diff --git a/docs/cli.md b/docs/cli.md index 1c0a9e484..0eeb6f78f 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -130,8 +130,22 @@ Historical remote guides are excluded from the supported documentation. - `--json` on `hack up`/`down`/`restart`/`doctor` emits a `{ok, data | error: {code, message}}` envelope with stable `E_*` error codes. `--json` on `hack up` implies `--detach`. - A `--path` (or working directory) without a `.hack/` project reports `E_PROJECT_NOT_FOUND` - from every project command, for example `hack ps -p --json` and `hack up -p --json`. - Without `--json` it prints one `E_PROJECT_NOT_FOUND` line and no stack trace. + from `up`, `down`, `restart`, `ps`, `logs`, `run`, `exec`, `open`, `tui`, `branch ...`, + `config get`/`set`, `env ...`, `host exec`/`shell` and `project owner`/`target`/`task`, for + example `hack ps -p --json` and `hack branch list -p `. Under `--json` it is one + error envelope; without `--json` it is one `ERROR: E_PROJECT_NOT_FOUND: ...` line and no stack + trace. `project target` and `project task` use their own message, and `target` adds a + `detail`. These commands report something else: + - `tui` without a terminal refuses for that reason first. + - `env get` never prints a failure reason, since its output is raw values: it prints one fixed + line on stderr, with or without `--json`. + - `config validate`, `plan`, `import` and `adopt` read native configuration and keep their own + refusals: `E_NATIVE_PROJECT_UNSUPPORTED` for `validate`/`plan`, a refused preview for + `import --dry-run`, and `E_CONFIG_INVALID` for `adopt`. + - `init`, `doctor`, `crash-capture`, and the `setup`, `mcp` and `agent` commands do not need a + project. + + `tests/missing-project-error-code.test.ts` pins each command that takes `--path`. - Known Hack errors and closed native runtime refusals print their message only, never a stack trace; set `HACK_DEBUG=1` to add the stack. Unexpected exceptions always print their stack. - `--no-interactive` (or `HACK_NO_INTERACTIVE=1`) is a global flag: commands never prompt — they @@ -206,8 +220,16 @@ to JSON. A `--` before the child command is optional and is not passed on; a lat Hack parses options with the resolved command's own options plus the global ones, so each command keeps its own short flags and option types. `-p` is `--path` for project commands (`init`, `up`, -`down`, `ps`, `logs`, `env ...`, `config ...`, `setup ...`) and `--port` for `hack ssh`. An option -that only another command declares is refused as `Option(s) not valid for ""`. +`down`, `ps`, `logs`, `env ...`, `config ...`, `setup ...`) and `--port` for `hack ssh`. Both +refusals below are `E_USAGE`: + +- A long option that only another command declares is refused as + `Option(s) not valid for "": --