Commit graph

2 commits

Author SHA1 Message Date
trvon
47c3af735c
CLI: exit code 3 for "could not run here", confirm destructive actions
Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
Decided 2026-10-27 (docs/cli-ux.md):
- Exit codes: 0 done/healthy, 1 negative result (unhealthy, not found,
  daemon refused), 2 usage, 3 could not run here (daemon unreachable,
  permission denied, store not readable, feature not built). Daemon
  unreachable used to exit 2, like a usage error.
- Process kill/suspend, quarantine, allowlist-add, protection-set to
  enforce, store compact and doctor fix (without --dry-run) say what they
  will do and ask "Proceed? [y/N]" on a terminal; Enter or EOF is no.
  Without a terminal they need --yes, else exit 2 with nothing done.
  This applies to the flag form too (--policy-set process-kill ...).
  The desktop app talks to the control socket directly and is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:44:52 -06:00
trvon
bf1e779706
CLI: safe terminal output, completions, no accidental daemons; UX guide
Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
- Evidence strings are attacker-controlled: every CLI command's stdout
  and stderr now pass through a filter that shows control characters
  (C0, DEL, C1) and invalid UTF-8 as \xNN (src/term_safe.hpp), so a
  crafted process name or path cannot inject terminal escape sequences.
  The daemon's journal output is unchanged.
- `strawberry` alone prints help; an unknown word (`strawberry fix`) is an
  error with a "did you mean" hint. Both used to start a daemon as the
  calling user with the word as its config path. Config paths (contain
  '/' or end in .conf) still run the daemon, for older units.
- Shell completions generated from the command table: `strawberry
  completion bash|zsh|fish`; install.sh installs them under
  /usr/local/share.
- One correlation pass at daemon start (stored findings catch up with the
  current rules, e.g. stable ids), and retire-superseded-findings
  correlates first, so replacements exist before old copies are retired.
  The user's first run reported "no duplicates" for that reason.
- docs/cli-ux.md: CLI UX rules adapted from yams (grammar, flags, human
  and JSON output, status words, security rules for output, help and
  completions, adding a command, known gaps). Exit code 3 and
  confirmation prompts are proposed there, pending a decision. AGENTS.md
  and CLAUDE.md point to it.

tests/test_cli.cpp: bare and unknown words, terminal_safe and the stream
filter, completion scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:41:19 -06:00