Documentation
¶
Overview ¶
Package cli implements clawtool's user-facing subcommands.
Subcommand layout (ADR-004 §4):
clawtool init interactive wizard: pick recipes, apply to repo clawtool serve run as MCP server (delegates to internal/server) clawtool version print version clawtool help print top-level usage clawtool tools list list known tools and resolved enabled state clawtool tools enable <s> set tools.<selector>.enabled = true clawtool tools disable <s> set tools.<selector>.enabled = false clawtool tools status <s> print resolved state and the rule that won
Source / profile / group subcommands are scaffolded in main.go usage but not wired in v0.2 — they land alongside the source-instance feature.
Package cli — `clawtool doctor` is the one-command diagnostic. It surveys binary / agents / sources / recipes and prints a colour-coded checklist with suggested fix commands. Pure composition of existing internal helpers — no new deps.
Package cli — wizard-side install-prompt UX. Implements setup.Prompter (the abstraction the runner uses for missing prereqs) on top of huh + os/exec, plus the CommandRunner that actually shells out the per-platform install commands.
Kept in a separate file from init_wizard.go so the prompter + runner pair can be swapped or wrapped (e.g. by a dry-run wrapper) without touching the rest of the wizard. Test files inject a recordingRunner and a scriptedPrompter against the same interfaces — the wizard surface stays huh-bound, but every install decision is exercised in unit tests.
Package cli — `clawtool init` wizard. Two-scope welcome screen: repo (recipes) and user-global (agents + sources + secrets), with "both" and a read-only "show me what's available" preview path.
Honors --yes for non-interactive runs and falls back to the same path when stdin/stdout aren't TTYs (CI / containers).
Package cli — `clawtool` (no args) launches a friendly TUI landing menu that points at the most-used flows. Designed for users who'd rather not memorise subcommands; pure huh.Select.
Package cli — `clawtool skill` subcommand. Scaffolds and lists Agent Skills per the agentskills.io spec: a folder containing SKILL.md (required, with frontmatter name + description) plus optional scripts/, references/, assets/ subdirectories.
The standard was authored by Anthropic and is now open. clawtool's skill subcommand is the bootstrap layer — `clawtool skill new` is the analogue of `npm init` for Agent Skills.
Index ¶
- type App
- func (a *App) Init() error
- func (a *App) Path() string
- func (a *App) RecipeApply(name string, kvs []string) error
- func (a *App) RecipeList(category string) error
- func (a *App) RecipeStatus(name string) error
- func (a *App) Run(argv []string) int
- func (a *App) SecretsPath() string
- func (a *App) SetSecretsPath(p string)
- func (a *App) ToolsDisable(selector string) error
- func (a *App) ToolsEnable(selector string) error
- func (a *App) ToolsList() error
- func (a *App) ToolsStatus(selector string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
// ConfigPath overrides the default config location. Empty = config.DefaultPath().
ConfigPath string
// contains filtered or unexported fields
}
App holds CLI dependencies. Stdout/stderr are injected so tests can capture.
func New ¶
func New() *App
New returns an App writing to the process's stdout/stderr and using the default config path.
func (*App) Init ¶
Init writes a default config to disk if the file does not already exist. Returns an "already exists" error if it does — callers can ignore that.
func (*App) RecipeApply ¶ added in v0.9.0
RecipeApply runs the recipe against the current working directory. Options are key=value strings; comma-separated values become []string. v0.9 keeps options simple — wizard / MCP path will pass richer types as the surface evolves.
func (*App) RecipeList ¶ added in v0.9.0
RecipeList prints every registered recipe grouped by category with its Detect state in the cwd.
func (*App) RecipeStatus ¶ added in v0.9.0
RecipeStatus prints the Detect output for one recipe or all recipes.
func (*App) Run ¶
Run dispatches argv (excluding program name) to the right subcommand. Returns the exit code; 0 = success, 2 = usage error, 1 = runtime failure.
func (*App) SecretsPath ¶
SecretsPath returns the secrets-store path. Tests can shadow App.SecretsPath to point at a tmp file; production uses secrets.DefaultPath().
func (*App) SetSecretsPath ¶
SetSecretsPath lets tests redirect the secrets store to a tmp file.
func (*App) ToolsDisable ¶
ToolsDisable writes tools.<selector>.enabled = false.
func (*App) ToolsEnable ¶
ToolsEnable writes tools.<selector>.enabled = true.
func (*App) ToolsStatus ¶
ToolsStatus prints the resolved enabled state for a selector and the rule that won, per ADR-004 §4.