@mrciphersmith/keryx 0.2.9

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 (297) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +351 -0
  3. package/dist/cli.js +48427 -0
  4. package/dist/proxy-worker.js +381 -0
  5. package/package.json +63 -0
  6. package/src/gdgraph/affected.test.ts +100 -0
  7. package/src/gdgraph/affected.ts +135 -0
  8. package/src/gdgraph/build-integrity.test.ts +193 -0
  9. package/src/gdgraph/build-lang.test.ts +399 -0
  10. package/src/gdgraph/build.test.ts +120 -0
  11. package/src/gdgraph/build.ts +804 -0
  12. package/src/gdgraph/config.test.ts +47 -0
  13. package/src/gdgraph/config.ts +113 -0
  14. package/src/gdgraph/core-sources.test.ts +99 -0
  15. package/src/gdgraph/core-sources.ts +20 -0
  16. package/src/gdgraph/enrich.ts +79 -0
  17. package/src/gdgraph/fallback.test.ts +153 -0
  18. package/src/gdgraph/find.test.ts +78 -0
  19. package/src/gdgraph/find.ts +107 -0
  20. package/src/gdgraph/pagerank.ts +129 -0
  21. package/src/gdgraph/path.test.ts +56 -0
  22. package/src/gdgraph/path.ts +112 -0
  23. package/src/gdgraph/query.ts +133 -0
  24. package/src/gdgraph/repomap.test.ts +110 -0
  25. package/src/gdgraph/repomap.ts +193 -0
  26. package/src/gdgraph/service.test.ts +59 -0
  27. package/src/gdgraph/service.ts +51 -0
  28. package/src/gdgraph/staleness.ts +20 -0
  29. package/src/gdgraph/symbol.test.ts +89 -0
  30. package/src/gdgraph/symbol.ts +123 -0
  31. package/src/gdgraph/symbols-capability.test.ts +41 -0
  32. package/src/gdgraph/symbols-capability.ts +49 -0
  33. package/src/gdgraph/target.ts +56 -0
  34. package/src/gdgraph/treesitter/adapter.test.ts +249 -0
  35. package/src/gdgraph/treesitter/adapter.ts +213 -0
  36. package/src/gdgraph/treesitter/extract.test.ts +278 -0
  37. package/src/gdgraph/treesitter/extract.ts +389 -0
  38. package/src/gdgraph/treesitter/grammars.ts +110 -0
  39. package/src/gdgraph/treesitter/no-treesitter-import.test.ts +51 -0
  40. package/src/gdgraph/treesitter/resolve-calls.test.ts +38 -0
  41. package/src/gdgraph/types.ts +63 -0
  42. package/src/gdskills/bundled/rules/core/api-contracts.mdc +148 -0
  43. package/src/gdskills/bundled/rules/core/async-patterns.mdc +185 -0
  44. package/src/gdskills/bundled/rules/core/clean-architecture.mdc +163 -0
  45. package/src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc +49 -0
  46. package/src/gdskills/bundled/rules/core/code-review-b091-profile.mdc +48 -0
  47. package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +54 -0
  48. package/src/gdskills/bundled/rules/core/commit-message-formatting.mdc +25 -0
  49. package/src/gdskills/bundled/rules/core/database-patterns.mdc +162 -0
  50. package/src/gdskills/bundled/rules/core/documentation-management.mdc +106 -0
  51. package/src/gdskills/bundled/rules/core/error-handling.mdc +163 -0
  52. package/src/gdskills/bundled/rules/core/execution-metrics.md +99 -0
  53. package/src/gdskills/bundled/rules/core/frontend-assistant.mdc +40 -0
  54. package/src/gdskills/bundled/rules/core/git-rules.mdc +37 -0
  55. package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +198 -0
  56. package/src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc +149 -0
  57. package/src/gdskills/bundled/rules/core/implementation-plans.mdc +58 -0
  58. package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +221 -0
  59. package/src/gdskills/bundled/rules/core/mobx-store-template.mdc +561 -0
  60. package/src/gdskills/bundled/rules/core/model-selection.mdc +53 -0
  61. package/src/gdskills/bundled/rules/core/nestjs-dto.mdc +50 -0
  62. package/src/gdskills/bundled/rules/core/playwright-testing.mdc +321 -0
  63. package/src/gdskills/bundled/rules/core/requirements-management.mdc +35 -0
  64. package/src/gdskills/bundled/rules/core/requirements-package-standard.mdc +103 -0
  65. package/src/gdskills/bundled/rules/core/review-agent-profile.mdc +49 -0
  66. package/src/gdskills/bundled/rules/core/review-strict-profile.mdc +44 -0
  67. package/src/gdskills/bundled/rules/core/rule-management-workflow.mdc +62 -0
  68. package/src/gdskills/bundled/rules/core/security-baseline.mdc +155 -0
  69. package/src/gdskills/bundled/rules/core/shared-definitions.mdc +79 -0
  70. package/src/gdskills/bundled/rules/core/skill-lifecycle.mdc +55 -0
  71. package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +88 -0
  72. package/src/gdskills/bundled/rules/core/solid-principles.mdc +149 -0
  73. package/src/gdskills/bundled/rules/core/storybook-guidelines.mdc +36 -0
  74. package/src/gdskills/bundled/rules/core/subagent-context-construction.md +107 -0
  75. package/src/gdskills/bundled/rules/core/subagent-status-protocol.md +169 -0
  76. package/src/gdskills/bundled/rules/core/tdd-workflow.mdc +96 -0
  77. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.codex.md +47 -0
  78. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.cursor.md +55 -0
  79. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.md +352 -0
  80. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.opencode.md +39 -0
  81. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.zed.md +29 -0
  82. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.codex.md +567 -0
  83. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.cursor.md +567 -0
  84. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +655 -0
  85. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.opencode.md +567 -0
  86. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.zed.md +567 -0
  87. package/src/gdskills/bundled/skills/orchestration/context-collector/input-contract.schema.json +134 -0
  88. package/src/gdskills/bundled/skills/orchestration/context-collector/orchestrator-prompt.md +183 -0
  89. package/src/gdskills/bundled/skills/orchestration/context-collector/output-contract.schema.json +208 -0
  90. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.codex.md +1412 -0
  91. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.cursor.md +1412 -0
  92. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.detail.md +735 -0
  93. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +468 -0
  94. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.opencode.md +1412 -0
  95. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.zed.md +1412 -0
  96. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/analysis-request.md +62 -0
  97. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/analysis-request.template.md +79 -0
  98. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/input-contract.schema.json +247 -0
  99. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/orchestrator-prompt.md +362 -0
  100. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/output-contract.schema.json +87 -0
  101. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.codex.md +105 -0
  102. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.cursor.md +105 -0
  103. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +165 -0
  104. package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +379 -0
  105. package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/input-contract.schema.json +33 -0
  106. package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/output-contract.schema.json +41 -0
  107. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.codex.md +307 -0
  108. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.cursor.md +307 -0
  109. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.md +373 -0
  110. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.opencode.md +307 -0
  111. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.zed.md +307 -0
  112. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/input-contract.schema.json +130 -0
  113. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/issue-request.template.md +50 -0
  114. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/orchestrator-prompt.md +155 -0
  115. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/output-contract.schema.json +61 -0
  116. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.codex.md +365 -0
  117. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.cursor.md +365 -0
  118. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +373 -0
  119. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.opencode.md +365 -0
  120. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.zed.md +365 -0
  121. package/src/gdskills/bundled/skills/orchestration/job-documenter/input-contract.schema.json +55 -0
  122. package/src/gdskills/bundled/skills/orchestration/job-documenter/output-contract.schema.json +58 -0
  123. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.codex.md +1701 -0
  124. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.cursor.md +1701 -0
  125. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1734 -0
  126. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.opencode.md +1701 -0
  127. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.zed.md +1701 -0
  128. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/input-contract.schema.json +188 -0
  129. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/orchestrator-prompt.md +179 -0
  130. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/output-contract.schema.json +103 -0
  131. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/state.schema.json +164 -0
  132. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.codex.md +395 -0
  133. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.cursor.md +395 -0
  134. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +556 -0
  135. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.opencode.md +395 -0
  136. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.zed.md +395 -0
  137. package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +204 -0
  138. package/src/gdskills/bundled/skills/orchestration/task-implementer/orchestrator-prompt.md +206 -0
  139. package/src/gdskills/bundled/skills/orchestration/task-implementer/output-contract.schema.json +51 -0
  140. package/src/gdskills/bundled/skills/orchestration/task-implementer/task-request.template.md +111 -0
  141. package/src/gdskills/bundled/skills/planning/autodoc-analyst/SKILL.md +163 -0
  142. package/src/gdskills/bundled/skills/planning/autodoc-architect/SKILL.md +161 -0
  143. package/src/gdskills/bundled/skills/planning/autodoc-assembler/SKILL.md +128 -0
  144. package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +321 -0
  145. package/src/gdskills/bundled/skills/planning/autodoc-scanner/SKILL.md +166 -0
  146. package/src/gdskills/bundled/skills/planning/autodoc-writer/SKILL.md +253 -0
  147. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.claude.md +46 -0
  148. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.codex.md +90 -0
  149. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.cursor.md +90 -0
  150. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +90 -0
  151. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +33 -0
  152. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +33 -0
  153. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +190 -0
  154. package/src/gdskills/bundled/skills/planning/docpack-orchestrator/SKILL.md +142 -0
  155. package/src/gdskills/bundled/skills/planning/docpack-orchestrator/input-contract.schema.json +31 -0
  156. package/src/gdskills/bundled/skills/planning/docpack-orchestrator/output-contract.schema.json +31 -0
  157. package/src/gdskills/bundled/skills/planning/docpack-review/SKILL.md +80 -0
  158. package/src/gdskills/bundled/skills/planning/docpack-review/input-contract.schema.json +20 -0
  159. package/src/gdskills/bundled/skills/planning/docpack-review/output-contract.schema.json +36 -0
  160. package/src/gdskills/bundled/skills/planning/interview/SKILL.codex.md +181 -0
  161. package/src/gdskills/bundled/skills/planning/interview/SKILL.cursor.md +181 -0
  162. package/src/gdskills/bundled/skills/planning/interview/SKILL.md +187 -0
  163. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.claude.md +94 -0
  164. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.codex.md +99 -0
  165. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.cursor.md +99 -0
  166. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +105 -0
  167. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +33 -0
  168. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +33 -0
  169. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +237 -0
  170. package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +33 -0
  171. package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +33 -0
  172. package/src/gdskills/bundled/skills/planning/planner/SKILL.md +190 -0
  173. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.codex.md +193 -0
  174. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.cursor.md +193 -0
  175. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.md +193 -0
  176. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.opencode.md +193 -0
  177. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.zed.md +193 -0
  178. package/src/gdskills/bundled/skills/planning/prd-creator/input-contract.schema.json +63 -0
  179. package/src/gdskills/bundled/skills/planning/prd-creator/output-contract.schema.json +175 -0
  180. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +31 -0
  181. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +31 -0
  182. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +153 -0
  183. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +32 -0
  184. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +32 -0
  185. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +166 -0
  186. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +44 -0
  187. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +44 -0
  188. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +243 -0
  189. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +43 -0
  190. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +43 -0
  191. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +193 -0
  192. package/src/gdskills/bundled/skills/platform/agent-entrypoint-distiller/SKILL.md +47 -0
  193. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.codex.md +87 -0
  194. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.cursor.md +87 -0
  195. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.md +87 -0
  196. package/src/gdskills/bundled/skills/platform/hookify/SKILL.codex.md +100 -0
  197. package/src/gdskills/bundled/skills/platform/hookify/SKILL.cursor.md +100 -0
  198. package/src/gdskills/bundled/skills/platform/hookify/SKILL.md +100 -0
  199. package/src/gdskills/bundled/skills/quality/changelog/SKILL.claude.md +45 -0
  200. package/src/gdskills/bundled/skills/quality/changelog/SKILL.codex.md +84 -0
  201. package/src/gdskills/bundled/skills/quality/changelog/SKILL.cursor.md +84 -0
  202. package/src/gdskills/bundled/skills/quality/changelog/SKILL.md +84 -0
  203. package/src/gdskills/bundled/skills/quality/commit/SKILL.codex.md +66 -0
  204. package/src/gdskills/bundled/skills/quality/commit/SKILL.cursor.md +66 -0
  205. package/src/gdskills/bundled/skills/quality/commit/SKILL.md +66 -0
  206. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.claude.md +40 -0
  207. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.codex.md +66 -0
  208. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.cursor.md +66 -0
  209. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.md +66 -0
  210. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.claude.md +45 -0
  211. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.codex.md +81 -0
  212. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.cursor.md +81 -0
  213. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.md +81 -0
  214. package/src/gdskills/bundled/skills/quality/deploy/SKILL.claude.md +42 -0
  215. package/src/gdskills/bundled/skills/quality/deploy/SKILL.codex.md +70 -0
  216. package/src/gdskills/bundled/skills/quality/deploy/SKILL.cursor.md +70 -0
  217. package/src/gdskills/bundled/skills/quality/deploy/SKILL.md +70 -0
  218. package/src/gdskills/bundled/skills/quality/metaproject-security/SKILL.md +103 -0
  219. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.claude.md +48 -0
  220. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.codex.md +83 -0
  221. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.cursor.md +83 -0
  222. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.md +83 -0
  223. package/src/gdskills/bundled/skills/quality/pr/SKILL.codex.md +75 -0
  224. package/src/gdskills/bundled/skills/quality/pr/SKILL.cursor.md +75 -0
  225. package/src/gdskills/bundled/skills/quality/pr/SKILL.md +75 -0
  226. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.codex.md +364 -0
  227. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.cursor.md +295 -0
  228. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +378 -0
  229. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.opencode.md +364 -0
  230. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.zed.md +38 -0
  231. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/input-contract.schema.json +53 -0
  232. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/output-contract.schema.json +46 -0
  233. package/src/gdskills/bundled/skills/quality/push/SKILL.codex.md +52 -0
  234. package/src/gdskills/bundled/skills/quality/push/SKILL.cursor.md +52 -0
  235. package/src/gdskills/bundled/skills/quality/push/SKILL.md +52 -0
  236. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.claude.md +40 -0
  237. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.codex.md +61 -0
  238. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.cursor.md +61 -0
  239. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.md +61 -0
  240. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.claude.md +30 -0
  241. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.codex.md +75 -0
  242. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.cursor.md +75 -0
  243. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.md +75 -0
  244. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.codex.md +64 -0
  245. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.cursor.md +74 -0
  246. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +339 -0
  247. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.opencode.md +48 -0
  248. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.zed.md +44 -0
  249. package/src/gdskills/bundled/skills/quality/tests-creator/input-contract.schema.json +121 -0
  250. package/src/gdskills/bundled/skills/quality/tests-creator/output-contract.schema.json +127 -0
  251. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.codex.md +204 -0
  252. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.cursor.md +204 -0
  253. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +203 -0
  254. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.opencode.md +204 -0
  255. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.zed.md +204 -0
  256. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.codex.md +209 -0
  257. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.cursor.md +209 -0
  258. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.md +208 -0
  259. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.opencode.md +209 -0
  260. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.zed.md +209 -0
  261. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.codex.md +263 -0
  262. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.cursor.md +263 -0
  263. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +258 -0
  264. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.opencode.md +263 -0
  265. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.zed.md +263 -0
  266. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.codex.md +175 -0
  267. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.cursor.md +175 -0
  268. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +168 -0
  269. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.opencode.md +175 -0
  270. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.zed.md +175 -0
  271. package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +360 -0
  272. package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +337 -0
  273. package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +477 -0
  274. package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +93 -0
  275. package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +119 -0
  276. package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +595 -0
  277. package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +144 -0
  278. package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +519 -0
  279. package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +323 -0
  280. package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +927 -0
  281. package/src/gdskills/bundled/skills/review/review-orchestrator/input-contract.schema.json +153 -0
  282. package/src/gdskills/bundled/skills/review/review-orchestrator/output-contract.schema.json +77 -0
  283. package/src/gdskills/bundled/skills/review/review-orchestrator/review-context.schema.json +389 -0
  284. package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +189 -0
  285. package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-input.schema.json +241 -0
  286. package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +344 -0
  287. package/src/gdskills/bundled/skills/review/review-pr-feedback/SKILL.md +327 -0
  288. package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +348 -0
  289. package/src/gdskills/bundled/skills/review/review-strict/SKILL.md +328 -0
  290. package/src/gdskills/bundled/skills/review/review-style/SKILL.md +343 -0
  291. package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +134 -0
  292. package/src/gdskills/bundled/skills/shared/git-merge-base.md +33 -0
  293. package/src/gdskills/contracts/agent-event.schema.json +32 -0
  294. package/src/gdskills/contracts/orchestrator-state.schema.json +58 -0
  295. package/src/gdskills/contracts/review-finding.schema.json +59 -0
  296. package/src/gdskills/contracts/subagent-dispatch.schema.json +123 -0
  297. package/src/gdskills/contracts/subagent-result.schema.json +136 -0
@@ -0,0 +1,1412 @@
1
+ ---
2
+ name: feature-analyzer
3
+ description: "Deep cross-repository analysis of feature branches: requires explicit context gathering from user (source/target repos, branch), git diff analysis, mandatory Deep Dive with code examples, API contract analysis, and structured documentation. Use when: analyzing branch changes across repos, planning feature implementation, understanding backend→frontend contracts. NEVER start analysis without explicit user confirmation of source, target, and branch."
4
+ triggers:
5
+ - "Analyze branch"
6
+ - "Analyze changes"
7
+ - "Analyze commit"
8
+ - "Study changes"
9
+ - "Cross-repo analysis"
10
+ - "Backend to frontend analysis"
11
+ - "Feature analyzer"
12
+ metadata:
13
+ author: "MrCipherSmith"
14
+ version: "2.4.0"
15
+ category: "analysis"
16
+ license: "MIT"
17
+ compatibility: "cursor,codex,zed,opencode"
18
+ ---
19
+
20
+ # Feature Analyzer
21
+
22
+ ## ⚠️ MANDATORY: DO NOT PROCEED WITHOUT CONTEXT
23
+
24
+ **CRITICAL RULE: You CANNOT start analysis until user explicitly provides:**
25
+ 1. ✅ Source repository (local path)
26
+ 2. ✅ Target repository (local path)
27
+ 3. ✅ Branch to analyze
28
+ 4. ✅ Confirmation of analysis scope
29
+
30
+ **DO NOT assume defaults. DO NOT use current directory. DO NOT proceed without asking.**
31
+
32
+ **If user says:** "Analyze everything related to variables in pipelines"
33
+
34
+ **You MUST respond:**
35
+ ```
36
+ I'll help you analyze variables in pipelines. First, I need to clarify the context:
37
+
38
+ **SOURCE Repository** (where the changes exist):
39
+ - Local path: [user must provide, e.g., /Users/.../<PROJECT>]
40
+ - GitHub repo: [owner/repo]
41
+ - Branch to analyze: [branch-name]
42
+
43
+ **TARGET Repository** (where implementation will happen):
44
+ - Local path: [user must provide, e.g., /Users/.../<PROJECT>]
45
+ - GitHub repo: [owner/repo]
46
+ - Current branch: [branch-name]
47
+
48
+ **FOCUS** (from your request): "variables in pipelines"
49
+ - Keywords: variable, pipeline, param
50
+
51
+ Once you provide these details, I'll begin the focused analysis.
52
+ ```
53
+
54
+ **If user doesn't provide all required info → STOP and ask again.**
55
+
56
+ ---
57
+
58
+ ## Purpose
59
+
60
+ Performs deep cross-repository analysis to understand business logic, architecture, API contracts, and implementation requirements. Generates structured documentation for both human developers and AI agents.
61
+
62
+ **Two Analysis Modes:**
63
+
64
+ **Mode A - Changes Analysis** (when base-branch provided):
65
+ - Analyze what changed FROM base-branch TO current branch
66
+ - Shows: additions, modifications, deletions
67
+ - Use for: reviewing PRs, understanding feature implementation
68
+
69
+ **Mode B - Current State Analysis** (when NO base-branch provided):
70
+ - Analyze ENTIRE codebase as it exists NOW
71
+ - Shows: existing functionality, architecture, patterns
72
+ - Use for: understanding system, formalizing features, exploring codebase
73
+
74
+ **Key Capabilities:**
75
+ - Cross-repository analysis (Source → Target)
76
+ - API contract validation (DTOs, interfaces)
77
+ - Business logic extraction and formalization
78
+ - Implementation planning
79
+ - Multi-language documentation (EN for AI agents, EN/RU for humans)
80
+ - Focus-based prioritization (e.g., "variables in pipelines")
81
+
82
+ ## When to Use
83
+
84
+ ### Mode A: Changes Analysis (provide base-branch)
85
+ - "Analyze feature branch changes from main"
86
+ - "Review what changed in this PR"
87
+ - "Compare feature-x with develop branch"
88
+ - Understanding backend API changes for frontend implementation
89
+ - Planning feature implementation based on changes
90
+
91
+ ### Mode B: Current State Analysis (no base-branch)
92
+ - "Analyze everything related to variables in pipelines" (explore current system)
93
+ - "How does authentication work in this codebase?"
94
+ - "Document the pipeline execution flow"
95
+ - "Formalize the user management feature"
96
+ - Understanding existing system architecture
97
+ - Creating feature specification from existing code
98
+
99
+ ### Examples by Mode
100
+
101
+ **Mode A Examples (with base-branch):**
102
+ - "Analyze branch feature/auth-v2 from main" → Changes Analysis
103
+ - "Review changes in PR #123 against develop" → Changes Analysis
104
+ - "What changed in DTOs since last release?" → Changes Analysis
105
+
106
+ **Mode B Examples (without base-branch):**
107
+ - "Analyze variables in pipelines" → Current State Analysis
108
+ - "How does error handling work?" → Current State Analysis
109
+ - "Document the caching mechanism" → Current State Analysis
110
+ - "Explain the user workflow" → Current State Analysis
111
+
112
+ ## User-Specified Analysis Focus (Optional but Recommended)
113
+
114
+ User can request **targeted analysis** with specific focus:
115
+
116
+ **Examples:**
117
+ - "Analyze everything related to **variables in pipelines**"
118
+ - "Focus on **authentication changes** in this branch"
119
+ - "Find all changes related to **DTO validations**"
120
+ - "Analyze **performance optimizations** specifically"
121
+ - "Focus on **error handling** modifications"
122
+
123
+ ### Focus Keywords Priority System
124
+
125
+ When user specifies focus, adjust priorities:
126
+
127
+ **Priority Boost Rules:**
128
+ - Files matching focus keywords → **Boost to P0** (even if normally P1/P2)
129
+ - Files referencing focus entities → **+1 priority level**
130
+ - Files in relevant directories → **+1 priority level**
131
+
132
+ **Example:** Focus = "variables in pipelines"
133
+ ```
134
+ Files containing "variable" in path or content:
135
+ - src/pipelines/variable-resolver.ts → P0 (boosted from P1)
136
+ - src/models/pipeline-variable.dto.ts → P0 (already P0)
137
+ - src/components/variable-input.tsx → P0 (boosted from P2)
138
+
139
+ Files in pipelines directory:
140
+ - src/pipelines/pipeline-runner.ts → P1 (context, +1 priority)
141
+ ```
142
+
143
+ ### Search Strategy for Focus Areas
144
+
145
+ **Step 1: Keyword Extraction**
146
+ Extract key terms from user request:
147
+ - Main concept: "variables"
148
+ - Context: "pipelines"
149
+ - Action: "analyze"
150
+
151
+ **Step 2: Multi-Scope Search**
152
+ Search across entire codebase (not just changed files):
153
+
154
+ ```bash
155
+ # Search in changed files first
156
+ git diff --name-only | xargs grep -l "variable" 2>/dev/null
157
+
158
+ # Search in broader codebase for context
159
+ grep -r "variable" --include="*.ts" --include="*.tsx" src/pipelines/ | head -20
160
+
161
+ # Search related terms
162
+ grep -ri "var\|param\|arg\|input" --include="*.ts" src/pipelines/ | head -20
163
+ ```
164
+
165
+ **Step 3: Relationship Mapping**
166
+ Identify related components:
167
+ - What uses variables? → PipelineRunner, PipelineBuilder
168
+ - What defines variables? → VariableService, VariableDTO
169
+ - Where are variables stored? → VariableStore, PipelineContext
170
+
171
+ **Step 4: Cross-Reference Analysis**
172
+ Check target repository for:
173
+ - Files importing Variable-related types
174
+ - Components using pipeline variables
175
+ - Tests covering variable functionality
176
+
177
+ ### Focus-Based File Prioritization Algorithm
178
+
179
+ ```
180
+ Standard Priority + Focus Boost = Final Priority
181
+
182
+ For each changed file:
183
+ 1. Assign base priority (P0/P1/P2)
184
+ 2. IF file matches focus keywords → Boost to P0
185
+ 3. IF file references focus entities → +1 level
186
+ 4. IF file in focus directory → +1 level
187
+ 5. IF file is dependency of focus files → Keep base priority
188
+ 6. ELSE → Standard priority
189
+
190
+ Select top 7 files by final priority
191
+ ```
192
+
193
+ ### Focus Analysis Workflow Adjustment
194
+
195
+ Add to workflow:
196
+ ```
197
+ Analysis Progress:
198
+ ...
199
+ □ Step 4.5: Apply focus filter and boost priorities
200
+ □ Step 5.5: Search broader codebase for focus context
201
+ □ Step 6.5: Map relationships between focus entities
202
+ ...
203
+ ```
204
+
205
+ ## Workflow
206
+
207
+ Copy this checklist and track progress based on your Analysis Mode:
208
+
209
+ ### Mode A: Changes Analysis (with base-branch)
210
+
211
+ Use when analyzing what changed FROM base-branch TO current branch.
212
+
213
+ ```
214
+ Analysis Progress - Mode A (Changes):
215
+ 🚫 PRE-STEP: VALIDATE CONTEXT
216
+ □ Source repository path: _____________
217
+ □ Target repository path: _____________
218
+ □ Branch to analyze: _____________
219
+ □ Base branch provided: _____________ (e.g., "main")
220
+ □ Analysis Mode: A (Changes)
221
+ □ User explicitly confirmed: _____________
222
+ □ Step 1: Gather context (source, target, branch, base-branch, focus)
223
+ □ Step 1.5: Parse focus keywords (if focus specified)
224
+ □ Step 2: Verify GitHub MCP availability
225
+ □ Step 3: Analyze GitHub issue/PR (if provided)
226
+ □ Step 4: Calculate BASE_SHA from merge-base (last branching point)
227
+ □ Step 5: Collect git changes (git diff BASE_SHA..HEAD)
228
+ □ Step 6: Categorize changed files: P0/P1/P2
229
+ □ Step 6.5: Apply focus-based priority boost
230
+ □ Step 7: Select 3-7 key files from CHANGED files
231
+ □ Step 8: Deep Dive - read changed files
232
+ □ Step 9: Analyze related tests
233
+ □ Step 10: Check rules compliance
234
+ □ Step 11: Cross-repo dependency analysis
235
+ □ Step 12: UI analysis (if applicable)
236
+ □ Step 13: Intermediate review
237
+ □ Step 14: Generate documentation
238
+ □ Step 15: Final review and delivery
239
+ ```
240
+
241
+ ### Mode B: Current State Analysis (without base-branch)
242
+
243
+ Use when analyzing ENTIRE codebase to understand existing functionality.
244
+
245
+ ```
246
+ Analysis Progress - Mode B (Current State):
247
+ 🚫 PRE-STEP: VALIDATE CONTEXT
248
+ □ Source repository path: _____________
249
+ □ Target repository path: _____________
250
+ □ Branch to analyze: _____________
251
+ □ Base branch: NOT PROVIDED (Mode B)
252
+ □ Analysis Mode: B (Current State)
253
+ □ User explicitly confirmed: _____________
254
+ □ Step 1: Gather context (source, target, branch, focus)
255
+ □ Step 1.5: Parse focus keywords (if focus specified)
256
+ □ Step 2: Verify GitHub MCP availability
257
+ □ Step 3: Analyze GitHub issue/PR (if provided)
258
+ □ Step 4: SKIP (no base-branch comparison)
259
+ □ Step 5: Search ENTIRE codebase for focus-related files
260
+ □ Step 6: Discover and categorize ALL relevant files: P0/P1/P2
261
+ □ Step 6.5: Apply focus-based priority boost
262
+ □ Step 7: Select 3-10 key files from ENTIRE codebase
263
+ □ Step 8: Deep Dive - read files to understand functionality
264
+ □ Step 8.5: FORMALIZE functionality (document what exists)
265
+ - Business logic
266
+ - API contracts
267
+ - State management
268
+ - Data flow
269
+ - Integration points
270
+ □ Step 9: Analyze tests (understand coverage)
271
+ □ Step 10: Check rules compliance
272
+ □ Step 11: Cross-repo dependency analysis (find usages)
273
+ □ Step 12: UI analysis (if applicable)
274
+ □ Step 13: Intermediate review with formalization
275
+ □ Step 14: Generate documentation (Feature Specification)
276
+ □ Step 15: Final review and delivery
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Mode B: Feature Formalization (Current State Analysis)
282
+
283
+ When user does NOT provide base-branch, you must **formalize existing functionality** instead of analyzing changes.
284
+
285
+ ### What is Feature Formalization?
286
+
287
+ **Purpose**: Create comprehensive specification of existing functionality as it works RIGHT NOW.
288
+
289
+ **Difference from Changes Analysis**:
290
+ - **Changes Analysis**: "What changed from version A to version B?"
291
+ - **Feature Formalization**: "How does this functionality work in the current codebase?"
292
+
293
+ ### Formalization Checklist
294
+
295
+ For each analyzed component, document:
296
+
297
+ ```
298
+ COMPONENT FORMALIZATION TEMPLATE:
299
+
300
+ 1. PURPOSE
301
+ - What business problem does this solve?
302
+ - Who are the users?
303
+ - When is it used?
304
+
305
+ 2. API CONTRACT (if applicable)
306
+ - Input parameters
307
+ - Return types
308
+ - Error responses
309
+ - Authentication/authorization requirements
310
+
311
+ 3. BUSINESS LOGIC
312
+ - Core algorithms
313
+ - Validation rules
314
+ - Business constraints
315
+ - Decision trees
316
+
317
+ 4. STATE MANAGEMENT
318
+ - What state is maintained?
319
+ - Where is it stored?
320
+ - How is it updated?
321
+ - Lifecycle of state
322
+
323
+ 5. DATA FLOW
324
+ - Input sources
325
+ - Processing steps
326
+ - Output destinations
327
+ - Side effects
328
+
329
+ 6. INTEGRATION POINTS
330
+ - External services called
331
+ - Events published/consumed
332
+ - Database interactions
333
+ - File system operations
334
+
335
+ 7. ERROR HANDLING
336
+ - Expected error scenarios
337
+ - Recovery mechanisms
338
+ - Fallback behavior
339
+
340
+ 8. EDGE CASES
341
+ - Boundary conditions
342
+ - Empty/null handling
343
+ - Concurrency issues
344
+ - Performance constraints
345
+
346
+ 9. TESTING
347
+ - Test coverage
348
+ - Critical test scenarios
349
+ - Manual testing steps
350
+
351
+ 10. USAGE EXAMPLES
352
+ - Code examples
353
+ - Common patterns
354
+ - Anti-patterns to avoid
355
+ ```
356
+
357
+ ### Search Strategy for Mode B
358
+
359
+ When no base-branch provided, search ENTIRE codebase:
360
+
361
+ ```bash
362
+ # 1. Find all files related to focus keywords
363
+ grep -r "focus_keyword" --include="*.ts" --include="*.tsx" src/ | head -50
364
+
365
+ # 2. Find files in relevant directories
366
+ find src/path -type f \( -name "*.ts" -o -name "*.tsx" \) | head -30
367
+
368
+ # 3. Find entity definitions
369
+ # (classes, interfaces, types matching focus)
370
+ grep -l "class Focus\|interface Focus\|type Focus" --include="*.ts" src/
371
+
372
+ # 4. Find consumers (what uses these entities)
373
+ grep -l "import.*Focus\|from.*focus" --include="*.ts" src/
374
+
375
+ # 5. Find tests related to focus
376
+ grep -r "focus_keyword" --include="*.spec.ts" --include="*.test.ts" src/
377
+ ```
378
+
379
+ ### Output for Mode B
380
+
381
+ Generate **Feature Specification Document** instead of Change Analysis:
382
+
383
+ ```
384
+ <DOCS_ROOT>/analysis/<feature>-current-state-<date>/
385
+ ├── README.md
386
+ ├── specification/
387
+ │ ├── en/
388
+ │ │ └── feature-specification.md # Human-readable spec
389
+ │ ├── ru/
390
+ │ │ └── feature-specification.md # Human-readable spec (RU)
391
+ │ └── ai/
392
+ │ └── feature-specification.md # Gherkin format
393
+ ├── architecture/
394
+ │ ├── data-flow.md # Data flow diagrams
395
+ │ ├── component-diagram.md # Component relationships
396
+ │ └── api-contracts.md # API specifications
397
+ ├── usage/
398
+ │ ├── examples.md # Code examples
399
+ │ └── patterns.md # Common patterns
400
+ └── tests/
401
+ └── test-coverage.md # Testing documentation
402
+ ```
403
+
404
+ ---
405
+
406
+ ## Timeouts and Limits (CRITICAL)
407
+
408
+ **Analysis must be time-boxed to prevent excessive duration.**
409
+
410
+ ### Default Timeouts
411
+
412
+ | Phase | Max Duration | Action on Timeout |
413
+ |-------|-------------|-------------------|
414
+ | GitHub MCP verification | 30 seconds | Ask user to restart or skip |
415
+ | Git history analysis | 2 minutes | Proceed with limited history |
416
+ | Single file reading | 30 seconds per file | Skip and mark as "partial" |
417
+ | Cross-repo dependency search | 3 minutes | Provide partial results |
418
+ | Documentation generation | 5 minutes | Generate minimal report |
419
+ | **Total analysis** | **30 minutes** | Force intermediate review |
420
+
421
+ ### Timeout Handling Strategy
422
+
423
+ **When approaching timeout:**
424
+ 1. Notify user: "Analysis approaching 30-minute limit"
425
+ 2. Show current progress and what remains
426
+ 3. Offer options:
427
+ - **Continue**: Extend timeout by 15 minutes
428
+ - **Split**: Break into multiple smaller analyses
429
+ - **Partial**: Generate report with current findings
430
+ - **Prioritize**: Focus only on P0 files
431
+
432
+ ### File Count Limits
433
+
434
+ **Automatic scope reduction when limits exceeded:**
435
+
436
+ | Total Changed Files | Action |
437
+ |-------------------|---------|
438
+ | 1-10 files | Analyze all P0, selected P1 |
439
+ | 11-30 files | Analyze P0 only (up to 10) |
440
+ | 31-50 files | Top 7 P0 files only |
441
+ | 50+ files | **STOP** — ask user to narrow scope |
442
+
443
+ **When 50+ files detected:**
444
+ ```
445
+ ⚠️ LARGE CHANGESET DETECTED
446
+
447
+ Found [N] changed files. This is too large for effective analysis.
448
+
449
+ Options:
450
+ 1. Analyze specific directory: [suggest paths]
451
+ 2. Analyze specific file types: [API files only]
452
+ 3. Split by commits: analyze first [N] commits
453
+ 4. Manual selection: user specifies which files
454
+
455
+ Recommended: Option [suggested]
456
+ ```
457
+
458
+ ### Progress Monitoring
459
+
460
+ **Every 10 minutes, provide status update:**
461
+ ```
462
+ ⏱️ Time elapsed: [X] minutes
463
+ 📊 Progress:
464
+ - Phase: [current phase]
465
+ - Files analyzed: [N]/[total]
466
+ - P0: [N] complete
467
+ - P1: [N] complete
468
+ ⏰ Estimated remaining: [X] minutes
469
+ ```
470
+
471
+ ---
472
+
473
+ ## Cache and Existing Reports Check (Step 0.1)
474
+
475
+ **Before starting analysis, check for existing reports to avoid duplication.**
476
+
477
+ ### Cache Lookup
478
+
479
+ ```bash
480
+ # Check if analysis already exists for this branch
481
+ git_branch="$(git rev-parse --abbrev-ref HEAD)"
482
+ git_sha="$(git rev-parse HEAD)"
483
+ analysis_dir="<DOCS_ROOT>/analysis/${git_branch}-*"
484
+
485
+ # Look for recent analysis (within last 7 days)
486
+ find <DOCS_ROOT>/analysis/ -name "*.md" -mtime -7 | grep "${git_branch}"
487
+ ```
488
+
489
+ ### Existing Report Detection
490
+
491
+ **If recent analysis found, ask user:**
492
+
493
+ ```
494
+ 🔍 EXISTING ANALYSIS DETECTED
495
+
496
+ Found existing analysis for branch [branch-name]:
497
+ - Date: [creation date]
498
+ - Path: [path/to/analysis]
499
+ - Coverage: [N files analyzed]
500
+ - Completeness: [full/partial]
501
+
502
+ Options:
503
+ 1. ⏩ Use existing (skip new analysis)
504
+ 2. 🔄 Refresh (update with latest changes)
505
+ 3. 📊 Compare (show diff between existing and current)
506
+ 4. 🆕 New analysis (ignore existing, start fresh)
507
+ 5. 🗑️ Archive old & create new
508
+
509
+ Recommended: [suggested option based on age and changes]
510
+ ```
511
+
512
+ ### Cache Invalidation Rules
513
+
514
+ **Always create new analysis when:**
515
+ - [ ] Branch has new commits since last analysis
516
+ - [ ] BASE_SHA changed (rebased branch)
517
+ - [ ] User explicitly requests fresh analysis
518
+ - [ ] Existing analysis older than 7 days
519
+ - [ ] Existing analysis marked as "partial" or "incomplete"
520
+
521
+ **Can reuse existing when:**
522
+ - [x] Same commit SHA
523
+ - [x] Same BASE_SHA
524
+ - [x] Analysis complete and recent (< 7 days)
525
+ - [x] User confirms no significant changes
526
+
527
+ ### Incremental Analysis
528
+
529
+ **If refreshing existing analysis:**
530
+
531
+ 1. Load previous analysis metadata
532
+ 2. Identify new commits since last analysis: `git log ${LAST_SHA}..HEAD`
533
+ 3. Analyze only new/changed files
534
+ 4. Merge findings with previous report
535
+ 5. Update timestamps and version
536
+
537
+ ```
538
+ 🔄 INCREMENTAL UPDATE MODE
539
+
540
+ Previous analysis: [date]
541
+ New commits since then: [N]
542
+ Files changed in new commits: [N]
543
+
544
+ Analyzing only new changes...
545
+ ```
546
+
547
+ ### Cache Storage
548
+
549
+ **Metadata file for caching:** `<DOCS_ROOT>/analysis/.cache/index.json`
550
+
551
+ ```json
552
+ {
553
+ "analyses": [
554
+ {
555
+ "branch": "feature-name",
556
+ "sha": "abc123",
557
+ "base_sha": "def456",
558
+ "path": "feature-name-2024-01-15",
559
+ "created_at": "2024-01-15T10:00:00Z",
560
+ "updated_at": "2024-01-15T10:00:00Z",
561
+ "status": "complete",
562
+ "files_analyzed": 12,
563
+ "coverage": "full"
564
+ }
565
+ ]
566
+ }
567
+ ```
568
+
569
+ ---
570
+
571
+ ## Step 0: Context Gathering (MANDATORY)
572
+
573
+ **CRITICAL**: User MUST specify both Source and Target repositories.
574
+
575
+ ### Analysis Mode Selection (CRITICAL)
576
+
577
+ User can choose between **two analysis modes**:
578
+
579
+ **Mode A: Changes Analysis** (with base-branch)
580
+ - Analyze changes FROM base-branch TO current branch
581
+ - Shows what changed, what was added/removed/modified
582
+ - Use when: reviewing feature implementation, checking PR changes
583
+
584
+ **Mode B: Current State Analysis** (without base-branch)
585
+ - Analyze ENTIRE codebase as it exists NOW
586
+ - Shows current functionality, architecture, patterns
587
+ - Use when: understanding existing system, formalizing features, exploring codebase
588
+
589
+ If user doesn't specify base-branch, default to **Mode B**.
590
+
591
+ ---
592
+
593
+ ### Context Questions
594
+
595
+ Ask in one message:
596
+
597
+ ```
598
+ For cross-repository analysis, I need:
599
+
600
+ 1. **SOURCE Repository** (where to analyze):
601
+ - Local path: ?
602
+ - GitHub repo (owner/repo): ?
603
+ - Branch to analyze: ?
604
+
605
+ 2. **TARGET Repository** (where implementation will happen, if applicable):
606
+ - Local path: ?
607
+ - GitHub repo (owner/repo): ?
608
+ - Current branch: ?
609
+ - (Can be same as source for single-repo analysis)
610
+
611
+ 3. **Analysis Mode**:
612
+ A. Changes Analysis - compare against base-branch (see what changed)
613
+ - Base branch: ? (e.g., "main", "develop", "master")
614
+ B. Current State Analysis - analyze entire codebase as-is
615
+ - No base branch needed
616
+
617
+ 4. **Ticket/Reference** (GitHub Issue/PR URL, optional): ?
618
+
619
+ 5. **Analysis Focus** (optional):
620
+ - [ ] API contracts only
621
+ - [ ] Full implementation plan
622
+ - [ ] Breaking changes assessment
623
+ - [ ] Business logic understanding
624
+ - [ ] Specific area (e.g., "variables in pipelines", "auth changes")
625
+ - [ ] Feature formalization (document existing functionality)
626
+
627
+ 6. **Specific Focus Area** (if "Specific area" selected above):
628
+ - What to focus on: ? (e.g., "variables", "pipelines", "authentication", "DTOs")
629
+ - Where to look: ? (e.g., "src/pipelines", "src/auth", "src/models")
630
+ - Context keywords: ? (optional, comma-separated)
631
+ ```
632
+
633
+ **No default paths** - user must provide all locations explicitly.
634
+
635
+ **If user provides natural language focus** (e.g., "analyze everything related to variables in pipelines"):
636
+ - Parse and extract: Focus = "variables", Location = "pipelines"
637
+ - Apply Focus-Based Prioritization (see above)
638
+
639
+ ---
640
+
641
+ ## ⛔ GUARD CLAUSE: Validate Context Before Proceeding
642
+
643
+ **Before Step 1, verify you have explicit user confirmation:**
644
+
645
+ ```
646
+ CONTEXT VALIDATION CHECKLIST:
647
+ □ Source repository path: [PROVIDED / NOT PROVIDED]
648
+ □ Target repository path: [PROVIDED / NOT PROVIDED]
649
+ □ Branch to analyze: [PROVIDED / NOT PROVIDED]
650
+ □ Analysis mode: [A - Changes / B - Current State / NOT SPECIFIED]
651
+ □ Base branch (if Mode A): [PROVIDED / NOT PROVIDED]
652
+ □ Focus area (if any): [PARSED / NOT SPECIFIED]
653
+
654
+ IF Source, Target, or Branch is "NOT PROVIDED":
655
+ → STOP analysis
656
+ → Ask user for missing information
657
+ → DO NOT proceed until all fields are provided
658
+
659
+ IF Analysis mode is "NOT SPECIFIED":
660
+ → ASK: "Do you want to analyze (A) changes from base-branch or (B) current codebase state?"
661
+ → Wait for user choice
662
+
663
+ IF Mode A and Base branch is "NOT PROVIDED":
664
+ → ASK: "What is the base branch to compare against? (e.g., main, develop)"
665
+ → OR: "If you want to analyze current state without comparing to base, choose Mode B"
666
+
667
+ IF user says "just use current directory" or similar:
668
+ → EXPLICITLY CONFIRM: "I will analyze [current path] @ [current branch]. Confirm? [Y/n]"
669
+ → Wait for explicit Y before proceeding
670
+ ```
671
+
672
+ ### Analysis Mode Decision Tree
673
+
674
+ ```
675
+ User Request: "Analyze variables in pipelines"
676
+
677
+ ├─→ User provides base-branch (e.g., "from main")
678
+ │ └─→ Mode A: Changes Analysis
679
+ │ └─→ Analyze diff between main..current-branch
680
+ │ └─→ Focus on what CHANGED regarding variables
681
+
682
+ └─→ User does NOT provide base-branch
683
+ └─→ Mode B: Current State Analysis
684
+ └─→ Analyze entire codebase as-is
685
+ └─→ Focus on what EXISTS regarding variables
686
+ └─→ Formalize functionality, document patterns
687
+ ```
688
+
689
+ **Example conversation:**
690
+ ```
691
+ User: "Analyze everything related to variables in pipelines"
692
+
693
+ Agent: "I'll help you analyze variables in pipelines. First, I need context:
694
+
695
+ SOURCE Repository (where changes exist):
696
+ - Local path: ?"
697
+
698
+ User: "/Users/.../<PROJECT>"
699
+
700
+ Agent: "✓ Source: /Users/.../<PROJECT>
701
+
702
+ TARGET Repository (where to implement):
703
+ - Local path: ?"
704
+
705
+ User: "/Users/.../<PROJECT>"
706
+
707
+ Agent: "✓ Target: /Users/.../<PROJECT>
708
+
709
+ Branch to analyze:
710
+ - Branch name: ?"
711
+
712
+ User: "feature/pipeline-variables"
713
+
714
+ Agent: "✓ Branch: feature/pipeline-variables
715
+
716
+ **CONFIRMATION:**
717
+ Analyze 'feature/pipeline-variables' with focus on 'variables in pipelines'?
718
+ - Source: /Users/.../<PROJECT>
719
+ - Target: /Users/.../<PROJECT>
720
+ - Focus: variables in pipelines
721
+
722
+ Start analysis? [Y/n]"
723
+
724
+ User: "Y"
725
+
726
+ Agent: "✓ Starting analysis..."
727
+ ```
728
+
729
+ ---
730
+
731
+ ## Step 1: GitHub MCP Availability Check
732
+
733
+ Before starting analysis:
734
+
735
+ ```bash
736
+ # Check if GitHub MCP is responsive
737
+ # Try to fetch a simple repo info
738
+ ```
739
+
740
+ **If GitHub MCP unavailable:**
741
+ 1. Notify user: "GitHub MCP is not available. Options:"
742
+ 2. Option A: "Restart GitHub MCP and continue"
743
+ 3. Option B: "Proceed with git-only analysis (limited context)"
744
+ 4. Wait for user choice before proceeding
745
+
746
+ ---
747
+
748
+ ## Step 2: GitHub Issue/PR Analysis (if provided)
749
+
750
+ - Use GitHub MCP to fetch Issue/PR and all comments
751
+ - **CRITICAL**: Understand business goal - what problem does the feature solve?
752
+ - Extract acceptance criteria and requirements
753
+ - Note any architectural decisions or constraints mentioned
754
+
755
+ ---
756
+
757
+ ## Step 3: Git Changes Collection
758
+
759
+ ### Base Branch Determination Rule (CRITICAL)
760
+
761
+ **The base branch MUST be determined from the last branching point (merge-base), NOT from the current HEAD of the parent branch.**
762
+
763
+ This ensures you analyze only the changes made in the feature branch, not changes that occurred in the parent branch after the feature was branched.
764
+
765
+ **Why this matters:**
766
+ - If you compare against `origin/main` HEAD, you'll see unrelated changes from other merged PRs
767
+ - You MUST find the exact commit where the feature branch diverged
768
+ - Use `git merge-base` to find this point
769
+
770
+ ### Calculate BASE_SHA
771
+
772
+ **ALGORITHM - Find the last branching point:**
773
+
774
+ ```bash
775
+ BRANCH="$(git rev-parse --abbrev-ref HEAD)"
776
+ UPSTREAM_REF="$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null || true)"
777
+
778
+ # Step 1: Determine parent branch candidate
779
+ PARENT=""
780
+ if git rev-parse --verify -q "origin/main" >/dev/null; then
781
+ PARENT="origin/main"
782
+ elif git rev-parse --verify -q "origin/master" >/dev/null; then
783
+ PARENT="origin/master"
784
+ elif git rev-parse --verify -q "main" >/dev/null; then
785
+ PARENT="main"
786
+ elif git rev-parse --verify -q "master" >/dev/null; then
787
+ PARENT="master"
788
+ elif [ -n "$UPSTREAM_REF" ] && [ "$UPSTREAM_REF" != "$BRANCH" ] && [ "$UPSTREAM_REF" != "origin/$BRANCH" ]; then
789
+ PARENT="@{upstream}"
790
+ else
791
+ echo "Cannot determine parent ref" >&2
792
+ exit 1
793
+ fi
794
+
795
+ # Step 2: CRITICAL - Find the actual branching point (merge-base)
796
+ # This gives you the commit where feature branch diverged from parent
797
+ BASE_SHA="$(git merge-base HEAD "$PARENT")"
798
+ ```
799
+
800
+ **Verification:**
801
+ ```bash
802
+ # Verify BASE_SHA is correct
803
+ echo "Feature branch: $BRANCH"
804
+ echo "Parent branch: $PARENT"
805
+ echo "Branching point (BASE_SHA): $BASE_SHA"
806
+ echo "Commits in feature branch:"
807
+ git log --oneline "${BASE_SHA}..HEAD"
808
+ ```
809
+
810
+ **Result:** `BASE_SHA` is the exact commit where your feature branch started - this is your analysis starting point.
811
+ fi
812
+
813
+ BASE_SHA="$(git merge-base HEAD "$PARENT")"
814
+ ```
815
+
816
+ ### Collect Changes
817
+ ```bash
818
+ # Committed changes
819
+ git log --oneline "${BASE_SHA}..HEAD"
820
+ git diff --stat "${BASE_SHA}..HEAD"
821
+ git diff --name-status "${BASE_SHA}..HEAD"
822
+ git diff "${BASE_SHA}..HEAD"
823
+
824
+ # Full snapshot (commits + staged + unstaged)
825
+ git diff --stat "${BASE_SHA}"
826
+ git diff --name-status "${BASE_SHA}"
827
+ git diff "${BASE_SHA}"
828
+ git ls-files --others --exclude-standard
829
+ ```
830
+
831
+ ---
832
+
833
+ ## Step 4: File Categorization and Prioritization
834
+
835
+ ### Priority Levels
836
+
837
+ **P0 - MUST ANALYZE (Critical)**:
838
+ - ✅ **API Contracts**: DTOs, interfaces, type definitions
839
+ - Public API endpoints (controllers, routes)
840
+ - Database schema changes
841
+ - Breaking changes in shared libraries
842
+ - Authentication/authorization changes
843
+ - Configuration changes affecting multiple services
844
+
845
+ **P1 - SHOULD ANALYZE (Important)**:
846
+ - Business logic implementation (services, use cases)
847
+ - State management changes (stores, contexts)
848
+ - New features and capabilities
849
+ - Error handling and validation logic
850
+ - Integration points with external services
851
+
852
+ **P2 - NICE TO HAVE (Optional)**:
853
+ - UI component updates (pure presentation)
854
+ - Refactoring without logic changes
855
+ - Test file updates
856
+ - Documentation updates
857
+ - Package dependency updates (non-breaking)
858
+
859
+ ### File Selection Algorithm
860
+
861
+ #### Standard Algorithm (No Focus Specified)
862
+ From P0 files, select up to 5 most important:
863
+ 1. Sort by: API contracts → Business logic → Infrastructure
864
+ 2. Within each tier, pick files with most changes (lines changed)
865
+ 3. Ensure coverage of: entry points, data flow, state management
866
+
867
+ From P1 files, select up to 3 if P0 < 3:
868
+ 1. Focus on files interacting with P0 files
869
+ 2. Business-critical paths
870
+
871
+ **Skip P2 files** unless P0+P1 < 3 total.
872
+
873
+ #### Focus-Based Algorithm (User Specified Focus)
874
+ When user specifies focus (e.g., "variables in pipelines"):
875
+
876
+ **Step 1: Boost Priorities Based on Focus**
877
+ ```
878
+ For each changed file:
879
+ 1. Assign base priority (P0/P1/P2)
880
+ 2. IF file matches focus keywords → Boost to P0
881
+ 3. IF file in focus directory → +1 level
882
+ 4. IF file references focus entities → +1 level
883
+ 5. Final priority = MIN(P0, base + boosts)
884
+ ```
885
+
886
+ **Step 2: Search Broader Context**
887
+ Search beyond changed files for focus understanding:
888
+ ```bash
889
+ # Search focus keywords in entire codebase
890
+ grep -r "focus_keyword" --include="*.ts" src/ | head -30
891
+
892
+ # Find all files in focus directory
893
+ find src/focus_directory -type f -name "*.ts" -o -name "*.tsx"
894
+
895
+ # Identify focus entity definitions
896
+ grep -l "class FocusEntity\|interface FocusEntity" --include="*.ts" src/
897
+ ```
898
+
899
+ **Step 3: Map Relationships**
900
+ Identify related components that use/interact with focus entities:
901
+ - What imports focus entities? → Consumers
902
+ - What defines focus entities? → Definitions
903
+ - What modifies focus entities? → Mutators
904
+
905
+ **Step 4: Selection with Focus**
906
+ 1. Select ALL focus-matching P0 files (even if >5)
907
+ 2. If < 5 focus files, add non-focus P0 by standard rules
908
+ 3. Add focus-matching P1 files (up to 3)
909
+ 4. Include 1-2 context files (files that use focus entities)
910
+
911
+ **Example:** Focus = "variables in pipelines"
912
+ ```
913
+ Selected files:
914
+ ✅ P0: src/pipelines/variable-resolver.ts (focus match)
915
+ ✅ P0: src/models/pipeline-variable.dto.ts (focus match)
916
+ ✅ P1: src/pipelines/pipeline-runner.ts (context - uses variables)
917
+ ✅ P1: src/services/variable-service.ts (focus match)
918
+ ✅ P0: src/pipelines/pipeline-builder.ts (context - creates pipelines)
919
+ ```
920
+
921
+ **Skip non-focus files** unless needed for context.
922
+
923
+ ---
924
+
925
+ ## Step 5: Deep Dive Protocol
926
+
927
+ **You CANNOT make conclusions from git diff alone. You MUST:**
928
+
929
+ 1. **Read selected files**:
930
+ - For small/medium files: read completely - no partial reads.
931
+ - **CRITICAL**: For large files (> 500 lines), DO NOT read the entire file. First use code-outline (`view_file_outline`) or `grep_search` tools to locate the relevant classes or functions, then read only those specific line ranges using `view_file`.
932
+ 2. **Understand context**:
933
+ - How does this file fit in the architecture?
934
+ - What are its dependencies?
935
+ - What depends on it?
936
+ 3. **Find and analyze tests**:
937
+ - Look for test files matching changed files
938
+ - Understand test coverage and scenarios
939
+ - Identify edge cases being tested
940
+ 4. **Check rules compliance**:
941
+ - Verify against `code-style-patterns.mdc`
942
+ - Check architecture patterns
943
+ - Validate TypeScript usage
944
+
945
+ ---
946
+
947
+ ## Step 6: Cross-Repository Analysis (Source → Target)
948
+
949
+ **When analyzing external branch (e.g., backend) for implementation in target (e.g., frontend):**
950
+
951
+ ### 6.1 Dependency Search in Target
952
+ Find all files in TARGET repo that:
953
+ - Import or use changed DTOs/APIs from SOURCE
954
+ - Reference modified endpoints
955
+ - Depend on changed business logic
956
+
957
+ ### 6.2 Contract Divergence Analysis
958
+ Compare new contracts from SOURCE with current implementation in TARGET:
959
+ - Field additions/removals
960
+ - Type changes
961
+ - Endpoint modifications
962
+ - Behavior changes
963
+
964
+ ### 6.3 Target Deep Dive
965
+ Read 2-3 key components in TARGET that will need changes:
966
+ - Understand current implementation patterns
967
+ - Identify MobX stores, React hooks, or services affected
968
+ - Check integration points
969
+
970
+ ### 6.4 Target Rules Compliance
971
+ Verify TARGET repository guidelines:
972
+ - Check `.cursor/rules/core/*.mdc` in target repo
973
+ - Validate proposed changes against target patterns
974
+
975
+ ---
976
+
977
+ ## Step 7: UI Analysis (if applicable)
978
+
979
+ For UI changes, use Playwright/Storybook (see AGENTS.md for available tools):
980
+
981
+ ### Check AGENTS.md for:
982
+ - `core/playwright-testing.mdc` - E2E test patterns
983
+ - `core/storybook-guidelines.mdc` - Component documentation
984
+ - Any UI testing skills in Skills Catalog
985
+
986
+ ### Analyze:
987
+ - Visual regression requirements
988
+ - Component behavior changes
989
+ - Responsive design impact
990
+ - Accessibility considerations
991
+
992
+ ---
993
+
994
+ ## Step 8: Integration with Other Skills
995
+
996
+ **Leverage other skills via AGENTS.md catalog:**
997
+
998
+ Before finalizing analysis, consider running:
999
+ - `skills/code-style-review` - if architecture changes detected
1000
+ - `skills/code-ai-review` - for self-validation of findings
1001
+ - `skills/code-mobx-store-review` - if store changes found
1002
+
1003
+ **How to invoke:**
1004
+ 1. Reference `AGENTS.md` Skills Catalog
1005
+ 2. Select appropriate skill based on findings
1006
+ 3. Run skill with context from current analysis
1007
+ 4. Incorporate findings into final report
1008
+
1009
+ ---
1010
+
1011
+ ## Step 9: Intermediate Review (CRITICAL)
1012
+
1013
+ After completing analysis, **SHOW USER** before generating full report:
1014
+
1015
+ ```
1016
+ ═══════════════════════════════════════════════
1017
+ INTERMEDIATE ANALYSIS SUMMARY
1018
+ ═══════════════════════════════════════════════
1019
+
1020
+ Scope:
1021
+ - Source: [repo] @ [branch]
1022
+ - Target: [repo] @ [branch]
1023
+ - Files analyzed: [N] (P0: [N], P1: [N])
1024
+ - BASE_SHA: [sha]
1025
+
1026
+ Key Findings:
1027
+ 1. [Brief finding 1]
1028
+ 2. [Brief finding 2]
1029
+ 3. [Brief finding 3]
1030
+
1031
+ Cross-Repo Impact:
1032
+ - [ ] Breaking API changes detected
1033
+ - [ ] New endpoints to implement
1034
+ - [ ] DTO changes affecting frontend
1035
+ - [ ] Database schema changes
1036
+
1037
+ Estimated Complexity: [Low/Medium/High]
1038
+ Estimated Implementation Time: [hours/days]
1039
+
1040
+ Continue to full documentation? [Y/n]
1041
+ - Type 'Y' to generate full report
1042
+ - Type 'n' to adjust analysis scope
1043
+ - Type 'questions' to ask about specific findings
1044
+ ═══════════════════════════════════════════════
1045
+ ```
1046
+
1047
+ Wait for user confirmation before proceeding.
1048
+
1049
+ ---
1050
+
1051
+ ## Step 10: Documentation Generation
1052
+
1053
+ ### Output Structure
1054
+ ```
1055
+ <DOCS_ROOT>/analysis/<feature-name>-<YYYY-MM-DD>/
1056
+ ├── README.md # Index and navigation
1057
+ ├── report/
1058
+ │ ├── en/
1059
+ │ │ └── report.md # English for humans
1060
+ │ ├── ru/
1061
+ │ │ └── report.md # Russian for humans
1062
+ │ └── ai/
1063
+ │ └── report.md # Structured for AI agents (EN)
1064
+ ├── plans/
1065
+ │ ├── en/
1066
+ │ │ └── implementation-plan.md
1067
+ │ ├── ru/
1068
+ │ │ └── implementation-plan.md
1069
+ │ └── ai/
1070
+ │ └── implementation-plan.md # Gherkin-style format
1071
+ ├── contracts/
1072
+ │ ├── api-changes.md # API contract diff
1073
+ │ └── dto-comparison.md # Before/after DTOs
1074
+ └── metrics/
1075
+ └── analysis-metrics.md # Analysis metadata
1076
+ ```
1077
+
1078
+ ### AI-Readable Format (Gherkin-style)
1079
+
1080
+ For AI agent consumption in `report/ai/report.md` and `plans/ai/implementation-plan.md`.
1081
+
1082
+ **Purpose**: Enable other AI agents to parse analysis results programmatically and generate implementation plans.
1083
+
1084
+ **Structure Requirements**:
1085
+
1086
+ #### 1. Feature Declaration
1087
+ ```gherkin
1088
+ Feature: [Concise Feature Name]
1089
+ As a [type of user]
1090
+ I want [goal]
1091
+ So that [benefit]
1092
+
1093
+ Background:
1094
+ Given source repository is "[owner/repo]"
1095
+ And source branch is "[branch-name]"
1096
+ And target repository is "[owner/repo]"
1097
+ And target branch is "[branch-name]"
1098
+ And analysis date is "YYYY-MM-DD"
1099
+ And analysis version is "[version]"
1100
+ ```
1101
+
1102
+ #### 2. Metadata Scenario (Required)
1103
+ ```gherkin
1104
+ Scenario: Analysis Metadata
1105
+ Given the analysis scope
1106
+ Then the following metadata is captured:
1107
+ | Field | Value |
1108
+ | BASE_SHA | [commit-hash] |
1109
+ | Parent Branch | [origin/main] |
1110
+ | Files Analyzed | [N] |
1111
+ | P0 Files | [N] |
1112
+ | P1 Files | [N] |
1113
+ | Complexity Score | [N] |
1114
+ | Risk Level | [Low/Medium/High] |
1115
+ ```
1116
+
1117
+ #### 3. API Contract Scenarios (One per changed endpoint)
1118
+ ```gherkin
1119
+ Scenario: API Contract - [Endpoint Name]
1120
+ Given the endpoint "[METHOD /path/to/resource]"
1121
+ And the endpoint purpose is "[business purpose]"
1122
+ When comparing contracts between source and target
1123
+ Then the request changes are:
1124
+ | Field | Type | Required | Description |
1125
+ | [field] | [type] | [Y/N] | [desc] |
1126
+ And the response changes are:
1127
+ | Field | Type | Required | Description |
1128
+ | [field] | [type] | [Y/N] | [desc] |
1129
+ And breaking changes are "[Y/N]"
1130
+ And backward compatibility is "[Y/N]"
1131
+ Examples:
1132
+ | Version | Change Type |
1133
+ | old | [before state] |
1134
+ | new | [after state] |
1135
+ ```
1136
+
1137
+ #### 4. Business Logic Scenarios (One per P0 file)
1138
+ ```gherkin
1139
+ Scenario: Business Logic - [File Name]
1140
+ Given the file "[path/to/file.ts]"
1141
+ And the file purpose is "[purpose description]"
1142
+ When analyzing the implementation
1143
+ Then the following functions/methods are present:
1144
+ | Name | Purpose | Input | Output |
1145
+ | [name] | [purpose] | [input] | [output] |
1146
+ And the key logic includes:
1147
+ """
1148
+ [code snippet with comments]
1149
+ """
1150
+ And the business rules are:
1151
+ 1. [rule 1]
1152
+ 2. [rule 2]
1153
+ And the edge cases handled are:
1154
+ | Case | Handling |
1155
+ | [case] | [how handled] |
1156
+ ```
1157
+
1158
+ #### 5. State Management Scenarios (if applicable)
1159
+ ```gherkin
1160
+ Scenario: State Management - [Store Name]
1161
+ Given the MobX store "[StoreName]"
1162
+ And the store manages "[what state]"
1163
+ Then the observables are:
1164
+ | Name | Type | Initial Value |
1165
+ | [name] | [type] | [value] |
1166
+ And the actions are:
1167
+ | Name | Purpose | Async |
1168
+ | [name] | [purpose] | [Y/N] |
1169
+ And the computed values are:
1170
+ | Name | Dependencies | Purpose |
1171
+ | [name] | [deps] | [purpose] |
1172
+ ```
1173
+
1174
+ #### 6. Cross-Repository Impact Scenarios
1175
+ ```gherkin
1176
+ Scenario: Cross-Repository Impact - [Component/Service]
1177
+ Given the target component "[path/to/component.tsx]"
1178
+ And it depends on source API "[endpoint]"
1179
+ When the API changes are applied
1180
+ Then the following changes are required:
1181
+ | Location | Change Type | Description |
1182
+ | [file] | [modify/add/remove] | [desc] |
1183
+ And the migration steps are:
1184
+ 1. [step 1]
1185
+ 2. [step 2]
1186
+ And the risk level is "[Low/Medium/High]"
1187
+ ```
1188
+
1189
+ #### 7. Implementation Plan (in plans/ai/)
1190
+ ```gherkin
1191
+ Feature: Implementation Plan for [Feature Name]
1192
+ Background:
1193
+ Given analysis from "[path/to/analysis]"
1194
+ And target repository is "[owner/repo]"
1195
+
1196
+ Scenario: Phase 1 - Setup and Dependencies
1197
+ Given the current state of target repository
1198
+ Then install/update the following dependencies:
1199
+ | Package | Version | Purpose |
1200
+ | [pkg] | [ver] | [purpose] |
1201
+ And configure the following:
1202
+ | Config | Value |
1203
+ | [key] | [value] |
1204
+
1205
+ Scenario: Phase 2 - API Layer Implementation
1206
+ Given the API contract changes
1207
+ Then implement the following files:
1208
+ | File | Purpose | Key Methods |
1209
+ | [path] | [purpose] | [methods] |
1210
+ And update DTOs:
1211
+ | DTO | Changes |
1212
+ | [name] | [changes] |
1213
+
1214
+ Scenario: Phase 3 - Business Logic Implementation
1215
+ Given the business requirements
1216
+ Then implement:
1217
+ """
1218
+ [pseudo-code or code structure]
1219
+ """
1220
+ And handle edge cases:
1221
+ | Case | Implementation |
1222
+ | [case] | [solution] |
1223
+
1224
+ Scenario: Phase 4 - UI Integration
1225
+ Given the UI requirements
1226
+ Then update components:
1227
+ | Component | Changes |
1228
+ | [name] | [desc] |
1229
+
1230
+ Scenario: Phase 5 - Testing
1231
+ Given the implementation
1232
+ Then write tests for:
1233
+ | Type | Coverage |
1234
+ | Unit | [what to test] |
1235
+ | Integration | [scenarios] |
1236
+ And verify:
1237
+ | Check | Expected |
1238
+ | [check] | [result] |
1239
+
1240
+ Scenario: Verification and Rollout
1241
+ Given all phases complete
1242
+ Then verify:
1243
+ | Check | Command/Method |
1244
+ | Build | npm run build |
1245
+ | Tests | npm test |
1246
+ | Lint | npm run lint |
1247
+ And deploy to:
1248
+ | Environment | Steps |
1249
+ | [env] | [steps] |
1250
+ ```
1251
+
1252
+ #### Gherkin Syntax Rules:
1253
+ - Use **Given** for preconditions and context
1254
+ - Use **When** for actions or analysis steps
1255
+ - Use **Then** for expected outcomes and validations
1256
+ - Use **And/But** to continue previous statement
1257
+ - Use **Examples** for tabular data variations
1258
+ - Use **"""** for multi-line text (code snippets)
1259
+ - Use **|** for tables with headers
1260
+ - Keep scenarios focused and atomic (one concept per scenario)
1261
+ - Use descriptive names: "API Contract - User Creation Endpoint" not "Scenario 1"
1262
+
1263
+ ---
1264
+
1265
+ ## Step 11: Content Requirements
1266
+
1267
+ ### Evidence-Based Documentation
1268
+ - Every claim MUST reference specific code
1269
+ - Use format: `[filename.ts:L123](file:///absolute/path#L123)`
1270
+ - Minimum 3 code examples in report
1271
+
1272
+ ### Visualization
1273
+ - Mermaid diagrams for architecture
1274
+ - Tables for DTO changes
1275
+ - Flowcharts for data flow changes
1276
+
1277
+ ### Multi-Language Support
1278
+ - **report/en/**: Full detail for humans
1279
+ - **report/ru/**: Full detail for humans (Russian)
1280
+ - **report/ai/**: Gherkin-style for AI agents (English)
1281
+
1282
+ ---
1283
+
1284
+ ## Step 12: Error Handling and Fallbacks
1285
+
1286
+ ### GitHub MCP Unavailable
1287
+ ```markdown
1288
+ **Status**: GitHub MCP not responding
1289
+ **Fallback**: Using git history and commit messages only
1290
+ **Impact**: Limited business context
1291
+ **Action**: Ask user to restart MCP or proceed with limited analysis
1292
+ ```
1293
+
1294
+ ### No Tests Found
1295
+ ```markdown
1296
+ **Warning**: No test files found for analyzed components
1297
+ **Risk**: Untested logic may have edge cases
1298
+ **Recommendation**: Add test coverage for critical paths
1299
+ ```
1300
+
1301
+ ### Cannot Determine BASE_SHA
1302
+ ```markdown
1303
+ **Strategy 1**: Ask user for parent branch name
1304
+ **Strategy 2**: Use `git log --first-parent` to estimate
1305
+ **Strategy 3**: Analyze only HEAD commit (limited scope)
1306
+ ```
1307
+
1308
+ ### Empty Diff
1309
+ ```markdown
1310
+ **Check 1**: Staged changes only? `git diff --cached`
1311
+ **Check 2**: Untracked files? `git status`
1312
+ **Check 3**: Wrong branch? `git branch -a`
1313
+ ```
1314
+
1315
+ ### Cross-Repo Access Denied
1316
+ ```markdown
1317
+ **Status**: Cannot access target repository
1318
+ **Options**:
1319
+ 1. Provide target repo path manually
1320
+ 2. Skip cross-repo analysis (source-only)
1321
+ 3. Export analysis for manual review
1322
+ ```
1323
+
1324
+ ---
1325
+
1326
+ ## Step 13: Analysis Metrics
1327
+
1328
+ Track and report:
1329
+
1330
+ ```markdown
1331
+ ## Analysis Metrics
1332
+
1333
+ - **Duration**: [X minutes]
1334
+ - **Files Analyzed**: [N total] (P0: [N], P1: [N], P2: [N])
1335
+ - **Lines of Code Changed**: [N]
1336
+ - **Cross-Repo Dependencies**: [N files affected]
1337
+ - **API Endpoints Changed**: [N]
1338
+ - **DTOs Modified**: [N]
1339
+ - **Breaking Changes**: [Y/N, count]
1340
+ - **Test Coverage**: [% or N/A]
1341
+ - **Risk Level**: [Low/Medium/High]
1342
+ - **Estimated Effort**: [X hours/days]
1343
+
1344
+ ## Complexity Score
1345
+ Calculate: (P0_files × 3) + (P1_files × 2) + (P2_files × 1) + (breaking_changes × 5)
1346
+ - 0-10: Low complexity
1347
+ - 11-25: Medium complexity
1348
+ - 26+: High complexity
1349
+ ```
1350
+
1351
+ ---
1352
+
1353
+ ## Step 14: Validation Checklist
1354
+
1355
+ Before finalizing, verify:
1356
+
1357
+ ```markdown
1358
+ ## Pre-Delivery Checklist
1359
+
1360
+ - [ ] Source repository fully analyzed (all P0 files)
1361
+ - [ ] Target repository analyzed (if cross-repo)
1362
+ - [ ] Minimum 3 code examples included
1363
+ - [ ] All file references include line numbers
1364
+ - [ ] API contracts documented (if applicable)
1365
+ - [ ] Breaking changes clearly identified
1366
+ - [ ] Implementation plan provided
1367
+ - [ ] Metrics calculated and documented
1368
+ - [ ] Multi-language reports generated (EN, RU, AI)
1369
+ - [ ] User approved intermediate review
1370
+ - [ ] AGENTS.md updated if new patterns discovered
1371
+ ```
1372
+
1373
+ ---
1374
+
1375
+ ## Step 15: Post-Analysis
1376
+
1377
+ ### Update Documentation Registry
1378
+ Follow `documentation-management.mdc`:
1379
+ - Update `<DOCS_ROOT>/readme.md`
1380
+ - Add entry to analysis index
1381
+ - Tag with relevant keywords
1382
+
1383
+ ### Archive Old Analyses
1384
+ User manages cleanup manually, but suggest:
1385
+ ```
1386
+ Tip: Consider archiving analyses older than 3 months to:
1387
+ <DOCS_ROOT>/analysis/archived/
1388
+ ```
1389
+
1390
+ ---
1391
+
1392
+ ## Rules and Guidelines
1393
+
1394
+ 1. **Always follow** `documentation-management.mdc` for doc structure
1395
+ 2. **Always check** `code-style-patterns.mdc` for compliance
1396
+ 3. **Always use** AGENTS.md to discover available skills and tools
1397
+ 4. **Never assume** - ask user when unclear
1398
+ 5. **Never skip** intermediate review for complex analyses (P0 files > 3)
1399
+ 6. **Always provide** concrete, actionable recommendations
1400
+ 7. **Always include** both human-readable and AI-readable formats
1401
+
1402
+ ---
1403
+
1404
+ ## Success Criteria
1405
+
1406
+ Analysis is successful when:
1407
+ - Business logic is fully understood and documented
1408
+ - API contracts are clearly specified
1409
+ - Breaking changes are identified
1410
+ - Implementation plan is actionable
1411
+ - User confirms understanding via intermediate review
1412
+ - All P0 files analyzed completely