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 helpersconfig_cmd—kranz config show|set|unset|role(layered files + mid-mission role changes)exec—kranz exec -f mission.md, fully headless missions for CIhook_guard—kranz hook-guard, the Claude Code lifecycle-hook command the engine installs into worker sessions (internal plumbing)hook_status—kranz hook-status, the cursor CLI lifecycle-hook signal relay (internal plumbing, observational only)otel— event-log-to-span mapping for thekranz otelsidecaroutput— pure rendering (status tree, plan review, cost estimate)ready— repo-readiness scorecard for onboardingtail— the live event printer used bykranz runplanning_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 thekranz workdispatcher (design: docs/backlog-and-slack.md). - cli
- clap derive surface of the
kranzbinary (plan §5 Phase 1-2). - commands
- One function per
kranzsubcommand, 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 iskranz_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 iskranz_engine::hook_status, which also records the verified cursor hook surface this relays).- host_
bridge kranz serve --slackglue: the Slack bridge’sPlanningHostimplemented over the SAMEkranz_server::MissionHostthe web UI serves from — one hosted-engine registry, two clients (docs/slack-management.md). This is the only place the two crates meet;kranz_slackstays server-free andkranz_serverstays 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 askranz outcomes, with the grouping switched to the catalog. Each repo’s numbers come fromkranz_engine::outcomes::compute_cost_per_merged_change: the cost fold over missions closed in the window for the numerator, and merged changes (themerged.rslanded/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 otelsidecar — 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 planon a real terminal). - ready
- Repository readiness scanner for
kranz ready. - tail
- Live event printer for
kranz run: a read-only tail ofevents.jsonl(never the lock — the engine is the single writer, §4.3). - ticket_
notes - The
kranz ticket note|notessurface (D-BW-3, adopted from beads): environment concerns (note author) and terminal rendering overkranz_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.