Documentation
¶
Index ¶
- Constants
- func AppendEvent(wrkHome string, ev Event) error
- func AutoRecord(wrkHome, workDir string) (string, error)
- func FindProjectsByBasename(wrkHome, basename string) ([]string, error)
- func ListProjects(wrkHome string) ([]string, error)
- func NormalizePath(path string) string
- func RecordProject(wrkHome, path, source string) error
- func RemoveProject(wrkHome, path string) (bool, error)
- func ResetEventsIfDoctest(wrkHome string) error
- func ResolveMainRepoForWorkDir(workDir string) (string, bool)
- func SaveProjects(wrkHome string, pf ProjectsFile) error
- type Event
- type Project
- type ProjectsFile
Constants ¶
const ( SourceAuto = "auto" SourceManual = "manual" SourceScan = "scan" )
Variables ¶
This section is empty.
Functions ¶
func AppendEvent ¶
AppendEvent appends one JSON line to events.jsonl.
func AutoRecord ¶
AutoRecord records the main repo for workDir with source "auto" when git resolves successfully.
func FindProjectsByBasename ¶
FindProjectsByBasename returns saved project paths whose final path component equals basename, sorted lexicographically.
func ListProjects ¶
ListProjects returns recorded project paths sorted lexicographically.
func NormalizePath ¶
NormalizePath returns an absolute path, resolving symlinks when possible.
func RecordProject ¶
RecordProject appends a project when absent. Re-adding is idempotent; the first recorded source wins.
func RemoveProject ¶
RemoveProject deletes the project entry matching normalized path. Returns true when an entry was removed, false when no matching entry exists.
func ResetEventsIfDoctest ¶
ResetEventsIfDoctest truncates events.jsonl when DOCTEST_SESSION_ID is set so doctest assertions observe only the current invocation's event.
func ResolveMainRepoForWorkDir ¶
ResolveMainRepoForWorkDir returns the main repo for workDir when it exists and is inside a git work tree.
func SaveProjects ¶
func SaveProjects(wrkHome string, pf ProjectsFile) error
SaveProjects writes projects.json under wrkHome.
Types ¶
type Event ¶
type Event struct {
TS string `json:"ts"`
Command string `json:"command"`
WorkDir string `json:"work_dir"`
MainRepo string `json:"main_repo"`
Args []string `json:"args"`
ExitCode int `json:"exit_code"`
}
Event is one append-only events.jsonl record.
type Project ¶
type Project struct {
Path string `json:"path"`
AddedAt string `json:"added_at"`
Source string `json:"source"`
}
Project is one recorded main repository entry.
type ProjectsFile ¶
ProjectsFile is the on-disk projects.json schema.
func LoadProjects ¶
func LoadProjects(wrkHome string) (ProjectsFile, error)
LoadProjects reads projects.json, returning an empty file when absent.