# CLI ## Shortest Useful Command ```bash narratio run --session-id 2026-04-04 ``` This uses default config discovery for `pipeline.yml` and `session.yml`; both files must be discoverable for this command to run. ## Command Overview Implemented commands: - `run`: execute the full stage plan and persist manifest state. - `plan`: validate config, prepare workdir, and print run/skip decisions. - `resume`: continue from the first non-succeeded stage in the manifest. - `status`: read and print stage statuses from an existing manifest file. - `run-stage`: execute exactly one selected stage. Unknown commands print usage (`Usage: narratio `) and exit non-zero. For configuration field details, see [docs/config.md](./config.md). For operational lifecycle details, see [docs/operations.md](./operations.md). ## Complete Flag Reference ### `run` - `--config `: optional explicit `pipeline.yml` path; if omitted, default locations are searched. - `--session `: optional explicit `session.yml` path; if omitted, default locations are searched. - `--session-id `: session template variable value for `session.yml` rendering. - `--force`: force stage execution (prevents skip of already-succeeded stages). ### `plan` - `--config ` - `--session ` - `--session-id ` - `--force`: show forced run decisions instead of normal skip behavior. ### `resume` - `--config ` - `--session ` - `--session-id ` - `--force`: run full stage order rather than starting at first non-succeeded stage. ### `run-stage` - `--config ` - `--session ` - `--session-id ` - `--force` - positional ``: required stage name. Valid stage names: - `prepare` - `transcribe` - `merge` - `polish` - `normalize` - `trim` - `analyze` - `archive` - `notify` ### `status` - `--manifest `: required manifest path. ## Command Reference ### `run` Purpose: - Validate configuration and execute all stages in canonical order. Syntax: ```bash narratio run [--config ] [--session ] [--session-id ] [--force] ``` Success output: - `narratio run: session ; executed= skipped=; manifest=` Common failure cases: - no pipeline config found in default search paths when `--config` is omitted. - no session config found in default search paths when `--session` is omitted. - invalid flags or unexpected positional arguments. - config/template/validation errors. ### `plan` Purpose: - Validate config, load secrets (if configured), prepare workspace layout, and print per-stage run/skip decisions. Syntax: ```bash narratio plan [--config ] [--session ] [--session-id ] [--force] ``` Success output includes: - `narratio plan: workdir prepared at ` - one line per stage (`: run|skip`) - `totals: run= skip=` Common failure cases: - same discovery, template, and validation failures as `run`. - secrets directory read failures when `pipeline.secrets.env_dir` is configured. ### `resume` Purpose: - Continue execution from manifest state for the same session. Syntax: ```bash narratio resume [--config ] [--session ] [--session-id ] [--force] ``` Success output: - either `narratio resume: session has no remaining stages` - or `narratio resume: session ; executed= skipped=; manifest=` Common failure cases: - same discovery/template/validation failures as `run`. - manifest load errors when an existing manifest is unreadable. ### `status` Purpose: - Inspect an existing manifest file without running stages. Syntax: ```bash narratio status --manifest ``` Success output includes: - `session_id: ` - `updated_at: ` - `stages:` section with `- : ` entries. Common failure cases: - missing `--manifest`. - manifest path unreadable or invalid JSON shape. ### `run-stage` Purpose: - Execute exactly one stage from the supported stage set. Syntax: ```bash narratio run-stage [--config ] [--session ] [--session-id ] [--force] ``` Success output: - `narratio run-stage: stage= executed= skipped= force=; manifest=` Common failure cases: - missing stage positional argument. - unknown stage name. - same discovery/template/validation failures as `run`. ## Common Workflows Default-discovery run: ```bash narratio run --session-id 2026-04-04 ``` Explicit config/session run: ```bash narratio run --config /etc/narratio/pipeline.yml --session ./session.yml --session-id 2026-04-04 ``` Plan before run: ```bash narratio plan --config /etc/narratio/pipeline.yml --session ./session.yml --session-id 2026-04-04 ``` Resume interrupted work: ```bash narratio resume --config /etc/narratio/pipeline.yml --session ./session.yml --session-id 2026-04-04 ``` Run one stage: ```bash narratio run-stage --config /etc/narratio/pipeline.yml --session ./session.yml --session-id 2026-04-04 polish ``` ## Diagnostic / Recovery Commands Read stage status from a manifest: ```bash narratio status --manifest ``` How to get manifest path: - `run`, `resume`, and `run-stage` success output includes `manifest=`. - use that path with `status` for direct inspection.