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,665 @@
1
+ import { spawn as O, execSync as R } from "node:child_process";
2
+ import u, { mkdirSync as F, readFileSync as $, existsSync as M } from "node:fs";
3
+ import m, { resolve as d, dirname as G, join as P } from "node:path";
4
+ import { platform as b, homedir as k } from "node:os";
5
+ import { fileURLToPath as T } from "node:url";
6
+ import { l as w } from "./services-CaLOhuLV.js";
7
+ const I = 864e5, W = 3e3, U = "update-check-worker.ts", H = "update-check-cache.json";
8
+ function V(r) {
9
+ return b() === "win32" ? d(process.env.LOCALAPPDATA ?? d(k(), "AppData", "Local"), "gennady") : b() === "darwin" ? d(k(), "Library", "Caches", "gennady") : d(k(), ".cache", "gennady");
10
+ }
11
+ function Y(r) {
12
+ try {
13
+ const s = $(r, "utf-8"), n = JSON.parse(s);
14
+ return typeof n?.lastCheck != "string" || typeof n?.latestVersion != "string" ? null : n;
15
+ } catch {
16
+ return null;
17
+ }
18
+ }
19
+ function K(r, s) {
20
+ return Date.now() - new Date(r.lastCheck).getTime() < s;
21
+ }
22
+ function C(r, s) {
23
+ let n = !1;
24
+ process.on("beforeExit", () => {
25
+ n || (n = !0, process.stderr.write(`
26
+ Update available: ${r} → ${s}
27
+ `), process.stderr.write(`Run: npm i -g gennady@latest
28
+
29
+ `));
30
+ });
31
+ }
32
+ function ye(r, s) {
33
+ if (process.env.GENNADY_NO_UPDATE_CHECK === "1" || process.argv.includes("--no-update-check")) {
34
+ process.env.GENNADY_DEBUG === "1" && process.stderr.write(
35
+ `[update-check] skipped: opt-out (GENNADY_NO_UPDATE_CHECK or --no-update-check)
36
+ `
37
+ );
38
+ return;
39
+ }
40
+ if (process.env.CI === "true" || process.env.CONTINUOUS_INTEGRATION === "true" || process.env.NODE_ENV === "test") {
41
+ process.env.GENNADY_DEBUG === "1" && process.stderr.write(`[update-check] skipped: CI/test environment
42
+ `);
43
+ return;
44
+ }
45
+ const n = Number(process.env.GENNADY_UPDATE_CHECK_INTERVAL) || I, e = V(), a = d(e, H);
46
+ F(e, { recursive: !0 });
47
+ const t = Y(a);
48
+ if (t && K(t, n)) {
49
+ t.latestVersion && t.latestVersion !== r.version && (process.stderr.isTTY || s?.skipNotificationIfNoTty === !1) && C(r.version, t.latestVersion);
50
+ return;
51
+ }
52
+ const i = d(G(T(import.meta.url)), U);
53
+ O(
54
+ process.execPath,
55
+ [i, r.name, r.version, a, String(W)],
56
+ {
57
+ stdio: "ignore"
58
+ }
59
+ ).unref(), t?.latestVersion && t.latestVersion !== r.version && (process.stderr.isTTY || s?.skipNotificationIfNoTty === !1) && C(r.version, t.latestVersion);
60
+ }
61
+ const h = ["plain", "nocolor", "noColor", "no-color", "color=no", "color=never"].some(
62
+ (r) => process.argv.includes(`-${r}`) || process.argv.includes(`--${r}`)
63
+ ), p = {
64
+ // Modifiers
65
+ reset: "\x1B[0m",
66
+ bold: "\x1B[1m",
67
+ dim: "\x1B[2m",
68
+ italic: "\x1B[3m",
69
+ underline: "\x1B[4m",
70
+ overline: "\x1B[53m",
71
+ inverse: "\x1B[7m",
72
+ hidden: "\x1B[8m",
73
+ strikethrough: "\x1B[9m",
74
+ // Colors (foreground)
75
+ black: "\x1B[30m",
76
+ red: "\x1B[31m",
77
+ green: "\x1B[32m",
78
+ yellow: "\x1B[33m",
79
+ blue: "\x1B[34m",
80
+ magenta: "\x1B[35m",
81
+ cyan: "\x1B[36m",
82
+ white: "\x1B[37m",
83
+ gray: "\x1B[90m",
84
+ redBright: "\x1B[91m",
85
+ greenBright: "\x1B[92m",
86
+ yellowBright: "\x1B[93m",
87
+ blueBright: "\x1B[94m",
88
+ magentaBright: "\x1B[95m",
89
+ cyanBright: "\x1B[96m",
90
+ whiteBright: "\x1B[97m",
91
+ // Background colors
92
+ bgBlack: "\x1B[40m",
93
+ bgRed: "\x1B[41m",
94
+ bgGreen: "\x1B[42m",
95
+ bgYellow: "\x1B[43m",
96
+ bgBlue: "\x1B[44m",
97
+ bgMagenta: "\x1B[45m",
98
+ bgCyan: "\x1B[46m",
99
+ bgWhite: "\x1B[47m",
100
+ bgGray: "\x1B[100m",
101
+ bgRedBright: "\x1B[101m",
102
+ bgGreenBright: "\x1B[102m",
103
+ bgYellowBright: "\x1B[103m",
104
+ bgBlueBright: "\x1B[104m",
105
+ bgMagentaBright: "\x1B[105m",
106
+ bgCyanBright: "\x1B[106m",
107
+ bgWhiteBright: "\x1B[107m"
108
+ };
109
+ function D(r = []) {
110
+ const s = (n) => h ? n : r.join("") + n + p.reset;
111
+ return new Proxy(s, {
112
+ get(n, e) {
113
+ if (e === "toString")
114
+ return () => h ? "%s" : r.join("") + "%s" + p.reset;
115
+ if (e in p) {
116
+ const a = p[e];
117
+ return D(h ? [] : [...r, a].filter(Boolean));
118
+ }
119
+ },
120
+ apply(n, e, a) {
121
+ const t = a[0] ?? "";
122
+ return h ? t : r.join("") + t + p.reset;
123
+ }
124
+ });
125
+ }
126
+ const ke = D(), xe = (r, s = {}) => {
127
+ const n = { _: [] };
128
+ return r.slice(2).forEach((a) => {
129
+ if (a.startsWith("-")) {
130
+ const t = a.replace(/^-+/, ""), [i, o] = t.split("=");
131
+ for (const [c, l] of Object.entries(s))
132
+ if (Array.isArray(l) && i && l.includes(i)) {
133
+ const g = o ? o.replace(/^"|"$/g, "") : !0;
134
+ c in n ? (Array.isArray(n[c]) || (n[c] = [n[c]]), n[c].push(g)) : n[c] = g;
135
+ break;
136
+ }
137
+ } else
138
+ n._.push(a);
139
+ }), n;
140
+ }, J = {
141
+ js: "JavaScript",
142
+ jsx: "JavaScript",
143
+ ts: "TypeScript",
144
+ tsx: "TypeScript",
145
+ java: "Java",
146
+ py: "Python",
147
+ c: "C",
148
+ cpp: "C++",
149
+ cs: "C#",
150
+ rb: "Ruby",
151
+ php: "PHP",
152
+ go: "Go",
153
+ swift: "Swift",
154
+ m: "Objective-C",
155
+ mm: "Objective-C++",
156
+ kt: "Kotlin",
157
+ sh: "Shell",
158
+ bash: "Shell",
159
+ html: "HTML",
160
+ css: "CSS",
161
+ less: "Less",
162
+ scss: "SCSS",
163
+ sass: "Sass",
164
+ md: "Markdown",
165
+ mdc: "Markdown"
166
+ }, A = (r) => J[r] ?? void 0, Ee = () => {
167
+ try {
168
+ return R("osascript -e 'user locale of (get system info)'").toString().trim().toLowerCase().split("_").filter((n) => n !== "en" && n !== "us")[0] ?? "en";
169
+ } catch {
170
+ return "en";
171
+ }
172
+ }, _ = (r) => {
173
+ const s = r.match(/[\p{L}\p{N}_]+|[^\s\p{L}\p{N}_]/gu);
174
+ return s ? s.length : 0;
175
+ }, X = [
176
+ "^package\\.json",
177
+ "^tsconfig\\.json",
178
+ "^babel\\.config\\.json",
179
+ "^\\.pnpmfile\\.cjs",
180
+ "^\\.yarnrc(?:\\.(?:yml|yaml))?",
181
+ "^go\\.(?:mod|sum)",
182
+ "^\\.env(?:\\.[\\w]+)?",
183
+ "^\\..+",
184
+ ".*\\.(?:yml|yaml|rc|ini|conf)"
185
+ ], z = [
186
+ "^package-lock\\.json",
187
+ "^npm-shrinkwrap\\.json",
188
+ "^yarn(?:-lock)?\\.(?:yaml|yml|toml)",
189
+ "^pnpm-lock\\.yaml",
190
+ "^composer\\.lock",
191
+ "^podfile\\.lock",
192
+ "^go\\.sum",
193
+ "^gemfile\\.lock"
194
+ ], q = {
195
+ doc: /\.(md|markdown|txt|rst)$/i,
196
+ cfg: new RegExp(X.join("|"), "i"),
197
+ img: /\.(png|jpe?g|gif|svg|bmp|tiff|ico)$/i,
198
+ css: /\.(css|less|scss|sass|styl)$/i,
199
+ html: /\.(html?)$/i,
200
+ code: /\.(js|jsx|ts|tsx|java|py|c|cpp|cs|rb|php|go|swift|m|mm|kt|sh|bash)$/i,
201
+ bin: /^(exe|dll|so|bin)\b/i,
202
+ lock: new RegExp(z.join("|"), "i"),
203
+ json: /\.json$/i
204
+ }, B = (r, s) => {
205
+ if (s?.extra && Array.isArray(s.extra)) {
206
+ for (const e of s.extra)
207
+ if (/^Binary files? /i.test(e) || /GIT binary patch/i.test(e))
208
+ return "bin";
209
+ }
210
+ return Object.entries(q).find(([, e]) => e.test(r))?.[0] ?? "other";
211
+ }, Q = (r) => {
212
+ const s = r.split(`
213
+ `), n = [];
214
+ let e = null, a = null;
215
+ if (s.forEach((t) => {
216
+ if (t.startsWith("diff --git")) {
217
+ if (e) {
218
+ e.diff.tokens = e.diff.hunks.reduce(
219
+ (g, L) => g + L.tokens,
220
+ 0
221
+ ), e.tokens = e.diff.tokens;
222
+ const l = e.filename.match(/\.([^.]+)$/);
223
+ e.ext = l?.[1]?.toLowerCase() ?? "", e.category = B(
224
+ e.filename,
225
+ e.metadata
226
+ ), e.programmingLanguage = A(e.ext), n.push(e);
227
+ }
228
+ const i = t.match(/^diff --git a\/(.+?) b\/(.+)$/), o = i?.[1] ?? null;
229
+ e = {
230
+ isNew: !1,
231
+ isDeleted: !1,
232
+ isRenamed: !1,
233
+ filename: i?.[2] ?? null ?? "",
234
+ oldFilename: o ?? null,
235
+ newFileMode: null,
236
+ deletedFileMode: null,
237
+ diff: {
238
+ tokens: 0,
239
+ hunks: []
240
+ },
241
+ tokens: 0,
242
+ metadata: {},
243
+ ext: "",
244
+ category: "other",
245
+ programmingLanguage: void 0
246
+ }, a = null;
247
+ } else if (e && t.startsWith("new file mode")) {
248
+ const i = t.split(" ");
249
+ e.isNew = !0, e.newFileMode = i[3] ?? null, e.metadata.newFileMode = e.newFileMode;
250
+ } else if (e && t.startsWith("deleted file mode")) {
251
+ const i = t.split(" ");
252
+ e.isDeleted = !0, e.deletedFileMode = i[3] ?? null, e.metadata.deletedFileMode = e.deletedFileMode;
253
+ } else if (e && t.startsWith("old mode")) {
254
+ const i = t.split(" ");
255
+ e.metadata.oldMode = i[2] ?? null;
256
+ } else if (e && t.startsWith("new mode")) {
257
+ const i = t.split(" ");
258
+ e.metadata.newMode = i[2] ?? null;
259
+ } else if (e && t.startsWith("similarity index")) {
260
+ const i = t.split(" ");
261
+ e.metadata.similarityIndex = i[2] ?? null;
262
+ } else if (e && t.startsWith("rename from")) {
263
+ const i = t.substring(11).trim();
264
+ e.isRenamed = !0, e.oldFilename = i, e.metadata.renameFrom = i;
265
+ } else if (e && t.startsWith("rename to")) {
266
+ const i = t.substring(9).trim();
267
+ e.isRenamed = !0, e.filename = i, e.metadata.renameTo = i;
268
+ } else e && t.startsWith("index") ? e.metadata.index = t.substring(5).trim() : e && (t.startsWith("--- ") || t.startsWith("+++ ")) ? t.startsWith("--- ") ? e.metadata.oldFileMarker = t : e.metadata.newFileMarker = t : e && t.startsWith("@@") ? (a = {
269
+ header: t,
270
+ changes: [t],
271
+ tokens: _(t)
272
+ }, e.diff.hunks.push(a)) : a && (t.startsWith("+") || t.startsWith("-") || t.startsWith(" ")) ? (a.changes.push(t), a.tokens += _(t)) : e && (Array.isArray(e.metadata.extra) || (e.metadata.extra = []), e.metadata.extra.push(t));
273
+ }), e) {
274
+ const t = e, i = t.filename.match(/\.([^.]+)$/);
275
+ t.diff.tokens = t.diff.hunks.reduce(
276
+ (o, c) => o + c.tokens,
277
+ 0
278
+ ), t.tokens = t.diff.tokens, t.ext = i?.[1]?.toLowerCase() ?? "", t.category = B(t.filename, t.metadata), t.programmingLanguage = A(t.ext), n.push(t);
279
+ }
280
+ return n;
281
+ }, f = (r) => {
282
+ try {
283
+ return R(r, { encoding: "utf-8" });
284
+ } catch (s) {
285
+ return w.error("[execSyncSafe] [running → failed] Command failed", { cause: s }), "";
286
+ }
287
+ }, S = (r) => /\.(test|spec)s?\./.test(r), Z = () => f("git branch --list 2>/dev/null")?.match(/\s*\*?\s*(master|main)$/m)?.[1] ?? "master", we = () => f("git rev-parse --abbrev-ref HEAD 2>/dev/null").trim() || "HEAD", be = () => {
288
+ const s = (f("git config --get remote.origin.url 2>/dev/null").trim() || f("git remote get-url origin 2>/dev/null").trim() || "").trim();
289
+ if (!s) return null;
290
+ if (/^[a-z]+:\/\//i.test(s))
291
+ try {
292
+ const e = new URL(s), a = (e.hostname || "").toLowerCase(), t = (e.protocol || "").replace(/:$/, "").toLowerCase(), i = (e.pathname || "").replace(/^\/+/, "").replace(/\.git$/i, "");
293
+ return !a || !i ? null : { host: a, project: i, scheme: t };
294
+ } catch (e) {
295
+ w.debug("[getGitRemote] [parsing → skip] URL parse failed", { cause: e });
296
+ }
297
+ const n = s.match(/^[\w.-]+@([^:\/]+)[:\/](.+)$/);
298
+ if (n) {
299
+ const e = (n[1] || "").toLowerCase(), a = (n[2] || "").replace(/^\/+/, "").replace(/\.git$/i, ""), t = "ssh";
300
+ return !e || !a ? null : { host: e, project: a, scheme: t };
301
+ }
302
+ return null;
303
+ }, ee = () => {
304
+ try {
305
+ const r = f(`git rev-list --count HEAD ^${Z()} 2>/dev/null`);
306
+ return parseInt(r, 10) || 0;
307
+ } catch (r) {
308
+ return w.debug("[getGitCommitCount] [counting → fallback] Using 0", { cause: r }), 0;
309
+ }
310
+ }, te = (r) => f(r ? `git diff ${r}` : "git diff HEAD"), Ce = (r) => {
311
+ const s = te(r), n = Q(s).sort((o, c) => o.tokens - c.tokens), e = n.filter(
312
+ (o) => !o.isDeleted && !o.isRenamed && !S(o.filename) && (o.category === "config" || o.programmingLanguage)
313
+ );
314
+ e.length || e.push(
315
+ ...n.filter(
316
+ (o) => !o.isDeleted && !o.isRenamed && (o.category === "doc" || S(o.filename))
317
+ )
318
+ );
319
+ const a = e.reduce((o, c) => o + c.tokens, 0), t = e.at(-1)?.tokens ?? 0, i = [
320
+ ...new Set(e.map((o) => o.programmingLanguage).filter(Boolean))
321
+ ];
322
+ return {
323
+ diff: s,
324
+ parsedDiff: n,
325
+ parsedCodeDiff: e,
326
+ parsedCodeTokens: a,
327
+ parsedCodeChunkMaxTokens: t,
328
+ programmingLanguages: i,
329
+ commitCount: ee()
330
+ };
331
+ }, re = (r) => {
332
+ if (Array.isArray(r) && r.length === 2) {
333
+ const s = r[1];
334
+ if (s === null)
335
+ return r[0];
336
+ throw s instanceof Error ? s : new TypeError(`[UNGUARD_ERROR_TYPE] Error "${s}"`, { cause: s });
337
+ }
338
+ throw new SyntaxError(
339
+ "[UNGUARD_ERROR_SYNTAX] Invalid input: not a valid [result, error] tuple.",
340
+ { cause: r }
341
+ );
342
+ }, Ae = async (r) => {
343
+ const s = await r;
344
+ return re(s);
345
+ }, v = "</think>", _e = (r) => {
346
+ const s = String(r ?? "").split(v).slice(-1).join(v).trim();
347
+ return /^(Хорошо,|Okay,)/.test(s) ? s.split(`
348
+
349
+
350
+ `).slice(-1).join(`
351
+
352
+
353
+ `).trim() : s;
354
+ };
355
+ class E {
356
+ /** @purpose Default configuration filename. */
357
+ static DEFAULT_FILENAME = ".gennadyrc";
358
+ /**
359
+ * @purpose Create GennadyRc instances for current directory and HOME (lookup priority).
360
+ * @returns Array of two instances: [cwd, HOME].
361
+ * @sideEffect IO: file read at constructor.
362
+ */
363
+ static getDefaults() {
364
+ return [process.cwd(), process.env.HOME].map((s) => new E(s));
365
+ }
366
+ /** @purpose Full path to the loaded rc config file. */
367
+ _filename = "";
368
+ /** @purpose Parsed configuration data with model list. */
369
+ _data = {
370
+ models: []
371
+ };
372
+ /** @purpose Load/parse error if config is invalid, null otherwise. */
373
+ _error = null;
374
+ /**
375
+ * @purpose Load and parse Gennady RC config file from a directory.
376
+ * @param [dir] Directory to look for the rc file in (defaults to cwd).
377
+ * @param [name] Config filename (defaults to .gennadyrc).
378
+ */
379
+ constructor(s = process.cwd(), n = E.DEFAULT_FILENAME) {
380
+ this._filename = P(s, n);
381
+ try {
382
+ if (M(this._filename)) {
383
+ const e = JSON.parse($(this._filename).toString());
384
+ Array.isArray(e) ? this._data.models = e : e && typeof e == "object" && Array.isArray(e.models) ? this._data = {
385
+ ...this._data,
386
+ ...e
387
+ } : this._error = new Error(
388
+ `[GENNADY_RC_ERROR_CONFIG] Invalid "${this._filename}" config data`,
389
+ { cause: e }
390
+ );
391
+ }
392
+ } catch (e) {
393
+ this._error = new Error(`[GENNADY_RC_ERROR_PARSE] Read "${this._filename}" config failed`, {
394
+ cause: e
395
+ });
396
+ }
397
+ }
398
+ /**
399
+ * @purpose Check that configuration was successfully loaded and recognized.
400
+ * @returns true if no error; false on parse error or invalid data.
401
+ */
402
+ isValid() {
403
+ return !this._error;
404
+ }
405
+ /**
406
+ * @purpose Get list of models from loaded rc.
407
+ * @returns Array of RcModel (empty on error or missing file).
408
+ */
409
+ getModels() {
410
+ return this._data.models;
411
+ }
412
+ /**
413
+ * @purpose Get load/parse error if one occurred.
414
+ * @returns Error or null on successful load.
415
+ */
416
+ getError() {
417
+ return this._error;
418
+ }
419
+ }
420
+ function Be(r) {
421
+ const s = String(r).match(/<message[\s\S]*?>[\s\S]*?<\/message>/)?.[0];
422
+ if (!s)
423
+ return null;
424
+ const n = (o) => s.match(o)?.[1] ?? "", e = n(/type="([^"]+)"/), a = n(/icon="([^"]+)"/), t = n(/<subject>([\s\S]*?)<\/subject>/), i = n(/<description>([\s\S]*?)<\/description>/).replace(/\n\s+-/g, `
425
+ -`);
426
+ return {
427
+ type: e,
428
+ icon: a,
429
+ subject: t?.trim() || null,
430
+ description: i?.trim() || null
431
+ };
432
+ }
433
+ function x(r) {
434
+ return r ? String(r).replace(/[<>&'"]/g, (s) => {
435
+ switch (s) {
436
+ case "<":
437
+ return "&lt;";
438
+ case ">":
439
+ return "&gt;";
440
+ case "&":
441
+ return "&amp;";
442
+ case "'":
443
+ return "&apos;";
444
+ case '"':
445
+ return "&quot;";
446
+ default:
447
+ return s;
448
+ }
449
+ }) : "";
450
+ }
451
+ function N(r, s = 0) {
452
+ const n = " ".repeat(s), { tag: e, attrs: a, children: t } = r;
453
+ let i = "";
454
+ if (a && (i = Object.entries(a).filter(([, c]) => c != null).map(([c, l]) => ` ${c}="${x(String(l))}"`).join("")), t == null)
455
+ return `${n}<${e}${i} />`;
456
+ if (Array.isArray(t) && t.length === 0)
457
+ return `${n}<${e}${i} />`;
458
+ let o = "";
459
+ return Array.isArray(t) ? t.length > 0 && typeof t[0] == "string" ? o = t.map((l) => x(l)).join(`
460
+ `) : o = `
461
+ ` + t.map((l) => N(l, s + 1)).join(`
462
+ `) + `
463
+ ` + n : typeof t == "string" ? o = x(t) : "cdata" in t ? o = `<![CDATA[${String(t.cdata).replaceAll("]]>", "]]]]><![CDATA[>")}]]>` : o = `
464
+ ` + N(t, s + 1) + `
465
+ ` + n, `${n}<${e}${i}>${o}</${e}>`;
466
+ }
467
+ function Se(r) {
468
+ const s = [
469
+ "ai.knowledge.md",
470
+ "ai/ai.knowledge.md"
471
+ ], n = [];
472
+ for (const e of s) {
473
+ const a = m.join(r, e);
474
+ try {
475
+ u.existsSync(a) && u.statSync(a).isFile() && n.push(e);
476
+ } catch {
477
+ }
478
+ }
479
+ return n.length === 0 ? "" : `**MUST READ PROJECT KNOWLEDGE FILES**: ${n.join(", ")}.`;
480
+ }
481
+ const se = [
482
+ {
483
+ kind: "marker",
484
+ relativePath: "go.mod",
485
+ commands: ["go test ./...", "go vet ./...", "go fmt ./..."]
486
+ },
487
+ {
488
+ kind: "npm-package-json",
489
+ scriptGroups: [
490
+ {
491
+ preferredNames: [
492
+ "test",
493
+ "test:run",
494
+ "test:ci",
495
+ "test:app",
496
+ "mc:test",
497
+ "unit",
498
+ "jest",
499
+ "vitest"
500
+ ],
501
+ fallbackPatterns: [/(^|:)test($|:)/i, /(^|:)unit($|:)/i, /(^|:)spec($|:)/i]
502
+ },
503
+ {
504
+ preferredNames: ["lint:ci", "lint", "eslint", "stylelint", "format:check"],
505
+ fallbackPatterns: [/(^|:)(lint|eslint|stylelint)($|:)/i]
506
+ },
507
+ {
508
+ preferredNames: ["type-check", "typecheck", "check"],
509
+ fallbackPatterns: [/(^|:)(typecheck|type-check|check)($|:)/i]
510
+ }
511
+ ],
512
+ maxCommands: 5
513
+ },
514
+ {
515
+ kind: "marker",
516
+ relativePath: "Cargo.toml",
517
+ commands: ["cargo test", "cargo clippy"]
518
+ }
519
+ ];
520
+ function ne(r, s) {
521
+ const n = m.join(r, s);
522
+ try {
523
+ return u.existsSync(n) && u.statSync(n).isFile();
524
+ } catch {
525
+ return !1;
526
+ }
527
+ }
528
+ function ae(r, s) {
529
+ const n = r.toLowerCase(), e = s.toLowerCase();
530
+ return /(^|:|-)watch($|:|-)/i.test(n) ? !0 : [
531
+ /(^|\s)--watch(?:[=\s]|$)/i,
532
+ /(^|\s)--watchall(?:[=\s]|$)/i,
533
+ /(^|\s)watch(?:\s|$)/i,
534
+ /(^|\s)nodemon(?:\s|$)/i
535
+ ].some((t) => t.test(e));
536
+ }
537
+ function ie(r, s, n) {
538
+ const e = Object.entries(r).filter(
539
+ ([a, t]) => !n.has(a) && !ae(a, t)
540
+ );
541
+ for (const a of s.preferredNames)
542
+ if (e.some(([t]) => t === a))
543
+ return a;
544
+ for (const [a] of e)
545
+ if (s.fallbackPatterns.some((t) => t.test(a)))
546
+ return a;
547
+ return null;
548
+ }
549
+ function oe(r, s) {
550
+ const n = m.join(r, "package.json");
551
+ let e;
552
+ try {
553
+ if (!u.existsSync(n) || !u.statSync(n).isFile())
554
+ return null;
555
+ e = u.readFileSync(n, "utf-8");
556
+ } catch {
557
+ return null;
558
+ }
559
+ let a;
560
+ try {
561
+ a = JSON.parse(e);
562
+ } catch {
563
+ return null;
564
+ }
565
+ const t = a.scripts;
566
+ if (!t || typeof t != "object")
567
+ return null;
568
+ const i = [], o = /* @__PURE__ */ new Set();
569
+ for (const c of s.scriptGroups) {
570
+ const l = ie(t, c, o);
571
+ if (l && (i.push(`npm run ${l}`), o.add(l)), i.length >= s.maxCommands)
572
+ break;
573
+ }
574
+ return i.length === 0 ? null : i.slice(0, s.maxCommands);
575
+ }
576
+ function ce(r) {
577
+ for (const s of se) {
578
+ if (s.kind === "marker") {
579
+ if (ne(r, s.relativePath))
580
+ return [...s.commands];
581
+ continue;
582
+ }
583
+ if (s.kind === "npm-package-json") {
584
+ const n = oe(r, s);
585
+ if (n != null && n.length > 0)
586
+ return n;
587
+ }
588
+ }
589
+ return [];
590
+ }
591
+ function le(r) {
592
+ return r.map((s) => `\`${s}\``).join(", ");
593
+ }
594
+ function ve(r) {
595
+ const s = ce(r);
596
+ if (s.length === 0)
597
+ return {
598
+ axiomHint: "как в README или CI принято проверять код (тесты, линтер, типы). Не подменяй это тяжёлой production-сборкой или публикацией, если это явно не описано как проверка",
599
+ toolsExample: "команды из `package.json` → `scripts`, из Makefile или из CI-шагов, которые относятся к качеству кода; сначала прочитай README",
600
+ verifyStep: "Прочитай README и при наличии — конфиг CI: какие команды запускают тесты, линтер и проверку типов. Выполни их из корня репозитория. Не запускай `build`/`publish`/полный `ci`, если не уверен, что это нужно для проверки изменений; при сомнении спроси пользователя."
601
+ };
602
+ const n = le(s);
603
+ return {
604
+ axiomHint: `\`${s[0]}\` или следующую команду из того же набора проверок`,
605
+ toolsExample: n,
606
+ verifyStep: `Из корня репозитория выполни: ${n}. Не добавляй \`build\`, полный \`ci\` или публикацию, если они не перечислены здесь и не описаны в README как обязательная проверка.`
607
+ };
608
+ }
609
+ const y = "ai/agents";
610
+ function j(r) {
611
+ return u.existsSync(r) ? u.promises.readFile(r, "utf-8") : null;
612
+ }
613
+ function me(r) {
614
+ let s = r;
615
+ for (; ; ) {
616
+ const n = m.join(s, "package.json");
617
+ if (u.existsSync(n))
618
+ return s;
619
+ const e = m.dirname(s);
620
+ if (e === s)
621
+ return null;
622
+ s = e;
623
+ }
624
+ }
625
+ async function Ne(r) {
626
+ const s = m.dirname(T(import.meta.url)), n = m.join(process.cwd(), y, r), e = j(n);
627
+ if (e)
628
+ return e;
629
+ const a = me(s), t = [];
630
+ a ? (t.push(m.join(a, y, r)), t.push(m.join(a, "dist", y, r))) : t.push(
631
+ m.join(s, "../../../../../../dist", y, r)
632
+ );
633
+ for (const i of t) {
634
+ const o = j(i);
635
+ if (o)
636
+ return o;
637
+ }
638
+ throw new Error(`Не найден файл шаблона ${r}.`, {
639
+ cause: {
640
+ projectOverridePath: n,
641
+ packageCandidates: t
642
+ }
643
+ });
644
+ }
645
+ export {
646
+ E as G,
647
+ be as a,
648
+ we as b,
649
+ ye as c,
650
+ N as d,
651
+ f as e,
652
+ ve as f,
653
+ Ce as g,
654
+ Se as h,
655
+ A as i,
656
+ Ee as j,
657
+ Q as k,
658
+ Ne as l,
659
+ re as m,
660
+ xe as p,
661
+ _e as r,
662
+ ke as s,
663
+ Ae as u,
664
+ Be as x
665
+ };
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @purpose Загрузить agent-шаблон из проекта (override) или fallback из gennady.
2
+ * @purpose Load agent template from the project (override) or fallback from gennady.
3
+ * @param templateFilename XML file name in `ai/agents`.
4
+ * @returns XML template content.
3
5
  * @consumer render-review-verify.xml, render-resolve-conflicts.xml
4
- * @param templateFilename Имя XML-файла в `.ai/agents`.
5
- * @returns Содержимое XML-шаблона.
6
6
  */
7
7
  export declare function loadAgentTemplate(templateFilename: string): Promise<string>;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @purpose Сформировать подстановку `<!--ai:first-->` с обязательными knowledge-файлами проекта.
2
+ * @purpose Build `<!--ai:first-->` substitution with mandatory project knowledge files.
3
+ * @param projectRoot Repository root.
4
+ * @returns Empty string if knowledge files are not found; otherwise mandatory read text.
3
5
  * @consumer render-review-verify.xml, render-resolve-conflicts.xml
4
- * @param projectRoot Корень репозитория.
5
- * @returns Пустая строка, если knowledge-файлы не найдены; иначе текст обязательного чтения.
6
6
  */
7
7
  export declare function buildAiFirstKnowledgeBlock(projectRoot: string): string;