refactor(cli): split workflow/thread into two top-level command groups #145

Closed
opened 2026-04-27 01:14:55 +00:00 by xingyue · 0 comments
Owner

What

Split the current nerve workflow command into two top-level command groups to reflect the two-layer domain model:

  • workflow = definition layer (YAML config)
  • thread = instance layer (a single run of a workflow)

Why

Currently nerve workflow mixes definition-level operations (list workflows, trigger) with instance-level operations (runs, inspect, thread, kill). This causes naming confusion (list vs runs, inspect vs thread). Splitting into two groups makes the CLI self-documenting.

Target CLI Structure

nerve workflow — definition layer

nerve workflow list              # List all defined workflows (from YAML/workspace)
nerve workflow status            # Real-time daemon status (running/queued/concurrency)  
nerve workflow trigger <name>    # Manually trigger a workflow

nerve thread — instance layer

nerve thread list                        # List all thread instances
nerve thread list --workflow <name>      # Filter by workflow name
nerve thread show <runId>                # Show conversation rounds (agent/role view)
nerve thread inspect <runId>             # Show system event log (machine view)
nerve thread kill <runId>                # Kill a running/queued thread

Changes

packages/cli/src/commands/workflow.ts

  • Keep: list (NEW — reads workflow definitions from workspace YAML files), status (rename from current list), trigger
  • Remove: runs, inspect, thread, kill (moved to thread group)

packages/cli/src/commands/thread.ts (NEW)

  • list — moved from workflow runs, change positional [workflow] arg to --workflow <name> flag
  • show — moved from workflow thread (the role-rounds / conversation view)
  • inspect — moved from workflow inspect (system event log view)
  • kill — moved from workflow kill

packages/cli/src/cli.ts

  • Register new thread top-level command group
  • Import threadCommand from new file

Notes

  • nerve workflow list is NEW — currently there is no command to list defined workflows. It should read from the workspace YAML files and show: name, schedule (if any), concurrency config
  • nerve workflow status replaces the current nerve workflow list which queries the daemon for real-time state
  • The --all flag on current runs should move to thread list --all
  • Pagination flags (--limit, --offset, --before, --budget) should be preserved on the respective thread commands
  • Fix stale help text: workflow trigger error message still says nerve start instead of nerve daemon start

Ref

None

## What Split the current `nerve workflow` command into two top-level command groups to reflect the two-layer domain model: - **workflow** = definition layer (YAML config) - **thread** = instance layer (a single run of a workflow) ## Why Currently `nerve workflow` mixes definition-level operations (list workflows, trigger) with instance-level operations (runs, inspect, thread, kill). This causes naming confusion (`list` vs `runs`, `inspect` vs `thread`). Splitting into two groups makes the CLI self-documenting. ## Target CLI Structure ### `nerve workflow` — definition layer ``` nerve workflow list # List all defined workflows (from YAML/workspace) nerve workflow status # Real-time daemon status (running/queued/concurrency) nerve workflow trigger <name> # Manually trigger a workflow ``` ### `nerve thread` — instance layer ``` nerve thread list # List all thread instances nerve thread list --workflow <name> # Filter by workflow name nerve thread show <runId> # Show conversation rounds (agent/role view) nerve thread inspect <runId> # Show system event log (machine view) nerve thread kill <runId> # Kill a running/queued thread ``` ## Changes ### `packages/cli/src/commands/workflow.ts` - Keep: `list` (NEW — reads workflow definitions from workspace YAML files), `status` (rename from current `list`), `trigger` - Remove: `runs`, `inspect`, `thread`, `kill` (moved to thread group) ### `packages/cli/src/commands/thread.ts` (NEW) - `list` — moved from `workflow runs`, change positional `[workflow]` arg to `--workflow <name>` flag - `show` — moved from `workflow thread` (the role-rounds / conversation view) - `inspect` — moved from `workflow inspect` (system event log view) - `kill` — moved from `workflow kill` ### `packages/cli/src/cli.ts` - Register new `thread` top-level command group - Import `threadCommand` from new file ### Notes - `nerve workflow list` is NEW — currently there is no command to list defined workflows. It should read from the workspace YAML files and show: name, schedule (if any), concurrency config - `nerve workflow status` replaces the current `nerve workflow list` which queries the daemon for real-time state - The `--all` flag on current `runs` should move to `thread list --all` - Pagination flags (`--limit`, `--offset`, `--before`, `--budget`) should be preserved on the respective thread commands - Fix stale help text: `workflow trigger` error message still says `nerve start` instead of `nerve daemon start` ## Ref None
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#145