@deksden-com/dd-flow-cli 0.4.1 → 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 +33 -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 +86 -19
  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,125 +1,181 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "dd-flow/flow-contract@3",
4
- "title": "dd-flow canonical flow contract",
5
- "description": "Structural contract for the complete flow-contract.json catalog. Dynamic cross-key relationships are validated by the shared CLI normalizer.",
3
+ "$id": "dd-flow/flow-contract@5",
4
+ "title": "dd-flow canonical runtime contract",
5
+ "description": "Structural contract for the SPC-004 v0.2 and SPC-005 runtime/PLAN cutover. Dynamic command and cross-repository checks belong to companion projects.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
- "required": ["id", "version", "capabilities", "stages", "transitions", "readiness", "merge_queue", "defaults", "legacy_aliases", "flow_flags"],
8
+ "required": [
9
+ "schema_id",
10
+ "id",
11
+ "contract_id",
12
+ "version",
13
+ "status",
14
+ "source",
15
+ "specifications",
16
+ "stage_lifecycle",
17
+ "run",
18
+ "artifacts",
19
+ "plan",
20
+ "validation",
21
+ "workspace",
22
+ "lint",
23
+ "removed_contracts",
24
+ "presets",
25
+ "policy"
26
+ ],
9
27
  "properties": {
10
- "id": {"type":"string","pattern":"^dd-flow-canonical-[0-9]{4}-[0-9]{2}$"},
11
- "version": {"const":3},
12
- "capabilities": {"type":"array","uniqueItems":true,"items":{"type":"string","minLength":1}},
13
- "stages": {"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/stage"}},
14
- "transitions": {"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/stringArray"}},
15
- "entrypoints": {"type":"object","additionalProperties":{"$ref":"#/definitions/entrypoint"}},
16
- "readiness": {"$ref":"#/definitions/readiness"},
17
- "merge_queue": {"$ref":"#/definitions/mergeQueue"},
18
- "defaults": {"$ref":"#/definitions/defaults"},
19
- "auto_policy": {"$ref":"#/definitions/autoPolicy"},
20
- "legacy_aliases": {"$ref":"#/definitions/stringMap"},
21
- "route_aliases": {"$ref":"#/definitions/stringMap"},
22
- "flow_flags": {"$ref":"#/definitions/flowFlags"}
23
- },
24
- "definitions": {
25
- "nonEmptyString": {"type":"string","minLength":1},
26
- "stringArray": {"type":"array","uniqueItems":true,"items":{"$ref":"#/definitions/nonEmptyString"}},
27
- "stringMap": {"type":"object","additionalProperties":{"$ref":"#/definitions/nonEmptyString"}},
28
- "flagScalar": {"type":["string","number","boolean","null"]},
29
- "flagMap": {"type":"object","additionalProperties":{"$ref":"#/definitions/flagScalar"}},
30
- "stage": {
31
- "type":"object","additionalProperties":false,"required":["terminal"],
32
- "properties":{"terminal":{"type":"boolean"},"report_enabled":{"type":"boolean"}}
28
+ "schema_id": {"const": "dd-flow/flow-contract@5"},
29
+ "id": {"const": "dd-flow-canonical-2026-08"},
30
+ "contract_id": {"type": "string", "pattern": "^dd-flow-canonical-[0-9]{4}-[0-9]{2}$"},
31
+ "version": {"const": 5},
32
+ "status": {"const": "active"},
33
+ "source": {"const": ".memory-bank/dd-flow/common/runtime-contract.md"},
34
+ "specifications": {
35
+ "type": "array",
36
+ "minItems": 2,
37
+ "items": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["id", "version", "sha256"],
41
+ "properties": {
42
+ "id": {"enum": ["SPC-004", "SPC-005"]},
43
+ "version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
44
+ "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
45
+ }
46
+ }
33
47
  },
34
- "entrypoint": {
35
- "type":"object","additionalProperties":false,
48
+ "stage_lifecycle": {"$ref": "#/definitions/stageLifecycle"},
49
+ "run": {"$ref": "#/definitions/runContract"},
50
+ "artifacts": {"$ref": "#/definitions/artifactContract"},
51
+ "plan": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["semantic_source", "schema", "progress_projection", "worker_projection", "coverage_source", "removed"],
36
55
  "properties": {
37
- "stage":{"$ref":"#/definitions/nonEmptyString"},
38
- "logical_stages":{"$ref":"#/definitions/stringArray"},
39
- "creates_protocol":{"type":"boolean"},
40
- "purpose":{"$ref":"#/definitions/nonEmptyString"},
41
- "mode":{"$ref":"#/definitions/nonEmptyString"}
42
- },
43
- "anyOf":[{"required":["stage"]},{"required":["logical_stages"]}]
56
+ "semantic_source": {"const": ".memory-bank/protocol/<PRT-ID>/plan.json"},
57
+ "schema": {"const": ".memory-bank/dd-flow/schemas/protocol-plan.schema.json"},
58
+ "progress_projection": {"const": "run.json.plan_progress"},
59
+ "worker_projection": {"const": "run.json.workers"},
60
+ "coverage_source": {"const": "<RUN-home>/02-plan/aspect-map.json"},
61
+ "removed": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
62
+ }
44
63
  },
45
- "readiness": {
46
- "type":"object","additionalProperties":false,"required":["command","allowed_from","target_stage"],
47
- "properties":{"command":{"const":"ready-for-merge"},"allowed_from":{"$ref":"#/definitions/stringArray"},"target_stage":{"$ref":"#/definitions/nonEmptyString"}}
64
+ "validation": {"$ref": "#/definitions/validationContract"},
65
+ "workspace": {"$ref": "#/definitions/workspaceContract"},
66
+ "lint": {"$ref": "#/definitions/lintContract"},
67
+ "removed_contracts": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
68
+ "presets": {"$ref": "#/definitions/presets"},
69
+ "policy": {"$ref": "#/definitions/policy"}
70
+ },
71
+ "definitions": {
72
+ "nonEmptyString": {"type": "string", "minLength": 1},
73
+ "stageLifecycle": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["actions", "start_command", "finish_command", "prompt_sections", "current_write_alias", "archive_pattern"],
77
+ "properties": {
78
+ "actions": {
79
+ "const": ["stage_start", "stage_finish"]
80
+ },
81
+ "start_command": {"const": "dd-flow stage start <RUN> --stage <stage> --json"},
82
+ "finish_command": {"const": "dd-flow stage finish <RUN> --stage <stage> --status done --json"},
83
+ "prompt_sections": {
84
+ "const": [
85
+ "stage_identity",
86
+ "runtime_context",
87
+ "intake",
88
+ "applicable_instructions",
89
+ "stage_cli",
90
+ "file_boundaries",
91
+ "completion_contract"
92
+ ]
93
+ },
94
+ "current_write_alias": {"const": "@stage"},
95
+ "archive_pattern": {"const": "try-NNN"}
96
+ }
48
97
  },
49
- "mergeQueue": {
50
- "type":"object","additionalProperties":false,"required":["complete"],
51
- "properties":{"complete":{"type":"object","additionalProperties":false,"required":["target_stage","next_action"],"properties":{"target_stage":{"$ref":"#/definitions/nonEmptyString"},"next_action":{"$ref":"#/definitions/nonEmptyString"}}}}
98
+ "runContract": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["current_state", "history", "sole_authority", "legacy_state"],
102
+ "properties": {
103
+ "current_state": {"const": "run.json"},
104
+ "history": {"const": "timeline.jsonl"},
105
+ "sole_authority": {"const": true},
106
+ "legacy_state": {"const": "retired"}
107
+ }
52
108
  },
53
- "defaults": {
54
- "type":"object","additionalProperties":false,"required":["registered_next_action"],
109
+ "artifactContract": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["finish_outputs", "model_input", "mechanical_facts"],
55
113
  "properties": {
56
- "registered_next_action":{"$ref":"#/definitions/nonEmptyString"},
57
- "ordinary_protocol_flow_kind":{"$ref":"#/definitions/nonEmptyString"},
58
- "normal_stage_layout":{"$ref":"#/definitions/stringArray"},
59
- "legacy_coding_stage_layout":{"$ref":"#/definitions/stringArray"}
114
+ "finish_outputs": {"const": ["stage-report.json", "stage-report.md", "stage-report.html", "summary.md"]},
115
+ "model_input": {"const": "semantic-only"},
116
+ "mechanical_facts": {"const": "cli-owned"}
60
117
  }
61
118
  },
62
- "autoPolicy": {
63
- "type":"object","additionalProperties":false,
119
+ "validationContract": {
120
+ "type": "object",
121
+ "additionalProperties": false,
122
+ "required": ["permission_scope", "memory_bank_scope", "alias_policy"],
64
123
  "properties": {
65
- "ready_for_code_auto":{"$ref":"#/definitions/nonEmptyString"},
66
- "ready_for_code_after_user_review":{"$ref":"#/definitions/nonEmptyString"},
67
- "home_config_path":{"$ref":"#/definitions/nonEmptyString"},
68
- "snapshot_authority":{"$ref":"#/definitions/nonEmptyString"},
69
- "legacy_profile_projection":{"$ref":"#/definitions/nonEmptyString"}
124
+ "permission_scope": {"const": "known-targets-only"},
125
+ "memory_bank_scope": {"const": "post-write-delta"},
126
+ "alias_policy": {"const": "typed-contained-fail-closed"}
70
127
  }
71
128
  },
72
- "flowFlags": {
73
- "type":"object","additionalProperties":false,
74
- "required":["source_precedence","definitions","presets","flows","mandatory_floors"],
129
+ "workspaceContract": {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "required": ["manager", "command", "project_hooks", "fallbacks"],
75
133
  "properties": {
76
- "source_precedence": {
77
- "type":"array","minItems":1,"uniqueItems":true,
78
- "items":{"enum":["flow_default","preset","task_profile","protocol_override","run_override","escalation","compatibility_alias"]}
79
- },
80
- "definitions": {"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/flagDefinition"}},
81
- "presets": {"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/flagMap"}},
82
- "flows": {"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/flowFlagConsumer"}},
83
- "mandatory_floors": {"type":"array","items":{"$ref":"#/definitions/mandatoryFloor"}},
84
- "reduction_matrix": {"type":"object","additionalProperties":{"$ref":"#/definitions/reductionEntry"}},
85
- "consumer_matrix": {"type":"object","additionalProperties":{"$ref":"#/definitions/stringArray"}}
134
+ "manager": {"const": "official-worktrunk"},
135
+ "command": {"const": "wt switch --create <branch> --base <base> --format json"},
136
+ "project_hooks": {"const": [".worktreeinclude", ".config/wt.toml"]},
137
+ "fallbacks": {"const": "forbidden"}
86
138
  }
87
139
  },
88
- "flagDefinition": {
89
- "type":"object","additionalProperties":false,"required":["type","owner","description"],
140
+ "lintContract": {
141
+ "type": "object",
142
+ "additionalProperties": false,
143
+ "required": ["progress_channel", "result_channel", "default_concurrency", "findings_order"],
90
144
  "properties": {
91
- "type":{"enum":["boolean","enum","number","string"]},
92
- "values":{"type":"array","minItems":1,"uniqueItems":true,"items":{"$ref":"#/definitions/flagScalar"}},
93
- "owner":{"$ref":"#/definitions/nonEmptyString"},
94
- "description":{"$ref":"#/definitions/nonEmptyString"}
95
- },
96
- "allOf":[
97
- {"if":{"properties":{"type":{"const":"enum"}},"required":["type"]},"then":{"required":["values"]}},
98
- {"if":{"properties":{"type":{"enum":["boolean","number","string"]}},"required":["type"]},"then":{"not":{"required":["values"]}}}
99
- ]
145
+ "progress_channel": {"const": "stderr"},
146
+ "result_channel": {"const": "stdout"},
147
+ "default_concurrency": {"const": 32},
148
+ "findings_order": {"const": "deterministic"}
149
+ }
100
150
  },
101
- "flowFlagConsumer": {
102
- "type":"object","additionalProperties":false,"required":["default_preset","supported","defaults"],
151
+ "presets": {
152
+ "type": "object",
153
+ "additionalProperties": false,
154
+ "required": ["compact", "normal", "full"],
103
155
  "properties": {
104
- "default_preset":{"$ref":"#/definitions/nonEmptyString"},
105
- "supported":{"type":"array","minItems":1,"uniqueItems":true,"items":{"$ref":"#/definitions/nonEmptyString"}},
106
- "defaults":{"type":"object","additionalProperties":false,"required":["preset"],"properties":{"preset":{"$ref":"#/definitions/nonEmptyString"}}}
156
+ "compact": {"$ref": "#/definitions/preset"},
157
+ "normal": {"$ref": "#/definitions/preset"},
158
+ "full": {"$ref": "#/definitions/preset"}
107
159
  }
108
160
  },
109
- "mandatoryFloor": {
110
- "type":"object","additionalProperties":false,"required":["when","values","reason"],
161
+ "preset": {
162
+ "type": "object",
163
+ "additionalProperties": false,
164
+ "required": ["planning", "verification"],
111
165
  "properties": {
112
- "when":{"type":"object","minProperties":1,"additionalProperties":{"$ref":"#/definitions/stringArray"}},
113
- "values":{"$ref":"#/definitions/flagMap"},
114
- "reason":{"$ref":"#/definitions/nonEmptyString"}
166
+ "planning": {"enum": ["compact", "normal", "full"]},
167
+ "verification": {"enum": ["mandatory", "full"]}
115
168
  }
116
169
  },
117
- "reductionEntry": {
118
- "type":"object","additionalProperties":false,"required":["skips","keeps","reduced_artifact_status"],
170
+ "policy": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": ["source_of_truth", "runtime_owner", "lint_owner", "integrated_gate"],
119
174
  "properties": {
120
- "skips":{"$ref":"#/definitions/stringArray"},
121
- "keeps":{"$ref":"#/definitions/stringArray"},
122
- "reduced_artifact_status":{"$ref":"#/definitions/nonEmptyString"}
175
+ "source_of_truth": {"const": "canonical prompts and schemas"},
176
+ "runtime_owner": {"const": "dd-flow-cli"},
177
+ "lint_owner": {"const": "mb-lint"},
178
+ "integrated_gate": {"const": "compatible releases plus clean specify-to-plan eval"}
123
179
  }
124
180
  }
125
181
  }
@@ -1,35 +1,141 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "dd-flow/flow-run@1",
4
- "title": "dd-flow runtime snapshot",
5
- "description": "Continuation/runtime authority for one RUN; navigation is projected separately to flow-run-index@3.",
3
+ "$id": "dd-flow/flow-run@2",
4
+ "title": "dd-flow canonical RUN state",
5
+ "description": "The sole current machine-readable state for one RUN. Event history belongs to timeline.jsonl.",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
- "required": ["schema_id", "run_index_schema_id", "run_id", "runtime_revision", "snapshot_revision", "snapshot_checksum", "flow_flags"],
8
+ "required": ["schema_id", "run_id", "project", "subject", "status", "started_at", "workspace", "current_stage", "attempts", "session_coverage", "usage_coverage", "artifacts"],
9
9
  "properties": {
10
- "schema_id": { "const": "dd-flow/flow-run@1" },
11
- "run_index_schema_id": { "type": "string" },
12
- "run_id": { "type": "string", "minLength": 1 },
13
- "runtime_revision": { "type": "integer", "minimum": 1 },
14
- "snapshot_revision": { "type": "integer", "minimum": 1 },
15
- "snapshot_checksum": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
16
- "flow_flags": { "$ref": "#/definitions/flowFlags" },
17
- "flag_revision_history": { "type": "array", "maxItems": 32, "items": { "type": "object" } }
10
+ "schema_id": {"const": "dd-flow/flow-run@2"},
11
+ "run_id": {"type": "string", "pattern": "^RUN-[0-9]+-[a-z0-9][a-z0-9-]*$"},
12
+ "project": {"$ref": "#/definitions/identity"},
13
+ "subject": {"$ref": "#/definitions/identity"},
14
+ "protocol_id": {"type": "string"},
15
+ "flow_kind": {"type": "string", "minLength": 1},
16
+ "status": {"enum": ["created", "running", "done", "failed", "blocked", "discarded"]},
17
+ "verdict": {"type": ["string", "null"]},
18
+ "started_at": {"type": "string", "format": "date-time"},
19
+ "finished_at": {"type": ["string", "null"], "format": "date-time"},
20
+ "wall_clock_ms": {"type": ["integer", "null"], "minimum": 0},
21
+ "timing_status": {"enum": ["measured", "partial", "unavailable"]},
22
+ "workspace": {"$ref": "#/definitions/workspace"},
23
+ "current_stage": {"type": ["string", "null"]},
24
+ "plan_ref": {"$ref": "#/definitions/planRef"},
25
+ "plan_progress": {"$ref": "#/definitions/planProgress"},
26
+ "workers": {"$ref": "#/definitions/workers"},
27
+ "attempts": {"type": "array", "items": {"$ref": "#/definitions/attempt"}},
28
+ "session_coverage": {"$ref": "#/definitions/coverage"},
29
+ "usage_coverage": {"$ref": "#/definitions/coverage"},
30
+ "artifacts": {"$ref": "#/definitions/artifacts"},
31
+ "timeline_path": {"const": "timeline.jsonl"}
18
32
  },
19
33
  "definitions": {
20
- "flowFlags": {
34
+ "planRef": {
21
35
  "type": "object",
22
- "required": ["contract", "flow_kind", "snapshot_revision", "resolution_status", "values", "snapshot_checksum"],
36
+ "additionalProperties": false,
37
+ "required": ["path", "plan_id", "revision", "sha256"],
23
38
  "properties": {
24
- "contract": { "type": "object" },
25
- "flow_kind": { "type": "string" },
26
- "preset": { "type": "object" },
27
- "snapshot_revision": { "type": "integer", "minimum": 1 },
28
- "resolution_status": { "type": "string" },
29
- "values": { "type": "object" },
30
- "snapshot_checksum": { "type": "string" },
31
- "compatibility_projection": { "type": "object" },
32
- "floors_applied": { "type": "array", "items": { "type": "string" } }
39
+ "path": {"type": "string", "pattern": "^\\.memory-bank/protocol/[^/]+/plan\\.json$"},
40
+ "plan_id": {"type": "string", "minLength": 1},
41
+ "revision": {"type": "integer", "minimum": 1},
42
+ "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
43
+ }
44
+ },
45
+ "planProgress": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "patternProperties": {
49
+ "^P[0-9]+$": {"$ref": "#/definitions/progressItem"}
50
+ }
51
+ },
52
+ "progressItem": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["status"],
56
+ "properties": {
57
+ "status": {"enum": ["pending", "in_progress", "done", "blocked", "skipped"]},
58
+ "started_at": {"type": "string", "format": "date-time"},
59
+ "completed_at": {"type": "string", "format": "date-time"},
60
+ "summary": {"type": "string", "minLength": 1},
61
+ "evidence": {"type": "array", "items": {"type": "string", "minLength": 1}}
62
+ }
63
+ },
64
+ "workers": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "patternProperties": {
68
+ "^JOB-[A-Za-z0-9._-]+$": {"$ref": "#/definitions/worker"}
69
+ }
70
+ },
71
+ "worker": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["units", "status"],
75
+ "properties": {
76
+ "units": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
77
+ "session_id": {"type": "string", "minLength": 1},
78
+ "status": {"enum": ["registered", "running", "completed", "failed", "blocked"]},
79
+ "task_ref": {"type": "string", "minLength": 1},
80
+ "prompt_ref": {"type": "string", "minLength": 1},
81
+ "report_ref": {"type": "string", "minLength": 1}
82
+ }
83
+ },
84
+ "identity": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["id", "title"],
88
+ "properties": {"id": {"type": "string", "minLength": 1}, "title": {"type": "string", "minLength": 1}}
89
+ },
90
+ "workspace": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": ["project_root", "workspace_path", "branch", "base"],
94
+ "properties": {
95
+ "project_root": {"type": "string", "minLength": 1},
96
+ "workspace_path": {"type": "string", "minLength": 1},
97
+ "branch": {"type": "string", "minLength": 1},
98
+ "base": {"type": "string", "minLength": 1},
99
+ "manager": {"const": "official-worktrunk"},
100
+ "bootstrap_status": {"type": "string", "minLength": 1}
101
+ }
102
+ },
103
+ "attempt": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": ["stage", "attempt_number", "root", "status"],
107
+ "properties": {
108
+ "stage": {"type": "string", "minLength": 1},
109
+ "attempt_number": {"type": "integer", "minimum": 1},
110
+ "root": {"type": "string", "minLength": 1},
111
+ "archive": {"type": ["string", "null"]},
112
+ "status": {"type": "string", "minLength": 1},
113
+ "started_at": {"type": "string", "format": "date-time"},
114
+ "finished_at": {"type": ["string", "null"], "format": "date-time"}
115
+ }
116
+ },
117
+ "coverage": {
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "required": ["status", "expected", "observed", "missing"],
121
+ "properties": {
122
+ "status": {"enum": ["complete", "partial", "unavailable"]},
123
+ "expected": {"type": "array", "items": {"type": "string"}},
124
+ "observed": {"type": "array", "items": {"type": "string"}},
125
+ "missing": {"type": "array", "items": {"type": "string"}},
126
+ "reason": {"type": "string"}
127
+ }
128
+ },
129
+ "artifacts": {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "required": ["stage_prompt", "stage_report_json", "stage_report_md", "stage_report_html", "summary"],
133
+ "properties": {
134
+ "stage_prompt": {"type": "string", "minLength": 1},
135
+ "stage_report_json": {"type": "string", "minLength": 1},
136
+ "stage_report_md": {"type": "string", "minLength": 1},
137
+ "stage_report_html": {"type": "string", "minLength": 1},
138
+ "summary": {"type": "string", "minLength": 1}
33
139
  }
34
140
  }
35
141
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "dd-flow/mb-upgrade-review-data@1",
4
- "title": "mb-upgrade-review data",
5
- "description": "Canonical data contract for mb-upgrade-review review-data.json.",
4
+ "title": "mb-upgrade 05-review data",
5
+ "description": "Canonical data contract for review-data.json produced by mb-upgrade stage 05-review.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": [
@@ -4,37 +4,13 @@
4
4
  "title": "Memory Bank permissions preflight",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": [
8
- "schema_id",
9
- "ok",
10
- "exit_code",
11
- "flow",
12
- "mode",
13
- "platform",
14
- "targets",
15
- "checks",
16
- "summary",
17
- "remediation"
18
- ],
7
+ "required": ["schema_id", "ok", "exit_code", "flow", "mode", "platform", "targets", "checks", "summary", "remediation"],
19
8
  "properties": {
20
- "schema_id": {
21
- "const": "dd-flow/memorybank-permissions-preflight@1"
22
- },
23
- "ok": {
24
- "type": "boolean"
25
- },
26
- "exit_code": {
27
- "type": "integer",
28
- "enum": [0, 1]
29
- },
30
- "flow": {
31
- "type": "string",
32
- "enum": ["mb-init", "mb-upgrade", "mb-audit", "mb-fix", "mb-upgrade-review", "custom"]
33
- },
34
- "mode": {
35
- "type": "string",
36
- "enum": ["read", "write", "repair", "report_only"]
37
- },
9
+ "schema_id": { "const": "dd-flow/memorybank-permissions-preflight@1" },
10
+ "ok": { "type": "boolean" },
11
+ "exit_code": { "type": "integer", "enum": [0, 1] },
12
+ "flow": { "type": "string", "enum": ["mb-init", "mb-upgrade", "mb-audit", "mb-fix", "custom"] },
13
+ "mode": { "type": "string", "enum": ["read", "write", "repair", "report_only"] },
38
14
  "platform": {
39
15
  "type": "object",
40
16
  "additionalProperties": false,
@@ -57,10 +33,7 @@
57
33
  "tasks": { "type": "string" }
58
34
  }
59
35
  },
60
- "checks": {
61
- "type": "array",
62
- "items": { "$ref": "#/$defs/check" }
63
- },
36
+ "checks": { "type": "array", "items": { "$ref": "#/$defs/check" } },
64
37
  "summary": {
65
38
  "type": "object",
66
39
  "additionalProperties": false,
@@ -71,10 +44,7 @@
71
44
  "can_continue": { "type": "boolean" }
72
45
  }
73
46
  },
74
- "remediation": {
75
- "type": "array",
76
- "items": { "$ref": "#/$defs/remediation" }
77
- }
47
+ "remediation": { "type": "array", "items": { "$ref": "#/$defs/remediation" } }
78
48
  },
79
49
  "$defs": {
80
50
  "check": {
@@ -87,36 +57,12 @@
87
57
  "path": { "type": "string" },
88
58
  "operation": {
89
59
  "type": "string",
90
- "enum": [
91
- "read_existing_file",
92
- "write_existing_file",
93
- "create_file",
94
- "create_directory",
95
- "delete_probe",
96
- "stat_metadata",
97
- "detect_acl",
98
- "detect_flags"
99
- ]
100
- },
101
- "status": {
102
- "type": "string",
103
- "enum": ["passed", "failed", "warning", "skipped", "unknown"]
60
+ "enum": ["read_existing_file", "write_existing_file", "create_file", "create_directory", "delete_probe", "stat_metadata", "detect_acl", "detect_flags"]
104
61
  },
62
+ "status": { "type": "string", "enum": ["passed", "failed", "warning", "skipped", "unknown"] },
105
63
  "reason": {
106
64
  "type": "string",
107
- "enum": [
108
- "ok",
109
- "not_found",
110
- "not_writable",
111
- "not_readable",
112
- "owner_mismatch",
113
- "acl_denied",
114
- "read_only_attribute",
115
- "immutable_flag",
116
- "unsupported_platform",
117
- "probe_failed",
118
- "unknown"
119
- ]
65
+ "enum": ["ok", "not_found", "not_writable", "not_readable", "owner_mismatch", "acl_denied", "read_only_attribute", "immutable_flag", "unsupported_platform", "probe_failed", "unknown"]
120
66
  },
121
67
  "fs_error": {
122
68
  "type": "object",
@@ -130,10 +76,7 @@
130
76
  "owner": { "type": "string" },
131
77
  "group": { "type": "string" },
132
78
  "mode": { "type": "string" },
133
- "side_effect": {
134
- "type": "string",
135
- "enum": ["none", "temporary_probe_created_and_removed", "temporary_probe_cleanup_failed"]
136
- }
79
+ "side_effect": { "type": "string", "enum": ["none", "temporary_probe_created_and_removed", "temporary_probe_cleanup_failed"] }
137
80
  }
138
81
  },
139
82
  "remediation": {
@@ -143,10 +86,7 @@
143
86
  "properties": {
144
87
  "platform": { "type": "string" },
145
88
  "title": { "type": "string" },
146
- "commands": {
147
- "type": "array",
148
- "items": { "type": "string" }
149
- },
89
+ "commands": { "type": "array", "items": { "type": "string" } },
150
90
  "requires_user_confirmation": { "type": "boolean" }
151
91
  }
152
92
  }
@@ -235,10 +235,10 @@
235
235
  "run": {
236
236
  "type": "object",
237
237
  "additionalProperties": true,
238
- "required": ["run_id", "run_index"],
238
+ "required": ["run_id", "run_state"],
239
239
  "properties": {
240
240
  "run_id": { "type": "string", "pattern": "^RUN-[0-9]{3}-[a-z0-9]+(?:-[a-z0-9]+)*$" },
241
- "run_index": { "type": "string", "minLength": 1 }
241
+ "run_state": { "type": "string", "minLength": 1 }
242
242
  }
243
243
  },
244
244
  "stage": {