@deksden-com/dd-flow-cli 0.4.2 → 0.5.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 (49) hide show
  1. package/CHANGELOG.md +27 -4
  2. package/dist/build-info.json +6 -6
  3. package/dist/cli/help.js +14 -3
  4. package/dist/cli/run-cli.js +32 -16
  5. package/dist/domain/flow-contract.js +81 -2
  6. package/dist/domain/validation.js +56 -28
  7. package/dist/protocol/local-files.js +1 -16
  8. package/dist/schemas/code-stage-report.schema.json +2 -2
  9. package/dist/schemas/flow-contract.schema.json +150 -94
  10. package/dist/schemas/flow-run.schema.json +129 -23
  11. package/dist/schemas/mb-upgrade-review-data.schema.json +2 -2
  12. package/dist/schemas/memorybank-permissions-preflight.schema.json +13 -73
  13. package/dist/schemas/merge-stage-report.schema.json +2 -2
  14. package/dist/schemas/plan-stage-report.schema.json +38 -335
  15. package/dist/schemas/project-flow-pack-manifest.schema.json +4 -4
  16. package/dist/schemas/protocol-plan.schema.json +197 -0
  17. package/dist/schemas/release-impact.schema.json +9 -5
  18. package/dist/schemas/session-usage.schema.json +16 -0
  19. package/dist/schemas/stage-finish-input.schema.json +20 -0
  20. package/dist/schemas/stage-prompt.schema.json +31 -0
  21. package/dist/schemas/stage-report.schema.json +20 -0
  22. package/dist/schemas/stage-start-response.schema.json +29 -0
  23. package/dist/schemas/timeline-event.schema.json +29 -0
  24. package/dist/schemas/worktrunk-workspace.schema.json +19 -0
  25. package/dist/services/branch-context.js +9 -4
  26. package/dist/services/dashboard.js +51 -26
  27. package/dist/services/engines.js +84 -18
  28. package/dist/services/hooks.js +80 -246
  29. package/dist/services/memory-permissions.js +77 -69
  30. package/dist/services/plan-runtime.js +124 -0
  31. package/dist/services/plans.js +22 -84
  32. package/dist/services/projects.js +2 -1
  33. package/dist/services/prompts.js +26 -21
  34. package/dist/services/protocols.js +29 -25
  35. package/dist/services/run-projection.js +77 -11
  36. package/dist/services/runs.js +95 -61
  37. package/dist/services/schema-validation.js +168 -7
  38. package/dist/services/sessions.js +132 -68
  39. package/dist/services/stage-lifecycle.js +572 -0
  40. package/dist/services/tooling.js +285 -0
  41. package/dist/services/usage.js +183 -30
  42. package/dist/services/version-status.js +1 -1
  43. package/dist/services/worktrees.js +88 -39
  44. package/dist/storage/database.js +72 -30
  45. package/dist/storage/paths.js +0 -9
  46. package/package.json +14 -13
  47. package/tools/worktrunk-manifest.json +34 -0
  48. package/dist/schemas/flow-run-index-v3.schema.json +0 -203
  49. package/dist/schemas/flow-run-index.schema.json +0 -175
@@ -1,37 +1,14 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "dd-flow/plan-stage-report@2",
4
- "title": "dd-flow plan stage report data",
3
+ "$id": "dd-flow/plan-stage-report@5",
4
+ "title": "Generated PLAN receipt projection",
5
+ "description": "A deterministic lifecycle receipt. It references the canonical plan and aspect map but never copies their semantic items.",
5
6
  "type": "object",
6
7
  "additionalProperties": false,
7
- "allOf": [
8
- {
9
- "if": {
10
- "properties": { "schema_id": { "const": "dd-flow/plan-stage-report@2" } },
11
- "required": ["schema_id"]
12
- },
13
- "then": { "required": ["flow_flags"] }
14
- }
15
- ],
16
- "required": [
17
- "schema_id",
18
- "generated_at",
19
- "protocol",
20
- "overall",
21
- "route",
22
- "graph",
23
- "aspects",
24
- "plan_items",
25
- "handoff"
26
- ],
8
+ "required": ["schema_id", "generated_at", "protocol", "overall", "route", "plan_ref", "aspect_map_ref", "execution_summary", "delta_lint", "transition", "handoff"],
27
9
  "properties": {
28
- "schema_id": {
29
- "enum": ["dd-flow/plan-stage-report@1", "dd-flow/plan-stage-report@2"]
30
- },
31
- "generated_at": {
32
- "type": "string",
33
- "format": "date-time"
34
- },
10
+ "schema_id": {"const": "dd-flow/plan-stage-report@5"},
11
+ "generated_at": {"type": "string", "format": "date-time"},
35
12
  "protocol": {
36
13
  "type": "object",
37
14
  "additionalProperties": false,
@@ -41,7 +18,7 @@
41
18
  "title": {"type": "string", "minLength": 1},
42
19
  "project": {"type": "string", "minLength": 1},
43
20
  "branch": {"type": "string", "minLength": 1},
44
- "stage": {"type": "string", "minLength": 1}
21
+ "stage": {"const": "plan"}
45
22
  }
46
23
  },
47
24
  "overall": {
@@ -49,10 +26,7 @@
49
26
  "additionalProperties": false,
50
27
  "required": ["verdict", "verdict_label", "score", "score_max", "next_action", "summary"],
51
28
  "properties": {
52
- "verdict": {
53
- "type": "string",
54
- "enum": ["plan_ready", "ready_for_code", "needs_user_decision", "plan_blocked", "degraded"]
55
- },
29
+ "verdict": {"enum": ["plan_ready", "ready_for_code", "needs_user_decision", "plan_blocked", "degraded"]},
56
30
  "verdict_label": {"type": "string", "minLength": 1},
57
31
  "score": {"type": "number", "minimum": 0},
58
32
  "score_max": {"type": "number", "exclusiveMinimum": 0},
@@ -74,208 +48,54 @@
74
48
  }
75
49
  }
76
50
  },
77
- "task_profile": {
78
- "type": "object",
79
- "additionalProperties": true,
80
- "properties": {
81
- "size": {"type": "string"},
82
- "risk": {"type": "string"},
83
- "planning_route_hint": {"type": "string"},
84
- "execution_mode_hint": {"type": "string"},
85
- "verification_mode": {"type": "string"}
86
- }
87
- },
88
- "route_decision": {
89
- "type": "object",
90
- "additionalProperties": true,
91
- "properties": {
92
- "selected_planning_route": {"type": "string"},
93
- "selected_execution_mode": {"type": "string"},
94
- "selected_git_route": {"type": "string"},
95
- "selected_verification_depth": {"type": "string"},
96
- "selected_evidence_level": {"type": "string"},
97
- "reason": {"type": "string"}
98
- }
99
- },
100
- "flow_flags": { "$ref": "#/definitions/flowFlags" },
101
- "graph": {
51
+ "plan_ref": {
102
52
  "type": "object",
103
53
  "additionalProperties": false,
104
- "required": ["nodes", "edges"],
54
+ "required": ["path", "plan_id", "revision", "sha256", "item_count"],
105
55
  "properties": {
106
- "nodes": {
107
- "type": "array",
108
- "minItems": 1,
109
- "items": {
110
- "type": "object",
111
- "additionalProperties": false,
112
- "required": ["id", "label", "x", "y", "status", "note"],
113
- "properties": {
114
- "id": {"type": "string", "minLength": 1},
115
- "label": {"type": "string", "minLength": 1},
116
- "x": {"type": "number"},
117
- "y": {"type": "number"},
118
- "status": {"type": "string", "enum": ["done", "ready", "watch", "next", "blocked", "skipped"]},
119
- "note": {"type": "string", "minLength": 1}
120
- }
121
- }
122
- },
123
- "edges": {
124
- "type": "array",
125
- "items": {
126
- "type": "array",
127
- "items": [
128
- {"type": "string", "minLength": 1},
129
- {"type": "string", "minLength": 1}
130
- ],
131
- "additionalItems": false,
132
- "minItems": 2,
133
- "maxItems": 2
134
- }
135
- }
56
+ "path": {"type": "string", "pattern": "^\\.memory-bank/protocol/[^/]+/plan\\.json$"},
57
+ "plan_id": {"type": "string", "minLength": 1},
58
+ "revision": {"type": "integer", "minimum": 1},
59
+ "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
60
+ "item_count": {"type": "integer", "minimum": 1}
136
61
  }
137
62
  },
138
- "aspects": {
139
- "type": "array",
140
- "minItems": 1,
141
- "items": {
142
- "type": "object",
143
- "additionalProperties": false,
144
- "required": ["id", "label", "score", "status", "summary", "note", "findings"],
145
- "properties": {
146
- "id": {"type": "string", "minLength": 1},
147
- "label": {"type": "string", "minLength": 1},
148
- "radar_label": {"type": "string"},
149
- "relevance": {"type": "string", "enum": ["not_applicable", "light", "deep", "unknown"]},
150
- "coverage_mode": {"type": "string", "enum": ["orchestrator", "subagent", "grouped_subagent", "degraded"]},
151
- "subagent_id": {"type": "string"},
152
- "group_id": {"type": "string"},
153
- "report_path": {"type": "string"},
154
- "not_applicable_reason": {"type": "string"},
155
- "score": {"type": "number", "minimum": 0, "maximum": 5},
156
- "status": {"type": "string", "enum": ["reviewed", "watch", "blocked", "not_applicable", "degraded"]},
157
- "summary": {"type": "string", "minLength": 1},
158
- "note": {"type": "string", "minLength": 1},
159
- "findings": {
160
- "type": "array",
161
- "items": {"type": "string", "minLength": 1}
162
- }
163
- }
164
- }
165
- },
166
- "review_gates": {
167
- "type": "array",
168
- "items": { "$ref": "#/definitions/reviewGate" }
169
- },
170
- "design_aspect_traceability": {
63
+ "aspect_map_ref": {
171
64
  "type": "object",
172
- "additionalProperties": true,
65
+ "additionalProperties": false,
66
+ "required": ["path", "sha256", "coverage_count"],
173
67
  "properties": {
174
- "source": {"type": "string"},
175
- "verdict": {"type": "string"},
176
- "summary": {"type": "string"},
177
- "design_aspects": {
178
- "type": "array",
179
- "items": {"type": "string"}
180
- },
181
- "requirements": {
182
- "type": "array",
183
- "items": {"type": "string"}
184
- },
185
- "verification_seeds": {
186
- "type": "array",
187
- "items": {"type": "string"}
188
- },
189
- "gaps": {
190
- "type": "array",
191
- "items": {"type": "string"}
192
- }
68
+ "path": {"type": "string", "minLength": 1},
69
+ "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
70
+ "coverage_count": {"type": "integer", "minimum": 0}
193
71
  }
194
72
  },
195
- "testing_system": {
73
+ "execution_summary": {
196
74
  "type": "object",
197
- "additionalProperties": true,
75
+ "additionalProperties": false,
76
+ "required": ["wall_clock_ms"],
198
77
  "properties": {
199
- "applicability": {"type": "string"},
200
- "applicability_reason": {"type": "string"},
201
- "stages": {"type": "array"},
202
- "test_levels": {"type": "object"},
203
- "datasets": {"type": "array"},
204
- "scenario_links": {"type": "array"},
205
- "design_decision_coverage": {"type": "array"},
206
- "gaps": {"type": "array"}
78
+ "wall_clock_ms": {"type": "integer", "minimum": 0},
79
+ "available_subagent_slots": {"type": "integer", "minimum": 0}
207
80
  }
208
81
  },
209
- "aspect_map": { "$ref": "#/definitions/aspectMap" },
210
- "sdlc_contours": {
82
+ "delta_lint": {
211
83
  "type": "object",
212
- "additionalProperties": true,
84
+ "additionalProperties": false,
85
+ "required": ["status", "selected_files", "finding_count"],
213
86
  "properties": {
214
- "summary": {"type": "string"},
215
- "contours": {
216
- "type": "array",
217
- "items": {
218
- "type": "object",
219
- "additionalProperties": true,
220
- "required": ["name", "applicability_status", "gate_status", "summary"],
221
- "properties": {
222
- "name": {"type": "string", "minLength": 1},
223
- "applicability_status": {"type": "string", "minLength": 1},
224
- "verification_state": {"type": "string"},
225
- "closure_state": {"type": "string"},
226
- "gate_status": {"type": "string", "minLength": 1},
227
- "target_stage": {"type": "string"},
228
- "delivery_target": {"type": "string"},
229
- "summary": {"type": "string", "minLength": 1},
230
- "reason": {"type": "string"},
231
- "evidence": {"type": "string"},
232
- "next_action": {"type": "string"}
233
- }
234
- }
235
- },
236
- "policy_migration": {"type": "string"},
237
- "next_delivery_action": {"type": "string"}
87
+ "status": {"enum": ["passed", "failed", "not_applicable_no_changed_docs", "unavailable"]},
88
+ "selected_files": {"type": "array", "items": {"type": "string", "minLength": 1}},
89
+ "finding_count": {"type": "integer", "minimum": 0}
238
90
  }
239
91
  },
240
- "policy_context": { "$ref": "#/definitions/policyContext" },
241
- "links": {
92
+ "transition": {
242
93
  "type": "object",
243
- "additionalProperties": { "$ref": "#/definitions/link" },
94
+ "additionalProperties": false,
95
+ "required": ["status", "next_stage"],
244
96
  "properties": {
245
- "global_dashboard": { "$ref": "#/definitions/link" },
246
- "project_dashboard": { "$ref": "#/definitions/link" },
247
- "protocol_page": { "$ref": "#/definitions/link" },
248
- "run_index": { "$ref": "#/definitions/link" },
249
- "run_summary": { "$ref": "#/definitions/link" },
250
- "protocol_source": { "$ref": "#/definitions/link" },
251
- "protocol_summary": { "$ref": "#/definitions/link" },
252
- "previous_stage_report": { "$ref": "#/definitions/link" },
253
- "next_stage_report": { "$ref": "#/definitions/link" }
254
- }
255
- },
256
- "plan_items": {
257
- "type": "array",
258
- "minItems": 1,
259
- "items": {
260
- "type": "object",
261
- "additionalProperties": false,
262
- "required": ["id", "title", "owner", "status", "depends_on", "verification", "note", "details"],
263
- "properties": {
264
- "id": {"type": "string", "minLength": 1},
265
- "title": {"type": "string", "minLength": 1},
266
- "owner": {"type": "string", "minLength": 1},
267
- "status": {"type": "string", "enum": ["ready", "watch", "blocked", "done", "skipped"]},
268
- "depends_on": {
269
- "type": "array",
270
- "items": {"type": "string", "minLength": 1}
271
- },
272
- "verification": {"type": "string", "minLength": 1},
273
- "note": {"type": "string", "minLength": 1},
274
- "details": {
275
- "type": "array",
276
- "items": {"type": "string", "minLength": 1}
277
- }
278
- }
97
+ "status": {"enum": ["applied", "blocked", "not_applicable"]},
98
+ "next_stage": {"type": "string", "minLength": 1}
279
99
  }
280
100
  },
281
101
  "handoff": {
@@ -284,126 +104,9 @@
284
104
  "required": ["code_prompt", "must_read", "next_gate"],
285
105
  "properties": {
286
106
  "code_prompt": {"type": "string", "minLength": 1},
287
- "must_read": {
288
- "type": "array",
289
- "items": {"type": "string", "minLength": 1}
290
- },
107
+ "must_read": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
291
108
  "next_gate": {"type": "string", "minLength": 1}
292
109
  }
293
110
  }
294
- },
295
- "definitions": {
296
- "link": {
297
- "type": "object",
298
- "additionalProperties": true,
299
- "required": ["href", "label", "path_kind", "status"],
300
- "properties": {
301
- "href": { "type": "string" },
302
- "label": { "type": "string", "minLength": 1 },
303
- "path_kind": { "type": "string", "enum": ["relative", "absolute"] },
304
- "status": { "type": "string", "enum": ["available", "pending", "missing", "not_applicable"] },
305
- "degraded_reason": { "type": "string" },
306
- "source": { "type": "string" }
307
- }
308
- },
309
- "reviewGate": {
310
- "type": "object",
311
- "additionalProperties": true,
312
- "required": ["id", "label", "stage", "applicability", "verdict", "summary"],
313
- "properties": {
314
- "id": { "type": "string", "minLength": 1 },
315
- "label": { "type": "string", "minLength": 1 },
316
- "stage": { "type": "string", "minLength": 1 },
317
- "applicability": { "type": "string", "minLength": 1 },
318
- "verdict": { "type": "string", "minLength": 1 },
319
- "summary": { "type": "string", "minLength": 1 },
320
- "evidence": {
321
- "type": "array",
322
- "items": { "type": "string", "minLength": 1 }
323
- }
324
- }
325
- },
326
- "aspectMap": {
327
- "type": "object",
328
- "additionalProperties": true,
329
- "required": ["path", "schema_id", "status"],
330
- "properties": {
331
- "path": { "type": "string", "minLength": 1 },
332
- "schema_id": { "type": "string", "minLength": 1 },
333
- "status": { "type": "string", "minLength": 1 },
334
- "summary": { "type": "string" },
335
- "counts": {
336
- "type": "object",
337
- "additionalProperties": true,
338
- "properties": {
339
- "applicable": { "type": "integer", "minimum": 0 },
340
- "not_applicable": { "type": "integer", "minimum": 0 },
341
- "unknown": { "type": "integer", "minimum": 0 }
342
- }
343
- }
344
- }
345
- },
346
- "policyContext": {
347
- "type": "object",
348
- "additionalProperties": true,
349
- "required": ["sources", "git", "checks", "delivery", "gaps"],
350
- "properties": {
351
- "sources": { "type": "object", "additionalProperties": true },
352
- "git": {
353
- "type": "object",
354
- "additionalProperties": true,
355
- "properties": {
356
- "workspace_route": { "type": "string" },
357
- "delivery_strategy": {
358
- "type": "string",
359
- "enum": ["direct_commit", "direct_commit_push", "feature_merge", "pull_request", "merge_queue", "squash_merge", "rebase_ff", "release_branch", "external_handoff", "local_only", "no_git"]
360
- },
361
- "fixation_required": { "type": "boolean" },
362
- "result_evidence_required": { "type": "array", "items": { "type": "string" } }
363
- }
364
- },
365
- "checks": { "type": "object", "additionalProperties": true },
366
- "delivery": { "type": "object", "additionalProperties": true },
367
- "gaps": { "type": "object", "additionalProperties": true }
368
- }
369
- },
370
- "flowFlags": {
371
- "type": "object",
372
- "additionalProperties": false,
373
- "required": ["flow_kind", "snapshot_revision", "resolution_status", "values", "snapshot_checksum"],
374
- "properties": {
375
- "contract": { "type": "object", "additionalProperties": true },
376
- "flow_kind": { "type": "string", "minLength": 1 },
377
- "preset": { "type": "object", "additionalProperties": true },
378
- "snapshot_revision": { "type": "integer", "minimum": 1 },
379
- "resolution_status": { "type": "string", "enum": ["valid", "legacy_incomplete", "reconciliation_required"] },
380
- "values": { "type": "object", "additionalProperties": { "$ref": "#/definitions/flagValue" } },
381
- "snapshot_checksum": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
382
- "floors_applied": { "type": "array", "items": { "type": "string" } },
383
- "resolved_at": { "type": "string", "format": "date-time" }
384
- }
385
- },
386
- "flagValue": {
387
- "type": "object",
388
- "additionalProperties": false,
389
- "required": ["value", "value_type", "owner", "source", "rationale", "resolved_at"],
390
- "properties": {
391
- "value": {},
392
- "value_type": { "type": "string", "minLength": 1 },
393
- "owner": { "type": "string", "minLength": 1 },
394
- "source": {
395
- "type": "object",
396
- "additionalProperties": false,
397
- "required": ["kind", "ref"],
398
- "properties": {
399
- "kind": { "type": "string", "minLength": 1 },
400
- "ref": { "type": "string", "minLength": 1 },
401
- "revision": { "type": ["integer", "null"] }
402
- }
403
- },
404
- "rationale": { "type": "string", "minLength": 1 },
405
- "resolved_at": { "type": "string", "format": "date-time" }
406
- }
407
- }
408
111
  }
409
112
  }
@@ -77,11 +77,11 @@
77
77
  },
78
78
  "excluded_canonical_only_flows": {
79
79
  "type": "array",
80
- "minItems": 4,
80
+ "minItems": 3,
81
81
  "uniqueItems": true,
82
82
  "items": {
83
83
  "type": "string",
84
- "enum": ["mb-init.md", "mb-upgrade.md", "mb-upgrade-review.md", "mb-distill.md"]
84
+ "enum": ["mb-init.md", "mb-upgrade.md", "mb-distill.md"]
85
85
  }
86
86
  },
87
87
  "generated_allow_patterns": {
@@ -116,8 +116,8 @@
116
116
  "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*//)(?!manifest\\.json$)[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$",
117
117
  "not": {
118
118
  "anyOf": [
119
- { "pattern": "^(mb-init|mb-upgrade|mb-upgrade-review|mb-distill)\\.md$" },
120
- { "pattern": "^(mb-init|mb-upgrade|mb-upgrade-review|mb-distill)/" },
119
+ { "pattern": "^(mb-init|mb-upgrade|mb-distill)\\.md$" },
120
+ { "pattern": "^(mb-init|mb-upgrade|mb-distill)/" },
121
121
  { "pattern": "^experiments/" },
122
122
  { "pattern": "^evals/" }
123
123
  ]