24 lines
1.1 KiB
Markdown
24 lines
1.1 KiB
Markdown
---
|
|
description: "CLI stdout/stderr stream contract and exit code conventions for seal-use commands"
|
|
globs: "src/cli/**/*.ts"
|
|
trigger: "manual"
|
|
---
|
|
|
|
# CLI Stream & Exit Code Protocol
|
|
|
|
When working on CLI command implementations under `src/cli/`:
|
|
|
|
1. **Machine Channel (`stdout`)**:
|
|
- Data commands MUST output pure, parseable JSON on `stdout`.
|
|
- NEVER output human text, logs, spinners, or progress banners to `stdout` (the Agent Harness parses `stdout` directly).
|
|
- Documented exceptions for Markdown output: `seal-use --help` / `seal-use help <area>` and `seal-use doctor guide`.
|
|
|
|
2. **Diagnostics & Guidance Channel (`stderr`)**:
|
|
- Write runtime logs, warnings, probing status, and human tips to `stderr`.
|
|
- Format next-step guidance explicitly: `👉 Next action: seal-use ...`.
|
|
|
|
3. **Exit Code Contract**:
|
|
- Successful operations MUST exit with `0`.
|
|
- Any validation error, upstream API failure, or block MUST result in non-zero exit code (e.g. `1`).
|
|
- DO NOT call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
|