Documentation
¶
Index ¶
- Variables
- type Checkpoint
- type Freshness
- type Manager
- func (m *Manager) BumpRevision(changedPaths ...string) (oldRevision, newRevision string)
- func (m *Manager) Changes() []string
- func (m *Manager) ChangesResponse() protocol.ChangesResponse
- func (m *Manager) Checkpoint(note string) Checkpoint
- func (m *Manager) Diff(target string) (protocol.DiffResponse, error)
- func (m *Manager) DiffSince(target string, since string) (protocol.DiffResponse, error)
- func (m *Manager) DiffSummary() []protocol.ChangedFile
- func (m *Manager) DirtyPaths() ([]string, error)
- func (m *Manager) FileAtHead(path string) ([]byte, bool)
- func (m *Manager) Freshness(indexedCommit string) Freshness
- func (m *Manager) HeadCommit() (string, error)
- func (m *Manager) RevertCheckpoint(id string) (Checkpoint, bool)
- func (m *Manager) Revision() string
- func (m *Manager) Root() string
- func (m *Manager) SymbolHistory(path string, startLine int, endLine int, limit int, includePatch bool) (protocol.HistoryResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoCommits = errors.New("repository has no commits yet") ErrNotARepository = errors.New("not a git repository") )
ErrNoCommits and ErrNotARepository replace raw git stderr for the two ways resolving HEAD legitimately fails.
This matters more than it looks. Freshness puts the error text into every inspect and outline response, so on a repository with no commits yet — a brand-new one, the most common thing there is — jade was emitting four lines of `git rev-parse`'s "ambiguous argument 'HEAD'" diagnostic at the top of every single response. Localized, too: on the machine this was found on it came back in German, which no amount of downstream string matching could have coped with. Found live while verifying 11.3 against a fresh repo.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
Checkpoint captures workspace state for later restore.
type Freshness ¶
type Freshness struct {
IndexedCommit string
HeadCommit string
Drifted bool
ChangedPaths []string
DirtyPaths []string
Unknown string
}
Freshness reports whether caller-visible workspace state drifted relative to an index snapshot commit.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks in-memory scaffold state. The concrete implementation will persist revisions and map to git worktrees in later phases.
func (*Manager) BumpRevision ¶
func (*Manager) Changes ¶
Changes returns every path this workspace considers touched: paths jade itself mediated an edit for (normalized back to real file paths, since a replace_symbol edit is tracked under a "path::Name@line" key), unioned with whatever git actually sees as dirty. Without the git union, an edit made outside jade (e.g. through a host's own file tools) would be invisible here even though the workspace genuinely changed.
func (*Manager) ChangesResponse ¶
func (m *Manager) ChangesResponse() protocol.ChangesResponse
ChangesResponse assembles the full changes() payload — revision, tracked paths, and a numstat-style diff summary — in one place so transports don't duplicate this assembly.
func (*Manager) Checkpoint ¶
func (m *Manager) Checkpoint(note string) Checkpoint
func (*Manager) Diff ¶
func (m *Manager) Diff(target string) (protocol.DiffResponse, error)
Diff returns the actual patch text for the workspace or one target path — docs/scope.md §22's diff(target?), and the "expand change" step of §13's progressive disclosure: changes() says how much moved, diff() says what.
An empty target diffs the whole working tree. Untracked files are included in both modes; `git diff HEAD` cannot see them, and a newly created file showing an empty patch would be a silent lie about what changed.
func (*Manager) DiffSince ¶
DiffSince diffs against an arbitrary git revision instead of HEAD.
An empty since is exactly Diff's behaviour. A non-empty one answers "what has this branch done", which the working-tree diff cannot express once any of the work is committed — a task that commits midway disappears from `git diff HEAD` while being precisely what the caller wanted to see.
Untracked files are deliberately *not* folded in here the way Diff does for the working tree: against an explicit revision the caller asked what changed between two committed states, and silently adding files that are in neither would answer a different question.
func (*Manager) DiffSummary ¶
func (m *Manager) DiffSummary() []protocol.ChangedFile
DiffSummary returns a numstat-style per-file added/removed line count summary of the workspace's changes against HEAD. It is deliberately cheap and never throws (a git failure degrades to an empty summary rather than propagating an error), and gives per-file counts rather than full diff content. Tracked changes come from "git diff --numstat HEAD"; untracked new files (which numstat omits entirely) are counted separately as fully-added.
func (*Manager) DirtyPaths ¶
func (*Manager) FileAtHead ¶
FileAtHead returns a file's committed content at HEAD. The bool is false when the path is not in HEAD at all — a newly created file — which is a different situation from an empty file and must not be collapsed into one: the symbol delta treats "absent at HEAD" as "every symbol is new".
func (*Manager) HeadCommit ¶
HeadCommit resolves HEAD, or reports in one short line why it cannot.
--verify --quiet makes git exit non-zero with *empty* output instead of printing its multi-line diagnostic, so the distinction below is drawn from exit status rather than from parsing locale-dependent text.
func (*Manager) RevertCheckpoint ¶
func (m *Manager) RevertCheckpoint(id string) (Checkpoint, bool)
func (*Manager) Root ¶
Root returns the workspace's root directory, for callers (such as the validation job runner) that need to execute commands against it.
func (*Manager) SymbolHistory ¶
func (m *Manager) SymbolHistory(path string, startLine int, endLine int, limit int, includePatch bool) (protocol.HistoryResponse, error)
SymbolHistory returns the commits that touched one line range — docs/scope.md §18's `history(SessionManager.refreshSession)` instead of `git log -p` over a whole file.
This is `git log -L <start>,<end>:<file>`, a real git primitive that follows the range backwards through history rather than a line-number guess against old revisions. Without a patch it emits commits only, which is the progressive-disclosure default: the commit list answers "why does this exist", and the patch is the follow-up question.