Documentation
¶
Overview ¶
Package history keeps a private, automatic git history of a Volt project: every save, AI edit and outside change becomes a commit whose author says who made it (you, Volt Assistant, an AI app, or a change outside the IDE).
The repository lives in <project>/.volt/history with the project folder as its work tree, so it never touches a git repository the user keeps themselves. It is ordinary git (go-git, no git binary needed): log, diff and blame work, and it can be exported later.
Index ¶
- func Tracked(rel string) bool
- type BlameLine
- type Change
- type Entry
- type FileChange
- type Repo
- func (h *Repo) Blame(file string) ([]BlameLine, error)
- func (h *Repo) Log(file string, limit int) ([]Entry, error)
- func (h *Repo) Record(author, message string, coalesce ...bool) (string, error)
- func (h *Repo) Restore(hash, file, author string) (string, error)
- func (h *Repo) Show(hash string) (*Change, error)
- func (h *Repo) Undo(hash, author string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlameLine ¶
type BlameLine struct {
Line int `json:"line"`
Hash string `json:"hash"`
Author string `json:"author"`
When string `json:"when"`
Message string `json:"message"`
}
BlameLine says which change last touched a line.
type Change ¶
type Change struct {
Entry
Changes []FileChange `json:"changes"`
}
Change is a recorded change with its file contents.
type Entry ¶
type Entry struct {
Hash string `json:"hash"`
Author string `json:"author"`
When string `json:"when"`
Message string `json:"message"`
Added int `json:"added"`
Removed int `json:"removed"`
Files []string `json:"files"`
}
Entry is one recorded change.
type FileChange ¶
type FileChange struct {
Path string `json:"path"`
Before string `json:"before"`
After string `json:"after"`
Status string `json:"status"` // added | removed | modified
}
FileChange is one file's content before and after a change ("" = absent).
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is one project's history.
func (*Repo) Log ¶
Log lists recorded changes, newest first, optionally only those touching file (a path relative to the project).
func (*Repo) Record ¶
Record commits the project's current files if anything changed. It returns the new commit, or "" when there was nothing to record. With coalesce, a change by the same author as the last one, within a few minutes, is folded into it.
func (*Repo) Restore ¶
Restore puts the project's files (or just file) back as they were right after change hash, and records that as a new change by author.