19 — CLI Standards

Status: Ratified Version: 1.0.0 Applies to: hunterx command-line interface


1. Purpose

The CLI is a first-class interface (equal to the REST API). It must be: discoverable (--help), scriptable (machine-parseable output), deterministic, and safe. It is implemented with a modern argument parser framework (Typer/Click).


2. Command Model

Command hierarchy (groups):

hunterx
├── mission          # create, plan, start, approve, list, show, abort, status, archive
├── workflow         # list, show, run, cancel, resume, checkpoint
├── scan             # ad-hoc single scan (fast path, single target)
├── report           # generate, list, show, export, evidence
├── tool             # list, install, update, health, docs, run
├── plugin           # list, install, remove, update, ban, scaffold, package, test
├── knowledge        # list, show, sync, index, validate
├── payload          # sync, index, search, stats
├── config           # show, validate, get, set (scoped), doctor
├── secret           # set, get (masked), list, rotate, unset
├── api              # serve, token, status
├── admin            # users, roles, audit, maintenance, telemetry
├── completion       # generate shell completions
├── doctor           # environment diagnostics
└── version / self-update

2.1 Command Grammar


3. Global Flags

Flag Purpose
--config <path> Override config file
--profile <name> Mission/tool profile preset
--output <format> text (default) | json | yaml | csv
--quiet / -q Reduce output to errors + results
--verbose / -v Increase verbosity (repeatable)
--no-color Disable ANSI (also auto-detected when non-TTY)
--yes / -y Skip interactive confirmation (non-interactive mode)
--correlation-id <id> Override request correlation id
--version Print version and exit

4. Flags & Options Conventions


5. Profiles


6. Output Formatting


7. Colors


8. Errors & Exit Codes

Exit code table (stable contract):

Code Meaning
0 Success
1 General runtime error
2 Usage error (bad flags/args)
3 Validation error (invalid input/target)
4 Configuration error
5 Not authorized / forbidden
6 Target out of scope
7 Tool/plugin missing or unavailable
8 Timeout
9 AI provider unavailable
10 Resource limits exceeded
20–29 Reserved for specific tool/plugin errors
130 Interrupted (SIGINT)

Error output format (text):

error: <code> <safe message>
hint: <remediation or docs link>

With --output json, the error envelope is {"ok": false, "error": {...}} per 17 §9.


9. Help & Discoverability


10. Autocomplete


11. Interactive vs Non-Interactive


12. Safety & Determinism


13. CLI ↔ API Parity


14. References