claw-code/tests
YeonGyu-Kim 01dca90e95 fix: #167 — show-command and show-tool now accept --output-format flag; CLI parity with session-lifecycle family
Closes the inspect-capability parity gap: show-command and show-tool were
the only discovery/inspection CLI commands lacking --output-format support,
making them outliers in the ecosystem that already had unified JSON
contracts across list-sessions, load-session, delete-session, and
flush-transcript (#160/#165/#166).

Concrete additions:

- show-command: --output-format {text,json}
- show-tool: --output-format {text,json}

JSON envelope shape (found case):
  {name, found: true, source_hint, responsibility}

JSON envelope shape (not-found case):
  {name, found: false, error: {kind:'command_not_found'|'tool_not_found',
                               message, retryable: false}}

Exit codes:
  0 = success
  1 = not found

Backward compatibility:
  - Default (no --output-format) is 'text' (unchanged)
  - Text output byte-identical to pre-#167 (three newline-separated lines)

Tests (10 new, test_show_command_tool_output_format.py):
  - TestShowCommandOutputFormat (5): found + not-found in JSON; text mode
    backward compat; text is default
  - TestShowToolOutputFormat (3): found + not-found in JSON; text mode
    backward compat
  - TestShowCommandToolFormatParity (2): both accept same flag choices;
    consistent JSON envelope shape

Full suite: 114 → 124 passing, zero regression.

Closes ROADMAP #167.

Why this matters:
  Before: Claws calling show-command/show-tool had to parse human-readable
  prose output via regex, with no structured error signal.
  After: Same envelope contract as load-session and friends: JSON-first,
  typed errors, machine-parseable.

Related clusters:
  - Session-lifecycle CLI parity family (#160, #165, #166, #167)
  - Machine-readable error contracts (same vein as #162 atomicity + #164
    cancellation state-safety: structured boundaries for orchestration)
2026-04-22 18:21:38 +09:00
..
test_flush_transcript_cli.py fix: #166 — flush-transcript now accepts --directory / --output-format / --session-id; session-creation command parity with #160/#165 lifecycle triplet 2026-04-22 18:04:25 +09:00
test_load_session_cli.py fix: #165 — load-session CLI now parity-matches list/delete (--directory, --output-format, typed JSON errors) 2026-04-22 17:44:48 +09:00
test_porting_workspace.py feat(#160): wire claw list-sessions and delete-session CLI commands 2026-04-22 17:16:53 +09:00
test_run_turn_loop_cancellation.py fix: #164 Stage A — cooperative cancellation via cancel_event in submit_message 2026-04-22 18:14:14 +09:00
test_run_turn_loop_continuation.py fix: #163 — remove [turn N] suffix pollution from run_turn_loop; file #164 timeout-cancellation followup 2026-04-22 17:37:22 +09:00
test_run_turn_loop_permissions.py fix: #159 — run_turn_loop no longer hardcodes empty denied_tools; permission denials now parity-match bootstrap_session 2026-04-22 17:50:21 +09:00
test_run_turn_loop_timeout.py fix: #164 Stage A — cooperative cancellation via cancel_event in submit_message 2026-04-22 18:14:14 +09:00
test_session_store.py fix(#160): harden delete_session contract — idempotency, race-safety, typed partial-failure 2026-04-22 17:11:26 +09:00
test_show_command_tool_output_format.py fix: #167 — show-command and show-tool now accept --output-format flag; CLI parity with session-lifecycle family 2026-04-22 18:21:38 +09:00
test_submit_message_budget.py fix: #162 — budget-overflow no longer corrupts session state in submit_message 2026-04-22 17:29:55 +09:00
test_submit_message_cancellation.py fix: #164 Stage A — cooperative cancellation via cancel_event in submit_message 2026-04-22 18:14:14 +09:00