@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.
Files changed (213) hide show
  1. package/.sdd/skills/curated/devtrack-api/SKILL.md +98 -12
  2. package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +10 -0
  3. package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +10 -0
  4. package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +10 -0
  5. package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +10 -0
  6. package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +10 -0
  7. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +5 -3
  8. package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +12 -0
  9. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +61 -5
  10. package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
  11. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1951 -0
  12. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +16 -14
  13. package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
  14. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +19 -2
  15. package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
  16. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
  17. package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +42 -0
  18. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
  19. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -7
  20. package/README.md +280 -29
  21. package/dist/applications/sdd/index.d.ts +16 -0
  22. package/dist/applications/sdd/index.js +16 -0
  23. package/dist/cli/program.js +180 -11
  24. package/dist/commands/config.js +197 -10
  25. package/dist/commands/sdd/execution.js +408 -16
  26. package/dist/commands/sdd/plugin.js +5 -0
  27. package/dist/commands/sdd/shared.d.ts +1 -0
  28. package/dist/commands/sdd/shared.js +10 -0
  29. package/dist/commands/sdd.js +157 -7
  30. package/dist/core/cli/command-matrix.d.ts +18 -0
  31. package/dist/core/cli/command-matrix.js +157 -0
  32. package/dist/core/cli-command-quality.js +11 -0
  33. package/dist/core/completions/command-registry.js +45 -0
  34. package/dist/core/config-schema.d.ts +31 -1
  35. package/dist/core/config-schema.js +79 -5
  36. package/dist/core/config.d.ts +1 -0
  37. package/dist/core/config.js +11 -0
  38. package/dist/core/global-config.d.ts +29 -0
  39. package/dist/core/init.d.ts +2 -2
  40. package/dist/core/init.js +13 -14
  41. package/dist/core/sdd/agent-binding.d.ts +19 -19
  42. package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
  43. package/dist/core/sdd/agent-runtime-contract.js +200 -0
  44. package/dist/core/sdd/allocator-recovery.d.ts +14 -0
  45. package/dist/core/sdd/allocator-recovery.js +30 -0
  46. package/dist/core/sdd/allocator-security.d.ts +18 -0
  47. package/dist/core/sdd/allocator-security.js +36 -0
  48. package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
  49. package/dist/core/sdd/api-foundation-baseline.js +151 -0
  50. package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
  51. package/dist/core/sdd/api-foundation-parity.js +131 -0
  52. package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
  53. package/dist/core/sdd/api-profile-catalog.js +132 -0
  54. package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
  55. package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
  56. package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
  57. package/dist/core/sdd/api-profile-recipes.js +484 -0
  58. package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
  59. package/dist/core/sdd/artifact-id-allocator.js +510 -0
  60. package/dist/core/sdd/check.d.ts +52 -1
  61. package/dist/core/sdd/check.js +326 -11
  62. package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
  63. package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
  64. package/dist/core/sdd/coordination/index.d.ts +1 -0
  65. package/dist/core/sdd/coordination/index.js +1 -0
  66. package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
  67. package/dist/core/sdd/coordination/redis-runtime.js +698 -0
  68. package/dist/core/sdd/deepagent-contracts.d.ts +99 -5
  69. package/dist/core/sdd/deepagent-contracts.js +62 -0
  70. package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
  71. package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
  72. package/dist/core/sdd/default-bootstrap-files.js +14 -10
  73. package/dist/core/sdd/default-skills.js +115 -9
  74. package/dist/core/sdd/devtrack-api-appliance.d.ts +42 -1
  75. package/dist/core/sdd/devtrack-api-appliance.js +159 -32
  76. package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
  77. package/dist/core/sdd/devtrack-api-architecture.js +86 -0
  78. package/dist/core/sdd/docs-sync.js +24 -18
  79. package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
  80. package/dist/core/sdd/domain/capability-diff.js +200 -0
  81. package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
  82. package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
  83. package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
  84. package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
  85. package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
  86. package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
  87. package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
  88. package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
  89. package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
  90. package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
  91. package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
  92. package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
  93. package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
  94. package/dist/core/sdd/foundation-layer-manifest.js +117 -0
  95. package/dist/core/sdd/governance-schemas.d.ts +2 -2
  96. package/dist/core/sdd/governance-schemas.js +11 -2
  97. package/dist/core/sdd/intent-guard.d.ts +22 -0
  98. package/dist/core/sdd/intent-guard.js +67 -0
  99. package/dist/core/sdd/json-schema.js +13 -1
  100. package/dist/core/sdd/legacy-operations.js +169 -5
  101. package/dist/core/sdd/migrate-workspace.js +39 -0
  102. package/dist/core/sdd/package-security-gates.d.ts +21 -0
  103. package/dist/core/sdd/package-security-gates.js +121 -0
  104. package/dist/core/sdd/package-structure-gate.d.ts +85 -3
  105. package/dist/core/sdd/package-structure-gate.js +384 -11
  106. package/dist/core/sdd/parallel-feat-automation.d.ts +185 -7
  107. package/dist/core/sdd/parallel-feat-automation.js +212 -0
  108. package/dist/core/sdd/plugin-broker.d.ts +223 -4
  109. package/dist/core/sdd/plugin-broker.js +10 -0
  110. package/dist/core/sdd/plugin-cli.d.ts +30 -0
  111. package/dist/core/sdd/plugin-cli.js +70 -3
  112. package/dist/core/sdd/plugin-evidence.d.ts +73 -0
  113. package/dist/core/sdd/plugin-manifest.d.ts +69 -1
  114. package/dist/core/sdd/plugin-manifest.js +10 -0
  115. package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
  116. package/dist/core/sdd/plugin-policy.js +6 -1
  117. package/dist/core/sdd/plugin-registry.d.ts +138 -2
  118. package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
  119. package/dist/core/sdd/plugin-sdk-contract.js +268 -0
  120. package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
  121. package/dist/core/sdd/quality-validation.d.ts +89 -16
  122. package/dist/core/sdd/release-readiness.d.ts +68 -0
  123. package/dist/core/sdd/release-readiness.js +767 -0
  124. package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
  125. package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
  126. package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
  127. package/dist/core/sdd/reversa-artifact-writer.js +40 -0
  128. package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
  129. package/dist/core/sdd/reversa-command-policy.js +361 -0
  130. package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
  131. package/dist/core/sdd/reversa-data-extractor.js +73 -0
  132. package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
  133. package/dist/core/sdd/reversa-equivalence.js +34 -0
  134. package/dist/core/sdd/reversa-evidence.d.ts +298 -0
  135. package/dist/core/sdd/reversa-evidence.js +118 -0
  136. package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
  137. package/dist/core/sdd/reversa-reconstruction.js +32 -0
  138. package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
  139. package/dist/core/sdd/reversa-rules-extractor.js +86 -0
  140. package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
  141. package/dist/core/sdd/reversa-source-safety.js +105 -0
  142. package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
  143. package/dist/core/sdd/reversa-surface-scout.js +85 -0
  144. package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
  145. package/dist/core/sdd/reversa-ux-mapper.js +73 -0
  146. package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
  147. package/dist/core/sdd/runtime-boundary-contract.js +90 -0
  148. package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
  149. package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
  150. package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
  151. package/dist/core/sdd/services/agent-run.service.js +73 -1
  152. package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
  153. package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
  154. package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
  155. package/dist/core/sdd/services/capability-diff.service.js +26 -0
  156. package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
  157. package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
  158. package/dist/core/sdd/services/context.service.d.ts +43 -340
  159. package/dist/core/sdd/services/context.service.js +323 -9
  160. package/dist/core/sdd/services/decide.service.js +1 -1
  161. package/dist/core/sdd/services/finalize.service.d.ts +27 -0
  162. package/dist/core/sdd/services/finalize.service.js +226 -18
  163. package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
  164. package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
  165. package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
  166. package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
  167. package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
  168. package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
  169. package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
  170. package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
  171. package/dist/core/sdd/state.d.ts +1 -0
  172. package/dist/core/sdd/state.js +266 -34
  173. package/dist/core/sdd/store/sdd-stores.js +2 -2
  174. package/dist/core/sdd/structural-health.d.ts +13 -13
  175. package/dist/core/sdd/types.d.ts +30 -15
  176. package/dist/core/sdd/types.js +4 -0
  177. package/dist/core/sdd/views.js +17 -0
  178. package/dist/core/sdd/workspace-schemas.d.ts +428 -7
  179. package/dist/core/sdd/workspace-schemas.js +223 -70
  180. package/dist/core/shared/skill-generation.d.ts +2 -0
  181. package/dist/core/shared/skill-generation.js +19 -2
  182. package/dist/core/shared/tool-detection.d.ts +19 -0
  183. package/dist/core/shared/tool-detection.js +89 -0
  184. package/dist/domains/sdd/index.d.ts +6 -0
  185. package/dist/domains/sdd/index.js +6 -0
  186. package/dist/infrastructures/sdd/index.d.ts +7 -0
  187. package/dist/infrastructures/sdd/index.js +6 -0
  188. package/dist/presentations/cli/sdd/index.d.ts +3 -0
  189. package/dist/presentations/cli/sdd/index.js +3 -0
  190. package/dist/shared/sdd/index.d.ts +3 -0
  191. package/dist/shared/sdd/index.js +2 -0
  192. package/package.json +14 -10
  193. package/schemas/sdd/2-plan.schema.json +207 -2
  194. package/schemas/sdd/5-quality.schema.json +324 -25
  195. package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
  196. package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
  197. package/schemas/sdd/codesdd-plugin.schema.json +171 -0
  198. package/schemas/sdd/deepagent-run-request.schema.json +316 -0
  199. package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
  200. package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
  201. package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
  202. package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
  203. package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
  204. package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
  205. package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
  206. package/schemas/sdd/plugin-package-governance.schema.json +74 -0
  207. package/schemas/sdd/plugin-registry.schema.json +171 -0
  208. package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
  209. package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
  210. package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
  211. package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
  212. package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
  213. package/schemas/sdd/workspace-catalog.schema.json +5298 -1409
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ export declare const sdkAgentPluginCoverageScopeSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ label: z.ZodString;
5
+ metrics: z.ZodObject<{
6
+ statements: z.ZodOptional<z.ZodNumber>;
7
+ branches: z.ZodOptional<z.ZodNumber>;
8
+ functions: z.ZodOptional<z.ZodNumber>;
9
+ lines: z.ZodOptional<z.ZodNumber>;
10
+ }, z.core.$strip>;
11
+ target: z.ZodOptional<z.ZodObject<{
12
+ statements: z.ZodOptional<z.ZodNumber>;
13
+ branches: z.ZodOptional<z.ZodNumber>;
14
+ functions: z.ZodOptional<z.ZodNumber>;
15
+ lines: z.ZodOptional<z.ZodNumber>;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
18
+ export declare const sdkAgentPluginQualityGateInputSchema: z.ZodObject<{
19
+ schema_version: z.ZodDefault<z.ZodLiteral<1>>;
20
+ generated_at: z.ZodString;
21
+ feature_ref: z.ZodOptional<z.ZodString>;
22
+ package_governance: z.ZodOptional<z.ZodUnknown>;
23
+ language_runtime: z.ZodOptional<z.ZodUnknown>;
24
+ artifact_map: z.ZodOptional<z.ZodUnknown>;
25
+ agent_runtime_plans: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
26
+ plugin_compliance_indexes: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
27
+ coverage_scopes: z.ZodDefault<z.ZodArray<z.ZodObject<{
28
+ id: z.ZodString;
29
+ label: z.ZodString;
30
+ metrics: z.ZodObject<{
31
+ statements: z.ZodOptional<z.ZodNumber>;
32
+ branches: z.ZodOptional<z.ZodNumber>;
33
+ functions: z.ZodOptional<z.ZodNumber>;
34
+ lines: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$strip>;
36
+ target: z.ZodOptional<z.ZodObject<{
37
+ statements: z.ZodOptional<z.ZodNumber>;
38
+ branches: z.ZodOptional<z.ZodNumber>;
39
+ functions: z.ZodOptional<z.ZodNumber>;
40
+ lines: z.ZodOptional<z.ZodNumber>;
41
+ }, z.core.$strip>>;
42
+ }, z.core.$strip>>>;
43
+ required_agent_providers: z.ZodDefault<z.ZodArray<z.ZodEnum<{
44
+ opencode: "opencode";
45
+ codex: "codex";
46
+ deepagents: "deepagents";
47
+ }>>>;
48
+ coverage_target: z.ZodDefault<z.ZodObject<{
49
+ statements: z.ZodOptional<z.ZodNumber>;
50
+ branches: z.ZodOptional<z.ZodNumber>;
51
+ functions: z.ZodOptional<z.ZodNumber>;
52
+ lines: z.ZodOptional<z.ZodNumber>;
53
+ }, z.core.$strip>>;
54
+ }, z.core.$strip>;
55
+ export declare const sdkAgentPluginQualityGateIssueSchema: z.ZodObject<{
56
+ code: z.ZodString;
57
+ severity: z.ZodEnum<{
58
+ fail: "fail";
59
+ warn: "warn";
60
+ }>;
61
+ message: z.ZodString;
62
+ remediation: z.ZodString;
63
+ path: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ export declare const sdkAgentPluginQualityGateSchema: z.ZodObject<{
66
+ id: z.ZodString;
67
+ domain: z.ZodEnum<{
68
+ coverage: "coverage";
69
+ "agent-runtime": "agent-runtime";
70
+ "plugin-sdk": "plugin-sdk";
71
+ "plugin-compliance": "plugin-compliance";
72
+ "foundation-architecture": "foundation-architecture";
73
+ }>;
74
+ status: z.ZodEnum<{
75
+ pass: "pass";
76
+ fail: "fail";
77
+ warn: "warn";
78
+ }>;
79
+ severity: z.ZodEnum<{
80
+ info: "info";
81
+ fail: "fail";
82
+ warn: "warn";
83
+ }>;
84
+ evidence: z.ZodString;
85
+ issues: z.ZodDefault<z.ZodArray<z.ZodObject<{
86
+ code: z.ZodString;
87
+ severity: z.ZodEnum<{
88
+ fail: "fail";
89
+ warn: "warn";
90
+ }>;
91
+ message: z.ZodString;
92
+ remediation: z.ZodString;
93
+ path: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>>>;
95
+ }, z.core.$strip>;
96
+ export declare const sdkAgentPluginQualityGateReportSchema: z.ZodObject<{
97
+ schema_version: z.ZodLiteral<1>;
98
+ generated_at: z.ZodString;
99
+ feature_ref: z.ZodOptional<z.ZodString>;
100
+ decision: z.ZodEnum<{
101
+ warning: "warning";
102
+ failed: "failed";
103
+ passed: "passed";
104
+ }>;
105
+ summary: z.ZodObject<{
106
+ total: z.ZodNumber;
107
+ passed: z.ZodNumber;
108
+ warned: z.ZodNumber;
109
+ failed: z.ZodNumber;
110
+ }, z.core.$strip>;
111
+ gates: z.ZodArray<z.ZodObject<{
112
+ id: z.ZodString;
113
+ domain: z.ZodEnum<{
114
+ coverage: "coverage";
115
+ "agent-runtime": "agent-runtime";
116
+ "plugin-sdk": "plugin-sdk";
117
+ "plugin-compliance": "plugin-compliance";
118
+ "foundation-architecture": "foundation-architecture";
119
+ }>;
120
+ status: z.ZodEnum<{
121
+ pass: "pass";
122
+ fail: "fail";
123
+ warn: "warn";
124
+ }>;
125
+ severity: z.ZodEnum<{
126
+ info: "info";
127
+ fail: "fail";
128
+ warn: "warn";
129
+ }>;
130
+ evidence: z.ZodString;
131
+ issues: z.ZodDefault<z.ZodArray<z.ZodObject<{
132
+ code: z.ZodString;
133
+ severity: z.ZodEnum<{
134
+ fail: "fail";
135
+ warn: "warn";
136
+ }>;
137
+ message: z.ZodString;
138
+ remediation: z.ZodString;
139
+ path: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>>;
141
+ }, z.core.$strip>>;
142
+ }, z.core.$strip>;
143
+ export type SdkAgentPluginCoverageScope = z.infer<typeof sdkAgentPluginCoverageScopeSchema>;
144
+ export type SdkAgentPluginQualityGateInput = z.input<typeof sdkAgentPluginQualityGateInputSchema>;
145
+ export type SdkAgentPluginQualityGateIssue = z.infer<typeof sdkAgentPluginQualityGateIssueSchema>;
146
+ export type SdkAgentPluginQualityGate = z.infer<typeof sdkAgentPluginQualityGateSchema>;
147
+ export type SdkAgentPluginQualityGateReport = z.infer<typeof sdkAgentPluginQualityGateReportSchema>;
148
+ export declare function buildSdkAgentPluginQualityGateReport(value: SdkAgentPluginQualityGateInput): SdkAgentPluginQualityGateReport;
149
+ export declare function buildSdkAgentPluginQualityGateJsonSchemas(): Record<string, unknown>;
150
+ //# sourceMappingURL=sdk-agent-plugin-quality-gates.d.ts.map
@@ -0,0 +1,258 @@
1
+ import { toJSONSchema, z } from 'zod';
2
+ import { agentRuntimeCommandPlanSchema, agentRuntimeProviderSchema, } from './agent-runtime-contract.js';
3
+ import { validateFoundationArtifactMapArchitecture } from './foundation-artifact-map-validator.js';
4
+ import { pluginComplianceIndexSchema } from './plugin-evidence.js';
5
+ import { pluginArtifactMapSchema, pluginLanguageRuntimeSchema, pluginPackageGovernanceSchema, } from './plugin-sdk-contract.js';
6
+ const JSON_SCHEMA_DRAFT = 'https://json-schema.org/draft/2020-12/schema';
7
+ const FEATURE_REF_PATTERN = /^FEAT-\d{4}$/;
8
+ const ISSUE_CODE_PATTERN = /^[A-Z][A-Z0-9_]*$/;
9
+ const coverageMetricsSchema = z
10
+ .object({
11
+ statements: z.number().min(0).max(100).optional(),
12
+ branches: z.number().min(0).max(100).optional(),
13
+ functions: z.number().min(0).max(100).optional(),
14
+ lines: z.number().min(0).max(100).optional(),
15
+ })
16
+ .refine((metrics) => Object.keys(metrics).length > 0, {
17
+ message: 'At least one coverage metric is required.',
18
+ });
19
+ export const sdkAgentPluginCoverageScopeSchema = z.object({
20
+ id: z.string().min(1),
21
+ label: z.string().min(1),
22
+ metrics: coverageMetricsSchema,
23
+ target: coverageMetricsSchema.optional(),
24
+ });
25
+ export const sdkAgentPluginQualityGateInputSchema = z.object({
26
+ schema_version: z.literal(1).default(1),
27
+ generated_at: z.string().datetime(),
28
+ feature_ref: z.string().regex(FEATURE_REF_PATTERN).optional(),
29
+ package_governance: z.unknown().optional(),
30
+ language_runtime: z.unknown().optional(),
31
+ artifact_map: z.unknown().optional(),
32
+ agent_runtime_plans: z.array(z.unknown()).default([]),
33
+ plugin_compliance_indexes: z.array(z.unknown()).default([]),
34
+ coverage_scopes: z.array(sdkAgentPluginCoverageScopeSchema).default([]),
35
+ required_agent_providers: z.array(agentRuntimeProviderSchema).default(['deepagents', 'codex', 'opencode']),
36
+ coverage_target: coverageMetricsSchema.default({
37
+ statements: 95,
38
+ branches: 85,
39
+ functions: 95,
40
+ lines: 95,
41
+ }),
42
+ });
43
+ export const sdkAgentPluginQualityGateIssueSchema = z.object({
44
+ code: z.string().regex(ISSUE_CODE_PATTERN),
45
+ severity: z.enum(['warn', 'fail']),
46
+ message: z.string().min(1),
47
+ remediation: z.string().min(1),
48
+ path: z.string().min(1).optional(),
49
+ });
50
+ export const sdkAgentPluginQualityGateSchema = z.object({
51
+ id: z.string().min(1),
52
+ domain: z.enum([
53
+ 'plugin-sdk',
54
+ 'agent-runtime',
55
+ 'plugin-compliance',
56
+ 'foundation-architecture',
57
+ 'coverage',
58
+ ]),
59
+ status: z.enum(['pass', 'warn', 'fail']),
60
+ severity: z.enum(['info', 'warn', 'fail']),
61
+ evidence: z.string().min(1),
62
+ issues: z.array(sdkAgentPluginQualityGateIssueSchema).default([]),
63
+ });
64
+ export const sdkAgentPluginQualityGateReportSchema = z.object({
65
+ schema_version: z.literal(1),
66
+ generated_at: z.string().datetime(),
67
+ feature_ref: z.string().regex(FEATURE_REF_PATTERN).optional(),
68
+ decision: z.enum(['passed', 'warning', 'failed']),
69
+ summary: z.object({
70
+ total: z.number().int().nonnegative(),
71
+ passed: z.number().int().nonnegative(),
72
+ warned: z.number().int().nonnegative(),
73
+ failed: z.number().int().nonnegative(),
74
+ }),
75
+ gates: z.array(sdkAgentPluginQualityGateSchema).min(1),
76
+ });
77
+ const COVERAGE_METRICS = ['statements', 'branches', 'functions', 'lines'];
78
+ export function buildSdkAgentPluginQualityGateReport(value) {
79
+ const input = sdkAgentPluginQualityGateInputSchema.parse(value);
80
+ const gates = [
81
+ packageGovernanceGate(input.package_governance),
82
+ languageRuntimeGate(input.language_runtime),
83
+ artifactMapGate(input.artifact_map),
84
+ agentRuntimeGate(input.agent_runtime_plans, input.required_agent_providers),
85
+ pluginComplianceGate(input.plugin_compliance_indexes),
86
+ coverageGate(input.coverage_scopes, input.coverage_target),
87
+ ];
88
+ const summary = {
89
+ total: gates.length,
90
+ passed: gates.filter((gate) => gate.status === 'pass').length,
91
+ warned: gates.filter((gate) => gate.status === 'warn').length,
92
+ failed: gates.filter((gate) => gate.status === 'fail').length,
93
+ };
94
+ return sdkAgentPluginQualityGateReportSchema.parse({
95
+ schema_version: 1,
96
+ generated_at: input.generated_at,
97
+ feature_ref: input.feature_ref,
98
+ decision: summary.failed > 0 ? 'failed' : summary.warned > 0 ? 'warning' : 'passed',
99
+ summary,
100
+ gates,
101
+ });
102
+ }
103
+ export function buildSdkAgentPluginQualityGateJsonSchemas() {
104
+ return {
105
+ 'sdk-agent-plugin-quality-gate-input.yaml': normalizeJsonSchema(sdkAgentPluginQualityGateInputSchema, 'CodeSDD SDK Agent Plugin Quality Gate Input', 'Input contract for validating plugin SDK, agent runtime, plugin compliance, Foundation artifact map, and coverage evidence together.'),
106
+ 'sdk-agent-plugin-quality-gate-report.yaml': normalizeJsonSchema(sdkAgentPluginQualityGateReportSchema, 'CodeSDD SDK Agent Plugin Quality Gate Report', 'Machine-readable quality gate report for SDK contracts, agent runtimes, plugin compliance indexes, Foundation artifact maps, and coverage scopes.'),
107
+ };
108
+ }
109
+ function packageGovernanceGate(value) {
110
+ if (value === undefined) {
111
+ return gate('plugin-sdk.package-governance', 'plugin-sdk', [
112
+ issue('SDK_PACKAGE_GOVERNANCE_MISSING', 'fail', 'Plugin package governance evidence is missing.', 'Attach package_governance from @devtrack-solution/codesdd-plugin-sdk before accepting the plugin package.'),
113
+ ], 'No package governance evidence was provided.');
114
+ }
115
+ const parsed = pluginPackageGovernanceSchema.safeParse(value);
116
+ if (!parsed.success) {
117
+ return gate('plugin-sdk.package-governance', 'plugin-sdk', [
118
+ issue('SDK_PACKAGE_GOVERNANCE_INVALID', 'fail', `Package governance failed validation: ${formatIssues(parsed.error.issues)}`, 'Use the @devtrack-solution/codesdd-plugin-* package prefix, SemVer, package kind, and required discovery keywords.'),
119
+ ], 'Package governance evidence failed SDK validation.');
120
+ }
121
+ return gate('plugin-sdk.package-governance', 'plugin-sdk', [], `Package governance passed for ${parsed.data.package_name}.`);
122
+ }
123
+ function languageRuntimeGate(value) {
124
+ if (value === undefined) {
125
+ return gate('plugin-sdk.language-runtime', 'plugin-sdk', [
126
+ issue('SDK_LANGUAGE_RUNTIME_MISSING', 'fail', 'Plugin language runtime evidence is missing.', 'Declare language_runtime with bridge and transport metadata before planning standalone plugin execution.'),
127
+ ], 'No language runtime evidence was provided.');
128
+ }
129
+ const parsed = pluginLanguageRuntimeSchema.safeParse(value);
130
+ if (!parsed.success) {
131
+ return gate('plugin-sdk.language-runtime', 'plugin-sdk', [
132
+ issue('SDK_LANGUAGE_RUNTIME_INVALID', 'fail', `Language runtime failed validation: ${formatIssues(parsed.error.issues)}`, 'Use a valid bridge for the plugin language and declare commands for process-backed runtimes.'),
133
+ ], 'Language runtime evidence failed SDK validation.');
134
+ }
135
+ return gate('plugin-sdk.language-runtime', 'plugin-sdk', [], `Language runtime passed for ${parsed.data.language} through ${parsed.data.bridge}.`);
136
+ }
137
+ function artifactMapGate(value) {
138
+ if (value === undefined) {
139
+ return gate('foundation.artifact-map', 'foundation-architecture', [
140
+ issue('SDK_ARTIFACT_MAP_MISSING', 'fail', 'Plugin artifact map evidence is missing.', 'Attach a typed artifact map before accepting generated or modified project files.'),
141
+ ], 'No artifact map evidence was provided.');
142
+ }
143
+ const sdkParsed = pluginArtifactMapSchema.safeParse(value);
144
+ if (!sdkParsed.success) {
145
+ return gate('foundation.artifact-map', 'foundation-architecture', [
146
+ issue('SDK_ARTIFACT_MAP_INVALID', 'fail', `Artifact map failed SDK validation: ${formatIssues(sdkParsed.error.issues)}`, 'Validate artifact maps with the CodeSDD plugin SDK before Foundation architecture checks run.'),
147
+ ], 'Artifact map failed SDK schema validation.');
148
+ }
149
+ const foundation = validateFoundationArtifactMapArchitecture(sdkParsed.data);
150
+ const issues = foundation.findings.map((finding) => issue(finding.code, 'warn', finding.message, finding.remediation, finding.path));
151
+ return gate('foundation.artifact-map', 'foundation-architecture', issues, `Artifact map contains ${sdkParsed.data.artifacts.length} artifacts; Foundation architecture status is ${foundation.status}.`);
152
+ }
153
+ function agentRuntimeGate(values, requiredProviders) {
154
+ const plansByProvider = new Map();
155
+ const issues = [];
156
+ values.forEach((value, index) => {
157
+ const parsed = agentRuntimeCommandPlanSchema.safeParse(value);
158
+ if (!parsed.success) {
159
+ issues.push(issue('AGENT_RUNTIME_PLAN_INVALID', 'fail', `Agent runtime plan at index ${index} failed validation: ${formatIssues(parsed.error.issues)}`, 'Build agent execution through the Agent Runtime v2 command-plan contract.', `agent_runtime_plans.${index}`));
160
+ return;
161
+ }
162
+ const plan = parsed.data;
163
+ plansByProvider.set(plan.provider, (plansByProvider.get(plan.provider) ?? 0) + 1);
164
+ if (plan.status === 'blocked') {
165
+ issues.push(issue('AGENT_RUNTIME_PLAN_BLOCKED', 'fail', `${plan.provider} plan is blocked: ${plan.reasons.join('; ') || 'no reason provided'}`, 'Resolve runtime policy findings or keep the agent outside executable apply flows.', `agent_runtime_plans.${index}`));
166
+ }
167
+ });
168
+ for (const provider of requiredProviders) {
169
+ if (!plansByProvider.has(provider)) {
170
+ issues.push(issue('AGENT_RUNTIME_PROVIDER_MISSING', 'fail', `Required agent runtime provider ${provider} has no command plan.`, 'Attach command plans for DeepAgents, Codex exec, and OpenCode run before closing agent-runtime coverage.', provider));
171
+ }
172
+ }
173
+ return gate('agent-runtime.v2-command-plans', 'agent-runtime', issues, `Validated ${values.length} agent runtime plans across ${plansByProvider.size} providers.`);
174
+ }
175
+ function pluginComplianceGate(values) {
176
+ const issues = [];
177
+ if (values.length === 0) {
178
+ issues.push(issue('PLUGIN_COMPLIANCE_INDEX_MISSING', 'fail', 'No plugin compliance index was attached.', 'Attach at least one compliance index generated from plugin evidence before accepting plugin quality gates.'));
179
+ }
180
+ values.forEach((value, index) => {
181
+ const parsed = pluginComplianceIndexSchema.safeParse(value);
182
+ if (!parsed.success) {
183
+ issues.push(issue('PLUGIN_COMPLIANCE_INDEX_INVALID', 'fail', `Plugin compliance index at index ${index} failed validation: ${formatIssues(parsed.error.issues)}`, 'Build compliance indexes through the plugin evidence contract.', `plugin_compliance_indexes.${index}`));
184
+ return;
185
+ }
186
+ if (parsed.data.decision === 'non-compliant') {
187
+ issues.push(issue('PLUGIN_COMPLIANCE_NON_COMPLIANT', 'fail', `${parsed.data.plugin_ref.id}@${parsed.data.plugin_ref.version} is non-compliant with score ${parsed.data.score}.`, 'Resolve failing compliance criteria before enabling plugin execution.', `plugin_compliance_indexes.${index}`));
188
+ }
189
+ else if (parsed.data.decision === 'warning') {
190
+ issues.push(issue('PLUGIN_COMPLIANCE_WARNING', 'warn', `${parsed.data.plugin_ref.id}@${parsed.data.plugin_ref.version} has warning compliance with score ${parsed.data.score}.`, 'Record the accepted residual risk or improve plugin evidence before apply modes.', `plugin_compliance_indexes.${index}`));
191
+ }
192
+ });
193
+ return gate('plugin-compliance.indexes', 'plugin-compliance', issues, `Validated ${values.length} plugin compliance indexes.`);
194
+ }
195
+ function coverageGate(scopes, defaultTarget) {
196
+ const issues = [];
197
+ if (scopes.length === 0) {
198
+ issues.push(issue('COVERAGE_SCOPE_MISSING', 'fail', 'No coverage scope evidence was attached.', 'Attach coverage metrics for touched SDK, agent runtime, and plugin modules.'));
199
+ }
200
+ for (const scope of scopes) {
201
+ const target = { ...defaultTarget, ...scope.target };
202
+ for (const metric of COVERAGE_METRICS) {
203
+ const targetValue = target[metric];
204
+ if (targetValue === undefined)
205
+ continue;
206
+ const actual = scope.metrics[metric];
207
+ if (actual === undefined) {
208
+ issues.push(issue('COVERAGE_METRIC_MISSING', 'fail', `Coverage scope ${scope.id} is missing ${metric} coverage.`, `Record ${metric} coverage or remove ${metric} from the scope target.`, scope.id));
209
+ }
210
+ else if (actual < targetValue) {
211
+ issues.push(issue('COVERAGE_TARGET_MISSED', 'fail', `Coverage scope ${scope.id} has ${metric} ${formatPercent(actual)}, below target ${formatPercent(targetValue)}.`, 'Add tests for the touched contract or record a formal CodeSDD exception with compensating controls.', scope.id));
212
+ }
213
+ }
214
+ }
215
+ return gate('coverage.touched-contracts', 'coverage', issues, `Validated ${scopes.length} coverage scopes against touched-contract targets.`);
216
+ }
217
+ function gate(id, domain, issues, evidence) {
218
+ const status = issues.some((item) => item.severity === 'fail')
219
+ ? 'fail'
220
+ : issues.length > 0
221
+ ? 'warn'
222
+ : 'pass';
223
+ return sdkAgentPluginQualityGateSchema.parse({
224
+ id,
225
+ domain,
226
+ status,
227
+ severity: status === 'pass' ? 'info' : status,
228
+ evidence,
229
+ issues,
230
+ });
231
+ }
232
+ function issue(code, severity, message, remediation, path) {
233
+ return sdkAgentPluginQualityGateIssueSchema.parse({
234
+ code,
235
+ severity,
236
+ message,
237
+ remediation,
238
+ path,
239
+ });
240
+ }
241
+ function normalizeJsonSchema(schema, title, description) {
242
+ return {
243
+ ...toJSONSchema(schema),
244
+ $schema: JSON_SCHEMA_DRAFT,
245
+ title,
246
+ description,
247
+ };
248
+ }
249
+ function formatIssues(issues) {
250
+ return issues.map((item) => {
251
+ const issuePath = item.path.length > 0 ? item.path.join('.') : '<root>';
252
+ return `${issuePath}: ${item.message}`;
253
+ }).join('; ');
254
+ }
255
+ function formatPercent(value) {
256
+ return `${value.toFixed(2)} percent`;
257
+ }
258
+ //# sourceMappingURL=sdk-agent-plugin-quality-gates.js.map
@@ -2,18 +2,30 @@ import { type DeepAgentsRuntimeAdapterEnvelope } from '../deepagents/runtime-fac
2
2
  import { type DeepAgentRunEvidence, type DeepAgentRunPlan } from '../deepagents/evidence-mapper.js';
3
3
  import { type DeepAgentsOperationalPreflight } from '../deepagents/policy.js';
4
4
  import type { DeepAgentsRuntimeImporter } from '../deepagents/runtime-loader.js';
5
+ import { type CapabilityInventoryItem, type CapabilityKind } from '../domain/capability-diff.js';
6
+ import type { ChangeSafetyContract, PlannedFileChange } from '../domain/change-safety-guardrails.js';
5
7
  import type { SddStores } from '../store/sdd-stores.js';
8
+ import { type CapabilityDiffServiceResult } from './capability-diff.service.js';
9
+ import { type ChangeSafetyPreflightResult } from './change-safety-preflight.service.js';
10
+ import { type SemanticIntentClassifierServiceResult } from './semantic-intent-classifier.service.js';
6
11
  declare const DEEPAGENTS_RUN_MODES: readonly ["read-only", "plan", "validate", "apply-sandbox", "apply-approved"];
7
12
  export type DeepAgentsRunMode = (typeof DEEPAGENTS_RUN_MODES)[number];
8
13
  export type DeepAgentsRunStatus = 'allowed' | 'blocked';
9
14
  export interface DeepAgentsRunRequest {
10
15
  provider: string;
11
16
  mode?: string;
17
+ objective?: string;
12
18
  plugin_execution_path?: string;
13
19
  plugin_flow?: string[];
14
20
  operations?: string[];
15
21
  write_scope?: string[];
16
22
  planned_writes?: string[];
23
+ change_safety?: ChangeSafetyContract;
24
+ planned_file_changes?: PlannedFileChange[];
25
+ capability_inventory_before?: CapabilityInventoryItem[];
26
+ capability_inventory_after?: CapabilityInventoryItem[];
27
+ capability_inventory_required?: boolean;
28
+ capability_required_kinds?: CapabilityKind[];
17
29
  requested_env?: string[];
18
30
  network_domains?: string[];
19
31
  approval_grants?: string[];
@@ -40,6 +52,24 @@ export interface DeepAgentsRunResult {
40
52
  completed_flow: string[];
41
53
  missing_flow: string[];
42
54
  };
55
+ runtime_skipped?: boolean;
56
+ guardrail_telemetry: {
57
+ contract: 'preflight-telemetry/v1';
58
+ decision: DeepAgentsRunStatus;
59
+ runtime_skipped: boolean;
60
+ status_by_gate: {
61
+ plugin_flow: 'allowed' | 'blocked';
62
+ change_safety?: 'allowed' | 'blocked';
63
+ capability_diff?: 'not_run' | 'none' | 'low' | 'medium' | 'high' | 'critical';
64
+ semantic_intent?: 'not_run' | 'allowed' | 'blocked';
65
+ };
66
+ risk_level?: 'none' | 'low' | 'medium' | 'high' | 'critical';
67
+ semantic_classification?: 'incremental' | 'refactor' | 'replacement' | 'ambiguous';
68
+ override_status?: 'not_required' | 'valid' | 'invalid';
69
+ };
70
+ change_safety?: ChangeSafetyPreflightResult;
71
+ capability_diff?: CapabilityDiffServiceResult;
72
+ semantic_intent?: SemanticIntentClassifierServiceResult;
43
73
  runtime?: {
44
74
  preflight: DeepAgentsOperationalPreflight;
45
75
  adapter: DeepAgentsRuntimeAdapterEnvelope;
@@ -51,13 +81,15 @@ export interface DeepAgentsRunResult {
51
81
  };
52
82
  };
53
83
  }
84
+ export interface DeepAgentsRunServiceOptions {
85
+ projectRoot?: string;
86
+ env?: NodeJS.ProcessEnv;
87
+ stores?: SddStores;
88
+ importer?: DeepAgentsRuntimeImporter;
89
+ skipRuntime?: boolean;
90
+ }
54
91
  export declare class DeepAgentsRunService {
55
- execute(featureId: string, request: DeepAgentsRunRequest, options?: {
56
- projectRoot?: string;
57
- env?: NodeJS.ProcessEnv;
58
- stores?: SddStores;
59
- importer?: DeepAgentsRuntimeImporter;
60
- }): Promise<DeepAgentsRunResult>;
92
+ execute(featureId: string, request: DeepAgentsRunRequest, options?: DeepAgentsRunServiceOptions): Promise<DeepAgentsRunResult>;
61
93
  private executeRuntimePath;
62
94
  private invokeReadyRuntime;
63
95
  }
@@ -2,6 +2,10 @@ import { createDeepAgentsRuntimeAdapter, } from '../deepagents/runtime-factory.j
2
2
  import { createCodeSddDeepAgentsRuntimeTools } from '../deepagents/codesdd-tools.js';
3
3
  import { mapDeepAgentsRunEvidence, mapDeepAgentsRunPlan, } from '../deepagents/evidence-mapper.js';
4
4
  import { buildDeepAgentsOperationalPreflight, createDeepAgentsPolicySnapshot, } from '../deepagents/policy.js';
5
+ import { CAPABILITY_KINDS, } from '../domain/capability-diff.js';
6
+ import { CapabilityDiffService, } from './capability-diff.service.js';
7
+ import { ChangeSafetyPreflightService, } from './change-safety-preflight.service.js';
8
+ import { SemanticIntentClassifierService, } from './semantic-intent-classifier.service.js';
5
9
  const FEATURE_REF_PATTERN = /^FEAT-\d{4}$/;
6
10
  const DEEPAGENTS_RUN_MODES = [
7
11
  'read-only',
@@ -55,7 +59,33 @@ export class DeepAgentsRunService {
55
59
  reasons.push(`Mutation mode '${mode}' requires broker evidence flow: ${requiredPluginFlow.join(', ')}. Missing: ${missingPluginFlow.join(', ')}.`);
56
60
  }
57
61
  }
58
- const runtime = reasons.length === 0
62
+ const plannedFileChanges = resolvePlannedFileChanges(request);
63
+ const changeSafety = DEEPAGENTS_MUTATION_MODES.has(mode)
64
+ ? new ChangeSafetyPreflightService().execute({
65
+ feature_id: featureId,
66
+ change_safety: request.change_safety,
67
+ planned_changes: plannedFileChanges,
68
+ })
69
+ : undefined;
70
+ if (changeSafety?.status === 'blocked') {
71
+ reasons.push(...changeSafety.violations.map((violation) => violation.message));
72
+ }
73
+ const capabilityDiff = resolveCapabilityDiff(request, changeSafety, plannedFileChanges);
74
+ if (DEEPAGENTS_MUTATION_MODES.has(mode) && capabilityDiff?.risk.level === 'critical') {
75
+ reasons.push(`Capability diff deterministic risk is critical: ${capabilityDiff.risk.signals.map((signal) => signal.message).join(' ')}`);
76
+ }
77
+ const semanticIntent = capabilityDiff
78
+ ? new SemanticIntentClassifierService().execute({
79
+ objective: request.objective,
80
+ declared_operation: changeSafety?.operation,
81
+ capability_diff: capabilityDiff.diff,
82
+ deterministic_risk: capabilityDiff.risk,
83
+ })
84
+ : undefined;
85
+ if (semanticIntent?.status === 'blocked') {
86
+ reasons.push(...semanticIntent.reasons);
87
+ }
88
+ const runtime = reasons.length === 0 && options.skipRuntime !== true
59
89
  ? await this.executeRuntimePath(featureId, mode, runId, request, operations, options)
60
90
  : undefined;
61
91
  if (runtime?.adapter.status === 'blocked' && runtime.adapter.runtime !== 'disabled') {
@@ -87,6 +117,24 @@ export class DeepAgentsRunService {
87
117
  completed_flow: completedPluginFlow,
88
118
  missing_flow: missingPluginFlow,
89
119
  },
120
+ runtime_skipped: options.skipRuntime === true,
121
+ guardrail_telemetry: {
122
+ contract: 'preflight-telemetry/v1',
123
+ decision: status,
124
+ runtime_skipped: options.skipRuntime === true,
125
+ status_by_gate: {
126
+ plugin_flow: missingPluginFlow.length === 0 && pluginExecutionPath === 'broker' ? 'allowed' : 'blocked',
127
+ change_safety: changeSafety?.status,
128
+ capability_diff: capabilityDiff?.risk.level ?? 'not_run',
129
+ semantic_intent: semanticIntent?.status ?? 'not_run',
130
+ },
131
+ risk_level: capabilityDiff?.risk.level,
132
+ semantic_classification: semanticIntent?.classification,
133
+ override_status: changeSafety?.governed_override.status,
134
+ },
135
+ change_safety: changeSafety,
136
+ capability_diff: capabilityDiff,
137
+ semantic_intent: semanticIntent,
90
138
  runtime,
91
139
  },
92
140
  };
@@ -170,6 +218,30 @@ function normalizeFlow(flow) {
170
218
  function normalizeList(values) {
171
219
  return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))].sort();
172
220
  }
221
+ function resolvePlannedFileChanges(request) {
222
+ if (request.planned_file_changes) {
223
+ return request.planned_file_changes;
224
+ }
225
+ return normalizeList(request.planned_writes ?? []).map((plannedWrite) => ({
226
+ path: plannedWrite,
227
+ operation: 'modify',
228
+ }));
229
+ }
230
+ function resolveCapabilityDiff(request, changeSafety, plannedChanges) {
231
+ const hasInventory = Boolean(request.capability_inventory_before || request.capability_inventory_after);
232
+ if (!hasInventory && !request.capability_inventory_required) {
233
+ return undefined;
234
+ }
235
+ return new CapabilityDiffService().execute({
236
+ before: request.capability_inventory_before ?? [],
237
+ after: request.capability_inventory_after ?? [],
238
+ change_safety: changeSafety,
239
+ planned_changes: plannedChanges,
240
+ required_kinds: request.capability_inventory_required
241
+ ? request.capability_required_kinds ?? [...CAPABILITY_KINDS]
242
+ : request.capability_required_kinds,
243
+ });
244
+ }
173
245
  function resolveOperations(operations, modeRequested) {
174
246
  const normalized = normalizeFlow(operations ?? []);
175
247
  const candidates = normalized.length > 0
@@ -0,0 +1,17 @@
1
+ export type ArchiveQualityCoherenceIssueCode = 'ACCEPTANCE_NOT_MET_WITH_Q95_PASS' | 'OPEN_RISK_WITH_Q95_PASS' | 'PLACEHOLDER_EVIDENCE_WITH_Q95_PASS' | 'GENERIC_EVIDENCE_WITH_Q95_PASS';
2
+ export interface ArchiveQualityCoherenceIssue {
3
+ featureId: string;
4
+ qualityPath: string;
5
+ issueCode: ArchiveQualityCoherenceIssueCode;
6
+ message: string;
7
+ }
8
+ export interface ArchiveQualityCoherenceReport {
9
+ scanned: number;
10
+ analyzed: number;
11
+ grandfathered: number;
12
+ issues: ArchiveQualityCoherenceIssue[];
13
+ }
14
+ export declare function scanArchiveQualityCoherence(archivedDir: string, options?: {
15
+ grandfatherMaxFeat?: number;
16
+ }): Promise<ArchiveQualityCoherenceReport>;
17
+ //# sourceMappingURL=archive-quality-coherence.service.d.ts.map