@devtrack-solution/codesdd 1.2.3 → 1.2.4
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/.sdd/skills/curated/devtrack-api/SKILL.md +98 -12
- package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +5 -3
- package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +12 -0
- package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +61 -5
- package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
- package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1951 -0
- package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +16 -14
- package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
- package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +19 -2
- package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
- package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +42 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
- package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -7
- package/README.md +280 -29
- package/dist/applications/sdd/index.d.ts +16 -0
- package/dist/applications/sdd/index.js +16 -0
- package/dist/cli/program.js +180 -11
- package/dist/commands/config.js +197 -10
- package/dist/commands/sdd/execution.js +408 -16
- package/dist/commands/sdd/plugin.js +5 -0
- package/dist/commands/sdd/shared.d.ts +1 -0
- package/dist/commands/sdd/shared.js +10 -0
- package/dist/commands/sdd.js +157 -7
- package/dist/core/cli/command-matrix.d.ts +18 -0
- package/dist/core/cli/command-matrix.js +157 -0
- package/dist/core/cli-command-quality.js +11 -0
- package/dist/core/completions/command-registry.js +45 -0
- package/dist/core/config-schema.d.ts +31 -1
- package/dist/core/config-schema.js +79 -5
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.js +11 -0
- package/dist/core/global-config.d.ts +29 -0
- package/dist/core/init.d.ts +2 -2
- package/dist/core/init.js +13 -14
- package/dist/core/sdd/agent-binding.d.ts +19 -19
- package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
- package/dist/core/sdd/agent-runtime-contract.js +200 -0
- package/dist/core/sdd/allocator-recovery.d.ts +14 -0
- package/dist/core/sdd/allocator-recovery.js +30 -0
- package/dist/core/sdd/allocator-security.d.ts +18 -0
- package/dist/core/sdd/allocator-security.js +36 -0
- package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
- package/dist/core/sdd/api-foundation-baseline.js +151 -0
- package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
- package/dist/core/sdd/api-foundation-parity.js +131 -0
- package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
- package/dist/core/sdd/api-profile-catalog.js +132 -0
- package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
- package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
- package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
- package/dist/core/sdd/api-profile-recipes.js +484 -0
- package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
- package/dist/core/sdd/artifact-id-allocator.js +510 -0
- package/dist/core/sdd/check.d.ts +52 -1
- package/dist/core/sdd/check.js +326 -11
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
- package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
- package/dist/core/sdd/coordination/index.d.ts +1 -0
- package/dist/core/sdd/coordination/index.js +1 -0
- package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
- package/dist/core/sdd/coordination/redis-runtime.js +698 -0
- package/dist/core/sdd/deepagent-contracts.d.ts +99 -5
- package/dist/core/sdd/deepagent-contracts.js +62 -0
- package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
- package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
- package/dist/core/sdd/default-bootstrap-files.js +14 -10
- package/dist/core/sdd/default-skills.js +115 -9
- package/dist/core/sdd/devtrack-api-appliance.d.ts +42 -1
- package/dist/core/sdd/devtrack-api-appliance.js +159 -32
- package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
- package/dist/core/sdd/devtrack-api-architecture.js +86 -0
- package/dist/core/sdd/docs-sync.js +24 -18
- package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
- package/dist/core/sdd/domain/capability-diff.js +200 -0
- package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
- package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
- package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
- package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
- package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
- package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
- package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
- package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
- package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
- package/dist/core/sdd/foundation-layer-manifest.js +117 -0
- package/dist/core/sdd/governance-schemas.d.ts +2 -2
- package/dist/core/sdd/governance-schemas.js +11 -2
- package/dist/core/sdd/intent-guard.d.ts +22 -0
- package/dist/core/sdd/intent-guard.js +67 -0
- package/dist/core/sdd/json-schema.js +13 -1
- package/dist/core/sdd/legacy-operations.js +169 -5
- package/dist/core/sdd/migrate-workspace.js +39 -0
- package/dist/core/sdd/package-security-gates.d.ts +21 -0
- package/dist/core/sdd/package-security-gates.js +121 -0
- package/dist/core/sdd/package-structure-gate.d.ts +85 -3
- package/dist/core/sdd/package-structure-gate.js +384 -11
- package/dist/core/sdd/parallel-feat-automation.d.ts +185 -7
- package/dist/core/sdd/parallel-feat-automation.js +212 -0
- package/dist/core/sdd/plugin-broker.d.ts +223 -4
- package/dist/core/sdd/plugin-broker.js +10 -0
- package/dist/core/sdd/plugin-cli.d.ts +30 -0
- package/dist/core/sdd/plugin-cli.js +70 -3
- package/dist/core/sdd/plugin-evidence.d.ts +73 -0
- package/dist/core/sdd/plugin-manifest.d.ts +69 -1
- package/dist/core/sdd/plugin-manifest.js +10 -0
- package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
- package/dist/core/sdd/plugin-policy.js +6 -1
- package/dist/core/sdd/plugin-registry.d.ts +138 -2
- package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
- package/dist/core/sdd/plugin-sdk-contract.js +268 -0
- package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
- package/dist/core/sdd/quality-validation.d.ts +89 -16
- package/dist/core/sdd/release-readiness.d.ts +68 -0
- package/dist/core/sdd/release-readiness.js +767 -0
- package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
- package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
- package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
- package/dist/core/sdd/reversa-artifact-writer.js +40 -0
- package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
- package/dist/core/sdd/reversa-command-policy.js +361 -0
- package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
- package/dist/core/sdd/reversa-data-extractor.js +73 -0
- package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
- package/dist/core/sdd/reversa-equivalence.js +34 -0
- package/dist/core/sdd/reversa-evidence.d.ts +298 -0
- package/dist/core/sdd/reversa-evidence.js +118 -0
- package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
- package/dist/core/sdd/reversa-reconstruction.js +32 -0
- package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
- package/dist/core/sdd/reversa-rules-extractor.js +86 -0
- package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
- package/dist/core/sdd/reversa-source-safety.js +105 -0
- package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
- package/dist/core/sdd/reversa-surface-scout.js +85 -0
- package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
- package/dist/core/sdd/reversa-ux-mapper.js +73 -0
- package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
- package/dist/core/sdd/runtime-boundary-contract.js +90 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
- package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
- package/dist/core/sdd/services/agent-run.service.js +73 -1
- package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
- package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
- package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
- package/dist/core/sdd/services/capability-diff.service.js +26 -0
- package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
- package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
- package/dist/core/sdd/services/context.service.d.ts +43 -340
- package/dist/core/sdd/services/context.service.js +323 -9
- package/dist/core/sdd/services/decide.service.js +1 -1
- package/dist/core/sdd/services/finalize.service.d.ts +27 -0
- package/dist/core/sdd/services/finalize.service.js +226 -18
- package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
- package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
- package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
- package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
- package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
- package/dist/core/sdd/state.d.ts +1 -0
- package/dist/core/sdd/state.js +266 -34
- package/dist/core/sdd/store/sdd-stores.js +2 -2
- package/dist/core/sdd/structural-health.d.ts +13 -13
- package/dist/core/sdd/types.d.ts +30 -15
- package/dist/core/sdd/types.js +4 -0
- package/dist/core/sdd/views.js +17 -0
- package/dist/core/sdd/workspace-schemas.d.ts +428 -7
- package/dist/core/sdd/workspace-schemas.js +223 -70
- package/dist/core/shared/skill-generation.d.ts +2 -0
- package/dist/core/shared/skill-generation.js +19 -2
- package/dist/core/shared/tool-detection.d.ts +19 -0
- package/dist/core/shared/tool-detection.js +89 -0
- package/dist/domains/sdd/index.d.ts +6 -0
- package/dist/domains/sdd/index.js +6 -0
- package/dist/infrastructures/sdd/index.d.ts +7 -0
- package/dist/infrastructures/sdd/index.js +6 -0
- package/dist/presentations/cli/sdd/index.d.ts +3 -0
- package/dist/presentations/cli/sdd/index.js +3 -0
- package/dist/shared/sdd/index.d.ts +3 -0
- package/dist/shared/sdd/index.js +2 -0
- package/package.json +14 -10
- package/schemas/sdd/2-plan.schema.json +207 -2
- package/schemas/sdd/5-quality.schema.json +324 -25
- package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
- package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
- package/schemas/sdd/codesdd-plugin.schema.json +171 -0
- package/schemas/sdd/deepagent-run-request.schema.json +316 -0
- package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
- package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
- package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
- package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
- package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
- package/schemas/sdd/plugin-package-governance.schema.json +74 -0
- package/schemas/sdd/plugin-registry.schema.json +171 -0
- package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
- package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
- package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
- package/schemas/sdd/workspace-catalog.schema.json +5298 -1409
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export const CODESDD_FOUNDATION_LAYER_IDS = [
|
|
2
|
+
'domains',
|
|
3
|
+
'applications',
|
|
4
|
+
'infrastructures',
|
|
5
|
+
'presentations',
|
|
6
|
+
'shared',
|
|
7
|
+
];
|
|
8
|
+
export const CODESDD_FOUNDATION_LAYER_MANIFEST = [
|
|
9
|
+
{
|
|
10
|
+
layer: 'domains',
|
|
11
|
+
root: 'src/domains',
|
|
12
|
+
entrypoint: 'src/domains/sdd/index.ts',
|
|
13
|
+
legacy_roots: ['src/core/sdd/domain'],
|
|
14
|
+
role: 'Pure CodeSDD lifecycle, traceability, title, transition, and guardrail domain rules.',
|
|
15
|
+
migration_status: 'active-facade',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
layer: 'applications',
|
|
19
|
+
root: 'src/applications',
|
|
20
|
+
entrypoint: 'src/applications/sdd/index.ts',
|
|
21
|
+
legacy_roots: ['src/core/sdd/services'],
|
|
22
|
+
role: 'Use-case and orchestration services for CodeSDD lifecycle and command workflows.',
|
|
23
|
+
migration_status: 'active-facade',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
layer: 'infrastructures',
|
|
27
|
+
root: 'src/infrastructures',
|
|
28
|
+
entrypoint: 'src/infrastructures/sdd/index.ts',
|
|
29
|
+
legacy_roots: ['src/core/sdd/store', 'src/core/sdd/coordination'],
|
|
30
|
+
role: 'Filesystem, YAML state, Redis, cache, lock, queue, and event adapters.',
|
|
31
|
+
migration_status: 'active-facade',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
layer: 'presentations',
|
|
35
|
+
root: 'src/presentations',
|
|
36
|
+
entrypoint: 'src/presentations/cli/sdd/index.ts',
|
|
37
|
+
legacy_roots: ['src/commands', 'src/cli'],
|
|
38
|
+
role: 'CLI and operator-facing command surfaces.',
|
|
39
|
+
migration_status: 'active-facade',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
layer: 'shared',
|
|
43
|
+
root: 'src/shared',
|
|
44
|
+
entrypoint: 'src/shared/sdd/index.ts',
|
|
45
|
+
legacy_roots: ['src/core/sdd/types.ts', 'src/core/sdd/workspace-schemas.ts', 'src/core/shared'],
|
|
46
|
+
role: 'Shared contracts, schema documents, and reusable utility boundaries.',
|
|
47
|
+
migration_status: 'active-facade',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
export function listCodesddFoundationLayerRoots(manifest = CODESDD_FOUNDATION_LAYER_MANIFEST) {
|
|
51
|
+
return manifest.map((entry) => entry.root);
|
|
52
|
+
}
|
|
53
|
+
export function validateCodesddFoundationLayerManifest(manifest = CODESDD_FOUNDATION_LAYER_MANIFEST) {
|
|
54
|
+
const findings = [];
|
|
55
|
+
const seenLayers = new Set();
|
|
56
|
+
const seenRoots = new Set();
|
|
57
|
+
for (const layer of CODESDD_FOUNDATION_LAYER_IDS) {
|
|
58
|
+
if (!manifest.some((entry) => entry.layer === layer)) {
|
|
59
|
+
findings.push({
|
|
60
|
+
code: 'FOUNDATION_LAYER_MISSING',
|
|
61
|
+
layer,
|
|
62
|
+
message: `Foundation-like layer ${layer} must be declared.`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const entry of manifest) {
|
|
67
|
+
if (seenLayers.has(entry.layer)) {
|
|
68
|
+
findings.push({
|
|
69
|
+
code: 'FOUNDATION_LAYER_DUPLICATE',
|
|
70
|
+
layer: entry.layer,
|
|
71
|
+
message: `Foundation-like layer ${entry.layer} is declared more than once.`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
seenLayers.add(entry.layer);
|
|
75
|
+
if (seenRoots.has(entry.root)) {
|
|
76
|
+
findings.push({
|
|
77
|
+
code: 'FOUNDATION_LAYER_DUPLICATE',
|
|
78
|
+
layer: entry.layer,
|
|
79
|
+
path: entry.root,
|
|
80
|
+
message: `Foundation-like root ${entry.root} is declared more than once.`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
seenRoots.add(entry.root);
|
|
84
|
+
const expectedRoot = `src/${entry.layer}`;
|
|
85
|
+
if (entry.root !== expectedRoot) {
|
|
86
|
+
findings.push({
|
|
87
|
+
code: 'FOUNDATION_LAYER_ROOT_MISMATCH',
|
|
88
|
+
layer: entry.layer,
|
|
89
|
+
path: entry.root,
|
|
90
|
+
message: `Layer ${entry.layer} must use plural root ${expectedRoot}.`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (!entry.entrypoint.startsWith(`${entry.root}/`)) {
|
|
94
|
+
findings.push({
|
|
95
|
+
code: 'FOUNDATION_LAYER_ENTRYPOINT_MISMATCH',
|
|
96
|
+
layer: entry.layer,
|
|
97
|
+
path: entry.entrypoint,
|
|
98
|
+
message: `Layer ${entry.layer} entrypoint must live under ${entry.root}.`,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
for (const legacyRoot of entry.legacy_roots) {
|
|
102
|
+
if (legacyRoot.includes('/.codesdd') || legacyRoot.startsWith('.codesdd')) {
|
|
103
|
+
findings.push({
|
|
104
|
+
code: 'FOUNDATION_LAYER_FORBIDDEN_PROJECT_RUNTIME',
|
|
105
|
+
layer: entry.layer,
|
|
106
|
+
path: legacyRoot,
|
|
107
|
+
message: 'Foundation-like layer mappings must not use project-local .codesdd runtime paths.',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
valid: findings.length === 0,
|
|
114
|
+
findings,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=foundation-layer-manifest.js.map
|
|
@@ -91,10 +91,10 @@ export declare const debateFrontmatterSchema: z.ZodObject<{
|
|
|
91
91
|
mediator: z.ZodObject<{
|
|
92
92
|
choice: z.ZodString;
|
|
93
93
|
rationale: z.ZodString;
|
|
94
|
-
accepted_risks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
94
|
+
accepted_risks: z.ZodDefault<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
|
|
95
95
|
risk: z.ZodString;
|
|
96
96
|
mitigation: z.ZodString;
|
|
97
|
-
}, z.core.$strict
|
|
97
|
+
}, z.core.$strict>>>>;
|
|
98
98
|
reversal_conditions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
99
99
|
}, z.core.$strict>;
|
|
100
100
|
output: z.ZodEnum<{
|
|
@@ -59,12 +59,21 @@ const debateScoringSchema = z
|
|
|
59
59
|
scores: z.record(z.string().regex(/^[A-Z]$/), z.number()),
|
|
60
60
|
})
|
|
61
61
|
.strict();
|
|
62
|
-
const
|
|
62
|
+
const DEFAULT_ACCEPTED_RISK_MITIGATION = 'Mitigation not provided by the source artifact; preserve this risk and require explicit mitigation before finalize.';
|
|
63
|
+
const debateAcceptedRiskSchema = z.preprocess((value) => {
|
|
64
|
+
if (typeof value !== 'string')
|
|
65
|
+
return value;
|
|
66
|
+
const risk = value.trim();
|
|
67
|
+
return {
|
|
68
|
+
risk,
|
|
69
|
+
mitigation: DEFAULT_ACCEPTED_RISK_MITIGATION,
|
|
70
|
+
};
|
|
71
|
+
}, z
|
|
63
72
|
.object({
|
|
64
73
|
risk: z.string().min(1),
|
|
65
74
|
mitigation: z.string().min(1),
|
|
66
75
|
})
|
|
67
|
-
.strict();
|
|
76
|
+
.strict());
|
|
68
77
|
const debateDecisionSchema = z
|
|
69
78
|
.object({
|
|
70
79
|
question: z.string().min(1),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const sddIntentGuardInputSchema: z.ZodObject<{
|
|
3
|
+
request: z.ZodString;
|
|
4
|
+
featureRef: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const sddIntentGuardResultSchema: z.ZodObject<{
|
|
7
|
+
request: z.ZodString;
|
|
8
|
+
classification: z.ZodEnum<{
|
|
9
|
+
change_request: "change_request";
|
|
10
|
+
read_only: "read_only";
|
|
11
|
+
outside_codesdd: "outside_codesdd";
|
|
12
|
+
}>;
|
|
13
|
+
requires_codesdd_planning: z.ZodBoolean;
|
|
14
|
+
feature_ref: z.ZodOptional<z.ZodString>;
|
|
15
|
+
reason: z.ZodString;
|
|
16
|
+
required_commands: z.ZodArray<z.ZodString>;
|
|
17
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type SddIntentGuardInput = z.input<typeof sddIntentGuardInputSchema>;
|
|
20
|
+
export type SddIntentGuardResult = z.infer<typeof sddIntentGuardResultSchema>;
|
|
21
|
+
export declare function evaluateSddIntentGuard(input: SddIntentGuardInput): SddIntentGuardResult;
|
|
22
|
+
//# sourceMappingURL=intent-guard.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CLI_NAME } from '../branding.js';
|
|
3
|
+
const FEATURE_REF_PATTERN = /^FEAT-\d{4}$/;
|
|
4
|
+
const changeIntentPattern = /\b(add|alter|apply|build|change|code|commit|create|delete|edit|execute|fix|generate|implement|install|move|refactor|remove|rename|resolve|run|scaffold|update|write|ajust|altere|aplique|corrija|crie|edite|execute|faca|faça|gere|implemente|mova|remova|renomeie|resolva|rode|atualize)\b/i;
|
|
5
|
+
const readOnlyPattern = /\b(read-only|readonly|no edit|no edits|sem editar|somente leitura|apenas leia|apenas leitura|explique|explique-me|analise|review|status|estado atual|listar|list|show|mostrar)\b/i;
|
|
6
|
+
const outsideSddPattern = /\b(skip codesdd|sem codesdd|fora do codesdd|outside codesdd|do not use codesdd|nao use codesdd|não use codesdd)\b/i;
|
|
7
|
+
export const sddIntentGuardInputSchema = z.object({
|
|
8
|
+
request: z.string().min(1),
|
|
9
|
+
featureRef: z.string().regex(FEATURE_REF_PATTERN).optional(),
|
|
10
|
+
});
|
|
11
|
+
export const sddIntentGuardResultSchema = z.object({
|
|
12
|
+
request: z.string(),
|
|
13
|
+
classification: z.enum(['change_request', 'read_only', 'outside_codesdd']),
|
|
14
|
+
requires_codesdd_planning: z.boolean(),
|
|
15
|
+
feature_ref: z.string().regex(FEATURE_REF_PATTERN).optional(),
|
|
16
|
+
reason: z.string(),
|
|
17
|
+
required_commands: z.array(z.string()),
|
|
18
|
+
warnings: z.array(z.string()),
|
|
19
|
+
});
|
|
20
|
+
export function evaluateSddIntentGuard(input) {
|
|
21
|
+
const parsed = sddIntentGuardInputSchema.parse(input);
|
|
22
|
+
const request = parsed.request.trim();
|
|
23
|
+
const explicitlyOutside = outsideSddPattern.test(request);
|
|
24
|
+
const readOnly = readOnlyPattern.test(request) && !changeIntentPattern.test(request);
|
|
25
|
+
const changeRequest = changeIntentPattern.test(request) && !explicitlyOutside;
|
|
26
|
+
if (explicitlyOutside) {
|
|
27
|
+
return sddIntentGuardResultSchema.parse({
|
|
28
|
+
request,
|
|
29
|
+
classification: 'outside_codesdd',
|
|
30
|
+
requires_codesdd_planning: false,
|
|
31
|
+
feature_ref: parsed.featureRef,
|
|
32
|
+
reason: 'The request explicitly opts out of CodeSDD handling.',
|
|
33
|
+
required_commands: [],
|
|
34
|
+
warnings: ['Only honor this opt-out when it does not conflict with repository governance policy.'],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (!changeRequest || readOnly) {
|
|
38
|
+
return sddIntentGuardResultSchema.parse({
|
|
39
|
+
request,
|
|
40
|
+
classification: 'read_only',
|
|
41
|
+
requires_codesdd_planning: false,
|
|
42
|
+
feature_ref: parsed.featureRef,
|
|
43
|
+
reason: 'The request is read-only and does not imply implementation, edits, validation, execution, or finalize.',
|
|
44
|
+
required_commands: [],
|
|
45
|
+
warnings: [],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const featureCommand = parsed.featureRef
|
|
49
|
+
? `${CLI_NAME} sdd context ${parsed.featureRef}`
|
|
50
|
+
: `${CLI_NAME} sdd context <FEAT-ID>`;
|
|
51
|
+
return sddIntentGuardResultSchema.parse({
|
|
52
|
+
request,
|
|
53
|
+
classification: 'change_request',
|
|
54
|
+
requires_codesdd_planning: true,
|
|
55
|
+
feature_ref: parsed.featureRef,
|
|
56
|
+
reason: 'The request implies implementation, edits, validation, execution, or finalize in an initialized CodeSDD repository.',
|
|
57
|
+
required_commands: [
|
|
58
|
+
`${CLI_NAME} sdd onboard system`,
|
|
59
|
+
`${CLI_NAME} sdd next`,
|
|
60
|
+
featureCommand,
|
|
61
|
+
],
|
|
62
|
+
warnings: parsed.featureRef
|
|
63
|
+
? []
|
|
64
|
+
: ['Bind this request to the active or ready FEAT returned by CodeSDD before coding.'],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=intent-guard.js.map
|
|
@@ -6,11 +6,15 @@ import { pluginArtifactManifestSchema, pluginDryRunExecutionPlanSchema, pluginRo
|
|
|
6
6
|
import { pluginPolicyEvaluationSchema } from './plugin-policy.js';
|
|
7
7
|
import { pluginPolicyPackEvaluationSchema, pluginPolicyPackSchema } from './plugin-policy-pack.js';
|
|
8
8
|
import { pluginComplianceIndexSchema, pluginEvidenceManifestSchema, pluginValidationManifestSchema, } from './plugin-evidence.js';
|
|
9
|
+
import { buildPluginSdkJsonSchemas } from './plugin-sdk-contract.js';
|
|
9
10
|
import { pluginSkillBindingResolutionSchema, pluginSkillBindingSchema, } from './plugin-skill-binding.js';
|
|
10
11
|
import { agentBindingAdapterSchema, agentBindingResolutionSchema, } from './agent-binding.js';
|
|
11
|
-
import {
|
|
12
|
+
import { buildAgentRuntimeJsonSchemas } from './agent-runtime-contract.js';
|
|
13
|
+
import { parallelFeatAutomationPlanSchema, parallelFeatAutomationRequestSchema, parallelFeatSchedulerRequestSchema, parallelFeatSchedulerResultSchema, } from './parallel-feat-automation.js';
|
|
12
14
|
import { backlogProjectionPlanSchema, backlogProviderContractSchema, } from './backlog-provider-contract.js';
|
|
13
15
|
import { qualityArchitectureSchema, qualityEvidenceBundleSchema, qualityRunSchema, qualityScenarioSchema, } from './quality-validation.js';
|
|
16
|
+
import { reversaEvidenceBundleSchema } from './reversa-evidence.js';
|
|
17
|
+
import { buildSdkAgentPluginQualityGateJsonSchemas } from './sdk-agent-plugin-quality-gates.js';
|
|
14
18
|
import { deepagentDecisionEvidenceSchema, deepagentEnvContractSchema, deepagentQualityEvidenceSchema, deepagentRunEvidenceSchema, deepagentRunPlanSchema, deepagentRunRequestSchema, deepagentSubagentEvidenceSchema, deepagentToolCallEvidenceSchema, } from './deepagent-contracts.js';
|
|
15
19
|
import { adrFrontmatterSchema, debateFrontmatterSchema, discardedFrontmatterSchema, epicFrontmatterSchema, insightFrontmatterSchema, } from './governance-schemas.js';
|
|
16
20
|
const JSON_SCHEMA_DRAFT = 'https://json-schema.org/draft/2020-12/schema';
|
|
@@ -70,6 +74,7 @@ export function buildWorkspaceJsonSchemaCatalog() {
|
|
|
70
74
|
plugin_manifests: {
|
|
71
75
|
'codesdd-plugin.yaml': buildPluginManifestJsonSchema(),
|
|
72
76
|
},
|
|
77
|
+
plugin_sdk_contracts: buildPluginSdkJsonSchemas(),
|
|
73
78
|
plugin_registries: {
|
|
74
79
|
'plugin-registry.yaml': normalizeJsonSchemaDocument(toJSONSchema(pluginRegistryStateSchema), 'CodeSDD Plugin Registry State', 'Machine-readable state contract for registered CodeSDD enterprise plugins.'),
|
|
75
80
|
},
|
|
@@ -115,9 +120,12 @@ export function buildWorkspaceJsonSchemaCatalog() {
|
|
|
115
120
|
agent_binding_resolutions: {
|
|
116
121
|
'agent-binding-resolution.yaml': normalizeJsonSchemaDocument(toJSONSchema(agentBindingResolutionSchema), 'CodeSDD Agent Binding Resolution', 'Machine-readable resolution result for selecting a compatible coding-agent adapter for a FEAT task.'),
|
|
117
122
|
},
|
|
123
|
+
agent_runtime_contracts: buildAgentRuntimeJsonSchemas(),
|
|
118
124
|
parallel_feat_automation: {
|
|
119
125
|
'parallel-feat-automation-request.yaml': normalizeJsonSchemaDocument(toJSONSchema(parallelFeatAutomationRequestSchema), 'CodeSDD Parallel FEAT Automation Request', 'Machine-readable input contract for planning safe parallel FEAT execution waves.'),
|
|
120
126
|
'parallel-feat-automation-plan.yaml': normalizeJsonSchemaDocument(toJSONSchema(parallelFeatAutomationPlanSchema), 'CodeSDD Parallel FEAT Automation Plan', 'Machine-readable execution plan for safe parallel FEAT waves, quality gates, and commit boundaries.'),
|
|
127
|
+
'parallel-feat-scheduler-request.yaml': normalizeJsonSchemaDocument(toJSONSchema(parallelFeatSchedulerRequestSchema), 'CodeSDD Parallel FEAT Scheduler Request', 'Machine-readable input contract for dependency-aware chained FEAT wave scheduling.'),
|
|
128
|
+
'parallel-feat-scheduler-result.yaml': normalizeJsonSchemaDocument(toJSONSchema(parallelFeatSchedulerResultSchema), 'CodeSDD Parallel FEAT Scheduler Result', 'Machine-readable scheduler result linking chained FEAT waves, blocked dependencies, and the execution plan.'),
|
|
121
129
|
},
|
|
122
130
|
backlog_integrations: {
|
|
123
131
|
'backlog-provider-contract.yaml': normalizeJsonSchemaDocument(toJSONSchema(backlogProviderContractSchema), 'CodeSDD Backlog Provider Contract', 'Machine-readable provider contract for projecting canonical CodeSDD backlog state to external planning tools.'),
|
|
@@ -128,6 +136,10 @@ export function buildWorkspaceJsonSchemaCatalog() {
|
|
|
128
136
|
'quality-run.yaml': normalizeJsonSchemaDocument(toJSONSchema(qualityRunSchema), 'CodeSDD Quality Run', 'Machine-readable execution record for a CodeSDD quality validation scenario.'),
|
|
129
137
|
'quality-architecture-schema.yaml': normalizeJsonSchemaDocument(toJSONSchema(qualityArchitectureSchema), 'CodeSDD Quality Architecture Schema', 'Machine-readable architecture gateway contract for generated product validation.'),
|
|
130
138
|
'quality-evidence-bundle.yaml': normalizeJsonSchemaDocument(toJSONSchema(qualityEvidenceBundleSchema), 'CodeSDD Quality Evidence Bundle', 'Machine-readable evidence bundle contract tying scenario, run, artifacts, checksums, findings, and exceptions together.'),
|
|
139
|
+
...buildSdkAgentPluginQualityGateJsonSchemas(),
|
|
140
|
+
},
|
|
141
|
+
reversa_contracts: {
|
|
142
|
+
'reversa-evidence-bundle.yaml': normalizeJsonSchemaDocument(toJSONSchema(reversaEvidenceBundleSchema), 'CodeSDD Reversa Evidence Bundle', 'Machine-readable evidence bundle contract for Reversa intake, extraction, generation, migration, reconstruction, and equivalence phases.'),
|
|
131
143
|
},
|
|
132
144
|
deepagent_execution: {
|
|
133
145
|
'deepagent-run-request.yaml': normalizeJsonSchemaDocument(toJSONSchema(deepagentRunRequestSchema), 'CodeSDD DeepAgent Run Request', 'Machine-readable request contract for governed DeepAgents execution with scoped tools, write policy, env contract, and expected evidence.'),
|
|
@@ -136,16 +136,19 @@ Decide ____ instead of ____ to solve ____.
|
|
|
136
136
|
|
|
137
137
|
## 3) Options Considered (Minimum 2)
|
|
138
138
|
### Option A
|
|
139
|
+
- Status (selected/discarded):
|
|
139
140
|
- Proposal:
|
|
140
141
|
- Pros:
|
|
141
142
|
- Cons:
|
|
142
143
|
|
|
143
144
|
### Option B
|
|
145
|
+
- Status (selected/discarded):
|
|
144
146
|
- Proposal:
|
|
145
147
|
- Pros:
|
|
146
148
|
- Cons:
|
|
147
149
|
|
|
148
150
|
### Option C (Optional)
|
|
151
|
+
- Status (selected/discarded):
|
|
149
152
|
- Proposal:
|
|
150
153
|
- Pros:
|
|
151
154
|
- Cons:
|
|
@@ -194,7 +197,15 @@ Decide ____ instead of ____ to solve ____.
|
|
|
194
197
|
- APPROVED -> EPIC-####
|
|
195
198
|
- DISCARDED -> Record in discarded
|
|
196
199
|
|
|
197
|
-
##
|
|
200
|
+
## 10) Planning Completeness Gate (Required before promotion)
|
|
201
|
+
- Measurable acceptance:
|
|
202
|
+
- Non-scope:
|
|
203
|
+
- Definition of Done:
|
|
204
|
+
- Validation commands:
|
|
205
|
+
-
|
|
206
|
+
- Residual risk:
|
|
207
|
+
|
|
208
|
+
## 11) Metadata
|
|
198
209
|
- Source insight: ${insight.id}
|
|
199
210
|
- Insight title: ${insight.title}
|
|
200
211
|
- Created at: ${insight.created_at || now}
|
|
@@ -745,19 +756,92 @@ export async function findDebateFile(paths, debateId) {
|
|
|
745
756
|
return null;
|
|
746
757
|
return path.join(debateDir, found.name);
|
|
747
758
|
}
|
|
759
|
+
const GENERIC_DECISION_QUESTION_PATTERNS = [
|
|
760
|
+
/^decide\s+____\s+instead\s+of\s+____\s+to\s+solve\s+____\.?$/i,
|
|
761
|
+
/^decidir\s+____\s+em\s+vez\s+de\s+____\s+para\s+resolver\s+____\.?$/i,
|
|
762
|
+
/which option should we choose\??$/i,
|
|
763
|
+
/qual opcao devemos escolher\??$/i,
|
|
764
|
+
/decide between option [a-z] and option [a-z]\.?$/i,
|
|
765
|
+
/decidir entre opcao [a-z] e opcao [a-z]\.?$/i,
|
|
766
|
+
];
|
|
767
|
+
function isPlaceholderLike(value) {
|
|
768
|
+
const normalized = value.trim().toLowerCase();
|
|
769
|
+
if (!normalized)
|
|
770
|
+
return true;
|
|
771
|
+
const placeholderTokens = ['____', '(fill in', '(preencher', 'todo', 'tbd', 'n/a'];
|
|
772
|
+
return placeholderTokens.some((token) => normalized.includes(token));
|
|
773
|
+
}
|
|
774
|
+
function isGenericDecisionQuestion(question) {
|
|
775
|
+
const normalized = question.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
776
|
+
if (normalized.length < 30)
|
|
777
|
+
return true;
|
|
778
|
+
return GENERIC_DECISION_QUESTION_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
779
|
+
}
|
|
780
|
+
function extractNamedListValue(content, labels) {
|
|
781
|
+
const escaped = labels.map((label) => label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
|
|
782
|
+
const match = content.match(new RegExp(`-\\s*(?:${escaped}):\\s*(.+)`, 'i'));
|
|
783
|
+
if (!match)
|
|
784
|
+
return '';
|
|
785
|
+
return match[1].trim();
|
|
786
|
+
}
|
|
787
|
+
function hasValidationCommand(content) {
|
|
788
|
+
const sectionMatch = content.match(/-\s*Validation commands:\s*([\s\S]*?)(?=\n-\s*Residual risk:|\n##\s+\d+\)|$)/i);
|
|
789
|
+
if (!sectionMatch)
|
|
790
|
+
return false;
|
|
791
|
+
const lines = sectionMatch[1]
|
|
792
|
+
.split(/\r?\n/)
|
|
793
|
+
.map((line) => line.trim())
|
|
794
|
+
.filter((line) => line.startsWith('-'))
|
|
795
|
+
.map((line) => line.replace(/^-\s*/, '').replace(/`/g, '').trim())
|
|
796
|
+
.filter((line) => line.length > 0);
|
|
797
|
+
if (lines.length === 0)
|
|
798
|
+
return false;
|
|
799
|
+
return lines.some((line) => line.includes('pnpm') || line.includes('npm') || line.includes('vitest'));
|
|
800
|
+
}
|
|
801
|
+
function collectPlanningGateMissing(content, selectedOption, optionIds) {
|
|
802
|
+
const missing = [];
|
|
803
|
+
const nonSelectedOptionIds = optionIds.filter((optionId) => optionId !== selectedOption);
|
|
804
|
+
if (nonSelectedOptionIds.length === 0) {
|
|
805
|
+
missing.push('Provide at least one discarded alternative option different from mediator choice');
|
|
806
|
+
}
|
|
807
|
+
const measurableAcceptance = extractNamedListValue(content, ['Measurable acceptance']);
|
|
808
|
+
if (isPlaceholderLike(measurableAcceptance) || !/\d|%|<=|>=|\bwithin\b|\bunder\b|\bmax\b/i.test(measurableAcceptance)) {
|
|
809
|
+
missing.push('Define measurable acceptance criteria in the planning completeness gate');
|
|
810
|
+
}
|
|
811
|
+
const nonScope = extractNamedListValue(content, ['Non-scope', 'Nao-escopo']);
|
|
812
|
+
if (isPlaceholderLike(nonScope)) {
|
|
813
|
+
missing.push('Document non-scope in the planning completeness gate');
|
|
814
|
+
}
|
|
815
|
+
const definitionOfDone = extractNamedListValue(content, ['Definition of Done', 'DoD']);
|
|
816
|
+
if (isPlaceholderLike(definitionOfDone)) {
|
|
817
|
+
missing.push('Document Definition of Done (DoD) in the planning completeness gate');
|
|
818
|
+
}
|
|
819
|
+
if (!hasValidationCommand(content)) {
|
|
820
|
+
missing.push('Document executable validation commands in the planning completeness gate');
|
|
821
|
+
}
|
|
822
|
+
const residualRisk = extractNamedListValue(content, ['Residual risk', 'Risco residual']);
|
|
823
|
+
if (isPlaceholderLike(residualRisk)) {
|
|
824
|
+
missing.push('Document residual risk in the planning completeness gate');
|
|
825
|
+
}
|
|
826
|
+
return missing;
|
|
827
|
+
}
|
|
748
828
|
export function validateDebateDocument(content) {
|
|
749
829
|
try {
|
|
750
830
|
const parsed = parseGovernanceFile('inline-content', content, debateFrontmatterSchema);
|
|
751
831
|
if (parsed.hasFrontmatter && parsed.frontmatter) {
|
|
752
832
|
const missing = [];
|
|
753
833
|
const question = parsed.frontmatter.decision.question.trim().toLowerCase();
|
|
754
|
-
if (
|
|
834
|
+
if (isGenericDecisionQuestion(question) || question.includes('____')) {
|
|
755
835
|
missing.push('Fill the decision question with real context');
|
|
756
836
|
}
|
|
837
|
+
if (parsed.frontmatter.decision.options.length < 2) {
|
|
838
|
+
missing.push('Provide at least two options in the decision matrix');
|
|
839
|
+
}
|
|
757
840
|
const rationale = parsed.frontmatter.decision.mediator.rationale.trim().toLowerCase();
|
|
758
841
|
if (!rationale || rationale.includes('____') || rationale.includes('(fill in') || rationale.includes('(preencher')) {
|
|
759
842
|
missing.push('Inform the mediator decision rationale');
|
|
760
843
|
}
|
|
844
|
+
missing.push(...collectPlanningGateMissing(parsed.body, parsed.frontmatter.decision.mediator.choice.trim().toUpperCase(), parsed.frontmatter.decision.options.map((option) => option.id.trim().toUpperCase())));
|
|
761
845
|
if (/\- Unit coverage:\s*$/m.test(parsed.body)) {
|
|
762
846
|
missing.push('Inform required unit coverage evidence in the quality contract');
|
|
763
847
|
}
|
|
@@ -770,7 +854,7 @@ export function validateDebateDocument(content) {
|
|
|
770
854
|
if (/\- Exceptions:\s*\n\s+- None, or formal exception/m.test(parsed.body)) {
|
|
771
855
|
missing.push('Confirm there is no quality exception or document the formal exception');
|
|
772
856
|
}
|
|
773
|
-
return missing;
|
|
857
|
+
return Array.from(new Set(missing));
|
|
774
858
|
}
|
|
775
859
|
}
|
|
776
860
|
catch (error) {
|
|
@@ -782,6 +866,11 @@ export function validateDebateDocument(content) {
|
|
|
782
866
|
content.includes('Decide ____ instead of ____ to solve ____.')) {
|
|
783
867
|
missing.push('Fill the decision question with real context');
|
|
784
868
|
}
|
|
869
|
+
const selectedChoice = content.match(/-\s+(?:Escolha|Choice)(?:\s+\(A\/B\/C\))?:\s*(?:op(?:c|ç)[aã]o\s*)?([ABC])\b/i)?.[1] ||
|
|
870
|
+
content.match(/-\s+Op(?:c|ç)[aã]o\s+escolhida:\s*([ABC])\b/i)?.[1] ||
|
|
871
|
+
'A';
|
|
872
|
+
const optionIds = Array.from(content.matchAll(/###\s+Option\s+([A-Z])/gi)).map((match) => match[1]);
|
|
873
|
+
missing.push(...collectPlanningGateMissing(content, selectedChoice.toUpperCase(), optionIds));
|
|
785
874
|
if (/\- (?:Escolha|Choice) \(A\/B\/C\):\s*$/m.test(content)) {
|
|
786
875
|
missing.push('Inform the mediator choice in "Choice (A/B/C)"');
|
|
787
876
|
}
|
|
@@ -800,7 +889,7 @@ export function validateDebateDocument(content) {
|
|
|
800
889
|
if (/\- Exceptions:\s*\n\s+- None, or formal exception/m.test(content)) {
|
|
801
890
|
missing.push('Confirm there is no quality exception or document the formal exception');
|
|
802
891
|
}
|
|
803
|
-
return missing;
|
|
892
|
+
return Array.from(new Set(missing));
|
|
804
893
|
}
|
|
805
894
|
export function pickTopSkills(catalogSkills, ids, max = 3) {
|
|
806
895
|
if (!ids || ids.length === 0)
|
|
@@ -1028,6 +1117,74 @@ export function buildActivePlanDoc(feature, recommendedBundles) {
|
|
|
1028
1117
|
const baseDocument = {
|
|
1029
1118
|
schema_version: 1,
|
|
1030
1119
|
feature_id: feature.id,
|
|
1120
|
+
governance: {
|
|
1121
|
+
state_boundary: 'codesdd-canonical-sdd-state',
|
|
1122
|
+
planning_artifacts: [
|
|
1123
|
+
'.sdd/state/backlog.yaml',
|
|
1124
|
+
`.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/1-spec.yaml`,
|
|
1125
|
+
`.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/2-plan.yaml`,
|
|
1126
|
+
`.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/5-quality.yaml`,
|
|
1127
|
+
],
|
|
1128
|
+
decision_refs: Array.from(new Set([feature.origin_ref, ...feature.acceptance_refs].filter(Boolean))),
|
|
1129
|
+
planned_state_writes: [
|
|
1130
|
+
'.sdd/state/backlog.yaml',
|
|
1131
|
+
'.sdd/state/transition-log.yaml',
|
|
1132
|
+
],
|
|
1133
|
+
rollback_plan: 'If validation fails, revert only the scoped feature workspace/state entries and regenerate CodeSDD views from canonical state.',
|
|
1134
|
+
validation_gates: [
|
|
1135
|
+
{
|
|
1136
|
+
name: 'SDD diagnose',
|
|
1137
|
+
command: `${CLI_NAME} sdd diagnose`,
|
|
1138
|
+
expected: 'Structural CodeSDD health has no blockers or errors.',
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
name: 'SDD check render',
|
|
1142
|
+
command: `${CLI_NAME} sdd check --render`,
|
|
1143
|
+
expected: 'Canonical state validates and generated views are synchronized.',
|
|
1144
|
+
},
|
|
1145
|
+
],
|
|
1146
|
+
},
|
|
1147
|
+
execution_plan: {
|
|
1148
|
+
mode: 'single-feature',
|
|
1149
|
+
state_boundary_ref: 'codesdd-canonical-sdd-state',
|
|
1150
|
+
command_sequence: [
|
|
1151
|
+
{
|
|
1152
|
+
name: 'Load CodeSDD context',
|
|
1153
|
+
command: `${CLI_NAME} sdd context ${feature.id}`,
|
|
1154
|
+
writes_state: false,
|
|
1155
|
+
expected_state_writes: [],
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
name: 'Declare frontend impact',
|
|
1159
|
+
command: `${CLI_NAME} sdd frontend-impact ${feature.id} --status required|none --reason "..."`,
|
|
1160
|
+
writes_state: true,
|
|
1161
|
+
expected_state_writes: ['.sdd/state/backlog.yaml', '.sdd/state/transition-log.yaml'],
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
name: 'Finalize feature',
|
|
1165
|
+
command: `${CLI_NAME} sdd finalize --ref ${feature.id}`,
|
|
1166
|
+
writes_state: true,
|
|
1167
|
+
expected_state_writes: [
|
|
1168
|
+
'.sdd/state/backlog.yaml',
|
|
1169
|
+
'.sdd/state/finalize-queue.yaml',
|
|
1170
|
+
'.sdd/state/transition-log.yaml',
|
|
1171
|
+
`.sdd/archived/${feature.id}/`,
|
|
1172
|
+
],
|
|
1173
|
+
},
|
|
1174
|
+
],
|
|
1175
|
+
allowed_state_writes: [
|
|
1176
|
+
`.sdd/active/${feature.id}/`,
|
|
1177
|
+
`.sdd/archived/${feature.id}/`,
|
|
1178
|
+
'.sdd/state/backlog.yaml',
|
|
1179
|
+
'.sdd/state/finalize-queue.yaml',
|
|
1180
|
+
'.sdd/state/transition-log.yaml',
|
|
1181
|
+
],
|
|
1182
|
+
forbidden_state_writes: ['.codesdd/**', 'external-context/**'],
|
|
1183
|
+
handoff_artifacts: [
|
|
1184
|
+
`.sdd/active/${feature.id}/5-quality.yaml`,
|
|
1185
|
+
`.sdd/archived/${feature.id}/`,
|
|
1186
|
+
],
|
|
1187
|
+
},
|
|
1031
1188
|
architectural_impact: {
|
|
1032
1189
|
description: `Touches ${feature.touches.join(', ') || 'the active SDD workspace'} with lock domains ${feature.lock_domains.join(', ') || 'none declared'}.`,
|
|
1033
1190
|
affected_modules: feature.touches,
|
|
@@ -1136,6 +1293,11 @@ export function buildActiveQualityDoc(feature) {
|
|
|
1136
1293
|
},
|
|
1137
1294
|
requirements: [],
|
|
1138
1295
|
},
|
|
1296
|
+
runtime_quality_gates: {
|
|
1297
|
+
mode: 'observe',
|
|
1298
|
+
performance: [],
|
|
1299
|
+
flakiness: [],
|
|
1300
|
+
},
|
|
1139
1301
|
q95_ledger: {
|
|
1140
1302
|
threshold: 95,
|
|
1141
1303
|
score: 0,
|
|
@@ -2016,7 +2178,9 @@ export function inferOriginType(input) {
|
|
|
2016
2178
|
return 'direct';
|
|
2017
2179
|
}
|
|
2018
2180
|
export async function buildFinalizeQueue(paths, backlogItems, queueItems) {
|
|
2019
|
-
const queueByFeature = new Map(queueItems
|
|
2181
|
+
const queueByFeature = new Map(queueItems
|
|
2182
|
+
.filter((item) => item.status === 'PENDING')
|
|
2183
|
+
.map((item) => [item.feature_id, item]));
|
|
2020
2184
|
const archiveRoot = resolveLegacySpecSubpath(paths.projectRoot, 'changes', 'archive');
|
|
2021
2185
|
for (const item of backlogItems) {
|
|
2022
2186
|
if (!item.change_name)
|
|
@@ -198,6 +198,35 @@ function migratePlan(featureId, parsed) {
|
|
|
198
198
|
const doc = {
|
|
199
199
|
schema_version: 1,
|
|
200
200
|
feature_id: featureId,
|
|
201
|
+
governance: {
|
|
202
|
+
state_boundary: 'codesdd-canonical-sdd-state',
|
|
203
|
+
planning_artifacts: [`.sdd/active/${featureId}/2-plan.yaml`],
|
|
204
|
+
decision_refs: [featureId],
|
|
205
|
+
planned_state_writes: [],
|
|
206
|
+
rollback_plan: 'Review the migrated workspace plan and revert only the scoped migration files if validation fails.',
|
|
207
|
+
validation_gates: [
|
|
208
|
+
{
|
|
209
|
+
name: 'Workspace schema validation',
|
|
210
|
+
command: `codesdd sdd migrate-workspace --feat ${featureId}`,
|
|
211
|
+
expected: 'Migrated plan document validates against the canonical workspace schema.',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
execution_plan: {
|
|
216
|
+
mode: 'single-feature',
|
|
217
|
+
state_boundary_ref: 'codesdd-canonical-sdd-state',
|
|
218
|
+
command_sequence: [
|
|
219
|
+
{
|
|
220
|
+
name: 'Validate migrated workspace',
|
|
221
|
+
command: `codesdd sdd migrate-workspace --feat ${featureId}`,
|
|
222
|
+
writes_state: true,
|
|
223
|
+
expected_state_writes: [`.sdd/active/${featureId}/2-plan.yaml`],
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
allowed_state_writes: [`.sdd/active/${featureId}/`],
|
|
227
|
+
forbidden_state_writes: ['.codesdd/**', 'external-context/**'],
|
|
228
|
+
handoff_artifacts: [`.sdd/active/${featureId}/5-quality.yaml`],
|
|
229
|
+
},
|
|
201
230
|
architectural_impact: {
|
|
202
231
|
description: ensureText(featureId, 'architectural_impact.description', section(parsed, ['architectural impact', 'impacto arquitetural', 'plan', 'plano']), 1, missing),
|
|
203
232
|
affected_modules: affected,
|
|
@@ -304,6 +333,16 @@ function migrateQuality(featureId, parsed) {
|
|
|
304
333
|
},
|
|
305
334
|
requirements: [],
|
|
306
335
|
},
|
|
336
|
+
token_budget_gates: {
|
|
337
|
+
require_numeric_efficiency: true,
|
|
338
|
+
fail_below_percent: 95,
|
|
339
|
+
telemetry: [],
|
|
340
|
+
},
|
|
341
|
+
runtime_quality_gates: {
|
|
342
|
+
mode: 'observe',
|
|
343
|
+
performance: [],
|
|
344
|
+
flakiness: [],
|
|
345
|
+
},
|
|
307
346
|
q95_ledger: {
|
|
308
347
|
threshold: 95,
|
|
309
348
|
score: 0,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface PackageSecurityIssue {
|
|
2
|
+
code: string;
|
|
3
|
+
path: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PackageSecurityGateReport {
|
|
7
|
+
status: 'pass' | 'fail';
|
|
8
|
+
package_allowlist: {
|
|
9
|
+
status: 'pass' | 'fail';
|
|
10
|
+
allowed_files: string[];
|
|
11
|
+
issues: PackageSecurityIssue[];
|
|
12
|
+
};
|
|
13
|
+
secret_scan: {
|
|
14
|
+
status: 'pass' | 'fail';
|
|
15
|
+
scanned_files: number;
|
|
16
|
+
issues: PackageSecurityIssue[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function evaluatePackageSecurityGates(projectRoot: string): Promise<PackageSecurityGateReport>;
|
|
20
|
+
export declare function evaluatePackageFileAllowlist(files: string[]): PackageSecurityIssue[];
|
|
21
|
+
//# sourceMappingURL=package-security-gates.d.ts.map
|