Documentation
¶
Index ¶
- func ExtractRuleFrontmatterDescription(deps Deps, path string) string
- func FindRuleSpec(deps Deps, agentsHome, scope, name string) (*platform.RuleFileSpec, error)
- func NewListCmd(deps Deps) *cobra.Command
- func NewRemoveCmd(deps Deps) *cobra.Command
- func NewRulesCmd(deps Deps) *cobra.Command
- func NewShowCmd(deps Deps) *cobra.Command
- func RunList(deps Deps, scope string) error
- func RunRemove(deps Deps, scope, name string) error
- func RunShow(deps Deps, scope, name string) error
- type Deps
- type GlobalFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractRuleFrontmatterDescription ¶
ExtractRuleFrontmatterDescription parses YAML-style frontmatter at the head of a rule file and returns the `description:` value (case-insensitive). Returns the empty string if no frontmatter, no closing fence, no description key, or the file is unreadable. The file read goes through deps.io() (the ruleIO seam) so the read-error branch is fault-injectable. Exported so the parent-package shim and its tests can reach it.
func FindRuleSpec ¶
func FindRuleSpec(deps Deps, agentsHome, scope, name string) (*platform.RuleFileSpec, error)
FindRuleSpec resolves <scope>/<name> to a platform.RuleFileSpec, emitting hint-aware errors via deps.UsageError / deps.ErrorWithHints for the empty and not-found cases. Exported so the parent-package shim and its tests can reach it.
func NewListCmd ¶
NewListCmd / NewShowCmd / NewRemoveCmd build each subcommand standalone. Exported so the parent-package shim can wire them for cross-cutting RunE coverage tests.
func NewRemoveCmd ¶
func NewRulesCmd ¶
NewRulesCmd builds the `da rules` command tree from injected dependencies. Mirrors agents.NewAgentsCmd / skills.NewSkillsCmd: helpers come from Deps so the subpackage stays independent of the parent commands/ package. The cobra-tree assembly lives in cmdutil so mcp/settings/rules share one implementation; the per-resource description lives in a single CanonicalFileSpec built by canonicalSpec (see list.go).
func NewShowCmd ¶
func RunList ¶
RunList lists canonical rule files for the given scope. Exported so the shim in commands/rules.go can delegate to it.
Types ¶
type Deps ¶
type Deps struct {
Flags GlobalFlags
ErrorWithHints func(message string, hints ...string) error
UsageError func(message string, hints ...string) error
MaximumNArgsWithHints func(n int, hints ...string) cobra.PositionalArgs
ExactArgsWithHints func(n int, hints ...string) cobra.PositionalArgs
// IO is the filesystem + platform-lookup collaborator (seams.go). It is
// the interface-DI seam that replaced the legacy osReadFile /
// platform*CanonicalRuleFile package func-vars. Leave it nil in
// production and the zero-value data path; the io() accessor falls back
// to stdRuleIO{}. Tests inject a fake to fault the error branches.
IO ruleIO
}
Deps carries UX helpers from the commands package without an import cycle. Mirrors agents.Deps / skills.Deps so the extracted subpackages share the same shape. Only fields actually consumed by rules subcommands are present.
type GlobalFlags ¶
GlobalFlags mirrors the subset of commands.Flags used by rules subcommands. Kept as a parallel type to commands.GlobalFlags so the rules subpackage has no import on the parent commands/ package. Mirrors agents.GlobalFlags / skills.GlobalFlags.