Documentation
¶
Overview ¶
Package projects discovers project roots under configured scan roots and tracks which ones the user keeps visible. Discovery is depth-1: a direct child of a scan root that contains one of the configured marker paths (default .docs/ai) is a project. Enabled/disabled state lives in an app-owned JSON file (projects.json); newly discovered projects are enabled by default, so the user unchecks to hide rather than checks to show.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatePath ¶
func StatePath() string
StatePath is the default location of the project-state file. It sits beside the config file — config.Dir() already resolves the HARNESS_DECK_CONFIG override and $XDG_CONFIG_HOME, so state and config always move together (handy for the fixture-based manual test setup).
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager discovers projects and persists which ones are hidden.
func NewManager ¶
NewManager builds a Manager. scanRoots are directories scanned depth-1 for projects; explicit are project roots included unconditionally; markers are the paths whose presence marks a child as a project (empty means the .docs/ai default); statePath is the JSON file recording hidden projects.
func (*Manager) Discovered ¶
Discovered returns every project found, sorted by name, with Enabled reflecting the persisted hidden set.
func (*Manager) Fingerprint ¶
Fingerprint is a digest of discovered projects, their visibility, and the size and mtime of each project's .docs/ai docs. The watcher compares it between polls to decide when to push an SSE refresh.
func (*Manager) Reorder ¶ added in v0.1.3
Reorder records the user's preferred display order for discovered projects and persists it. Every name must match a currently discovered project so stale browser state can't smuggle ghost entries into the order. The hidden set is preserved untouched — visibility and order are independent.
func (*Manager) SetRoots ¶ added in v0.2.7
SetRoots replaces the discovery roots and markers — used when config.json changes at runtime (e.g. `harness-deck register` added a project) so the watcher picks up the new roots without a restart. The next Discovered/Enabled recomputes against them. Safe for concurrent use; copies the inputs so a later mutation of the caller's slices can't alias the Manager's state.
type Project ¶
type Project struct {
Name string `json:"name"` // display name (directory basename; disambiguated with a parent-dir hint on collision) — also the persistence key
Path string `json:"path"` // absolute path to the project root
Enabled bool `json:"enabled"` // false when the user has hidden it
}
Project is one discovered project root.