@deksden-com/dd-flow-cli 0.2.0 → 0.3.1

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 (47) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +76 -5
  3. package/dist/build-info.json +10 -6
  4. package/dist/cli/help.js +165 -20
  5. package/dist/cli/run-cli.js +427 -17
  6. package/dist/schemas/compatibility.schema.json +105 -0
  7. package/dist/schemas/engine-manifest.schema.json +61 -0
  8. package/dist/schemas/flow-guidance.schema.json +90 -0
  9. package/dist/schemas/flow-run-index.schema.json +30 -4
  10. package/dist/schemas/global-dashboard-data.schema.json +126 -0
  11. package/dist/schemas/mb-sdlc-review-report.schema.json +242 -0
  12. package/dist/schemas/mb-upgrade-migration-report.schema.json +93 -0
  13. package/dist/schemas/plan-stage-report.schema.json +83 -0
  14. package/dist/schemas/project-dashboard-data.schema.json +122 -0
  15. package/dist/schemas/project-flow-pack-manifest.schema.json +5 -1
  16. package/dist/schemas/project-summary.schema.json +73 -0
  17. package/dist/schemas/protocol-dashboard-data.schema.json +112 -0
  18. package/dist/schemas/status-report.schema.json +38 -2
  19. package/dist/schemas/version-report.schema.json +22 -0
  20. package/dist/services/build-info.js +26 -3
  21. package/dist/services/canon.js +93 -22
  22. package/dist/services/cleanup.js +45 -1
  23. package/dist/services/cli-operation-classifier.js +104 -0
  24. package/dist/services/compatibility-preflight.js +124 -0
  25. package/dist/services/config.js +31 -0
  26. package/dist/services/dashboard-targets.js +95 -0
  27. package/dist/services/dashboard.js +972 -10
  28. package/dist/services/engines.js +532 -0
  29. package/dist/services/flow-guidance.js +221 -0
  30. package/dist/services/hooks.js +1 -1
  31. package/dist/services/ids.js +106 -0
  32. package/dist/services/lanes.js +333 -1
  33. package/dist/services/merge-queue.js +106 -16
  34. package/dist/services/merge-worker.js +67 -4
  35. package/dist/services/migrations.js +231 -0
  36. package/dist/services/project-summary.js +122 -0
  37. package/dist/services/projects.js +44 -3
  38. package/dist/services/protocol-lifecycle.js +144 -0
  39. package/dist/services/protocols.js +660 -7
  40. package/dist/services/runs.js +98 -21
  41. package/dist/services/schema-validation.js +84 -4
  42. package/dist/services/sessions.js +21 -4
  43. package/dist/services/status.js +199 -1
  44. package/dist/services/version-status.js +59 -9
  45. package/dist/storage/database.js +31 -0
  46. package/dist/storage/paths.js +33 -0
  47. package/package.json +3 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # @deksden-com/dd-flow-cli
2
+
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 16f68a3: Add router-native engine snapshot commands and routed project-command dispatch.
8
+
9
+ Also include the runtime/dashboard compatibility wave needed by the current Memory Bank canon:
10
+ - target-based dashboard `open`/`refresh` commands and related-command help;
11
+ - persisted FIFO lane waiters and merge wait-acquire specialization;
12
+ - `migration plan/report/verify` evidence helpers for controlled `mb-upgrade` runtime migrations;
13
+ - `dd-flow/project-summary@1` publication and global dashboard aggregation from project summaries.
14
+ - active npm release runbook notes for Changesets-generated changelogs, strict Memory Bank canon build metadata, token-safe publish, local global link and post-publish compatibility verification.
15
+
16
+ ## 0.3.0
17
+
18
+ ### Minor Changes
19
+
20
+ - Add CLI version preflight support with `dd-flow version`, `dd-flow --version`, `dd-flow version --json`, Memory Bank compatibility verdicts in `dd-flow status`, and an explicit cached npm registry check through `dd-flow status --check-registry`.
21
+ - 565c601: Add static HTML dashboard rendering for global, project, and protocol dashboard pages.
22
+
23
+ The dashboard command family now supports `--format html`, a `dashboard data` command, adjacent JSON data files, protocol pages, bundled dashboard schemas, and compatibility with existing markdown dashboards.
24
+
25
+ - Add `flow_guidance` to status-like protocol/run/project/merge outputs so agents can see current stage, allowed next stages, recommended prompt/action, guard status and missing predecessor evidence without moving semantic planning into the CLI.
26
+ - Store new `RUN-*` artifacts in DD Flow home under `~/.dd-flow/projects/<PRJ-ID>/runs/<RUN-ID>/`, while keeping legacy project `.tasks/dd-flow-runs/<RUN-ID>/` readable as compatibility input.
27
+ - Add protocol-set continuation support: protocol dependency blockers, `protocol ready`, safe `protocol-implement` guidance, blocked-protocol start guards and compact set status data for dashboards.
28
+ - Add `mb-sdlc-review` / `review` flow-kind support, bundled `mb-sdlc-review-report` schema validation, semantic review-report checks and dashboard counters for review runs.
29
+ - Extend dashboard data/rendering for protocol sets, review runs and home-run stage artifacts.
30
+
31
+ ### Patch Changes
32
+
33
+ - Keep merge queue, protocol runtime and run status in sync when a merge job completes, so agents can verify `closed` protocol state, `merged` queue state and `done/merged` run state without stale `claimed` diagnostics.
34
+
35
+ ## 0.2.0
36
+
37
+ ### Minor Changes
38
+
39
+ - Expose canonical Memory Bank version visibility in `dd-flow status`, including CLI build metadata, resolved canon metadata, project Memory Bank markers, project flow pack manifest state, drift diagnostics, and the `dd-flow/status-report@1` schema.
40
+
41
+ ### Patch Changes
42
+
43
+ - 322cae9: Add canonical Memory Bank discovery commands and runtime status output.
package/README.md CHANGED
@@ -97,6 +97,28 @@ dd-flow codex home --help
97
97
  dd-flow worktree --help
98
98
  ```
99
99
 
100
+ ## Engine Router
101
+
102
+ `dd-flow` is the stable router command. The router keeps immutable engine snapshots in `DD_FLOW_HOME/engines` and selects the compatible engine for project-scoped commands.
103
+
104
+ Router-native engine commands do not mutate project runtime:
105
+
106
+ ```bash
107
+ dd-flow engine install --json
108
+ dd-flow engine list --json
109
+ dd-flow engine info --json
110
+ dd-flow engine resolve --project-root "$PWD" --json
111
+ dd-flow engine doctor --project-root "$PWD" --json
112
+ ```
113
+
114
+ Old installable engines are installed from the matching published package version without replacing the global router:
115
+
116
+ ```bash
117
+ npx @deksden-com/dd-flow-cli@<version> engine install
118
+ ```
119
+
120
+ Project commands keep using `dd-flow ...`; agents should not call snapshot entrypoints directly.
121
+
100
122
  ## Lanes And Locks
101
123
 
102
124
  A lane is a named shared operational workspace inside a project. A lane lock is a time-bound ownership lease on that workspace. The CLI enforces one active non-expired lock per project/lane; prompts decide whether a task should use a feature worktree, `direct-main`, or `merge`.
@@ -121,10 +143,20 @@ Inspect lane state:
121
143
  ```bash
122
144
  dd-flow lane status --project-root "$PROJECT_ROOT" --json
123
145
  dd-flow lane lock status --project-root "$PROJECT_ROOT" --lane merge --json
146
+ dd-flow lane waiters --project-root "$PROJECT_ROOT" --lane merge --json
124
147
  ```
125
148
 
126
149
  Branch checks are factual diagnostics. Lock mutation and merge queue claiming validate the registered workspace path mechanically. A mismatch can help a prompt or operator notice the wrong checkout, but the CLI does not decide whether the route is semantically allowed.
127
150
 
151
+ Persisted lane waiters let agents wait for exclusive lane ownership without token-level polling:
152
+
153
+ ```bash
154
+ dd-flow lane lock wait-acquire --project-root "$PROJECT_ROOT" --lane merge --worker-id "$WORKER_ID" --path "$WORKSPACE" --timeout 300 --poll-interval 10 --ttl 300 --reason "merge worker" --json
155
+ dd-flow lane waiter cancel --project-root "$PROJECT_ROOT" --lane merge --worker-id "$WORKER_ID" --reason "session stopped" --json
156
+ ```
157
+
158
+ `wait-acquire` creates one queued waiter per `project/lane/worker-id`, preserves FIFO acquisition order, treats same-worker retries idempotently, returns `timed_out` for the command's own timeout, and leaves stale queued waiters for `cleanup scan/apply`.
159
+
128
160
  ## Direct Main Recipe
129
161
 
130
162
  Use `direct-main` only after the prompt or operator has chosen direct integration work for a small, low-risk task.
@@ -164,7 +196,9 @@ For supervisor-style waiting outside model tokens:
164
196
  dd-flow merge-queue wait-next --project-root "$PROJECT_ROOT" --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --timeout 1200 --poll-interval 10 --acquire-lock true --json
165
197
  ```
166
198
 
167
- With `--acquire-lock true`, `wait-next` heartbeats the merge lane lock while it waits and releases a lock it acquired itself when the wait times out. Live merge workers should prefer long waits, for example 1200 seconds / 20 minutes, so the agent sleeps inside the CLI process instead of spending model tokens on frequent polling.
199
+ With `--acquire-lock true`, `wait-next` first uses the generic FIFO lane waiter path for `lane=merge`, then heartbeats the merge lane lock while it waits and releases a lock it acquired itself when the wait times out. Live merge workers should prefer long waits, for example 1200 seconds / 20 minutes, so the agent sleeps inside the CLI process instead of spending model tokens on frequent polling.
200
+
201
+ Merge queue JSON uses `queue_item`, `protocol`, and `claim` as the primary queued/claimed protocol contract. The legacy `job` field remains as a compatibility alias during the migration window.
168
202
 
169
203
  Complete or fail the claimed job:
170
204
 
@@ -206,6 +240,32 @@ dd-flow protocol cancel PRT-... --reason "replaced by fresh run" --close-session
206
240
 
207
241
  For a stale disposable feature checkout, use `--worktree remove`. The command removes the git worktree recorded either in `worktree_records` or in stable runtime `state.workspace`; with `--force`, it also force-deletes the local feature branch when present. It refuses dirty worktrees without `--force` and refuses to remove the stable project root or the current process working directory.
208
242
 
243
+ ## mb-upgrade Runtime Migrations
244
+
245
+ Normal `dd-flow` commands do not migrate project runtime or home data just because a newer router/engine can read an older project. Runtime/home data migrations belong to the explicit canonical `mb-upgrade` contour and need backup evidence, an adjacent migration chain, active-state handling and post-upgrade verification.
246
+
247
+ Use migration evidence helpers from `mb-upgrade`:
248
+
249
+ ```bash
250
+ dd-flow migration plan --project-root "$PROJECT_ROOT" --source-version "$OLD_MB" --target-version "$NEW_MB" --run "$RUN_ID" --backup-path "$BACKUP" --json
251
+ dd-flow migration report --project-root "$PROJECT_ROOT" --source-version "$OLD_MB" --target-version "$NEW_MB" --run "$RUN_ID" --backup-path "$BACKUP" --json
252
+ dd-flow migration verify --file "$RUN_HOME/03-upgrade/migration-report.json" --json
253
+ ```
254
+
255
+ The report contract is `dd-flow/mb-upgrade-migration-report@1`. A blocked report is valid evidence that upgrade cannot safely mutate runtime yet; it is not permission to bypass active protocols, active runs, merge queue items or lane locks.
256
+
257
+ ## Project Summaries
258
+
259
+ Global dashboard data should consume compact project summaries instead of scanning deep project runtime directly. Publish the current project's read model with:
260
+
261
+ ```bash
262
+ dd-flow project summary --project-root "$PROJECT_ROOT" --json
263
+ ```
264
+
265
+ The summary is written to `~/.dd-flow/projects/<project-id>/summary/project-summary.json` and uses `dd-flow/project-summary@1`. `dashboard refresh --project <project>` also publishes the summary before rendering dashboards. Use `--write false` to inspect the payload without writing it.
266
+
267
+ Global dashboard data reads published project summaries and builds one prepared JSON model for the renderer. Compatible summaries become project cards; missing, unreadable or unsupported summaries are listed in `unsupported_projects` with a reason, summary path and install/refresh hint when available. The global dashboard also exposes `supported_summary_versions` and `summary_version_groups` so agents can see which local projects are represented by each summary contract version.
268
+
209
269
  ## Cleanup
210
270
 
211
271
  Use cleanup when local runtime state is stale after a crash, abandoned rerun, or removed feature worktree. `cleanup scan` is read-only. `cleanup apply` requires an explicit plan file and reason, reports requested/applied/changed/skipped action results, and dirty/destructive worktree actions require `--force --reason`. Worktree record cleanup marks a checkout `removed` only when the path is already absent; if the checkout still exists, the record is closed as `kept` rather than silently deleting files.
@@ -224,22 +284,33 @@ Dashboard markdown is rendered state, not source of truth. Successful state-chan
224
284
 
225
285
  The dashboard is intentionally compact: it shows the last update time, active protocols/sessions, merge queue summary, active locks, recent outcomes, and missing project roots without dumping full hook payloads into the main view.
226
286
 
287
+ Dashboard JSON separates protocol lifecycle from resource coordination. New consumers should read `lifecycle`, `lifecycle_summary`, `resource_summary`, `queued_protocols`, `queue_item`, and `claim` when present. Legacy fields such as `current_stage`, `raw_stage`, `raw_status`, `merge_queue`, and `job` remain available as compatibility aliases or diagnostics during the migration window.
288
+
227
289
  Defaults:
228
290
 
229
291
  ```text
230
292
  project dashboard: .tasks/dd-flow-dashboard.md
231
293
  global dashboard: ~/.dd-flow/dashboard.md
294
+ project HTML: ~/.dd-flow/projects/<PRJ-ID>/dashboard/project-dashboard.html
295
+ protocol HTML: ~/.dd-flow/projects/<PRJ-ID>/dashboard/protocols/<PRT-ID>.html
232
296
  ```
233
297
 
234
298
  Useful commands:
235
299
 
236
300
  ```bash
237
- dd-flow dashboard render --project-root "$PROJECT_ROOT" --json
238
- dd-flow dashboard render-global --json
239
- dd-flow dashboard refresh --project-root "$PROJECT_ROOT" --open false --json
240
- dd-flow dashboard open --project-root "$PROJECT_ROOT" --viewer cmux --json
301
+ dd-flow dashboard open --json
302
+ dd-flow dashboard refresh --json
303
+ dd-flow dashboard refresh --all --json
304
+ dd-flow dashboard refresh --project PRJ-001 --open false --json
305
+ dd-flow dashboard open --project PRJ-001 --viewer cmux --json
306
+ dd-flow dashboard data --project PRJ-001 --json
241
307
  ```
242
308
 
309
+ Compatibility forms remain available for older prompts and scripts: `refresh-global`,
310
+ `render-global`, `--project-root`, and `data --global`. Prefer the target-based
311
+ commands above for new automation. `--project` accepts a full project id, short
312
+ id, slug, or registered project root path.
313
+
243
314
  Config keys:
244
315
 
245
316
  ```bash
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "cli_package": "@deksden-com/dd-flow-cli",
3
- "cli_version": "0.2.0",
4
- "cli_commit": "8351d94bdeaca22d2fff503fd2b08071c86205cd",
5
- "built_at": "2026-06-15T14:46:55.550Z",
3
+ "cli_version": "0.3.1",
4
+ "cli_commit": "b677e824e7d3b1e6553e7963eeceeb1db02e86db",
5
+ "built_at": "2026-07-03T20:02:54.356Z",
6
6
  "built_with_canon": {
7
- "version": "2.4.0",
8
- "commit": "cf1f6d08e8d4775bf14334c6010b479d1c6fd73f",
9
- "flow_contract": "dd-flow-canonical-2026-05"
7
+ "version": "2.9.0",
8
+ "commit": "7e8b51c1321e290d18df3572d6ab26ed32b85403",
9
+ "flow_contract": "dd-flow-canonical-2026-06",
10
+ "repo_root": "/Users/deksden/Documents/_Projects/dd-memorybank",
11
+ "memorybank_root": "/Users/deksden/Documents/_Projects/dd-memorybank/.memory-bank",
12
+ "flow_root": "/Users/deksden/Documents/_Projects/dd-memorybank/.memory-bank/dd-flow",
13
+ "layout": "dot_memory_bank"
10
14
  }
11
15
  }
package/dist/cli/help.js CHANGED
@@ -9,21 +9,26 @@ Usage:
9
9
  dd-flow <command> --help
10
10
 
11
11
  Core commands:
12
+ version Print the installed dd-flow CLI package version.
12
13
  status Inspect dd-flow runtime, project and canon roots.
14
+ engine install/list/info Manage locally installed dd-flow engine snapshots.
15
+ engine resolve/doctor Inspect router engine selection and health.
13
16
  canon register/status/resolve Register and resolve the canonical Memory Bank.
14
- project register/status Register a project and inspect runtime state.
17
+ project register/status/summary Register a project, inspect state, and publish project summaries.
15
18
  project resolve/archive Resolve typed ids and archive stale project roots.
16
19
  project migrate-ids Migrate old project ids.
17
- protocol register/status Register and inspect protocol state.
20
+ protocol register/status/transition Register, inspect, transition and repair protocol state.
21
+ migration plan/report/verify Prepare and verify mb-upgrade runtime migration evidence.
18
22
  cleanup scan/apply Detect and repair stale local runtime state.
19
23
  run start/status/list Track concrete flow executions and stage artifacts.
24
+ id next Preview next typed ids for protocol or run allocation.
20
25
  plan set/status/item Attach and update protocol plans.
21
26
  lane workspace/lock/status Manage shared workspace lanes and leases.
22
27
  merge status/one-shot Inspect or claim one merge job from the current session.
23
28
  merge-worker status/start/stop Manage long-lived project merge workers.
24
29
  merge-queue status/next Claim, wait for, complete, or fail merge jobs.
25
30
  session register/status/stop Register flow sessions and stop workers.
26
- dashboard render/open/refresh Render markdown project/global dashboards.
31
+ dashboard data/render/open/refresh Render, refresh, open, and inspect project/global dashboards.
27
32
  schema validate Validate canonical dd-flow JSON data contracts.
28
33
  memory permissions preflight Check Memory Bank write/read permissions.
29
34
  integration cmux status Inspect optional cmux integration.
@@ -32,6 +37,9 @@ Core commands:
32
37
 
33
38
  Examples:
34
39
  dd-flow project register --root "$PWD"
40
+ dd-flow version
41
+ dd-flow engine install --json
42
+ dd-flow engine resolve --project-root "$PWD" --json
35
43
  dd-flow status --project-root "$PWD" --json
36
44
  dd-flow canon register --root "$DD_MEMORYBANK" --json
37
45
  dd-flow canon resolve --json
@@ -39,7 +47,9 @@ Examples:
39
47
  dd-flow project resolve PRJ-001 --json
40
48
  dd-flow project archive PRJ-001 --reason "old missing worktree root" --json
41
49
  dd-flow project migrate-ids --root "$PWD" --apply --json
42
- dd-flow run start --project-root "$PWD" --flow-kind coding --subject-type protocol --subject-id PRT-001-demo --slug demo --json
50
+ dd-flow run start --project-root "$PWD" --flow-kind mb_sdlc --subject-type protocol --subject-id PRT-001-demo --slug demo --json
51
+ dd-flow id next --type protocol --project-root "$PWD" --slug demo --json
52
+ dd-flow protocol transition PRT-001-demo --to implementation --payload-file transition.json --json
43
53
  dd-flow lane workspace set --project-root "$PWD" --lane merge --path "$PWD" --branch main --json
44
54
  dd-flow lane lock acquire --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --ttl 300 --reason "merge worker" --json
45
55
  dd-flow merge status --project-root "$PWD" --json
@@ -48,6 +58,44 @@ Examples:
48
58
  Default output is human-readable. Use --json for hooks, prompts, scripts and other agent automation; JSON mode never mixes human progress text into stdout.
49
59
 
50
60
  project_root is the stable repository identity. workspace_path is the concrete checkout where an agent is about to work.`
61
+ ],
62
+ [
63
+ "version",
64
+ `dd-flow version - print CLI package version
65
+
66
+ Usage:
67
+ dd-flow version
68
+ dd-flow version --json
69
+ dd-flow --version
70
+
71
+ version reports the installed dd-flow CLI package version from package metadata. Use status for richer canon/project compatibility diagnostics.
72
+
73
+ Examples:
74
+ dd-flow version
75
+ dd-flow version --json`
76
+ ],
77
+ [
78
+ "engine",
79
+ `dd-flow engine - manage router-installed engine snapshots
80
+
81
+ Usage:
82
+ dd-flow engine install [--force] --json
83
+ dd-flow engine list --json
84
+ dd-flow engine info [--package <name>] [--version <version>] --json
85
+ dd-flow engine resolve [--project-root <root>] --json
86
+ dd-flow engine doctor [--project-root <root>] --json
87
+
88
+ The globally invoked dd-flow command is the stable router surface. Engine snapshots live under DD_FLOW_HOME/engines and are selected by project Memory Bank compatibility data. Running an old package through npx can install that package's own engine without replacing the global router:
89
+
90
+ npx @deksden-com/dd-flow-cli@<version> engine install
91
+
92
+ Router-native engine commands never mutate project runtime data. Normal project commands are routed to a compatible engine or fail closed with a missing-engine diagnostic.
93
+
94
+ Examples:
95
+ dd-flow engine install --json
96
+ dd-flow engine list --json
97
+ dd-flow engine resolve --project-root "$PWD" --json
98
+ dd-flow engine doctor --project-root "$PWD" --json`
51
99
  ],
52
100
  [
53
101
  "status",
@@ -56,9 +104,12 @@ project_root is the stable repository identity. workspace_path is the concrete c
56
104
  Usage:
57
105
  dd-flow status [--project-root <root>] --json
58
106
  dd-flow status [--root <root>] --json
107
+ dd-flow status [--project-root <root>] [--check-registry] --json
59
108
 
60
109
  status reports DD_FLOW_HOME, the requested or current project root, registered project identity when available, and canonical Memory Bank discovery. It does not require the project to be registered and does not mutate state. In JSON mode canon discovery is embedded as a structured assessment so agents can detect missing or ambiguous canon roots without parsing stderr.
61
110
 
111
+ By default status does not call the network. Use --check-registry for an explicit cached npm latest check.
112
+
62
113
  Examples:
63
114
  dd-flow status --project-root "$PWD" --json
64
115
  dd-flow status --json`
@@ -87,18 +138,33 @@ Examples:
87
138
 
88
139
  Usage:
89
140
  dd-flow run start --project-root <root> [--workspace-root <checkout>] --flow-kind <kind> --subject-type <type> --subject-id <id> --slug <slug> [--next-action <text>] --json
141
+ dd-flow id next --type protocol|run --project-root <root> --slug <slug> --json
90
142
  dd-flow run status <RUN-ID|RUN-NNN> --project-root <root> --json
91
143
  dd-flow run list --project-root <root> --json
92
144
  dd-flow run attach-stage <RUN-ID|RUN-NNN> --project-root <root> --stage <name> --dir <NN-stage-slug> --status <status> [--data-schema-id <id>] --json
93
145
  dd-flow run complete-stage <RUN-ID|RUN-NNN> --project-root <root> --stage <name> --status <status> [--stage-report <path>] [--data <path>] [--data-schema-id <id>] [--report <path>] [--alias <path>] --json
94
146
  dd-flow run complete <RUN-ID|RUN-NNN> --project-root <root> --status done|blocked|cancelled|failed [--verdict <text>] [--next-action <text>] --json
95
147
 
96
- RUN-* is the execution envelope for one concrete flow launch. Semantic truth remains in protocol, experiment, DEF, scenario, evidence, and Memory Bank documents. Runtime state is stored under DD_FLOW_HOME/projects/<PRJ-ID-slug>/runtime/runs/<RUN-ID-slug>/, while human-facing artifacts are indexed through <workspace>/.tasks/dd-flow-runs/<RUN-ID-slug>/run-index.json.
148
+ RUN-* is the execution envelope for one concrete flow launch. Semantic truth remains in protocol, experiment, DEF, scenario, evidence, and Memory Bank documents. New run artifacts are stored under DD_FLOW_HOME/projects/<PRJ-ID-slug>/runs/<RUN-ID-slug>/ with run.json and run-index.json together. Legacy <workspace>/.tasks/dd-flow-runs/<RUN-ID-slug>/ indexes remain readable.
97
149
 
98
150
  Examples:
99
- dd-flow run start --project-root "$PWD" --flow-kind coding --subject-type protocol --subject-id PRT-001-demo --slug demo --json
151
+ dd-flow run start --project-root "$PWD" --flow-kind mb_sdlc --subject-type protocol --subject-id PRT-001-demo --slug demo --json
152
+ dd-flow id next --type run --project-root "$PWD" --slug demo --json
100
153
  dd-flow run attach-stage RUN-001 --project-root "$PWD" --stage plan --dir 01-plan --status running --json
101
154
  dd-flow run complete-stage RUN-001 --project-root "$PWD" --stage plan --status done --data 01-plan/stage-report.json --stage-report 01-plan/stage-report.html --report 01-plan/report.md --json`
155
+ ],
156
+ [
157
+ "id",
158
+ `dd-flow id - preview next typed ids
159
+
160
+ Usage:
161
+ dd-flow id next --type protocol|run --project-root <root> --slug <slug> --json
162
+
163
+ id next is read-only: it scans runtime records and known project files, then returns the next available TYPE-NNN-slug without reserving it. Use run start or protocol register to create durable state.
164
+
165
+ Examples:
166
+ dd-flow id next --type protocol --project-root "$PWD" --slug demo --json
167
+ dd-flow id next --type run --project-root "$PWD" --slug demo --json`
102
168
  ],
103
169
  [
104
170
  "protocol",
@@ -107,10 +173,27 @@ Examples:
107
173
  Usage:
108
174
  dd-flow protocol register <handshake-id> --project-root <root> [--workspace-path <checkout>] --json
109
175
  dd-flow protocol status <protocol-id> --json
176
+ dd-flow protocol ready --project-root <root> --json
177
+ dd-flow protocol blockers <protocol-id> --project-root <root> --json
178
+ dd-flow protocol implement <protocol-id> --project-root <root> [--force --reason <text>] --json
179
+ dd-flow protocol transition <protocol-id> --to <stage> --payload-file <file> [--force --reason <text>] --json
180
+ dd-flow protocol sync-from-run <protocol-id> --run <RUN-ID|RUN-NNN> [--target auto|<stage>] --json
110
181
  dd-flow protocol ready-for-merge <protocol-id> --json
111
182
  dd-flow protocol cancel <protocol-id> --reason <text> [--close-sessions true|false] [--cancel-queue true|false] [--release-locks true|false] [--worktree keep|remove] [--force] --json
112
183
 
184
+ ready, blockers and implement read protocol markdown frontmatter plus runtime state. implement is a preflight/guidance command: it never performs implementation, refuses unresolved blocked_by_protocols unless --force --reason is supplied, refuses terminal protocols and reports the expected next prompt/stage. transition validates the snapshotted flow contract stored in protocol runtime state, writes an audit event and updates lifecycle fields from the payload. --json-file is accepted as a compatibility alias for --payload-file. sync-from-run repairs legacy protocol/run mismatch from concrete RUN evidence instead of requiring manual runtime JSON edits.
185
+
113
186
  The project_root is the stable project identity used for queues, sessions, lanes, and dashboards. Runtime state is stored under DD_FLOW_HOME/projects/<PRJ-ID-slug>/runtime so feature worktree removal does not break status, cancel, or merge finalization. The optional workspace_path records the concrete checkout where the agent works. With --worktree remove, cancel removes the disposable git worktree recorded in runtime state or worktree records; with --force it also force-deletes the local feature branch when present.`
187
+ ],
188
+ [
189
+ "transition",
190
+ `dd-flow transition - compatibility alias for protocol transition
191
+
192
+ Usage:
193
+ dd-flow transition <protocol-id> --to <stage> --payload-file <file> [--force --reason <text>] --json
194
+ dd-flow transition <protocol-id> --to <stage> --json-file <file> [--force --reason <text>] --json
195
+
196
+ Prefer dd-flow protocol transition in new prompts and scripts. This top-level alias remains for older canonical prompts and experiments.`
114
197
  ],
115
198
  [
116
199
  "project",
@@ -119,12 +202,29 @@ The project_root is the stable project identity used for queues, sessions, lanes
119
202
  Usage:
120
203
  dd-flow project register --root <root> --json
121
204
  dd-flow project status --root <root> --json
205
+ dd-flow project summary --project-root <root> [--write true|false] --json
122
206
  dd-flow project resolve <PRJ-ID|PRJ-NNN> --json
123
207
  dd-flow project archive <PRJ-ID|PRJ-NNN> --reason <text> --json
124
208
  dd-flow project archive --root <previous-root-path> --reason <text> --json
125
209
  dd-flow project migrate-ids --root <root> [--apply] --json
126
210
 
127
- New registrations use full typed ids such as PRJ-001-dd-flow-playground and short aliases such as PRJ-001. project resolve accepts full id or unique short alias. project archive removes stale or deleted project roots from active dashboards without deleting history. Re-registering an existing root reactivates it. migrate-ids is the explicit transition path for old hash-based local project ids; without --apply it returns a dry-run plan.`
211
+ New registrations use full typed ids such as PRJ-001-dd-flow-playground and short aliases such as PRJ-001. project resolve accepts full id or unique short alias. project summary writes dd-flow/project-summary@1 to the project's home summary directory by default; use --write false to inspect the payload without writing. project archive removes stale or deleted project roots from active dashboards without deleting history. Re-registering an existing root reactivates it. migrate-ids is the explicit transition path for old hash-based local project ids; without --apply it returns a dry-run plan.`
212
+ ],
213
+ [
214
+ "migration",
215
+ `dd-flow migration - plan and verify mb-upgrade runtime/home data migrations
216
+
217
+ Usage:
218
+ dd-flow migration plan --project-root <root> [--source-version <version>] [--target-version <version>] [--run <RUN-ID>] [--backup-path <path>] [--backup-created-at <iso>] [--allow-active true|false] --json
219
+ dd-flow migration report --project-root <root> [--source-version <version>] [--target-version <version>] [--run <RUN-ID>] [--backup-path <path>] [--backup-created-at <iso>] [--allow-active true|false] --json
220
+ dd-flow migration verify --file <mb-upgrade-migration-report.json> --json
221
+
222
+ Migration commands are evidence and guardrail helpers for canonical mb-upgrade. They do not silently migrate runtime/home data during ordinary CLI use. Applying migrations remains an explicit mb-upgrade contour with backup, adjacent migration chain, active-state handling, derived artifact regeneration and post-upgrade verification.
223
+
224
+ Related commands:
225
+ dd-flow status --project-root <root> --json
226
+ dd-flow memory permissions preflight --root <root> --memory-bank .memory-bank --flow mb-upgrade --mode write --json
227
+ dd-flow dashboard refresh --project <project> --json`
128
228
  ],
129
229
  [
130
230
  "lane",
@@ -132,13 +232,16 @@ New registrations use full typed ids such as PRJ-001-dd-flow-playground and shor
132
232
 
133
233
  Usage:
134
234
  dd-flow lane status --project-root <root> --json
235
+ dd-flow lane waiters --project-root <root> [--lane <name>] --json
135
236
  dd-flow lane workspace <action> [options] --json
136
237
  dd-flow lane lock <action> [options] --json
238
+ dd-flow lane waiter <action> [options] --json
137
239
 
138
240
  Use lanes when multiple agents might edit or merge through the same workspace. The CLI enforces mechanical ownership only; prompts decide whether a route should use merge, direct-main, or a feature worktree.
139
241
 
140
242
  Examples:
141
243
  dd-flow lane status --project-root "$PWD" --json
244
+ dd-flow lane waiters --project-root "$PWD" --lane merge --json
142
245
  dd-flow lane workspace set --project-root "$PWD" --lane direct-main --path "$PWD" --branch main --json
143
246
  dd-flow lane lock status --project-root "$PWD" --lane direct-main --json`
144
247
  ],
@@ -166,13 +269,30 @@ Usage:
166
269
  dd-flow lane lock release --project-root <root> --lane <name> --worker-id <id> [--path <workspace>] [--lease-token <token>] --reason <text> --json
167
270
  dd-flow lane lock status --project-root <root> --lane <name> --json
168
271
  dd-flow lane lock wait --project-root <root> --lane <name> --worker-id <id> [--path <workspace>] --timeout <seconds> --poll-interval <seconds> --json
272
+ dd-flow lane lock wait-acquire --project-root <root> --lane <name> --worker-id <id> [--path <workspace>] --timeout <seconds> --poll-interval <seconds> [--ttl 300] --reason <text> --json
169
273
 
170
- Lock mutation commands validate that --path, or the current working directory when --path is omitted, matches the registered lane workspace. Only the owner can heartbeat or release an active lease. Expired leases can be taken over mechanically and are recorded in audit.
274
+ Lock mutation commands validate that --path, or the current working directory when --path is omitted, matches the registered lane workspace. Only the owner can heartbeat or release an active lease. wait-acquire creates a persisted FIFO waiter before acquiring the lock. Expired leases and stale waiters are recorded in audit.
171
275
 
172
276
  Examples:
173
277
  dd-flow lane lock acquire --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --ttl 300 --reason "merge worker" --json
278
+ dd-flow lane lock wait-acquire --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --timeout 300 --poll-interval 10 --reason "merge worker" --json
174
279
  dd-flow lane lock heartbeat --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --lease-token "$TOKEN" --json
175
280
  dd-flow lane lock release --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --lease-token "$TOKEN" --reason done --json`
281
+ ],
282
+ [
283
+ "lane waiter",
284
+ `dd-flow lane waiter - inspect and cancel persisted lane waiters
285
+
286
+ Usage:
287
+ dd-flow lane waiters --project-root <root> [--lane <name>] --json
288
+ dd-flow lane waiter cancel --project-root <root> --lane <name> --worker-id <id> --reason <text> --json
289
+
290
+ Waiters are runtime coordination records, not protocols or domain jobs. Use waiters to coordinate fair access to exclusive lanes before a worker owns the lane lock.
291
+
292
+ Related lane commands:
293
+ dd-flow lane lock wait-acquire --project-root "$PWD" --lane merge --worker-id worker-1 --path "$PWD" --timeout 300 --poll-interval 10 --reason "merge worker" --json
294
+ dd-flow lane lock status --project-root "$PWD" --lane merge --json
295
+ dd-flow lane waiter cancel --project-root "$PWD" --lane merge --worker-id worker-1 --reason "session stopped" --json`
176
296
  ],
177
297
  [
178
298
  "merge",
@@ -182,7 +302,7 @@ Usage:
182
302
  dd-flow merge status --project-root <root> --json
183
303
  dd-flow merge one-shot --project-root <root> --worker-id <id> [--path <workspace>] --json
184
304
 
185
- merge status reports active merge worker, claimed jobs, active merge lane lock and queue state. merge one-shot is status-only when a long-lived worker, claimed job or active lock exists; otherwise it acquires the merge lane, claims at most one ready job, and returns that job for the shared merge job prompt. If no job is ready, it releases the lock and returns job: null.`
305
+ merge status reports active merge worker, claimed protocols, active merge lane lock and queue state. merge one-shot is status-only when a long-lived worker, claimed protocol or active lock exists; otherwise it acquires the merge lane, claims at most one ready protocol, and returns queue_item/protocol/claim plus legacy job for the shared merge job prompt. If no protocol is ready, it releases the lock and returns queue_item: null and job: null.`
186
306
  ],
187
307
  [
188
308
  "merge-worker",
@@ -208,7 +328,7 @@ Usage:
208
328
  dd-flow merge-queue fail <protocol-id> --worker-id <id> [--path <workspace>] --reason <text> --requeue true|false --json
209
329
  dd-flow merge-queue cancel <protocol-id> --reason <text> [--worker-id <id>] [--path <workspace>] [--force] --json
210
330
 
211
- The worker must own the merge lane from the registered merge workspace before claiming, completing, or failing jobs. note updates the final completion summary after post-complete cleanup and does not require a lane lock. --path defaults to the current working directory. Use --worker-id as the owner identity.
331
+ The worker must own the merge lane from the registered merge workspace before claiming, completing, or failing queued protocols. Outputs use queue_item/protocol/claim as the primary contract and retain job as a compatibility alias. note updates the final completion summary after post-complete cleanup and does not require a lane lock. --path defaults to the current working directory. Use --worker-id as the owner identity.
212
332
 
213
333
  Examples:
214
334
  dd-flow merge-queue wait-next --project-root "$PWD" --worker-id merge-worker --path "$PWD" --timeout 1200 --poll-interval 10 --acquire-lock true --json
@@ -227,12 +347,12 @@ cleanup scan is read-only and returns deterministic findings plus plan.actions.
227
347
  ],
228
348
  [
229
349
  "merge-queue wait-next",
230
- `dd-flow merge-queue wait-next - wait for the next ready merge job
350
+ `dd-flow merge-queue wait-next - wait for the next ready merge protocol
231
351
 
232
352
  Usage:
233
353
  dd-flow merge-queue wait-next --project-root <root> --worker-id <id> [--path <workspace>] --timeout <seconds> --poll-interval <seconds> [--acquire-lock true] --json
234
354
 
235
- Use this from a shell or supervisor to wait outside model tokens. Live merge workers should prefer long waits, for example --timeout 1200 --poll-interval 10, so the agent sleeps inside the CLI process instead of spending model tokens on frequent polling. If --acquire-lock true is used, the merge lock is heartbeated while waiting and a lock acquired by this command is released on timeout. If a job is ready, it is claimed atomically. If no job appears before the timeout, the command returns a structured timeout result.
355
+ Use this from a shell or supervisor to wait outside model tokens. Live merge workers should prefer long waits, for example --timeout 1200 --poll-interval 10, so the agent sleeps inside the CLI process instead of spending model tokens on frequent polling. If --acquire-lock true is used, wait-next first enters the generic FIFO lane waiter path (lane lock wait-acquire --lane merge), then heartbeats the merge lock while waiting for a ready protocol. A lock acquired by this command is released on timeout. If a protocol is ready, it is claimed atomically. If no protocol appears before the timeout, the command returns outcome: wait_timeout with queue_item: null and legacy job: null.
236
356
 
237
357
  Examples:
238
358
  dd-flow merge-queue wait-next --project-root "$PWD" --worker-id supervisor --path "$PWD" --timeout 1200 --poll-interval 10 --acquire-lock true --json`
@@ -277,16 +397,41 @@ Usage:
277
397
  ],
278
398
  [
279
399
  "dashboard",
280
- `dd-flow dashboard - render or open markdown dashboards
400
+ `dd-flow dashboard - render, refresh, open, and inspect markdown/HTML dashboards
281
401
 
282
402
  Usage:
283
- dd-flow dashboard render --project-root <root> [--output <path>] --json
284
- dd-flow dashboard render-global [--output <path>] --json
285
- dd-flow dashboard open --project-root <root> [--viewer cmux] --json
286
- dd-flow dashboard refresh --project-root <root> [--open auto|true|false] --json
287
- dd-flow dashboard refresh-global [--output <path>] --json
288
-
289
- Dashboards are rendered views of dd-flow state. State-changing commands refresh markdown automatically when dashboard.auto_refresh is enabled. dashboard refresh rewrites project and global markdown when enabled. cmux is used only by explicit open/refresh commands and only according to project config.`
403
+ dd-flow dashboard open [--viewer cmux] [--format html|markdown] --json
404
+ dd-flow dashboard refresh [--format html|markdown] --json
405
+ dd-flow dashboard refresh --all [--format html|markdown] --json
406
+ dd-flow dashboard refresh --project <project> [--format html|markdown] [--protocol <PRT-ID>] [--open auto|true|false] --json
407
+ dd-flow dashboard open --project <project> [--protocol <PRT-ID>] [--viewer cmux] [--format html] --json
408
+ dd-flow dashboard data [--project <project>] [--protocol <PRT-ID>] --json
409
+ dd-flow dashboard render [--project <project>] [--format html|markdown] [--protocol <PRT-ID>] [--output <path>] --json
410
+
411
+ Compatibility aliases and explicit low-level forms:
412
+ dd-flow dashboard refresh-global [--format markdown|html] [--output <path>] --json
413
+ Preferred: dd-flow dashboard refresh
414
+ dd-flow dashboard render-global [--format markdown|html] [--output <path>] --json
415
+ Preferred: dd-flow dashboard render
416
+ dd-flow dashboard refresh --project-root <root> [--format markdown|html] [--protocol <PRT-ID>] [--open auto|true|false] --json
417
+ Preferred: dd-flow dashboard refresh --project <project>
418
+ dd-flow dashboard open --project-root <root> [--format markdown|html] [--viewer cmux] --json
419
+ Preferred: dd-flow dashboard open --project <project>
420
+ dd-flow dashboard render --project-root <root> [--format markdown|html] [--protocol <PRT-ID>] [--output <path>] --json
421
+ Preferred: dd-flow dashboard render --project <project>
422
+ dd-flow dashboard data --global --json
423
+ Preferred: dd-flow dashboard data
424
+
425
+ Project accepts full id, short id, slug, or registered project root path.
426
+
427
+ Related dashboard commands:
428
+ dd-flow dashboard open
429
+ dd-flow dashboard refresh
430
+ dd-flow dashboard refresh --all
431
+ dd-flow dashboard open --project <project>
432
+ dd-flow dashboard data --project <project> --json
433
+
434
+ Dashboards are rendered views of dd-flow state. Markdown remains the compatibility fallback. HTML dashboards write JSON next to self-contained local HTML: global under DD_FLOW_HOME/dashboard/ and project/protocol pages under DD_FLOW_HOME/projects/<PRJ-ID-slug>/dashboard/. Dashboard JSON uses lifecycle/resource/claim fields as the primary contract when present; current_stage/raw_stage/raw_status/merge_queue/job are compatibility or diagnostic fields. Global dashboard data consumes published project summaries, exposes supported_summary_versions and summary_version_groups, and lists missing/unreadable/unsupported project summaries under unsupported_projects instead of silently hiding those projects. State-changing commands still auto-refresh markdown during the transition. cmux is used only by explicit open/refresh commands and only according to project config. JSON mode writes machine-readable output only.`
290
435
  ],
291
436
  [
292
437
  "schema",