@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
|
@@ -1,22 +1,56 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { z } from 'zod';
|
|
3
|
+
import { validateFoundationArtifactMapArchitecture } from './foundation-artifact-map-validator.js';
|
|
4
|
+
import { pluginArtifactMapSchema } from './plugin-sdk-contract.js';
|
|
2
5
|
export const DerivationProfileSchema = z.enum(['prototype', 'foundation-compatible', 'enterprise-strict']);
|
|
3
6
|
export const PreviewGateStatusSchema = z.enum(['pending', 'approved', 'corrected', 'rejected']);
|
|
4
7
|
export const PackageStructureNodeKindSchema = z.enum(['dir', 'file']);
|
|
8
|
+
export const PreviewContextPatternSchema = z.enum(['bo-pattern', 'entity-pattern', 'application-only']);
|
|
9
|
+
export const PreviewDiagnosticSeveritySchema = z.enum(['warn', 'block']);
|
|
5
10
|
export const PackageStructureNodeSchema = z.lazy(() => z.object({
|
|
6
11
|
name: z.string().min(1),
|
|
7
12
|
kind: PackageStructureNodeKindSchema,
|
|
8
13
|
description: z.string().optional(),
|
|
9
14
|
children: z.array(PackageStructureNodeSchema).optional(),
|
|
10
15
|
}));
|
|
16
|
+
export const ApplicationOnlyContextSchema = z.object({
|
|
17
|
+
context: z.string().min(1),
|
|
18
|
+
path: z.string().min(1),
|
|
19
|
+
reason: z.string().min(1),
|
|
20
|
+
adr_required: z.boolean().default(true),
|
|
21
|
+
contract_rule_ref: z.literal('DTAPI-P1-APPONLY-001'),
|
|
22
|
+
});
|
|
23
|
+
export const PreviewContextClassificationSchema = z.object({
|
|
24
|
+
context: z.string().min(1),
|
|
25
|
+
pattern: PreviewContextPatternSchema,
|
|
26
|
+
source_paths: z.array(z.string().min(1)).default([]),
|
|
27
|
+
decision_refs: z.array(z.string().min(1)).default([]),
|
|
28
|
+
});
|
|
29
|
+
export const PreviewDiagnosticSchema = z.object({
|
|
30
|
+
code: z.string().min(1),
|
|
31
|
+
severity: PreviewDiagnosticSeveritySchema,
|
|
32
|
+
message: z.string().min(1),
|
|
33
|
+
remediation: z.string().min(1),
|
|
34
|
+
path: z.string().min(1).optional(),
|
|
35
|
+
});
|
|
11
36
|
export const PackageStructurePreviewSchema = z.object({
|
|
12
37
|
schema_version: z.literal(1),
|
|
13
38
|
generated_at: z.string(),
|
|
14
39
|
project_name: z.string().min(1),
|
|
15
40
|
profile: DerivationProfileSchema,
|
|
41
|
+
source: z.enum(['template', 'artifact-map']).default('template'),
|
|
16
42
|
contexts: z.array(z.string()),
|
|
17
43
|
subsystems: z.array(z.string()),
|
|
18
44
|
transports: z.array(z.string()),
|
|
19
45
|
tree: PackageStructureNodeSchema,
|
|
46
|
+
foundation_tests_projection: PackageStructureNodeSchema.optional(),
|
|
47
|
+
runtime_scripts_projection: PackageStructureNodeSchema.optional(),
|
|
48
|
+
application_only_contexts: z.array(ApplicationOnlyContextSchema).default([]),
|
|
49
|
+
context_classification: z.array(PreviewContextClassificationSchema).default([]),
|
|
50
|
+
contract_pack_refs: z.array(z.string().min(1)).default([]),
|
|
51
|
+
diagnostics: z.array(PreviewDiagnosticSchema).default([]),
|
|
52
|
+
artifact_languages: z.array(z.string().min(1)).default([]),
|
|
53
|
+
material_signature: z.string().min(1),
|
|
20
54
|
});
|
|
21
55
|
export const HumanValidationGateSchema = z.object({
|
|
22
56
|
gate_id: z.string(),
|
|
@@ -27,22 +61,59 @@ export const HumanValidationGateSchema = z.object({
|
|
|
27
61
|
approved_by: z.string().optional(),
|
|
28
62
|
correction_notes: z.string().optional(),
|
|
29
63
|
exception_refs: z.array(z.string()).default([]),
|
|
64
|
+
contract_pack_refs: z.array(z.string().min(1)).default([]),
|
|
65
|
+
material_signature: z.string().min(1),
|
|
66
|
+
serialized_at: z.string(),
|
|
30
67
|
});
|
|
68
|
+
const DEFAULT_CONTRACT_PACK_REFS = [
|
|
69
|
+
'DTAPI-P0-FOUNDATION-001',
|
|
70
|
+
'DTAPI-P0-PREVIEW-001',
|
|
71
|
+
'DTAPI-P0-PATH-001',
|
|
72
|
+
'DTAPI-P0-RUNTIME-SCRIPTS-001',
|
|
73
|
+
'DTAPI-P1-APPONLY-001',
|
|
74
|
+
];
|
|
75
|
+
const FOUNDATION_TESTS_ROOT = 'tests/';
|
|
76
|
+
const SUPPORTED_PREVIEW_LANGUAGES = new Set(['typescript', 'javascript']);
|
|
77
|
+
const APPLICATION_ONLY_CONTEXT_REASONS = {
|
|
78
|
+
'aws-integrations': 'Orchestrates AWS adapter wiring across infrastructure subsystems; invariants stay in infrastructure adapters.',
|
|
79
|
+
foundation: 'Composition root for Foundation-wide use-cases shared by other contexts and does not introduce a bounded domain vocabulary.',
|
|
80
|
+
};
|
|
31
81
|
export function generatePackageStructurePreview(input) {
|
|
82
|
+
if (input.artifact_map) {
|
|
83
|
+
return generateArtifactMapPackageStructurePreview(input);
|
|
84
|
+
}
|
|
32
85
|
const profile = input.profile ?? 'foundation-compatible';
|
|
33
86
|
const contexts = input.contexts ?? ['auth'];
|
|
34
87
|
const subsystems = input.subsystems ?? ['orm', 'cache', 'configuration'];
|
|
35
88
|
const transports = input.transports ?? ['rest', 'graphql', 'cli'];
|
|
36
89
|
const generatedAt = input.generated_at ?? new Date().toISOString();
|
|
37
|
-
|
|
90
|
+
const preview = {
|
|
38
91
|
schema_version: 1,
|
|
39
92
|
generated_at: generatedAt,
|
|
40
93
|
project_name: input.project_name,
|
|
41
94
|
profile,
|
|
95
|
+
source: 'template',
|
|
42
96
|
contexts,
|
|
43
97
|
subsystems,
|
|
44
98
|
transports,
|
|
45
99
|
tree: buildProjectTree(profile, contexts, subsystems, transports),
|
|
100
|
+
foundation_tests_projection: buildTemplateTestsProjection(),
|
|
101
|
+
runtime_scripts_projection: buildRuntimeScriptsProjection(),
|
|
102
|
+
application_only_contexts: [],
|
|
103
|
+
context_classification: contexts.map((context) => ({
|
|
104
|
+
context,
|
|
105
|
+
pattern: 'bo-pattern',
|
|
106
|
+
source_paths: [`src/domain/${context}/`, `src/application/business/${context}/`],
|
|
107
|
+
decision_refs: [],
|
|
108
|
+
})),
|
|
109
|
+
contract_pack_refs: [...DEFAULT_CONTRACT_PACK_REFS],
|
|
110
|
+
diagnostics: [],
|
|
111
|
+
artifact_languages: ['typescript'],
|
|
112
|
+
material_signature: '',
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
...preview,
|
|
116
|
+
material_signature: computePreviewSignature(preview),
|
|
46
117
|
};
|
|
47
118
|
}
|
|
48
119
|
export function formatPreviewAsTree(node, prefix = '') {
|
|
@@ -58,13 +129,24 @@ export function formatPreviewAsTree(node, prefix = '') {
|
|
|
58
129
|
}
|
|
59
130
|
return lines.join('\n');
|
|
60
131
|
}
|
|
61
|
-
export function buildHumanValidationGate(preview) {
|
|
132
|
+
export function buildHumanValidationGate(preview, options) {
|
|
133
|
+
const exceptionRefs = [...new Set(options?.exception_refs ?? [])];
|
|
134
|
+
const materialSignature = computeGateSignature(preview, exceptionRefs);
|
|
135
|
+
const previousGate = options?.previous_gate;
|
|
136
|
+
const preserveStatus = previousGate?.material_signature === materialSignature;
|
|
137
|
+
const serializedAt = new Date().toISOString();
|
|
62
138
|
return {
|
|
63
139
|
gate_id: `GATE-PKG-${preview.project_name.replace(/[^a-zA-Z0-9-]/g, '-')}`,
|
|
64
140
|
rule_ref: 'DTAPI-P0-PREVIEW-001',
|
|
65
|
-
status: 'pending',
|
|
141
|
+
status: preserveStatus ? previousGate.status : 'pending',
|
|
66
142
|
preview_ref: `devtrack-api-package-preview-${preview.project_name}`,
|
|
67
|
-
|
|
143
|
+
approved_at: preserveStatus ? previousGate?.approved_at : undefined,
|
|
144
|
+
approved_by: preserveStatus ? previousGate?.approved_by : undefined,
|
|
145
|
+
correction_notes: preserveStatus ? previousGate?.correction_notes : undefined,
|
|
146
|
+
exception_refs: exceptionRefs,
|
|
147
|
+
contract_pack_refs: preview.contract_pack_refs,
|
|
148
|
+
material_signature: materialSignature,
|
|
149
|
+
serialized_at: serializedAt,
|
|
68
150
|
};
|
|
69
151
|
}
|
|
70
152
|
export function generateDevtrackApiDebGate(input) {
|
|
@@ -73,12 +155,18 @@ export function generateDevtrackApiDebGate(input) {
|
|
|
73
155
|
return {
|
|
74
156
|
selected_profile: input.profile ?? 'foundation-compatible',
|
|
75
157
|
package_preview: preview,
|
|
76
|
-
human_validation_gate:
|
|
158
|
+
human_validation_gate: buildHumanValidationGate(preview, {
|
|
159
|
+
previous_gate: input.previous_human_validation_gate,
|
|
160
|
+
exception_refs: gate.exception_refs,
|
|
161
|
+
}),
|
|
77
162
|
exception_list: [],
|
|
78
163
|
policy_pool_seed: [
|
|
164
|
+
'DTAPI-P0-FOUNDATION-001: Foundation evidence wins over generated assumptions',
|
|
79
165
|
'DTAPI-P0-PROFILE-001: derivation profile must be explicit',
|
|
80
166
|
'DTAPI-P0-PREVIEW-001: early planning must include package structure preview',
|
|
81
167
|
'DTAPI-P0-PATH-001: proposed paths must match canonical Foundation paths',
|
|
168
|
+
'DTAPI-P0-RUNTIME-SCRIPTS-001: Foundation-linked projects require cleanup and port-safe npm/pnpm runtime scripts',
|
|
169
|
+
'DTAPI-P1-APPONLY-001: application-only contexts require ADR justification',
|
|
82
170
|
],
|
|
83
171
|
};
|
|
84
172
|
}
|
|
@@ -243,7 +331,12 @@ function buildOrmSubsystem(contexts) {
|
|
|
243
331
|
children: [
|
|
244
332
|
{ name: 'typeorm.config.ts', kind: 'file', description: 'TypeORM root configuration' },
|
|
245
333
|
{ name: 'typeorm-cli.datasource.ts', kind: 'file', description: 'TypeORM CLI datasource' },
|
|
246
|
-
{ name: 'typeorm.module.ts', kind: 'file', description: '
|
|
334
|
+
{ name: 'typeorm.module.ts', kind: 'file', description: 'TypeORM root module with forRootAsync and base forFeature entities' },
|
|
335
|
+
...contexts.map((context) => ({
|
|
336
|
+
name: `${context}-orm.module.ts`,
|
|
337
|
+
kind: 'file',
|
|
338
|
+
description: `${context} ORM module exporting repository port providers`,
|
|
339
|
+
})),
|
|
247
340
|
{
|
|
248
341
|
name: 'entities/',
|
|
249
342
|
kind: 'dir',
|
|
@@ -264,11 +357,6 @@ function buildOrmSubsystem(contexts) {
|
|
|
264
357
|
kind: 'dir',
|
|
265
358
|
children: [{ name: '<timestamp>-<action>.migration.ts', kind: 'file', description: 'Database migration' }],
|
|
266
359
|
},
|
|
267
|
-
...contexts.map((context) => ({
|
|
268
|
-
name: `${context}-orm.module.ts`,
|
|
269
|
-
kind: 'file',
|
|
270
|
-
description: `${context} TypeORM module`,
|
|
271
|
-
})),
|
|
272
360
|
],
|
|
273
361
|
};
|
|
274
362
|
}
|
|
@@ -359,4 +447,289 @@ function buildSharedLayer() {
|
|
|
359
447
|
],
|
|
360
448
|
};
|
|
361
449
|
}
|
|
450
|
+
function generateArtifactMapPackageStructurePreview(input) {
|
|
451
|
+
const generatedAt = input.generated_at ?? new Date().toISOString();
|
|
452
|
+
const profile = input.profile ?? 'foundation-compatible';
|
|
453
|
+
const parsed = pluginArtifactMapSchema.safeParse(input.artifact_map);
|
|
454
|
+
const contractPackRefs = [...new Set(input.contract_pack_refs ?? DEFAULT_CONTRACT_PACK_REFS)];
|
|
455
|
+
if (!parsed.success) {
|
|
456
|
+
const fallbackPreview = {
|
|
457
|
+
schema_version: 1,
|
|
458
|
+
generated_at: generatedAt,
|
|
459
|
+
project_name: input.project_name,
|
|
460
|
+
profile,
|
|
461
|
+
source: 'artifact-map',
|
|
462
|
+
contexts: input.contexts ?? [],
|
|
463
|
+
subsystems: input.subsystems ?? [],
|
|
464
|
+
transports: input.transports ?? [],
|
|
465
|
+
tree: { name: 'src/', kind: 'dir', children: [] },
|
|
466
|
+
foundation_tests_projection: { name: FOUNDATION_TESTS_ROOT, kind: 'dir', children: [] },
|
|
467
|
+
runtime_scripts_projection: buildRuntimeScriptsProjection([]),
|
|
468
|
+
application_only_contexts: [],
|
|
469
|
+
context_classification: [],
|
|
470
|
+
contract_pack_refs: contractPackRefs,
|
|
471
|
+
diagnostics: parsed.error.issues.map((issue) => ({
|
|
472
|
+
code: 'DTAPI_PREVIEW_ARTIFACT_MAP_INVALID',
|
|
473
|
+
severity: 'block',
|
|
474
|
+
message: issue.message,
|
|
475
|
+
remediation: 'Validate the artifact map with the CodeSDD plugin SDK before generating the Foundation-compatible preview.',
|
|
476
|
+
path: issue.path.join('.') || undefined,
|
|
477
|
+
})),
|
|
478
|
+
artifact_languages: [],
|
|
479
|
+
material_signature: '',
|
|
480
|
+
};
|
|
481
|
+
return {
|
|
482
|
+
...fallbackPreview,
|
|
483
|
+
material_signature: computePreviewSignature(fallbackPreview),
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const artifactMap = parsed.data;
|
|
487
|
+
const srcEntries = artifactMap.artifacts.filter((entry) => entry.path.startsWith('src/'));
|
|
488
|
+
const testEntries = artifactMap.artifacts.filter((entry) => entry.path.startsWith(FOUNDATION_TESTS_ROOT));
|
|
489
|
+
const runtimeEntries = artifactMap.artifacts.filter(isRuntimeScriptArtifact);
|
|
490
|
+
const domainContexts = collectDomainContexts(artifactMap.artifacts);
|
|
491
|
+
const applicationContexts = collectApplicationContexts(artifactMap.artifacts);
|
|
492
|
+
const applicationOnlyContexts = buildApplicationOnlyContexts(applicationContexts, domainContexts);
|
|
493
|
+
const contextClassification = buildContextClassification(artifactMap.artifacts, domainContexts, applicationOnlyContexts);
|
|
494
|
+
const diagnostics = [
|
|
495
|
+
...validateFoundationArtifactMapArchitecture(artifactMap).findings.map(mapFoundationFindingToPreviewDiagnostic),
|
|
496
|
+
...buildLanguageDiagnostics(artifactMap.artifacts),
|
|
497
|
+
...(testEntries.length === 0
|
|
498
|
+
? [
|
|
499
|
+
{
|
|
500
|
+
code: 'DTAPI_PREVIEW_TESTS_MISSING',
|
|
501
|
+
severity: 'warn',
|
|
502
|
+
message: 'Artifact map does not project any Foundation-compatible tests/ artifacts.',
|
|
503
|
+
remediation: 'Project at least the canonical tests/ smoke artifacts before human preview approval.',
|
|
504
|
+
},
|
|
505
|
+
]
|
|
506
|
+
: []),
|
|
507
|
+
];
|
|
508
|
+
const preview = {
|
|
509
|
+
schema_version: 1,
|
|
510
|
+
generated_at: generatedAt,
|
|
511
|
+
project_name: input.project_name,
|
|
512
|
+
profile,
|
|
513
|
+
source: 'artifact-map',
|
|
514
|
+
contexts: [...domainContexts],
|
|
515
|
+
subsystems: collectSubsystems(artifactMap.artifacts),
|
|
516
|
+
transports: collectTransports(artifactMap.artifacts),
|
|
517
|
+
tree: buildTreeFromArtifacts(srcEntries, 'src/'),
|
|
518
|
+
foundation_tests_projection: buildTreeFromArtifacts(testEntries, FOUNDATION_TESTS_ROOT),
|
|
519
|
+
runtime_scripts_projection: buildRuntimeScriptsProjection(runtimeEntries),
|
|
520
|
+
application_only_contexts: applicationOnlyContexts,
|
|
521
|
+
context_classification: contextClassification,
|
|
522
|
+
contract_pack_refs: contractPackRefs,
|
|
523
|
+
diagnostics,
|
|
524
|
+
artifact_languages: collectArtifactLanguages(artifactMap.artifacts),
|
|
525
|
+
material_signature: '',
|
|
526
|
+
};
|
|
527
|
+
return {
|
|
528
|
+
...preview,
|
|
529
|
+
material_signature: computePreviewSignature(preview),
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
function buildTemplateTestsProjection() {
|
|
533
|
+
return {
|
|
534
|
+
name: FOUNDATION_TESTS_ROOT,
|
|
535
|
+
kind: 'dir',
|
|
536
|
+
description: 'Foundation-compatible tests projection',
|
|
537
|
+
children: [
|
|
538
|
+
{ name: 'app.e2e-spec.ts', kind: 'file', description: 'Initial E2E smoke test' },
|
|
539
|
+
{ name: 'jest-e2e.json', kind: 'file', description: 'Jest E2E configuration' },
|
|
540
|
+
],
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function buildRuntimeScriptsProjection(entries) {
|
|
544
|
+
if (entries !== undefined) {
|
|
545
|
+
return buildTreeFromArtifacts(entries, 'project-root/');
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
name: 'project-root/',
|
|
549
|
+
kind: 'dir',
|
|
550
|
+
description: 'Mandatory npm/pnpm-compatible runtime script projection',
|
|
551
|
+
children: [
|
|
552
|
+
{ name: 'package.json', kind: 'file', description: 'Package scripts with cleanup, cleanup:install, start, start:dev, and npm-run internal composition' },
|
|
553
|
+
{
|
|
554
|
+
name: 'scripts/',
|
|
555
|
+
kind: 'dir',
|
|
556
|
+
children: [
|
|
557
|
+
{ name: 'cleanup.sh', kind: 'file', description: 'Destructive cleanup for dependencies, build outputs, caches, lockfiles, and compilation residue' },
|
|
558
|
+
{ name: 'kill-port.js', kind: 'file', description: 'Port preflight used by start and start:dev before Nest bootstrap' },
|
|
559
|
+
],
|
|
560
|
+
},
|
|
561
|
+
],
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function buildTreeFromArtifacts(entries, rootName) {
|
|
565
|
+
const root = { name: rootName, kind: 'dir', children: [] };
|
|
566
|
+
const rootSegments = rootName.replace(/\/$/u, '').split('/');
|
|
567
|
+
for (const entry of [...entries].sort((left, right) => left.path.localeCompare(right.path))) {
|
|
568
|
+
const segments = entry.path.split('/');
|
|
569
|
+
const relativeSegments = rootSegments.every((segment, index) => segments[index] === segment)
|
|
570
|
+
? segments.slice(rootSegments.length)
|
|
571
|
+
: segments;
|
|
572
|
+
insertArtifactPath(root, relativeSegments, entry.reason);
|
|
573
|
+
}
|
|
574
|
+
return root;
|
|
575
|
+
}
|
|
576
|
+
function isRuntimeScriptArtifact(entry) {
|
|
577
|
+
return entry.path === 'package.json' || entry.path === 'scripts/cleanup.sh' || entry.path === 'scripts/kill-port.js';
|
|
578
|
+
}
|
|
579
|
+
function insertArtifactPath(root, segments, description) {
|
|
580
|
+
if (segments.length === 0)
|
|
581
|
+
return;
|
|
582
|
+
if (!root.children)
|
|
583
|
+
root.children = [];
|
|
584
|
+
const [current, ...rest] = segments;
|
|
585
|
+
const isLeaf = rest.length === 0;
|
|
586
|
+
const nodeName = isLeaf ? current : `${current}/`;
|
|
587
|
+
let node = root.children.find((child) => child.name === nodeName);
|
|
588
|
+
if (!node) {
|
|
589
|
+
node = {
|
|
590
|
+
name: nodeName,
|
|
591
|
+
kind: isLeaf ? 'file' : 'dir',
|
|
592
|
+
description: isLeaf ? description : undefined,
|
|
593
|
+
children: isLeaf ? undefined : [],
|
|
594
|
+
};
|
|
595
|
+
root.children.push(node);
|
|
596
|
+
}
|
|
597
|
+
else if (isLeaf && !node.description) {
|
|
598
|
+
node.description = description;
|
|
599
|
+
}
|
|
600
|
+
if (!isLeaf) {
|
|
601
|
+
insertArtifactPath(node, rest, description);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function collectDomainContexts(entries) {
|
|
605
|
+
const contexts = new Set();
|
|
606
|
+
for (const entry of entries) {
|
|
607
|
+
const match = /^src\/domain\/([^/]+)\//u.exec(entry.path);
|
|
608
|
+
if (match)
|
|
609
|
+
contexts.add(match[1]);
|
|
610
|
+
}
|
|
611
|
+
return contexts;
|
|
612
|
+
}
|
|
613
|
+
function collectApplicationContexts(entries) {
|
|
614
|
+
const contexts = new Set();
|
|
615
|
+
for (const entry of entries) {
|
|
616
|
+
const match = /^src\/application\/business\/([^/]+)\//u.exec(entry.path);
|
|
617
|
+
if (match)
|
|
618
|
+
contexts.add(match[1]);
|
|
619
|
+
}
|
|
620
|
+
return contexts;
|
|
621
|
+
}
|
|
622
|
+
function buildApplicationOnlyContexts(applicationContexts, domainContexts) {
|
|
623
|
+
return [...applicationContexts]
|
|
624
|
+
.filter((context) => !domainContexts.has(context))
|
|
625
|
+
.sort()
|
|
626
|
+
.map((context) => ({
|
|
627
|
+
context,
|
|
628
|
+
path: `src/application/business/${context}/`,
|
|
629
|
+
reason: APPLICATION_ONLY_CONTEXT_REASONS[context] ??
|
|
630
|
+
'Application-only orchestration context without a domain counterpart; requires ADR justification before approval.',
|
|
631
|
+
adr_required: true,
|
|
632
|
+
contract_rule_ref: 'DTAPI-P1-APPONLY-001',
|
|
633
|
+
}));
|
|
634
|
+
}
|
|
635
|
+
function buildContextClassification(entries, domainContexts, applicationOnlyContexts) {
|
|
636
|
+
const grouped = new Map();
|
|
637
|
+
for (const entry of entries) {
|
|
638
|
+
const match = /^src\/domain\/([^/]+)\//u.exec(entry.path);
|
|
639
|
+
if (!match)
|
|
640
|
+
continue;
|
|
641
|
+
const context = match[1];
|
|
642
|
+
grouped.set(context, [...(grouped.get(context) ?? []), entry]);
|
|
643
|
+
}
|
|
644
|
+
const classifications = [...domainContexts].sort().map((context) => {
|
|
645
|
+
const contextEntries = grouped.get(context) ?? [];
|
|
646
|
+
const pattern = contextEntries.some((entry) => entry.role === 'entity')
|
|
647
|
+
? 'entity-pattern'
|
|
648
|
+
: 'bo-pattern';
|
|
649
|
+
return {
|
|
650
|
+
context,
|
|
651
|
+
pattern,
|
|
652
|
+
source_paths: [...new Set(contextEntries.map((entry) => entry.path))],
|
|
653
|
+
decision_refs: [...new Set(contextEntries.flatMap((entry) => entry.decision_refs))],
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
return [
|
|
657
|
+
...classifications,
|
|
658
|
+
...applicationOnlyContexts.map((item) => ({
|
|
659
|
+
context: item.context,
|
|
660
|
+
pattern: 'application-only',
|
|
661
|
+
source_paths: [item.path],
|
|
662
|
+
decision_refs: [],
|
|
663
|
+
})),
|
|
664
|
+
];
|
|
665
|
+
}
|
|
666
|
+
function collectSubsystems(entries) {
|
|
667
|
+
return [
|
|
668
|
+
...new Set(entries
|
|
669
|
+
.map((entry) => /^src\/infrastructure\/adapters\/([^/]+)\//u.exec(entry.path)?.[1])
|
|
670
|
+
.filter((value) => Boolean(value))),
|
|
671
|
+
];
|
|
672
|
+
}
|
|
673
|
+
function collectTransports(entries) {
|
|
674
|
+
return [
|
|
675
|
+
...new Set(entries
|
|
676
|
+
.map((entry) => /^src\/presentation\/([^/]+)\//u.exec(entry.path)?.[1])
|
|
677
|
+
.filter((value) => Boolean(value))),
|
|
678
|
+
];
|
|
679
|
+
}
|
|
680
|
+
function collectArtifactLanguages(entries) {
|
|
681
|
+
return [
|
|
682
|
+
...new Set(entries.map((entry) => entry.language).filter((value) => value !== undefined)),
|
|
683
|
+
];
|
|
684
|
+
}
|
|
685
|
+
function buildLanguageDiagnostics(entries) {
|
|
686
|
+
return entries
|
|
687
|
+
.filter((entry) => Boolean(entry.language) && !SUPPORTED_PREVIEW_LANGUAGES.has(entry.language))
|
|
688
|
+
.map((entry) => ({
|
|
689
|
+
code: 'DTAPI_PREVIEW_LANGUAGE_INVALID',
|
|
690
|
+
severity: 'block',
|
|
691
|
+
message: `Artifact "${entry.path}" declares unsupported preview language "${entry.language}".`,
|
|
692
|
+
remediation: 'Use TypeScript or JavaScript for Foundation-compatible devtrack-api preview artifacts, or document a governed exception.',
|
|
693
|
+
path: entry.path,
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
function mapFoundationFindingToPreviewDiagnostic(finding) {
|
|
697
|
+
return {
|
|
698
|
+
code: finding.code,
|
|
699
|
+
severity: finding.severity === 'warn' ? 'warn' : 'block',
|
|
700
|
+
message: finding.message,
|
|
701
|
+
remediation: finding.remediation,
|
|
702
|
+
path: finding.path,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function computePreviewSignature(preview) {
|
|
706
|
+
return createHash('sha256')
|
|
707
|
+
.update(JSON.stringify({
|
|
708
|
+
project_name: preview.project_name,
|
|
709
|
+
profile: preview.profile,
|
|
710
|
+
source: preview.source,
|
|
711
|
+
contexts: preview.contexts,
|
|
712
|
+
subsystems: preview.subsystems,
|
|
713
|
+
transports: preview.transports,
|
|
714
|
+
tree: preview.tree,
|
|
715
|
+
foundation_tests_projection: preview.foundation_tests_projection,
|
|
716
|
+
runtime_scripts_projection: preview.runtime_scripts_projection,
|
|
717
|
+
application_only_contexts: preview.application_only_contexts,
|
|
718
|
+
context_classification: preview.context_classification,
|
|
719
|
+
contract_pack_refs: preview.contract_pack_refs,
|
|
720
|
+
diagnostics: preview.diagnostics.map((item) => ({ code: item.code, path: item.path, severity: item.severity })),
|
|
721
|
+
artifact_languages: preview.artifact_languages,
|
|
722
|
+
}))
|
|
723
|
+
.digest('hex');
|
|
724
|
+
}
|
|
725
|
+
function computeGateSignature(preview, exceptionRefs) {
|
|
726
|
+
return createHash('sha256')
|
|
727
|
+
.update(JSON.stringify({
|
|
728
|
+
preview_signature: preview.material_signature,
|
|
729
|
+
profile: preview.profile,
|
|
730
|
+
contract_pack_refs: preview.contract_pack_refs,
|
|
731
|
+
exception_refs: [...exceptionRefs].sort(),
|
|
732
|
+
}))
|
|
733
|
+
.digest('hex');
|
|
734
|
+
}
|
|
362
735
|
//# sourceMappingURL=package-structure-gate.js.map
|