Documentation
¶
Overview ¶
Package manifest reads and writes the PromptVM context-sync manifest that declares which workspace/directory a repo syncs to and what gets captured.
Three scopes mirror Claude Code's settings hierarchy:
local → .promptvm/config.local.json (gitignored, machine-specific) project → .promptvm/config.json (committable, shared with the team) user → <os.UserConfigDir()>/promptvm/config.json (global default)
Resolution precedence is local → project → user (most specific wins). Scalar fields take the most-specific non-empty value. Capture-policy arrays (events, excludePaths) REPLACE rather than concat — the most-specific scope that sets them wins, so a repo can drop PreCompact (DX-5). Only the scope that explicitly declares an array overrides; an absent array (JSON `null`) inherits from the next-broader scope.
Index ¶
Constants ¶
const SchemaVersion = "1.0"
SchemaVersion is the current manifest schema version.
Variables ¶
var ( DefaultEvents = []string{"SessionEnd", "PreCompact"} DefaultMode = "summary" DefaultExcludePaths = []string{"**/.env*", "secrets/**", ".git/**"} DefaultGovernance = "inherit" )
Default capture policy values, applied when no scope sets them.
Functions ¶
func Path ¶
Path returns the manifest file path for the given scope. The project and local paths are anchored at repoRoot (or cwd when repoRoot is "").
Types ¶
type Capture ¶
type Capture struct {
Enabled *bool `json:"enabled,omitempty"`
Events []string `json:"events,omitempty"`
Mode string `json:"mode,omitempty"`
ExcludePaths []string `json:"excludePaths,omitempty"`
Redact *bool `json:"redact,omitempty"`
Governance string `json:"governance,omitempty"`
}
Capture is the capture-policy block of a manifest.
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schemaVersion,omitempty"`
Workspace string `json:"workspace,omitempty"`
Directory string `json:"directory,omitempty"`
Capture *Capture `json:"capture,omitempty"`
}
Manifest is the on-disk shape of a single scope's config file. Pointer and nil-slice fields let Resolve distinguish "unset" (inherit) from "set".
type Resolved ¶
type Resolved struct {
Workspace string
Directory string
Enabled bool
Events []string
Mode string
ExcludePaths []string
Redact bool
Governance string
}
Resolved is the fully-defaulted, flattened view used by the runtime after merging all scopes. Every field carries a concrete value.
func Resolve ¶
Resolve merges the user → project → local scopes (broad to specific) into a fully-defaulted Resolved. repoRoot anchors the project/local files. Missing files are skipped. Capture-policy arrays REPLACE (most-specific wins).
func (*Resolved) EventSelected ¶
EventSelected reports whether the resolved policy captures on the given Claude Code hook event name.