Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentHash ¶
ContentHash computes the sha256 hex digest of content bytes.
Types ¶
type ConflictAction ¶ added in v0.2.0
type ConflictAction int
ConflictAction describes the resolution the user selected for a single conflict-file entry during the cinematic ConflictsStage. Consumed by applyCinematicConflictPicks in cmd/add.go, which translates the per-file action into the WriteResult.ForceSelected + optional .bak write that the legacy buildConflictSteps / applyConflictPicks primitives perform as a bulk two-step form.
const ( // ConflictActionKeep keeps the user's local edits — no write happens. ConflictActionKeep ConflictAction = iota // ConflictActionOverwrite overwrites the local file with the source // content. No backup is created. ConflictActionOverwrite // ConflictActionBackup writes the current local file to `<path>.bak` // and then overwrites with source content. ConflictActionBackup )
type CustomItemMeta ¶
type CustomItemMeta struct {
DisplayName string `yaml:"display_name,omitempty"`
Description string `yaml:"description"`
Event string `yaml:"event,omitempty"` // sensors only
Matcher string `yaml:"matcher,omitempty"` // sensors only
Frequency string `yaml:"frequency,omitempty"` // routines only
}
CustomItemMeta holds metadata for user-created custom items (parsed from frontmatter).
type InstalledAgent ¶
type InstalledAgent struct {
AgentType string `yaml:"agent_type"`
Workspace string `yaml:"workspace"`
Skills []string `yaml:"skills"`
Workflows []string `yaml:"workflows"`
Protocols []string `yaml:"protocols"`
Sensors []string `yaml:"sensors"`
Routines []string `yaml:"routines"`
CustomItems map[string]*CustomItemMeta `yaml:"custom_items,omitempty"`
}
InstalledAgent represents an agent installed in a project.
type LockFile ¶
LockFile tracks all files generated by Bonsai.
func LoadLockFile ¶
LoadLockFile reads the lock file from disk. Returns a new empty lock file if the file doesn't exist (first run / migration case).
func (*LockFile) IsModified ¶
IsModified checks whether the file on disk differs from the lock file hash. Returns exists=false if the file is not on disk (safe to write). Returns modified=true if the file exists but differs from the lock hash, or if the file exists but has no lock entry (conservative: treat as user-owned).
type ProjectConfig ¶
type ProjectConfig struct {
ProjectName string `yaml:"project_name"`
Description string `yaml:"description,omitempty"`
DocsPath string `yaml:"docs_path,omitempty"`
Scaffolding []string `yaml:"scaffolding,omitempty"`
Agents map[string]*InstalledAgent `yaml:"agents,omitempty"`
}
ProjectConfig is the root project config serialized to .bonsai.yaml.
func Load ¶
func Load(path string) (*ProjectConfig, error)
Load reads a ProjectConfig from a YAML file.
func (*ProjectConfig) Save ¶
func (c *ProjectConfig) Save(path string) error
Save writes the config to a YAML file.
func (*ProjectConfig) Validate ¶ added in v0.4.0
func (c *ProjectConfig) Validate() error
Validate checks the project config for required fields, valid workspace paths, and the absence of shell metacharacters in user-controlled strings. Run after YAML unmarshalling so callers fail fast on hand-edited configs.
Workspace + DocsPath are validated through wsvalidate (same rules as the init/add TUI flows). The shell-metachar scan covers ProjectName, every agent name (map key), every agent.Workspace, and DocsPath — these strings flow into shell scripts via sensor templates, so a stray `"` or `$` would either break the script or open a substitution channel.