claw-code/src
YeonGyu-Kim 60925fa9f7 fix: #168 — exec-command / exec-tool / route / bootstrap now accept --output-format; CLI family JSON parity COMPLETE
Extends the #167 inspect-surface parity fix to the four remaining CLI
outliers: the commands claws actually invoke to DO work, not just
inspect state. After this commit, the entire claw-code CLI family speaks
a unified JSON envelope contract.

Concrete additions:
- exec-command: --output-format {text,json}
- exec-tool: --output-format {text,json}
- route: --output-format {text,json}
- bootstrap: --output-format {text,json}

JSON envelope shapes:

exec-command (handled):
  {name, prompt, source_hint, handled: true, message}
exec-command (not-found):
  {name, prompt, handled: false,
   error: {kind:'command_not_found', message, retryable: false}}

exec-tool (handled):
  {name, payload, source_hint, handled: true, message}
exec-tool (not-found):
  {name, payload, handled: false,
   error: {kind:'tool_not_found', message, retryable: false}}

route:
  {prompt, limit, match_count, matches: [{kind, name, score, source_hint}]}

bootstrap:
  {prompt, limit,
   setup: {python_version, implementation, platform_name, test_command},
   routed_matches: [{kind, name, score, source_hint}],
   command_execution_messages: [str],
   tool_execution_messages: [str],
   turn: {prompt, output, stop_reason},
   persisted_session_path}

Exit codes (unchanged from pre-#168):
  0 = success
  1 = exec not-found (exec-command, exec-tool only)

Backward compatibility:
  - Default (no --output-format) is 'text'
  - exec-command/exec-tool text output byte-identical
  - route text output: unchanged tab-separated kind/name/score/source_hint
  - bootstrap text output: unchanged Markdown runtime session report

Tests (13 new, test_exec_route_bootstrap_output_format.py):
  - TestExecCommandOutputFormat (3): handled + not-found JSON; text compat
  - TestExecToolOutputFormat (3): handled + not-found JSON; text compat
  - TestRouteOutputFormat (3): JSON envelope; zero-matches case; text compat
  - TestBootstrapOutputFormat (2): JSON envelope; text-mode Markdown compat
  - TestFamilyWideJsonParity (2): parametrised over ALL 6 family commands
    (show-command, show-tool, exec-command, exec-tool, route, bootstrap) —
    every one accepts --output-format json and emits parseable JSON; every
    one defaults to text mode without a leading {. One future regression on
    any family member breaks this test.

Full suite: 124 → 137 passing, zero regression.

Closes ROADMAP #168.

This completes the CLI-wide JSON parity sweep:
- Session-lifecycle family: #160 (list/delete), #165 (load), #166 (flush)
- Inspect family: #167 (show-command, show-tool)
- Work-verb family: #168 (exec-command, exec-tool, route, bootstrap)

ENTIRE CLI SURFACE is now machine-readable via --output-format json with
typed errors, deterministic exit codes, and consistent envelope shape.
Claws no longer need to regex-parse any CLI output.

Related clusters:
  - Clawability principle: 'machine-readable in state and failure modes'
    (ROADMAP top-level). 9 pinpoints in this cluster; all now landed.
  - Typed-error envelope consistency: command_not_found / tool_not_found /
    session_not_found / session_load_failed all share {kind, message,
    retryable} shape.
  - Work-verb semantics: exec-* surfaces expose 'handled' boolean (not
    'found') because 'not handled' is the operational signal — claws
    dispatch on whether the work was performed, not whether the entry
    exists in the inventory.
2026-04-22 18:34:26 +09:00
..
assistant chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
bootstrap chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
bridge chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
buddy chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
cli chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
components chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
constants chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
coordinator chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
entrypoints chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
hooks chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
keybindings chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
memdir chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
migrations chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
moreright chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
native_ts chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
outputStyles chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
plugins chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
reference_data Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
remote chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
schemas chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
screens chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
server chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
services chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
skills chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
state chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
types chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
upstreamproxy chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
utils chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
vim chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
voice chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
QueryEngine.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
Tool.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
__init__.py feat(#160): wire claw list-sessions and delete-session CLI commands 2026-04-22 17:16:53 +09:00
_archive_helper.py chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
bootstrap_graph.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
command_graph.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
commands.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
context.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
costHook.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
cost_tracker.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
deferred_init.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
dialogLaunchers.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
direct_modes.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
execution_registry.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
history.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
ink.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
interactiveHelpers.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
main.py fix: #168 — exec-command / exec-tool / route / bootstrap now accept --output-format; CLI family JSON parity COMPLETE 2026-04-22 18:34:26 +09:00
models.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
parity_audit.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
permissions.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
port_manifest.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
prefetch.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
projectOnboardingState.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
query.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
query_engine.py fix: #164 Stage A — cooperative cancellation via cancel_event in submit_message 2026-04-22 18:14:14 +09:00
remote_runtime.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
replLauncher.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
runtime.py fix: #164 Stage A — cooperative cancellation via cancel_event in submit_message 2026-04-22 18:14:14 +09:00
session_store.py fix(#160): harden delete_session contract — idempotency, race-safety, typed partial-failure 2026-04-22 17:11:26 +09:00
setup.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
system_init.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
task.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
tasks.py Make the repository's primary source tree genuinely Python 2026-03-31 07:17:34 -07:00
tool_pool.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
tools.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00
transcript.py Rewriting Project Claw Code - Python port with Rust on the way 2026-03-31 08:16:20 -07:00