gennady 0.6.0 → 0.7.0

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 (319) hide show
  1. package/README.md +2 -15
  2. package/ai/agents/agent-resolve-conflicts.xml +6 -0
  3. package/ai/agents/agent-review-verifier.xml +6 -0
  4. package/ai/directives/architecture/README.md +21 -0
  5. package/ai/directives/coding/README.md +23 -0
  6. package/ai/directives/coding/result-conventions.xml +55 -0
  7. package/ai/directives/coding/svelte5-runes.xml +248 -0
  8. package/ai/directives/coding/sveltekit-rules.xml +247 -0
  9. package/ai/directives/coding/typescript-rules.xml +589 -0
  10. package/ai/directives/coding/uikit-component-storybook.xml +347 -0
  11. package/ai/directives/coding/uikit-component-svelte.xml +344 -0
  12. package/ai/directives/coding/uikit-spec-drafting.xml +243 -0
  13. package/ai/directives/dbc-audit.directive.xml +131 -0
  14. package/ai/directives/dev-review.directive.xml +148 -0
  15. package/ai/directives/infra/README.md +11 -0
  16. package/ai/directives/infra/eslint-setup.xml +467 -0
  17. package/ai/directives/infra/git-setup.xml +261 -0
  18. package/ai/directives/infra/nodejs-npm-setup.xml +354 -0
  19. package/ai/directives/infra/storybook-setup.xml +153 -0
  20. package/ai/directives/knowledge.xml +206 -0
  21. package/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
  22. package/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
  23. package/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
  24. package/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
  25. package/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
  26. package/ai/directives/sdd/README.md +49 -0
  27. package/ai/directives/sdd/audit.directive.xml +543 -0
  28. package/ai/directives/sdd/discovery.directive.xml +824 -0
  29. package/ai/directives/sdd/fix.directive.xml +249 -0
  30. package/ai/directives/sdd/module-decomposition.directive.xml +666 -0
  31. package/ai/directives/sdd/phase-execution-protocol.xml +339 -0
  32. package/ai/directives/sdd/scaffold.directive.xml +717 -0
  33. package/ai/directives/sdd/setup.directive.xml +213 -0
  34. package/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
  35. package/ai/directives/semantic-change-extractor.directive.xml +99 -0
  36. package/ai/directives/testing/README.md +25 -0
  37. package/ai/directives/testing/common.xml +234 -0
  38. package/ai/directives/testing/node-test.xml +288 -0
  39. package/ai/directives/testing/playwright-cli.xml +199 -0
  40. package/ai/directives/testing/playwright-e2e.xml +292 -0
  41. package/ai/directives/testing/storybook-usage.xml +173 -0
  42. package/ai/directives/testing/svelte-testing.xml +237 -0
  43. package/ai/directives/testing/vitest-rules.xml +326 -0
  44. package/ai/docs/README.md +17 -0
  45. package/ai/docs/ai-icl.md +538 -0
  46. package/ai/docs/ai-priming.md +548 -0
  47. package/ai/docs/ai-prompt-formats.md +406 -0
  48. package/ai/docs/ai-promting.md +572 -0
  49. package/ai/drafts/DRAFT.md +120 -0
  50. package/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
  51. package/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
  52. package/ai/drafts/d.md +65 -0
  53. package/ai/drafts/music-posts.md +105 -0
  54. package/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
  55. package/ai/fw/v1/core/mental-model.xml +50 -0
  56. package/ai/fw/v1/discovery/intent-reactor.xml +92 -0
  57. package/ai/fw/v1/production/swarm-protocol.xml +122 -0
  58. package/ai/fw/v1/review/quality-pipeline.xml +102 -0
  59. package/ai/fw/v2/arch-universal.xml +73 -0
  60. package/ai/fw-draft/README.md +79 -0
  61. package/ai/fw-draft/bin/discovery.sh +116 -0
  62. package/ai/fw-draft/gennady.xml +58 -0
  63. package/ai/fw-draft/provider/claude.xml +16 -0
  64. package/ai/fw-draft/provider/cursor.xml +23 -0
  65. package/ai/fw-draft/provider/default.xml +12 -0
  66. package/ai/fw-draft/roles/developer.xml +18 -0
  67. package/ai/fw-draft/router.xml +39 -0
  68. package/ai/fw-draft/routes/development.xml +32 -0
  69. package/ai/fw-draft/routes/universal.xml +58 -0
  70. package/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
  71. package/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
  72. package/dist/ai/agents/agent-resolve-conflicts.xml +6 -0
  73. package/dist/ai/agents/agent-review-verifier.xml +6 -0
  74. package/dist/ai/directives/architecture/README.md +21 -0
  75. package/dist/ai/directives/coding/README.md +23 -0
  76. package/dist/ai/directives/coding/result-conventions.xml +55 -0
  77. package/dist/ai/directives/coding/svelte5-runes.xml +248 -0
  78. package/dist/ai/directives/coding/sveltekit-rules.xml +247 -0
  79. package/dist/ai/directives/coding/typescript-rules.xml +589 -0
  80. package/dist/ai/directives/coding/uikit-component-storybook.xml +347 -0
  81. package/dist/ai/directives/coding/uikit-component-svelte.xml +344 -0
  82. package/dist/ai/directives/coding/uikit-spec-drafting.xml +243 -0
  83. package/dist/ai/directives/dbc-audit.directive.xml +131 -0
  84. package/dist/ai/directives/dev-review.directive.xml +148 -0
  85. package/dist/ai/directives/infra/README.md +11 -0
  86. package/dist/ai/directives/infra/eslint-setup.xml +467 -0
  87. package/dist/ai/directives/infra/git-setup.xml +261 -0
  88. package/dist/ai/directives/infra/nodejs-npm-setup.xml +354 -0
  89. package/dist/ai/directives/infra/storybook-setup.xml +153 -0
  90. package/dist/ai/directives/knowledge.xml +206 -0
  91. package/dist/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
  92. package/dist/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
  93. package/dist/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
  94. package/dist/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
  95. package/dist/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
  96. package/dist/ai/directives/sdd/README.md +49 -0
  97. package/dist/ai/directives/sdd/audit.directive.xml +543 -0
  98. package/dist/ai/directives/sdd/discovery.directive.xml +824 -0
  99. package/dist/ai/directives/sdd/fix.directive.xml +249 -0
  100. package/dist/ai/directives/sdd/module-decomposition.directive.xml +666 -0
  101. package/dist/ai/directives/sdd/phase-execution-protocol.xml +339 -0
  102. package/dist/ai/directives/sdd/scaffold.directive.xml +717 -0
  103. package/dist/ai/directives/sdd/setup.directive.xml +213 -0
  104. package/dist/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
  105. package/dist/ai/directives/semantic-change-extractor.directive.xml +99 -0
  106. package/dist/ai/directives/testing/README.md +25 -0
  107. package/dist/ai/directives/testing/common.xml +234 -0
  108. package/dist/ai/directives/testing/node-test.xml +288 -0
  109. package/dist/ai/directives/testing/playwright-cli.xml +199 -0
  110. package/dist/ai/directives/testing/playwright-e2e.xml +292 -0
  111. package/dist/ai/directives/testing/storybook-usage.xml +173 -0
  112. package/dist/ai/directives/testing/svelte-testing.xml +237 -0
  113. package/dist/ai/directives/testing/vitest-rules.xml +326 -0
  114. package/dist/ai/docs/README.md +17 -0
  115. package/dist/ai/docs/ai-icl.md +538 -0
  116. package/dist/ai/docs/ai-priming.md +548 -0
  117. package/dist/ai/docs/ai-prompt-formats.md +406 -0
  118. package/dist/ai/docs/ai-promting.md +572 -0
  119. package/dist/ai/drafts/DRAFT.md +120 -0
  120. package/dist/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
  121. package/dist/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
  122. package/dist/ai/drafts/d.md +65 -0
  123. package/dist/ai/drafts/music-posts.md +105 -0
  124. package/dist/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
  125. package/dist/ai/fw/v1/core/mental-model.xml +50 -0
  126. package/dist/ai/fw/v1/discovery/intent-reactor.xml +92 -0
  127. package/dist/ai/fw/v1/production/swarm-protocol.xml +122 -0
  128. package/dist/ai/fw/v1/review/quality-pipeline.xml +102 -0
  129. package/dist/ai/fw/v2/arch-universal.xml +73 -0
  130. package/dist/ai/fw-draft/README.md +79 -0
  131. package/dist/ai/fw-draft/bin/discovery.sh +116 -0
  132. package/dist/ai/fw-draft/gennady.xml +58 -0
  133. package/dist/ai/fw-draft/provider/claude.xml +16 -0
  134. package/dist/ai/fw-draft/provider/cursor.xml +23 -0
  135. package/dist/ai/fw-draft/provider/default.xml +12 -0
  136. package/dist/ai/fw-draft/roles/developer.xml +18 -0
  137. package/dist/ai/fw-draft/router.xml +39 -0
  138. package/dist/ai/fw-draft/routes/development.xml +32 -0
  139. package/dist/ai/fw-draft/routes/universal.xml +58 -0
  140. package/dist/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
  141. package/dist/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
  142. package/dist/chunks/devtools-B-7ugZhF.js +79 -0
  143. package/dist/chunks/{help.cmd-CWasx25o.js → help.cmd-B_G7EWzF.js} +9 -2
  144. package/dist/chunks/{index-B63fYXL2.js → index-BeL1Zcbg.js} +1 -1
  145. package/dist/chunks/index-CVR66voe.js +26963 -0
  146. package/dist/chunks/index-CXuhZzS3.js +16979 -0
  147. package/dist/chunks/{index-B5bA2T7A.js → index-CaahtXiM.js} +33 -9
  148. package/dist/chunks/{index-iqg0w_pE.js → index-CiEM-8nJ.js} +35 -19
  149. package/dist/chunks/{index-B4m0-PAT.js → index-D1qsi0Uc.js} +57 -33
  150. package/dist/chunks/index-D9ceRUyB.js +443 -0
  151. package/dist/chunks/index-DJpVmyp2.js +176 -0
  152. package/dist/chunks/{index-C0andxna.js → index-DU6jD7SS.js} +1 -1
  153. package/dist/chunks/index-KxSZKmZn.js +540 -0
  154. package/dist/chunks/{index-Dqe1TdW4.js → index-UbHoePfr.js} +12 -12
  155. package/dist/chunks/{index-5xIgwwKx.js → index-g1LXlp77.js} +2 -2
  156. package/dist/chunks/index-zBnnuvLA.js +3788 -0
  157. package/dist/chunks/{run-review-command.logic-a_M3CkeZ.js → run-review-command.logic-DpkRoEi8.js} +2 -2
  158. package/dist/chunks/services-CaLOhuLV.js +2889 -0
  159. package/dist/chunks/shared-Bjy30TeM.js +665 -0
  160. package/dist/cli/cmd/_shared/prompt/io/load-agent-template.io.d.ts +3 -3
  161. package/dist/cli/cmd/_shared/prompt/logic/build-ai-first-knowledge-block.logic.d.ts +3 -3
  162. package/dist/cli/cmd/_shared/prompt/logic/build-ai-verify-placeholders.logic.d.ts +7 -4
  163. package/dist/cli/cmd/_shared/prompt/logic/verify-commands/resolve-verify-commands.logic.d.ts +5 -0
  164. package/dist/cli/cmd/_shared/update-check-worker.d.ts +1 -0
  165. package/dist/cli/cmd/_shared/update-check.d.ts +38 -0
  166. package/dist/cli/cmd/agent-mon/cmd/create-providers.d.ts +15 -0
  167. package/dist/cli/cmd/agent-mon/cmd/index.d.ts +1 -0
  168. package/dist/cli/cmd/agent-mon/cmd/run.d.ts +12 -0
  169. package/dist/cli/cmd/agent-mon/state/create-state-manager.d.ts +32 -0
  170. package/dist/cli/cmd/agent-mon/state/group-by-provider.d.ts +14 -0
  171. package/dist/cli/cmd/agent-mon/state/index.d.ts +5 -0
  172. package/dist/cli/cmd/agent-mon/state/is-waiting.d.ts +9 -0
  173. package/dist/cli/cmd/agent-mon/state/view-model.type.d.ts +74 -0
  174. package/dist/cli/cmd/agent-mon/ui/app.d.ts +16 -0
  175. package/dist/cli/cmd/agent-mon/ui/column-view.d.ts +14 -0
  176. package/dist/cli/cmd/agent-mon/ui/index.d.ts +10 -0
  177. package/dist/cli/cmd/agent-mon/ui/provider-column.d.ts +14 -0
  178. package/dist/cli/cmd/agent-mon/ui/session-card.d.ts +12 -0
  179. package/dist/cli/cmd/agent-mon/ui/status-badge.d.ts +10 -0
  180. package/dist/cli/cmd/alt-opinion/alt-opinion-parser.d.ts +18 -0
  181. package/dist/cli/cmd/alt-opinion/alt-opinion-runner.d.ts +32 -0
  182. package/dist/cli/cmd/alt-opinion/alt-opinion.cmd.d.ts +34 -0
  183. package/dist/cli/cmd/alt-opinion/alt-opinion.types.d.ts +88 -0
  184. package/dist/cli/cmd/alt-opinion/index.d.ts +1 -0
  185. package/dist/cli/cmd/cat/cat-url.fn.d.ts +19 -0
  186. package/dist/cli/cmd/lint/checks/anchor.check.d.ts +11 -0
  187. package/dist/cli/cmd/lint/checks/dbc-contract.check.d.ts +16 -0
  188. package/dist/cli/cmd/lint/checks/disables.check.d.ts +12 -0
  189. package/dist/cli/cmd/lint/checks/file-header.check.d.ts +10 -0
  190. package/dist/cli/cmd/lint/checks/language.check.d.ts +11 -0
  191. package/dist/cli/cmd/lint/index.d.ts +1 -0
  192. package/dist/cli/cmd/lint/lint.cmd.d.ts +18 -0
  193. package/dist/cli/cmd/lint/lint.types.d.ts +72 -0
  194. package/dist/cli/cmd/lint/utils/resolve-references.fn.d.ts +32 -0
  195. package/dist/cli/cmd/remote-console/index.d.ts +2 -0
  196. package/dist/cli/cmd/remote-console/remote-console.cmd.d.ts +55 -0
  197. package/dist/cli/cmd/resolve-conflicts/_core/io/resolve-conflicts-template-load.io.d.ts +2 -2
  198. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-args-parse.logic.d.ts +3 -3
  199. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-run.logic.d.ts +3 -3
  200. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-context-git-build.logic.d.ts +4 -4
  201. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-artifact.type.d.ts +3 -1
  202. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-args.type.d.ts +3 -1
  203. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-result.type.d.ts +5 -1
  204. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-context-git.type.d.ts +18 -2
  205. package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-artifact-build.xml.d.ts +6 -6
  206. package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-render.xml.d.ts +4 -4
  207. package/dist/cli/cmd/review/_core/io/load-review-verify-template.io.d.ts +2 -2
  208. package/dist/cli/cmd/review/_core/logic/build-review-context-git.logic.d.ts +3 -3
  209. package/dist/cli/cmd/review/_core/logic/build-review-context-vcs.logic.d.ts +2 -2
  210. package/dist/cli/cmd/review/_core/logic/load-review-context-mr.logic.d.ts +5 -5
  211. package/dist/cli/cmd/review/_core/logic/parse-review-command-args.logic.d.ts +3 -3
  212. package/dist/cli/cmd/review/_core/logic/resolve-review-intent.logic.d.ts +3 -3
  213. package/dist/cli/cmd/review/_core/logic/run-review-command.logic.d.ts +3 -3
  214. package/dist/cli/cmd/review/_core/types/review-artifact.type.d.ts +4 -1
  215. package/dist/cli/cmd/review/_core/types/review-command-args.type.d.ts +7 -1
  216. package/dist/cli/cmd/review/_core/types/review-command-mode.type.d.ts +1 -1
  217. package/dist/cli/cmd/review/_core/types/review-command-options.type.d.ts +3 -1
  218. package/dist/cli/cmd/review/_core/types/review-command-result.type.d.ts +5 -1
  219. package/dist/cli/cmd/review/_core/types/review-context-git.type.d.ts +3 -1
  220. package/dist/cli/cmd/review/_core/types/review-context-mr.type.d.ts +22 -3
  221. package/dist/cli/cmd/review/_core/types/review-context-vcs.type.d.ts +4 -1
  222. package/dist/cli/cmd/review/_core/types/review-intent.type.d.ts +1 -1
  223. package/dist/cli/cmd/review/_core/xml/build-review-artifact.xml.d.ts +10 -10
  224. package/dist/cli/cmd/review/_core/xml/render-review-issues.xml.d.ts +3 -3
  225. package/dist/cli/cmd/review/_core/xml/render-review-verify.xml.d.ts +4 -4
  226. package/dist/cli/cmd/sync/index.d.ts +1 -0
  227. package/dist/cli/cmd/sync/sync-core.d.ts +65 -0
  228. package/dist/cli/cmd/sync/sync-formatter.d.ts +12 -0
  229. package/dist/cli/cmd/sync/sync.cmd.d.ts +33 -0
  230. package/dist/cli/cmd/sync/sync.types.d.ts +50 -0
  231. package/dist/cli/cmd/vcs-reply/vcs-reply.cmd.d.ts +4 -4
  232. package/dist/cli/utils/ai-legacy/ai-legacy-agent.d.ts +12 -11
  233. package/dist/cli/utils/ai-legacy/ai-legacy-core.d.ts +33 -17
  234. package/dist/cli/utils/ai-legacy/ai-legacy-model.d.ts +42 -23
  235. package/dist/cli/utils/cat-gen/cat-gen.d.ts +19 -8
  236. package/dist/cli/utils/commit-gen/commit-gen.d.ts +39 -15
  237. package/dist/cli/utils/prompts/index.d.ts +6 -6
  238. package/dist/cli/utils/review-gen/review-gen.d.ts +33 -9
  239. package/dist/gennady.js +30 -10
  240. package/dist/index.d.ts +1 -0
  241. package/dist/index.js +44 -23
  242. package/dist/services/agent-mon/diff/diff.d.ts +9 -0
  243. package/dist/services/agent-mon/diff/index.d.ts +1 -0
  244. package/dist/services/agent-mon/index.d.ts +10 -0
  245. package/dist/services/agent-mon/model/agent-provider.type.d.ts +20 -0
  246. package/dist/services/agent-mon/model/agent-session.type.d.ts +49 -0
  247. package/dist/services/agent-mon/model/errors.d.ts +20 -0
  248. package/dist/services/agent-mon/model/index.d.ts +7 -0
  249. package/dist/services/agent-mon/model/observe-opts.type.d.ts +7 -0
  250. package/dist/services/agent-mon/model/scan-opts.type.d.ts +7 -0
  251. package/dist/services/agent-mon/model/session-changes.type.d.ts +10 -0
  252. package/dist/services/agent-mon/monitor/agent-monitor.d.ts +44 -0
  253. package/dist/services/agent-mon/monitor/create-monitor.d.ts +6 -0
  254. package/dist/services/agent-mon/monitor/index.d.ts +2 -0
  255. package/dist/services/agent-mon/observe/index.d.ts +1 -0
  256. package/dist/services/agent-mon/observe/observe.d.ts +12 -0
  257. package/dist/services/agent-mon/providers/claude/claude-provider.d.ts +50 -0
  258. package/dist/services/agent-mon/providers/claude/index.d.ts +5 -0
  259. package/dist/services/agent-mon/providers/claude/ps.d.ts +36 -0
  260. package/dist/services/agent-mon/providers/claude/session-json.d.ts +37 -0
  261. package/dist/services/agent-mon/providers/opencode/db.d.ts +41 -0
  262. package/dist/services/agent-mon/providers/opencode/index.d.ts +3 -0
  263. package/dist/services/agent-mon/providers/opencode/model-parser.d.ts +6 -0
  264. package/dist/services/agent-mon/providers/opencode/opencode-provider.d.ts +45 -0
  265. package/dist/services/ai-client/providers/ai-model.type.d.ts +14 -0
  266. package/dist/services/ai-client/providers/open-router/open-router-model.type.d.ts +1 -4
  267. package/dist/services/ai-client/providers/open-router/open-router-provider.d.ts +17 -0
  268. package/dist/services/ai-client/providers/openai-like-provider.d.ts +1 -0
  269. package/dist/services/data-ore/telegram/telegram-data-ore.d.ts +17 -0
  270. package/dist/services/data-ore/telegram/telegram-data-ore.types.d.ts +4 -0
  271. package/dist/services/data-ore/telegram/telegram-demo-music-helper.d.ts +1 -0
  272. package/dist/services/data-ore/telegram/telegram-demo.d.ts +1 -0
  273. package/dist/services/dbc/linter/dbc-ast-adapter.types.d.ts +82 -0
  274. package/dist/services/dbc/linter/dbc-linter.types.d.ts +95 -0
  275. package/dist/services/dbc/linter/implementations/ts/dbc-ts-ast-adapter.d.ts +183 -0
  276. package/dist/services/dbc/linter/implementations/ts/dbc-ts-linter.d.ts +152 -0
  277. package/dist/services/dbc/parser/dbc-parser.types.d.ts +16 -16
  278. package/dist/services/dbc/parser/implementations/jsdoc/dbc-jsdoc-parser.d.ts +14 -4
  279. package/dist/services/logger/logger.d.ts +26 -6
  280. package/dist/services/remote-console/client/remote-console-client-serializer.d.ts +7 -0
  281. package/dist/services/remote-console/client/remote-console-client.d.ts +20 -0
  282. package/dist/services/remote-console/client/remote-console-client.types.d.ts +88 -0
  283. package/dist/services/remote-console/remote-console.d.ts +6 -0
  284. package/dist/services/remote-console/server/remote-console-server.d.ts +10 -0
  285. package/dist/services/remote-console/server/remote-console-server.types.d.ts +44 -0
  286. package/dist/services/remote-console/server/remote-console-stdout-writer.d.ts +26 -0
  287. package/dist/services/vcs-client/abstract/vcs-client-merge-discussions.d.ts +22 -14
  288. package/dist/services/vcs-client/abstract/vcs-client-merge-requests.d.ts +31 -14
  289. package/dist/services/vcs-client/abstract/vcs-client-repository-files.d.ts +16 -0
  290. package/dist/services/vcs-client/abstract/vcs-client.d.ts +9 -5
  291. package/dist/services/vcs-client/entities/vcs-file-content.type.d.ts +24 -0
  292. package/dist/services/vcs-client/entities/vcs-merge-request-changes.type.d.ts +32 -0
  293. package/dist/services/vcs-client/entities/vcs-url.type.d.ts +14 -0
  294. package/dist/services/vcs-client/entities/vcs-user.type.d.ts +3 -0
  295. package/dist/services/vcs-client/github/vcs-github-client.d.ts +31 -0
  296. package/dist/services/vcs-client/github/vcs-github-merge-requests.d.ts +40 -0
  297. package/dist/services/vcs-client/github/vcs-github-repository-files.d.ts +27 -0
  298. package/dist/services/vcs-client/gitlab/vcs-gitlab-client.d.ts +13 -4
  299. package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-discussions.d.ts +16 -5
  300. package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-requests.d.ts +24 -5
  301. package/dist/services/vcs-client/gitlab/vcs-gitlab-repository-files.d.ts +27 -0
  302. package/dist/services/vcs-client/parse-vcs-url.d.ts +3 -0
  303. package/dist/shared/backend/git/git-core.d.ts +24 -22
  304. package/dist/shared/backend/git/git-diff.d.ts +16 -5
  305. package/dist/shared/backend/rc/rc-config.d.ts +27 -15
  306. package/dist/shared/common/exec.d.ts +4 -6
  307. package/dist/shared/common/files.d.ts +1 -3
  308. package/dist/shared/common/language.d.ts +3 -6
  309. package/dist/shared/common/parse-args.d.ts +1 -4
  310. package/dist/shared/common/style.d.ts +3 -3
  311. package/dist/shared/common/think.d.ts +1 -5
  312. package/dist/shared/common/tokens.d.ts +1 -5
  313. package/dist/shared/common/unguard.d.ts +4 -8
  314. package/dist/shared/common/xml.d.ts +16 -12
  315. package/package.json +20 -4
  316. package/dist/.ai/agents/agent-review-verifier.xml +0 -181
  317. package/dist/chunks/index-CNbmXK8M.js +0 -3548
  318. package/dist/chunks/services-Sb7TwLxt.js +0 -122
  319. package/dist/chunks/shared-BgLzFWMH.js +0 -577
@@ -0,0 +1,824 @@
1
+ <SddDiscovery keywords="discovery, scope, vision, golden-dx, design-variants, decision-log, scope-rules, scope-type, infrastructure, contracts, library, product, living-spec, frame-stack, evidence-hygiene, runtime-backing, sdd-scope-discovery" type="directive" ver="3.1">
2
+ <Directive_Context>
3
+ <Mission>
4
+ Turn the operator's intent for a scope into an approved scope spec at `specs/<scope-name>/<scope-name>.spec.md`.
5
+
6
+ Input: scope name + scope-type + operator intent (raw idea, or existing spec for `refine` / `pivot`).
7
+ Output: self-contained living scope spec. The required section set depends on `scope-type`:
8
+ - `infrastructure` → Vision, Tool Stack (Decision Log per tool), Dev Workflow Example, File Structure, Effective Rules, Handoff.
9
+ - `contracts` → Vision, Versioning Policy, Interfaces (schema / OpenAPI / proto), Compatibility Matrix, Decision Log, Handoff.
10
+ - `library` → Vision, Golden DX, Public API Surface, DbC contracts, Architecture, Decision Log, Handoff.
11
+ - `product` → Vision, Project Type, Golden DX, Requirements Gate, Architecture variants, Decision Log, Handoff to `module-decomposition`.
12
+
13
+ Living spec: no frozen sections. Any section may be updated via `refine` without a full pivot ritual. `pivot` remains reserved for breaking / incompatible changes.
14
+
15
+ Out of scope: module decomposition, entity inventory, DbC — those belong to `module-decomposition` for library / product scopes.
16
+
17
+ **Glossary.** Scope = architecturally cohesive unit (own runtime / stack / deployment target / UX surface). scope-type ∈ {infrastructure, contracts, library, product}.
18
+ </Mission>
19
+ </Directive_Context>
20
+
21
+ <Belief_State>
22
+ <Axiom id="AX_DIRECTIVE_MODE">
23
+ **Three modes, auto-detected:**
24
+ - `greenfield` — scope spec does not exist.
25
+ - `refine` — extension or tightening of an existing spec (new requirements, new tools, new contracts) without replacing architecture.
26
+ - `pivot` — replacement of foundational decisions (architecture swap, scope-type swap, tool stack swap). Triggers supersession in the Decision Log.
27
+
28
+ Discriminator: if the old decision remains valid in parallel with the new one → `refine`. If the old decision is replaced by an incompatible one → `pivot`.
29
+ </Axiom>
30
+
31
+ <Axiom id="AX_SCOPE_TYPE_BRANCH">
32
+ scope-type drives the flow of the directive:
33
+
34
+ | scope-type | STEP_3 | STEP_4 | STEP_5 | STEP_6 |
35
+ |---|---|---|---|---|
36
+ | infrastructure | Tool Categories + Choices | Dev Workflow Example | File Structure | Effective Rules |
37
+ | contracts | Interface Declaration | Versioning Policy | Compatibility Matrix | — |
38
+ | library | Requirements Gate | Golden DX | Architecture | — |
39
+ | product | Requirements Gate | Golden DX | Design Variants | Architecture Choice |
40
+
41
+ STEP_2 (Intent Capture), STEP_7 (External Dependencies Audit), and STEP_8 (Final Spec) are identical across all types.
42
+ </Axiom>
43
+
44
+ <Axiom id="AX_MODE_AUTO_DETECT_OR_HALT">
45
+ | spec exists? | verb | Mode |
46
+ |---|---|---|
47
+ | No | — | greenfield |
48
+ | Yes | refine / extend / add / расширь / добавь / уточни | refine |
49
+ | Yes | pivot / replace / заменим / поменяем архитектуру | pivot |
50
+ | Yes | none of the above | HALT `H_AMBIGUOUS_MODE` — ask binary: refine or pivot? |
51
+ </Axiom>
52
+
53
+ <Axiom id="AX_PORTAL_READ_ONLY_WITH_PLACEHOLDER_EXCEPTION">
54
+ `discovery` reads `specs/README.md` for project context (vision, scope graph, sibling scopes). It MUST NOT rewrite the file. The narrow exception (per `setup` `AX_PORTAL_PRIMARY_OWNER`): when `discovery` creates a brand-new scope, it MAY append one placeholder row to the Scopes table tagged `🚧 (awaiting setup sync)`. Any other edit is forbidden — promote `setup` instead.
55
+ </Axiom>
56
+
57
+ <Axiom id="AX_LIVING_SPEC">
58
+ The scope spec is a living document. In `refine` mode any section may be updated in place. There is no frozen 7 Handoff — the Handoff section evolves as modules are added.
59
+
60
+ `pivot` uses Decision Log supersession: the old entry → `status: superseded`, body preserved; the new entry carries `Supersedes: D-NNN` and `Was → Now`. The spec body is rewritten in place; git history is the full predecessor.
61
+ </Axiom>
62
+
63
+ <Axiom id="AX_SPEC_IS_SOLE_SOURCE">
64
+ The directive reads specs and never reads code. The only directive permitted to read code is `audit`.
65
+ - `greenfield` — operator input + rule files only.
66
+ - `refine` / `pivot` — Portal (for context) + existing scope spec.
67
+ </Axiom>
68
+
69
+ <Axiom id="AX_INFRASTRUCTURE_FLOW">
70
+ For scope-type=infrastructure:
71
+
72
+ **Tool categories — two classes.** Mandatory: vcs, package-management, git-hooks. Optional: type-check, linting, formatting, test-unit, test-e2e, test-ui, bundler, ci, monorepo-tool, docs. The agent proposes a subset from intent. Mandatory categories cannot be dropped.
73
+
74
+ **vcs is always mandatory.** Resolves to `ai/directives/infra/git-setup.xml`.
75
+
76
+ **Per tool category: 2–3 candidates with trade-offs.** Operator picks → Mandatory Rationale Pull → Decision Log entry. No tool may be locked without a Decision Log entry.
77
+
78
+ **Tool interaction check.** After every tool is chosen, verify compatibility (linter vs formatter, test runner vs type-check, CI vs package manager).
79
+
80
+ **Effective rules derived from tools.** After tool stack is finalized, look up each chosen tool in `ai/directives/knowledge.xml` `<Rules>` section: find every rule whose `<Triggers>` match the tool name or its config artefacts. Record matched rule `<File>` paths in spec section 5 Effective Rules. Missing-rule handling: governed by `AX_SCOPE_RULES_DECLARATION` (in-session operator pick — skip / research-and-author / defer).
81
+
82
+ **Dev workflow example is required.** The spec includes a Developer Workflow Example (shell-script shape) before final approval.
83
+ </Axiom>
84
+
85
+ <Axiom id="AX_PRODUCT_LIBRARY_FLOW">
86
+ For scope-type=product and scope-type=library:
87
+
88
+ **Requirements gate before design.** Architecture variants are forbidden until REQUIREMENTS_GATE is closed. Required: Functional Requirements, Non-Functional Constraints, Out-of-Scope, Project-Wide Rules (Rules).
89
+
90
+ **Golden DX example gate.** A Golden DX Example is mandatory before Design Variants. library → Public API DX. product → UX-flow DX or CLI DX depending on Project Type.
91
+
92
+ **Project Type scales depth** (product only):
93
+ - `app` (mobile / desktop / spa): 2–3 architectural variants.
94
+ - `service-module-sdk`: 2–3 variants across transport + persistence.
95
+ - `cli-utility`: 1–2 variants (minimal depth).
96
+
97
+ **YAGNI guard.** Only abstractions needed for v1. Future-proof extensions without a confirmed consumer are forbidden.
98
+ </Axiom>
99
+
100
+ <Axiom id="AX_CONTRACTS_FLOW">
101
+ For scope-type=contracts:
102
+ - Interface Declaration: schema format (OpenAPI / gRPC proto / JSON Schema / GraphQL), versioning scheme (semver / date-based / none), namespacing.
103
+ - Compatibility Matrix: backward-compat guarantees, breaking-change protocol.
104
+ - Consumer declaration: which scopes consume this contracts scope.
105
+ </Axiom>
106
+
107
+ <Axiom id="AX_RUNTIME_BACKING_EXPLICIT">
108
+ For product / library scope specs, runtime backing posture is declared at the scope level inside Requirements & Constraints under «Runtime Backing & Deferred Scope»:
109
+ - Posture per major capability: `not-implemented` | `simulation` | `real-runtime`.
110
+ - Deferred scope: parts whose real runtime is intentionally not delivered in v1, with reason.
111
+ - Trust boundaries that require a real runtime hook (auth, payments, persistence) are listed explicitly.
112
+
113
+ Establishing posture early prevents `module-decomposition` and `task-scaffolding` from misclassifying simulation seams as real implementations.
114
+ </Axiom>
115
+
116
+ <Axiom id="AX_SCOPE_RULES_DECLARATION">
117
+ Scope-wide rules are declared in spec Rules. Categories with directory mapping:
118
+ - coding → `ai/directives/coding/<rule>.xml`
119
+ - testing → `ai/directives/testing/<rule>.xml`
120
+ - architecture → `ai/directives/architecture/<rule>.xml`
121
+ - infra → `ai/directives/infra/<rule>.xml`
122
+
123
+ Every rule reference must resolve to an existing file. Missing → operator picks resolution IN-SESSION (never a halt, never an autonomous task):
124
+ - **skip** — tool's own defaults are the discipline; record in Decision Log.
125
+ - **research-and-author** — agent WebFetches authoritative docs (official source from `package.json#homepage` or operator-supplied URL), drafts rule file, operator approves before write to `ai/directives/<category>/<name>.xml`. Drafts capture TIMELESS engineering practice only — discipline, trade-offs, anti-pattern categories, binary invariants. NOT captured: version numbers, CLI flags, config-syntax snippets, plugin lists (those churn between releases; they live in `package.json` / config files).
126
+ - **defer** — record as Open Risk in Handoff with `Owner: operator-action`; proceed.
127
+
128
+ Operator refuses to choose → `H_MISSING_RULE_FILE`. Otherwise no halt.
129
+ </Axiom>
130
+
131
+ <Axiom id="AX_RULE_ACTIVATION">
132
+ Two stages:
133
+ - Stage A — relevance per category (recommend activate / recommend skip + rationale). Operator locks the list.
134
+ - Stage B — per-rule axiom walkthrough (infra/* and architecture/* rules only). Read `Mission` + `Belief_State` + `Reward_Criteria`. Operator decides Accept / Adapt / Override → Decision Log.
135
+
136
+ Defaults: infra/*, architecture/* → walk through now. coding/*, testing/* → deferred — phase-subagent loads them at phase entry per `phase-execution-protocol`.
137
+ </Axiom>
138
+
139
+ <Axiom id="AX_DECISION_LOG_REQUIRED">
140
+ Every non-trivial decision → Decision Log entry. Format: D-NNN, Status, Recorded, Why (operator's wording), Risk accepted, Rejected alternatives. IDs are stable.
141
+ </Axiom>
142
+
143
+ <Axiom id="AX_PIVOT_REQUIRES_SUPERSESSION">
144
+ In `pivot` mode every replaced decision: the old D-NNN → `status: superseded`. The new D-NNN carries `Was → Now` + `Supersedes: D-NNN` + a git ref pointing to the pre-rework state. Pivot Invalidation List (Pivot Invalidation List) enumerates downstream artifacts requiring `refine-module` / reopen — consumed by `audit` via `AX_STALE_AFTER_PIVOT_VERIFICATION`.
145
+ </Axiom>
146
+
147
+ <Axiom id="AX_HANDOFF_TO_MODULE_DECOMPOSITION">
148
+ For product / library scope: the spec carries Handoff with primary input for `module-decomposition`, named abstractions, open risks.
149
+ </Axiom>
150
+
151
+ <Axiom id="AX_CROSS_SCOPE_DEPENDENCIES">
152
+ Scope spec declares `depends-on` edges in Scope Dependencies. These edges feed cascade computation in `task-scaffolding`. Cross-scope contracts are sourced from `contracts`-type scopes — never described inside a product scope spec.
153
+ </Axiom>
154
+
155
+ <Axiom id="AX_EVIDENCE_HYGIENE">
156
+ Separate Facts / Assumptions / Hypotheses in every intake-style frame.
157
+ - **Facts** — directly observable from input artifacts (Portal, sibling specs, rule files).
158
+ - **Assumptions** — working assumptions awaiting confirmation; mark explicitly.
159
+ - **Hypotheses** — conjectures requiring operator validation before they harden into requirements.
160
+
161
+ Conflating the three is the most common path to false confidence; surface them in distinct lists.
162
+ </Axiom>
163
+
164
+ <Axiom id="AX_UNCOMFORTABLE_QUESTIONS">
165
+ Every meaningful frame includes ≥1 uncomfortable question — the kind that exposes hidden assumptions, degradation paths, or trust boundaries. Canonical seeds:
166
+ - What is the canonical source of truth for this entity / capability?
167
+ - What happens on dependency unavailability (graceful degradation vs hard failure)?
168
+ - Where does simulation end and real runtime begin?
169
+ - Who validates input at this trust boundary?
170
+ - Which assumption, if wrong, invalidates the design?
171
+
172
+ Skipping uncomfortable questions = false consensus.
173
+ </Axiom>
174
+
175
+ <Axiom id="AX_DX_FIRST">
176
+ For product / library scopes the Golden DX Example precedes Design Variants. DX shape:
177
+ - For library: the public-API DX (init / happy path / error path with commentary).
178
+ - For product app / spa / mobile / desktop: UX-flow DX.
179
+ - For product cli-utility: CLI DX (commands, flags, exit codes, sample sessions).
180
+ - For product service-module-sdk: API DX at the transport boundary.
181
+
182
+ DX is the empathic anchor for downstream design; without it Design Variants drift into solution-space gymnastics.
183
+
184
+ For product / library — this is the initial draft; ownership transfers post-first-`add-module` per `AX_SCOPE_SPEC_MODULE_MAP_OWNERSHIP` in module-decomposition.
185
+ </Axiom>
186
+
187
+ <Axiom id="AX_STACK_BASED_FLOW">
188
+ Discovery dialogue runs on an explicit frame stack. Main path: `INTAKE → SCOPE_TYPE_CONFIRM → INTENT_CAPTURE → TYPE_SPECIFIC_A → TYPE_SPECIFIC_B → TYPE_SPECIFIC_C → (TYPE_SPECIFIC_D) → FINAL_SPEC`. Disputes / dives / sub-topics open a nested frame; the stack is visible in TRACE_HEADER's `STACK` field. A sub-topic never silently stalls the parent frame.
189
+ </Axiom>
190
+
191
+ <Axiom id="AX_FRAME_EXIT_DISCIPLINE">
192
+ Every frame carries an exit condition. Status vocabulary: `OPEN` | `BLOCKED` | `READY_TO_RETURN` | `READY_TO_ADVANCE` | `DEFERRED`. Indefinite drilling without local resolution is forbidden. A sub-topic that does not block the current phase → status `DEFERRED`, return to parent with a Return Summary (per `RETURN_SUMMARY_FORMAT`).
193
+ </Axiom>
194
+
195
+ <Axiom id="AX_TRACE_ANCHORS">
196
+ Global: `DSC_R001`, `DSC_R002`, …. Frame: `F_INTENT_R01`, `F_REQ_R01`, `F_DV_R01`, etc. Stack rendered as `ROOT__<FRAME>__<SUBFRAME>` in the header.
197
+ </Axiom>
198
+
199
+ <Axiom id="AX_DIALOGUE_DISCIPLINE">
200
+ Phase agreement: agent signals `READY_TO_ADVANCE`; operator confirms. Neutral + critical: no auto-agree. Confidence explicit (`LOW` / `MEDIUM` / `HIGH`). No repeat questions. Context budget: compact on long dialogues.
201
+ </Axiom>
202
+
203
+ <Axiom id="AX_STATELESS_ARTIFACT">
204
+ The spec is self-contained. `module-decomposition` and `task-scaffolding` start without history of this conversation.
205
+ </Axiom>
206
+
207
+ <Axiom id="AX_BOOTSTRAP_NARROW_READ">
208
+ Discovery is design-blind to repository code (per `AX_SPEC_IS_SOLE_SOURCE`) **except** inside STEP_7 (External Dependencies Audit), where narrow Read is permitted **only for inventory verification** — confirming whether a referenced package, file, scope, or tool physically exists.
209
+ Permitted reads in STEP_7: `package.json` and equivalents, `tsconfig.json` and equivalents, `specs/README.md`, sibling scope manifests, filesystem existence checks.
210
+ Forbidden in STEP_7: reading application source code to influence design decisions; revisiting Vision / Requirements / Architecture / Contracts based on what was found. If a finding genuinely invalidates a design decision, pop back to the relevant STEP_3–STEP_6 explicitly and treat as `pivot`.
211
+ </Axiom>
212
+
213
+ <Axiom id="AX_OPERATOR_LANGUAGE">
214
+ **Directive prose (axioms, halt names, step procedures, contract identifiers, structural section headings) — English.**
215
+ **Operator-facing artifact prose and operator-facing messages — Russian.** Russian applies to:
216
+ - Spec body text (Vision sentence, Requirement statements, Decision Log `Why` / `Risk` content, Golden DX commentary).
217
+ - Halt messages emitted to the operator.
218
+ - Phase Progress free-text content.
219
+
220
+ English regardless of context: file paths, axiom IDs (`AX_*`), Trace anchors (`DSC_R<N>`), `F-NNN` / `D-NNN` / `H_*` IDs, status / scope-type tokens, BDD keywords, field labels (`**Status:**`, `**Why:**`).
221
+ </Axiom>
222
+ </Belief_State>
223
+
224
+ <Halt_Conditions>
225
+ | 🛑 ID | Trigger |
226
+ |---|---|
227
+ | `H_NO_INTAKE` | Empty intake |
228
+ | `H_AMBIGUOUS_MODE` | Spec exists + mode verb absent |
229
+ | `H_AMBIGUOUS_SCOPE_TYPE` | scope-type cannot be determined unambiguously |
230
+ | `H_LOW_CONFIDENCE` | Confidence `LOW` while locking architecture |
231
+ | `H_REQ_NOT_APPROVED` | Attempting Design Variants without a closed REQUIREMENTS_GATE (product / library) |
232
+ | `H_GOLDEN_NOT_APPROVED` | Attempting Design Variants without an approved Golden DX (product / library) |
233
+ | `H_MISSING_RULE_FILE` | Rule reference does not resolve to an existing file |
234
+ <!-- H_TOOL_RULE_MISSING removed — replaced by `AX_MISSING_RULE_RESEARCH_SUBFLOW` (interactive research+approval, never a halt) -->
235
+ | `H_PIVOT_NO_INVALIDATION_LIST` | `pivot` mode without Pivot Invalidation List |
236
+ | `H_BOOTSTRAP_REQUIREMENTS_MISSING` | STEP_7 finished without a Bootstrap Requirements section (even empty must be declared explicitly) |
237
+ | `H_OPERATOR_REJECT` | Operator rejected the spec |
238
+ </Halt_Conditions>
239
+
240
+ <Execution_Plan>
241
+ <Step id="STEP_0_INTAKE">
242
+ <Goal>Resolve scope name, scope-type, mode. Read Portal and rule registry for context.</Goal>
243
+ <Action>
244
+ 1. Read `specs/README.md` if present (for project vision + graph context).
245
+ 2. **Read `ai/directives/knowledge.xml` in full.** This is the canonical rule registry — it tells you what rule files exist, their `<Triggers>`, `<SkipWhen>`, `<ActivationHint>`, and `<RequiresVerification>`. You will use it throughout this session: to know which rules are available when selecting tools (infrastructure), to populate Project-Wide Rules (product/library), and to derive Effective Rules in the spec. Read it now — do not defer.
246
+ 3. Resolve scope name from intake (or ask).
247
+ 4. Stat `specs/<scope-name>/<scope-name>.spec.md`:
248
+ - Absent → `greenfield`.
249
+ - Present → apply `AX_MODE_AUTO_DETECT_OR_HALT`.
250
+ 5. Resolve / confirm scope-type from intake or naming convention (`infra-*` → infrastructure hint).
251
+ 6. Proceed to STEP_1.
252
+ </Action>
253
+ </Step>
254
+
255
+ <Step id="STEP_1_SCOPE_TYPE_CONFIRM">
256
+ <Goal>Lock scope-type and outline which sections the spec will carry.</Goal>
257
+ <Action>
258
+ 1. Propose scope-type with rationale.
259
+ 2. Outline the section set per `AX_SCOPE_TYPE_BRANCH`.
260
+ 3. Approval Check. STOP.
261
+ Confirmed → STEP_2.
262
+ </Action>
263
+ </Step>
264
+
265
+ <Step id="STEP_2_INTENT_CAPTURE">
266
+ <Goal>Lock the scope's goal and primary constraints.</Goal>
267
+ <Action>
268
+ 1. Intent Candidate: 1–3 bullets.
269
+ 2. Evidence Hygiene per `AX_EVIDENCE_HYGIENE`: Facts / Assumptions / Hypotheses, separated.
270
+ 3. Questions: 2–5; ≥1 uncomfortable per `AX_UNCOMFORTABLE_QUESTIONS`.
271
+ 4. For product / library: capture initial Runtime Backing posture per `AX_RUNTIME_BACKING_EXPLICIT`.
272
+ 5. Phase Progress + Approval Check. STOP.
273
+ </Action>
274
+ </Step>
275
+
276
+ <Step id="STEP_3_TYPE_SPECIFIC_A">
277
+ <Goal>First type-specific step.</Goal>
278
+ <Action>
279
+ Per `AX_SCOPE_TYPE_BRANCH`:
280
+ - infrastructure → Tool Categories Declaration. Approval Check. STOP.
281
+ - contracts → Interface Declaration (schema format, versioning scheme, namespacing). Approval Check. STOP.
282
+ - library → Requirements Gate (Functional, Non-Functional, Out-of-Scope, Rules). Approval Check. STOP.
283
+ - product → Requirements Gate (Functional, Non-Functional, Out-of-Scope, Runtime Backing per `AX_RUNTIME_BACKING_EXPLICIT`, Project-Wide Rules). Approval Check. STOP.
284
+ </Action>
285
+ </Step>
286
+
287
+ <Step id="STEP_4_TYPE_SPECIFIC_B">
288
+ <Goal>Second type-specific step.</Goal>
289
+ <Action>
290
+ Per `AX_SCOPE_TYPE_BRANCH`:
291
+ - infrastructure → Tool Choices (2–3 candidates per category; Mandatory Rationale Pull; Decision Log entry per tool). Tool Interaction Check. STOP.
292
+ - contracts → Versioning Policy (semver / date-based; breaking-change protocol; consumer notification). STOP.
293
+ - library → Golden DX (Public API DX per `AX_DX_FIRST`). STOP.
294
+ - product → Golden DX per `AX_DX_FIRST`. STOP.
295
+ </Action>
296
+ </Step>
297
+
298
+ <Step id="STEP_5_TYPE_SPECIFIC_C">
299
+ <Goal>Third type-specific step.</Goal>
300
+ <Action>
301
+ Per `AX_SCOPE_TYPE_BRANCH`:
302
+ - infrastructure → Developer Workflow Example. STOP.
303
+ - contracts → Compatibility Matrix (backward-compat guarantees; consumers list). STOP.
304
+ - library → Architecture (Public Surface structure, key design patterns, brief rejected alternatives). Approval Check. STOP.
305
+ - product → Design Variants 2–3 (depth per Project Type). Approval Check. STOP.
306
+ </Action>
307
+ </Step>
308
+
309
+ <Step id="STEP_6_TYPE_SPECIFIC_D">
310
+ <Goal>Fourth type-specific step (only some types).</Goal>
311
+ <Action>
312
+ Per `AX_SCOPE_TYPE_BRANCH`:
313
+ - infrastructure → File Structure (repo root layout; config file mapping). Then Effective Rules table. Then Verification Commands table (mandatory — one row per active tool command). STOP.
314
+ - contracts → skip, proceed to STEP_7.
315
+ - library → skip, proceed to STEP_7.
316
+ - product → Architecture Choice (operator picks variant; Mandatory Rationale Pull; Decision Log entry). STOP.
317
+ </Action>
318
+ </Step>
319
+
320
+ <Step id="STEP_7_EXTERNAL_DEPENDENCIES_AUDIT">
321
+ <Goal>Reconcile the drafted spec with repository reality. Surface every external assumption the spec makes, classify each as exists / missing / unknown, resolve unknowns with the operator, and materialize Bootstrap Requirements.</Goal>
322
+ <Action>
323
+ 1. **Walk the drafted spec end-to-end** (all sections produced by STEP_3–STEP_6). Extract every external assumption — anything the spec references that must exist before functional tasks can run. Cover all of:
324
+ - Third-party packages (npm / pip / cargo / etc.) — name + intended version constraint.
325
+ - Workspace links / monorepo packages — internal scope this scope depends on.
326
+ - Runtime tools (CLIs, binaries, language runtimes).
327
+ - Files and paths the spec assumes pre-exist (`package.json`, config files, fixtures).
328
+ - Types / modules / contracts sourced from other scopes (resolve via Scope Dependencies).
329
+ - Environment variables, secrets, external services (DBs, queues, APIs).
330
+ - Repo-level structural prerequisites (a package boundary, a workspace entry, a folder).
331
+ 2. **Classify each assumption** as `exists` | `missing` | `unknown`:
332
+ - For verification, narrow Read is permitted **only for inventory** (`package.json`, `tsconfig.json`, `specs/README.md`, scope manifests, filesystem checks). Reading application source code for inspiration is forbidden — `AX_SPEC_IS_SOLE_SOURCE` still holds for design content.
333
+ - `exists` → record actual location / version / scope ref.
334
+ - `missing` → assumption is real and known to be absent.
335
+ - `unknown` → cannot be determined from repo alone.
336
+ 3. **Resolve every `missing` and `unknown` with the operator.** For each, ask explicitly:
337
+ - source (which registry / which scope / which operator action),
338
+ - version / shape constraint,
339
+ - owner (this scope's bootstrap task vs external prerequisite vs operator-side action outside SDD).
340
+ Record each resolution as a Decision Log entry.
341
+ 4. **Materialize Bootstrap Requirements** in the spec. Ordered list — each item:
342
+ | Requirement | Kind | Owner | Resolution |
343
+ Kind ∈ `package` | `workspace-link` | `tool` | `file` | `external-type` | `env` | `service` | `structural`.
344
+ Owner ∈ `this-scope-task` | `external-prereq-scope` | `operator-action`.
345
+ Resolution ∈ verbatim outcome from step 3 (e.g. `install valibot@^0.42 via npm`, `link @org/contracts via workspace`, `operator provisions DATABASE_URL`).
346
+
347
+ Note: missing rule files (under `ai/directives/**`) are NOT bootstrap rows — they are knowledge artifacts handled inline in STEP_3–6 per `AX_SCOPE_RULES_DECLARATION`, not external assumptions to install.
348
+ 5. **Gate.** Discovery cannot proceed to STEP_8 until Bootstrap Requirements exists. Empty list is acceptable only when steps 1–3 produced zero external assumptions — an explicit «nothing to bootstrap», not an omission. Otherwise → `H_BOOTSTRAP_REQUIREMENTS_MISSING`.
349
+
350
+ **Scope of this step:** verification of physical/external prerequisites only. This step does NOT revisit functional design — Vision, Requirements, Architecture, Contracts are immutable here. If a bootstrap finding invalidates a design decision, pop back to the relevant STEP_3–STEP_6 explicitly and treat as `pivot` per `AX_PIVOT_REQUIRES_SUPERSESSION`.
351
+ </Action>
352
+ </Step>
353
+
354
+ <Step id="STEP_8_FINAL_SPEC">
355
+ <Goal>Emit the scope spec.</Goal>
356
+ <Action>
357
+ 1. Assemble `specs/<scope-name>/<scope-name>.spec.md` per the corresponding SPEC_CONTRACT. The Bootstrap Requirements section produced in STEP_7 is part of every spec regardless of scope-type.
358
+ 2. In `pivot` mode: include Pivot Invalidation List (per `AX_PIVOT_REQUIRES_SUPERSESSION`); emit rework-flavored Decision Log entries per `REWORK_DECISION_LOG_ENTRY_FORMAT`.
359
+ 3. Output for review. Approval Check. STOP.
360
+ </Action>
361
+ </Step>
362
+ </Execution_Plan>
363
+
364
+ <Frame_Rules>
365
+ <Rule id="FRAME_PUSH_WHEN">Push a frame on: dispute about scope-type; alternative tool / architecture proposal; sub-topic that cannot close in one sentence; uncomfortable-question dive; pivot rationale clarification.</Rule>
366
+ <Rule id="FRAME_POP_WHEN">Pop on: confirmed local conclusion; deferred non-blocking topic; topic requires a separate supporting artifact while main flow continues.</Rule>
367
+ <Rule id="FRAME_STATUS_VALUES">OPEN | BLOCKED | READY_TO_RETURN | READY_TO_ADVANCE | DEFERRED.</Rule>
368
+ <Rule id="RETURN_SUMMARY_FORMAT">On pop, emit a Return Summary with: Confirmed / Changed / New Constraints / Open / Parent Next.</Rule>
369
+ </Frame_Rules>
370
+
371
+ <Example_Patterns>
372
+ Discovery deliberately avoids one monolithic Golden Example — scope-spec shape varies too much across scope-types. Below are intentionally compact, freeform sketches; treat them as orientation, not templates. The normative shapes live in the SPEC_STRUCTURE contracts.
373
+
374
+ <Pattern id="EXAMPLE_INFRASTRUCTURE">
375
+ ```markdown
376
+ # infra-base: Infrastructure Specification
377
+
378
+ ## 1. Vision
379
+ Минимальный TS-стек: быстрый CI, deterministic install, zero-config formatter.
380
+
381
+ ## 2. Tool Stack
382
+ | Category | Tool | Rationale |
383
+ |---|---|---|
384
+ | package-management | pnpm | D-001 (lockfile determinism vs npm) |
385
+ | type-check | tsc | D-002 (no transpiler — esbuild на bundler-этапе) |
386
+ | linting+formatting | biome | D-003 (один tool вместо eslint+prettier) |
387
+
388
+ ## 3. Dev Workflow Example
389
+ ```bash
390
+ pnpm install
391
+ pnpm typecheck && pnpm test && pnpm lint
392
+ ```
393
+
394
+ ## 5. Effective Rules (cascade)
395
+ | Rule | Category | File | Source |
396
+ |---|---|---|---|
397
+ | <rule-id> | coding | ai/directives/coding/<rule>.xml | infra (D-NNN) |
398
+ | <rule-id> | infra | ai/directives/infra/<rule>.xml | infra (D-NNN) |
399
+ ```
400
+ </Pattern>
401
+
402
+ <Pattern id="EXAMPLE_CONTRACTS">
403
+ ```markdown
404
+ # api-contracts: Contracts Specification
405
+
406
+ ## 2. Interface Declaration
407
+ - Schema format: OpenAPI 3.1
408
+ - Versioning: date-based (`/v2026-05-01/...`)
409
+ - Namespace: `api.example.com`
410
+
411
+ ## 3. Versioning Policy
412
+ Breaking changes требуют новой date-версии + 6 мес deprecation окна; non-breaking — same version, additive only.
413
+
414
+ ## 4. Compatibility Matrix
415
+ | Consumer | Min version | Breaking protocol |
416
+ |---|---|---|
417
+ | backend | 2026-05-01 | dual-publish on transition |
418
+ | web | 2026-05-01 | client codegen via openapi-typescript |
419
+ ```
420
+ </Pattern>
421
+
422
+ <Pattern id="EXAMPLE_LIBRARY">
423
+ ```markdown
424
+ # logger-core: Library Specification
425
+
426
+ ## 2. Approved Golden DX Example
427
+ ```ts
428
+ // happy path
429
+ const log = createLogger({ name: 'payments', level: 'info' })
430
+ log.info({ orderId }, 'charge succeeded')
431
+
432
+ // degradation: transport unavailable
433
+ log.transport.on('error', (err) => log.warn({ err }, 'fallback to stdout'))
434
+ ```
435
+
436
+ ## 4. Public API Surface
437
+ - `createLogger(config) → Logger`
438
+ - `Logger.{ trace, debug, info, warn, error, fatal }(payload, message)`
439
+ - `Logger.child(bindings) → Logger`
440
+ ```
441
+ </Pattern>
442
+
443
+ <Pattern id="EXAMPLE_PRODUCT">
444
+ ```markdown
445
+ # backend: Scope Specification
446
+
447
+ ## 2. Project Type
448
+ - Type: service-module-sdk
449
+ - Why: IMAP backend, без UI; transport — long-lived TCP + outbound HTTP.
450
+
451
+ ## 3. Approved Golden DX Example (UX-flow)
452
+ Сценарий «новое письмо»: IMAP IDLE keep-alive ловит EXISTS → forward to consumer → ack;
453
+ degradation: server reset → exponential backoff + restore по UIDVALIDITY.
454
+
455
+ ## 4.4 Runtime Backing & Deferred Scope
456
+ - IMAP IDLE: `real-runtime` (production-critical).
457
+ - OAuth refresh: `real-runtime`.
458
+ - Webhook dispatcher: `simulation` в v1 (deferred → TSK-stub до реальной integration).
459
+ ```
460
+ </Pattern>
461
+ </Example_Patterns>
462
+
463
+ <Output_Contracts>
464
+ <Contract id="TRACE_HEADER_FORMAT">
465
+ ```text
466
+ 🦾 DSC_R<N> | SCOPE: <scope-name> | TYPE: <scope-type> | MODE: <greenfield|refine|pivot> | STACK: ROOT__<FRAME>__<SUBFRAME> | FRAME: F_<KEY>_R<N> | <STATUS> | CONF: <LOW|MEDIUM|HIGH>
467
+ 🎯 GOAL: <local goal>
468
+ ⏭️ EXIT: <exit condition>
469
+ ```
470
+ </Contract>
471
+
472
+ <Contract id="INFRASTRUCTURE_SPEC_STRUCTURE">
473
+ Every top-level `## N.` section is wrapped with `<!--SECTION:UPPER_SNAKE-->…<!--/SECTION:UPPER_SNAKE-->` markers so any agent can pull a single section via `~/.claude/skills/sdd-execute/scripts/sdd extract <file> <NAME>`. Open marker IMMEDIATELY before the header; close marker IMMEDIATELY before the next same-level header (or EOF). Sub-sections (`### N.M`) and entity-level headers are NOT wrapped — they live inside the containing anchor. Section names are author-discretionary (the four templates below illustrate idiomatic choices); no name registry is enforced. Grammar source of truth: `extract-section.sh`. The four `SPEC_STRUCTURE` templates emit anchors by default — copy verbatim.
474
+
475
+ ```markdown
476
+ # <scope-name>: Infrastructure Specification
477
+
478
+ <!--SECTION:SCOPE_TYPE-->
479
+ ## scope-type
480
+ infrastructure
481
+ <!--/SECTION:SCOPE_TYPE-->
482
+
483
+ <!--SECTION:VISION-->
484
+ ## 1. Vision
485
+ [Что включает dev/ops experience.]
486
+ <!--/SECTION:VISION-->
487
+
488
+ <!--SECTION:TOOL_STACK-->
489
+ ## 2. Tool Stack
490
+
491
+ ### 2.1 Categories Covered
492
+ [Список категорий + краткое обоснование исключений.]
493
+
494
+ ### 2.2 Tool Choices
495
+ | Category | Tool | Rationale |
496
+ |---|---|---|
497
+ | <category> | <tool> | D-NNN |
498
+ <!--/SECTION:TOOL_STACK-->
499
+
500
+ <!--SECTION:WORKFLOW_EXAMPLE-->
501
+ ## 3. Developer Workflow Example
502
+ [Shell-script: setup, daily flow, commit flow, debug flow.]
503
+ <!--/SECTION:WORKFLOW_EXAMPLE-->
504
+
505
+ <!--SECTION:FILE_STRUCTURE-->
506
+ ## 4. File Structure
507
+ [ASCII tree + File Mapping.]
508
+ <!--/SECTION:FILE_STRUCTURE-->
509
+
510
+ <!--SECTION:EFFECTIVE_RULES-->
511
+ ## 5. Effective Rules (for cascade)
512
+ | Rule | Category | Source |
513
+ |---|---|---|
514
+ | <rule-name> | coding | infra (D-NNN) |
515
+ <!--/SECTION:EFFECTIVE_RULES-->
516
+
517
+ <!--SECTION:VERIFICATION_COMMANDS-->
518
+ ## 6. Verification Commands
519
+ **Mandatory for infrastructure scopes.** After tool stack is finalized, record a table:
520
+ | Command Name | Invocation |
521
+ | typecheck-command | <actual invocation> |
522
+ | test-command | <actual invocation> |
523
+ | lint-command | <actual invocation> |
524
+ | format-command | <actual invocation> |
525
+ | check-command | <actual invocation> |
526
+
527
+ Include only command names for tools present in the chosen stack.
528
+ `check-command` is **always required** when the runtime setup rule (`nodejs-npm-setup` or equivalent) is active — it is the composed entry point that runs all active phases in `CheckPhaseOrder` order (typecheck → test → lint → format). Composition: chain invocations of each active phase command in that order. Task tickets use `check-command` as their single verification alias.
529
+ <!--/SECTION:VERIFICATION_COMMANDS-->
530
+
531
+ <!--SECTION:DECISION_LOG-->
532
+ ## 7. Decision Log
533
+ [D-NNN entries.]
534
+ <!--/SECTION:DECISION_LOG-->
535
+
536
+ <!--SECTION:SCOPE_DEPENDENCIES-->
537
+ ## 8. Scope Dependencies
538
+ - **Depends on:** None (infrastructure scopes are typically leaves)
539
+ - **Provides rules to:** [list of product/library scopes that depend on this]
540
+ <!--/SECTION:SCOPE_DEPENDENCIES-->
541
+
542
+ <!--SECTION:BOOTSTRAP_REQUIREMENTS-->
543
+ ## 9. Bootstrap Requirements
544
+ | Requirement | Kind | Owner | Resolution |
545
+ |---|---|---|---|
546
+ <!-- Kind ∈ package | workspace-link | tool | file | external-type | env | service | structural -->
547
+ <!-- Owner ∈ this-scope-task | external-prereq-scope | operator-action -->
548
+ <!-- Empty list allowed only when STEP_7 audit produced zero external assumptions — declare it explicitly: "No external bootstrap required." -->
549
+ <!--/SECTION:BOOTSTRAP_REQUIREMENTS-->
550
+
551
+ <!--SECTION:HANDOFF-->
552
+ ## 10. Handoff
553
+ - **Setup tasks to scaffold:** [list]
554
+ - **Effective rules ready for cascade:** see 5
555
+ - **Verification Commands ready for cascade:** see 6
556
+ - **Bootstrap tickets ready for cascade:** see 9
557
+ - **Open risks:** [not-closed items]
558
+
559
+ <!-- 10.1 Pivot Invalidation List — only in pivot mode -->
560
+ <!--/SECTION:HANDOFF-->
561
+ ```
562
+ </Contract>
563
+
564
+ <Contract id="CONTRACTS_SPEC_STRUCTURE">
565
+ ```markdown
566
+ # <scope-name>: Contracts Specification
567
+
568
+ <!--SECTION:SCOPE_TYPE-->
569
+ ## scope-type
570
+ contracts
571
+ <!--/SECTION:SCOPE_TYPE-->
572
+
573
+ <!--SECTION:VISION-->
574
+ ## 1. Vision
575
+ [Что контракт определяет и для кого.]
576
+ <!--/SECTION:VISION-->
577
+
578
+ <!--SECTION:INTERFACE_DECLARATION-->
579
+ ## 2. Interface Declaration
580
+ - **Schema format:** OpenAPI 3.x | gRPC proto3 | JSON Schema | GraphQL SDL
581
+ - **Versioning scheme:** semver | date-based (YYYY-MM-DD) | none
582
+ - **Namespace:** <api prefix / package name>
583
+ - **Interfaces:** [список endpoint groups / message types / operations]
584
+ <!--/SECTION:INTERFACE_DECLARATION-->
585
+
586
+ <!--SECTION:VERSIONING_POLICY-->
587
+ ## 3. Versioning Policy
588
+ [Semver rules / breaking-change protocol / deprecation window.]
589
+ <!--/SECTION:VERSIONING_POLICY-->
590
+
591
+ <!--SECTION:COMPATIBILITY_MATRIX-->
592
+ ## 4. Compatibility Matrix
593
+ | Consumer scope | Min compatible version | Breaking change protocol |
594
+ |---|---|---|
595
+ <!--/SECTION:COMPATIBILITY_MATRIX-->
596
+
597
+ <!--SECTION:DECISION_LOG-->
598
+ ## 5. Decision Log
599
+ [D-NNN entries.]
600
+ <!--/SECTION:DECISION_LOG-->
601
+
602
+ <!--SECTION:SCOPE_DEPENDENCIES-->
603
+ ## 6. Scope Dependencies
604
+ - **Depends on:** [infra scopes if any]
605
+ - **Provides contracts to:** [product/library scopes]
606
+ <!--/SECTION:SCOPE_DEPENDENCIES-->
607
+
608
+ <!--SECTION:BOOTSTRAP_REQUIREMENTS-->
609
+ ## 7. Bootstrap Requirements
610
+ | Requirement | Kind | Owner | Resolution |
611
+ |---|---|---|---|
612
+ <!-- Empty list allowed only when STEP_7 audit produced zero external assumptions — declare explicitly. -->
613
+ <!--/SECTION:BOOTSTRAP_REQUIREMENTS-->
614
+
615
+ <!--SECTION:HANDOFF-->
616
+ ## 8. Handoff
617
+ - **Contract files to scaffold:** [schema files, codegen configs]
618
+ - **Bootstrap tickets ready for cascade:** see 7
619
+ - **Open risks:** [versioning gaps, unconfirmed consumers]
620
+ <!--/SECTION:HANDOFF-->
621
+ ```
622
+ </Contract>
623
+
624
+ <Contract id="LIBRARY_SPEC_STRUCTURE">
625
+ ```markdown
626
+ # <scope-name>: Library Specification
627
+
628
+ <!--SECTION:SCOPE_TYPE-->
629
+ ## scope-type
630
+ library
631
+ <!--/SECTION:SCOPE_TYPE-->
632
+
633
+ <!--SECTION:VISION-->
634
+ ## 1. Vision & Primary Goal
635
+ [Что library делает; главная проблема, которую решает.]
636
+ <!--/SECTION:VISION-->
637
+
638
+ <!--SECTION:GOLDEN_DX-->
639
+ ## 2. Approved Golden DX Example
640
+ [Публичный API DX: init/setup + happy path + error path. Комментарии раскрывают намерение.]
641
+ <!--/SECTION:GOLDEN_DX-->
642
+
643
+ <!--SECTION:REQUIREMENTS_AND_CONSTRAINTS-->
644
+ ## 3. Requirements & Constraints
645
+
646
+ ### 3.1 Functional Requirements
647
+
648
+ ### 3.2 Non-Functional Constraints
649
+
650
+ ### 3.3 Out-of-Scope
651
+
652
+ ### 3.4 Runtime Backing & Deferred Scope
653
+ [Per `AX_RUNTIME_BACKING_EXPLICIT`. Posture per major capability + deferred parts.]
654
+
655
+ ### 3.5 Rules
656
+ | Rule | Category | Source |
657
+ |---|---|---|
658
+ <!--/SECTION:REQUIREMENTS_AND_CONSTRAINTS-->
659
+
660
+ <!--SECTION:PUBLIC_API_SURFACE-->
661
+ ## 4. Public API Surface
662
+ [Ключевые exported interfaces, types, functions. Intent-level, без impl detail.]
663
+ <!--/SECTION:PUBLIC_API_SURFACE-->
664
+
665
+ <!--SECTION:ARCHITECTURE-->
666
+ ## 5. Architecture
667
+ [Выбранный design pattern. Кратко — rejected alternatives.]
668
+ <!--/SECTION:ARCHITECTURE-->
669
+
670
+ <!--SECTION:DECISION_LOG-->
671
+ ## 6. Decision Log
672
+ [D-NNN entries.]
673
+ <!--/SECTION:DECISION_LOG-->
674
+
675
+ <!--SECTION:SCOPE_DEPENDENCIES-->
676
+ ## 7. Scope Dependencies
677
+ - **Depends on:** [infra-*, contracts scopes]
678
+ - **Provides to:** [consumer scopes]
679
+ <!--/SECTION:SCOPE_DEPENDENCIES-->
680
+
681
+ <!--SECTION:BOOTSTRAP_REQUIREMENTS-->
682
+ ## 8. Bootstrap Requirements
683
+ | Requirement | Kind | Owner | Resolution |
684
+ |---|---|---|---|
685
+ <!-- Empty list allowed only when STEP_7 audit produced zero external assumptions — declare explicitly. -->
686
+ <!--/SECTION:BOOTSTRAP_REQUIREMENTS-->
687
+
688
+ <!--SECTION:HANDOFF-->
689
+ ## 9. Handoff to module-decomposition
690
+ - **Areas requiring decomposition:** [list]
691
+ - **Named abstractions:** [from Golden DX]
692
+ - **Bootstrap tickets ready for cascade:** see 8
693
+ - **Open risks:** [validation needs]
694
+
695
+ <!-- 9.1 Pivot Invalidation List — only in pivot mode -->
696
+ <!--/SECTION:HANDOFF-->
697
+ ```
698
+ </Contract>
699
+
700
+ <Contract id="PRODUCT_SPEC_STRUCTURE">
701
+ ```markdown
702
+ # <scope-name>: Scope Specification
703
+
704
+ <!--SECTION:SCOPE_TYPE-->
705
+ ## scope-type
706
+ product
707
+ <!--/SECTION:SCOPE_TYPE-->
708
+
709
+ <!--SECTION:VISION-->
710
+ ## 1. Vision & Primary Goal
711
+ <!--/SECTION:VISION-->
712
+
713
+ <!--SECTION:PROJECT_TYPE-->
714
+ ## 2. Project Type
715
+ - **Type:** app[mobile|desktop|spa] | service-module-sdk | cli-utility
716
+ - **Why this type:** [Краткое обоснование.]
717
+ <!--/SECTION:PROJECT_TYPE-->
718
+
719
+ <!--SECTION:GOLDEN_DX-->
720
+ ## 3. Approved Golden DX Example
721
+ [Commentary-rich: init/setup + happy path + error/degradation path.]
722
+ <!--/SECTION:GOLDEN_DX-->
723
+
724
+ <!--SECTION:REQUIREMENTS_AND_CONSTRAINTS-->
725
+ ## 4. Requirements & Constraints
726
+
727
+ ### 4.1 Functional Requirements
728
+
729
+ ### 4.2 Non-Functional Constraints
730
+
731
+ ### 4.3 Out-of-Scope
732
+
733
+ ### 4.4 Runtime Backing & Deferred Scope
734
+ [Per `AX_RUNTIME_BACKING_EXPLICIT`. Posture per major capability + deferred parts + trust boundaries требующие real runtime hook.]
735
+
736
+ ### 4.5 Rules
737
+ | Rule | Category | Source |
738
+ |---|---|---|
739
+ <!--/SECTION:REQUIREMENTS_AND_CONSTRAINTS-->
740
+
741
+ <!--SECTION:ARCHITECTURE-->
742
+ ## 5. High-Level Architecture
743
+ [Выбранный вариант. Block diagram. Краткие описания.]
744
+
745
+ ### 5.1 Rejected Alternatives
746
+ <!--/SECTION:ARCHITECTURE-->
747
+
748
+ <!--SECTION:DECISION_LOG-->
749
+ ## 6. Decision Log
750
+ [D-NNN entries.]
751
+ <!--/SECTION:DECISION_LOG-->
752
+
753
+ <!--SECTION:SCOPE_DEPENDENCIES-->
754
+ ## 7. Scope Dependencies
755
+ - **Depends on:** [infra-*, api-contracts, design-system-* scopes]
756
+ - **Provides to:** [consumer scopes, if any]
757
+ <!--/SECTION:SCOPE_DEPENDENCIES-->
758
+
759
+ <!--SECTION:BOOTSTRAP_REQUIREMENTS-->
760
+ ## 8. Bootstrap Requirements
761
+ | Requirement | Kind | Owner | Resolution |
762
+ |---|---|---|---|
763
+ <!-- Empty list allowed only when STEP_7 audit produced zero external assumptions — declare explicitly. -->
764
+ <!--/SECTION:BOOTSTRAP_REQUIREMENTS-->
765
+
766
+ <!--SECTION:MODULE_MAP-->
767
+ ## 9. Module Map
768
+ [Appended by `module-decomposition`. Initially: «Modules not yet decomposed — run `module-decomposition <scope-name>`».]
769
+ <!--/SECTION:MODULE_MAP-->
770
+
771
+ <!--SECTION:HANDOFF-->
772
+ ## 10. Handoff to module-decomposition
773
+ - **Primary input:** `specs/<scope-name>/<scope-name>.spec.md`
774
+ - **Areas requiring decomposition:** [list]
775
+ - **Named abstractions:** [from Golden DX]
776
+ - **Bootstrap tickets ready for cascade:** see 8
777
+ - **Open risks:** [validation needs]
778
+
779
+ <!-- 10.1 Pivot Invalidation List — only in pivot mode -->
780
+ <!--/SECTION:HANDOFF-->
781
+ ```
782
+ </Contract>
783
+
784
+ <Contract id="DECISION_LOG_ENTRY_FORMAT">
785
+ ```markdown
786
+ ### D-NNN — <short title>
787
+ - **Status:** active | superseded | rejected | deferred
788
+ - **Recorded:** session Discovery, <scope-name>
789
+ - **Why:** <operator's own wording>
790
+ - **Risk accepted:** <if any>
791
+ - **Rejected alternatives:** <list>
792
+ - **Supersedes:** D-NNN (when superseding)
793
+ ```
794
+ </Contract>
795
+
796
+ <Contract id="REWORK_DECISION_LOG_ENTRY_FORMAT">
797
+ Used in `pivot` mode for each replaced decision. Self-contained: a future reader of the spec at this git ref must understand the rework without external context.
798
+
799
+ ```markdown
800
+ ### D-NNN — <short title> (rework)
801
+ - **Status:** active
802
+ - **Recorded:** session Discovery, <scope-name>, pivot
803
+ - **Supersedes:** D-MMM
804
+ - **Pre-rework state:** git ref `<sha-or-tag>` (snapshot of spec immediately before this pivot)
805
+ - **Was:** <one-sentence summary of the prior decision>
806
+ - **Now:** <one-sentence summary of the replacement>
807
+ - **Why:** <operator's own wording — what forced the rework>
808
+ - **Risk accepted:** <if any>
809
+ - **Downstream invalidation:** see Pivot Invalidation List
810
+ ```
811
+
812
+ Paired with Pivot Invalidation List entries that enumerate concrete downstream artifacts (`refine-module` targets, ticket reopens, rule revisits) for `audit` (`AX_STALE_AFTER_PIVOT_VERIFICATION`).
813
+ </Contract>
814
+
815
+ <Contract id="PIVOT_INVALIDATION_LIST_FORMAT">
816
+ ```markdown
817
+ ### 9.1 Pivot Invalidation List
818
+ - **Module specs requiring refine:** [list with reasons]
819
+ - **Tasks requiring reopen:** [TSK-NN — reason]
820
+ - **Rules to revisit:** [list]
821
+ ```
822
+ </Contract>
823
+ </Output_Contracts>
824
+ </SddDiscovery>