cmux-tui-hooks: status reports conflicting hook targets

Merged
TE
18d ago
+269-15

cmux agent hook status reported a hook target that install refuses as absent: a plugin file cmux-tui didn't write, a symlinked settings.json, or a directory where a plugin file goes. A caller then offered a plain Install that the installer rejects. Status now names the obstacle.

For each provider, status reports conflict when the target exists in a form install refuses, and unavailable when it can't be inspected. Both carry a machine-readable reason (symlink, not_a_file, not_a_directory, not_owned, unreadable) and a human-readable detail:

{"provider":"amp","path":"…/cmux-tui-journal.ts","state":"conflict","reason":"not_owned","detail":"… exists and is not owned by cmux-tui","changed":false}

cmux --json agent hook status emits this as-is. The checks live in a new status_conflict.rs along with ensure_replaceable_target, which they mirror, so lib.rs (a baselined god file) ends up shorter than its base. The check mirrors install's refusals: ensure_replaceable_target for the JSON formats and Antigravity, plus the plugin ownership check, plus Hermes's owned-directory rule. Rovo and Kimi have no refusal, so they never report a conflict. Install and uninstall behavior is unchanged, and a conflict is a status result, not an error, so status still exits 0.

One visible change: a symlinked ~/.claude/settings.json (or another symlinked JSON config) now reads conflict/symlink even if cmux hooks are inside it, since install and uninstall both refuse to touch it.

This is the first half of a stack. The cmux-next Settings "Agent integrations" helper builds on it.

Verification

  • Red first (23718d23ecc): cargo test -p cmux-tui-hooks status_reports on Linux, 2 failed (absent where conflict/unavailable was expected).
  • Green (1709c250217): cargo test -p cmux-tui-hooks, 44 passed; cargo clippy -p cmux-tui-hooks --all-targets and cargo fmt --check are clean.
  • Hosted: ./scripts/verify-cmux-tui-hosted.sh --filter status_reports passed on 4f962afe19f (Linux and macOS): https://github.com/manaflow-ai/cmux/actions/runs/39178494664. The first hosted run, on 1709c250217, failed only the Rust god-file ratchet, because lib.rs grew.

Changelog

  • Changed: cmux agent hook status reports conflict or unavailable, with a reason, when a file cmux didn't create blocks a hook install.

šŸ¤– Generated with Claude Code