@deksden-com/dd-flow-cli 0.6.0 → 0.8.0-beta.135
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.
- package/CHANGELOG.md +636 -0
- package/README.md +13 -1
- package/dist/build-info.json +10 -10
- package/dist/cli/help.js +108 -18
- package/dist/cli/run-cli.js +626 -49
- package/dist/domain/flow-contract.js +11 -0
- package/dist/domain/stage-catalog.js +22 -0
- package/dist/runtime/context.js +8 -2
- package/dist/schemas/code-review-decision.schema.json +26 -0
- package/dist/schemas/code-review-result.schema.json +14 -0
- package/dist/schemas/code-stage-report.schema.json +7 -2
- package/dist/schemas/code-verification.schema.json +14 -0
- package/dist/schemas/code-work-batch.schema.json +24 -0
- package/dist/schemas/code-work-result.schema.json +16 -0
- package/dist/schemas/engine-manifest.schema.json +22 -0
- package/dist/schemas/flow-contract.schema.json +6 -3
- package/dist/schemas/flow-run.schema.json +16 -122
- package/dist/schemas/mb-upgrade-migration-report.schema.json +3 -1
- package/dist/schemas/merge-stage-report-legacy-0.4.2.schema.json +24 -0
- package/dist/schemas/plan-aspect-map.schema.json +22 -0
- package/dist/schemas/plan-review-decision.schema.json +14 -0
- package/dist/schemas/plan-review-result.schema.json +42 -0
- package/dist/schemas/protocol-plan.schema.json +15 -182
- package/dist/schemas/run-engine-binding.schema.json +37 -0
- package/dist/schemas/stage-finish-input.schema.json +16 -2
- package/dist/schemas/stage-prompt.schema.json +4 -4
- package/dist/schemas/stage-report.schema.json +8 -7
- package/dist/schemas/vnext-protocol-plan.schema.json +37 -0
- package/dist/schemas/vnext-protocolize-result.schema.json +29 -0
- package/dist/schemas/vnext-specify.schema.json +45 -0
- package/dist/services/branch-context.js +1 -1
- package/dist/services/canon.js +15 -1
- package/dist/services/cleanup.js +8 -8
- package/dist/services/cli-operation-classifier.js +60 -8
- package/dist/services/code-checks.js +244 -0
- package/dist/services/compatibility-preflight.js +1 -1
- package/dist/services/config.js +7 -1
- package/dist/services/dashboard.js +14 -14
- package/dist/services/engines.js +408 -30
- package/dist/services/eval-snapshots.js +404 -0
- package/dist/services/hooks.js +775 -23
- package/dist/services/ids.js +16 -6
- package/dist/services/lanes.js +1 -5
- package/dist/services/merge-queue.js +53 -5
- package/dist/services/merge-worker.js +5 -6
- package/dist/services/migrations.js +307 -44
- package/dist/services/plan-runtime.js +5 -5
- package/dist/services/plans.js +5 -3
- package/dist/services/projects.js +4 -4
- package/dist/services/prompts.js +1 -1
- package/dist/services/protocols.js +31 -10
- package/dist/services/run-engine-bindings.js +157 -0
- package/dist/services/run-projection.js +49 -13
- package/dist/services/runs.js +525 -58
- package/dist/services/schema-validation.js +116 -2
- package/dist/services/sessions.js +51 -12
- package/dist/services/stage-blocker.js +57 -0
- package/dist/services/stage-context.js +90 -0
- package/dist/services/stage-lifecycle.js +288 -77
- package/dist/services/stage-pause.js +175 -0
- package/dist/services/stage-report-renderer.js +65 -0
- package/dist/services/status.js +8 -3
- package/dist/services/usage.js +526 -18
- package/dist/services/vnext-code-review.js +308 -0
- package/dist/services/vnext-code.js +616 -0
- package/dist/services/vnext-contracts.js +1 -0
- package/dist/services/vnext-execution-profile.js +27 -0
- package/dist/services/vnext-fanout.js +79 -0
- package/dist/services/vnext-plan-review.js +499 -0
- package/dist/services/vnext-plan.js +576 -0
- package/dist/services/vnext-protocolize.js +542 -0
- package/dist/services/vnext-specify.js +595 -0
- package/dist/services/vnext-workspace-policy.js +87 -0
- package/dist/services/work-registry.js +499 -0
- package/dist/services/worktrees.js +58 -37
- package/dist/storage/database.js +292 -42
- package/dist/storage/paths.js +47 -1
- package/package.json +12 -12
|
@@ -64,6 +64,17 @@ export function loadProjectFlowContract(projectRoot) {
|
|
|
64
64
|
if (!contractPath) {
|
|
65
65
|
return defaultFlowContract;
|
|
66
66
|
}
|
|
67
|
+
return loadFlowContractFile(contractPath);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Canonical-only flows execute against the pinned canonical contract before
|
|
71
|
+
* the target project flow pack is synchronized. Keep this path explicit so a
|
|
72
|
+
* stale project-local contract cannot become the upgrade RUN authority.
|
|
73
|
+
*/
|
|
74
|
+
export function loadCanonicalFlowContract(flowRoot) {
|
|
75
|
+
return loadFlowContractFile(path.join(flowRoot, "flow-contract.json"));
|
|
76
|
+
}
|
|
77
|
+
function loadFlowContractFile(contractPath) {
|
|
67
78
|
try {
|
|
68
79
|
const value = readFlowContractObject(contractPath);
|
|
69
80
|
validateFlowContractStructure(value);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppError } from "../shared/errors.js";
|
|
2
|
+
export const vnextStages = [
|
|
3
|
+
{ id: "specify", directory: "01-specify", result: "specify.json", schema: "dd-flow/vnext-specify-result@4", next: ["protocolize"] },
|
|
4
|
+
{ id: "protocolize", directory: "02-protocolize", result: "protocolize-result.json", schema: "dd-flow/vnext-protocolize-result@3", next: ["plan"] },
|
|
5
|
+
{ id: "plan", directory: "03-plan", result: "stage-report.json", schema: "dd-flow/stage-report@2", next: ["plan-review", "code"] },
|
|
6
|
+
{ id: "plan-review", directory: "04-plan-review", result: "decision.json", schema: "dd-flow/plan-review-decision@3", next: ["code"] },
|
|
7
|
+
{ id: "code", directory: "05-code", result: "code-verification.json", schema: "dd-flow/code-verification@2", next: ["code-review", "merge"] },
|
|
8
|
+
{ id: "code-review", directory: "06-code-review", result: "decision.json", schema: "dd-flow/code-review-decision@2", next: ["merge"] },
|
|
9
|
+
{ id: "merge", directory: "07-merge", result: "merge-result.json", schema: "dd-flow/merge-result@1", next: [] }
|
|
10
|
+
];
|
|
11
|
+
export function vnextStage(id) {
|
|
12
|
+
const stage = vnextStages.find((candidate) => candidate.id === id);
|
|
13
|
+
if (!stage)
|
|
14
|
+
throw new AppError("validation", `Unknown vNext stage: ${id}`, 2, { stage: id });
|
|
15
|
+
return stage;
|
|
16
|
+
}
|
|
17
|
+
export function vnextStageDirectory(id) {
|
|
18
|
+
return vnextStage(id).directory;
|
|
19
|
+
}
|
|
20
|
+
export function isLegalVnextTransition(from, to) {
|
|
21
|
+
return vnextStage(from).next.includes(to);
|
|
22
|
+
}
|
package/dist/runtime/context.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { getDatabase } from "../storage/database.js";
|
|
2
2
|
import { resolveDdFlowHome } from "../storage/paths.js";
|
|
3
|
-
export function
|
|
3
|
+
export function createRouterContext(env) {
|
|
4
|
+
return {
|
|
5
|
+
ddFlowHome: resolveDdFlowHome(env),
|
|
6
|
+
now: () => new Date().toISOString()
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function createContext(env, mode = "initialize") {
|
|
4
10
|
const ddFlowHome = resolveDdFlowHome(env);
|
|
5
11
|
return {
|
|
6
12
|
ddFlowHome,
|
|
7
|
-
db: getDatabase(ddFlowHome),
|
|
13
|
+
db: getDatabase(ddFlowHome, mode),
|
|
8
14
|
env,
|
|
9
15
|
now: () => new Date().toISOString()
|
|
10
16
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "dd-flow/code-review-decision@2",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "summary", "findings"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/code-review-decision@2"},
|
|
9
|
+
"summary": {"type": "string", "minLength": 1},
|
|
10
|
+
"findings": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"required": ["finding_ref", "disposition", "reason"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"finding_ref": {"type": "string", "pattern": "^WRK-[^/]+/FIND-[0-9]{3}$"},
|
|
18
|
+
"disposition": {"enum": ["fix", "defer", "reject", "duplicate"]},
|
|
19
|
+
"reason": {"type": "string", "minLength": 1},
|
|
20
|
+
"def_id": {"type": "string", "minLength": 1},
|
|
21
|
+
"duplicate_of": {"type": "string", "minLength": 1}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "dd-flow/code-review-result@1",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "verdict", "summary", "aspects", "findings"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/code-review-result@1"},
|
|
9
|
+
"verdict": {"enum": ["pass", "findings", "blocked"]},
|
|
10
|
+
"summary": {"type": "string", "minLength": 1},
|
|
11
|
+
"aspects": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["aspect_id", "verdict", "summary", "evidence_refs"], "properties": {"aspect_id": {"type": "string", "minLength": 1}, "verdict": {"enum": ["pass", "findings", "blocked"]}, "summary": {"type": "string", "minLength": 1}, "evidence_refs": {"type": "array", "items": {"type": "string"}}}}},
|
|
12
|
+
"findings": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["finding_id", "aspect_id", "priority", "problem", "impact", "evidence_refs", "obligation_refs"], "properties": {"finding_id": {"type": "string", "pattern": "^FIND-[0-9]{3}$"}, "aspect_id": {"type": "string", "minLength": 1}, "priority": {"enum": ["p0", "p1", "p2", "p3"]}, "problem": {"type": "string", "minLength": 1}, "impact": {"type": "string", "minLength": 1}, "evidence_refs": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "obligation_refs": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}}}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -124,10 +124,15 @@
|
|
|
124
124
|
"run": {
|
|
125
125
|
"type": "object",
|
|
126
126
|
"additionalProperties": true,
|
|
127
|
-
"required": ["run_id"
|
|
127
|
+
"required": ["run_id"],
|
|
128
|
+
"anyOf": [
|
|
129
|
+
{"required": ["run_state"]},
|
|
130
|
+
{"required": ["run_index"]}
|
|
131
|
+
],
|
|
128
132
|
"properties": {
|
|
129
133
|
"run_id": { "type": "string", "pattern": "^RUN-[0-9]{3}-[a-z0-9]+(?:-[a-z0-9]+)*$" },
|
|
130
|
-
"run_state": { "type": "string", "minLength": 1 }
|
|
134
|
+
"run_state": { "type": "string", "minLength": 1 },
|
|
135
|
+
"run_index": { "type": "string", "minLength": 1 }
|
|
131
136
|
}
|
|
132
137
|
},
|
|
133
138
|
"stage": {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "dd-flow/code-verification@2",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "verdict", "summary", "unresolved", "deviations"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/code-verification@2"},
|
|
9
|
+
"verdict": {"enum": ["passed", "needs_repair", "blocked"]},
|
|
10
|
+
"summary": {"type": "string", "minLength": 1},
|
|
11
|
+
"unresolved": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
12
|
+
"deviations": {"type": "array", "items": {"type": "string", "minLength": 1}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/code-work-batch@4",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "sources", "works"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/code-work-batch@4"},
|
|
9
|
+
"sources": {"type": "array", "minItems": 1, "items": {"type": "object", "additionalProperties": false, "required": ["plan_id", "protocol_id", "revision", "sha256"], "properties": {"plan_id": {"type": "string", "minLength": 1}, "protocol_id": {"type": "string", "minLength": 1}, "revision": {"type": "integer", "minimum": 1}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}}}},
|
|
10
|
+
"works": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/work"}}
|
|
11
|
+
},
|
|
12
|
+
"$defs": {
|
|
13
|
+
"strings": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
|
|
14
|
+
"stringList": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
15
|
+
"source": {"type": "object", "additionalProperties": false, "required": ["plan_id", "protocol_id", "plan_item_id", "revision", "sha256"], "properties": {"plan_id": {"type": "string", "minLength": 1}, "protocol_id": {"type": "string", "minLength": 1}, "plan_item_id": {"type": "string", "minLength": 1}, "revision": {"type": "integer", "minimum": 1}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}}},
|
|
16
|
+
"spine": {"type": "object", "additionalProperties": false, "required": ["user_outcome", "component_responsibility", "must_preserve", "non_goals", "acceptance_contribution"], "properties": {"user_outcome": {"type": "string", "minLength": 1}, "component_responsibility": {"type": "string", "minLength": 1}, "must_preserve": {"$ref": "#/$defs/strings"}, "non_goals": {"$ref": "#/$defs/stringList"}, "acceptance_contribution": {"type": "string", "minLength": 1}}},
|
|
17
|
+
"obligation": {"type": "object", "additionalProperties": false, "required": ["id", "statement"], "properties": {"id": {"type": "string", "minLength": 1}, "statement": {"type": "string", "minLength": 1}}},
|
|
18
|
+
"acceptance": {"type": "object", "additionalProperties": false, "required": ["criterion_id", "path", "environment", "fixtures", "cleanup", "check_refs", "expected_evidence", "proof_limits", "gate"], "properties": {"criterion_id": {"type": "string", "pattern": "^AC-[0-9]+$"}, "path": {"type": "string", "minLength": 1}, "environment": {"type": "string", "minLength": 1}, "fixtures": {"$ref": "#/$defs/stringList"}, "cleanup": {"type": "string", "minLength": 1}, "check_refs": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}, "expected_evidence": {"$ref": "#/$defs/strings"}, "proof_limits": {"$ref": "#/$defs/strings"}, "gate": {"type": "string", "minLength": 1}}},
|
|
19
|
+
"check": {"type": "object", "additionalProperties": false, "required": ["id", "command", "purpose", "run_at", "availability"], "properties": {"id": {"type": "string", "pattern": "^CHK-[A-Za-z0-9-]+$"}, "command": {"type": "string", "minLength": 1}, "purpose": {"type": "string", "minLength": 1}, "run_at": {"enum": ["work", "code", "readiness", "merge", "release", "external"]}, "availability": {"enum": ["available", "planned"]}, "provided_by": {"type": "string", "minLength": 1}, "definition": {"type": "string", "minLength": 1}, "required_artifacts": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}, "allOf": [{"if": {"properties": {"availability": {"const": "planned"}}, "required": ["availability"]}, "then": {"required": ["provided_by", "definition"], "properties": {"command": {"pattern": "^@check/"}}}}]},
|
|
20
|
+
"documentUpdate": {"type": "object", "additionalProperties": false, "required": ["path", "action", "owner", "reason", "baseline_sha256"], "properties": {"path": {"type": "string", "minLength": 1}, "action": {"enum": ["create", "update"]}, "owner": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}, "baseline_sha256": {"type": ["string", "null"], "pattern": "^[a-f0-9]{64}$"}}},
|
|
21
|
+
"repair": {"type": "object", "additionalProperties": false, "required": ["origin_work_ids"], "anyOf": [{"required": ["check_receipt_id", "failure_receipt_path"]}, {"required": ["review_finding_ids", "review_evidence_refs"]}], "properties": {"origin_work_ids": {"$ref": "#/$defs/strings"}, "check_receipt_id": {"type": "string", "minLength": 1}, "failure_receipt_path": {"type": "string", "minLength": 1}, "review_finding_ids": {"$ref": "#/$defs/strings"}, "review_evidence_refs": {"$ref": "#/$defs/strings"}}},
|
|
22
|
+
"work": {"type": "object", "additionalProperties": false, "required": ["schema_id", "key", "launch_policy", "source", "task", "semantic_spine", "requirements", "acceptance", "document_updates", "required_read", "discovery_boundary", "write_scope", "checks", "provides_checks", "stop_conditions", "depends_on", "result_schema"], "properties": {"schema_id": {"const": "dd-flow/code-work-packet@4"}, "key": {"type": "string", "minLength": 1}, "launch_policy": {"const": "fresh_agent_required"}, "source": {"$ref": "#/$defs/source"}, "repair": {"$ref": "#/$defs/repair"}, "task": {"type": "string", "minLength": 1}, "semantic_spine": {"$ref": "#/$defs/spine"}, "requirements": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/obligation"}}, "acceptance": {"type": "array", "items": {"$ref": "#/$defs/acceptance"}}, "document_updates": {"type": "array", "items": {"$ref": "#/$defs/documentUpdate"}}, "required_read": {"$ref": "#/$defs/strings"}, "discovery_boundary": {"$ref": "#/$defs/strings"}, "write_scope": {"$ref": "#/$defs/strings"}, "checks": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/check"}}, "provides_checks": {"type": "array", "items": {"$ref": "#/$defs/check"}}, "stop_conditions": {"$ref": "#/$defs/strings"}, "depends_on": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}, "result_schema": {"const": "dd-flow/code-work-result@2"}}}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/code-work-result@2",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "summary", "changed_paths", "evidence", "deviations", "blockers"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/code-work-result@2"},
|
|
9
|
+
"summary": {"type": "string", "minLength": 1},
|
|
10
|
+
"changed_paths": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
|
|
11
|
+
"evidence": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["criterion_id", "refs"], "properties": {"criterion_id": {"type": "string", "minLength": 1}, "refs": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}},
|
|
12
|
+
"deviations": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
13
|
+
"blockers": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
14
|
+
"resolved_finding_refs": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -44,6 +44,28 @@
|
|
|
44
44
|
"items": { "type": "string", "minLength": 1 }
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
"schema_registry": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["schema_id", "entries"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"schema_id": { "const": "dd-flow/engine-schema-registry@1" },
|
|
53
|
+
"entries": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": ["name", "id", "path", "checksum"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
|
|
61
|
+
"id": { "type": "string", "minLength": 1 },
|
|
62
|
+
"path": { "type": "string", "pattern": "^dist/schemas/[a-z0-9][a-z0-9-]*\\.schema\\.json$" },
|
|
63
|
+
"checksum": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
47
69
|
"integrity": {
|
|
48
70
|
"type": "object",
|
|
49
71
|
"additionalProperties": false,
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"start_command": {"const": "dd-flow stage start <RUN> --stage <stage> --json"},
|
|
82
82
|
"bootstrap_command": {"const": "dd-flow stage start --bootstrap --stage specify --project-root <root> --subject <label> --intake-file <path> --json"},
|
|
83
|
-
"finish_command": {"const": "dd-flow stage finish <RUN> --stage <stage> --
|
|
83
|
+
"finish_command": {"const": "dd-flow stage finish <RUN> --stage <stage> --json"},
|
|
84
84
|
"prompt_sections": {
|
|
85
85
|
"const": [
|
|
86
86
|
"stage_identity",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"required": ["finish_outputs", "model_input", "mechanical_facts"],
|
|
115
115
|
"properties": {
|
|
116
116
|
"finish_outputs": {"const": ["stage-report.json", "stage-report.md", "stage-report.html", "summary.md"]},
|
|
117
|
-
"model_input": {"const": "semantic-only;
|
|
117
|
+
"model_input": {"const": "semantic-only; status in stage-input.json; mechanical facts are CLI-owned"},
|
|
118
118
|
"mechanical_facts": {"const": "cli-owned"}
|
|
119
119
|
}
|
|
120
120
|
},
|
|
@@ -131,11 +131,14 @@
|
|
|
131
131
|
"workspaceContract": {
|
|
132
132
|
"type": "object",
|
|
133
133
|
"additionalProperties": false,
|
|
134
|
-
"required": ["manager", "command", "project_hooks", "fallbacks"],
|
|
134
|
+
"required": ["manager", "command", "project_hooks", "feature_route_stage", "service_checkout_root", "feature_branch_template", "fallbacks"],
|
|
135
135
|
"properties": {
|
|
136
136
|
"manager": {"const": "official-worktrunk"},
|
|
137
137
|
"command": {"const": "wt switch --create <branch> --base <base> --format json"},
|
|
138
138
|
"project_hooks": {"const": [".worktreeinclude", ".config/wt.toml"]},
|
|
139
|
+
"feature_route_stage": {"const": "protocolize_start"},
|
|
140
|
+
"service_checkout_root": {"const": "$DD_FLOW_HOME/projects/<PRJ-ID>/checkouts/worktrees/<RUN>/<repo>"},
|
|
141
|
+
"feature_branch_template": {"const": "feature/run-<RUN>-<slug>"},
|
|
139
142
|
"fallbacks": {"const": "forbidden"}
|
|
140
143
|
}
|
|
141
144
|
},
|
|
@@ -1,142 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "dd-flow/flow-run@
|
|
4
|
-
"title": "dd-flow
|
|
5
|
-
"description": "
|
|
3
|
+
"$id": "dd-flow/flow-run@3",
|
|
4
|
+
"title": "dd-flow portable RUN projection",
|
|
5
|
+
"description": "Compact current projection. SQLite owns runtime state and timeline.jsonl owns history.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": true,
|
|
8
|
-
"required": ["schema_id", "run_id", "project", "subject", "status", "started_at", "workspace"
|
|
8
|
+
"required": ["schema_id", "run_id", "project", "subject", "status", "started_at", "workspace"],
|
|
9
9
|
"properties": {
|
|
10
|
-
"schema_id": {"const": "dd-flow/flow-run@
|
|
10
|
+
"schema_id": {"const": "dd-flow/flow-run@3"},
|
|
11
11
|
"run_id": {"type": "string", "pattern": "^RUN-[0-9]+-[a-z0-9][a-z0-9-]*$"},
|
|
12
12
|
"project": {"$ref": "#/definitions/identity"},
|
|
13
13
|
"subject": {"$ref": "#/definitions/identity"},
|
|
14
|
-
"protocol_id": {"type": "string"},
|
|
15
14
|
"flow_kind": {"type": "string", "minLength": 1},
|
|
16
|
-
"status": {"enum": ["created", "running", "done", "failed", "blocked", "discarded"]},
|
|
15
|
+
"status": {"enum": ["created", "running", "paused", "waiting_for_user", "done", "failed", "blocked", "cancelled", "discarded"]},
|
|
17
16
|
"verdict": {"type": ["string", "null"]},
|
|
18
17
|
"started_at": {"type": "string", "format": "date-time"},
|
|
19
18
|
"finished_at": {"type": ["string", "null"], "format": "date-time"},
|
|
20
19
|
"wall_clock_ms": {"type": ["integer", "null"], "minimum": 0},
|
|
21
20
|
"timing_status": {"enum": ["measured", "partial", "unavailable"]},
|
|
22
21
|
"workspace": {"$ref": "#/definitions/workspace"},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"usage_coverage": {"$ref": "#/definitions/coverage"},
|
|
30
|
-
"artifacts": {"$ref": "#/definitions/artifacts"},
|
|
22
|
+
"root_work_id": {"type": ["string", "null"]},
|
|
23
|
+
"active_stages": {"type": "array", "items": {"type": "string", "minLength": 1}, "uniqueItems": true},
|
|
24
|
+
"next_actions": {"type": "array", "items": {"type": "string", "minLength": 1}, "uniqueItems": true},
|
|
25
|
+
"works": {"type": "array", "items": {"$ref": "#/definitions/work"}},
|
|
26
|
+
"sessions": {"type": "array", "items": {"$ref": "#/definitions/session"}},
|
|
27
|
+
"variables": {"type": "object"},
|
|
31
28
|
"timeline_path": {"const": "timeline.jsonl"}
|
|
32
29
|
},
|
|
33
30
|
"definitions": {
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"properties": {
|
|
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}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
31
|
+
"identity": {"type": "object", "additionalProperties": false, "required": ["id", "title"], "properties": {"id": {"type": "string", "minLength": 1}, "title": {"type": "string", "minLength": 1}}},
|
|
32
|
+
"workspace": {"type": "object", "additionalProperties": true, "required": ["project_root", "workspace_path", "branch", "base"], "properties": {"project_root": {"type": "string", "minLength": 1}, "workspace_path": {"type": "string", "minLength": 1}, "branch": {"type": "string", "minLength": 1}, "base": {"type": "string", "minLength": 1}}},
|
|
33
|
+
"work": {"type": "object", "additionalProperties": false, "required": ["work_id", "status", "depends_on"], "properties": {"work_id": {"type": "string"}, "parent_work_id": {"type": ["string", "null"]}, "status": {"enum": ["created", "running", "completed", "failed", "cancelled"]}, "depends_on": {"type": "array", "items": {"type": "string"}}, "launch_policy": {"enum": ["reuse_allowed", "fresh_agent_required"]}, "started_at": {"type": ["string", "null"]}, "completed_at": {"type": ["string", "null"]}}},
|
|
34
|
+
"session": {"type": "object", "additionalProperties": true, "required": ["session_id", "status"], "properties": {"session_id": {"type": "string", "minLength": 1}, "parent_session_id": {"type": ["string", "null"]}, "work_id": {"type": "string"}, "agent_id": {"type": ["string", "null"]}, "status": {"type": "string"}}}
|
|
141
35
|
}
|
|
142
36
|
}
|
|
@@ -70,12 +70,14 @@
|
|
|
70
70
|
},
|
|
71
71
|
"backup": {
|
|
72
72
|
"type": "object",
|
|
73
|
-
"required": ["status", "path", "created_at", "rollback_route"],
|
|
73
|
+
"required": ["status", "path", "created_at", "rollback_route", "size_bytes", "sha256"],
|
|
74
74
|
"additionalProperties": true,
|
|
75
75
|
"properties": {
|
|
76
76
|
"status": { "enum": ["present", "planned", "missing"] },
|
|
77
77
|
"path": { "type": ["string", "null"] },
|
|
78
78
|
"created_at": { "type": ["string", "null"] },
|
|
79
|
+
"size_bytes": { "type": ["integer", "null"], "minimum": 1 },
|
|
80
|
+
"sha256": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
|
|
79
81
|
"rollback_route": { "type": "string", "minLength": 1 }
|
|
80
82
|
}
|
|
81
83
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/merge-stage-report@2/engine-0.4.2",
|
|
4
|
+
"title": "Merge stage report emitted by dd-flow engine 0.4.2",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"required": ["schema_id", "run", "stage", "project", "subject", "overall", "breadcrumbs", "implemented_goals", "acceptance_scenarios", "changed_files", "checks", "review", "review_gates", "defs"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_id": { "const": "dd-flow/merge-stage-report@2" },
|
|
10
|
+
"run": { "type": "object", "required": ["run_id", "run_index"], "properties": { "run_id": { "type": "string", "pattern": "^RUN-[0-9]{3}-[a-z0-9]+(?:-[a-z0-9]+)*$" }, "run_index": { "type": "string", "minLength": 1 } } },
|
|
11
|
+
"stage": { "type": "object", "required": ["name", "dir", "status"] },
|
|
12
|
+
"project": { "type": "object", "required": ["id", "title"] },
|
|
13
|
+
"subject": { "type": "object", "required": ["id", "title"] },
|
|
14
|
+
"overall": { "type": "object", "required": ["verdict", "summary", "next_action"], "properties": { "verdict": { "enum": ["accepted", "blocked", "failed"] }, "summary": { "type": "string", "minLength": 1 }, "next_action": { "type": "string", "minLength": 1 } } },
|
|
15
|
+
"breadcrumbs": { "type": "array" },
|
|
16
|
+
"implemented_goals": { "type": "array" },
|
|
17
|
+
"acceptance_scenarios": { "type": "array" },
|
|
18
|
+
"changed_files": { "type": "array" },
|
|
19
|
+
"checks": { "type": "array" },
|
|
20
|
+
"review": { "type": "object" },
|
|
21
|
+
"review_gates": { "type": "array" },
|
|
22
|
+
"defs": { "type": "array" }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/plan-aspect-map@3",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["$schema", "schema_id", "protocol_id", "plan_id", "plan_revision", "catalog_ref", "routing", "review_groups", "aspects"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {"type": "string", "minLength": 1},
|
|
9
|
+
"schema_id": {"const": "dd-flow/plan-aspect-map@3"},
|
|
10
|
+
"protocol_id": {"type": "string", "pattern": "^PRT-"},
|
|
11
|
+
"plan_id": {"type": "string", "minLength": 1},
|
|
12
|
+
"plan_revision": {"type": "integer", "minimum": 1},
|
|
13
|
+
"catalog_ref": {"type": "object", "additionalProperties": false, "required": ["path"], "properties": {"path": {"type": "string", "minLength": 1}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}}},
|
|
14
|
+
"routing": {"type": "object", "additionalProperties": false, "required": ["initial_state", "selected_route", "reason", "groups"], "properties": {"initial_state": {"const": "orchestrator_local"}, "selected_route": {"enum": ["local_compact", "single_wave_grouped", "multi_wave_grouped", "external_handoff"]}, "reason": {"type": "string", "minLength": 1}, "groups": {"type": "array", "items": {"$ref": "#/$defs/group"}}}},
|
|
15
|
+
"review_groups": {"type": "array", "description": "Every applicable aspect exactly once. Prefer one semantically safe wave within measured capacity.", "items": {"$ref": "#/$defs/group"}},
|
|
16
|
+
"review_tail_reason": {"type": "string", "minLength": 1},
|
|
17
|
+
"aspects": {"type": "array", "minItems": 1, "items": {"type": "object", "additionalProperties": false, "required": ["aspect_id", "applicability", "reason", "planned_artifact_refs"], "properties": {"aspect_id": {"type": "string", "minLength": 1}, "applicability": {"enum": ["applicable", "not_applicable"]}, "reason": {"type": "string", "minLength": 1}, "planned_artifact_refs": {"type": "array", "items": {"type": "string", "minLength": 1}}}}}
|
|
18
|
+
},
|
|
19
|
+
"$defs": {
|
|
20
|
+
"group": {"type": "object", "additionalProperties": false, "required": ["id", "aspect_ids"], "properties": {"id": {"type": "string", "minLength": 1}, "aspect_ids": {"type": "array", "minItems": 1, "maxItems": 3, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/plan-review-decision@3",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "outcome", "summary", "finding_decisions", "correction"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/plan-review-decision@3"},
|
|
9
|
+
"outcome": {"enum": ["accepted", "blocked", "failed", "cancelled"]},
|
|
10
|
+
"summary": {"type": "string", "minLength": 1},
|
|
11
|
+
"finding_decisions": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["finding_ref", "decision", "reason"], "properties": {"finding_ref": {"type": "string", "pattern": "^WRK-[^/]+/FIND-[0-9]{3}$"}, "decision": {"enum": ["accepted_fix", "rejected", "deferred_as_DEF", "requires_user", "duplicate"]}, "reason": {"type": "string", "minLength": 1}}}},
|
|
12
|
+
"correction": {"type": "object", "additionalProperties": false, "required": ["status", "previous_plan_revision", "changed_paths", "summary"], "properties": {"status": {"enum": ["applied", "not_required"]}, "previous_plan_revision": {"type": "integer", "minimum": 1}, "changed_paths": {"type": "array", "items": {"type": "string", "minLength": 1}}, "summary": {"type": "string", "minLength": 1}}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/plan-review-result@1",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema_id", "plan_revision", "overall_verdict", "summary", "aspects"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_id": {"const": "dd-flow/plan-review-result@1"},
|
|
9
|
+
"plan_revision": {"type": "integer", "minimum": 1},
|
|
10
|
+
"overall_verdict": {"enum": ["pass", "watch", "needs_changes", "blocked"]},
|
|
11
|
+
"summary": {"type": "string", "minLength": 1},
|
|
12
|
+
"aspects": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["aspect_id", "verdict", "summary", "evidence_refs", "findings"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"aspect_id": {"type": "string", "minLength": 1},
|
|
21
|
+
"verdict": {"enum": ["pass", "watch", "needs_changes", "blocked"]},
|
|
22
|
+
"summary": {"type": "string", "minLength": 1},
|
|
23
|
+
"evidence_refs": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
24
|
+
"findings": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"required": ["finding_id", "severity", "summary", "evidence_refs"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"finding_id": {"type": "string", "pattern": "^FIND-[0-9]{3}$"},
|
|
32
|
+
"severity": {"enum": ["blocker", "high", "medium", "low", "info"]},
|
|
33
|
+
"summary": {"type": "string", "minLength": 1},
|
|
34
|
+
"evidence_refs": {"type": "array", "items": {"type": "string", "minLength": 1}}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|