Skip to main content

Crate kranz_cli

Crate kranz_cli 

Source
Expand description

kranz CLI — clap surface, command implementations, and terminal rendering.

The binary (src/main.rs) is a thin shim over this library so the integration tests can drive argument parsing, status rendering, control enqueueing and mission selection directly, without spawning processes (and without ever spawning a real claude binary).

Module map:

  • cli — the clap derive types (kranz <subcommand>)
  • commands — one function per subcommand + shared helpers
  • config_cmdkranz config show|set|unset|role (layered files + mid-mission role changes)
  • execkranz exec -f mission.md, fully headless missions for CI
  • hook_guardkranz hook-guard, the Claude Code lifecycle-hook command the engine installs into worker sessions (internal plumbing)
  • hook_statuskranz hook-status, the cursor CLI lifecycle-hook signal relay (internal plumbing, observational only)
  • otel — event-log-to-span mapping for the kranz otel sidecar
  • output — pure rendering (status tree, plan review, cost estimate)
  • ready — repo-readiness scorecard for onboarding
  • tail — the live event printer used by kranz run
  • planning_tui — the full-screen interactive planning UI

Modules§

amm
AMM-compatible readiness projection over kranz-native signals.
backlog
The backlog CLI: kranz ticket …, kranz draft, kranz queue, and the kranz work dispatcher (design: docs/backlog-and-slack.md).
cli
clap derive surface of the kranz binary (plan §5 Phase 1-2).
commands
One function per kranz subcommand, plus the shared helpers (config loading, backend construction, mission selection).
config_cmd
kranz config — inspect and edit the layered configuration.
exec
kranz exec -f <mission.md> — fully headless missions for CI (roadmap M5).
hook_guard
kranz hook-guard — the command Claude Code lifecycle hooks invoke inside worker sessions (ticket .kranz/tickets/claude-code-hook-gate-projection.md, KRZ-302; the engine side is kranz_engine::hook_gates, which also records the targeted hooks schema version).
hook_status
kranz hook-status — the command cursor CLI lifecycle hooks invoke inside agent sessions (ticket .kranz/tickets/agent-hooks-status-signals; the engine side is kranz_engine::hook_status, which also records the verified cursor hook surface this relays).
host_bridge
kranz serve --slack glue: the Slack bridge’s PlanningHost implemented over the SAME kranz_server::MissionHost the web UI serves from — one hosted-engine registry, two clients (docs/slack-management.md). This is the only place the two crates meet; kranz_slack stays server-free and kranz_server stays Slack-free.
init
Idempotent fresh-repository onboarding for kranz init.
merged_costs
Cost per merged change, grouped by repo across the M8 host catalog (ticket cost-per-merged-change, KRZ-329) — the same outcomes fold as kranz outcomes, with the grouping switched to the catalog. Each repo’s numbers come from kranz_engine::outcomes::compute_cost_per_merged_change: the cost fold over missions closed in the window for the numerator, and merged changes (the merged.rs landed/ancestry probe, derived at fold time, never stored) for the denominator — beside the autonomy ratio.
openspec
Import an OpenSpec change folder as a kranz ticket.
otel
kranz otel sidecar — read-side event-to-span mapping.
output
Pure terminal rendering: the status tree, the plan review, and the pre-mission cost estimate line. No I/O here — everything returns String so tests can assert on the exact output.
planning_tui
Full-screen interactive planning TUI (kranz plan on a real terminal).
ready
Repository readiness scanner for kranz ready.
tail
Live event printer for kranz run: a read-only tail of events.jsonl (never the lock — the engine is the single writer, §4.3).
ticket_notes
The kranz ticket note|notes surface (D-BW-3, adopted from beads): environment concerns (note author) and terminal rendering over kranz_engine::ticket_notes, which owns storage, the append-only durability idiom, and the draft-context folding — so every surface (CLI today, REST/Slack later) shares one implementation.