agentxchain 0.8.8 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +136 -136
  2. package/bin/agentxchain.js +186 -5
  3. package/dashboard/app.js +305 -0
  4. package/dashboard/components/blocked.js +145 -0
  5. package/dashboard/components/cross-repo.js +126 -0
  6. package/dashboard/components/gate.js +311 -0
  7. package/dashboard/components/hooks.js +177 -0
  8. package/dashboard/components/initiative.js +147 -0
  9. package/dashboard/components/ledger.js +165 -0
  10. package/dashboard/components/timeline.js +222 -0
  11. package/dashboard/index.html +352 -0
  12. package/package.json +14 -6
  13. package/scripts/live-api-proxy-preflight-smoke.sh +531 -0
  14. package/scripts/publish-from-tag.sh +88 -0
  15. package/scripts/release-postflight.sh +231 -0
  16. package/scripts/release-preflight.sh +167 -0
  17. package/src/commands/accept-turn.js +160 -0
  18. package/src/commands/approve-completion.js +80 -0
  19. package/src/commands/approve-transition.js +85 -0
  20. package/src/commands/dashboard.js +70 -0
  21. package/src/commands/init.js +516 -0
  22. package/src/commands/migrate.js +348 -0
  23. package/src/commands/multi.js +549 -0
  24. package/src/commands/plugin.js +157 -0
  25. package/src/commands/reject-turn.js +204 -0
  26. package/src/commands/resume.js +389 -0
  27. package/src/commands/status.js +196 -3
  28. package/src/commands/step.js +947 -0
  29. package/src/commands/template-list.js +33 -0
  30. package/src/commands/template-set.js +279 -0
  31. package/src/commands/validate.js +20 -11
  32. package/src/commands/verify.js +71 -0
  33. package/src/lib/adapters/api-proxy-adapter.js +1076 -0
  34. package/src/lib/adapters/local-cli-adapter.js +337 -0
  35. package/src/lib/adapters/manual-adapter.js +169 -0
  36. package/src/lib/blocked-state.js +94 -0
  37. package/src/lib/config.js +97 -1
  38. package/src/lib/context-compressor.js +121 -0
  39. package/src/lib/context-section-parser.js +220 -0
  40. package/src/lib/coordinator-acceptance.js +428 -0
  41. package/src/lib/coordinator-config.js +461 -0
  42. package/src/lib/coordinator-dispatch.js +276 -0
  43. package/src/lib/coordinator-gates.js +487 -0
  44. package/src/lib/coordinator-hooks.js +239 -0
  45. package/src/lib/coordinator-recovery.js +523 -0
  46. package/src/lib/coordinator-state.js +365 -0
  47. package/src/lib/cross-repo-context.js +247 -0
  48. package/src/lib/dashboard/bridge-server.js +284 -0
  49. package/src/lib/dashboard/file-watcher.js +93 -0
  50. package/src/lib/dashboard/state-reader.js +96 -0
  51. package/src/lib/dispatch-bundle.js +568 -0
  52. package/src/lib/dispatch-manifest.js +252 -0
  53. package/src/lib/gate-evaluator.js +285 -0
  54. package/src/lib/governed-state.js +2139 -0
  55. package/src/lib/governed-templates.js +145 -0
  56. package/src/lib/hook-runner.js +788 -0
  57. package/src/lib/normalized-config.js +539 -0
  58. package/src/lib/plugin-config-schema.js +192 -0
  59. package/src/lib/plugins.js +692 -0
  60. package/src/lib/protocol-conformance.js +291 -0
  61. package/src/lib/reference-conformance-adapter.js +858 -0
  62. package/src/lib/repo-observer.js +597 -0
  63. package/src/lib/repo.js +0 -31
  64. package/src/lib/schema.js +121 -0
  65. package/src/lib/schemas/turn-result.schema.json +205 -0
  66. package/src/lib/token-budget.js +206 -0
  67. package/src/lib/token-counter.js +27 -0
  68. package/src/lib/turn-paths.js +67 -0
  69. package/src/lib/turn-result-validator.js +496 -0
  70. package/src/lib/validation.js +137 -0
  71. package/src/templates/governed/api-service.json +31 -0
  72. package/src/templates/governed/cli-tool.json +30 -0
  73. package/src/templates/governed/generic.json +10 -0
  74. package/src/templates/governed/web-app.json +30 -0
package/README.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # agentxchain
2
2
 
3
- CLI for multi-agent coordination in your IDE. Define a team of AI agents, let them take turns building your project — each in its own IDE window.
3
+ CLI for governed multi-agent software delivery.
4
+
5
+ The canonical mode is governed delivery: orchestrator-owned state, structured turn results, phase gates, mandatory challenge, and explicit human approvals where required.
6
+
7
+ Legacy IDE-window coordination is still shipped as a compatibility mode for teams that want lock-based handoff in Cursor, VS Code, or Claude Code.
8
+
9
+ ## Docs
10
+
11
+ - [Quickstart](https://agentxchain.dev/docs/quickstart/)
12
+ - [CLI reference](https://agentxchain.dev/docs/cli/)
13
+ - [Adapter reference](https://agentxchain.dev/docs/adapters/)
14
+ - [Protocol spec (v6)](https://agentxchain.dev/docs/protocol/)
15
+ - [Why governed multi-agent delivery matters](https://agentxchain.dev/why/)
4
16
 
5
17
  ## Install
6
18
 
@@ -11,192 +23,180 @@ npm install -g agentxchain
11
23
  Or run without installing:
12
24
 
13
25
  ```bash
14
- npx agentxchain init
26
+ npx agentxchain init --governed -y
15
27
  ```
16
28
 
17
- ## Quick start
29
+ ## Quick Start
18
30
 
19
- ### Happy path: net-new project
31
+ ### Governed workflow
20
32
 
21
33
  ```bash
22
- npx agentxchain init
23
- cd my-agentxchain-project # default with init -y, or your chosen folder name
24
- agentxchain kickoff
34
+ npx agentxchain init --governed -y
35
+ cd my-agentxchain-project
36
+ git init
37
+ git add -A
38
+ git commit -m "initial governed scaffold"
39
+ agentxchain status
40
+ agentxchain step --role pm
25
41
  ```
26
42
 
27
- ### Happy path: existing project
28
-
29
- Run these commands from inside your existing project folder:
43
+ If you want template-specific planning artifacts from day one:
30
44
 
31
45
  ```bash
32
- agentxchain doctor
33
- agentxchain generate
34
- agentxchain kickoff
46
+ npx agentxchain init --governed --template api-service -y
35
47
  ```
36
48
 
37
- Each agent runs in its own Cursor window for a single turn at a time. The referee loop (`watch` / `supervise --autonudge`) determines the next agent and wakes that specific session.
49
+ Built-in governed templates:
38
50
 
39
- Agents are now required to maintain `TALK.md` as the human-readable handoff log each turn.
51
+ - `generic`: baseline governed scaffold
52
+ - `api-service`: API contract, operational readiness, error budget
53
+ - `cli-tool`: command surface, platform support, distribution checklist
54
+ - `web-app`: user flows, UI acceptance, browser support
40
55
 
41
- ## Commands
42
-
43
- | Command | What it does |
44
- |---------|-------------|
45
- | `init` | Create project folder with agents, protocol files, and templates |
46
- | `kickoff` | Guided PM-first flow: PM kickoff, validate, launch remaining, release |
47
- | `start` | Open a Cursor window per agent + copy prompts to clipboard |
48
- | `supervise` | Run watcher and optional AppleScript auto-nudge together |
49
- | `generate` | Regenerate agent files from `agentxchain.json` |
50
- | `validate` | Enforce PM signoff + waves/phases + turn artifact schema |
51
- | `status` | Show lock holder, phase, turn number, agents |
52
- | `doctor` | Validate local setup (tools, trigger flow, accessibility checks) |
53
- | `claim` | Human takes control (agents stop claiming) |
54
- | `release` | Hand lock back to agents |
55
- | `stop` | Stop watch daemon, end Claude Code sessions; Cursor/VS Code chats close manually |
56
- | `branch` | Show/set Cursor branch override for launches |
57
- | `watch` | Referee loop: validates turns, writes next trigger, and force-releases stale locks |
58
- | `config` | View/edit config, add/remove agents, change rules |
59
- | `rebind` | Rebuild Cursor workspace/prompt bindings for agents |
60
- | `update` | Self-update CLI from npm |
61
-
62
- ### Full command list
56
+ `step` writes a turn-scoped bundle under `.agentxchain/dispatch/turns/<turn_id>/` and expects a staged result at `.agentxchain/staging/<turn_id>/turn-result.json`. Typical continuation:
63
57
 
64
58
  ```bash
65
- agentxchain init
66
- agentxchain status
67
- agentxchain start
68
- agentxchain kickoff
69
- agentxchain stop
70
- agentxchain branch
71
- agentxchain config
72
- agentxchain rebind
73
- agentxchain generate
74
- agentxchain watch
75
- agentxchain supervise
76
- agentxchain claim
77
- agentxchain release
78
- agentxchain update
79
- agentxchain doctor
80
- agentxchain validate
59
+ agentxchain validate --mode turn
60
+ agentxchain accept-turn
61
+ agentxchain approve-transition
62
+ agentxchain step --role dev
63
+ agentxchain step --role qa
64
+ agentxchain approve-completion
81
65
  ```
82
66
 
83
- ### IDE options
67
+ Default governed scaffolding configures QA as `api_proxy` with `ANTHROPIC_API_KEY`. For a provider-free walkthrough, switch the QA runtime to `manual` before the QA step.
68
+
69
+ ### Migrate a legacy project
84
70
 
85
71
  ```bash
86
- agentxchain start # Cursor (default) — one window per agent
87
- agentxchain start --ide vscode # VS Code — uses .agent.md custom agents + hooks
88
- agentxchain start --ide claude-code # Claude Code — spawns CLI processes
72
+ agentxchain migrate
73
+ agentxchain status
74
+ agentxchain step
89
75
  ```
90
76
 
91
- ### Additional flags
77
+ ## Command Sets
92
78
 
93
- ```bash
94
- agentxchain kickoff # guided first-run PM-first workflow
95
- agentxchain kickoff --ide vscode # guided flow for VS Code mode
96
- agentxchain kickoff --send # with Cursor auto-nudge auto-send enabled
97
- agentxchain kickoff --interval 2 # nudge poll interval override
98
- agentxchain kickoff --no-autonudge # skip auto-nudge prompt
99
-
100
- agentxchain start --agent pm # launch only one specific agent
101
- agentxchain start --remaining # launch all agents except PM (PM-first flow)
102
- agentxchain start --dry-run # preview agents without launching
103
- agentxchain validate --mode kickoff # required before --remaining
104
- agentxchain validate --mode turn --agent pm
105
- agentxchain validate --json # machine-readable validation output
106
- agentxchain watch --daemon # run watch in background
107
- agentxchain supervise --autonudge # run watch + AppleScript nudge loop
108
- agentxchain supervise --autonudge --send # auto-press Enter after paste
109
- agentxchain supervise --interval 2 # set auto-nudge poll interval
110
- agentxchain rebind # regenerate agent prompt/workspace bindings
111
- agentxchain rebind --open # regenerate and reopen all Cursor agent windows
112
- agentxchain rebind --agent pm # regenerate one agent binding only
113
- agentxchain claim --agent pm # guarded claim as agent turn owner
114
- agentxchain release --agent pm # guarded release as agent turn owner
115
- agentxchain release --force # force-release non-human holder lock
116
- agentxchain config --set "rules.strict_next_owner true" # TALK-only next owner (no cyclic fallback)
117
- ```
79
+ ### Governed
118
80
 
119
- ## macOS auto-nudge (AppleScript)
81
+ | Command | What it does |
82
+ |---|---|
83
+ | `init --governed [--template <id>]` | Create a governed project, optionally with project-shape-specific planning artifacts |
84
+ | `migrate` | Convert a legacy v3 project to governed format |
85
+ | `status` | Show current run, template, phase, turn, and approval state |
86
+ | `resume` | Initialize or continue a governed run and assign the next turn |
87
+ | `step` | Run one governed turn end to end or resume an active turn |
88
+ | `accept-turn` | Accept the staged governed turn result |
89
+ | `reject-turn` | Reject the staged result, retry, or reassign |
90
+ | `approve-transition` | Approve a pending human-gated phase transition |
91
+ | `approve-completion` | Approve a pending human-gated run completion |
92
+ | `validate` | Validate governed kickoff wiring, a staged turn, or both |
93
+ | `verify protocol` | Run the shipped protocol conformance suite against a target implementation |
94
+ | `dashboard` | Open the read-only governance dashboard in your browser for repo-local runs or multi-repo coordinator initiatives |
95
+ | `plugin install|list|remove` | Install, inspect, or remove governed hook plugins backed by `agentxchain-plugin.json` manifests |
96
+
97
+ ### Shared utilities
120
98
 
121
- **Recommended:** `agentxchain supervise --autonudge` (starts `watch` + auto-nudge together). Requires macOS, `jq`, and Accessibility for Terminal + Cursor.
99
+ | Command | What it does |
100
+ |---|---|
101
+ | `config` | View or edit project configuration |
102
+ | `update` | Update the CLI from npm |
122
103
 
123
- ```bash
124
- agentxchain supervise --autonudge
125
- agentxchain supervise --autonudge --send # paste + Enter
126
- ```
104
+ ### Legacy v3 compatibility
127
105
 
128
- **Advanced (debugging):** from a checkout of `cli/`, run the script alone while `watch` is already running:
106
+ | Command | What it does |
107
+ |---|---|
108
+ | `init` | Create a legacy project folder |
109
+ | `start` | Launch legacy agents in IDE sessions |
110
+ | `kickoff` | Guided PM-first legacy setup flow |
111
+ | `watch` | Referee loop for legacy lock-based handoff |
112
+ | `supervise` | Run `watch` plus optional macOS auto-nudge |
113
+ | `claim` / `release` | Human override of legacy lock ownership |
114
+ | `rebind` | Rebuild Cursor bindings |
115
+ | `generate` | Regenerate VS Code agent files |
116
+ | `branch` | Manage Cursor branch override for launches |
117
+ | `doctor` | Check local environment and setup |
118
+ | `stop` | Stop watch daemon and local sessions |
119
+
120
+ ## Governed Flow
121
+
122
+ 1. `agentxchain step` initializes or resumes the run if needed.
123
+ 2. It assigns the next role for the current phase.
124
+ 3. It writes `.agentxchain/dispatch/turns/<turn_id>/`.
125
+ 4. The assigned role writes `.agentxchain/staging/<turn_id>/turn-result.json`.
126
+ 5. The orchestrator validates and either accepts, rejects, advances phase, pauses for approval, or completes the run.
127
+
128
+ ## Protocol Conformance
129
+
130
+ AgentXchain ships a conformance kit under `.agentxchain-conformance/`. Use it to prove a runner or fork still implements the governed workflow contract:
129
131
 
130
132
  ```bash
131
- bash scripts/run-autonudge.sh --project "/absolute/path/to/your-project" [--send]
132
- bash scripts/stop-autonudge.sh
133
+ agentxchain verify protocol --tier 3 --target .
133
134
  ```
134
135
 
135
- Notes:
136
- - Requires macOS (`osascript`) and `jq` (`brew install jq`)
137
- - Grant Accessibility permissions to Terminal and Cursor
138
- - The script watches `.agentxchain-trigger.json`, which is written by `agentxchain watch`
139
- - `run-autonudge.sh` now requires watch to be running first
140
- - The script only nudges when it finds a unique matching agent window (no random fallback)
136
+ Useful flags:
141
137
 
142
- ## How it works
138
+ - `--tier 1|2|3`: maximum conformance tier to verify
139
+ - `--surface <name>`: isolate one surface such as `state_machine`, `dispatch_manifest`, or `coordinator`
140
+ - `--format json`: emit a machine-readable report for CI
141
+ - `--target <path>`: point at the root containing `.agentxchain-conformance/capabilities.json`
143
142
 
144
- ### Cursor mode (default)
143
+ Important governed files:
145
144
 
146
- 1. `agentxchain kickoff` launches PM first for human-product alignment
147
- 2. Each window gets a unique prompt copied to clipboard
148
- 3. Kickoff validates PM signoff and launches remaining agents
149
- 4. Agent prompts are single-turn: claim → work → validate → release → stop
150
- 5. Agents use the latest `Next owner:` in `TALK.md` to pick who goes next (fallback: config order)
151
- 6. Human can `claim` to pause and `release` to resume anytime
145
+ ```text
146
+ agentxchain.json
147
+ .agentxchain/state.json
148
+ .agentxchain/history.jsonl
149
+ .agentxchain/decision-ledger.jsonl
150
+ .agentxchain/dispatch/turns/<turn_id>/
151
+ .agentxchain/staging/<turn_id>/turn-result.json
152
+ TALK.md
153
+ .planning/
154
+ ```
152
155
 
153
- ### VS Code mode
156
+ ### Runtime support today
154
157
 
155
- 1. `agentxchain init` generates `.github/agents/*.agent.md` (VS Code custom agents) and `.github/hooks/` (lifecycle hooks)
156
- 2. VS Code discovers custom agents in Chat when using **GitHub Copilot** agents (see Microsoft docs)
157
- 3. The `Stop` hook acts as referee hands off to next agent automatically
158
+ - `manual`: implemented
159
+ - `local_cli`: implemented
160
+ - `api_proxy`: implemented for synchronous review-only turns and stages a provider-backed result during `step`
158
161
 
159
- ### Turn ownership
162
+ ## Legacy IDE Mode
160
163
 
161
- Agent turns are handoff-driven:
162
- - Each turn appends a `Next owner:` in `TALK.md` with a valid agent id
163
- - `watch`/`supervise` dispatches the next trigger from that handoff
164
- - `claim --agent <id>` enforces that expected owner (with guarded fallback)
164
+ Legacy mode is still useful if you specifically want one IDE session per agent and lock-file coordination.
165
165
 
166
- ## Key features
166
+ ```bash
167
+ agentxchain start # Cursor (default)
168
+ agentxchain start --ide vscode
169
+ agentxchain start --ide claude-code
170
+ agentxchain kickoff
171
+ agentxchain supervise --autonudge
172
+ ```
167
173
 
168
- - **One window per agent** each agent has its own Cursor window and chat session
169
- - **Referee-driven coordination** — `watch`/`supervise` wakes the next correct agent each turn
170
- - **Works in Cursor, VS Code, Claude Code** — adapters for each IDE
171
- - **User-defined teams** — any number of agents, any roles
172
- - **No API keys or cloud required** — everything runs locally
173
- - **Human-in-the-loop** — claim/release to intervene anytime
174
- - **Team templates** — SaaS MVP, Landing Page, Bug Squad, API Builder, Refactor Team
175
- - **Lock TTL** — `watch` can force-release stale locks as a safety net
174
+ In this mode, agents hand off through `lock.json`, `state.json`, triggers, and `TALK.md`. For new projects, prefer governed mode unless IDE-window choreography is the goal.
176
175
 
177
- ## VS Code extension (optional)
176
+ ## macOS Auto-Nudge
178
177
 
179
- The VSIX is not committed to the repo. Build/package from `cli/vscode-extension/` (see that folder’s README or `vsce package`), then:
178
+ `supervise --autonudge` is legacy-only and macOS-only.
180
179
 
181
180
  ```bash
182
- code --install-extension /path/to/agentxchain-*.vsix
181
+ agentxchain supervise --autonudge
182
+ agentxchain supervise --autonudge --send
183
183
  ```
184
184
 
185
- ## Publish updates (maintainers)
186
-
187
- ```bash
188
- cd cli
189
- bash scripts/publish-npm.sh # patch bump + publish
190
- bash scripts/publish-npm.sh minor # minor bump + publish
191
- ```
185
+ Requires:
192
186
 
193
- If `NPM_TOKEN` exists in `agentXchain.dev/.env` (project root), the script uses it automatically.
187
+ - `osascript`
188
+ - `jq`
189
+ - Accessibility permissions for Terminal and Cursor
194
190
 
195
191
  ## Links
196
192
 
197
193
  - [agentxchain.dev](https://agentxchain.dev)
194
+ - [Quickstart](https://agentxchain.dev/docs/quickstart/)
195
+ - [CLI reference](https://agentxchain.dev/docs/cli/)
196
+ - [Adapter reference](https://agentxchain.dev/docs/adapters/)
197
+ - [Protocol spec (v6)](https://agentxchain.dev/docs/protocol/)
198
198
  - [GitHub](https://github.com/shivamtiwari93/agentXchain.dev)
199
- - [Protocol v3 spec](https://github.com/shivamtiwari93/agentXchain.dev/blob/main/PROTOCOL-v3.md)
199
+ - [Legacy Protocol v3 spec](https://github.com/shivamtiwari93/agentXchain.dev/blob/main/PROTOCOL-v3.md)
200
200
 
201
201
  ## License
202
202
 
@@ -59,9 +59,33 @@ import { generateCommand } from '../src/commands/generate.js';
59
59
  import { doctorCommand } from '../src/commands/doctor.js';
60
60
  import { superviseCommand } from '../src/commands/supervise.js';
61
61
  import { validateCommand } from '../src/commands/validate.js';
62
+ import { verifyProtocolCommand } from '../src/commands/verify.js';
62
63
  import { kickoffCommand } from '../src/commands/kickoff.js';
63
64
  import { rebindCommand } from '../src/commands/rebind.js';
64
65
  import { branchCommand } from '../src/commands/branch.js';
66
+ import { migrateCommand } from '../src/commands/migrate.js';
67
+ import { resumeCommand } from '../src/commands/resume.js';
68
+ import { acceptTurnCommand } from '../src/commands/accept-turn.js';
69
+ import { rejectTurnCommand } from '../src/commands/reject-turn.js';
70
+ import { stepCommand } from '../src/commands/step.js';
71
+ import { approveTransitionCommand } from '../src/commands/approve-transition.js';
72
+ import { approveCompletionCommand } from '../src/commands/approve-completion.js';
73
+ import { dashboardCommand } from '../src/commands/dashboard.js';
74
+ import {
75
+ pluginInstallCommand,
76
+ pluginListCommand,
77
+ pluginRemoveCommand,
78
+ pluginUpgradeCommand,
79
+ } from '../src/commands/plugin.js';
80
+ import { templateSetCommand } from '../src/commands/template-set.js';
81
+ import { templateListCommand } from '../src/commands/template-list.js';
82
+ import {
83
+ multiInitCommand,
84
+ multiStatusCommand,
85
+ multiStepCommand,
86
+ multiApproveGateCommand,
87
+ multiResyncCommand,
88
+ } from '../src/commands/multi.js';
65
89
 
66
90
  const __dirname = dirname(fileURLToPath(import.meta.url));
67
91
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
@@ -70,24 +94,27 @@ const program = new Command();
70
94
 
71
95
  program
72
96
  .name('agentxchain')
73
- .description('Multi-agent coordination in your IDE')
97
+ .description('Governed multi-agent software delivery orchestration')
74
98
  .version(pkg.version);
75
99
 
76
100
  program
77
101
  .command('init')
78
102
  .description('Create a new AgentXchain project folder')
79
103
  .option('-y, --yes', 'Skip prompts, use defaults')
104
+ .option('--governed', 'Create a governed project (orchestrator-owned state)')
105
+ .option('--template <id>', 'Governed scaffold template: generic, api-service, cli-tool, web-app')
106
+ .option('--schema-version <version>', 'Schema version (3 for legacy, or use --governed for current)')
80
107
  .action(initCommand);
81
108
 
82
109
  program
83
110
  .command('status')
84
- .description('Show lock status, phase, and agents')
111
+ .description('Show current run or lock status')
85
112
  .option('-j, --json', 'Output as JSON')
86
113
  .action(statusCommand);
87
114
 
88
115
  program
89
116
  .command('start')
90
- .description('Launch agents in your IDE')
117
+ .description('Launch legacy v3 agents in your IDE')
91
118
  .option('--ide <ide>', 'Target IDE: cursor, vscode, claude-code', 'cursor')
92
119
  .option('--agent <id>', 'Launch a specific agent only')
93
120
  .option('--remaining', 'Launch all remaining agents except PM (for PM-first flow)')
@@ -96,7 +123,7 @@ program
96
123
 
97
124
  program
98
125
  .command('kickoff')
99
- .description('Guided PM-first first-run workflow')
126
+ .description('Guided legacy PM-first first-run workflow')
100
127
  .option('--ide <ide>', 'Target IDE: cursor, vscode, claude-code', 'cursor')
101
128
  .option('--send', 'When using Cursor auto-nudge, auto-send nudges')
102
129
  .option('--interval <seconds>', 'Auto-nudge poll interval in seconds', '3')
@@ -176,10 +203,164 @@ program
176
203
 
177
204
  program
178
205
  .command('validate')
179
- .description('Validate Get Shit Done docs and QA protocol artifacts')
206
+ .description('Validate project protocol artifacts')
180
207
  .option('--mode <mode>', 'Validation mode: kickoff, turn, full', 'full')
181
208
  .option('--agent <id>', 'Expected agent for last history entry (turn mode)')
182
209
  .option('-j, --json', 'Output as JSON')
183
210
  .action(validateCommand);
184
211
 
212
+ const verifyCmd = program
213
+ .command('verify')
214
+ .description('Verify protocol conformance targets');
215
+
216
+ verifyCmd
217
+ .command('protocol')
218
+ .description('Run the protocol conformance fixture suite against a target implementation')
219
+ .option('--tier <tier>', 'Conformance tier to verify (1, 2, or 3)', '1')
220
+ .option('--surface <surface>', 'Restrict verification to a single surface')
221
+ .option('--target <path>', 'Target root containing .agentxchain-conformance/capabilities.json', '.')
222
+ .option('--format <format>', 'Output format: text or json', 'text')
223
+ .action(verifyProtocolCommand);
224
+
225
+ program
226
+ .command('migrate')
227
+ .description('Migrate a legacy v3 project to governed format')
228
+ .option('-y, --yes', 'Skip confirmation prompts')
229
+ .option('-j, --json', 'Output migration report as JSON')
230
+ .action(migrateCommand);
231
+
232
+ program
233
+ .command('resume')
234
+ .description('Resume a governed project: initialize or continue a run and assign the next turn')
235
+ .option('--role <role>', 'Override the target role (default: phase entry role)')
236
+ .option('--turn <id>', 'Target a specific retained turn when multiple exist')
237
+ .action(resumeCommand);
238
+
239
+ program
240
+ .command('accept-turn')
241
+ .description('Accept the currently staged governed turn result')
242
+ .option('--turn <id>', 'Target a specific active turn when multiple turns exist')
243
+ .option('--resolution <mode>', 'Conflict resolution mode for conflicted turns (standard, human_merge)', 'standard')
244
+ .action(acceptTurnCommand);
245
+
246
+ program
247
+ .command('reject-turn')
248
+ .description('Reject the current governed turn result and retry or escalate')
249
+ .option('--turn <id>', 'Target a specific active turn when multiple turns exist')
250
+ .option('--reason <reason>', 'Operator reason for the rejection')
251
+ .option('--reassign', 'Immediately re-dispatch a conflicted turn with conflict context')
252
+ .action(rejectTurnCommand);
253
+
254
+ program
255
+ .command('step')
256
+ .description('Run a single governed turn: assign, dispatch, wait, validate, accept/reject')
257
+ .option('--role <role>', 'Override the target role (default: phase entry role)')
258
+ .option('--resume', 'Resume waiting for an already-active turn')
259
+ .option('--turn <id>', 'Target a specific active turn (required with --resume when multiple turns exist)')
260
+ .option('--poll <seconds>', 'Polling interval for manual adapter in seconds', '2')
261
+ .option('--verbose', 'Stream local_cli subprocess output while the turn is running')
262
+ .option('--auto-reject', 'Auto-reject and retry on validation failure')
263
+ .action(stepCommand);
264
+
265
+ program
266
+ .command('approve-transition')
267
+ .description('Approve a pending phase transition that requires human sign-off')
268
+ .action(approveTransitionCommand);
269
+
270
+ program
271
+ .command('approve-completion')
272
+ .description('Approve a pending run completion that requires human sign-off')
273
+ .action(approveCompletionCommand);
274
+
275
+ program
276
+ .command('dashboard')
277
+ .description('Open the read-only governance dashboard in your browser')
278
+ .option('--port <port>', 'Server port', '3847')
279
+ .option('--no-open', 'Do not auto-open the browser')
280
+ .action(dashboardCommand);
281
+
282
+ const pluginCmd = program
283
+ .command('plugin')
284
+ .description('Manage governed project plugins');
285
+
286
+ pluginCmd
287
+ .command('install <source>')
288
+ .description('Install a plugin from a local path, archive, or npm package spec')
289
+ .option('--config <json>', 'Inline JSON plugin config validated against config_schema')
290
+ .option('--config-file <path>', 'Read plugin config JSON from a file')
291
+ .option('-j, --json', 'Output as JSON')
292
+ .action(pluginInstallCommand);
293
+
294
+ pluginCmd
295
+ .command('list')
296
+ .description('List installed plugins')
297
+ .option('-j, --json', 'Output as JSON')
298
+ .action(pluginListCommand);
299
+
300
+ pluginCmd
301
+ .command('remove <name>')
302
+ .description('Remove an installed plugin')
303
+ .option('-j, --json', 'Output as JSON')
304
+ .action(pluginRemoveCommand);
305
+
306
+ pluginCmd
307
+ .command('upgrade <name> [source]')
308
+ .description('Upgrade an installed plugin atomically, rolling back on failure')
309
+ .option('--config <json>', 'Inline JSON plugin config validated against config_schema')
310
+ .option('--config-file <path>', 'Read plugin config JSON from a file')
311
+ .option('-j, --json', 'Output as JSON')
312
+ .action(pluginUpgradeCommand);
313
+
314
+ const templateCmd = program
315
+ .command('template')
316
+ .description('Manage governed project templates');
317
+
318
+ templateCmd
319
+ .command('set <id>')
320
+ .description('Set or change the governed template for this project')
321
+ .option('-y, --yes', 'Skip confirmation prompt')
322
+ .option('--dry-run', 'Print what would change without writing anything')
323
+ .action(templateSetCommand);
324
+
325
+ templateCmd
326
+ .command('list')
327
+ .description('List available governed templates')
328
+ .option('-j, --json', 'Output as JSON')
329
+ .action(templateListCommand);
330
+
331
+ const multiCmd = program
332
+ .command('multi')
333
+ .description('Multi-repo coordinator orchestration');
334
+
335
+ multiCmd
336
+ .command('init')
337
+ .description('Bootstrap a multi-repo coordinator run')
338
+ .option('-j, --json', 'Output as JSON')
339
+ .action(multiInitCommand);
340
+
341
+ multiCmd
342
+ .command('status')
343
+ .description('Show coordinator status and repo-run snapshots')
344
+ .option('-j, --json', 'Output as JSON')
345
+ .action(multiStatusCommand);
346
+
347
+ multiCmd
348
+ .command('step')
349
+ .description('Select the next workstream and dispatch a coordinator turn')
350
+ .option('-j, --json', 'Output as JSON')
351
+ .action(multiStepCommand);
352
+
353
+ multiCmd
354
+ .command('approve-gate')
355
+ .description('Approve a pending phase transition or completion gate')
356
+ .option('-j, --json', 'Output as JSON')
357
+ .action(multiApproveGateCommand);
358
+
359
+ multiCmd
360
+ .command('resync')
361
+ .description('Detect divergence and rebuild coordinator state from repo authority')
362
+ .option('-j, --json', 'Output as JSON')
363
+ .option('--dry-run', 'Detect divergence without resyncing')
364
+ .action(multiResyncCommand);
365
+
185
366
  program.parse();