refactor: extract @agent-device/command-output

Merged
TH
20h ago
+663-277

Summary

Extracts the shared CLI/MCP presentation (family formatters, warning routing, color, human error lines, serialization) into private @agent-device/command-output. Sources moved with git mv. command-surface gains no presentation import; MCP stays root. 82 files, +663/āˆ’277 rename-aware.

  • Purity: the package reads no process member (R86, including named imports). printHumanError, printJson and the stderr progress sink stay root; stdout/stderrIsTTY arrive as input.
  • Entry: exactly ".", explicit names, including FormatCliOutputParams. formatCliOutput and the diff renderers load the formatter tables on first call.
  • Deep callers render through production formatCliOutput.
  • Review fixes kept: bounded warning-collapse regex (CodeQL), -i conformance samples, named-import guard.
  • Rebase: onto ff8c2285c8 (#4121 client extraction). Conflicts were manifests, entry pins, cli-runner.ts and render-fixtures.ts; both packages stay registered. Lockfile regenerated with pnpm (only the new importer). range-diff: the last four commits are unchanged; one added commit merges a duplicate import.

Eager closure at the old base: cli.ts 256→256, SDK 241→241, MCP server 254→230, entry 19 (ceiling 20); the budget gate passed on the rebased head.

Validation

Full gate at bc1c0dece1: pnpm check --head bc1c0dece1 passed, exactCommit: true (tooling, fallow, unit); merge-tree against current main is clean. CI then failed AgentGuidance (docs/agents 40,007 bytes > 40,000); f4795dfaa7 shortens one sentence in code-ownership.md, no cap raised. Docs-only delta to f4795dfaa7: check:affected --base bc1c0dece1 --head f4795dfaa7 selected agent-guidance, passed, exactCommit: true; not a new full gate. Earlier CI passes apply to older heads. Not device-facing. CI-only lanes pending.

šŸ¤– Generated with Claude Code