@devtrack-solution/codesdd 1.2.2 → 1.2.3

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 (345) hide show
  1. package/.sdd/skills/curated/api-clean-flask-langgraph/SKILL.md +17 -17
  2. package/.sdd/skills/curated/devtrack-api/SKILL.md +160 -28
  3. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +1 -1
  4. package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +8 -7
  5. package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +93 -0
  6. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +317 -0
  7. package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +95 -0
  8. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +295 -0
  9. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +4 -4
  10. package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +4 -0
  11. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +2 -2
  12. package/LICENSE +1 -1
  13. package/README.md +243 -51
  14. package/bin/codesdd.js +3 -2
  15. package/dist/cli/index.d.ts +2 -2
  16. package/dist/cli/index.js +11 -558
  17. package/dist/cli/program.d.ts +14 -0
  18. package/dist/cli/program.js +645 -0
  19. package/dist/commands/change.js +5 -5
  20. package/dist/commands/completion.d.ts +1 -1
  21. package/dist/commands/completion.js +9 -2
  22. package/dist/commands/config.js +159 -20
  23. package/dist/commands/feedback.js +1 -1
  24. package/dist/commands/schema.d.ts +63 -0
  25. package/dist/commands/schema.js +12 -12
  26. package/dist/commands/sdd/backlog.d.ts +3 -0
  27. package/dist/commands/sdd/backlog.js +54 -0
  28. package/dist/commands/sdd/execution.js +147 -16
  29. package/dist/commands/sdd/plugin.d.ts +3 -0
  30. package/dist/commands/sdd/plugin.js +153 -0
  31. package/dist/commands/sdd/shared.js +2 -23
  32. package/dist/commands/sdd/skills.js +7 -0
  33. package/dist/commands/sdd.js +69 -12
  34. package/dist/commands/spec.js +9 -9
  35. package/dist/commands/validate.js +6 -6
  36. package/dist/commands/workflow/instructions.js +6 -6
  37. package/dist/commands/workflow/new-change.js +3 -3
  38. package/dist/commands/workflow/shared.d.ts +1 -1
  39. package/dist/commands/workflow/shared.js +4 -4
  40. package/dist/core/archive.js +15 -5
  41. package/dist/core/artifact-graph/instruction-loader.d.ts +1 -1
  42. package/dist/core/artifact-graph/instruction-loader.js +3 -3
  43. package/dist/core/artifact-graph/resolver.d.ts +4 -4
  44. package/dist/core/artifact-graph/resolver.js +6 -6
  45. package/dist/core/branding.js +3 -3
  46. package/dist/core/cli/command-matrix.js +10 -1
  47. package/dist/core/cli-command-quality.d.ts +27 -0
  48. package/dist/core/cli-command-quality.js +171 -0
  49. package/dist/core/command-generation/adapters/costrict.d.ts +1 -1
  50. package/dist/core/command-generation/adapters/costrict.js +2 -2
  51. package/dist/core/command-generation/types.d.ts +1 -1
  52. package/dist/core/completions/command-registry.d.ts +1 -1
  53. package/dist/core/completions/command-registry.js +155 -12
  54. package/dist/core/completions/completion-provider.d.ts +14 -1
  55. package/dist/core/completions/completion-provider.js +29 -1
  56. package/dist/core/completions/generators/bash-generator.d.ts +1 -1
  57. package/dist/core/completions/generators/bash-generator.js +20 -12
  58. package/dist/core/completions/generators/fish-generator.d.ts +9 -1
  59. package/dist/core/completions/generators/fish-generator.js +39 -25
  60. package/dist/core/completions/generators/powershell-generator.d.ts +1 -1
  61. package/dist/core/completions/generators/powershell-generator.js +21 -11
  62. package/dist/core/completions/generators/zsh-generator.d.ts +3 -6
  63. package/dist/core/completions/generators/zsh-generator.js +21 -42
  64. package/dist/core/completions/installers/bash-installer.js +6 -6
  65. package/dist/core/completions/installers/fish-installer.js +1 -1
  66. package/dist/core/completions/installers/powershell-installer.js +14 -14
  67. package/dist/core/completions/installers/zsh-installer.d.ts +7 -1
  68. package/dist/core/completions/installers/zsh-installer.js +36 -8
  69. package/dist/core/completions/templates/bash-templates.d.ts +1 -1
  70. package/dist/core/completions/templates/bash-templates.js +12 -6
  71. package/dist/core/completions/templates/fish-templates.d.ts +2 -2
  72. package/dist/core/completions/templates/fish-templates.js +20 -9
  73. package/dist/core/completions/templates/powershell-templates.d.ts +1 -1
  74. package/dist/core/completions/templates/powershell-templates.js +13 -4
  75. package/dist/core/completions/templates/zsh-templates.d.ts +1 -1
  76. package/dist/core/completions/templates/zsh-templates.js +18 -9
  77. package/dist/core/config-schema.d.ts +3 -1
  78. package/dist/core/config-schema.js +26 -1
  79. package/dist/core/config.d.ts +3 -3
  80. package/dist/core/config.js +4 -4
  81. package/dist/core/global-config.d.ts +41 -12
  82. package/dist/core/global-config.js +344 -27
  83. package/dist/core/index.d.ts +1 -1
  84. package/dist/core/index.js +2 -2
  85. package/dist/core/init.d.ts +6 -1
  86. package/dist/core/init.js +99 -77
  87. package/dist/core/legacy-cleanup.d.ts +17 -17
  88. package/dist/core/legacy-cleanup.js +96 -79
  89. package/dist/core/list.js +18 -4
  90. package/dist/core/migration.d.ts +3 -1
  91. package/dist/core/migration.js +7 -8
  92. package/dist/core/parsers/change-parser.js +1 -1
  93. package/dist/core/parsers/markdown-parser.js +2 -2
  94. package/dist/core/profile-sync-drift.d.ts +1 -1
  95. package/dist/core/profile-sync-drift.js +13 -13
  96. package/dist/core/project-config.d.ts +4 -4
  97. package/dist/core/project-config.js +11 -11
  98. package/dist/core/schemas/change.schema.d.ts +1 -1
  99. package/dist/core/schemas/change.schema.js +1 -1
  100. package/dist/core/schemas/spec.schema.d.ts +1 -1
  101. package/dist/core/schemas/spec.schema.js +1 -1
  102. package/dist/core/sdd/adr.js +23 -1
  103. package/dist/core/sdd/agent-binding.d.ts +346 -0
  104. package/dist/core/sdd/agent-binding.js +343 -0
  105. package/dist/core/sdd/backlog-cli.d.ts +16 -0
  106. package/dist/core/sdd/backlog-cli.js +146 -0
  107. package/dist/core/sdd/backlog-conflict-policy.d.ts +58 -0
  108. package/dist/core/sdd/backlog-conflict-policy.js +230 -0
  109. package/dist/core/sdd/backlog-projection.d.ts +8 -0
  110. package/dist/core/sdd/backlog-projection.js +89 -0
  111. package/dist/core/sdd/backlog-provider-contract.d.ts +252 -0
  112. package/dist/core/sdd/backlog-provider-contract.js +158 -0
  113. package/dist/core/sdd/bootstrap.js +2 -2
  114. package/dist/core/sdd/check.d.ts +42 -0
  115. package/dist/core/sdd/check.js +22 -22
  116. package/dist/core/sdd/contract.d.ts +13 -0
  117. package/dist/core/sdd/contract.js +36 -0
  118. package/dist/core/sdd/coordination/coordination-adapters.d.ts +38 -0
  119. package/dist/core/sdd/coordination/coordination-adapters.js +139 -1
  120. package/dist/core/sdd/deepagent-contracts.d.ts +276 -0
  121. package/dist/core/sdd/deepagent-contracts.js +173 -0
  122. package/dist/core/sdd/deepagents/adr-governor.d.ts +2 -0
  123. package/dist/core/sdd/deepagents/adr-governor.js +30 -0
  124. package/dist/core/sdd/deepagents/backend.d.ts +63 -0
  125. package/dist/core/sdd/deepagents/backend.js +174 -0
  126. package/dist/core/sdd/deepagents/codesdd-tools.d.ts +39 -0
  127. package/dist/core/sdd/deepagents/codesdd-tools.js +83 -0
  128. package/dist/core/sdd/deepagents/evidence-mapper.d.ts +86 -0
  129. package/dist/core/sdd/deepagents/evidence-mapper.js +178 -0
  130. package/dist/core/sdd/deepagents/model-provider.d.ts +53 -0
  131. package/dist/core/sdd/deepagents/model-provider.js +379 -0
  132. package/dist/core/sdd/deepagents/policy-enforcement.d.ts +30 -0
  133. package/dist/core/sdd/deepagents/policy-enforcement.js +90 -0
  134. package/dist/core/sdd/deepagents/policy.d.ts +75 -0
  135. package/dist/core/sdd/deepagents/policy.js +358 -0
  136. package/dist/core/sdd/deepagents/quality-witness.d.ts +3 -0
  137. package/dist/core/sdd/deepagents/quality-witness.js +77 -0
  138. package/dist/core/sdd/deepagents/reversa-subagents.d.ts +75 -0
  139. package/dist/core/sdd/deepagents/reversa-subagents.js +182 -0
  140. package/dist/core/sdd/deepagents/runtime-factory.d.ts +90 -0
  141. package/dist/core/sdd/deepagents/runtime-factory.js +231 -0
  142. package/dist/core/sdd/deepagents/runtime-loader.d.ts +16 -0
  143. package/dist/core/sdd/deepagents/runtime-loader.js +65 -0
  144. package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
  145. package/dist/core/sdd/default-bootstrap-files.js +36 -2
  146. package/dist/core/sdd/default-skills.d.ts +30 -0
  147. package/dist/core/sdd/default-skills.js +181 -5
  148. package/dist/core/sdd/devtrack-api-appliance.d.ts +84 -0
  149. package/dist/core/sdd/devtrack-api-appliance.js +257 -0
  150. package/dist/core/sdd/devtrack-api-architecture.d.ts +31 -0
  151. package/dist/core/sdd/devtrack-api-architecture.js +608 -0
  152. package/dist/core/sdd/devtrack-api-import-boundary.d.ts +19 -0
  153. package/dist/core/sdd/devtrack-api-import-boundary.js +32 -0
  154. package/dist/core/sdd/diagnose.d.ts +59 -0
  155. package/dist/core/sdd/diagnose.js +37 -37
  156. package/dist/core/sdd/docs-sync.js +33 -5
  157. package/dist/core/sdd/domain/post-active-validation.d.ts +7 -0
  158. package/dist/core/sdd/domain/post-active-validation.js +61 -0
  159. package/dist/core/sdd/domain/transition-engine.js +1 -0
  160. package/dist/core/sdd/entity-reference.d.ts +5 -0
  161. package/dist/core/sdd/entity-reference.js +22 -0
  162. package/dist/core/sdd/governance-backfill.d.ts +31 -0
  163. package/dist/core/sdd/governance-backfill.js +359 -0
  164. package/dist/core/sdd/governance-parser.d.ts +21 -0
  165. package/dist/core/sdd/governance-parser.js +91 -0
  166. package/dist/core/sdd/governance-schemas.d.ts +245 -0
  167. package/dist/core/sdd/governance-schemas.js +143 -0
  168. package/dist/core/sdd/{import-openspec.d.ts → import-legacy-spec.d.ts} +7 -7
  169. package/dist/core/sdd/{import-openspec.js → import-legacy-spec.js} +21 -29
  170. package/dist/core/sdd/init.d.ts +3 -0
  171. package/dist/core/sdd/init.js +6 -3
  172. package/dist/core/sdd/json-schema.js +100 -6
  173. package/dist/core/sdd/knowledge-graph.d.ts +45 -0
  174. package/dist/core/sdd/knowledge-graph.js +288 -0
  175. package/dist/core/sdd/legacy-operations.js +431 -43
  176. package/dist/core/sdd/lenses.d.ts +1 -0
  177. package/dist/core/sdd/lenses.js +29 -1
  178. package/dist/core/sdd/migrate-workspace.js +56 -2
  179. package/dist/core/sdd/migrate.d.ts +1 -1
  180. package/dist/core/sdd/migrate.js +36 -2
  181. package/dist/core/sdd/package-structure-gate.d.ts +83 -0
  182. package/dist/core/sdd/package-structure-gate.js +362 -0
  183. package/dist/core/sdd/parallel-feat-automation.d.ts +152 -0
  184. package/dist/core/sdd/parallel-feat-automation.js +212 -0
  185. package/dist/core/sdd/plugin-broker.d.ts +558 -0
  186. package/dist/core/sdd/plugin-broker.js +482 -0
  187. package/dist/core/sdd/plugin-certification.d.ts +79 -0
  188. package/dist/core/sdd/plugin-certification.js +453 -0
  189. package/dist/core/sdd/plugin-cli.d.ts +109 -0
  190. package/dist/core/sdd/plugin-cli.js +198 -0
  191. package/dist/core/sdd/plugin-evidence.d.ts +275 -0
  192. package/dist/core/sdd/plugin-evidence.js +307 -0
  193. package/dist/core/sdd/plugin-manifest.d.ts +164 -0
  194. package/dist/core/sdd/plugin-manifest.js +215 -0
  195. package/dist/core/sdd/plugin-policy-pack.d.ts +88 -0
  196. package/dist/core/sdd/plugin-policy-pack.js +236 -0
  197. package/dist/core/sdd/plugin-policy.d.ts +68 -0
  198. package/dist/core/sdd/plugin-policy.js +212 -0
  199. package/dist/core/sdd/plugin-registry.d.ts +311 -0
  200. package/dist/core/sdd/plugin-registry.js +138 -0
  201. package/dist/core/sdd/plugin-skill-binding.d.ts +151 -0
  202. package/dist/core/sdd/plugin-skill-binding.js +339 -0
  203. package/dist/core/sdd/quality-artifact-manifest-validator.d.ts +28 -0
  204. package/dist/core/sdd/quality-artifact-manifest-validator.js +167 -0
  205. package/dist/core/sdd/quality-evidence-renderer.d.ts +65 -0
  206. package/dist/core/sdd/quality-evidence-renderer.js +218 -0
  207. package/dist/core/sdd/quality-scenario-runner.d.ts +42 -0
  208. package/dist/core/sdd/quality-scenario-runner.js +613 -0
  209. package/dist/core/sdd/quality-validation.d.ts +547 -0
  210. package/dist/core/sdd/quality-validation.js +239 -0
  211. package/dist/core/sdd/resolve-project-root.d.ts +2 -2
  212. package/dist/core/sdd/resolve-project-root.js +11 -5
  213. package/dist/core/sdd/sanitize.d.ts +30 -1
  214. package/dist/core/sdd/sanitize.js +23 -23
  215. package/dist/core/sdd/services/agent-run.service.d.ts +65 -0
  216. package/dist/core/sdd/services/agent-run.service.js +189 -0
  217. package/dist/core/sdd/services/breakdown.service.js +2 -1
  218. package/dist/core/sdd/services/context.service.js +18 -16
  219. package/dist/core/sdd/services/debate.service.js +15 -2
  220. package/dist/core/sdd/services/feature-lint.service.d.ts +22 -0
  221. package/dist/core/sdd/services/feature-lint.service.js +105 -5
  222. package/dist/core/sdd/services/finalize.service.d.ts +80 -0
  223. package/dist/core/sdd/services/finalize.service.js +323 -24
  224. package/dist/core/sdd/services/frontend-gap.service.js +22 -7
  225. package/dist/core/sdd/services/governance-control-plane-runtime-adapters.d.ts +17 -0
  226. package/dist/core/sdd/services/governance-control-plane-runtime-adapters.js +38 -0
  227. package/dist/core/sdd/services/governance-control-plane.service.d.ts +66 -0
  228. package/dist/core/sdd/services/governance-control-plane.service.js +134 -0
  229. package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
  230. package/dist/core/sdd/services/legacy-capability.service.d.ts +10 -7
  231. package/dist/core/sdd/services/legacy-capability.service.js +38 -21
  232. package/dist/core/sdd/services/mcp-runtime.service.d.ts +123 -8
  233. package/dist/core/sdd/services/mcp-runtime.service.js +1085 -33
  234. package/dist/core/sdd/services/onboard.service.js +2 -1
  235. package/dist/core/sdd/services/rebuild.service.js +6 -1
  236. package/dist/core/sdd/services/skills-sync.service.d.ts +17 -5
  237. package/dist/core/sdd/services/skills-sync.service.js +55 -2
  238. package/dist/core/sdd/services/start.service.js +6 -4
  239. package/dist/core/sdd/skill-bundles-curation-schema.d.ts +66 -0
  240. package/dist/core/sdd/skill-bundles-curation-schema.js +52 -0
  241. package/dist/core/sdd/skill-evidence.d.ts +19 -0
  242. package/dist/core/sdd/skill-evidence.js +38 -0
  243. package/dist/core/sdd/skill-policy-pool.d.ts +46 -0
  244. package/dist/core/sdd/skill-policy-pool.js +185 -0
  245. package/dist/core/sdd/state.d.ts +22 -0
  246. package/dist/core/sdd/state.js +66 -41
  247. package/dist/core/sdd/structural-health.d.ts +42 -42
  248. package/dist/core/sdd/types.d.ts +33 -7
  249. package/dist/core/sdd/types.js +17 -0
  250. package/dist/core/sdd/upgrade-to-codesdd.d.ts +45 -0
  251. package/dist/core/sdd/upgrade-to-codesdd.js +179 -0
  252. package/dist/core/sdd/workspace-schemas.d.ts +285 -14
  253. package/dist/core/sdd/workspace-schemas.js +148 -0
  254. package/dist/core/sdd/write-manifest.js +22 -4
  255. package/dist/core/shared/skill-generation.d.ts +1 -1
  256. package/dist/core/shared/skill-generation.js +15 -15
  257. package/dist/core/shared/tool-detection.d.ts +3 -3
  258. package/dist/core/shared/tool-detection.js +14 -14
  259. package/dist/core/specs-apply.js +6 -6
  260. package/dist/core/templates/index.d.ts +1 -1
  261. package/dist/core/templates/index.js +1 -1
  262. package/dist/core/templates/workflows/apply-change.js +14 -14
  263. package/dist/core/templates/workflows/archive-change.js +32 -32
  264. package/dist/core/templates/workflows/bulk-archive-change.js +25 -25
  265. package/dist/core/templates/workflows/continue-change.js +12 -12
  266. package/dist/core/templates/workflows/explore.js +29 -29
  267. package/dist/core/templates/workflows/feedback.js +6 -6
  268. package/dist/core/templates/workflows/ff-change.js +24 -24
  269. package/dist/core/templates/workflows/new-change.js +20 -20
  270. package/dist/core/templates/workflows/onboard.js +33 -33
  271. package/dist/core/templates/workflows/propose.js +23 -23
  272. package/dist/core/templates/workflows/sdd.js +8 -8
  273. package/dist/core/templates/workflows/sync-specs.js +19 -19
  274. package/dist/core/templates/workflows/verify-change.js +17 -17
  275. package/dist/core/update.d.ts +2 -2
  276. package/dist/core/update.js +16 -15
  277. package/dist/core/validation/constants.d.ts +1 -1
  278. package/dist/core/validation/constants.js +1 -1
  279. package/dist/core/view.js +11 -11
  280. package/dist/telemetry/config.d.ts +2 -1
  281. package/dist/telemetry/config.js +17 -8
  282. package/dist/telemetry/index.d.ts +10 -2
  283. package/dist/telemetry/index.js +40 -7
  284. package/dist/ui/ascii-patterns.d.ts +2 -2
  285. package/dist/ui/ascii-patterns.js +2 -2
  286. package/dist/ui/welcome-screen.js +2 -2
  287. package/dist/utils/change-metadata.d.ts +4 -4
  288. package/dist/utils/change-metadata.js +6 -6
  289. package/dist/utils/change-utils.d.ts +3 -3
  290. package/dist/utils/change-utils.js +5 -5
  291. package/dist/utils/file-system.js +1 -1
  292. package/dist/utils/interactive.js +1 -1
  293. package/dist/utils/item-discovery.js +4 -4
  294. package/dist/utils/legacy-spec-compat.d.ts +2 -0
  295. package/dist/utils/legacy-spec-compat.js +2 -0
  296. package/dist/utils/shell-detection.d.ts +1 -0
  297. package/dist/utils/shell-detection.js +16 -0
  298. package/package.json +27 -17
  299. package/schemas/sdd/1-spec.schema.json +1 -1
  300. package/schemas/sdd/2-plan.schema.json +73 -1
  301. package/schemas/sdd/3-tasks.schema.json +73 -1
  302. package/schemas/sdd/4-changelog.schema.json +1 -1
  303. package/schemas/sdd/5-quality.schema.json +442 -2
  304. package/schemas/sdd/adr.schema.json +148 -0
  305. package/schemas/sdd/agent-binding-adapter.schema.json +210 -0
  306. package/schemas/sdd/agent-binding-resolution.schema.json +338 -0
  307. package/schemas/sdd/backlog-projection-plan.schema.json +180 -0
  308. package/schemas/sdd/backlog-provider-contract.schema.json +260 -0
  309. package/schemas/sdd/codesdd-plugin.schema.json +474 -0
  310. package/schemas/sdd/debate.schema.json +244 -0
  311. package/schemas/sdd/deepagent-decision-evidence.schema.json +58 -0
  312. package/schemas/sdd/deepagent-env-contract.schema.json +143 -0
  313. package/schemas/sdd/deepagent-quality-evidence.schema.json +108 -0
  314. package/schemas/sdd/deepagent-run-evidence.schema.json +192 -0
  315. package/schemas/sdd/deepagent-run-plan.schema.json +197 -0
  316. package/schemas/sdd/deepagent-run-request.schema.json +321 -0
  317. package/schemas/sdd/deepagent-subagent-evidence.schema.json +110 -0
  318. package/schemas/sdd/deepagent-tool-call-evidence.schema.json +78 -0
  319. package/schemas/sdd/discarded.schema.json +127 -0
  320. package/schemas/sdd/epic.schema.json +147 -0
  321. package/schemas/sdd/insight.schema.json +136 -0
  322. package/schemas/sdd/parallel-feat-automation-plan.schema.json +215 -0
  323. package/schemas/sdd/parallel-feat-automation-request.schema.json +109 -0
  324. package/schemas/sdd/plugin-artifact-manifest.schema.json +150 -0
  325. package/schemas/sdd/plugin-compliance-index.schema.json +136 -0
  326. package/schemas/sdd/plugin-dry-run-plan.schema.json +260 -0
  327. package/schemas/sdd/plugin-evidence-manifest.schema.json +569 -0
  328. package/schemas/sdd/plugin-policy-evaluation.schema.json +92 -0
  329. package/schemas/sdd/plugin-policy-pack-evaluation.schema.json +94 -0
  330. package/schemas/sdd/plugin-policy-pack.schema.json +196 -0
  331. package/schemas/sdd/plugin-registry.schema.json +558 -0
  332. package/schemas/sdd/plugin-rollback-manifest.schema.json +87 -0
  333. package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +845 -0
  334. package/schemas/sdd/plugin-skill-binding-resolution.schema.json +305 -0
  335. package/schemas/sdd/plugin-skill-binding.schema.json +88 -0
  336. package/schemas/sdd/plugin-validation-manifest.schema.json +123 -0
  337. package/schemas/sdd/quality-architecture-schema.schema.json +216 -0
  338. package/schemas/sdd/quality-evidence-bundle.schema.json +1228 -0
  339. package/schemas/sdd/quality-run.schema.json +197 -0
  340. package/schemas/sdd/quality-scenario.schema.json +252 -0
  341. package/schemas/sdd/workspace-catalog.schema.json +9841 -22
  342. package/schemas/spec-driven/schema.yaml +4 -4
  343. package/schemas/spec-driven/templates/proposal.md +1 -1
  344. package/dist/utils/openspec-compat.d.ts +0 -2
  345. 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' })),
@@ -836,6 +1049,7 @@ export function buildActivePlanDoc(feature, recommendedBundles) {
836
1049
  detected_conflicts: [],
837
1050
  architecture_tree_ascii: profile.architectureTreeAscii,
838
1051
  },
1052
+ policy_injection: policyInjection,
839
1053
  };
840
1054
  if (isPrivacyComplianceFeature(feature)) {
841
1055
  baseDocument.privacy_controls = {
@@ -855,6 +1069,8 @@ export function buildActiveQualityDoc(feature) {
855
1069
  const profile = workspaceExecutionProfileForFeature(feature);
856
1070
  const targetedTestCommand = testCommandForFeature(feature);
857
1071
  const requiredSkillIds = Array.from(new Set(feature.recommended_skills.filter(Boolean)));
1072
+ const requirementRefs = Array.from(new Set([`${feature.id}-R1`, ...(feature.acceptance_refs ?? []).map((ref) => ref.trim()).filter(Boolean)]));
1073
+ const policyInjection = buildWorkspacePolicyInjection(requiredSkillIds);
858
1074
  const baseDocument = {
859
1075
  schema_version: 1,
860
1076
  feature_id: feature.id,
@@ -877,6 +1093,14 @@ export function buildActiveQualityDoc(feature) {
877
1093
  evidence_log: [],
878
1094
  skill_evidence: {
879
1095
  required_skill_ids: requiredSkillIds,
1096
+ policy_requirements: policyInjection.required_policies.map((policy) => ({
1097
+ skill_id: policy.skill_id,
1098
+ policy_pool_ref: policy.policy_pool_ref,
1099
+ source_contract_ref: policy.source_contract_ref,
1100
+ enforcement: policy.enforcement,
1101
+ required_rule_refs: policy.required_rule_refs,
1102
+ required_evidence: policy.required_evidence,
1103
+ })),
880
1104
  evidence: [],
881
1105
  verification_rule: requiredSkillIds.length > 0
882
1106
  ? `Record one evidence entry per required skill before finalize: ${requiredSkillIds.join(', ')}.`
@@ -887,6 +1111,14 @@ export function buildActiveQualityDoc(feature) {
887
1111
  status: 'not_met',
888
1112
  evidence: 'Evidence must be recorded before finalize.',
889
1113
  })),
1114
+ requirement_validation_evidence_risk_matrix: requirementRefs.map((requirementRef) => ({
1115
+ requirement_ref: requirementRef,
1116
+ validation_refs: ['Targeted tests', 'Build'],
1117
+ evidence_refs: ['Tasks must be completed with validation evidence.'],
1118
+ residual_risk: 'Residual risk must be documented with mitigation before finalize.',
1119
+ risk_status: 'open',
1120
+ })),
1121
+ policy_injection: policyInjection,
890
1122
  exceptions: contract.exceptions.map((exception) => ({
891
1123
  scope: exception.scope,
892
1124
  reason: exception.reason,
@@ -904,6 +1136,47 @@ export function buildActiveQualityDoc(feature) {
904
1136
  },
905
1137
  requirements: [],
906
1138
  },
1139
+ q95_ledger: {
1140
+ threshold: 95,
1141
+ score: 0,
1142
+ status: 'pending',
1143
+ computed_at: '',
1144
+ weights: {
1145
+ coverage: 30,
1146
+ traceability: 20,
1147
+ integrity: 20,
1148
+ naming: 10,
1149
+ token: 20,
1150
+ },
1151
+ axes: {
1152
+ coverage: {
1153
+ raw_score: 0,
1154
+ weighted_score: 0,
1155
+ rationale: 'Computed during finalize.',
1156
+ },
1157
+ traceability: {
1158
+ raw_score: 0,
1159
+ weighted_score: 0,
1160
+ rationale: 'Computed during finalize.',
1161
+ },
1162
+ integrity: {
1163
+ raw_score: 0,
1164
+ weighted_score: 0,
1165
+ rationale: 'Computed during finalize.',
1166
+ },
1167
+ naming: {
1168
+ raw_score: 0,
1169
+ weighted_score: 0,
1170
+ rationale: 'Computed during finalize.',
1171
+ },
1172
+ token: {
1173
+ raw_score: 0,
1174
+ weighted_score: 0,
1175
+ rationale: 'Computed during finalize.',
1176
+ },
1177
+ },
1178
+ next_best_action: 'Record missing evidence to raise the lowest weighted axis.',
1179
+ },
907
1180
  };
908
1181
  if (isPrivacyComplianceFeature(feature)) {
909
1182
  baseDocument.security_integrity = {
@@ -926,18 +1199,23 @@ export function buildActiveTasksDoc(feature, paths) {
926
1199
  ? feature.recommended_skills.join(', ')
927
1200
  : 'architecture and api-design-principles';
928
1201
  const summary = feature.summary || `Deliver ${feature.title} for ${scope.description}.`;
1202
+ const policyInjection = buildWorkspacePolicyInjection(feature.recommended_skills);
1203
+ const policySummary = policyInjection.required_policies.length > 0
1204
+ ? ` Policy requirements injected for ${policyInjection.required_policies.map((policy) => policy.skill_id).join(', ')}.`
1205
+ : '';
929
1206
  return workspaceYamlDoc('3-tasks.yaml', {
930
1207
  schema_version: 1,
931
1208
  feature_id: feature.id,
1209
+ policy_injection: policyInjection,
932
1210
  tasks: [
933
1211
  {
934
1212
  id: `${feature.id}-T1`,
935
1213
  phase: 'preparation',
936
1214
  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}`,
1215
+ 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
1216
  files_touched: ['.sdd/state/backlog.yaml', '.sdd/state/discovery-index.yaml'],
939
1217
  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.`,
1218
+ 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
1219
  status: 'pending',
942
1220
  },
943
1221
  {
@@ -947,7 +1225,7 @@ export function buildActiveTasksDoc(feature, paths) {
947
1225
  description: `Apply the ${feature.title} changes in ${touchedFiles.join(', ')} while preserving existing public contracts and SDD state transitions.`,
948
1226
  files_touched: touchedFiles,
949
1227
  test_scripts: [],
950
- acceptance: `The ${scope.label} behavior is implemented, uses existing OpenSDD patterns, and keeps generated workspace/state artifacts valid.`,
1228
+ acceptance: `The ${scope.label} behavior is implemented, uses existing CodeSDD patterns, and keeps generated workspace/state artifacts valid.`,
951
1229
  status: 'pending',
952
1230
  },
953
1231
  {
@@ -985,16 +1263,32 @@ export function buildActiveTasksDoc(feature, paths) {
985
1263
  id: `${feature.id}-T5`,
986
1264
  phase: 'finalization',
987
1265
  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'],
1266
+ 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.`,
1267
+ files_touched: [
1268
+ '.sdd/active/<FEAT-ID>/5-quality.yaml',
1269
+ '.sdd/archived/<FEAT-ID>/',
1270
+ '.sdd/state/backlog.yaml',
1271
+ '.sdd/state/finalize-queue.yaml',
1272
+ '.sdd/state/transition-log.yaml',
1273
+ ],
990
1274
  test_scripts: [
991
1275
  {
992
1276
  command: profile.buildCommand,
993
1277
  type: 'build',
994
1278
  expected: profile.buildExpected,
995
1279
  },
1280
+ {
1281
+ command: `${CLI_NAME} sdd diagnose`,
1282
+ type: 'sdd',
1283
+ expected: 'SDD structural health is healthy after finalize.',
1284
+ },
1285
+ {
1286
+ command: `${CLI_NAME} sdd check --render`,
1287
+ type: 'sdd',
1288
+ expected: 'Rendered SDD state is valid and completed FEAT status is coherent.',
1289
+ },
996
1290
  ],
997
- acceptance: 'Frontend impact is declared, quality coverage targets are met or formally excepted, and SDD finalize succeeds without unresolved re-task rounds.',
1291
+ 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
1292
  status: 'pending',
999
1293
  },
1000
1294
  ],
@@ -1008,9 +1302,25 @@ function taskScopeForFeature(feature) {
1008
1302
  feature.summary || '',
1009
1303
  ].join(' ').toLowerCase();
1010
1304
  const profile = workspaceExecutionProfileForFeature(feature);
1011
- if (profile.id !== 'opensdd_typescript') {
1305
+ if (profile.id !== 'codesdd_typescript') {
1012
1306
  return { label: profile.label, description: profile.description };
1013
1307
  }
1308
+ if (includesAny(tokens, [
1309
+ 'creditos',
1310
+ 'créditos',
1311
+ 'clean-room',
1312
+ 'clean room',
1313
+ 'licenca',
1314
+ 'licença',
1315
+ 'license',
1316
+ 'notices',
1317
+ 'notice',
1318
+ ])) {
1319
+ return {
1320
+ label: 'governance docs workflow',
1321
+ description: 'credits clean-room boundary, runtime license notices, and repository documentation governance',
1322
+ };
1323
+ }
1014
1324
  if (tokens.includes('skill')) {
1015
1325
  return { label: 'skill distribution workflow', description: 'built-in skills, skill catalog state, and distribution templates' };
1016
1326
  }
@@ -1018,7 +1328,7 @@ function taskScopeForFeature(feature) {
1018
1328
  return { label: 'workspace schema workflow', description: 'workspace YAML documents, schemas, and SDD write validation' };
1019
1329
  }
1020
1330
  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' };
1331
+ return { label: 'CodeSDD backend workflow', description: 'CodeSDD state, command services, and backend validation flows' };
1022
1332
  }
1023
1333
  return { label: 'feature scope', description: feature.touches.join(', ') || 'the declared feature scope' };
1024
1334
  }
@@ -1038,6 +1348,22 @@ function filesForFeatureScope(feature, paths) {
1038
1348
  ];
1039
1349
  }
1040
1350
  const files = new Set();
1351
+ if (includesAny(tokens, [
1352
+ 'creditos',
1353
+ 'créditos',
1354
+ 'clean-room',
1355
+ 'clean room',
1356
+ 'licenca',
1357
+ 'licença',
1358
+ 'license',
1359
+ 'notices',
1360
+ 'notice',
1361
+ ])) {
1362
+ files.add('docs/CREDITS.md');
1363
+ files.add('docs/THIRD_PARTY_NOTICES.md');
1364
+ files.add('README.md');
1365
+ files.add('src/core/sdd/legacy-operations.ts');
1366
+ }
1041
1367
  if (tokens.includes('schema') || tokens.includes('yaml') || tokens.includes('workspace')) {
1042
1368
  files.add('src/core/sdd/workspace-schemas.ts');
1043
1369
  files.add('src/core/sdd/legacy-operations.ts');
@@ -1073,6 +1399,19 @@ function testCommandForFeature(feature) {
1073
1399
  feature.title,
1074
1400
  feature.summary || '',
1075
1401
  ].join(' ').toLowerCase();
1402
+ if (includesAny(tokens, [
1403
+ 'creditos',
1404
+ 'créditos',
1405
+ 'clean-room',
1406
+ 'clean room',
1407
+ 'licenca',
1408
+ 'licença',
1409
+ 'license',
1410
+ 'notices',
1411
+ 'notice',
1412
+ ])) {
1413
+ return 'pnpm test -- test/core/sdd-operations.test.ts';
1414
+ }
1076
1415
  if (tokens.includes('quality') || tokens.includes('task') || tokens.includes('finalize')) {
1077
1416
  return 'pnpm test -- test/core/sdd/task-quality-schemas.test.ts';
1078
1417
  }
@@ -1192,9 +1531,10 @@ export function resolveRadar(record) {
1192
1531
  }
1193
1532
  }
1194
1533
  export function resolveFeat(items, id) {
1195
- const feat = items.find((item) => item.id === id);
1534
+ const normalizedId = normalizeFeatRef(id) ?? id.trim();
1535
+ const feat = items.find((item) => item.id === normalizedId);
1196
1536
  if (!feat) {
1197
- throw new Error(`Feature ${id} nao encontrada no backlog.`);
1537
+ throw new Error(`Feature ${normalizedId} nao encontrada no backlog.`);
1198
1538
  }
1199
1539
  return feat;
1200
1540
  }
@@ -1291,6 +1631,38 @@ export function classifyFeatureShape(title, contextTokens = []) {
1291
1631
  const titleNormalized = title.toLowerCase();
1292
1632
  const contextNormalized = contextTokens.join(' ').toLowerCase();
1293
1633
  const normalized = [titleNormalized, contextNormalized].join(' ').toLowerCase();
1634
+ const isDocumentationGovernanceWork = includesAny(normalized, [
1635
+ 'docs',
1636
+ 'documentacao',
1637
+ 'documentation',
1638
+ 'adr',
1639
+ 'manual',
1640
+ 'review',
1641
+ 'revisao',
1642
+ 'migration plan',
1643
+ 'plano de migracao',
1644
+ 'naming',
1645
+ 'nomeacao',
1646
+ ]) &&
1647
+ !includesAny(normalized, [
1648
+ 'seed',
1649
+ 'backfill',
1650
+ 'database migration',
1651
+ 'db migration',
1652
+ 'schema migration',
1653
+ 'migracao de banco',
1654
+ 'migracao de dados',
1655
+ ]);
1656
+ if (isDocumentationGovernanceWork) {
1657
+ return {
1658
+ executionKind: 'documentation',
1659
+ touches: ['docs'],
1660
+ lockDomains: [],
1661
+ produces: ['documentacao-atualizada'],
1662
+ consumes: ['implementacao-concluida'],
1663
+ planningMode: 'direct_tasks',
1664
+ };
1665
+ }
1294
1666
  if (includesAny(normalized, ['migracao', 'migration', 'seed', 'backfill'])) {
1295
1667
  return {
1296
1668
  executionKind: 'migration',
@@ -1368,7 +1740,7 @@ export function classifyFeatureShape(title, contextTokens = []) {
1368
1740
  planningMode: 'local_plan',
1369
1741
  };
1370
1742
  }
1371
- if (includesAny(normalized, ['docs', 'documentacao', 'adr', 'manual'])) {
1743
+ if (includesAny(normalized, ['docs', 'documentacao', 'documentation', 'adr', 'manual'])) {
1372
1744
  return {
1373
1745
  executionKind: 'documentation',
1374
1746
  touches: ['docs'],
@@ -1608,8 +1980,12 @@ export async function maybeCreateAutomaticFrontendGap(paths, snapshot, feature,
1608
1980
  export function resolveRoutedSkills(snapshot, touches) {
1609
1981
  const knownSkills = new Set((snapshot.skillCatalog?.skills || []).map((skill) => skill.id));
1610
1982
  let injectedSkills = [];
1611
- if (touches.length > 0 && snapshot.skillRouting && snapshot.skillRouting.routes) {
1612
- for (const touch of touches) {
1983
+ const hasPythonApiOverride = touches.some((touch) => ['python', 'flask', 'langgraph', 'langchain'].includes(touch));
1984
+ const routeTouches = hasPythonApiOverride
1985
+ ? touches.filter((touch) => touch !== 'backend' && touch !== 'api')
1986
+ : touches;
1987
+ if (routeTouches.length > 0 && snapshot.skillRouting && snapshot.skillRouting.routes) {
1988
+ for (const touch of routeTouches) {
1613
1989
  const route = snapshot.skillRouting.routes.find((r) => r.domain === touch);
1614
1990
  if (route && route.skills) {
1615
1991
  injectedSkills.push(...route.skills);
@@ -1641,7 +2017,7 @@ export function inferOriginType(input) {
1641
2017
  }
1642
2018
  export async function buildFinalizeQueue(paths, backlogItems, queueItems) {
1643
2019
  const queueByFeature = new Map(queueItems.map((item) => [item.feature_id, item]));
1644
- const archiveRoot = resolveOpenSpecSubpath(paths.projectRoot, 'changes', 'archive');
2020
+ const archiveRoot = resolveLegacySpecSubpath(paths.projectRoot, 'changes', 'archive');
1645
2021
  for (const item of backlogItems) {
1646
2022
  if (!item.change_name)
1647
2023
  continue;
@@ -1708,8 +2084,30 @@ export async function evaluateFeatureQuality(paths, config, feature) {
1708
2084
  };
1709
2085
  }
1710
2086
  export function buildAdrMarkdown(feature, unlocked, timestamp) {
1711
- const refs = [feature.id, feature.origin_ref].filter(Boolean).join(', ') || '-';
1712
- return `# ADR ${feature.id}
2087
+ const refs = [feature.id, feature.origin_ref].filter(Boolean);
2088
+ const refsText = refs.join(', ') || '-';
2089
+ const frontmatter = yaml
2090
+ .stringify({
2091
+ schema_version: 1,
2092
+ artifact_type: 'ADR',
2093
+ id: `ADR-${feature.id}`,
2094
+ feature_id: feature.id,
2095
+ title: `ADR ${feature.id}: ${feature.title}`,
2096
+ status: feature.status,
2097
+ origin: { type: 'feature', ref: feature.id },
2098
+ related_ids: refs,
2099
+ created_at: timestamp,
2100
+ updated_at: timestamp,
2101
+ decision_status: 'ACCEPTED',
2102
+ supersedes: [],
2103
+ superseded_by: [],
2104
+ references: refs,
2105
+ })
2106
+ .trim();
2107
+ return `---
2108
+ ${frontmatter}
2109
+ ---
2110
+ # ADR ${feature.id}
1713
2111
 
1714
2112
  ## Context
1715
2113
  - Feature: ${feature.id} - ${feature.title}
@@ -1732,7 +2130,7 @@ Consolidate feature ${feature.id} and make the result official in SDD memory.
1732
2130
  ${unlocked.length > 0 ? unlocked.map((id) => `- ${id}`).join('\n') : '- None'}
1733
2131
 
1734
2132
  ## References
1735
- - ${refs}
2133
+ - ${refsText}
1736
2134
  `;
1737
2135
  }
1738
2136
  export function applyLoggedTransition(transitionLog, entityType, entity, toStatus, options) {
@@ -1762,17 +2160,7 @@ export function gateSatisfied(status) {
1762
2160
  return status === 'aprovada' || status === 'nao_exigida';
1763
2161
  }
1764
2162
  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;
2163
+ return detectSddEntityType(ref);
1776
2164
  }
1777
2165
  export async function pathExists(targetPath) {
1778
2166
  try {
@@ -2170,6 +2558,6 @@ Regras:
2170
2558
  1. Cite as skills que esta aplicando no inicio da resposta.
2171
2559
  2. Siga a ordem definida acima.
2172
2560
  3. Se faltar contexto, consulte primeiro o estado canônico em .sdd/state/*.yaml.
2173
- 4. Finalize com proximos comandos OpenSDD recomendados.`;
2561
+ 4. Finalize com proximos comandos CodeSDD recomendados.`;
2174
2562
  }
2175
2563
  //# sourceMappingURL=legacy-operations.js.map