@devtrack-solution/codesdd 1.2.2 → 1.2.4-rc3

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 (413) hide show
  1. package/.sdd/skills/curated/api-clean-flask-langgraph/SKILL.md +17 -17
  2. package/.sdd/skills/curated/devtrack-api/SKILL.md +170 -31
  3. package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +8 -0
  4. package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +8 -0
  5. package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +8 -0
  6. package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +8 -0
  7. package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +8 -0
  8. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +4 -2
  9. package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +10 -0
  10. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +2 -2
  11. package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +8 -7
  12. package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +93 -0
  13. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +372 -0
  14. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +13 -13
  15. package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +95 -0
  16. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +294 -0
  17. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +5 -5
  18. package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +4 -0
  19. package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +41 -0
  20. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +2 -2
  21. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +7 -9
  22. package/LICENSE +1 -1
  23. package/README.md +399 -53
  24. package/bin/codesdd.js +3 -2
  25. package/dist/applications/sdd/index.d.ts +16 -0
  26. package/dist/applications/sdd/index.js +16 -0
  27. package/dist/cli/index.d.ts +2 -2
  28. package/dist/cli/index.js +11 -558
  29. package/dist/cli/program.d.ts +14 -0
  30. package/dist/cli/program.js +645 -0
  31. package/dist/commands/change.js +5 -5
  32. package/dist/commands/completion.d.ts +1 -1
  33. package/dist/commands/completion.js +9 -2
  34. package/dist/commands/config.js +320 -20
  35. package/dist/commands/feedback.js +1 -1
  36. package/dist/commands/schema.d.ts +63 -0
  37. package/dist/commands/schema.js +12 -12
  38. package/dist/commands/sdd/backlog.d.ts +3 -0
  39. package/dist/commands/sdd/backlog.js +54 -0
  40. package/dist/commands/sdd/execution.js +489 -28
  41. package/dist/commands/sdd/plugin.d.ts +3 -0
  42. package/dist/commands/sdd/plugin.js +158 -0
  43. package/dist/commands/sdd/shared.d.ts +1 -0
  44. package/dist/commands/sdd/shared.js +11 -22
  45. package/dist/commands/sdd/skills.js +7 -0
  46. package/dist/commands/sdd.js +107 -15
  47. package/dist/commands/spec.js +9 -9
  48. package/dist/commands/validate.js +6 -6
  49. package/dist/commands/workflow/instructions.js +6 -6
  50. package/dist/commands/workflow/new-change.js +3 -3
  51. package/dist/commands/workflow/shared.d.ts +1 -1
  52. package/dist/commands/workflow/shared.js +4 -4
  53. package/dist/core/archive.js +15 -5
  54. package/dist/core/artifact-graph/instruction-loader.d.ts +1 -1
  55. package/dist/core/artifact-graph/instruction-loader.js +3 -3
  56. package/dist/core/artifact-graph/resolver.d.ts +4 -4
  57. package/dist/core/artifact-graph/resolver.js +6 -6
  58. package/dist/core/branding.js +3 -3
  59. package/dist/core/cli/command-matrix.js +19 -1
  60. package/dist/core/cli-command-quality.d.ts +27 -0
  61. package/dist/core/cli-command-quality.js +180 -0
  62. package/dist/core/command-generation/adapters/costrict.d.ts +1 -1
  63. package/dist/core/command-generation/adapters/costrict.js +2 -2
  64. package/dist/core/command-generation/types.d.ts +1 -1
  65. package/dist/core/completions/command-registry.d.ts +1 -1
  66. package/dist/core/completions/command-registry.js +200 -12
  67. package/dist/core/completions/completion-provider.d.ts +14 -1
  68. package/dist/core/completions/completion-provider.js +29 -1
  69. package/dist/core/completions/generators/bash-generator.d.ts +1 -1
  70. package/dist/core/completions/generators/bash-generator.js +20 -12
  71. package/dist/core/completions/generators/fish-generator.d.ts +9 -1
  72. package/dist/core/completions/generators/fish-generator.js +39 -25
  73. package/dist/core/completions/generators/powershell-generator.d.ts +1 -1
  74. package/dist/core/completions/generators/powershell-generator.js +21 -11
  75. package/dist/core/completions/generators/zsh-generator.d.ts +3 -6
  76. package/dist/core/completions/generators/zsh-generator.js +21 -42
  77. package/dist/core/completions/installers/bash-installer.js +6 -6
  78. package/dist/core/completions/installers/fish-installer.js +1 -1
  79. package/dist/core/completions/installers/powershell-installer.js +14 -14
  80. package/dist/core/completions/installers/zsh-installer.d.ts +7 -1
  81. package/dist/core/completions/installers/zsh-installer.js +36 -8
  82. package/dist/core/completions/templates/bash-templates.d.ts +1 -1
  83. package/dist/core/completions/templates/bash-templates.js +12 -6
  84. package/dist/core/completions/templates/fish-templates.d.ts +2 -2
  85. package/dist/core/completions/templates/fish-templates.js +20 -9
  86. package/dist/core/completions/templates/powershell-templates.d.ts +1 -1
  87. package/dist/core/completions/templates/powershell-templates.js +13 -4
  88. package/dist/core/completions/templates/zsh-templates.d.ts +1 -1
  89. package/dist/core/completions/templates/zsh-templates.js +18 -9
  90. package/dist/core/config-schema.d.ts +20 -1
  91. package/dist/core/config-schema.js +70 -2
  92. package/dist/core/config.d.ts +3 -3
  93. package/dist/core/config.js +4 -4
  94. package/dist/core/global-config.d.ts +57 -12
  95. package/dist/core/global-config.js +344 -27
  96. package/dist/core/index.d.ts +1 -1
  97. package/dist/core/index.js +2 -2
  98. package/dist/core/init.d.ts +6 -1
  99. package/dist/core/init.js +99 -77
  100. package/dist/core/legacy-cleanup.d.ts +17 -17
  101. package/dist/core/legacy-cleanup.js +96 -79
  102. package/dist/core/list.js +18 -4
  103. package/dist/core/migration.d.ts +3 -1
  104. package/dist/core/migration.js +7 -8
  105. package/dist/core/parsers/change-parser.js +1 -1
  106. package/dist/core/parsers/markdown-parser.js +2 -2
  107. package/dist/core/profile-sync-drift.d.ts +1 -1
  108. package/dist/core/profile-sync-drift.js +13 -13
  109. package/dist/core/project-config.d.ts +4 -4
  110. package/dist/core/project-config.js +11 -11
  111. package/dist/core/schemas/change.schema.d.ts +1 -1
  112. package/dist/core/schemas/change.schema.js +1 -1
  113. package/dist/core/schemas/spec.schema.d.ts +1 -1
  114. package/dist/core/schemas/spec.schema.js +1 -1
  115. package/dist/core/sdd/adr.js +23 -1
  116. package/dist/core/sdd/agent-binding.d.ts +346 -0
  117. package/dist/core/sdd/agent-binding.js +343 -0
  118. package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
  119. package/dist/core/sdd/agent-runtime-contract.js +200 -0
  120. package/dist/core/sdd/backlog-cli.d.ts +16 -0
  121. package/dist/core/sdd/backlog-cli.js +146 -0
  122. package/dist/core/sdd/backlog-conflict-policy.d.ts +58 -0
  123. package/dist/core/sdd/backlog-conflict-policy.js +230 -0
  124. package/dist/core/sdd/backlog-projection.d.ts +8 -0
  125. package/dist/core/sdd/backlog-projection.js +89 -0
  126. package/dist/core/sdd/backlog-provider-contract.d.ts +252 -0
  127. package/dist/core/sdd/backlog-provider-contract.js +158 -0
  128. package/dist/core/sdd/bootstrap.js +2 -2
  129. package/dist/core/sdd/check.d.ts +44 -0
  130. package/dist/core/sdd/check.js +62 -24
  131. package/dist/core/sdd/contract.d.ts +13 -0
  132. package/dist/core/sdd/contract.js +36 -0
  133. package/dist/core/sdd/coordination/coordination-adapters.d.ts +53 -8
  134. package/dist/core/sdd/coordination/coordination-adapters.js +182 -16
  135. package/dist/core/sdd/coordination/index.d.ts +1 -0
  136. package/dist/core/sdd/coordination/index.js +1 -0
  137. package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
  138. package/dist/core/sdd/coordination/redis-runtime.js +698 -0
  139. package/dist/core/sdd/deepagent-contracts.d.ts +370 -0
  140. package/dist/core/sdd/deepagent-contracts.js +235 -0
  141. package/dist/core/sdd/deepagents/adr-governor.d.ts +2 -0
  142. package/dist/core/sdd/deepagents/adr-governor.js +30 -0
  143. package/dist/core/sdd/deepagents/backend.d.ts +63 -0
  144. package/dist/core/sdd/deepagents/backend.js +174 -0
  145. package/dist/core/sdd/deepagents/codesdd-tools.d.ts +39 -0
  146. package/dist/core/sdd/deepagents/codesdd-tools.js +83 -0
  147. package/dist/core/sdd/deepagents/evidence-mapper.d.ts +86 -0
  148. package/dist/core/sdd/deepagents/evidence-mapper.js +178 -0
  149. package/dist/core/sdd/deepagents/model-provider.d.ts +53 -0
  150. package/dist/core/sdd/deepagents/model-provider.js +379 -0
  151. package/dist/core/sdd/deepagents/policy-enforcement.d.ts +30 -0
  152. package/dist/core/sdd/deepagents/policy-enforcement.js +90 -0
  153. package/dist/core/sdd/deepagents/policy.d.ts +75 -0
  154. package/dist/core/sdd/deepagents/policy.js +358 -0
  155. package/dist/core/sdd/deepagents/quality-witness.d.ts +3 -0
  156. package/dist/core/sdd/deepagents/quality-witness.js +77 -0
  157. package/dist/core/sdd/deepagents/reversa-subagents.d.ts +75 -0
  158. package/dist/core/sdd/deepagents/reversa-subagents.js +182 -0
  159. package/dist/core/sdd/deepagents/runtime-factory.d.ts +90 -0
  160. package/dist/core/sdd/deepagents/runtime-factory.js +231 -0
  161. package/dist/core/sdd/deepagents/runtime-loader.d.ts +16 -0
  162. package/dist/core/sdd/deepagents/runtime-loader.js +65 -0
  163. package/dist/core/sdd/default-bootstrap-files.d.ts +3 -3
  164. package/dist/core/sdd/default-bootstrap-files.js +50 -10
  165. package/dist/core/sdd/default-skills.d.ts +30 -0
  166. package/dist/core/sdd/default-skills.js +288 -8
  167. package/dist/core/sdd/devtrack-api-appliance.d.ts +91 -0
  168. package/dist/core/sdd/devtrack-api-appliance.js +280 -0
  169. package/dist/core/sdd/devtrack-api-architecture.d.ts +31 -0
  170. package/dist/core/sdd/devtrack-api-architecture.js +608 -0
  171. package/dist/core/sdd/devtrack-api-import-boundary.d.ts +19 -0
  172. package/dist/core/sdd/devtrack-api-import-boundary.js +32 -0
  173. package/dist/core/sdd/diagnose.d.ts +59 -0
  174. package/dist/core/sdd/diagnose.js +37 -37
  175. package/dist/core/sdd/docs-sync.js +54 -20
  176. package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
  177. package/dist/core/sdd/domain/capability-diff.js +200 -0
  178. package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
  179. package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
  180. package/dist/core/sdd/domain/post-active-validation.d.ts +7 -0
  181. package/dist/core/sdd/domain/post-active-validation.js +61 -0
  182. package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
  183. package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
  184. package/dist/core/sdd/domain/transition-engine.js +1 -0
  185. package/dist/core/sdd/entity-reference.d.ts +5 -0
  186. package/dist/core/sdd/entity-reference.js +22 -0
  187. package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
  188. package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
  189. package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
  190. package/dist/core/sdd/foundation-layer-manifest.js +117 -0
  191. package/dist/core/sdd/governance-backfill.d.ts +31 -0
  192. package/dist/core/sdd/governance-backfill.js +359 -0
  193. package/dist/core/sdd/governance-parser.d.ts +21 -0
  194. package/dist/core/sdd/governance-parser.js +91 -0
  195. package/dist/core/sdd/governance-schemas.d.ts +245 -0
  196. package/dist/core/sdd/governance-schemas.js +143 -0
  197. package/dist/core/sdd/{import-openspec.d.ts → import-legacy-spec.d.ts} +7 -7
  198. package/dist/core/sdd/{import-openspec.js → import-legacy-spec.js} +21 -29
  199. package/dist/core/sdd/init.d.ts +3 -0
  200. package/dist/core/sdd/init.js +6 -3
  201. package/dist/core/sdd/intent-guard.d.ts +22 -0
  202. package/dist/core/sdd/intent-guard.js +67 -0
  203. package/dist/core/sdd/json-schema.js +108 -6
  204. package/dist/core/sdd/knowledge-graph.d.ts +45 -0
  205. package/dist/core/sdd/knowledge-graph.js +288 -0
  206. package/dist/core/sdd/legacy-operations.js +507 -44
  207. package/dist/core/sdd/lenses.d.ts +1 -0
  208. package/dist/core/sdd/lenses.js +29 -1
  209. package/dist/core/sdd/migrate-workspace.js +95 -2
  210. package/dist/core/sdd/migrate.d.ts +1 -1
  211. package/dist/core/sdd/migrate.js +36 -2
  212. package/dist/core/sdd/package-security-gates.d.ts +21 -0
  213. package/dist/core/sdd/package-security-gates.js +119 -0
  214. package/dist/core/sdd/package-structure-gate.d.ts +83 -0
  215. package/dist/core/sdd/package-structure-gate.js +357 -0
  216. package/dist/core/sdd/parallel-feat-automation.d.ts +330 -0
  217. package/dist/core/sdd/parallel-feat-automation.js +424 -0
  218. package/dist/core/sdd/plugin-broker.d.ts +777 -0
  219. package/dist/core/sdd/plugin-broker.js +492 -0
  220. package/dist/core/sdd/plugin-certification.d.ts +79 -0
  221. package/dist/core/sdd/plugin-certification.js +453 -0
  222. package/dist/core/sdd/plugin-cli.d.ts +139 -0
  223. package/dist/core/sdd/plugin-cli.js +265 -0
  224. package/dist/core/sdd/plugin-evidence.d.ts +348 -0
  225. package/dist/core/sdd/plugin-evidence.js +307 -0
  226. package/dist/core/sdd/plugin-manifest.d.ts +232 -0
  227. package/dist/core/sdd/plugin-manifest.js +225 -0
  228. package/dist/core/sdd/plugin-policy-pack.d.ts +88 -0
  229. package/dist/core/sdd/plugin-policy-pack.js +236 -0
  230. package/dist/core/sdd/plugin-policy.d.ts +68 -0
  231. package/dist/core/sdd/plugin-policy.js +212 -0
  232. package/dist/core/sdd/plugin-registry.d.ts +447 -0
  233. package/dist/core/sdd/plugin-registry.js +138 -0
  234. package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
  235. package/dist/core/sdd/plugin-sdk-contract.js +268 -0
  236. package/dist/core/sdd/plugin-skill-binding.d.ts +151 -0
  237. package/dist/core/sdd/plugin-skill-binding.js +339 -0
  238. package/dist/core/sdd/quality-artifact-manifest-validator.d.ts +28 -0
  239. package/dist/core/sdd/quality-artifact-manifest-validator.js +167 -0
  240. package/dist/core/sdd/quality-evidence-renderer.d.ts +65 -0
  241. package/dist/core/sdd/quality-evidence-renderer.js +218 -0
  242. package/dist/core/sdd/quality-scenario-runner.d.ts +42 -0
  243. package/dist/core/sdd/quality-scenario-runner.js +613 -0
  244. package/dist/core/sdd/quality-validation.d.ts +620 -0
  245. package/dist/core/sdd/quality-validation.js +239 -0
  246. package/dist/core/sdd/release-readiness.d.ts +19 -0
  247. package/dist/core/sdd/release-readiness.js +472 -0
  248. package/dist/core/sdd/resolve-project-root.d.ts +2 -2
  249. package/dist/core/sdd/resolve-project-root.js +11 -5
  250. package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
  251. package/dist/core/sdd/runtime-boundary-contract.js +90 -0
  252. package/dist/core/sdd/sanitize.d.ts +30 -1
  253. package/dist/core/sdd/sanitize.js +23 -23
  254. package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
  255. package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
  256. package/dist/core/sdd/services/agent-run.service.d.ts +97 -0
  257. package/dist/core/sdd/services/agent-run.service.js +261 -0
  258. package/dist/core/sdd/services/breakdown.service.js +2 -1
  259. package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
  260. package/dist/core/sdd/services/capability-diff.service.js +26 -0
  261. package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
  262. package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
  263. package/dist/core/sdd/services/context.service.d.ts +43 -340
  264. package/dist/core/sdd/services/context.service.js +341 -25
  265. package/dist/core/sdd/services/debate.service.js +15 -2
  266. package/dist/core/sdd/services/feature-lint.service.d.ts +22 -0
  267. package/dist/core/sdd/services/feature-lint.service.js +105 -5
  268. package/dist/core/sdd/services/finalize.service.d.ts +105 -0
  269. package/dist/core/sdd/services/finalize.service.js +499 -38
  270. package/dist/core/sdd/services/frontend-gap.service.js +22 -7
  271. package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
  272. package/dist/core/sdd/services/governance-control-plane-runtime-adapters.d.ts +17 -0
  273. package/dist/core/sdd/services/governance-control-plane-runtime-adapters.js +38 -0
  274. package/dist/core/sdd/services/governance-control-plane.service.d.ts +66 -0
  275. package/dist/core/sdd/services/governance-control-plane.service.js +134 -0
  276. package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
  277. package/dist/core/sdd/services/legacy-capability.service.d.ts +10 -7
  278. package/dist/core/sdd/services/legacy-capability.service.js +38 -21
  279. package/dist/core/sdd/services/mcp-runtime.service.d.ts +123 -8
  280. package/dist/core/sdd/services/mcp-runtime.service.js +1085 -33
  281. package/dist/core/sdd/services/onboard.service.js +2 -1
  282. package/dist/core/sdd/services/rebuild.service.js +6 -1
  283. package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
  284. package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
  285. package/dist/core/sdd/services/skills-sync.service.d.ts +17 -5
  286. package/dist/core/sdd/services/skills-sync.service.js +55 -2
  287. package/dist/core/sdd/services/start.service.js +6 -4
  288. package/dist/core/sdd/skill-bundles-curation-schema.d.ts +66 -0
  289. package/dist/core/sdd/skill-bundles-curation-schema.js +52 -0
  290. package/dist/core/sdd/skill-evidence.d.ts +19 -0
  291. package/dist/core/sdd/skill-evidence.js +38 -0
  292. package/dist/core/sdd/skill-policy-pool.d.ts +46 -0
  293. package/dist/core/sdd/skill-policy-pool.js +185 -0
  294. package/dist/core/sdd/state.d.ts +23 -0
  295. package/dist/core/sdd/state.js +313 -66
  296. package/dist/core/sdd/store/sdd-stores.js +2 -2
  297. package/dist/core/sdd/structural-health.d.ts +55 -55
  298. package/dist/core/sdd/types.d.ts +60 -19
  299. package/dist/core/sdd/types.js +21 -0
  300. package/dist/core/sdd/upgrade-to-codesdd.d.ts +45 -0
  301. package/dist/core/sdd/upgrade-to-codesdd.js +179 -0
  302. package/dist/core/sdd/views.js +17 -0
  303. package/dist/core/sdd/workspace-schemas.d.ts +670 -19
  304. package/dist/core/sdd/workspace-schemas.js +285 -5
  305. package/dist/core/sdd/write-manifest.js +22 -4
  306. package/dist/core/shared/skill-generation.d.ts +1 -1
  307. package/dist/core/shared/skill-generation.js +15 -15
  308. package/dist/core/shared/tool-detection.d.ts +3 -3
  309. package/dist/core/shared/tool-detection.js +14 -14
  310. package/dist/core/specs-apply.js +6 -6
  311. package/dist/core/templates/index.d.ts +1 -1
  312. package/dist/core/templates/index.js +1 -1
  313. package/dist/core/templates/workflows/apply-change.js +14 -14
  314. package/dist/core/templates/workflows/archive-change.js +32 -32
  315. package/dist/core/templates/workflows/bulk-archive-change.js +25 -25
  316. package/dist/core/templates/workflows/continue-change.js +12 -12
  317. package/dist/core/templates/workflows/explore.js +29 -29
  318. package/dist/core/templates/workflows/feedback.js +6 -6
  319. package/dist/core/templates/workflows/ff-change.js +24 -24
  320. package/dist/core/templates/workflows/new-change.js +20 -20
  321. package/dist/core/templates/workflows/onboard.js +33 -33
  322. package/dist/core/templates/workflows/propose.js +23 -23
  323. package/dist/core/templates/workflows/sdd.js +8 -8
  324. package/dist/core/templates/workflows/sync-specs.js +19 -19
  325. package/dist/core/templates/workflows/verify-change.js +17 -17
  326. package/dist/core/update.d.ts +2 -2
  327. package/dist/core/update.js +16 -15
  328. package/dist/core/validation/constants.d.ts +1 -1
  329. package/dist/core/validation/constants.js +1 -1
  330. package/dist/core/view.js +11 -11
  331. package/dist/domains/sdd/index.d.ts +6 -0
  332. package/dist/domains/sdd/index.js +6 -0
  333. package/dist/infrastructures/sdd/index.d.ts +7 -0
  334. package/dist/infrastructures/sdd/index.js +6 -0
  335. package/dist/presentations/cli/sdd/index.d.ts +3 -0
  336. package/dist/presentations/cli/sdd/index.js +3 -0
  337. package/dist/shared/sdd/index.d.ts +3 -0
  338. package/dist/shared/sdd/index.js +2 -0
  339. package/dist/telemetry/config.d.ts +2 -1
  340. package/dist/telemetry/config.js +17 -8
  341. package/dist/telemetry/index.d.ts +10 -2
  342. package/dist/telemetry/index.js +40 -7
  343. package/dist/ui/ascii-patterns.d.ts +2 -2
  344. package/dist/ui/ascii-patterns.js +2 -2
  345. package/dist/ui/welcome-screen.js +2 -2
  346. package/dist/utils/change-metadata.d.ts +4 -4
  347. package/dist/utils/change-metadata.js +6 -6
  348. package/dist/utils/change-utils.d.ts +3 -3
  349. package/dist/utils/change-utils.js +5 -5
  350. package/dist/utils/file-system.js +1 -1
  351. package/dist/utils/interactive.js +1 -1
  352. package/dist/utils/item-discovery.js +4 -4
  353. package/dist/utils/legacy-spec-compat.d.ts +2 -0
  354. package/dist/utils/legacy-spec-compat.js +2 -0
  355. package/dist/utils/shell-detection.d.ts +1 -0
  356. package/dist/utils/shell-detection.js +16 -0
  357. package/package.json +34 -21
  358. package/schemas/sdd/1-spec.schema.json +1 -1
  359. package/schemas/sdd/2-plan.schema.json +280 -3
  360. package/schemas/sdd/3-tasks.schema.json +73 -1
  361. package/schemas/sdd/4-changelog.schema.json +1 -1
  362. package/schemas/sdd/5-quality.schema.json +701 -5
  363. package/schemas/sdd/adr.schema.json +148 -0
  364. package/schemas/sdd/agent-binding-adapter.schema.json +210 -0
  365. package/schemas/sdd/agent-binding-resolution.schema.json +338 -0
  366. package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
  367. package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
  368. package/schemas/sdd/backlog-projection-plan.schema.json +180 -0
  369. package/schemas/sdd/backlog-provider-contract.schema.json +260 -0
  370. package/schemas/sdd/codesdd-plugin.schema.json +645 -0
  371. package/schemas/sdd/debate.schema.json +244 -0
  372. package/schemas/sdd/deepagent-decision-evidence.schema.json +58 -0
  373. package/schemas/sdd/deepagent-env-contract.schema.json +143 -0
  374. package/schemas/sdd/deepagent-quality-evidence.schema.json +108 -0
  375. package/schemas/sdd/deepagent-run-evidence.schema.json +192 -0
  376. package/schemas/sdd/deepagent-run-plan.schema.json +197 -0
  377. package/schemas/sdd/deepagent-run-request.schema.json +637 -0
  378. package/schemas/sdd/deepagent-subagent-evidence.schema.json +110 -0
  379. package/schemas/sdd/deepagent-tool-call-evidence.schema.json +78 -0
  380. package/schemas/sdd/discarded.schema.json +127 -0
  381. package/schemas/sdd/epic.schema.json +147 -0
  382. package/schemas/sdd/insight.schema.json +136 -0
  383. package/schemas/sdd/parallel-feat-automation-plan.schema.json +304 -0
  384. package/schemas/sdd/parallel-feat-automation-request.schema.json +109 -0
  385. package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
  386. package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
  387. package/schemas/sdd/plugin-artifact-manifest.schema.json +259 -0
  388. package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
  389. package/schemas/sdd/plugin-compliance-index.schema.json +136 -0
  390. package/schemas/sdd/plugin-dry-run-plan.schema.json +260 -0
  391. package/schemas/sdd/plugin-evidence-manifest.schema.json +678 -0
  392. package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
  393. package/schemas/sdd/plugin-package-governance.schema.json +74 -0
  394. package/schemas/sdd/plugin-policy-evaluation.schema.json +92 -0
  395. package/schemas/sdd/plugin-policy-pack-evaluation.schema.json +94 -0
  396. package/schemas/sdd/plugin-policy-pack.schema.json +196 -0
  397. package/schemas/sdd/plugin-registry.schema.json +729 -0
  398. package/schemas/sdd/plugin-rollback-manifest.schema.json +87 -0
  399. package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +954 -0
  400. package/schemas/sdd/plugin-skill-binding-resolution.schema.json +305 -0
  401. package/schemas/sdd/plugin-skill-binding.schema.json +88 -0
  402. package/schemas/sdd/plugin-validation-manifest.schema.json +123 -0
  403. package/schemas/sdd/quality-architecture-schema.schema.json +216 -0
  404. package/schemas/sdd/quality-evidence-bundle.schema.json +1337 -0
  405. package/schemas/sdd/quality-run.schema.json +197 -0
  406. package/schemas/sdd/quality-scenario.schema.json +252 -0
  407. package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
  408. package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
  409. package/schemas/sdd/workspace-catalog.schema.json +13232 -35
  410. package/schemas/spec-driven/schema.yaml +4 -4
  411. package/schemas/spec-driven/templates/proposal.md +1 -1
  412. package/dist/utils/openspec-compat.d.ts +0 -2
  413. package/dist/utils/openspec-compat.js +0 -2
@@ -7,13 +7,17 @@ import { promisify } from 'node:util';
7
7
  import * as yaml from 'yaml';
8
8
  import { CLI_NAME } from '../branding.js';
9
9
  import { LENSES, validateDocumentAgainstLens } from './lenses.js';
10
+ import { detectSddEntityType, normalizeFeatRef } from './entity-reference.js';
10
11
  import { TransitionEngine } from './domain/transition-engine.js';
11
- import { resolveOpenSpecSubpath } from './services/legacy-capability.service.js';
12
+ import { resolveLegacySpecSubpath } from './services/legacy-capability.service.js';
12
13
  import { allocateEntityId, loadProjectSddConfig, loadStateSnapshot, nowIso, resolveSddPaths, } from './state.js';
13
14
  import { BUILT_IN_SDD_SKILLS } from './default-skills.js';
14
15
  import { renderViews } from './views.js';
15
16
  import { normalizeSemanticText } from './dedup.js';
17
+ import { buildWorkspacePolicyInjection } from './skill-policy-pool.js';
16
18
  import { stringifyWorkspaceYamlDocument } from './workspace-schemas.js';
19
+ import { parseGovernanceFile } from './governance-parser.js';
20
+ import { debateFrontmatterSchema } from './governance-schemas.js';
17
21
  export const execFileAsync = promisify(execFile);
18
22
  export const RADAR_TO_DISCOVERY_STATUS = {
19
23
  READY: 'READY',
@@ -55,7 +59,70 @@ export function findDiscoveryRecord(records, id) {
55
59
  }
56
60
  export function markdownDebateTemplate(insight, debateId) {
57
61
  const now = nowIso();
58
- return `# Debate ${debateId}
62
+ const frontmatter = yaml
63
+ .stringify({
64
+ schema_version: 1,
65
+ artifact_type: 'DEB',
66
+ id: debateId,
67
+ title: `Debate ${debateId}: ${insight.title}`,
68
+ status: 'OPEN',
69
+ origin: {
70
+ type: 'insight',
71
+ ref: insight.id,
72
+ },
73
+ related_ids: [insight.id],
74
+ created_at: now,
75
+ updated_at: now,
76
+ decision: {
77
+ question: 'Decide ____ instead of ____ to solve ____.',
78
+ options: [
79
+ { id: 'A', label: 'Option A' },
80
+ { id: 'B', label: 'Option B' },
81
+ { id: 'C', label: 'Option C' },
82
+ ],
83
+ criteria: ['User impact', 'Implementation complexity', 'Technical risk', 'Operational cost', 'Delivery time'],
84
+ scoring: [
85
+ {
86
+ criterion: 'User impact',
87
+ weight: 3,
88
+ scores: { A: 0, B: 0, C: 0 },
89
+ },
90
+ {
91
+ criterion: 'Implementation complexity',
92
+ weight: 2,
93
+ scores: { A: 0, B: 0, C: 0 },
94
+ },
95
+ {
96
+ criterion: 'Technical risk',
97
+ weight: 3,
98
+ scores: { A: 0, B: 0, C: 0 },
99
+ },
100
+ {
101
+ criterion: 'Operational cost',
102
+ weight: 2,
103
+ scores: { A: 0, B: 0, C: 0 },
104
+ },
105
+ {
106
+ criterion: 'Delivery time',
107
+ weight: 2,
108
+ scores: { A: 0, B: 0, C: 0 },
109
+ },
110
+ ],
111
+ mediator: {
112
+ choice: 'A',
113
+ rationale: '____',
114
+ accepted_risks: [],
115
+ reversal_conditions: [],
116
+ },
117
+ output: 'APPROVED',
118
+ },
119
+ })
120
+ .trim();
121
+ return `---
122
+ ${frontmatter}
123
+ ---
124
+
125
+ # Debate ${debateId}
59
126
 
60
127
  ## 1) Decision Question (Required)
61
128
  Decide ____ instead of ____ to solve ____.
@@ -135,7 +202,25 @@ Decide ____ instead of ____ to solve ____.
135
202
  `;
136
203
  }
137
204
  export function markdownInsightTemplate(id, title, text) {
138
- return `# Insight ${id}
205
+ const now = nowIso();
206
+ const frontmatter = yaml
207
+ .stringify({
208
+ schema_version: 1,
209
+ artifact_type: 'INS',
210
+ id,
211
+ title,
212
+ status: 'NEW',
213
+ origin: { type: 'user_prompt' },
214
+ related_ids: [],
215
+ created_at: now,
216
+ updated_at: now,
217
+ })
218
+ .trim();
219
+ return `---
220
+ ${frontmatter}
221
+ ---
222
+
223
+ # Insight ${id}
139
224
 
140
225
  ## Title
141
226
  ${title}
@@ -145,14 +230,44 @@ ${text}
145
230
  `;
146
231
  }
147
232
  export function markdownRadarTemplate(debate, radarId, rationale) {
148
- return `# Epic ${radarId}
233
+ const now = nowIso();
234
+ const summary = rationale || 'Approved summary pending explicit expansion from the source debate.';
235
+ const frontmatter = yaml
236
+ .stringify({
237
+ schema_version: 1,
238
+ artifact_type: 'EPIC',
239
+ id: radarId,
240
+ title: debate.title,
241
+ status: 'READY',
242
+ origin: { type: 'debate', ref: debate.id },
243
+ related_ids: [debate.id],
244
+ created_at: now,
245
+ updated_at: now,
246
+ approved_summary: summary,
247
+ quality_contract: {
248
+ scope: 'touched_scope',
249
+ unit_target_percent: 95,
250
+ integration_target_percent: 95,
251
+ evidence_mode: 'hybrid',
252
+ },
253
+ lock_domains: [],
254
+ produces: [],
255
+ consumes: [],
256
+ breakdown_policy: 'graph',
257
+ })
258
+ .trim();
259
+ return `---
260
+ ${frontmatter}
261
+ ---
262
+
263
+ # Epic ${radarId}
149
264
 
150
265
  ## Origin
151
266
  - Debate: ${debate.id}
152
267
  - Base title: ${debate.title}
153
268
 
154
269
  ## Approved Summary
155
- ${rationale || 'Approved summary pending explicit expansion from the source debate.'}
270
+ ${summary}
156
271
 
157
272
  ## Quality Contract
158
273
  - Default scope: touched_scope.
@@ -166,14 +281,44 @@ READY
166
281
  `;
167
282
  }
168
283
  export function markdownRadarFromDepositoTemplate(radarId, title, sourceCount, rationale) {
169
- return `# Epic ${radarId}
284
+ const now = nowIso();
285
+ const summary = rationale || 'Initial planning generated from source inputs.';
286
+ const frontmatter = yaml
287
+ .stringify({
288
+ schema_version: 1,
289
+ artifact_type: 'EPIC',
290
+ id: radarId,
291
+ title,
292
+ status: 'READY',
293
+ origin: { type: 'source_intake' },
294
+ related_ids: [],
295
+ created_at: now,
296
+ updated_at: now,
297
+ approved_summary: summary,
298
+ quality_contract: {
299
+ scope: 'touched_scope',
300
+ unit_target_percent: 95,
301
+ integration_target_percent: 95,
302
+ evidence_mode: 'hybrid',
303
+ },
304
+ lock_domains: [],
305
+ produces: [],
306
+ consumes: [],
307
+ breakdown_policy: 'graph',
308
+ })
309
+ .trim();
310
+ return `---
311
+ ${frontmatter}
312
+ ---
313
+
314
+ # Epic ${radarId}
170
315
 
171
316
  ## Origin
172
317
  - Origin: source intake
173
318
  - Indexed sources: ${sourceCount}
174
319
 
175
320
  ## Approved Summary
176
- ${rationale || 'Initial planning generated from source inputs.'}
321
+ ${summary}
177
322
 
178
323
  ## Quality Contract
179
324
  - Default scope: touched_scope.
@@ -190,14 +335,37 @@ READY
190
335
  `;
191
336
  }
192
337
  export function markdownDiscardTemplate(debate, rationale) {
193
- return `# Discarded ${debate.id}
338
+ const now = nowIso();
339
+ const reason = rationale || '(reason not provided)';
340
+ const frontmatter = yaml
341
+ .stringify({
342
+ schema_version: 1,
343
+ artifact_type: 'Discarded',
344
+ id: debate.id,
345
+ title: debate.title,
346
+ status: 'DISCARDED',
347
+ origin: { type: 'debate', ref: debate.id },
348
+ related_ids: [debate.id],
349
+ created_at: debate.created_at || now,
350
+ updated_at: now,
351
+ discarded_from: debate.id,
352
+ discard_reason: reason,
353
+ discarded_at: now,
354
+ discarded_by: CLI_NAME,
355
+ })
356
+ .trim();
357
+ return `---
358
+ ${frontmatter}
359
+ ---
360
+
361
+ # Discarded ${debate.id}
194
362
 
195
363
  ## Origin
196
364
  - Debate: ${debate.id}
197
365
  - Title: ${debate.title}
198
366
 
199
367
  ## Discard Reason
200
- ${rationale || '(reason not provided)'}
368
+ ${reason}
201
369
  `;
202
370
  }
203
371
  export const DEFAULT_META_EVOLUTION_CONFIG = {
@@ -369,6 +537,19 @@ export async function collectAuditArtifacts(paths) {
369
537
  return artifactFiles;
370
538
  }
371
539
  export function debateHasRealDeliberation(content) {
540
+ try {
541
+ const parsed = parseGovernanceFile('inline-content', content, debateFrontmatterSchema);
542
+ if (parsed.hasFrontmatter && parsed.frontmatter) {
543
+ const choice = parsed.frontmatter.decision.mediator.choice.trim().toLowerCase();
544
+ const rationale = parsed.frontmatter.decision.mediator.rationale.trim().toLowerCase();
545
+ const invalidTokens = ['(preencher', '(fill in', '____', '-', 'todo', 'tbd'];
546
+ const isInvalid = (value, token) => value === token || (token !== '-' && value.includes(token));
547
+ return !invalidTokens.some((token) => isInvalid(choice, token) || isInvalid(rationale, token));
548
+ }
549
+ }
550
+ catch {
551
+ return false;
552
+ }
372
553
  const lower = content.toLowerCase();
373
554
  const sectionIndexCandidates = [
374
555
  lower.indexOf('## 7) decisao do mediador'),
@@ -565,6 +746,37 @@ export async function findDebateFile(paths, debateId) {
565
746
  return path.join(debateDir, found.name);
566
747
  }
567
748
  export function validateDebateDocument(content) {
749
+ try {
750
+ const parsed = parseGovernanceFile('inline-content', content, debateFrontmatterSchema);
751
+ if (parsed.hasFrontmatter && parsed.frontmatter) {
752
+ const missing = [];
753
+ const question = parsed.frontmatter.decision.question.trim().toLowerCase();
754
+ if (!question || question.includes('____')) {
755
+ missing.push('Fill the decision question with real context');
756
+ }
757
+ const rationale = parsed.frontmatter.decision.mediator.rationale.trim().toLowerCase();
758
+ if (!rationale || rationale.includes('____') || rationale.includes('(fill in') || rationale.includes('(preencher')) {
759
+ missing.push('Inform the mediator decision rationale');
760
+ }
761
+ if (/\- Unit coverage:\s*$/m.test(parsed.body)) {
762
+ missing.push('Inform required unit coverage evidence in the quality contract');
763
+ }
764
+ if (/\- Integration\/e2e or equivalent:\s*$/m.test(parsed.body)) {
765
+ missing.push('Inform integration/e2e or equivalence evidence in the quality contract');
766
+ }
767
+ if (/\- Acceptance and risk matrix:\s*$/m.test(parsed.body)) {
768
+ missing.push('Inform acceptance and risk matrix evidence in the quality contract');
769
+ }
770
+ if (/\- Exceptions:\s*\n\s+- None, or formal exception/m.test(parsed.body)) {
771
+ missing.push('Confirm there is no quality exception or document the formal exception');
772
+ }
773
+ return missing;
774
+ }
775
+ }
776
+ catch (error) {
777
+ const message = error instanceof Error ? error.message : String(error);
778
+ return [`Invalid debate frontmatter: ${message}`];
779
+ }
568
780
  const missing = validateDocumentAgainstLens(content, LENSES.debate);
569
781
  if (content.includes('Decidir ____ em vez de ____ para resolver ____.') ||
570
782
  content.includes('Decide ____ instead of ____ to solve ____.')) {
@@ -754,7 +966,7 @@ function workspaceExecutionProfileForFeature(feature) {
754
966
  return {
755
967
  id: 'frontend_typescript',
756
968
  label: 'frontend workflow',
757
- description: 'frontend routes, UI coverage, and OpenSDD frontend guardrails',
969
+ description: 'frontend routes, UI coverage, and CodeSDD frontend guardrails',
758
970
  implementationFiles: ['src/', 'app/', 'pages/', 'components/', 'tests/'],
759
971
  unitCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
760
972
  integrationCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
@@ -764,9 +976,9 @@ function workspaceExecutionProfileForFeature(feature) {
764
976
  };
765
977
  }
766
978
  return {
767
- id: 'opensdd_typescript',
768
- label: 'OpenSDD backend workflow',
769
- description: 'OpenSDD state, command services, and backend validation flows',
979
+ id: 'codesdd_typescript',
980
+ label: 'CodeSDD backend workflow',
981
+ description: 'CodeSDD state, command services, and backend validation flows',
770
982
  implementationFiles: ['src/core/sdd/legacy-operations.ts'],
771
983
  unitCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
772
984
  integrationCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
@@ -789,7 +1001,7 @@ export function buildActiveSpecDoc(feature) {
789
1001
  },
790
1002
  objective,
791
1003
  expected_outcome: ensureMinLength(`${feature.title} is implemented with acceptance refs, dependencies, and quality evidence visible to the next agent.`, `Feature ${feature.id} reaches a verifiable done state with generated workspace artifacts and canonical SDD state in sync.`, 50),
792
- system_impact: ensureMinLength('Preserve canonical SDD state, generated views, documentation sync, and handoff context without hidden operational memory.', `System impact for ${feature.id} remains visible in OpenSDD state and workspace artifacts.`, 30),
1004
+ system_impact: ensureMinLength('Preserve canonical SDD state, generated views, documentation sync, and handoff context without hidden operational memory.', `System impact for ${feature.id} remains visible in CodeSDD state and workspace artifacts.`, 30),
793
1005
  acceptance_refs: feature.acceptance_refs.length > 0 ? feature.acceptance_refs : [feature.origin_ref || feature.id],
794
1006
  gates: feature.gates,
795
1007
  created_at: now,
@@ -808,6 +1020,7 @@ export function buildActiveSpecDoc(feature) {
808
1020
  }
809
1021
  export function buildActivePlanDoc(feature, recommendedBundles) {
810
1022
  const profile = workspaceExecutionProfileForFeature(feature);
1023
+ const policyInjection = buildWorkspacePolicyInjection(feature.recommended_skills);
811
1024
  const affectedContracts = [
812
1025
  ...feature.consumes.map((name) => ({ name, change_type: 'consumes' })),
813
1026
  ...feature.produces.map((name) => ({ name, change_type: 'produces' })),
@@ -815,6 +1028,74 @@ export function buildActivePlanDoc(feature, recommendedBundles) {
815
1028
  const baseDocument = {
816
1029
  schema_version: 1,
817
1030
  feature_id: feature.id,
1031
+ governance: {
1032
+ state_boundary: 'codesdd-canonical-sdd-state',
1033
+ planning_artifacts: [
1034
+ '.sdd/state/backlog.yaml',
1035
+ `.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/1-spec.yaml`,
1036
+ `.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/2-plan.yaml`,
1037
+ `.sdd/${feature.status === 'IN_PROGRESS' ? 'active' : 'planned'}/${feature.id}/5-quality.yaml`,
1038
+ ],
1039
+ decision_refs: Array.from(new Set([feature.origin_ref, ...feature.acceptance_refs].filter(Boolean))),
1040
+ planned_state_writes: [
1041
+ '.sdd/state/backlog.yaml',
1042
+ '.sdd/state/transition-log.yaml',
1043
+ ],
1044
+ rollback_plan: 'If validation fails, revert only the scoped feature workspace/state entries and regenerate CodeSDD views from canonical state.',
1045
+ validation_gates: [
1046
+ {
1047
+ name: 'SDD diagnose',
1048
+ command: `${CLI_NAME} sdd diagnose`,
1049
+ expected: 'Structural CodeSDD health has no blockers or errors.',
1050
+ },
1051
+ {
1052
+ name: 'SDD check render',
1053
+ command: `${CLI_NAME} sdd check --render`,
1054
+ expected: 'Canonical state validates and generated views are synchronized.',
1055
+ },
1056
+ ],
1057
+ },
1058
+ execution_plan: {
1059
+ mode: 'single-feature',
1060
+ state_boundary_ref: 'codesdd-canonical-sdd-state',
1061
+ command_sequence: [
1062
+ {
1063
+ name: 'Load CodeSDD context',
1064
+ command: `${CLI_NAME} sdd context ${feature.id}`,
1065
+ writes_state: false,
1066
+ expected_state_writes: [],
1067
+ },
1068
+ {
1069
+ name: 'Declare frontend impact',
1070
+ command: `${CLI_NAME} sdd frontend-impact ${feature.id} --status required|none --reason "..."`,
1071
+ writes_state: true,
1072
+ expected_state_writes: ['.sdd/state/backlog.yaml', '.sdd/state/transition-log.yaml'],
1073
+ },
1074
+ {
1075
+ name: 'Finalize feature',
1076
+ command: `${CLI_NAME} sdd finalize --ref ${feature.id}`,
1077
+ writes_state: true,
1078
+ expected_state_writes: [
1079
+ '.sdd/state/backlog.yaml',
1080
+ '.sdd/state/finalize-queue.yaml',
1081
+ '.sdd/state/transition-log.yaml',
1082
+ `.sdd/archived/${feature.id}/`,
1083
+ ],
1084
+ },
1085
+ ],
1086
+ allowed_state_writes: [
1087
+ `.sdd/active/${feature.id}/`,
1088
+ `.sdd/archived/${feature.id}/`,
1089
+ '.sdd/state/backlog.yaml',
1090
+ '.sdd/state/finalize-queue.yaml',
1091
+ '.sdd/state/transition-log.yaml',
1092
+ ],
1093
+ forbidden_state_writes: ['.codesdd/**', 'external-context/**'],
1094
+ handoff_artifacts: [
1095
+ `.sdd/active/${feature.id}/5-quality.yaml`,
1096
+ `.sdd/archived/${feature.id}/`,
1097
+ ],
1098
+ },
818
1099
  architectural_impact: {
819
1100
  description: `Touches ${feature.touches.join(', ') || 'the active SDD workspace'} with lock domains ${feature.lock_domains.join(', ') || 'none declared'}.`,
820
1101
  affected_modules: feature.touches,
@@ -836,6 +1117,7 @@ export function buildActivePlanDoc(feature, recommendedBundles) {
836
1117
  detected_conflicts: [],
837
1118
  architecture_tree_ascii: profile.architectureTreeAscii,
838
1119
  },
1120
+ policy_injection: policyInjection,
839
1121
  };
840
1122
  if (isPrivacyComplianceFeature(feature)) {
841
1123
  baseDocument.privacy_controls = {
@@ -855,6 +1137,8 @@ export function buildActiveQualityDoc(feature) {
855
1137
  const profile = workspaceExecutionProfileForFeature(feature);
856
1138
  const targetedTestCommand = testCommandForFeature(feature);
857
1139
  const requiredSkillIds = Array.from(new Set(feature.recommended_skills.filter(Boolean)));
1140
+ const requirementRefs = Array.from(new Set([`${feature.id}-R1`, ...(feature.acceptance_refs ?? []).map((ref) => ref.trim()).filter(Boolean)]));
1141
+ const policyInjection = buildWorkspacePolicyInjection(requiredSkillIds);
858
1142
  const baseDocument = {
859
1143
  schema_version: 1,
860
1144
  feature_id: feature.id,
@@ -877,6 +1161,14 @@ export function buildActiveQualityDoc(feature) {
877
1161
  evidence_log: [],
878
1162
  skill_evidence: {
879
1163
  required_skill_ids: requiredSkillIds,
1164
+ policy_requirements: policyInjection.required_policies.map((policy) => ({
1165
+ skill_id: policy.skill_id,
1166
+ policy_pool_ref: policy.policy_pool_ref,
1167
+ source_contract_ref: policy.source_contract_ref,
1168
+ enforcement: policy.enforcement,
1169
+ required_rule_refs: policy.required_rule_refs,
1170
+ required_evidence: policy.required_evidence,
1171
+ })),
880
1172
  evidence: [],
881
1173
  verification_rule: requiredSkillIds.length > 0
882
1174
  ? `Record one evidence entry per required skill before finalize: ${requiredSkillIds.join(', ')}.`
@@ -887,6 +1179,14 @@ export function buildActiveQualityDoc(feature) {
887
1179
  status: 'not_met',
888
1180
  evidence: 'Evidence must be recorded before finalize.',
889
1181
  })),
1182
+ requirement_validation_evidence_risk_matrix: requirementRefs.map((requirementRef) => ({
1183
+ requirement_ref: requirementRef,
1184
+ validation_refs: ['Targeted tests', 'Build'],
1185
+ evidence_refs: ['Tasks must be completed with validation evidence.'],
1186
+ residual_risk: 'Residual risk must be documented with mitigation before finalize.',
1187
+ risk_status: 'open',
1188
+ })),
1189
+ policy_injection: policyInjection,
890
1190
  exceptions: contract.exceptions.map((exception) => ({
891
1191
  scope: exception.scope,
892
1192
  reason: exception.reason,
@@ -904,6 +1204,52 @@ export function buildActiveQualityDoc(feature) {
904
1204
  },
905
1205
  requirements: [],
906
1206
  },
1207
+ runtime_quality_gates: {
1208
+ mode: 'observe',
1209
+ performance: [],
1210
+ flakiness: [],
1211
+ },
1212
+ q95_ledger: {
1213
+ threshold: 95,
1214
+ score: 0,
1215
+ status: 'pending',
1216
+ computed_at: '',
1217
+ weights: {
1218
+ coverage: 30,
1219
+ traceability: 20,
1220
+ integrity: 20,
1221
+ naming: 10,
1222
+ token: 20,
1223
+ },
1224
+ axes: {
1225
+ coverage: {
1226
+ raw_score: 0,
1227
+ weighted_score: 0,
1228
+ rationale: 'Computed during finalize.',
1229
+ },
1230
+ traceability: {
1231
+ raw_score: 0,
1232
+ weighted_score: 0,
1233
+ rationale: 'Computed during finalize.',
1234
+ },
1235
+ integrity: {
1236
+ raw_score: 0,
1237
+ weighted_score: 0,
1238
+ rationale: 'Computed during finalize.',
1239
+ },
1240
+ naming: {
1241
+ raw_score: 0,
1242
+ weighted_score: 0,
1243
+ rationale: 'Computed during finalize.',
1244
+ },
1245
+ token: {
1246
+ raw_score: 0,
1247
+ weighted_score: 0,
1248
+ rationale: 'Computed during finalize.',
1249
+ },
1250
+ },
1251
+ next_best_action: 'Record missing evidence to raise the lowest weighted axis.',
1252
+ },
907
1253
  };
908
1254
  if (isPrivacyComplianceFeature(feature)) {
909
1255
  baseDocument.security_integrity = {
@@ -926,18 +1272,23 @@ export function buildActiveTasksDoc(feature, paths) {
926
1272
  ? feature.recommended_skills.join(', ')
927
1273
  : 'architecture and api-design-principles';
928
1274
  const summary = feature.summary || `Deliver ${feature.title} for ${scope.description}.`;
1275
+ const policyInjection = buildWorkspacePolicyInjection(feature.recommended_skills);
1276
+ const policySummary = policyInjection.required_policies.length > 0
1277
+ ? ` Policy requirements injected for ${policyInjection.required_policies.map((policy) => policy.skill_id).join(', ')}.`
1278
+ : '';
929
1279
  return workspaceYamlDoc('3-tasks.yaml', {
930
1280
  schema_version: 1,
931
1281
  feature_id: feature.id,
1282
+ policy_injection: policyInjection,
932
1283
  tasks: [
933
1284
  {
934
1285
  id: `${feature.id}-T1`,
935
1286
  phase: 'preparation',
936
1287
  title: `Frame ${feature.title}`,
937
- description: `Run ${CLI_NAME} sdd context ${feature.id}, confirm ${scope.description}, review ${skills}, and turn the feature summary into concrete acceptance checks: ${summary}`,
1288
+ description: `Run ${CLI_NAME} sdd context ${feature.id}, confirm ${scope.description}, review ${skills}, and turn the feature summary into concrete acceptance checks: ${summary}${policySummary}`,
938
1289
  files_touched: ['.sdd/state/backlog.yaml', '.sdd/state/discovery-index.yaml'],
939
1290
  test_scripts: [],
940
- acceptance: `The implementation plan names the ${scope.description} files, expected validation commands, and any dependency or lock-domain risk before edits begin.`,
1291
+ acceptance: `The implementation plan names the ${scope.description} files, injected policy requirements, expected validation commands, and any dependency or lock-domain risk before edits begin.`,
941
1292
  status: 'pending',
942
1293
  },
943
1294
  {
@@ -947,7 +1298,7 @@ export function buildActiveTasksDoc(feature, paths) {
947
1298
  description: `Apply the ${feature.title} changes in ${touchedFiles.join(', ')} while preserving existing public contracts and SDD state transitions.`,
948
1299
  files_touched: touchedFiles,
949
1300
  test_scripts: [],
950
- acceptance: `The ${scope.label} behavior is implemented, uses existing OpenSDD patterns, and keeps generated workspace/state artifacts valid.`,
1301
+ acceptance: `The ${scope.label} behavior is implemented, uses existing CodeSDD patterns, and keeps generated workspace/state artifacts valid.`,
951
1302
  status: 'pending',
952
1303
  },
953
1304
  {
@@ -985,16 +1336,32 @@ export function buildActiveTasksDoc(feature, paths) {
985
1336
  id: `${feature.id}-T5`,
986
1337
  phase: 'finalization',
987
1338
  title: `Finalize ${feature.id}`,
988
- description: `Declare frontend impact, ensure 5-quality.yaml has evidence meeting coverage targets or a formal exception, then finalize with ${CLI_NAME} sdd finalize --ref ${feature.id}.`,
989
- files_touched: ['.sdd/active/<FEAT-ID>/5-quality.yaml', '.sdd/state/backlog.yaml', '.sdd/state/transition-log.yaml'],
1339
+ description: `Declare frontend impact, ensure 5-quality.yaml has evidence meeting coverage targets or a formal exception, then finalize with ${CLI_NAME} sdd finalize --ref ${feature.id}. After finalize, run ${CLI_NAME} sdd diagnose and ${CLI_NAME} sdd check --render, confirm ${feature.id} is DONE with current_stage consolidacao, confirm done_at and archived_at are set, confirm .sdd/archived/${feature.id}/ exists, confirm .sdd/active/${feature.id}/ no longer exists, and triage any remote security warnings such as Dependabot as an in-scope fix, formal exception, or follow-up SDD item before reporting completion.`,
1340
+ files_touched: [
1341
+ '.sdd/active/<FEAT-ID>/5-quality.yaml',
1342
+ '.sdd/archived/<FEAT-ID>/',
1343
+ '.sdd/state/backlog.yaml',
1344
+ '.sdd/state/finalize-queue.yaml',
1345
+ '.sdd/state/transition-log.yaml',
1346
+ ],
990
1347
  test_scripts: [
991
1348
  {
992
1349
  command: profile.buildCommand,
993
1350
  type: 'build',
994
1351
  expected: profile.buildExpected,
995
1352
  },
1353
+ {
1354
+ command: `${CLI_NAME} sdd diagnose`,
1355
+ type: 'sdd',
1356
+ expected: 'SDD structural health is healthy after finalize.',
1357
+ },
1358
+ {
1359
+ command: `${CLI_NAME} sdd check --render`,
1360
+ type: 'sdd',
1361
+ expected: 'Rendered SDD state is valid and completed FEAT status is coherent.',
1362
+ },
996
1363
  ],
997
- acceptance: 'Frontend impact is declared, quality coverage targets are met or formally excepted, and SDD finalize succeeds without unresolved re-task rounds.',
1364
+ acceptance: `${feature.id} is DONE in .sdd/state/backlog.yaml, current_stage is consolidacao, done_at and archived_at are set, the workspace lives under .sdd/archived/${feature.id}/, no .sdd/active/${feature.id}/ residue remains, SDD diagnose/check pass, and any remote security warning observed during push or validation is recorded with a fix, exception, or follow-up SDD reference.`,
998
1365
  status: 'pending',
999
1366
  },
1000
1367
  ],
@@ -1008,9 +1375,25 @@ function taskScopeForFeature(feature) {
1008
1375
  feature.summary || '',
1009
1376
  ].join(' ').toLowerCase();
1010
1377
  const profile = workspaceExecutionProfileForFeature(feature);
1011
- if (profile.id !== 'opensdd_typescript') {
1378
+ if (profile.id !== 'codesdd_typescript') {
1012
1379
  return { label: profile.label, description: profile.description };
1013
1380
  }
1381
+ if (includesAny(tokens, [
1382
+ 'creditos',
1383
+ 'créditos',
1384
+ 'clean-room',
1385
+ 'clean room',
1386
+ 'licenca',
1387
+ 'licença',
1388
+ 'license',
1389
+ 'notices',
1390
+ 'notice',
1391
+ ])) {
1392
+ return {
1393
+ label: 'governance docs workflow',
1394
+ description: 'credits clean-room boundary, runtime license notices, and repository documentation governance',
1395
+ };
1396
+ }
1014
1397
  if (tokens.includes('skill')) {
1015
1398
  return { label: 'skill distribution workflow', description: 'built-in skills, skill catalog state, and distribution templates' };
1016
1399
  }
@@ -1018,7 +1401,7 @@ function taskScopeForFeature(feature) {
1018
1401
  return { label: 'workspace schema workflow', description: 'workspace YAML documents, schemas, and SDD write validation' };
1019
1402
  }
1020
1403
  if (tokens.includes('sdd') || tokens.includes('backend') || tokens.includes('architecture')) {
1021
- return { label: 'OpenSDD backend workflow', description: 'OpenSDD state, command services, and backend validation flows' };
1404
+ return { label: 'CodeSDD backend workflow', description: 'CodeSDD state, command services, and backend validation flows' };
1022
1405
  }
1023
1406
  return { label: 'feature scope', description: feature.touches.join(', ') || 'the declared feature scope' };
1024
1407
  }
@@ -1038,6 +1421,22 @@ function filesForFeatureScope(feature, paths) {
1038
1421
  ];
1039
1422
  }
1040
1423
  const files = new Set();
1424
+ if (includesAny(tokens, [
1425
+ 'creditos',
1426
+ 'créditos',
1427
+ 'clean-room',
1428
+ 'clean room',
1429
+ 'licenca',
1430
+ 'licença',
1431
+ 'license',
1432
+ 'notices',
1433
+ 'notice',
1434
+ ])) {
1435
+ files.add('docs/CREDITS.md');
1436
+ files.add('docs/THIRD_PARTY_NOTICES.md');
1437
+ files.add('README.md');
1438
+ files.add('src/core/sdd/legacy-operations.ts');
1439
+ }
1041
1440
  if (tokens.includes('schema') || tokens.includes('yaml') || tokens.includes('workspace')) {
1042
1441
  files.add('src/core/sdd/workspace-schemas.ts');
1043
1442
  files.add('src/core/sdd/legacy-operations.ts');
@@ -1073,6 +1472,19 @@ function testCommandForFeature(feature) {
1073
1472
  feature.title,
1074
1473
  feature.summary || '',
1075
1474
  ].join(' ').toLowerCase();
1475
+ if (includesAny(tokens, [
1476
+ 'creditos',
1477
+ 'créditos',
1478
+ 'clean-room',
1479
+ 'clean room',
1480
+ 'licenca',
1481
+ 'licença',
1482
+ 'license',
1483
+ 'notices',
1484
+ 'notice',
1485
+ ])) {
1486
+ return 'pnpm test -- test/core/sdd-operations.test.ts';
1487
+ }
1076
1488
  if (tokens.includes('quality') || tokens.includes('task') || tokens.includes('finalize')) {
1077
1489
  return 'pnpm test -- test/core/sdd/task-quality-schemas.test.ts';
1078
1490
  }
@@ -1192,9 +1604,10 @@ export function resolveRadar(record) {
1192
1604
  }
1193
1605
  }
1194
1606
  export function resolveFeat(items, id) {
1195
- const feat = items.find((item) => item.id === id);
1607
+ const normalizedId = normalizeFeatRef(id) ?? id.trim();
1608
+ const feat = items.find((item) => item.id === normalizedId);
1196
1609
  if (!feat) {
1197
- throw new Error(`Feature ${id} nao encontrada no backlog.`);
1610
+ throw new Error(`Feature ${normalizedId} nao encontrada no backlog.`);
1198
1611
  }
1199
1612
  return feat;
1200
1613
  }
@@ -1291,6 +1704,38 @@ export function classifyFeatureShape(title, contextTokens = []) {
1291
1704
  const titleNormalized = title.toLowerCase();
1292
1705
  const contextNormalized = contextTokens.join(' ').toLowerCase();
1293
1706
  const normalized = [titleNormalized, contextNormalized].join(' ').toLowerCase();
1707
+ const isDocumentationGovernanceWork = includesAny(normalized, [
1708
+ 'docs',
1709
+ 'documentacao',
1710
+ 'documentation',
1711
+ 'adr',
1712
+ 'manual',
1713
+ 'review',
1714
+ 'revisao',
1715
+ 'migration plan',
1716
+ 'plano de migracao',
1717
+ 'naming',
1718
+ 'nomeacao',
1719
+ ]) &&
1720
+ !includesAny(normalized, [
1721
+ 'seed',
1722
+ 'backfill',
1723
+ 'database migration',
1724
+ 'db migration',
1725
+ 'schema migration',
1726
+ 'migracao de banco',
1727
+ 'migracao de dados',
1728
+ ]);
1729
+ if (isDocumentationGovernanceWork) {
1730
+ return {
1731
+ executionKind: 'documentation',
1732
+ touches: ['docs'],
1733
+ lockDomains: [],
1734
+ produces: ['documentacao-atualizada'],
1735
+ consumes: ['implementacao-concluida'],
1736
+ planningMode: 'direct_tasks',
1737
+ };
1738
+ }
1294
1739
  if (includesAny(normalized, ['migracao', 'migration', 'seed', 'backfill'])) {
1295
1740
  return {
1296
1741
  executionKind: 'migration',
@@ -1368,7 +1813,7 @@ export function classifyFeatureShape(title, contextTokens = []) {
1368
1813
  planningMode: 'local_plan',
1369
1814
  };
1370
1815
  }
1371
- if (includesAny(normalized, ['docs', 'documentacao', 'adr', 'manual'])) {
1816
+ if (includesAny(normalized, ['docs', 'documentacao', 'documentation', 'adr', 'manual'])) {
1372
1817
  return {
1373
1818
  executionKind: 'documentation',
1374
1819
  touches: ['docs'],
@@ -1608,8 +2053,12 @@ export async function maybeCreateAutomaticFrontendGap(paths, snapshot, feature,
1608
2053
  export function resolveRoutedSkills(snapshot, touches) {
1609
2054
  const knownSkills = new Set((snapshot.skillCatalog?.skills || []).map((skill) => skill.id));
1610
2055
  let injectedSkills = [];
1611
- if (touches.length > 0 && snapshot.skillRouting && snapshot.skillRouting.routes) {
1612
- for (const touch of touches) {
2056
+ const hasPythonApiOverride = touches.some((touch) => ['python', 'flask', 'langgraph', 'langchain'].includes(touch));
2057
+ const routeTouches = hasPythonApiOverride
2058
+ ? touches.filter((touch) => touch !== 'backend' && touch !== 'api')
2059
+ : touches;
2060
+ if (routeTouches.length > 0 && snapshot.skillRouting && snapshot.skillRouting.routes) {
2061
+ for (const touch of routeTouches) {
1613
2062
  const route = snapshot.skillRouting.routes.find((r) => r.domain === touch);
1614
2063
  if (route && route.skills) {
1615
2064
  injectedSkills.push(...route.skills);
@@ -1640,8 +2089,10 @@ export function inferOriginType(input) {
1640
2089
  return 'direct';
1641
2090
  }
1642
2091
  export async function buildFinalizeQueue(paths, backlogItems, queueItems) {
1643
- const queueByFeature = new Map(queueItems.map((item) => [item.feature_id, item]));
1644
- const archiveRoot = resolveOpenSpecSubpath(paths.projectRoot, 'changes', 'archive');
2092
+ const queueByFeature = new Map(queueItems
2093
+ .filter((item) => item.status === 'PENDING')
2094
+ .map((item) => [item.feature_id, item]));
2095
+ const archiveRoot = resolveLegacySpecSubpath(paths.projectRoot, 'changes', 'archive');
1645
2096
  for (const item of backlogItems) {
1646
2097
  if (!item.change_name)
1647
2098
  continue;
@@ -1708,8 +2159,30 @@ export async function evaluateFeatureQuality(paths, config, feature) {
1708
2159
  };
1709
2160
  }
1710
2161
  export function buildAdrMarkdown(feature, unlocked, timestamp) {
1711
- const refs = [feature.id, feature.origin_ref].filter(Boolean).join(', ') || '-';
1712
- return `# ADR ${feature.id}
2162
+ const refs = [feature.id, feature.origin_ref].filter(Boolean);
2163
+ const refsText = refs.join(', ') || '-';
2164
+ const frontmatter = yaml
2165
+ .stringify({
2166
+ schema_version: 1,
2167
+ artifact_type: 'ADR',
2168
+ id: `ADR-${feature.id}`,
2169
+ feature_id: feature.id,
2170
+ title: `ADR ${feature.id}: ${feature.title}`,
2171
+ status: feature.status,
2172
+ origin: { type: 'feature', ref: feature.id },
2173
+ related_ids: refs,
2174
+ created_at: timestamp,
2175
+ updated_at: timestamp,
2176
+ decision_status: 'ACCEPTED',
2177
+ supersedes: [],
2178
+ superseded_by: [],
2179
+ references: refs,
2180
+ })
2181
+ .trim();
2182
+ return `---
2183
+ ${frontmatter}
2184
+ ---
2185
+ # ADR ${feature.id}
1713
2186
 
1714
2187
  ## Context
1715
2188
  - Feature: ${feature.id} - ${feature.title}
@@ -1732,7 +2205,7 @@ Consolidate feature ${feature.id} and make the result official in SDD memory.
1732
2205
  ${unlocked.length > 0 ? unlocked.map((id) => `- ${id}`).join('\n') : '- None'}
1733
2206
 
1734
2207
  ## References
1735
- - ${refs}
2208
+ - ${refsText}
1736
2209
  `;
1737
2210
  }
1738
2211
  export function applyLoggedTransition(transitionLog, entityType, entity, toStatus, options) {
@@ -1762,17 +2235,7 @@ export function gateSatisfied(status) {
1762
2235
  return status === 'aprovada' || status === 'nao_exigida';
1763
2236
  }
1764
2237
  export function detectContextType(ref) {
1765
- if (/^FEAT-\d{3,}$/.test(ref))
1766
- return 'FEAT';
1767
- if (/^EPIC-\d{3,}$/.test(ref))
1768
- return 'EPIC';
1769
- if (/^RAD-\d{3,}$/.test(ref))
1770
- return 'RAD';
1771
- if (/^FGAP-\d{3,}$/.test(ref))
1772
- return 'FGAP';
1773
- if (/^TD-\d{3,}$/.test(ref))
1774
- return 'TD';
1775
- return null;
2238
+ return detectSddEntityType(ref);
1776
2239
  }
1777
2240
  export async function pathExists(targetPath) {
1778
2241
  try {
@@ -2170,6 +2633,6 @@ Regras:
2170
2633
  1. Cite as skills que esta aplicando no inicio da resposta.
2171
2634
  2. Siga a ordem definida acima.
2172
2635
  3. Se faltar contexto, consulte primeiro o estado canônico em .sdd/state/*.yaml.
2173
- 4. Finalize com proximos comandos OpenSDD recomendados.`;
2636
+ 4. Finalize com proximos comandos CodeSDD recomendados.`;
2174
2637
  }
2175
2638
  //# sourceMappingURL=legacy-operations.js.map