2026-05-18 22:03:59 -05:00
# CLI
## Shortest Useful Command
```bash
narratio run --session-id 2026-04-04
```
2026-05-19 22:32:55 -05:00
This command uses default discovery for `pipeline.yml` and `session.yml` ; both files must be discoverable unless you pass explicit `--config` and `--session` paths.
2026-05-18 22:03:59 -05:00
## Command Overview
Implemented commands:
2026-05-19 19:42:28 -05:00
- `run` : execute pipeline stages and persist manifest state.
- `plan` : validate config, prepare workspace layout, and print stage run/skip decisions.
- `resume` : continue from first non-succeeded stage unless forced.
- `status` : read and print stage statuses from an existing manifest.
- `run-stage` : execute exactly one stage.
2026-05-19 22:32:55 -05:00
- `restore` : restore durable local session state from the committed remote archive state.
2026-05-18 22:03:59 -05:00
2026-05-19 19:42:28 -05:00
Unknown commands print usage and exit non-zero.
2026-05-18 22:03:59 -05:00
2026-05-19 19:42:28 -05:00
For config semantics, see [docs/config.md ](./config.md ). For operator lifecycle and recovery, see [docs/operations.md ](./operations.md ).
2026-05-18 22:03:59 -05:00
## Complete Flag Reference
### `run`
2026-05-19 19:42:28 -05:00
- `--config <path>` : optional explicit `pipeline.yml` path.
- `--session <path>` : optional explicit `session.yml` path.
- `--session-id <value>` : session template variable value.
2026-05-20 14:26:32 +00:00
- `--previous-session-id <value>` : previous-session template variable value.
2026-05-19 19:42:28 -05:00
- `--force` : force stage execution.
- `--artifacts <names>` : analyze artifact keys to execute (repeatable or comma-separated).
2026-05-18 22:03:59 -05:00
### `plan`
- `--config <path>`
- `--session <path>`
- `--session-id <value>`
2026-05-20 14:26:32 +00:00
- `--previous-session-id <value>`
2026-05-19 19:42:28 -05:00
- `--force`
2026-05-18 22:03:59 -05:00
### `resume`
- `--config <path>`
- `--session <path>`
- `--session-id <value>`
2026-05-20 14:26:32 +00:00
- `--previous-session-id <value>`
2026-05-19 19:42:28 -05:00
- `--force`
- `--artifacts <names>` : analyze artifact keys to execute (repeatable or comma-separated).
2026-05-18 22:03:59 -05:00
### `run-stage`
- `--config <path>`
- `--session <path>`
- `--session-id <value>`
2026-05-20 14:26:32 +00:00
- `--previous-session-id <value>`
2026-05-18 22:03:59 -05:00
- `--force`
2026-05-19 19:42:28 -05:00
- `--artifacts <names>` : analyze artifact keys to execute (repeatable or comma-separated).
2026-05-18 22:03:59 -05:00
- positional `<stage>` : required stage name.
Valid stage names:
- `prepare`
- `transcribe`
- `merge`
- `polish`
- `normalize`
- `trim`
- `analyze`
- `archive`
- `notify`
2026-05-19 22:32:55 -05:00
### `restore`
- `--config <path>`
- `--session <path>`
- `--session-id <value>`
2026-05-20 14:26:32 +00:00
- `--previous-session-id <value>`
2026-05-19 22:32:55 -05:00
- `--dry-run` : plan restore actions without writing local files.
- `--force` : overwrite local conflicting files with remote archive files.
- `--include-audio` : include durable archived `audio/**` files in restore scope.
2026-05-18 22:03:59 -05:00
### `status`
- `--manifest <path>` : required manifest path.
## Command Reference
### `run`
Purpose:
2026-05-19 19:42:28 -05:00
- Execute configured stages in canonical order.
2026-05-18 22:03:59 -05:00
Syntax:
```bash
2026-05-20 14:26:32 +00:00
narratio run [--config <pipeline.yml>] [--session <session.yml>] [--session-id <id>] [--previous-session-id <id>] [--force] [--artifacts <name[,name...]>]
2026-05-18 22:03:59 -05:00
```
Success output:
- `narratio run: session <session_id>; executed=<n> skipped=<n>; manifest=<path>`
Common failure cases:
2026-05-19 19:42:28 -05:00
- missing default config/session paths when flags omitted.
- invalid template/rendered session mismatch.
- unknown/invalid `--artifacts` value.
- `--artifacts` with unknown configured artifact key.
2026-05-18 22:03:59 -05:00
### `plan`
Purpose:
2026-05-19 19:42:28 -05:00
- Validate config, load secrets (if configured), prepare workdir, and print stage run/skip decisions.
2026-05-18 22:03:59 -05:00
Syntax:
```bash
2026-05-20 14:26:32 +00:00
narratio plan [--config <pipeline.yml>] [--session <session.yml>] [--session-id <id>] [--previous-session-id <id>] [--force]
2026-05-18 22:03:59 -05:00
```
Success output includes:
- `narratio plan: workdir prepared at <path>`
- one line per stage (`<stage>: run|skip` )
- `totals: run=<n> skip=<n>`
Common failure cases:
2026-05-19 19:42:28 -05:00
- same config/session discovery and validation failures as `run` .
2026-05-18 22:03:59 -05:00
- secrets directory read failures when `pipeline.secrets.env_dir` is configured.
### `resume`
Purpose:
2026-05-19 19:42:28 -05:00
- Continue from session-manifest stage status.
2026-05-18 22:03:59 -05:00
Syntax:
```bash
2026-05-20 14:26:32 +00:00
narratio resume [--config <pipeline.yml>] [--session <session.yml>] [--session-id <id>] [--previous-session-id <id>] [--force] [--artifacts <name[,name...]>]
2026-05-18 22:03:59 -05:00
```
Success output:
2026-05-19 19:42:28 -05:00
- `narratio resume: session <session_id> has no remaining stages`
2026-05-18 22:03:59 -05:00
- or `narratio resume: session <session_id>; executed=<n> skipped=<n>; manifest=<path>`
Common failure cases:
- same discovery/template/validation failures as `run` .
2026-05-19 19:42:28 -05:00
- manifest load errors when existing manifest is unreadable.
- invalid or unknown artifact selections.
2026-05-18 22:03:59 -05:00
### `status`
Purpose:
2026-05-19 19:42:28 -05:00
- Inspect one manifest file without executing stages.
2026-05-18 22:03:59 -05:00
Syntax:
```bash
narratio status --manifest <manifest.json>
```
Success output includes:
- `session_id: <id>`
- `updated_at: <timestamp>`
2026-05-19 19:42:28 -05:00
- `stages:` entries (`- <stage>: <status>` )
2026-05-18 22:03:59 -05:00
Common failure cases:
- missing `--manifest` .
2026-05-19 19:42:28 -05:00
- unreadable or invalid manifest path.
2026-05-18 22:03:59 -05:00
### `run-stage`
Purpose:
2026-05-19 19:42:28 -05:00
- Execute exactly one stage.
2026-05-18 22:03:59 -05:00
Syntax:
```bash
2026-05-20 14:26:32 +00:00
narratio run-stage [--config <pipeline.yml>] [--session <session.yml>] [--session-id <id>] [--previous-session-id <id>] [--force] [--artifacts <name[,name...]>] <stage>
2026-05-18 22:03:59 -05:00
```
Success output:
- `narratio run-stage: stage=<name> executed=<n> skipped=<n> force=<true|false>; manifest=<path>`
2026-05-19 19:42:28 -05:00
`--artifacts` behavior:
- accepted only when `<stage>` is `analyze` .
- names are normalized (trimmed, deduplicated, sorted).
- unknown configured artifact keys fail.
2026-05-18 22:03:59 -05:00
2026-05-19 19:42:28 -05:00
Common failure cases:
- missing stage positional arg.
2026-05-18 22:03:59 -05:00
- unknown stage name.
2026-05-19 19:42:28 -05:00
- using `--artifacts` with any non-`analyze` stage.
2026-05-18 22:03:59 -05:00
2026-05-19 22:32:55 -05:00
### `restore`
Purpose:
2026-05-20 15:17:04 +00:00
- Restore durable session state (`manifest.json` , `transcripts/**` , `artifacts/**` , `previous/**` , and optional `audio/**` ) from the committed remote archive current state.
2026-05-19 22:32:55 -05:00
Syntax:
```bash
2026-05-20 14:26:32 +00:00
narratio restore [--config <pipeline.yml>] [--session <session.yml>] [--session-id <id>] [--previous-session-id <id>] [--dry-run] [--force] [--include-audio]
2026-05-19 22:32:55 -05:00
```
Success output (dry-run):
- `Restore plan for <campaign>/<session_id>`
- `Remote run: <run_id>`
- `Would download: <n>`
- `Would skip unchanged: <n>`
- `Conflicts: <n>`
Success output (non-dry-run):
- `Restored session archive for <campaign>/<session_id>`
- `Remote run: <run_id>`
- `Downloaded: <n>`
- `Skipped unchanged: <n>`
- `Conflicts: <n>`
Common failure cases:
- storage backend is not configured.
- remote `current/run_id.txt` missing/empty.
- remote `current/manifest.json` missing or invalid.
- remote manifest session/campaign mismatch.
- local conflicts without `--force` .
- session lock conflict.
2026-05-18 22:03:59 -05:00
## Common Workflows
Default-discovery run:
```bash
narratio run --session-id 2026-04-04
```
2026-05-19 19:42:28 -05:00
Run only selected analyze artifacts:
2026-05-18 22:03:59 -05:00
```bash
2026-05-19 19:42:28 -05:00
narratio run --session-id 2026-04-04 --artifacts session_recap,player_handout
2026-05-18 22:03:59 -05:00
```
2026-05-19 19:42:28 -05:00
Resume with selected analyze artifacts:
2026-05-18 22:03:59 -05:00
```bash
2026-05-19 19:42:28 -05:00
narratio resume --session-id 2026-04-04 --artifacts player_handout
2026-05-18 22:03:59 -05:00
```
2026-05-19 19:42:28 -05:00
Run only analyze stage with selected artifacts:
2026-05-18 22:03:59 -05:00
```bash
2026-05-19 19:42:28 -05:00
narratio run-stage --session-id 2026-04-04 --artifacts player_handout analyze
2026-05-18 22:03:59 -05:00
```
2026-05-19 22:32:55 -05:00
Preview restore actions without writes:
```bash
narratio restore --session-id 2026-04-04 --dry-run
```
Restore and then force analyze:
```bash
narratio restore --session-id 2026-04-04
narratio run-stage --session-id 2026-04-04 --force analyze
```
2026-05-20 15:17:04 +00:00
Rehydrate canonical previous-session inputs after artifact-input changes:
```bash
narratio run-stage --session-id 2026-04-04 --force prepare
```
2026-05-18 22:03:59 -05:00
## Diagnostic / Recovery Commands
2026-05-19 19:42:28 -05:00
Inspect stage status:
2026-05-18 22:03:59 -05:00
```bash
narratio status --manifest <manifest.json>
```
2026-05-19 19:42:28 -05:00
Get manifest path from previous output:
- `run` , `resume` , and `run-stage` print `manifest=<path>` on success.
## `--artifacts` and `--force`
2026-05-18 22:03:59 -05:00
2026-05-19 19:42:28 -05:00
- `--artifacts` filters which configured artifacts are executable when analyze runs.
- `--artifacts` does not imply `--force` .
2026-05-19 22:32:55 -05:00
- if analyze is already `succeeded` and `--force` is not set, runner-level skip still applies.