Files
CodeWhale BotandClaude Opus 5 063f914f29 refactor: extract palette into its own crate and move command_safety to execpolicy
Two more modules out of the TUI monolith, on the same evidence as the
localization extraction: a dependency census that counted `crate::` mentions
inside doc comments and `#[cfg(test)]` blocks made these look entangled. With
comments and test code excluded, both had **zero** real production dependencies
on the rest of the crate.

`palette` -> `codewhale-palette` (5,850 lines). Theming and colour tokens, with
a wide but shallow consumer rewrite. No contrast or colour value changed while
moving; `scripts/export-design-tokens.py` and the `check:tokens` gate follow the
new path, and the gate passes with 64 tokens unchanged. Two OSC probes
(`osc11::query_terminal`, used by `tui::mark` for the kitty graphics query) had
to widen from `pub(crate)` to `pub` to cross the new crate line — a terminal
capability query, not a trust boundary, and stated here rather than left for a
reader to notice.

`command_safety` -> `crates/execpolicy` (2,951 lines). Deliberately **not** a
new crate: execpolicy already owns `ApprovalMode` and approval policy, and a
`codewhale-command-safety` beside it would be a second authority for one
concern. This is security-relevant code that classifies whether a shell command
is safe to run, so it moved unchanged — not one classification rule, allowlist
entry or matcher was touched. `crates/tui` already depended on execpolicy, so
this move *removes* a dependency edge rather than adding one, which is the ideal
shape for this work. The CI step that ran its tests under `codewhale-tui` now
picks them up from the `codewhale-execpolicy` run on the line below it.

crates/tui: 973,442 -> 957,746 lines across this session's three extractions.

Verified:
  cargo check --workspace --all-targets      0 errors, 0 unused warnings
  cargo test -p codewhale-palette            81 passed; 0 failed
  cargo test -p codewhale-execpolicy         188 + 1 + 5 passed; 0 failed
  cargo test -p codewhale-localization       51 passed; 0 failed
  scripts/check-tui-locale-parity.py         PASS
  scripts/export-design-tokens.py --check    up to date, 64 tokens

No new tests: the moved suites passing unchanged is the proof a move is correct.

Refs: Linear C03-C10 / SHA-6179, docs/design/TUI_DECONSTRUCTION.md.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01X57KRgwqYkmmtVQScczqiL
2026-09-09 22:59:41 -07:00
..