history

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tracked

func Tracked(rel string) bool

Tracked says whether a project file belongs in the history: only the project's own files — its .volt program files and volt.toml. Libraries, SDK copies, build output, editor/AI settings and every hidden file are the platform's to manage, so they are never recorded.

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 Open

func Open(dir string) (*Repo, error)

Open opens (creating on first use) the history of the project in dir.

func (*Repo) Blame

func (h *Repo) Blame(file string) ([]BlameLine, error)

Blame traces every line of file (as last recorded) to its change.

func (*Repo) Log

func (h *Repo) Log(file string, limit int) ([]Entry, error)

Log lists recorded changes, newest first, optionally only those touching file (a path relative to the project).

func (*Repo) Record

func (h *Repo) Record(author, message string, coalesce ...bool) (string, error)

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

func (h *Repo) Restore(hash, file, author string) (string, error)

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.

func (*Repo) Show

func (h *Repo) Show(hash string) (*Change, error)

Show returns a change and every file it touched, before and after.

func (*Repo) Undo

func (h *Repo) Undo(hash, author string) (string, error)

Undo reverses one change, file by file, as long as those files haven't changed since; it records the reversal as a new change by author.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL