Skip to content

feat(pilotctl): agent-first CLI overhaul — bounded output, filters, styling#247

Open
TeoSlayer wants to merge 3 commits into
mainfrom
feat/pilotctl-agent-first-cli
Open

feat(pilotctl): agent-first CLI overhaul — bounded output, filters, styling#247
TeoSlayer wants to merge 3 commits into
mainfrom
feat/pilotctl-agent-first-cli

Conversation

@TeoSlayer

Copy link
Copy Markdown
Owner

Summary

  • Agents can finally use the CLI without shell-grubbing. pilotctl --json inbox went from a 23 MB all-messages dump to a bounded 3 KB reply; --latest replaces the jq -r '.data' "$(ls -1t ~/.pilot/inbox/*.json | head -1)" workaround the SKILL.md used to teach.
  • Bounded + filterable everywhere: inbox and received get --limit/--since/--latest/read <id>/--clear --before; trust gets --limit/--search (newest-first, one-way trust flagged); peers shows a summary + exceptions-only view (immediately surfaced 3 unencrypted peers invisible in the old 678-row noise table), with colorized --all.
  • Real bug fixed: daemon status no longer reports stopped (pid 0) from a stale PID file while printing live socket data — the socket is now the source of truth, with a dim "pid file stale" note.
  • Faster failure + hints: ping defaults 5s (was 30s; total failure ~10s instead of ~40s) and prints a relay-convergence hint; handshake/approve/untrust outcome messages carry the next command to run.
  • Silent waits animated: send-message --wait, ping, bench, traceroute show a self-erasing waiting… Ns line on stderr — TTY-only, hard no-op for pipes and --json, race-detector clean.
  • New style layer (cmd/pilotctl/style.go): semantic ANSI (statusDot, bold/dim/accent) gated on TTY + NO_COLOR/PILOT_NO_COLOR/TERM=dumb. Piped output stays grep-safe; --json is byte-stable except documented additions ("to" resolved-address on send-message/ping, "total"/"shown" counters).
  • Plus: config aligned key-value (no more raw JSON at humans), skills status per-tool status dots with --verbose detail, updates word-boundary wrap, network list drops the always-empty MEMBERS column with an "admin only" footnote, context <command> returns one command's spec (18 KB → ~440 B).

Test plan

  • go test ./cmd/pilotctl/ -count=1 green (presentation assertions updated to new contract; all plain-text, no ANSI — tests pipe stdout so color is off)
  • New tests: wait-progress lifecycle (incl. -race), received --limit/--since/--clear --before, context <command> found/not-found, send-message/ping JSON "to" field
  • gofmt + go vet clean; pre-commit hooks pass
  • Live-verified against a running daemon (678 peers): inbox/peers/trust/info/daemon-status/skills-status/config/updates/network-list rendering via pseudo-TTY, JSON shapes via pipe
  • Reviewer: eyeball script -q /dev/null pilotctl <cmd> rendering on your terminal theme

🤖 Generated with Claude Code

…tyling

Inbox was unusable for agents (23 MB --json dumps, oldest-first, 80-char
mid-token truncation) and several commands shared the same disease. This
makes every high-traffic command bounded, filterable, non-interactive,
and visually scannable, without breaking --json consumers.

- inbox: newest-first, default --limit 10, --latest/--from/--since/
  --full/read <id>/--clear --before; --json bounded (23 MB -> 3 KB)
- received: same flag surface ported (mtime-ordered; sender metadata
  unavailable in dataexchange filenames)
- peers: summary + exceptions-only view (surfaces unencrypted peers),
  colorized --all, --limit/--search
- trust: newest-first, --limit 20, --search, one-way trust flagged
- daemon status: fix contradiction (stale PID file reported "stopped"
  while live socket data printed); socket is now the source of truth
- info: grouped identity/network/traffic/skills layout
- ping: 5s default timeout (was 30s), relay-convergence hint on failure
- send-message/ping --json: add "to" resolved-address field
- send-message --wait, ping, bench, traceroute: animated elapsed line on
  stderr (TTY-only, erased on completion, no-op for pipes/--json)
- config/skills status/updates/network list: aligned key-value, per-tool
  status dots, word-boundary wrap, dead MEMBERS column dropped
- handshake/approve/untrust: next-step hints
- context <command>: single-command spec (18 KB -> ~440 B)

New style layer (cmd/pilotctl/style.go): semantic ANSI helpers gated on
TTY + NO_COLOR/PILOT_NO_COLOR/TERM=dumb; tests pipe stdout so assertions
stay plain-text.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@TeoSlayer TeoSlayer requested a review from Alexgodoroja as a code owner June 11, 2026 10:13
teovl and others added 2 commits June 11, 2026 20:28
received gained --limit, --since, --clear --before in the CLI overhaul.
The cli-reference-check gate caught the stale summary line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants