Documentation
¶
Overview ¶
Package cli implements a composer.Composer backed by the operator's resident coding-agent CLI (Claude Code or Codex) running under its own logged-in SUBSCRIPTION — no API key is minted or passed. It shells out to the CLI with a schema-forcing structured-output mode, extracts the schema-valid JSON object the CLI emits, and hands it to composer.ProposeWithRetry for the canonical parse/validate/bounded-retry/fail-closed loop.
Trust model: the child process runs read-only — no MUTATING tools (no edits, writes, or command execution) — so a prompt-injected attachment cannot get the CLI to take an action against the host. (Read-only tool use, e.g. file reads, may still occur; it is bounded by a small --max-turns cap and is immaterial here — the CLI is used purely as a structured-output text generator and its output is Grade+Clamped downstream.) This is WARDYN-ENFORCED per tool by an explicit least-privilege flag, NOT left to the CLI's ambient default: codex gets `--sandbox read-only --ask-for-approval never`; claude gets `--permission-mode plan`. ANTHROPIC_API_KEY is scrubbed from the child env for the claude tool so it uses the subscription session (never an API key) and never bills/leaks one.
Index ¶
Constants ¶
const ( ToolClaude = "claude" ToolCodex = "codex" )
Tool identifies which resident CLI to shell out to.
Variables ¶
This section is empty.
Functions ¶
func NewComposer ¶
NewComposer validates cfg and returns a Composer that shells out to the operator's resident subscription CLI. It does NOT verify the binary exists at construction time (the operator may install it later / it may live only in the daemon's PATH); a missing binary surfaces as a clear error on Propose.
Types ¶
type Config ¶
type Config struct {
// Tool selects the resident CLI: "claude" (Claude Code) or "codex".
Tool string
// Model is the model id passed to the CLI (e.g. "claude-sonnet-4-5",
// "gpt-5"). Empty lets the CLI use its own configured default.
Model string
// BinPath is the path to the CLI binary. Empty defaults to the tool name
// ("claude" / "codex"), resolved against PATH.
BinPath string
// Timeout bounds a single CLI invocation. Zero uses defaultTimeout.
Timeout time.Duration
// MaxAttempts bounds the parse/validate/retry loop. <1 uses
// composer.DefaultMaxAttempts.
MaxAttempts int
}
Config configures the CLI composer backend.