gennady 0.6.1 → 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 (320) 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-Gy1n7hRU.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-Bh0p7rJg.js → index-CaahtXiM.js} +33 -9
  148. package/dist/chunks/{index-BrobNwbS.js → index-CiEM-8nJ.js} +35 -19
  149. package/dist/chunks/{index-D1Hurfwu.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-B3r-YFvt.js → index-DU6jD7SS.js} +1 -1
  153. package/dist/chunks/index-KxSZKmZn.js +540 -0
  154. package/dist/chunks/{index-DgAmONSz.js → index-UbHoePfr.js} +12 -12
  155. package/dist/chunks/{index-Bx_P7mlL.js → index-g1LXlp77.js} +2 -2
  156. package/dist/chunks/index-zBnnuvLA.js +3788 -0
  157. package/dist/chunks/{run-review-command.logic-BQDGxh0f.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-resolve-conflicts.xml +0 -148
  317. package/dist/.ai/agents/agent-review-verifier.xml +0 -181
  318. package/dist/chunks/index-C4jt5WBP.js +0 -3548
  319. package/dist/chunks/services-Sb7TwLxt.js +0 -122
  320. package/dist/chunks/shared-D0kSJB49.js +0 -601
@@ -0,0 +1,344 @@
1
+ <!--
2
+ @file: Svelte component conventions for uikit — data attributes, CSS tokens, file structure, a11y, token overrides.
3
+ @consumers: SDD agents (implementation phase of uikit-component tasks)
4
+ @tasks: TSK-26
5
+ -->
6
+ <UiKitComponentSvelte keywords="uikit, svelte-component, data-attributes, css-tokens, file-structure, a11y, token-overrides" type="coding-rules" ver="1.0">
7
+ <Directive_Context>
8
+ <Mission>
9
+ Canonical rules for implementing a uikit Svelte component. Every execution-agent MUST apply these conventions when creating or modifying a Svelte component for the uikit library. These rules are LAYERED ON TOP of `svelte5-runes.xml` — the base Svelte 5 rules are prerequisites; this directive adds uikit-specific structural, styling, and accessibility constraints derived from the first component (Button).
10
+
11
+ **Base axiom:** A uikit component is a closed-world artifact — four files in kebab-case, data-attribute selectors (never `:host()`), VKUI CSS custom properties inherited through `:root`, `data-state` for testable pseudo-states, and WAI-ARIA accessibility. Deviating from any of these breaks the automated verification pipeline (no `:host()` in headless Chromium, no pseudo-class triggers in programmatic tests).
12
+
13
+ You are NOT in charge of:
14
+ - Enforcing Svelte 5 runes syntax (delegated to `svelte5-runes.xml`);
15
+ - Storybook conventions (delegated to `uikit-component-storybook.xml`);
16
+ - Deriving the component spec (that is `uikit-spec` territory).
17
+ </Mission>
18
+ </Directive_Context>
19
+
20
+ <Depends_On>
21
+ - ai/directives/coding/svelte5-runes.xml
22
+ - ai/directives/coding/uikit-spec-drafting.xml
23
+ </Depends_On>
24
+
25
+ <Belief_State>
26
+ <Axiom id="AX_DATA_ATTRS_NOT_HOST">
27
+ CSS selectors use `data-*` attributes on an inner wrapper element, NOT `:host()` pseudo-class selectors. The outer host element is a simple `display: inline-block` container; all styling and testable selectors target the inner element.
28
+
29
+ Reasoning (D-UC01): `:host([attr="value"])` compound selectors fail in headless Chromium — `getComputedStyle` returns `0px` for padding. The inner-wrapper approach with `data-*` attributes is proven in the Button PoC and works consistently across all test environments.
30
+
31
+ Correct pattern:
32
+ ```css
33
+ .btn[data-mode="primary"] { ... }
34
+ .btn[data-appearance="accent"] { ... }
35
+ .btn[data-size="s"] { height: var(--vkui--size_button_small_height--compact); }
36
+ .btn[data-state="hover"] { /* hover styles */ }
37
+ ```
38
+
39
+ Forbidden: `:host([mode="primary"])`, `:host(.primary)`, any `:host()` usage.
40
+ </Axiom>
41
+
42
+ <Axiom id="AX_CSS_TOKENS_VIA_ROOT">
43
+ CSS custom properties (design tokens) are inherited through `:root` in `<name>.tokens.css`. Shadow DOM is NOT used for token inheritance — the component relies on the global CSS cascade.
44
+
45
+ The tokens file has two mandatory blocks:
46
+ 1. `:root { ... }` — the token declarations block.
47
+ 2. Override block — tokens where the SVG value differs from the VKUI default, each with a `/* override: was Xpx */` comment.
48
+
49
+ The CSS module (`<name>.module.css`) consumes these tokens via `var(--vkui--...)` functions. No hardcoded pixel values in `.module.css` — every dimension, color, and spacing comes from a token.
50
+
51
+ Counter element: `box-sizing: border-box` is mandatory (prevents overflow when the counter number grows).
52
+ </Axiom>
53
+
54
+ <Axiom id="AX_FILE_STRUCTURE_KEBAB_CASE">
55
+ Every uikit component consists of EXACTLY four files, all in kebab-case, all in a single directory `src/ui/<name>/`:
56
+
57
+ | File | Purpose |
58
+ |--------------------------|------------------------------------------------|
59
+ | `<name>.svelte` | Svelte component (data-attributes, a11y) |
60
+ | `<name>.module.css` | CSS module (data-attribute selectors) |
61
+ | `<name>.tokens.css` | `:root` + override tokens |
62
+ | `<name>.stories.ts` | Storybook stories (mirror of spec) |
63
+
64
+ No PascalCase (`Button.svelte`), no camelCase (`buttonModule.css`), no additional files (`button.utils.ts` belongs elsewhere or doesn't exist). The four-file set is the closed-world contract per `ComponentArtefact`.
65
+ </Axiom>
66
+
67
+ <Axiom id="AX_DATA_STATE_FOR_TESTABILITY">
68
+ Every interactive state that is normally expressed through a CSS pseudo-class (`:hover`, `:active`, `:disabled`) MUST also be expressed through a `data-state` attribute on the inner wrapper element. CSS pseudo-classes cannot be triggered programmatically in headless test environments — `data-state` provides the testable channel.
69
+
70
+ States: `normal`, `hover`, `active`, `disabled`. The `data-state` attribute is always present, never conditionally omitted. The component derives `data-state` from the `state` prop, not from browser events.
71
+
72
+ For test assertions: `expect(element).toHaveAttribute('data-state', 'hover')` — NOT `expect(element).toHaveStyle(...)` for pseudo-class-triggered styles (that won't work in headless).
73
+ </Axiom>
74
+
75
+ <Axiom id="AX_A11Y_REQUIREMENTS">
76
+ Every interactive uikit component MUST declare:
77
+ - `role` — WAI-ARIA role (button, checkbox, etc.).
78
+ - `aria-label` — computed from label + counter (when present).
79
+ - `aria-disabled` — bound to the disabled state.
80
+ - `tabindex` — `0` when interactive, `-1` when disabled.
81
+ - Keyboard support — Enter and Space for activation.
82
+
83
+ For Button specifically:
84
+ - `role="button"`
85
+ - `aria-label={label}` (plus counter if present: `` `${label} ${counter}` ``)
86
+ - `aria-disabled={disabled}`
87
+ - `aria-pressed={state === 'active'}` (optional, for toggle mode)
88
+ - `tabindex={disabled ? -1 : 0}`
89
+
90
+ Focus styles use `:focus-visible` with appearance-dependent styling. No custom focus ring that overrides the browser default without providing equivalent visual feedback.
91
+ </Axiom>
92
+
93
+ <Axiom id="AX_ICON_SVG_TIGHT_VIEWBOX">
94
+ SVG icons have their viewBox cropped to the tight bounding box of the path — NOT the 20×20 Figma container. This prevents unwanted whitespace around icons and ensures consistent spacing within the button.
95
+
96
+ The icon SVG is inlined (not an `<img>` tag) so its fill color can be controlled via CSS. Icon fill inherits from the button's current appearance/mode color.
97
+ </Axiom>
98
+
99
+ <Axiom id="AX_TOKEN_OVERRIDE_COMMENT">
100
+ Every token override (where `diff > 1px` between SVG measurement and VKUI default) MUST carry a comment in `.tokens.css`:
101
+
102
+ ```css
103
+ /* override: was 8px */
104
+ --vkui--size_button_tertiary_small_padding_horizontal_icon--regular: 14px;
105
+ ```
106
+
107
+ The comment format is: `/* override: was <original-value> */`. This preserves the audit trail — an operator or SpecValidator can verify that the override was intentional and trace it back to the Token Mapping table in the spec.
108
+ </Axiom>
109
+
110
+ <Axiom id="AX_COMPONENT_PROPS_CONTRACT">
111
+ A uikit component receives its variant configuration through Svelte 5 `$props()` destructuring. The prop surface matches the spec's Variants table columns:
112
+
113
+ ```typescript
114
+ let {
115
+ appearance = 'accent',
116
+ mode = 'primary',
117
+ size = 's',
118
+ state = 'normal',
119
+ icon = false,
120
+ label = '',
121
+ counter = undefined,
122
+ indicator = false,
123
+ disabled = false,
124
+ }: Props = $props();
125
+ ```
126
+
127
+ The `disabled` prop takes precedence over `state` — when `disabled={true}`, `data-state` is `disabled` regardless of the `state` prop value. The component derives `aria-disabled` and `tabindex` from `disabled`.
128
+ </Axiom>
129
+
130
+ <Axiom id="AX_CSS_MODULE_SELECTOR_CONVENTIONS">
131
+ CSS module selectors follow the data-attribute pattern consistently:
132
+ - `.btn[data-size="s"]` for size-dependent styles.
133
+ - `.btn[data-mode="primary"][data-appearance="accent"]` for mode × appearance combinations.
134
+ - `.btn[data-state="hover"]` for state-dependent styles.
135
+ - Child elements use class selectors: `.icon`, `.label`, `.counter`, `.indicator`.
136
+
137
+ No ID selectors, no tag selectors (except `:root` in tokens), no descendant selectors deeper than 2 levels. Every selector is scoped to the component's root class (`.btn`).
138
+ </Axiom>
139
+ </Belief_State>
140
+
141
+ <Definitions>
142
+ <Definition id="DEF_COMPONENT_ARTEFACT">
143
+ The closed-world set of four files that constitute one uikit component: `<name>.svelte`, `<name>.module.css`, `<name>.tokens.css`, `<name>.stories.ts`. All in `src/ui/<name>/`, all in kebab-case.
144
+ </Definition>
145
+ <Definition id="DEF_DATA_ATTRIBUTE_SELECTOR">
146
+ A CSS selector that targets a `data-*` HTML attribute on the component's inner wrapper: `.btn[data-mode="primary"]`. Preferred over class-based selectors because `data-*` attributes are machine-verifiable in tests via `toHaveAttribute`.
147
+ </Definition>
148
+ <Definition id="DEF_TOKEN_OVERRIDE">
149
+ A CSS custom property declaration in `.tokens.css` whose value differs from the VKUI default. Must carry a `/* override: was ... */` comment. Originates from the Token Mapping table in the component's `.ui.spec.md`.
150
+ </Definition>
151
+ </Definitions>
152
+
153
+ <Code_Patterns>
154
+ <Pattern id="PT_COMPONENT_SVELTE_TEMPLATE">
155
+ <Intent>Canonical structure of a uikit Svelte component file.</Intent>
156
+ <Snippet language="svelte">
157
+ ```svelte
158
+ <!-- @file: Button component — uikit conventions: data-attributes, a11y, CSS tokens. -->
159
+ <script lang="ts">
160
+ let {
161
+ appearance = 'accent',
162
+ mode = 'primary',
163
+ size = 's',
164
+ state = 'normal',
165
+ icon = false,
166
+ label = '',
167
+ counter = undefined,
168
+ indicator = false,
169
+ disabled = false,
170
+ }: Props = $props();
171
+
172
+ let resolvedState = $derived(disabled ? 'disabled' : state);
173
+ </script>
174
+
175
+ <div
176
+ class="btn"
177
+ data-appearance={appearance}
178
+ data-mode={mode}
179
+ data-size={size}
180
+ data-state={resolvedState}
181
+ role="button"
182
+ aria-label={label}
183
+ aria-disabled={disabled}
184
+ tabindex={disabled ? -1 : 0}
185
+ >
186
+ {#if icon}
187
+ <span class="icon">
188
+ <!-- Inlined SVG with tight viewBox -->
189
+ </span>
190
+ {/if}
191
+ {#if label}
192
+ <span class="label">{label}</span>
193
+ {/if}
194
+ {#if counter !== undefined}
195
+ <span class="counter">{counter}</span>
196
+ {/if}
197
+ {#if indicator}
198
+ <span class="indicator">
199
+ <!-- Chevron SVG -->
200
+ </span>
201
+ {/if}
202
+ </div>
203
+ ```
204
+ </Snippet>
205
+ <Why>Single `$props()` destructure with all variant props; `$derived` resolves state vs disabled; inner wrapper carries all data-attributes and ARIA; child elements conditionally rendered; no `:host()`, no `<slot>`, no legacy patterns.</Why>
206
+ </Pattern>
207
+
208
+ <Pattern id="PT_TOKENS_CSS_TEMPLATE">
209
+ <Intent>Canonical structure of a uikit `.tokens.css` file.</Intent>
210
+ <Snippet language="css">
211
+ ```css
212
+ :root {
213
+ --vkui--size_button_small_height--compact: 28px;
214
+ --vkui--size_button_base_small_padding_horizontal_icon--regular: 14px;
215
+ /* override: was 8px */
216
+ --vkui--size_button_tertiary_small_padding_horizontal_icon--regular: 14px;
217
+ /* override: was rgba(0,0,0,0.12) */
218
+ --vkui--color_background_tertiary_alpha--active: rgba(0, 16, 61, 0.14);
219
+ }
220
+ ```
221
+ </Snippet>
222
+ <Why>Single `:root` block with all token declarations; override tokens carry `/* override: was ... */` comments; token names match the VKUI naming convention; no shadow DOM, no `@import`, no extra blocks.</Why>
223
+ </Pattern>
224
+
225
+ <Pattern id="PT_MODULE_CSS_TEMPLATE">
226
+ <Intent>Canonical structure of a uikit `.module.css` file.</Intent>
227
+ <Snippet language="css">
228
+ ```css
229
+ .btn[data-size='s'] {
230
+ height: var(--vkui--size_button_small_height--compact);
231
+ }
232
+
233
+ .btn[data-mode='primary'][data-appearance='accent'] {
234
+ background: var(--vkui--color_background_accent);
235
+ }
236
+
237
+ .btn[data-state='hover'] {
238
+ /* hover styles via data-state, not :hover pseudo-class */
239
+ }
240
+
241
+ .counter {
242
+ width: 18px;
243
+ height: 18px;
244
+ box-sizing: border-box;
245
+ }
246
+ ```
247
+ </Snippet>
248
+ <Why>Data-attribute selectors for variant-dependent styles; CSS custom properties for all values; `box-sizing: border-box` on counter; no `:host()`, no hardcoded values, no deep nesting.</Why>
249
+ </Pattern>
250
+ </Code_Patterns>
251
+
252
+ <Anti_Patterns>
253
+ <Anti_Pattern id="AP_HOST_SELECTOR">
254
+ <Bad>`.module.css` containing `:host([mode="primary"]) { background: blue; }`.</Bad>
255
+ <Why_Bad>`:host()` compound selectors fail in headless Chromium (`AX_DATA_ATTRS_NOT_HOST`). Padding returns `0px` from `getComputedStyle`, breaking visual tests. The inner-wrapper approach is the proven alternative.</Why_Bad>
256
+ <Good>Inner wrapper with data-attribute: `.btn[data-mode="primary"] { background: var(--vkui--color_background_accent); }`.</Good>
257
+ </Anti_Pattern>
258
+
259
+ <Anti_Pattern id="AP_MISSING_DATA_STATE">
260
+ <Bad>Component relies on CSS `:hover` pseudo-class for hover styling, with no `data-state` attribute.</Bad>
261
+ <Why_Bad>Headless test environments cannot trigger `:hover` programmatically (`AX_DATA_STATE_FOR_TESTABILITY`). The hover variant is untestable — visual regression tests pass trivially without actually verifying hover appearance.</Why_Bad>
262
+ <Good>Add `data-state={resolvedState}` attribute and use `.btn[data-state="hover"]` selectors. Tests assert `toHaveAttribute('data-state', 'hover')`.</Good>
263
+ </Anti_Pattern>
264
+
265
+ <Anti_Pattern id="AP_HARDCODED_PIXELS">
266
+ <Bad>`.module.css` with `height: 28px;` instead of `var(--vkui--size_button_small_height--compact)`.</Bad>
267
+ <Why_Bad>Token not consumed via custom property (`AX_CSS_TOKENS_VIA_ROOT`). The value cannot be overridden, themed, or traced back to the VKUI token system. When the design system updates the token, this component silently stays at the old value.</Why_Bad>
268
+ <Good>`height: var(--vkui--size_button_small_height--compact);` — the token from `.tokens.css` flows through.</Good>
269
+ </Anti_Pattern>
270
+
271
+ <Anti_Pattern id="AP_PASCAL_CASE_FILENAME">
272
+ <Bad>Component file named `Button.svelte` or `Button.module.css`.</Bad>
273
+ <Why_Bad>Violates kebab-case convention (`AX_FILE_STRUCTURE_KEBAB_CASE`, D-UC03). Inconsistent with existing project files (`app.svelte`, `app.stories.ts`). Breaks the closed-world `ComponentArtefact` contract.</Why_Bad>
274
+ <Good>`button.svelte`, `button.module.css`, `button.tokens.css`, `button.stories.ts`.</Good>
275
+ </Anti_Pattern>
276
+
277
+ <Anti_Pattern id="AP_MISSING_ARIA">
278
+ <Bad>Button component with `<div class="btn" onclick={handler}>` and no ARIA attributes.</Bad>
279
+ <Why_Bad>A11y contract not fulfilled (`AX_A11Y_REQUIREMENTS`). Screen readers cannot identify the element as a button, cannot announce its label, cannot report its disabled state. Keyboard users cannot focus or activate it.</Why_Bad>
280
+ <Good>`<div class="btn" role="button" aria-label={label} aria-disabled={disabled} tabindex={disabled ? -1 : 0}>`.</Good>
281
+ </Anti_Pattern>
282
+
283
+ <Anti_Pattern id="AP_OVERRIDE_WITHOUT_COMMENT">
284
+ <Bad>`.tokens.css` with `--vkui--size_button_tertiary_small_padding_horizontal_icon--regular: 14px;` and no override comment.</Bad>
285
+ <Why_Bad>Override without audit trail (`AX_TOKEN_OVERRIDE_COMMENT`). Cannot distinguish intentional override from accidental drift. SpecValidator cannot trace the value back to the Token Mapping table.</Why_Bad>
286
+ <Good>`/* override: was 8px */` on the line above the declaration.</Good>
287
+ </Anti_Pattern>
288
+
289
+ <Anti_Pattern id="AP_IMG_TAG_ICON">
290
+ <Bad>Icon rendered as `<img src="icon.svg" alt="" />`.</Bad>
291
+ <Why_Bad>Icon fill cannot be controlled via CSS when using `<img>` (`AX_ICON_SVG_TIGHT_VIEWBOX`). Each appearance/mode combination would need a separate SVG file with hardcoded fill. Inlined SVG with `fill: currentColor` or CSS variable solves this.</Why_Bad>
292
+ <Good>Inline the SVG with tight viewBox; control fill via CSS on the `.icon` container or the SVG paths directly.</Good>
293
+ </Anti_Pattern>
294
+ </Anti_Patterns>
295
+
296
+ <Verification_Hooks>
297
+ <Hook id="HOOK_NO_HOST_SELECTOR">
298
+ <Purpose>Detect forbidden `:host()` pseudo-class usage in component CSS.</Purpose>
299
+ <Command>find . -name '*.module.css' -not -path '*/node_modules/*' -print0 | xargs -0 grep -n ':host' || true</Command>
300
+ <Expected>Empty output. Any match is a violation of `AX_DATA_ATTRS_NOT_HOST`.</Expected>
301
+ </Hook>
302
+ <Hook id="HOOK_DATA_STATE_PRESENT">
303
+ <Purpose>Verify every uikit component exposes `data-state` attribute.</Purpose>
304
+ <Command>find src/ui -name '*.svelte' -not -path '*/node_modules/*' -print0 | xargs -0 grep -l 'data-state=' || echo MISSING</Command>
305
+ <Expected>Every `.svelte` file in `src/ui/` must appear in output. `MISSING` means at least one component lacks `data-state`.</Expected>
306
+ </Hook>
307
+ <Hook id="HOOK_ARIA_ATTRIBUTES_PRESENT">
308
+ <Purpose>Verify every uikit component has ARIA role and label.</Purpose>
309
+ <Command>find src/ui -name '*.svelte' -not -path '*/node_modules/*' -print0 | xargs -0 grep -lE 'role="button"|role="checkbox"|role="radio"' || echo MISSING</Command>
310
+ <Expected>Every `.svelte` file must appear. `MISSING` means a component lacks ARIA role.</Expected>
311
+ </Hook>
312
+ <Hook id="HOOK_KEBAB_CASE_FILES">
313
+ <Purpose>Verify all component files are in kebab-case.</Purpose>
314
+ <Command>find src/ui -type f \( -name '*.svelte' -o -name '*.module.css' -o -name '*.tokens.css' -o -name '*.stories.ts' \) -not -path '*/node_modules/*' | while read f; do basename "$f"; done | grep -E '[A-Z]' || true</Command>
315
+ <Expected>Empty output. Any match is a PascalCase/camelCase filename violation.</Expected>
316
+ </Hook>
317
+ <Hook id="HOOK_OVERRIDE_COMMENTS_PRESENT">
318
+ <Purpose>Verify every override token has its audit comment.</Purpose>
319
+ <Command>find src/ui -name '*.tokens.css' -not -path '*/node_modules/*' -print0 | xargs -0 grep -c 'override: was' || true</Command>
320
+ <Expected>Count should match the number of OVERRIDE rows in the component's Token Mapping table. Zero when the spec has zero overrides; positive otherwise.</Expected>
321
+ </Hook>
322
+ </Verification_Hooks>
323
+
324
+ <Reward_Criteria>
325
+ ✅ Component uses `data-*` attribute selectors on inner wrapper; no `:host()` anywhere.
326
+ ✅ CSS custom properties inherited through `:root` in `.tokens.css`; consumed via `var()` in `.module.css`.
327
+ ✅ Four files per component, all kebab-case: `<name>.svelte`, `<name>.module.css`, `<name>.tokens.css`, `<name>.stories.ts`.
328
+ ✅ `data-state` attribute present and used in CSS selectors for all interactive states.
329
+ ✅ ARIA role, label, disabled, and tabindex correctly wired.
330
+ ✅ SVG icons inlined with tight viewBox; fill controlled via CSS.
331
+ ✅ Override tokens carry `/* override: was ... */` comment.
332
+ ✅ Props match the spec's Variants table; `disabled` takes precedence over `state`.
333
+ ✅ Counter element has `box-sizing: border-box`.
334
+
335
+ ❌ `:host()` selector in any CSS file.
336
+ ❌ Hardcoded pixel/color values in `.module.css` (must use `var()`).
337
+ ❌ PascalCase or camelCase component filenames.
338
+ ❌ Missing `data-state` attribute.
339
+ ❌ Missing ARIA role or label on interactive component.
340
+ ❌ Override token without audit comment.
341
+ ❌ Icon as `<img>` tag (not inlined SVG).
342
+ ❌ `disabled` and `state` props conflicting without clear precedence.
343
+ </Reward_Criteria>
344
+ </UiKitComponentSvelte>
@@ -0,0 +1,243 @@
1
+ <!--
2
+ @file: Drafting rules for converting ExtractionResult JSON to a draft .ui.spec.md UI component spec.
3
+ @consumers: SDD agents (drafting phase of uikit-component tasks)
4
+ @tasks: TSK-25
5
+ -->
6
+ <UiKitSpecDrafting keywords="uikit, spec-drafting, extraction-result, ui-spec, token-mapping, variant-grouping, bdd-generation, a11y-defaults" type="drafting-rules" ver="1.0">
7
+ <Directive_Context>
8
+ <Mission>
9
+ Convert an ExtractionResult — the JSON output of `figma-utils extract &lt;component&gt;` — into a draft `.ui.spec.md` (per `spec-format.md`). The draft is a starting point for operator refinement; it must preserve ALL data from the extraction (all variants, all token candidates, all elements) without loss.
10
+
11
+ The format of the output spec is defined in `specs/uikit/spec-format.md`. This directive governs the TRANSFORMATION logic: how to group variants, populate token mappings, generate BDD, and apply a11y defaults.
12
+
13
+ You are NOT in charge of:
14
+ - Running `figma-utils extract` (that is a prior step, TSK-24);
15
+ - Validating the draft (SpecValidator is a separate check);
16
+ - Finalising the spec (operator approves after review).
17
+ </Mission>
18
+ </Directive_Context>
19
+
20
+ <Belief_State>
21
+ <Axiom id="AX_EXTRACTION_INPUT">
22
+ The input is an `ExtractionResult` object with shape:
23
+ ```json
24
+ {
25
+ "component": "button",
26
+ "svg": "<path-to-svg>",
27
+ "variants": [ /* SvgVariant[] */ ],
28
+ "elements": [ "icon", "label", "counter", "indicator" ],
29
+ "tokenOverrides": [ /* TokenCandidate[] where match=false */ ]
30
+ }
31
+ ```
32
+ Every `SvgVariant` carries: `id`, `size`, `appearance`, `mode`, `state`, and `measurements` (MeasurementSet with height, width, leftPad, rightPad, borderRadius, rectFill, elements).
33
+ Every `TokenCandidate` carries: `metric`, `svgValue`, `token`, `tokenValue`, `diff`, `match`.
34
+ </Axiom>
35
+
36
+ <Axiom id="AX_VARIANT_GROUPING">
37
+ Variants are grouped hierarchically: `size → appearance → mode`. Each leaf group contains all 4 states (normal, hover, active, disabled). The result is a closed-world table — every combination is listed explicitly, no «и т.д.» allowed.
38
+
39
+ Procedure:
40
+ 1. Collect all unique triples `(size, appearance, mode)` from `ExtractionResult.variants`.
41
+ 2. Sort: size (s, m, l) → appearance (accent, neutral, contrary) → mode (primary, secondary, tertiary, outline).
42
+ 3. For each triple, list states: `normal, hover, active, disabled`.
43
+ 4. If a state is missing from the extraction data, mark it as `⚠️ not in extraction` — do NOT omit the row.
44
+ </Axiom>
45
+
46
+ <Axiom id="AX_TOKEN_SECTION_GENERATION">
47
+ The Token Mapping section populates measurements from `ExtractionResult.variants[].measurements` and maps them to VKUI tokens from `TokenCandidate[]`.
48
+
49
+ Procedure:
50
+ 1. Collect all unique `(element, metric)` pairs across all variants. The `element` prefix is derived from `MeasurementSet` fields: `icon-padding-left` (from leftPad of icon element), `height`, `border-radius`, etc.
51
+ 2. For each pair, find the corresponding `TokenCandidate` where exists. If not found → mark as `⚠️ no token`.
52
+ 3. Compute `diff = |svgValue - tokenValue|`.
53
+ 4. If `diff ≤ 1` → Action = `OK`. If `diff > 1` → Action = `OVERRIDE: &lt;svgValue&gt;px`.
54
+ 5. Sort rows: element name alphabetically.
55
+
56
+ Note: `ExtractionResult.tokenOverrides` contains only candidates where `match: false`. For the full Token Mapping table, you need ALL measurements — both matched and unmatched. If `tokenOverrides` is the only source, the table will be incomplete. Prefer deriving measurements from `variants[].measurements` and cross-referencing with token mappings.
57
+ </Axiom>
58
+
59
+ <Axiom id="AX_BDD_GENERATION">
60
+ BDD scenarios are generated for each `(appearance, mode, state)` combination.
61
+
62
+ Procedure:
63
+ 1. For each group from variant grouping: heading `### &lt;Appearance&gt; / &lt;Mode&gt;`.
64
+ 2. For each state (normal, hover, active, disabled): sub-heading `#### &lt;State&gt;`.
65
+ 3. Write Given/When/Then:
66
+ - **Given:** component with `appearance=...`, `mode=...`, `state=...`, `size=...` (pick representative size, note size parameter)
67
+ - **When:** rendered
68
+ - **Then:** visual expectations derived from `Measurements` of the corresponding variant:
69
+ - `background = &lt;rectFill&gt;` (hex color from the variant's background rect)
70
+ - `text = &lt;label fill&gt;` (if label element exists)
71
+ - `height = &lt;height&gt;px`, `borderRadius = &lt;borderRadius&gt;px`
72
+ - For hover/active states: background color from the corresponding variant
73
+ - For disabled: `opacity = &lt;rectOpacity&gt;`
74
+
75
+ Minimum coverage: one scenario per state per (appearance, mode) group. All scenarios must reference real measurement data from the extraction.
76
+ </Axiom>
77
+
78
+ <Axiom id="AX_A11Y_DEFAULTS">
79
+ Default a11y requirements for common component types. Apply the template matching the component type.
80
+
81
+ For **button:**
82
+ - **Role:** button
83
+ - **aria-label:** формируется из label + counter (если есть)
84
+ - **aria-disabled:** при state=disabled
85
+ - **Keyboard:** Enter, Space активируют кнопку
86
+
87
+ For **other interactive components** (checkbox, radio, link, input): infer role from component name and visual structure; apply standard WAI-ARIA patterns.
88
+ </Axiom>
89
+
90
+ <Axiom id="AX_ELEMENT_STRUCTURE_FROM_EXTRACTION">
91
+ The Element Structure section is derived from `ExtractionResult.elements` — the list of element names discovered in the SVG.
92
+
93
+ Procedure:
94
+ 1. Map each element name to a semantic description:
95
+ - `icon` → "SVG-иконка (обрезанный viewBox до tight path bounds)"
96
+ - `label` → "текстовая метка"
97
+ - `counter` → "числовой счётчик (box-sizing: border-box)"
98
+ - `indicator` → "шеврон (стрелка вправо)"
99
+ 2. For unknown element names: infer from context, mark with `⚠️ requires clarification`.
100
+ 3. Order elements: icon, label, counter, indicator (visual left-to-right).
101
+ </Axiom>
102
+
103
+ <Axiom id="AX_NO_DATA_LOSS">
104
+ The draft MUST preserve ALL data from `ExtractionResult`:
105
+ - All `variants[]` are reflected in the Variants table.
106
+ - All unique `(element, metric)` pairs from all `Measurements` are reflected in Token Mapping.
107
+ - All `elements[]` are listed in Element Structure.
108
+ - Every state for every (size, appearance, mode) combination has a BDD scenario.
109
+
110
+ Missing data (state not in extraction, token not found) → mark explicitly with `⚠️`, never silently omit.
111
+ </Axiom>
112
+
113
+ <Axiom id="AX_DRAFT_READY_FOR_REVIEW">
114
+ The output is a DRAFT — marked with a header comment:
115
+ ```markdown
116
+ &lt;!-- DRAFT: generated from figma-utils extract. Review and finalise before scaffold. --&gt;
117
+ ```
118
+ This signals to the operator that the spec is machine-generated and requires human approval.
119
+ </Axiom>
120
+ </Belief_State>
121
+
122
+ <Drafting_Procedure>
123
+ <Step id="STEP_1_LOAD_EXTRACTION">
124
+ <Goal>Receive and validate the ExtractionResult.</Goal>
125
+ <Action>
126
+ 1. Confirm `ExtractionResult.variants` is non-empty.
127
+ 2. Confirm `ExtractionResult.elements` is non-empty.
128
+ 3. If either is empty → abort with diagnostic: «ExtractionResult пуст — запустите figma:extract &lt;component&gt; сначала».
129
+ </Action>
130
+ </Step>
131
+
132
+ <Step id="STEP_2_BUILD_VISION">
133
+ <Goal>Write the Vision section.</Goal>
134
+ <Action>
135
+ Format: `&lt;ComponentName&gt; — &lt;brief description&gt;. &lt;count&gt; size × &lt;appearances&gt; × &lt;states&gt;.`
136
+
137
+ Example: `Кнопка с иконкой — Primary CTA. 3 size × accent/neutral/contrary × normal/hover/active/disabled.`
138
+
139
+ Derive:
140
+ - `count` = number of unique sizes
141
+ - `appearances` = unique appearance values, joined by `/`
142
+ - `states` = unique state values, joined by `/`
143
+ </Action>
144
+ </Step>
145
+
146
+ <Step id="STEP_3_BUILD_VARIANTS">
147
+ <Goal>Build the closed-world Variants table.</Goal>
148
+ <Action>
149
+ Per `AX_VARIANT_GROUPING`:
150
+ 1. Group variants by `(size, appearance, mode)`.
151
+ 2. Sort hierarchically.
152
+ 3. For each group, list states as comma-separated.
153
+ 4. Flag missing states with `⚠️`.
154
+ </Action>
155
+ </Step>
156
+
157
+ <Step id="STEP_4_BUILD_TOKEN_MAPPING">
158
+ <Goal>Build the Token Mapping table.</Goal>
159
+ <Action>
160
+ Per `AX_TOKEN_SECTION_GENERATION`:
161
+ 1. Extract all unique `(element, metric, svgValue)` from all variants.
162
+ 2. Cross-reference with token candidates.
163
+ 3. Compute diff and action.
164
+ 4. Flag missing tokens with `⚠️ no token`.
165
+ </Action>
166
+ </Step>
167
+
168
+ <Step id="STEP_5_BUILD_ELEMENT_STRUCTURE">
169
+ <Goal>Build the Element Structure section.</Goal>
170
+ <Action>
171
+ Per `AX_ELEMENT_STRUCTURE_FROM_EXTRACTION`: map element names to semantic descriptions.
172
+ </Action>
173
+ </Step>
174
+
175
+ <Step id="STEP_6_BUILD_A11Y">
176
+ <Goal>Build the A11y Requirements section.</Goal>
177
+ <Action>
178
+ Per `AX_A11Y_DEFAULTS`: apply the template for the component type.
179
+ </Action>
180
+ </Step>
181
+
182
+ <Step id="STEP_7_BUILD_BDD">
183
+ <Goal>Build BDD scenarios for every state.</Goal>
184
+ <Action>
185
+ Per `AX_BDD_GENERATION`:
186
+ 1. For each (appearance, mode) group, write a heading.
187
+ 2. For each state, write a sub-heading and Given/When/Then.
188
+ 3. Derive expected values from the variant's `Measurements`.
189
+ </Action>
190
+ </Step>
191
+
192
+ <Step id="STEP_8_EMIT_DRAFT">
193
+ <Goal>Write the draft file.</Goal>
194
+ <Action>
195
+ 1. Prepend draft header: `&lt;!-- DRAFT: generated from figma-utils extract. Review and finalise before scaffold. --&gt;`.
196
+ 2. Write all 6 sections in order: Vision, Variants, Token Mapping, Element Structure, A11y Requirements, BDD Scenarios.
197
+ 3. Save as `specs/uikit/components/&lt;component&gt;.ui.spec.md`.
198
+ </Action>
199
+ </Step>
200
+ </Drafting_Procedure>
201
+
202
+ <Anti_Patterns>
203
+ <Anti_Pattern id="AP_DROPPED_VARIANTS">
204
+ <Bad>Пропуск строки в таблице Variants, потому что «этот вариант не в extraction».</Bad>
205
+ <Why_Bad>Closed-world нарушен. Последующий SpecValidator не сможет отличить «пропущен осознанно» от «забыли».</Why_Bad>
206
+ <Good>Строка присутствует, но состояния помечены `⚠️ not in extraction`.</Good>
207
+ </Anti_Pattern>
208
+
209
+ <Anti_Pattern id="AP_SILENT_MISSING_TOKEN">
210
+ <Bad>Пропуск строки в Token Mapping, когда токен не найден.</Bad>
211
+ <Why_Bad>Измерение теряется. SpecValidator не может проверить, что все измерения покрыты.</Why_Bad>
212
+ <Good>Строка с `⚠️ no token` в колонке Token и `Action = ⚠️`.</Good>
213
+ </Anti_Pattern>
214
+
215
+ <Anti_Pattern id="AP_DUPLICATE_BDD_GROUP">
216
+ <Bad>Один BDD-заголовок на несколько размеров: `### Primary / Accent (все размеры)`.</Bad>
217
+ <Why_Bad>Разные размеры имеют разные ожидаемые значения (height, pads). Сгруппированные BDD нельзя верифицировать.</Why_Bad>
218
+ <Good>Отдельный BDD-заголовок на каждый (appearance, mode), внутри указывается representative size и конкретные значения.</Good>
219
+ </Anti_Pattern>
220
+
221
+ <Anti_Pattern id="AP_FABRICATED_MEASUREMENTS">
222
+ <Bad>BDD-сценарий с выдуманными значениями: `background = #0077FF`, когда в extraction нет такого цвета.</Bad>
223
+ <Why_Bad>SpecValidator обнаружит расхождение. Фабрикация данных подрывает доверие к спекам.</Why_Bad>
224
+ <Good>Все Then-значения берутся из `MeasurementSet` соответствующего варианта: `rectFill`, `height`, `borderRadius`, etc.</Good>
225
+ </Anti_Pattern>
226
+ </Anti_Patterns>
227
+
228
+ <Reward_Criteria>
229
+ ✅ Draft содержит все 6 обязательных секций (Vision, Variants, Token Mapping, Element Structure, A11y, BDD).
230
+ ✅ Variants — closed-world таблица, все комбинации size × appearance × mode перечислены.
231
+ ✅ Token Mapping — каждая строка имеет валидный VKUI токен или явную пометку `⚠️ no token`.
232
+ ✅ Element Structure — все элементы из `ExtractionResult.elements` перечислены с семантическим описанием.
233
+ ✅ A11y — role, aria-атрибуты, keyboard navigation для типа компонента.
234
+ ✅ BDD — минимум один сценарий на каждое состояние, все значения из реальных измерений.
235
+ ✅ Нет потери данных: все variants[], все метрики, все элементы отражены в спеке.
236
+
237
+ ❌ Пропущена строка в Variants (нарушение closed-world).
238
+ ❌ Пропущено измерение в Token Mapping.
239
+ ❌ BDD без реальных данных (фабрикация).
240
+ ❌ Отсутствует a11y-секция.
241
+ ❌ Draft без пометки `DRAFT`.
242
+ </Reward_Criteria>
243
+ </UiKitSpecDrafting>