@deksden-com/dd-flow-cli 0.3.1 → 0.4.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 (43) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +25 -9
  3. package/dist/build-info.json +5 -5
  4. package/dist/cli/help.js +58 -32
  5. package/dist/cli/run-cli.js +282 -50
  6. package/dist/domain/entity-ids.js +4 -4
  7. package/dist/domain/flow-contract.js +502 -36
  8. package/dist/domain/validation.js +34 -0
  9. package/dist/protocol/local-files.js +8 -6
  10. package/dist/schemas/code-stage-report.schema.json +197 -2
  11. package/dist/schemas/flow-contract.schema.json +126 -0
  12. package/dist/schemas/flow-run-index-v3.schema.json +203 -0
  13. package/dist/schemas/flow-run-index.schema.json +22 -2
  14. package/dist/schemas/flow-run.schema.json +36 -0
  15. package/dist/schemas/merge-stage-report.schema.json +213 -2
  16. package/dist/schemas/plan-stage-report.schema.json +156 -2
  17. package/dist/schemas/release-impact.schema.json +16 -0
  18. package/dist/services/audit.js +3 -3
  19. package/dist/services/branch-context.js +266 -0
  20. package/dist/services/canon.js +0 -1
  21. package/dist/services/cleanup.js +6 -6
  22. package/dist/services/cli-operation-classifier.js +1 -1
  23. package/dist/services/compatibility-preflight.js +8 -77
  24. package/dist/services/dashboard.js +48 -11
  25. package/dist/services/engines.js +123 -13
  26. package/dist/services/hooks.js +6 -6
  27. package/dist/services/ids.js +40 -49
  28. package/dist/services/merge-queue.js +240 -20
  29. package/dist/services/merge-worker.js +12 -4
  30. package/dist/services/migrations.js +64 -0
  31. package/dist/services/plans.js +23 -16
  32. package/dist/services/projects.js +2 -2
  33. package/dist/services/prompts.js +322 -0
  34. package/dist/services/protocols.js +78 -42
  35. package/dist/services/run-projection.js +80 -0
  36. package/dist/services/runs.js +360 -22
  37. package/dist/services/schema-validation.js +35 -12
  38. package/dist/services/sessions.js +81 -3
  39. package/dist/services/status.js +32 -1
  40. package/dist/services/usage.js +233 -0
  41. package/dist/services/worktrees.js +24 -19
  42. package/dist/storage/database.js +223 -9
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @deksden-com/dd-flow-cli
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Preserve `--project-root` through engine routing, compatibility preflight, protocol services, nested lookups, merge-queue commands, and post-mutation dashboard refresh. Duplicate rootless protocol ids fail closed without side effects, while successful mutations remain successful when an optional dashboard projection fails.
8
+
9
+ - Include production dependencies in installed engine snapshots, so a routed CLI works outside the source checkout.
10
+
11
+ ## Unreleased
12
+
13
+ ### Patch Changes
14
+
15
+ - Make `PRT-*` and `RUN-*` allocation, persistence and resolution project-scoped. SQLite migrates legacy global primary keys without renumbering ids, including databases whose columns were appended in historical order; duplicate full ids may coexist across projects, and ambiguous context-free protocol lookup fails closed with project candidates.
16
+
17
+ - Allow `prompt render` to preserve validated RUN-local `required_read` and discovery references through `run://<relative-path>`, while keeping write scopes project-local and rejecting traversal or environment-secret paths.
18
+
19
+ ## 0.4.0
20
+
21
+ ### Minor Changes
22
+
23
+ - Add branch/workspace protocol context for agents: `protocol branch-status`, `branch_context` in protocol and merge JSON outputs, and branch bundle status with eligible, not-ready and claimed protocol lists.
24
+
25
+ Add `merge bundle status|claim|complete|fail` commands so a merge worker can integrate one feature branch containing multiple ready protocols under the existing merge lane lock.
26
+
27
+ ### Patch Changes
28
+
29
+ - cfdcf1d: Fix compatibility status reporting so selected compatible engines advertise `normal_write` in `allowed_modes`; blocked operations are now reported only when a write is actually blocked by missing or incompatible engine resolution.
30
+
3
31
  ## 0.3.1
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -72,17 +72,33 @@ Register and inspect a protocol:
72
72
 
73
73
  ```bash
74
74
  dd-flow protocol register HANDSHAKE-001 --project-root "$PWD" --json
75
- dd-flow protocol status PRT-HANDSHAKE-001 --json
75
+ dd-flow protocol status PRT-HANDSHAKE-001 --project-root "$PWD" --json
76
76
  ```
77
77
 
78
78
  Attach and update a plan:
79
79
 
80
80
  ```bash
81
- dd-flow plan set PRT-HANDSHAKE-001 --file plan.json --json
82
- dd-flow plan item start PRT-HANDSHAKE-001 P1 --json
83
- dd-flow plan item done PRT-HANDSHAKE-001 P1 --summary "Implemented" --evidence "pnpm test" --json
81
+ dd-flow plan set PRT-HANDSHAKE-001 --project-root "$PWD" --file plan.json --json
82
+ dd-flow plan item start PRT-HANDSHAKE-001 P1 --project-root "$PWD" --json
83
+ dd-flow plan item done PRT-HANDSHAKE-001 P1 --project-root "$PWD" --summary "Implemented" --evidence "pnpm test" --json
84
84
  ```
85
85
 
86
+ Render a bounded prompt for one delegated plan item after its RUN stage is attached:
87
+
88
+ ```bash
89
+ dd-flow prompt render \
90
+ --project-root "$PWD" \
91
+ --run RUN-001-example \
92
+ --stage code \
93
+ --plan-item P2 \
94
+ --profile code_implementation \
95
+ --json
96
+ ```
97
+
98
+ For a non-plan worker, replace `--plan-item` with `--task-file <path>` pointing to a `dd-flow/worker-task@1` manifest inside the selected RUN home. The manifest embeds one existing plan-item-shaped `task`, so validation and rendered artifacts remain identical to the compatibility route.
99
+
100
+ The selected item must contain `execution_context` and `semantic_spine`. The renderer accepts only registered profiles, validates the active RUN/workspace and source paths, then persists `launch-prompt.md`, `prompt-stack.json` and `render-report.json` in the RUN stage. The stack and render report both retain the validated read/discovery/write references. It records project sources as paths rather than copying their contents. `required_read` and `discovery_boundary` may use a checked `run://<relative-path>` reference for a source inside the selected RUN home; write scopes remain project-local.
101
+
86
102
  Human help is available for the operator-facing command groups:
87
103
 
88
104
  ```bash
@@ -178,7 +194,7 @@ dd-flow lane lock release --project-root "$PROJECT_ROOT" --lane direct-main --wo
178
194
  Prompts enqueue protocols only after explicit readiness signals exist:
179
195
 
180
196
  ```bash
181
- dd-flow protocol ready-for-merge PRT-... --json
197
+ dd-flow protocol ready-for-merge PRT-... --project-root "$PROJECT_ROOT" --json
182
198
  dd-flow merge-queue status --project-root "$PROJECT_ROOT" --json
183
199
  ```
184
200
 
@@ -203,8 +219,8 @@ Merge queue JSON uses `queue_item`, `protocol`, and `claim` as the primary queue
203
219
  Complete or fail the claimed job:
204
220
 
205
221
  ```bash
206
- dd-flow merge-queue complete PRT-... --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --summary "merged locally" --json
207
- dd-flow merge-queue fail PRT-... --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --reason "conflict requires owner" --requeue true --json
222
+ dd-flow merge-queue complete PRT-... --project-root "$PROJECT_ROOT" --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --summary "merged locally" --json
223
+ dd-flow merge-queue fail PRT-... --project-root "$PROJECT_ROOT" --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --reason "conflict requires owner" --requeue true --json
208
224
  ```
209
225
 
210
226
  Successful `merge-queue complete` is terminal for the protocol runtime: it writes `stage: closed`, `status: closed`, and `next_action: none`. Post-complete cleanup can still update the queue reason with `merge-queue note`, but dashboards must no longer show the protocol as active work.
@@ -212,8 +228,8 @@ Successful `merge-queue complete` is terminal for the protocol runtime: it write
212
228
  Cancel stale or intentionally abandoned queue work explicitly:
213
229
 
214
230
  ```bash
215
- dd-flow merge-queue cancel PRT-... --reason "abandoned rerun" --json
216
- dd-flow merge-queue cancel PRT-... --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --reason "owner cancelled claimed job" --json
231
+ dd-flow merge-queue cancel PRT-... --project-root "$PROJECT_ROOT" --reason "abandoned rerun" --json
232
+ dd-flow merge-queue cancel PRT-... --project-root "$PROJECT_ROOT" --worker-id "$WORKER_ID" --path "$MERGE_WORKSPACE" --reason "owner cancelled claimed job" --json
217
233
  ```
218
234
 
219
235
  Flow sessions are registered explicitly with `dd-flow session register`; merge queue commands use `--worker-id` only. Codex prompts should prefer a JSON payload file:
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "cli_package": "@deksden-com/dd-flow-cli",
3
- "cli_version": "0.3.1",
4
- "cli_commit": "b677e824e7d3b1e6553e7963eeceeb1db02e86db",
5
- "built_at": "2026-07-03T20:02:54.356Z",
3
+ "cli_version": "0.4.1",
4
+ "cli_commit": "6f85c042645e0f779824ec71b9aef0a68830874d",
5
+ "built_at": "2026-08-08T21:51:37.203Z",
6
6
  "built_with_canon": {
7
- "version": "2.9.0",
8
- "commit": "7e8b51c1321e290d18df3572d6ab26ed32b85403",
7
+ "version": "2.17.0",
8
+ "commit": "bab97fce96dc6b240c577c38b9d69e17b08fd471",
9
9
  "flow_contract": "dd-flow-canonical-2026-06",
10
10
  "repo_root": "/Users/deksden/Documents/_Projects/dd-memorybank",
11
11
  "memorybank_root": "/Users/deksden/Documents/_Projects/dd-memorybank/.memory-bank",
package/dist/cli/help.js CHANGED
@@ -18,13 +18,14 @@ Core commands:
18
18
  project resolve/archive Resolve typed ids and archive stale project roots.
19
19
  project migrate-ids Migrate old project ids.
20
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.
21
+ migration impact/plan/report/verify Assess release impact and prepare mb-upgrade migration evidence.
22
22
  cleanup scan/apply Detect and repair stale local runtime state.
23
- run start/status/list Track concrete flow executions and stage artifacts.
23
+ run start/status/list/timeline/usage/flags Track concrete flow executions, timing, source-aware usage and RUN-local flow flags.
24
24
  id next Preview next typed ids for protocol or run allocation.
25
25
  plan set/status/item Attach and update protocol plans.
26
+ prompt render Render one bounded, RUN-local worker launch prompt.
26
27
  lane workspace/lock/status Manage shared workspace lanes and leases.
27
- merge status/one-shot Inspect or claim one merge job from the current session.
28
+ merge status/one-shot/bundle Inspect, claim, or complete merge work from the current session.
28
29
  merge-worker status/start/stop Manage long-lived project merge workers.
29
30
  merge-queue status/next Claim, wait for, complete, or fail merge jobs.
30
31
  session register/status/stop Register flow sessions and stop workers.
@@ -68,7 +69,7 @@ Usage:
68
69
  dd-flow version --json
69
70
  dd-flow --version
70
71
 
71
- version reports the installed dd-flow CLI package version from package metadata. Use status for richer canon/project compatibility diagnostics.
72
+ version reports the installed dd-flow CLI package version from package metadata. Use status for richer canon/project compatibility diagnostics. Status remains read-only when a project flow contract is invalid and reports its exact error path plus a repair/upgrade validation command.
72
73
 
73
74
  Examples:
74
75
  dd-flow version
@@ -125,7 +126,7 @@ Usage:
125
126
 
126
127
  Discovery order is explicit --root, then DD_MEMORYBANK, then the globally registered runtime value in DD_FLOW_HOME, then known nearby dd-memorybank checkouts from the current working directory. Explicit --root is the only source considered for that command. If multiple different valid canonical checkouts are found, resolve fails closed with blockers so the caller chooses intentionally.
127
128
 
128
- A valid canonical root contains dd-flow/README.md, mbb/index.md, protocol/index.md, and canonical-only entrypoints such as dd-flow/mb-init.md, dd-flow/mb-upgrade.md, dd-flow/mb-upgrade-review.md, and dd-flow/mb-distill.md.
129
+ A valid canonical root contains dd-flow/README.md, mbb/index.md, protocol/index.md, and canonical-only entrypoints such as dd-flow/mb-init.md, dd-flow/mb-upgrade.md, and dd-flow/mb-distill.md. Current canon runs mb-upgrade review as the 05-review stage inside mb-upgrade, not as a top-level mb-upgrade-review.md entrypoint.
129
130
 
130
131
  Examples:
131
132
  dd-flow canon register --root "$DD_MEMORYBANK" --json
@@ -137,15 +138,19 @@ Examples:
137
138
  `dd-flow run - track concrete flow executions
138
139
 
139
140
  Usage:
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 run start --project-root <root> [--workspace-root <checkout>] --flow-kind <kind> --subject-type <type> --subject-id <id> --slug <slug> [--preset compact|normal|full] [--task-profile-file <file>] [--protocol-override-file <file>] [--flag key=value] [--next-action <text>] --json
141
142
  dd-flow id next --type protocol|run --project-root <root> --slug <slug> --json
142
- dd-flow run status <RUN-ID|RUN-NNN> --project-root <root> --json
143
+ dd-flow run status <RUN-ID|RUN-short-id> --project-root <root> --json
143
144
  dd-flow run list --project-root <root> --json
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
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
146
- dd-flow run complete <RUN-ID|RUN-NNN> --project-root <root> --status done|blocked|cancelled|failed [--verdict <text>] [--next-action <text>] --json
145
+ dd-flow run timeline <RUN-ID|RUN-short-id> --project-root <root> [--hide stages|events|sessions|usage|artifacts] --json
146
+ dd-flow run usage <RUN-ID|RUN-short-id> --project-root <root> [--group-by session|role|stage|aspect|plan-item] --json
147
+ dd-flow run flags status <RUN-ID|RUN-short-id> --project-root <root> --json
148
+ dd-flow run flags revise <RUN-ID|RUN-short-id> --project-root <root> --expected-revision <n> --idempotency-key <key> [--preset <name>] [--flag key=value] [--flag key=value] [--allow-downgrade --reason <text>] --json
149
+ dd-flow run attach-stage <RUN-ID|RUN-short-id> --project-root <root> --stage <name> --dir <NN-stage-slug> --status <status> [--data-schema-id <id>] --json
150
+ dd-flow run complete-stage <RUN-ID|RUN-short-id> --project-root <root> --stage <name> --status <status> [--stage-report <path>] [--data <path>] [--data-schema-id <id>] [--report <path>] [--alias <path>] --json
151
+ dd-flow run complete <RUN-ID|RUN-short-id> --project-root <root> --status done|blocked|cancelled|failed [--verdict <text>] [--next-action <text>] --json
147
152
 
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.
153
+ 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, run-index.json and an append-only timeline together. Timeline is the compact full run report: summary is always present, while --hide may suppress bulky sections. The run usage command reconciles registered local Codex transcript counters before reporting; unavailable data is explicit rather than zero.
149
154
 
150
155
  Examples:
151
156
  dd-flow run start --project-root "$PWD" --flow-kind mb_sdlc --subject-type protocol --subject-id PRT-001-demo --slug demo --json
@@ -160,7 +165,7 @@ Examples:
160
165
  Usage:
161
166
  dd-flow id next --type protocol|run --project-root <root> --slug <slug> --json
162
167
 
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.
168
+ id next is read-only: RUN previews use control-plane runtime records for the selected project, while protocol previews also consider that project's protocol files. Legacy date-based protocol ids such as PRT-2026-05-25-example are historical names and do not participate in typed sequence allocation. The command returns the project-local monotonic max(TYPE-<sequence>)+1 without reusing sequence gaps. It does not reserve the id. Use run start or protocol register to create durable state. PRT and RUN ids are resolved by project plus id; ambiguous context-free protocol lookup fails closed with project candidates.
164
169
 
165
170
  Examples:
166
171
  dd-flow id next --type protocol --project-root "$PWD" --slug demo --json
@@ -172,26 +177,28 @@ Examples:
172
177
 
173
178
  Usage:
174
179
  dd-flow protocol register <handshake-id> --project-root <root> [--workspace-path <checkout>] --json
175
- dd-flow protocol status <protocol-id> --json
180
+ dd-flow protocol status <protocol-id> [--project-root <root>] --json
181
+ dd-flow protocol branch-status <protocol-id> [--project-root <root>] --json
182
+ dd-flow protocol branch-status --project-root <root> --path <workspace> --json
176
183
  dd-flow protocol ready --project-root <root> --json
177
184
  dd-flow protocol blockers <protocol-id> --project-root <root> --json
178
185
  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
181
- dd-flow protocol ready-for-merge <protocol-id> --json
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
186
+ dd-flow protocol transition <protocol-id> [--project-root <root>] --to <stage> --payload-file <file> [--force --reason <text>] --json
187
+ dd-flow protocol sync-from-run <protocol-id> [--project-root <root>] --run <RUN-ID|RUN-short-id> [--target auto|<stage>] --json
188
+ dd-flow protocol ready-for-merge <protocol-id> [--project-root <root>] --json
189
+ dd-flow protocol cancel <protocol-id> [--project-root <root>] --reason <text> [--close-sessions true|false] [--cancel-queue true|false] [--release-locks true|false] [--worktree keep|remove] [--force] --json
183
190
 
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.
191
+ ready, blockers and implement read protocol markdown frontmatter plus runtime state. branch-status is read-only and reports the current protocol/workspace branch context: sibling protocols in the same branch/worktree, queue status, active sessions and merge bundle eligibility. 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
192
 
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.`
193
+ 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. Rootless protocol-id calls remain compatible only when the id is unique across registered projects; duplicate ids fail closed with ambiguous_protocol.`
187
194
  ],
188
195
  [
189
196
  "transition",
190
197
  `dd-flow transition - compatibility alias for protocol transition
191
198
 
192
199
  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
200
+ dd-flow transition <protocol-id> [--project-root <root>] --to <stage> --payload-file <file> [--force --reason <text>] --json
201
+ dd-flow transition <protocol-id> [--project-root <root>] --to <stage> --json-file <file> [--force --reason <text>] --json
195
202
 
196
203
  Prefer dd-flow protocol transition in new prompts and scripts. This top-level alias remains for older canonical prompts and experiments.`
197
204
  ],
@@ -203,8 +210,8 @@ Usage:
203
210
  dd-flow project register --root <root> --json
204
211
  dd-flow project status --root <root> --json
205
212
  dd-flow project summary --project-root <root> [--write true|false] --json
206
- dd-flow project resolve <PRJ-ID|PRJ-NNN> --json
207
- dd-flow project archive <PRJ-ID|PRJ-NNN> --reason <text> --json
213
+ dd-flow project resolve <PRJ-ID|PRJ-short-id> --json
214
+ dd-flow project archive <PRJ-ID|PRJ-short-id> --reason <text> --json
208
215
  dd-flow project archive --root <previous-root-path> --reason <text> --json
209
216
  dd-flow project migrate-ids --root <root> [--apply] --json
210
217
 
@@ -293,16 +300,29 @@ Related lane commands:
293
300
  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
301
  dd-flow lane lock status --project-root "$PWD" --lane merge --json
295
302
  dd-flow lane waiter cancel --project-root "$PWD" --lane merge --worker-id worker-1 --reason "session stopped" --json`
303
+ ],
304
+ [
305
+ "prompt",
306
+ `dd-flow prompt - render auditable worker launch prompts
307
+
308
+ Usage:
309
+ dd-flow prompt render --project-root <root> --run <RUN-ID> --stage <stage> (--plan-item <item-id> | --task-file <RUN-local-worker-task.json>) --profile <profile> [--workspace-root <checkout>] --json
310
+
311
+ The renderer accepts only registered profiles: code_implementation, documentation, verification. A legacy plan item or a RUN-local dd-flow/worker-task@1 manifest supplies the task execution context and semantic spine. The renderer verifies the running RUN stage and workspace, then writes launch-prompt.md, prompt-stack.json and render-report.json under the RUN stage subagents directory. Project sources remain path references; unsafe .env paths and paths outside the project are rejected before artifact creation.`
296
312
  ],
297
313
  [
298
314
  "merge",
299
315
  `dd-flow merge - current-session merge entrypoint helpers
300
316
 
301
317
  Usage:
302
- dd-flow merge status --project-root <root> --json
318
+ dd-flow merge status --project-root <root> [--path <workspace>] --json
303
319
  dd-flow merge one-shot --project-root <root> --worker-id <id> [--path <workspace>] --json
320
+ dd-flow merge bundle status --project-root <root> --path <workspace> --json
321
+ dd-flow merge bundle claim --project-root <root> --worker-id <id> --path <workspace> --json
322
+ dd-flow merge bundle complete --project-root <root> --worker-id <id> --path <workspace> --summary <text> --json
323
+ dd-flow merge bundle fail --project-root <root> --worker-id <id> --path <workspace> --reason <text> --requeue true|false --json
304
324
 
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.`
325
+ merge status reports active merge worker, claimed protocols, active merge lane lock, queue state and branch_context when --path is provided. merge one-shot keeps legacy single-protocol behavior and also returns branch_context. merge bundle commands operate on all ready protocols in the current branch/worktree: status is read-only, claim requires the merge lane lock owner, complete closes all claimed protocols after branch integration, and fail requeues or fails the claimed bundle.`
306
326
  ],
307
327
  [
308
328
  "merge-worker",
@@ -323,17 +343,21 @@ Usage:
323
343
  dd-flow merge-queue status --project-root <root> --json
324
344
  dd-flow merge-queue next --project-root <root> --worker-id <id> [--path <workspace>] --json
325
345
  dd-flow merge-queue wait-next --project-root <root> --worker-id <id> [--path <workspace>] --timeout <seconds> --poll-interval <seconds> [--acquire-lock true] --json
326
- dd-flow merge-queue complete <protocol-id> --worker-id <id> [--path <workspace>] --summary <text> --json
327
- dd-flow merge-queue note <protocol-id> --worker-id <id> --summary <text> --json
328
- dd-flow merge-queue fail <protocol-id> --worker-id <id> [--path <workspace>] --reason <text> --requeue true|false --json
329
- dd-flow merge-queue cancel <protocol-id> --reason <text> [--worker-id <id>] [--path <workspace>] [--force] --json
346
+ dd-flow merge-queue complete <protocol-id> [--project-root <root>] --worker-id <id> [--path <workspace>] --summary <text> --json
347
+ dd-flow merge-queue note <protocol-id> [--project-root <root>] --worker-id <id> --summary <text> --json
348
+ dd-flow merge-queue fail <protocol-id> [--project-root <root>] --worker-id <id> [--path <workspace>] --reason <text> --requeue true|false --json
349
+ dd-flow merge-queue cancel <protocol-id> [--project-root <root>] --reason <text> [--worker-id <id>] [--path <workspace>] [--force] --json
330
350
 
331
351
  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.
332
352
 
353
+ For branch-level integration prefer:
354
+ dd-flow merge bundle status --project-root "$PWD" --path "$PWD" --json
355
+ dd-flow merge bundle claim --project-root "$PWD" --worker-id merge-worker --path "$PWD" --json
356
+
333
357
  Examples:
334
358
  dd-flow merge-queue wait-next --project-root "$PWD" --worker-id merge-worker --path "$PWD" --timeout 1200 --poll-interval 10 --acquire-lock true --json
335
- dd-flow merge-queue complete PRT-123 --worker-id merge-worker --path "$PWD" --summary "merged locally; cleanup follows" --json
336
- dd-flow merge-queue note PRT-123 --worker-id merge-worker --summary "merged, pushed, checked, and cleanup completed" --json`
359
+ dd-flow merge-queue complete PRT-123 --project-root "$PWD" --worker-id merge-worker --path "$PWD" --summary "merged locally; cleanup follows" --json
360
+ dd-flow merge-queue note PRT-123 --project-root "$PWD" --worker-id merge-worker --summary "merged, pushed, checked, and cleanup completed" --json`
337
361
  ],
338
362
  [
339
363
  "cleanup",
@@ -365,6 +389,7 @@ Usage:
365
389
  dd-flow session register --payload-file <file> --json
366
390
  dd-flow session register --payload-base64 <payload> --json
367
391
  dd-flow session status --project-root <root> [--session-id <id>] [--worker-id <id>] --json
392
+ dd-flow session usage sync --project-root <root> --session-id <id> --json
368
393
  dd-flow session stop --project-root <root> --session-id <id> --reason <text> --json
369
394
  dd-flow session stop-worker --project-root <root> --worker-id <id> --reason <text> --json
370
395
 
@@ -440,7 +465,7 @@ Dashboards are rendered views of dd-flow state. Markdown remains the compatibili
440
465
  Usage:
441
466
  dd-flow schema validate --schema <name> --file <json-file> [--project-root <root>] [--schema-dir <dir>] --json
442
467
 
443
- Schema names resolve to <name>.schema.json. Lookup order is --schema-dir, then <project-root>/.memory-bank/dd-flow/schemas/, then <project-root>/dd-flow/schemas/ for canonical checkouts, then bundled CLI schemas. If --project-root is omitted, the current working directory is used. JSON mode writes valid results to stdout and structured validation/usage errors to stderr.`
468
+ Schema names resolve to <name>.schema.json. Lookup order is --schema-dir, then <project-root>/.memory-bank/dd-flow/schemas/, then <project-root>/dd-flow/schemas/ for canonical checkouts, then bundled CLI schemas. Flow-contract validation runs structural checks first and the runtime's shared semantic normalizer second. If --project-root is omitted, the current working directory is used. JSON mode writes valid results to stdout and structured validation/usage errors to stderr.`
444
469
  ],
445
470
  [
446
471
  "schema validate",
@@ -454,6 +479,7 @@ Exit codes:
454
479
  2 usage, unknown schema, invalid JSON, or schema validation failure
455
480
 
456
481
  Examples:
482
+ dd-flow schema validate --schema flow-contract --file .memory-bank/dd-flow/flow-contract.json --project-root "$PWD" --json
457
483
  dd-flow schema validate --schema mb-upgrade-review-data --file .tasks/mb-upgrade-review-2026-06-04-hr-agent/review-data.json --project-root "$PWD" --json
458
484
  dd-flow schema validate --schema mb-upgrade-review-data --file review-data.json --schema-dir .memory-bank/dd-flow/schemas`
459
485
  ],