cli

package
v0.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli implements clawtool's user-facing subcommands.

Subcommand layout (ADR-004 §4):

clawtool init              write a default config if missing
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.

Index

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

func (a *App) Init() error

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) Path

func (a *App) Path() string

Path returns the resolved config path (override > default).

func (*App) Run

func (a *App) Run(argv []string) int

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

func (a *App) SecretsPath() string

SecretsPath returns the secrets-store path. Tests can shadow App.SecretsPath to point at a tmp file; production uses secrets.DefaultPath().

func (*App) SetSecretsPath

func (a *App) SetSecretsPath(p string)

SetSecretsPath lets tests redirect the secrets store to a tmp file.

func (*App) ToolsDisable

func (a *App) ToolsDisable(selector string) error

ToolsDisable writes tools.<selector>.enabled = false.

func (*App) ToolsEnable

func (a *App) ToolsEnable(selector string) error

ToolsEnable writes tools.<selector>.enabled = true.

func (*App) ToolsList

func (a *App) ToolsList() error

ToolsList prints registered core tools and their resolved enabled state.

func (*App) ToolsStatus

func (a *App) ToolsStatus(selector string) error

ToolsStatus prints the resolved enabled state for a selector and the rule that won, per ADR-004 §4.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL