Documentation
¶
Overview ¶
Package navigate builds the map of a vault: what it holds, by folder, one line per note. An agent reads a file when it knows where the answer lives; with a knowledge base it can only know that if it can see what is there. Search answers a question already formed; the map lets the question form.
Index ¶
Constants ¶
const MaxLineRunes = 120
MaxLineRunes caps a note's one-line description so the map stays a map.
const MaxSummaryRunes = 256
MaxSummaryRunes caps a folder overview's summary: an L0 abstract, longer than a note's line. The 2026-10-03 probe measured whole overview lines.
const OverviewType = vault.OverviewType
OverviewType is the note type that describes the folder it sits in: its first sentence is the folder's summary in the map. Defined once, in vault.
const PathsField = "paths"
PathsField is the frontmatter field in which a note names the code it is about: globs relative to the repository root, `**` for any depth, a trailing `/` for everything under a folder, and `repo:` in front for another repo.
Variables ¶
This section is empty.
Functions ¶
func MarkCodeChanged ¶ added in v0.9.12
MarkCodeChanged sets CodeChanged on each note whose file was last committed before f was. Commit times on both sides, never file times: a checkout rewrites every mtime and would make every note look current. Without history on either side — a note not yet committed, a file outside a repository — there is nothing to compare, and the note is left unmarked.
Types ¶
type CodeChange ¶ added in v0.9.12
type CodeChange struct {
Commits int `json:"commits"`
Date string `json:"date"`
Latest string `json:"latest"`
// Summary is the sentence every surface shows — the text map and the
// code-map hook — so they cannot word the warning differently.
Summary string `json:"summary"`
}
CodeChange says the code a note covers was committed to after the note was. It is a prompt to check the note still holds, not a verdict: a broad glob changes for reasons that leave the note true.
type CodeFile ¶
type CodeFile struct {
Rel string
Repo string
// Root is the repository's folder, empty outside a repository. It is where
// the file's history is read.
Root string
}
CodeFile is the file an agent is reading: its path relative to its repository root, and the repository's name (the root folder's name).
func ResolveCodeFile ¶
ResolveCodeFile names a file the way `paths:` does: relative to the nearest enclosing repository root, and the repository by its origin remote (the root's folder name when it has none). Outside a repository the Rel is the file name alone and Repo is empty.
type Dir ¶
type Dir struct {
Path string `json:"path"`
Total int `json:"total"`
// Summary is what the folder covers: its overview note's first sentence,
// else its most used tags. SummaryFrom says which ("overview", "tags").
Summary string `json:"summary,omitempty"`
SummaryFrom string `json:"summary_from,omitempty"`
// Overview is the folder's overview note, kept out of Notes and Total.
Overview *Note `json:"overview,omitempty"`
Dirs []*Dir `json:"dirs,omitempty"`
Notes []Note `json:"notes,omitempty"`
}
Dir is a folder in the map. Total counts every note beneath it.
type Note ¶
type Note struct {
ID string `json:"id"`
Path string `json:"path"`
Title string `json:"title"`
Type string `json:"type"`
Status string `json:"status,omitempty"`
Line string `json:"line,omitempty"`
// CodeChanged is set by `tree --for` when the file was committed to after
// the note was.
CodeChanged *CodeChange `json:"code_changed,omitempty"`
// Tags and Mtime feed a folder's summary and doctor's staleness check;
// they are not part of the printed map.
Tags []string `json:"-"`
Mtime int64 `json:"-"`
}
Note is one entry in the map.
func Covering ¶
Covering returns the notes whose `paths:` cover f, each with its line. A status:draft note is omitted: the line is a slice of the body, and the code-map hook injects it as context. The full tree still lists the draft.
func CoveringIncludingDrafts ¶ added in v0.10.13
CoveringIncludingDrafts is Covering with the retrieval opt-in.
type RenderOptions ¶
type RenderOptions struct {
// Depth limits how many folder levels are listed; deeper folders are folded
// into their parent's count. Notes are listed only inside listed folders
// above the limit. 0 lists everything.
Depth int
// Brief prints titles and ids without the one-line descriptions.
Brief bool
}
RenderOptions shape the printed map.