octocode-cli 1.2.7 → 1.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 (282) hide show
  1. package/README.md +42 -35
  2. package/out/octocode-cli.js +36 -11719
  3. package/package.json +36 -36
  4. package/skills/README.md +42 -114
  5. package/skills/{octocode-code-engineer → octocode-engineer}/.claude/settings.local.json +2 -1
  6. package/skills/octocode-engineer/README.md +99 -0
  7. package/skills/octocode-engineer/SKILL.md +499 -0
  8. package/skills/octocode-engineer/build.mjs +29 -0
  9. package/skills/{octocode-code-engineer → octocode-engineer}/eslint.config.mjs +3 -13
  10. package/skills/{octocode-code-engineer → octocode-engineer}/package.json +28 -27
  11. package/skills/octocode-engineer/references/ast-reference.md +166 -0
  12. package/skills/{octocode-code-engineer → octocode-engineer}/references/cli-reference.md +80 -6
  13. package/skills/octocode-engineer/references/externals.md +86 -0
  14. package/skills/{octocode-code-engineer → octocode-engineer}/references/output-files.md +46 -6
  15. package/skills/octocode-engineer/references/quality-indicators.md +202 -0
  16. package/skills/octocode-engineer/references/tool-workflows.md +298 -0
  17. package/skills/octocode-engineer/references/validation-playbooks.md +99 -0
  18. package/skills/octocode-engineer/scripts/ast/search.js +45 -0
  19. package/skills/octocode-engineer/scripts/ast/tree-search.js +27 -0
  20. package/skills/octocode-engineer/scripts/index.js +173 -0
  21. package/skills/octocode-engineer/scripts/run.js +179 -0
  22. package/skills/octocode-engineer/src/analysis/dependencies.ts +378 -0
  23. package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/discovery.test.ts +57 -0
  24. package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/discovery.ts +43 -0
  25. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/search.test.ts +113 -0
  26. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/search.ts +64 -1
  27. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-sitter.test.ts +118 -2
  28. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-sitter.ts +65 -3
  29. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/ts-analyzer.test.ts +281 -1
  30. package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/ts-analyzer.ts +173 -3
  31. package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/security.test.ts +73 -0
  32. package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/security.ts +62 -4
  33. package/skills/octocode-engineer/src/detector-gating.test.ts +59 -0
  34. package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/code-quality.ts +342 -0
  35. package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/index.ts +8 -0
  36. package/skills/{octocode-code-engineer → octocode-engineer}/src/index.test.ts +565 -11
  37. package/skills/octocode-engineer/src/index.ts +468 -0
  38. package/skills/octocode-engineer/src/pipeline/affected.test.ts +147 -0
  39. package/skills/octocode-engineer/src/pipeline/affected.ts +68 -0
  40. package/skills/octocode-engineer/src/pipeline/baseline.test.ts +276 -0
  41. package/skills/octocode-engineer/src/pipeline/baseline.ts +76 -0
  42. package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cli.test.ts +300 -53
  43. package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cli.ts +180 -36
  44. package/skills/octocode-engineer/src/pipeline/config-loader.test.ts +264 -0
  45. package/skills/octocode-engineer/src/pipeline/config-loader.ts +109 -0
  46. package/skills/octocode-engineer/src/pipeline/create-options.ts +55 -0
  47. package/skills/octocode-engineer/src/pipeline/health-score.test.ts +65 -0
  48. package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/main.ts +130 -17
  49. package/skills/octocode-engineer/src/pipeline/progress.ts +51 -0
  50. package/skills/octocode-engineer/src/pipeline/reporters.test.ts +155 -0
  51. package/skills/octocode-engineer/src/pipeline/reporters.ts +64 -0
  52. package/skills/octocode-engineer/src/reporting/graph-features.test.ts +279 -0
  53. package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/output-contract.test.ts +6 -0
  54. package/skills/octocode-engineer/src/reporting/summary-md.test.ts +1066 -0
  55. package/skills/octocode-engineer/src/reporting/summary-md.ts +1604 -0
  56. package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/writer.ts +136 -13
  57. package/skills/octocode-engineer/src/run.ts +78 -0
  58. package/skills/{octocode-code-engineer → octocode-engineer}/src/sanity.test.ts +1 -1
  59. package/skills/octocode-engineer/src/types/analysis.ts +25 -0
  60. package/skills/octocode-engineer/src/types/collectors.ts +134 -0
  61. package/skills/{octocode-code-engineer → octocode-engineer}/src/types/constants.ts +75 -41
  62. package/skills/octocode-engineer/src/types/core.ts +203 -0
  63. package/skills/octocode-engineer/src/types/dependency.ts +215 -0
  64. package/skills/octocode-engineer/src/types/file-entry.ts +108 -0
  65. package/skills/octocode-engineer/src/types/findings.ts +105 -0
  66. package/skills/{octocode-code-engineer → octocode-engineer}/src/types/index.ts +60 -30
  67. package/skills/octocode-engineer/src/types/tree-sitter.ts +38 -0
  68. package/skills/{octocode-code-engineer → octocode-engineer}/tsconfig.json +1 -0
  69. package/skills/octocode-research/.octocode/scan/.cache/analysis-cache.json +1 -0
  70. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/architecture.json +1 -0
  71. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/ast-trees.txt +5566 -0
  72. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/code-quality.json +1 -0
  73. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/dead-code.json +1 -0
  74. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/file-inventory.json +1 -0
  75. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/findings.json +1 -0
  76. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/graph.md +189 -0
  77. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/security.json +1 -0
  78. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/summary.json +1 -0
  79. package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/summary.md +265 -0
  80. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/architecture.json +1 -0
  81. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/ast-trees.txt +5555 -0
  82. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/code-quality.json +1 -0
  83. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/dead-code.json +1 -0
  84. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/file-inventory.json +1 -0
  85. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/findings.json +1 -0
  86. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/graph.md +190 -0
  87. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/security.json +1 -0
  88. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/summary.json +1 -0
  89. package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/summary.md +265 -0
  90. package/skills/octocode-research/CHANGELOG.md +60 -0
  91. package/skills/octocode-research/README.md +102 -388
  92. package/skills/octocode-research/SKILL.md +169 -498
  93. package/skills/octocode-research/package.json +19 -31
  94. package/skills/octocode-research/references/PARALLEL_AGENT_PROTOCOL.md +19 -0
  95. package/skills/octocode-research/references/SESSION_MANAGEMENT.md +38 -0
  96. package/skills/octocode-research/scripts/server-init.js +1 -1
  97. package/skills/octocode-research/scripts/server.d.ts +2 -1
  98. package/skills/octocode-research/scripts/server.js +329 -233
  99. package/skills/octocode-research/src/__tests__/integration/promptsRoutes.test.ts +180 -0
  100. package/skills/octocode-research/src/__tests__/integration/serverHttp.test.ts +221 -0
  101. package/skills/octocode-research/src/__tests__/integration/serverLifecycle.test.ts +194 -0
  102. package/skills/octocode-research/src/__tests__/integration/toolsRoutes.test.ts +501 -0
  103. package/skills/octocode-research/src/__tests__/unit/readiness.test.ts +61 -0
  104. package/skills/octocode-research/src/__tests__/unit/resilience.test.ts +192 -0
  105. package/skills/octocode-research/src/__tests__/unit/responseFactory.test.ts +172 -0
  106. package/skills/octocode-research/src/__tests__/unit/responseParser.test.ts +288 -0
  107. package/skills/octocode-research/src/__tests__/unit/schemas.test.ts +509 -0
  108. package/skills/octocode-research/src/index.ts +4 -124
  109. package/skills/octocode-research/src/middleware/queryParser.ts +0 -26
  110. package/skills/octocode-research/src/routes/lsp.ts +58 -59
  111. package/skills/octocode-research/src/routes/package.ts +35 -65
  112. package/skills/octocode-research/src/routes/prompts.ts +3 -3
  113. package/skills/octocode-research/src/routes/tools.ts +8 -20
  114. package/skills/octocode-research/src/server-init.ts +30 -237
  115. package/skills/octocode-research/src/server.ts +50 -23
  116. package/skills/octocode-research/src/types/errorGuards.ts +9 -80
  117. package/skills/octocode-research/src/types/guards.ts +0 -28
  118. package/skills/octocode-research/src/types/mcp.ts +11 -66
  119. package/skills/octocode-research/src/types/responses.ts +11 -129
  120. package/skills/octocode-research/src/utils/circuitBreaker.ts +0 -21
  121. package/skills/octocode-research/src/utils/logger.ts +1 -97
  122. package/skills/octocode-research/src/utils/resilience.ts +2 -12
  123. package/skills/octocode-research/src/utils/responseFactory.ts +0 -42
  124. package/skills/octocode-research/src/utils/responseParser.ts +3 -25
  125. package/skills/octocode-research/src/utils/retry.ts +0 -63
  126. package/skills/octocode-research/src/utils/routeFactory.ts +1 -1
  127. package/skills/octocode-research/src/validation/httpPreprocess.ts +0 -3
  128. package/skills/octocode-research/src/validation/index.ts +0 -1
  129. package/skills/octocode-research/src/validation/schemas.ts +0 -63
  130. package/skills/octocode-research/src/validation/toolCallSchema.ts +3 -3
  131. package/skills/octocode-research/tsdown.config.ts +4 -0
  132. package/skills/octocode-research/vitest.config.ts +3 -0
  133. package/skills/octocode-code-engineer/.plan/VALIDATED_PLAN.md +0 -223
  134. package/skills/octocode-code-engineer/README.md +0 -178
  135. package/skills/octocode-code-engineer/SKILL.md +0 -418
  136. package/skills/octocode-code-engineer/minify-scripts.mjs +0 -32
  137. package/skills/octocode-code-engineer/references/agent-ast-reading-rfc.md +0 -95
  138. package/skills/octocode-code-engineer/references/architecture-techniques.md +0 -121
  139. package/skills/octocode-code-engineer/references/ast-search.md +0 -210
  140. package/skills/octocode-code-engineer/references/ast-tree-search.md +0 -151
  141. package/skills/octocode-code-engineer/references/concepts.md +0 -107
  142. package/skills/octocode-code-engineer/references/finding-categories.md +0 -128
  143. package/skills/octocode-code-engineer/references/improvement-roadmap.md +0 -304
  144. package/skills/octocode-code-engineer/references/playbooks.md +0 -204
  145. package/skills/octocode-code-engineer/references/present-results.md +0 -136
  146. package/skills/octocode-code-engineer/references/tool-workflows.md +0 -566
  147. package/skills/octocode-code-engineer/references/validate-investigate.md +0 -225
  148. package/skills/octocode-code-engineer/scripts/analysis/dependencies.js +0 -1
  149. package/skills/octocode-code-engineer/scripts/analysis/dependency-summary.js +0 -1
  150. package/skills/octocode-code-engineer/scripts/analysis/discovery.js +0 -1
  151. package/skills/octocode-code-engineer/scripts/analysis/graph-analytics.js +0 -1
  152. package/skills/octocode-code-engineer/scripts/analysis/semantic.js +0 -1
  153. package/skills/octocode-code-engineer/scripts/ast/helpers.js +0 -1
  154. package/skills/octocode-code-engineer/scripts/ast/metrics.js +0 -1
  155. package/skills/octocode-code-engineer/scripts/ast/search.js +0 -2
  156. package/skills/octocode-code-engineer/scripts/ast/tree-search.js +0 -2
  157. package/skills/octocode-code-engineer/scripts/ast/tree-sitter.js +0 -1
  158. package/skills/octocode-code-engineer/scripts/ast/ts-analyzer.js +0 -1
  159. package/skills/octocode-code-engineer/scripts/collectors/chains.js +0 -1
  160. package/skills/octocode-code-engineer/scripts/collectors/effects.js +0 -1
  161. package/skills/octocode-code-engineer/scripts/collectors/input-sources.js +0 -1
  162. package/skills/octocode-code-engineer/scripts/collectors/performance.js +0 -1
  163. package/skills/octocode-code-engineer/scripts/collectors/prototype-pollution.js +0 -1
  164. package/skills/octocode-code-engineer/scripts/collectors/security.js +0 -1
  165. package/skills/octocode-code-engineer/scripts/collectors/test-profile.js +0 -1
  166. package/skills/octocode-code-engineer/scripts/common/is-direct-run.js +0 -1
  167. package/skills/octocode-code-engineer/scripts/common/utils.js +0 -1
  168. package/skills/octocode-code-engineer/scripts/detectors/code-quality.js +0 -1
  169. package/skills/octocode-code-engineer/scripts/detectors/cohesion.js +0 -1
  170. package/skills/octocode-code-engineer/scripts/detectors/coupling.js +0 -1
  171. package/skills/octocode-code-engineer/scripts/detectors/cycle.js +0 -1
  172. package/skills/octocode-code-engineer/scripts/detectors/dead-code.js +0 -1
  173. package/skills/octocode-code-engineer/scripts/detectors/import-style.js +0 -1
  174. package/skills/octocode-code-engineer/scripts/detectors/index.js +0 -1
  175. package/skills/octocode-code-engineer/scripts/detectors/security.js +0 -1
  176. package/skills/octocode-code-engineer/scripts/detectors/semantic.js +0 -1
  177. package/skills/octocode-code-engineer/scripts/detectors/shared.js +0 -1
  178. package/skills/octocode-code-engineer/scripts/detectors/test-quality.js +0 -1
  179. package/skills/octocode-code-engineer/scripts/index.js +0 -1
  180. package/skills/octocode-code-engineer/scripts/pipeline/cache.js +0 -1
  181. package/skills/octocode-code-engineer/scripts/pipeline/cli.js +0 -1
  182. package/skills/octocode-code-engineer/scripts/pipeline/main.js +0 -2
  183. package/skills/octocode-code-engineer/scripts/reporting/analysis.js +0 -1
  184. package/skills/octocode-code-engineer/scripts/reporting/summary-md.js +0 -1
  185. package/skills/octocode-code-engineer/scripts/reporting/writer.js +0 -1
  186. package/skills/octocode-code-engineer/scripts/types/constants.js +0 -1
  187. package/skills/octocode-code-engineer/scripts/types/index.js +0 -1
  188. package/skills/octocode-code-engineer/scripts/types/interfaces.js +0 -1
  189. package/skills/octocode-code-engineer/src/analysis/dependencies.ts +0 -406
  190. package/skills/octocode-code-engineer/src/index.ts +0 -403
  191. package/skills/octocode-code-engineer/src/reporting/summary-md.test.ts +0 -421
  192. package/skills/octocode-code-engineer/src/reporting/summary-md.ts +0 -714
  193. package/skills/octocode-code-engineer/src/types/interfaces.ts +0 -682
  194. package/skills/octocode-research/src/types/toolTypes.ts +0 -33
  195. package/skills/octocode-research/src/utils/logEmoji.ts +0 -103
  196. /package/skills/{octocode-code-engineer → octocode-engineer}/.octocode/rfc/RFC-code-engineer-weakness-fixes.md +0 -0
  197. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/architecture.ts.html +0 -0
  198. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ast-helpers.ts.html +0 -0
  199. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ast-search.ts.html +0 -0
  200. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/base.css +0 -0
  201. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/block-navigation.js +0 -0
  202. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/cache.ts.html +0 -0
  203. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/cli.ts.html +0 -0
  204. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/clover.xml +0 -0
  205. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-effects.ts.html +0 -0
  206. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-input-sources.ts.html +0 -0
  207. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-performance.ts.html +0 -0
  208. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-prototype-pollution.ts.html +0 -0
  209. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-security.ts.html +0 -0
  210. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-test-profile.ts.html +0 -0
  211. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/coverage-final.json +0 -0
  212. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/dependencies.ts.html +0 -0
  213. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/dependency-summary.ts.html +0 -0
  214. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/discovery.ts.html +0 -0
  215. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/favicon.png +0 -0
  216. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/graph-analytics.ts.html +0 -0
  217. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/index.html +0 -0
  218. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/index.ts.html +0 -0
  219. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/metrics.ts.html +0 -0
  220. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/pipeline.ts.html +0 -0
  221. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/prettify.css +0 -0
  222. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/prettify.js +0 -0
  223. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/report-analysis.ts.html +0 -0
  224. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/report-writer.ts.html +0 -0
  225. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/security-detectors.ts.html +0 -0
  226. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/semantic-detectors.ts.html +0 -0
  227. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/semantic.ts.html +0 -0
  228. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/sort-arrow-sprite.png +0 -0
  229. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/sorter.js +0 -0
  230. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/summary-md.ts.html +0 -0
  231. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/test-quality-detectors.ts.html +0 -0
  232. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/tree-sitter-analyzer.ts.html +0 -0
  233. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ts-analyzer.ts.html +0 -0
  234. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/types.ts.html +0 -0
  235. /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/utils.ts.html +0 -0
  236. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependencies.test.ts +0 -0
  237. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependency-summary.test.ts +0 -0
  238. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependency-summary.ts +0 -0
  239. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/graph-analytics.test.ts +0 -0
  240. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/graph-analytics.ts +0 -0
  241. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/semantic.test.ts +0 -0
  242. /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/semantic.ts +0 -0
  243. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/helpers.test.ts +0 -0
  244. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/helpers.ts +0 -0
  245. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/metrics.test.ts +0 -0
  246. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/metrics.ts +0 -0
  247. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-search.test.ts +0 -0
  248. /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-search.ts +0 -0
  249. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/chains.ts +0 -0
  250. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/effects.test.ts +0 -0
  251. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/effects.ts +0 -0
  252. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/input-sources.test.ts +0 -0
  253. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/input-sources.ts +0 -0
  254. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/performance.test.ts +0 -0
  255. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/performance.ts +0 -0
  256. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/prototype-pollution.test.ts +0 -0
  257. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/prototype-pollution.ts +0 -0
  258. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/test-profile.test.ts +0 -0
  259. /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/test-profile.ts +0 -0
  260. /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/is-direct-run.test.ts +0 -0
  261. /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/is-direct-run.ts +0 -0
  262. /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/utils.test.ts +0 -0
  263. /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/utils.ts +0 -0
  264. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/cohesion.ts +0 -0
  265. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/coupling.ts +0 -0
  266. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/cycle.ts +0 -0
  267. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/dead-code.ts +0 -0
  268. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/import-style.ts +0 -0
  269. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/index.test.ts +0 -0
  270. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/security.test.ts +0 -0
  271. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/security.ts +0 -0
  272. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/semantic.ts +0 -0
  273. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/shared.ts +0 -0
  274. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/test-quality.test.ts +0 -0
  275. /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/test-quality.ts +0 -0
  276. /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cache.test.ts +0 -0
  277. /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cache.ts +0 -0
  278. /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/main.test.ts +0 -0
  279. /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline.test.ts +0 -0
  280. /package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/analysis.test.ts +0 -0
  281. /package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/analysis.ts +0 -0
  282. /package/skills/{octocode-code-engineer → octocode-engineer}/vitest.config.ts +0 -0
@@ -1,304 +0,0 @@
1
- # Improvement Roadmap
2
-
3
- Research-backed upgrade plan for the weakest parts of the skill: security analysis, test-quality analysis, semantic analysis, output/reporting, and test-suite quality.
4
-
5
- For validation policy, see the Principles section in [SKILL.md](../SKILL.md) and [validate & investigate](./validate-investigate.md).
6
-
7
- **Status legend**: Done, Partial, Planned
8
-
9
- ---
10
-
11
- ## 1. Security Analysis
12
-
13
- ### Current weakness
14
-
15
- The current security layer is strong on breadth but still depends heavily on single-file heuristics. That creates false positives for patterns that look dangerous but are not proven dangerous in context.
16
-
17
- ### Target architecture
18
-
19
- Move from isolated pattern detection to a lightweight taint model:
20
-
21
- `sources -> propagators -> sanitizers -> sinks -> evidence trace`
22
-
23
- Keep cheap AST rules for obvious cases:
24
- - `eval`
25
- - `new Function`
26
- - direct `innerHTML`
27
- - hardcoded secrets
28
-
29
- Upgrade the noisier rules to dataflow-backed analysis:
30
- - `prototype-pollution-risk`
31
- - `sql-injection-risk`
32
- - `unsafe-html`
33
- - `unvalidated-input-sink`
34
- - `input-passthrough-risk`
35
-
36
- ### Concrete upgrades
37
-
38
- - Add sink-specific rule models for SQL, HTML, command execution, file writes, path joins, and object merge/write sites.
39
- - Add sanitizer catalogs for common validation and encoding patterns.
40
- - Add confidence scoring per rule: `high`, `medium`, `low`.
41
- - Add finding evidence: source parameter, propagation steps, sink call, sanitizer status.
42
- - Suppress structural false positives where the dynamic key is synthesized locally and never user-controlled.
43
-
44
- ### P0 work
45
-
46
- - Split current security detectors into `pattern` rules and `flow` rules. *(Partial — detectors use evidence/confidence/ruleId)*
47
- - Add fixture tests for true positive and false positive pairs. *(Partial — test file exists)*
48
- - Add `confidence` and `evidence` fields to security findings. *(Done — `toSecurityFinding` in security.ts)*
49
-
50
- ### P1 work
51
-
52
- - Build intra-procedural taint tracking inside a function body. *(Planned)*
53
- - Add reusable source/sink/sanitizer definitions. *(Planned)*
54
- - Add validation playbooks for each security category using Octocode local tools. *(Partial — playbooks.md covers some)*
55
-
56
- ---
57
-
58
- ## 2. Test-Quality Analysis
59
-
60
- ### Current weakness
61
-
62
- The current test-quality pass mostly counts assertions, mocks, and setup hooks. That is helpful, but still shallow for real flakiness and false-confidence detection.
63
-
64
- ### Target architecture
65
-
66
- Extend test analysis from simple counters to behavior-aware checks:
67
-
68
- - assertion presence
69
- - assertion reachability on all paths
70
- - cleanup and restore behavior
71
- - deterministic execution
72
- - framework misuse
73
-
74
- ### Concrete upgrades
75
-
76
- - Detect async tests that neither `await` nor return a promise.
77
- - Detect `test.only`, `describe.only`, `skip`, and `todo`.
78
- - Detect fake timers without restore and mock/spy state not reset or restored.
79
- - Detect time, randomness, environment, and global-state coupling.
80
- - Detect snapshot-only tests and interaction-only tests with no outcome assertions.
81
- - Detect cleanup that exists on one path but not all paths.
82
-
83
- ### P0 work
84
-
85
- - Add dedicated detector tests for test-quality rules. *(Done — test-quality.test.ts)*
86
- - Add rules for focused tests, fake timers without restore, and missing mock restoration. *(Done — all 8 categories implemented)*
87
- - Add a richer `testProfile` summary for timers, mocks, async patterns, and cleanup hooks. *(Done — TestProfile in interfaces.ts)*
88
-
89
- ### P1 work
90
-
91
- - Add code-path-aware assertion and cleanup checks. *(Planned)*
92
- - Add framework-specific adapters for Vitest/Jest style APIs. *(Planned)*
93
- - Add flaky-test tags and recommended remediation steps. *(Planned)*
94
-
95
- ---
96
-
97
- ## 3. Semantic Analysis
98
-
99
- ### Current weakness
100
-
101
- Semantic analysis is valuable, but it currently rebuilds a fresh TypeScript language service and uses a constant script version. That limits scale and wastes work on repeated scans.
102
-
103
- ### Target architecture
104
-
105
- Adopt a persistent project-backed semantic engine:
106
-
107
- - cache by `tsconfig`
108
- - track file versions
109
- - reuse TypeScript project state across scans
110
- - support project references cleanly
111
-
112
- ### Concrete upgrades
113
-
114
- - Replace ad hoc `LanguageService` creation with a project-service wrapper.
115
- - Separate semantic fact collection from detector execution.
116
- - Cache export references, inheritance chains, implementation maps, and symbol relationships.
117
- - Expose semantic facts to detectors through a stable query surface instead of repeated tree walks.
118
-
119
- ### P0 work
120
-
121
- - Introduce a semantic cache keyed by root + tsconfig + file versions. *(Planned)*
122
- - Stop hardcoding script version `"1"`. *(Planned)*
123
- - Benchmark semantic scan cost before and after caching. *(Planned)*
124
-
125
- ### P1 work
126
-
127
- - Move to a Project Service style lifecycle. *(Planned)*
128
- - Support project references and monorepo workspaces. *(Planned)*
129
- - Share semantic state between multiple detectors in a single run. *(Partial — `runSemanticDetectors` shares ctx)*
130
-
131
- ---
132
-
133
- ## 4. Output & Reporting
134
-
135
- ### Current weakness
136
-
137
- The output is rich, but report generation is currently brittle and the output contract is not explicit enough to protect downstream tooling.
138
-
139
- ### Target architecture
140
-
141
- Treat findings and reports as a versioned API:
142
-
143
- - one normalized internal result model
144
- - multiple emitters from that model
145
- - stable schema version
146
- - stable rule IDs
147
- - optional SARIF output
148
-
149
- ### Concrete upgrades
150
-
151
- - Normalize `summary.json`, `findings.json`, and Markdown generation around one canonical result object.
152
- - Add `schemaVersion`, `confidence`, `evidence`, and `ruleId`.
153
- - Add SARIF emission with stable fingerprints.
154
- - Add diff/baseline mode so teams can adopt the tool incrementally.
155
- - Add contract tests for output shapes and golden tests for Markdown rendering.
156
-
157
- ### P0 work
158
-
159
- - Fix the report regression first. *(Done)*
160
- - Add dedicated golden tests for `summary.md`, `summary.json`, and `findings.json`. *(Done — output-contract.test.ts)*
161
- - Add contract assertions around required keys and nullable fields. *(Done — schemaVersion, REPORT_SCHEMA_VERSION)*
162
-
163
- ### P1 work
164
-
165
- - Add SARIF emitter. *(Planned)*
166
- - Add baseline and diff output modes. *(Planned)*
167
- - Add category-level and confidence-level summary slices. *(Planned)*
168
-
169
- ---
170
-
171
- ## 5. Test-Suite Quality
172
-
173
- ### Current weakness
174
-
175
- The suite is large, but the failing report tests show that critical output paths can still regress together. Some important detector modules do not have focused test files.
176
-
177
- ### Target architecture
178
-
179
- Use layered testing:
180
-
181
- - focused detector unit tests
182
- - integration tests for orchestration
183
- - golden tests for reports
184
- - property-based tests for AST invariants
185
- - mutation testing for critical rules
186
-
187
- ### Concrete upgrades
188
-
189
- - Add dedicated tests for `security-detectors`, `test-quality-detectors`, and `tree-sitter-analyzer`.
190
- - Add property-based tests for AST search and report invariants.
191
- - Add mutation testing for high-risk detectors and output generation.
192
- - Add smoke tests that run the scanner against its own source and assert key categories.
193
-
194
- ### P0 work
195
-
196
- - Restore a green Vitest run. *(Done)*
197
- - Add missing focused test files. *(Partial — 34 test files, some detector modules still untested)*
198
- - Lock down report and findings schema expectations. *(Done — output-contract.test.ts)*
199
-
200
- ### P1 work
201
-
202
- - Add property-based tests with `fast-check`. *(Planned)*
203
- - Add mutation testing with Stryker for critical modules. *(Planned)*
204
- - Add self-scan fixture snapshots for detector stability. *(Planned)*
205
-
206
- ---
207
-
208
- ## 6. Architecture Analysis Depth
209
-
210
- ### Current weakness
211
-
212
- The current architecture layer is strongest at file-level import analysis and architecture heuristics, but it still underuses graph science and AST/dataflow techniques that would make boundary and coupling defects more explainable.
213
-
214
- ### Target architecture
215
-
216
- Treat architecture analysis as a hybrid of graph evidence and structural evidence:
217
-
218
- - graph evidence for dependency shape, chokepoints, layering, and subsystem boundaries
219
- - AST/semantic evidence for code roles, boundary leaks, side effects, and repeated orchestration
220
-
221
- ### Graph technique upgrades
222
-
223
- - Add SCC condensation graphs so large file-level cycles collapse into interpretable cycle clusters.
224
- - Add folder/package graphs to surface subsystem-level cycles and cross-boundary chatter.
225
- - Add articulation-point and bridge-edge detection to identify brittle chokepoints.
226
- - Add broker or betweenness-centrality scoring to find modules that mediate too many paths.
227
- - Add change-coupling overlays from git history to catch architecture defects the import graph misses.
228
-
229
- ### AST and semantic technique upgrades
230
-
231
- - Add relational or composite AST rules for architecture motifs, not just single-node patterns.
232
- - Add symbol-level usage graphs so cohesion and feature-envy checks work below the file level.
233
- - Add CFG/dataflow checks for boundary leaks, initialization order, and validation-before-sink behavior.
234
- - Add import-time effect tracing to classify module-scope I/O, registration, and global mutation.
235
- - Add boundary-role detection so controllers, services, domain modules, and infrastructure code can be checked semantically instead of only by path names.
236
-
237
- ### P0 work
238
-
239
- - Expand the docs and playbooks so agents interpret architecture findings through graph and AST lenses together. *(Done — tool-workflows.md, playbooks.md)*
240
- - Surface existing hub-node and hotspot signals more explicitly in result reading guidance. *(Done — hotFiles in summary.md)*
241
- - Add fixture-based tests for graph-hotspot interpretation and architecture-summary rendering. *(Partial)*
242
-
243
- ### P1 work
244
-
245
- - Implement SCC condensation and package-level dependency views. *(Partial — SCC clusters implemented in graph-analytics.ts)*
246
- - Add broker centrality and articulation-point scoring to hotspot analysis. *(Done — broker-module, bridge-module in graph-analytics.ts)*
247
- - Add relational AST rules for boundary leaks, split-brain modules, and import-time orchestration. *(Partial — import-side-effect-risk implemented)*
248
-
249
- ### P2 work
250
-
251
- - Add lightweight local dataflow for architecture rules.
252
- - Combine graph scores with AST evidence into a single architecture-confidence model.
253
- - Add change-coupling overlays and folder/community clustering for subsystem discovery.
254
-
255
- ---
256
-
257
- ## Delivery Phases
258
-
259
- ### Phase 0: Stabilize
260
-
261
- - Fix output/reporting regressions.
262
- - Make Vitest green.
263
- - Add missing focused tests.
264
- - Enforce Octocode local-tool validation in the skill docs and playbooks.
265
- - Tighten architecture reading guidance around graph and AST signals.
266
-
267
- ### Phase 1: Improve Precision
268
-
269
- - Add security taint modeling inside a function body.
270
- - Add richer test-quality rules for cleanup, timers, mocks, and async behavior.
271
- - Add confidence and evidence fields to findings.
272
-
273
- ### Phase 2: Improve Scale
274
-
275
- - Add persistent semantic state and project-backed analysis.
276
- - Add semantic fact caching.
277
- - Add baseline/diff mode and SARIF output.
278
-
279
- ### Phase 3: Deepen Coverage
280
-
281
- - Add optional interprocedural summaries.
282
- - Add property-based and mutation testing.
283
- - Externalize more AST-only rules into rule packs.
284
- - Add deeper graph and subsystem analysis for architecture defects.
285
-
286
- ---
287
-
288
- ## Research Basis
289
-
290
- - TypeScript Compiler API wiki: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API
291
- - typescript-eslint Project Service docs: https://typescript-eslint.io/packages/project-service/generated/
292
- - typescript-eslint Project Service blog: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/website/blog/2025-05-29-project-service.mdx
293
- - Semgrep taint analysis overview: https://github.com/semgrep/semgrep-docs/blob/main/docs/writing-rules/data-flow/taint-mode/overview.md
294
- - ast-grep relational rules: https://github.com/ast-grep/ast-grep.github.io/blob/main/website/guide/rule-config/relational-rule.md
295
- - ESLint code path analysis: https://eslint.org/docs/latest/extend/code-path-analysis
296
- - Tree-sitter predicates and directives: https://tree-sitter.github.io/tree-sitter/using-parsers/queries/3-predicates-and-directives.html
297
- - dependency-cruiser rules reference: https://github.com/sverweij/dependency-cruiser/blob/main/doc/rules-reference.md
298
- - CodeQL data flow analysis: https://github.com/github/codeql/blob/main/docs/codeql/writing-codeql-queries/about-data-flow-analysis.rst
299
- - CodeQL JS/TS data flow guide: https://github.com/github/codeql/blob/main/docs/codeql/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript.rst
300
- - Vitest coverage reporters: https://github.com/vitest-dev/vitest/blob/main/docs/config/coverage.md
301
- - Vitest timers guide: https://vitest.dev/guide/mocking/timers
302
- - Stryker JS usage: https://github.com/stryker-mutator/stryker-js/blob/master/docs/usage.md
303
- - fast-check getting started: https://fast-check.dev/docs/introduction/getting-started/
304
- - GitHub SARIF fingerprints: https://docs.github.com/en/code-security/reference/code-scanning/sarif-files/sarif-support-for-code-scanning
@@ -1,204 +0,0 @@
1
- # Playbooks — Validate & Fix by Category
2
-
3
- Per-category guidance: which tools can help, what to check, and how to fix.
4
-
5
- For tool descriptions and LSP rules, see the **Tools** section in [SKILL.md](../SKILL.md).
6
- For investigation methodology, tool selection guide, taint tracing, and false positive dismissal, see [validate & investigate](./validate-investigate.md).
7
-
8
- Use `--graph-advanced` for SCC clusters, chokepoints, bridge modules, and package chatter. Use `--flow` for `cfgFlags`, `flowTrace`, and richer evidence.
9
-
10
- The tables below show CLI and Octocode MCP approaches per category. **These are suggestions, not rigid sequences** — pick the tools that answer the question fastest.
11
-
12
- ---
13
-
14
- ## Architecture Playbooks
15
-
16
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
17
- |---------|-------------|----------------------|-----|
18
- | `dependency-cycle` | `--features=dependency-cycle` → read `architecture.json` cycle paths | `localSearchCode(import.*from)` on cycle files → `lspGotoDefinition` on import | Break with shared contracts or dependency inversion |
19
- | `dependency-critical-path` | `--graph` → inspect Mermaid for long chains | `localSearchCode(export)` on hub → `lspCallHierarchy(incoming)` | Split hub, enforce boundaries |
20
- | `architecture-sdp-violation` | Read finding `reason` for I values | `lspCallHierarchy(incoming)` on stable; `(outgoing)` on unstable | Invert via interface or move to stable utility |
21
- | `high-coupling` | `--json \| jq` filter for `high-coupling` → check Ca/Ce | `lspFindReferences` on key exports → count consumers | Extract focused sub-modules by consumer group |
22
- | `god-module-coupling` | Check `hotFiles[]` in `architecture.json` for fan-in/fan-out | Fan-in: `lspFindReferences`; Fan-out: `lspCallHierarchy(outgoing)` | Split by responsibility, introduce facade |
23
- | `orphan-module` | `ast-search -p 'import $$$N from "modulePath"'` — 0 hits = orphan | `localSearchCode(fileName, filesOnly=true)` — check runtime config | Delete if disconnected |
24
- | `unreachable-module` | Same as orphan + check dynamic imports with `ast-search -p 'import($$$A)'` | `localSearchCode(moduleName)` — check dynamic imports | Delete subgraph if confirmed |
25
- | `layer-violation` | `--features=layer-violation --layer-order ui,service,repo` | `lspGotoDefinition` on violating import | Extract shared contracts to lower layer |
26
- | `low-cohesion` | Read finding `reason` for LCOM count + groups | `lspFindReferences` per export → map consumer clusters | Split into N focused modules |
27
- | `distance-from-main-sequence` | Read finding `reason` for A/I/D values + zone | Check `reason` for A/I/D values + zone | Add interfaces (Zone of Pain) or implementations (Zone of Uselessness) |
28
- | `feature-envy` | Check finding → compare import ratio | `lspCallHierarchy(outgoing)` on envious module → see which functions use target | Move logic to target module or extract shared module |
29
- | `cycle-cluster` | `--graph-advanced` → inspect `sccClusters[]` in `architecture.json` | `localSearchCode(import)` on hub files → `lspGotoDefinition` on cluster edges | Break SCC at a hub file or shared contract |
30
- | `broker-module` | `--graph-advanced` → inspect `chokepoints[]` and `criticalHubCandidates[]` | `lspFindReferences` for fan-in + `lspCallHierarchy(outgoing)` for fan-out | Split orchestration seams and narrow consumers |
31
- | `bridge-module` | `--graph-advanced` → inspect articulation-heavy `chokepoints[]` | `localSearchCode(fileName)` → trace the bridge edges with LSP | Remove the single structural bridge by adding lower-level contracts |
32
- | `package-boundary-chatter` | `--graph-advanced` → inspect `packageGraphSummary.hotspots[]` | `localSearchCode("from \\\"pkg\\\"")` on both sides → confirm symbol traffic | Reduce package API surface and stop internal-detail imports |
33
- | `startup-risk-hub` | `--graph-advanced` + `--features=startup-risk-hub` → inspect `topLevelEffects` + `chokepoints[]` | `lspFindReferences` on the module + `lspCallHierarchy` on effectful calls | Move import-time work behind explicit init or lazy paths |
34
- | `untested-critical-code` | `ast-search -p 'import $$$N from "modulePath"' --include-tests` — 0 test imports | `localFindFiles(name=*.test.*)` for sibling test → `lspCallHierarchy(incoming)` | Create test file covering public API + complex functions |
35
- | `import-side-effect-risk` | `--features=import-side-effect-risk` → check `topLevelEffects` in `file-inventory.json` | `lspFindReferences` on file → confirm fan-in; `lspCallHierarchy` on side-effect call → trace callers | Move side effects into explicit init(), wrap in lazy pattern, or guard with feature flags |
36
- | `namespace-import` | `ast-search -p 'import * as $NAME from $MOD'` | `localSearchCode("import * as")` → check which members are used | Convert to named imports for tree-shaking |
37
- | `commonjs-in-esm` | `ast-search -p 'require($$$A)'` | `localSearchCode("require(")` → check if ESM alternative exists | Convert to `import` syntax |
38
- | `export-star-leak` | `ast-search -p 'export * from $MOD'` | `localSearchCode("export * from")` → `lspFindReferences` on re-exported symbols | Replace with explicit named re-exports |
39
- | `mixed-module-format` | Check finding for mixed CJS/ESM evidence | `localGetFileContent` → confirm mixed `require()` and `import` | Standardize on ESM |
40
-
41
- ---
42
-
43
- ## Code Quality Playbooks
44
-
45
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
46
- |---------|-------------|----------------------|-----|
47
- | `duplicate-function-body` | `ast-search -p 'function $NAME($$$P) { $$$B }'` → compare matches | `localSearchCode` → `lspFindReferences` + `lspCallHierarchy(incoming)` | Extract shared helper |
48
- | `duplicate-flow-structure` | Read finding `reason` + line ranges → compare code | `localGetFileContent(startLine, endLine)` | Extract reusable flow helper |
49
- | `similar-function-body` | Read both file:line locations from finding | `localGetFileContent` on both locations → compare side-by-side | Parameterize differences into shared helper |
50
- | `function-optimization` | `--scope=file.ts:functionName` → check complexity breakdown | `lspCallHierarchy(incoming)` + `(outgoing)` | Split along responsibilities |
51
- | `cognitive-complexity` | `--scope=file.ts:functionName --features=cognitive-complexity` | `localGetFileContent(startLine, endLine)` + `lspCallHierarchy` | Early returns, extract nested blocks |
52
- | `god-module` | `--scope=file.ts` → check statement + export count | `localGetFileContent` → identify groups; `lspFindReferences` on exports → find consumer clusters | Extract each into dedicated module |
53
- | `god-function` | `--scope=file.ts:functionName` → check statement count | `localGetFileContent(startLine, endLine)` + `lspCallHierarchy` → map callees | Extract steps into named helpers |
54
- | `halstead-effort` | Read finding `reason` for effort/bugs/volume breakdown | `localGetFileContent` + `lspCallHierarchy(outgoing)` | Split into smaller functions |
55
- | `low-maintainability` | Read finding `reason` for MI components | Check `reason` for MI components | Reduce LOC, simplify expressions |
56
- | `excessive-parameters` | `ast-search -p 'function $NAME($A, $B, $C, $D, $E, $F)'` | `lspCallHierarchy(incoming)` → check caller diversity | Group into options object |
57
- | `unsafe-any` | `ast-search --preset any-type --root <package>` | `localSearchCode(": any\|as any")` | `unknown` + type guards, generics |
58
- | `empty-catch` | `ast-search --preset empty-catch --root <package>` | `localGetFileContent(startLine, endLine)` | Add logging or re-throw |
59
- | `switch-no-default` | `ast-search --preset switch-no-default` | `localGetFileContent(startLine, endLine)` | Add `default` with unreachable error |
60
- | `type-assertion-escape` | `ast-search --preset type-assertion` + `ast-search --preset non-null-assertion` | `localSearchCode("as any")` → review each occurrence | Replace with `unknown` + type guards, proper generics |
61
- | `missing-error-boundary` | `--features=missing-error-boundary` → check await counts (1=low, 2-3=med, 4+=high) | `localGetFileContent(startLine, endLine)` → check await calls; `lspCallHierarchy(incoming)` → check if callers wrap in try-catch | Wrap in try-catch, add `.catch()`, or document caller handling |
62
- | `promise-misuse` | `--features=promise-misuse` → list async-without-await | `localGetFileContent(startLine, endLine)` → check if await forgotten | Remove `async` keyword or add the missing `await` |
63
- | `message-chain` | `--features=message-chain` → read finding for depth and chain text | `localGetFileContent(startLine, endLine)` → read chain; `lspGotoDefinition` on root object → identify intermediate types | Add a delegating method on the root object (Tell, Don't Ask); replace chain with single call on immediate friend |
64
-
65
- ---
66
-
67
- ## Performance & Resource Playbooks
68
-
69
- > These categories appear under the **Code Quality** pillar in scan output.
70
-
71
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
72
- |---------|-------------|----------------------|-----|
73
- | `await-in-loop` | `ast-search -p 'await $EXPR' --root <dir>` + check if inside loop | `localGetFileContent(startLine, endLine)` → confirm loop+await pattern; `lspGotoDefinition` on awaited call | Collect promises, use `Promise.all()` or batch utility |
74
- | `sync-io` | `ast-search -p 'readFileSync($$$A)'` (or `writeFileSync`, etc.) | `localSearchCode("readFileSync\|writeFileSync")` → `lspCallHierarchy(incoming)` → check if in hot path | Replace with `fs.promises.*` async equivalents |
75
- | `uncleared-timer` | `ast-search -p 'setInterval($$$A)'` + search for `clearInterval` in same file | `localSearchCode("setInterval")` → check for `clearInterval` in same scope/cleanup | Store timer ID, call `clearInterval` in cleanup |
76
- | `listener-leak-risk` | `ast-search -p '.addEventListener($$$A)'` + `ast-search -p '.removeEventListener($$$A)'` — compare counts | `localSearchCode("addEventListener\|.on(")` → check for matching removal | Add `removeEventListener`/`.off()` in cleanup, or use `AbortController` |
77
- | `unbounded-collection` | `--scope=file.ts:functionName` → structural signal (loops × calls × depth) | **Read body**: `localGetFileContent(matchString=fnName)` → look for `.push/.add/.set` inside loops. **Trace**: `lspCallHierarchy(incoming)` → hot path? **Use `lspHints[]`** if present. **Dismiss** if no mutation in body or bounded by guard/limit | Add size limits, use pagination or streaming |
78
-
79
- ---
80
-
81
- ## Dead Code & Hygiene Playbooks
82
-
83
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
84
- |---------|-------------|----------------------|-----|
85
- | `dead-export` | `ast-search -p 'import { symbolName } from $MOD'` — 0 hits | `localSearchCode(export symbolName)` → `lspFindReferences(includeDeclaration=false)` — 0 refs | Remove export or delete symbol |
86
- | `dead-re-export` | `ast-search -p 'import { symbolName } from "barrelPath"'` — 0 hits | `localSearchCode(export.*from)` on barrel → `lspFindReferences` | Remove stale re-export |
87
- | `redundant-re-export` | Read barrel → `ast-search -p 'export { $SYM } from $MOD'` → check each for consumers | `lspFindReferences` on each re-exported symbol (from barrel, not source) → 0 consumer refs = redundant | Remove the re-export line. If source module also has 0 refs, flag for deletion. For `export *` with <50% consumed symbols, replace with explicit named exports |
88
- | `re-export-duplication` / `re-export-shadowed` | Read barrel file → check duplicate export names | `localSearchCode(export {)` in barrel | Keep one source-of-truth per name |
89
- | `unused-npm-dependency` | `ast-search -p 'import $$$N from "packageName"'` — 0 hits; also check `require("packageName")` | `localSearchCode(packageName)` — check build scripts | Remove the dependency via the project's package manager, verify build |
90
- | `package-boundary-violation` | Read finding → check if import goes through public API (index file) | `lspGotoDefinition` on cross-package import | Re-export from target index |
91
- | `barrel-explosion` | Count re-exports in barrel file; `--features=barrel-explosion` | `localGetFileContent(barrel file)` | Group into sub-barrels |
92
- | `redundant-comment` | `ast-search --rule '{"rule":{"kind":"comment"}}'` → filter for narrating patterns | `localSearchCode("// Import\|// Define\|// Return\|// Set \|// Get \|// Handle\|// Create\|// Initialize\|// Check \|// Update")` → review each hit | Delete comments that restate code. Keep comments explaining *why*, trade-offs, constraints, or non-obvious intent. Rule: if removing the comment loses zero information, remove it |
93
-
94
- ---
95
-
96
- ## Security Playbooks
97
-
98
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
99
- |---------|-------------|----------------------|-----|
100
- | `hardcoded-secret` | `ast-search --rule '{"rule":{"kind":"string","regex":"password\|secret\|token"}}'` → check if test/mock data | `localSearchCode("password\|api_key\|token")` → `lspFindReferences` on variable → scope remediation | Move to environment variable or secrets manager |
101
- | `eval-usage` | `ast-search -p 'eval($$$A)'` + `ast-search -p 'new Function($$$A)'` | `localGetFileContent(startLine, endLine)` → `lspCallHierarchy(incoming)` → trace how user input reaches eval | Replace with `JSON.parse`, lookup table, or function reference |
102
- | `unsafe-html` | `ast-search -p '$OBJ.innerHTML = $VAL'` + `ast-search -p 'dangerouslySetInnerHTML'` | `localSearchCode("innerHTML\|dangerouslySetInnerHTML")` → check if input is sanitized | Use `textContent`, DOMPurify, or JSX instead |
103
- | `sql-injection-risk` | Read finding → check template literal for user-controlled interpolation | `localGetFileContent(startLine, endLine)` → check if interpolated values are user input | Use parameterized queries or query builder |
104
- | `unsafe-regex` | Read finding regex pattern → check for nested quantifiers | `localGetFileContent(startLine, endLine)` → `lspFindReferences` → check if user input reaches regex | Simplify nested quantifiers, use `safe-regex` linter |
105
- | `prototype-pollution-risk` | `ast-search -p 'Object.assign($$$A)'` + `ast-search -p '$OBJ[$KEY] = $VAL'` | `localGetFileContent(startLine, endLine)` → `lspCallHierarchy(incoming)` → trace if user data reaches merge/assign site | Validate keys (reject `__proto__`, `constructor`), use `Object.create(null)`, use `structuredClone()` |
106
- | `unvalidated-input-sink` | `--features=unvalidated-input-sink` → read finding for param names + sink kinds | `lspCallHierarchy(outgoing)` on function → trace where input params flow; `lspFindReferences` on param → check all usages | Add schema validation (zod, joi) before sink; use parameterized queries for SQL/exec |
107
- | `input-passthrough-risk` | `--features=input-passthrough-risk` → read finding for param confidence + callees | `lspCallHierarchy(outgoing)` → verify downstream callees validate input; `lspFindReferences` on param → check all usage points | Add validation at entry point; search for middleware/guard patterns upstream |
108
- | `path-traversal-risk` | `--features=path-traversal-risk` → read finding for source params + sink kinds | `lspCallHierarchy(incoming)` on fs.readFile/path.resolve call → trace if path param comes from user input → check for `path.resolve` + `startsWith` + `realpathSync` guards | Add multi-layer validation: normalize → prefix check → realpath → re-validate |
109
- | `command-injection-risk` | `--features=command-injection-risk` → read finding for exec vs spawn distinction | `lspCallHierarchy(incoming)` on exec/spawn call → check if args come from user input → verify spawn uses array args (safe) vs exec with string interpolation (dangerous) | Replace exec with spawn + array args; use command allowlist; never interpolate user input into command strings |
110
- | `debug-log-leakage` | `ast-search --preset debugger` + `ast-search --preset console-any` → filter debug/trace calls | `localGetFileContent(startLine, endLine)` → confirm call exists and is not inside a test file or LOG_LEVEL guard | Remove `debugger` statements; replace `console.debug/trace` with structured logger gated by log-level config |
111
- | `sensitive-data-logging` | `ast-search --preset console-any --root <dir>` → filter for sensitive argument patterns | `localGetFileContent(startLine, endLine)` → read full log call and its arguments; `lspCallHierarchy(incoming)` → trace where the sensitive value originates | Remove raw sensitive values from log args; use `{ ...obj, password: "[REDACTED]" }` pattern; configure pino/winston redact option at the logger level |
112
-
113
- For taint tracing methodology, false positive dismissal criteria, and agentic security paths, see [validate & investigate](./validate-investigate.md).
114
-
115
- ---
116
-
117
- ## Test Quality Playbooks
118
-
119
- | Finding | CLI Validate | Octocode MCP Validate | Fix |
120
- |---------|-------------|----------------------|-----|
121
- | `low-assertion-density` | `ast-search -p 'expect($$$A)' --include-tests --root <test-file>` → count per `it()` block | `localSearchCode("expect\|assert")` in file → count assertions per test | Add meaningful assertions to each test case |
122
- | `test-no-assertion` | Read finding → check specific `it()`/`test()` block at line range | `localGetFileContent(startLine, endLine)` → confirm no expect/assert inside test block | Add at least one assertion verifying behavior |
123
- | `excessive-mocking` | `ast-search -p 'vi.mock($$$A)' --include-tests` + `ast-search -p 'jest.mock($$$A)' --include-tests` — count | `localSearchCode("jest.mock\|vi.mock\|sinon")` → count mock calls | Reduce mocks by testing through public interfaces; use DI |
124
- | `shared-mutable-state` | Read finding → check `let`/`var` at describe scope | `localGetFileContent(startLine, endLine)` → confirm let/var at describe scope | Move to `beforeEach` or use `const` |
125
- | `missing-test-cleanup` | `ast-search -p 'beforeAll($$$A)' --include-tests` + check for `afterAll` in same file | `localSearchCode("beforeAll\|beforeEach\|afterAll\|afterEach")` → check pairing | Add corresponding `afterAll`/`afterEach` to clean up resources |
126
- | `focused-test` | `ast-search -p 'it.only($$$A)' --include-tests` + `ast-search -p 'describe.only($$$A)'` | `localSearchCode("\.only\|\.skip\|\.todo")` in test files → confirm committed focused/skipped tests | Remove `.only`/`.skip`/`.todo` before committing — use a pre-commit hook or lint rule to prevent regression |
127
- | `fake-timer-no-restore` | `ast-search -p 'vi.useFakeTimers($$$A)' --include-tests` + `ast-search -p 'jest.useFakeTimers($$$A)'` → check for matching restore | `localSearchCode("useFakeTimers\|useRealTimers")` → confirm each useFakeTimers has a corresponding useRealTimers | Add `afterEach(() => vi.useRealTimers())` or `jest.useRealTimers()` after each fake-timer setup |
128
- | `missing-mock-restoration` | `ast-search -p 'vi.spyOn($$$A)' --include-tests` + `ast-search -p 'jest.spyOn($$$A)'` → check for `.mockRestore()` | `localSearchCode("spyOn\|mockRestore\|restoreAllMocks")` → confirm each spy is restored | Add `mockRestore()` on each spy in `afterEach`, or use `vi.restoreAllMocks()`/`jest.restoreAllMocks()` in `afterEach` |
129
-
130
- ---
131
-
132
- ## Semantic Analysis Playbooks (`--semantic`)
133
-
134
- | Finding | CLI Validate | Octocode MCP Validate (use `lspHints`) | Fix |
135
- |---------|-------------|----------------------------------------|-----|
136
- | `semantic-dead-export` | `--features=semantic-dead-export --semantic` → read findings | `lspFindReferences(symbolName, lineHint)` → 0 refs confirms dead | Remove export or delete symbol (stricter than `dead-export`) |
137
- | `over-abstraction` | `ast-search -p 'implements $IFACE'` → count implementations | `lspFindReferences` on interface → exactly 1 implementor | Inline interface into concrete class, or keep if mocking needed |
138
- | `concrete-dependency` | Read finding → check import target is class not interface | `lspGotoDefinition` on import → resolves to class (not interface) | Extract interface, depend on abstraction (DIP) |
139
- | `circular-type-dependency` | `--features=circular-type-dependency` → read cycle paths | `lspFindReferences` on each type in cycle → see cross-refs | Extract shared types to common file |
140
- | `unused-parameter` | `ast-search -p 'function $NAME($$$BEFORE, paramName, $$$AFTER)'` → check body references | `lspFindReferences` on param → 0 non-declaration refs | Remove param or prefix with `_` |
141
- | `deep-override-chain` | Read finding for override chain depth | `lspGotoDefinition` → trace override chain | Use template method or strategy pattern |
142
- | `interface-compliance` | Read finding for missing/any-cast members | `lspGotoDefinition` on interface → compare members | Implement missing members; replace `any` with proper types |
143
- | `unused-import` | `--features=unused-import --semantic` | `lspFindReferences` on import → 0 usages | Remove unused import statement |
144
- | `orphan-implementation` | `ast-search -p 'import { className } from $MOD'` — 0 hits | `lspFindReferences` on class → 0 external refs | Wire into DI/module graph, or delete if truly dead |
145
- | `shotgun-surgery` | Read finding for reference count across files | `lspFindReferences(symbolName, lineHint)` → count unique files | Introduce facade/adapter or event-based decoupling |
146
- | `move-to-caller` | Read finding → confirm 1 consumer | `lspFindReferences(symbolName, lineHint)` → exactly 1 consumer file | Move symbol to consumer file or inline it |
147
- | `narrowable-type` | Read finding for broad vs narrow type info | `lspCallHierarchy(incoming)` → check argument types at all call sites | Narrow param type to match actual usage |
148
-
149
- ---
150
-
151
- ## Change Risk Hotspots
152
-
153
- `architecture.json` → `hotFiles[]`: riskScore = fan-in + complexity + exports + cycle/critical-path membership.
154
-
155
- **CLI check**: `jq '.hotFiles[:5]' .octocode/scan/<ts>/architecture.json`
156
-
157
- **Octocode check**: `lspFindReferences` on top hotfile exports → map consumer blast radius.
158
-
159
- Prioritize for refactoring.
160
-
161
- ## Mega-Folder Restructuring
162
-
163
- When the scan reports a mega-folder finding (flat directory with many loosely related files):
164
-
165
- 1. **Map the import graph.** Use `localSearchCode` or `rg` to extract `from './...'` imports. Group files into clusters. Use LSP to confirm boundaries when ambiguous.
166
- 2. **Design target structure.** Name directories after their role (e.g., types → parsing → analysis → detection → reporting).
167
- 3. **Write a migration script.** Disposable Node.js/shell script that moves files and rewrites all relative import paths atomically. Path resolution: same dir → `./name.js`, root→subdir → `./subdir/name.js`, subdir→root → `../name.js`, across subdirs → `../other/name.js`.
168
- 4. **Validate.** Run the project's lint, build, and test scripts after migration (see Project Environment in SKILL.md).
169
- 5. **Delete the migration script.** One-shot tool, not part of the codebase.
170
-
171
- Prefer this over manual file-by-file moves when a directory has 15+ files in clearly separable domains.
172
-
173
- ---
174
-
175
- ## Fix Validation Playbook
176
-
177
- After every fix batch, run the project's toolchain to catch regressions:
178
-
179
- | Step | Command | On Failure |
180
- |------|---------|------------|
181
- | 1. Lint (auto-fix) | `<pm> run lint --fix` (if supported) or `<pm> run lint` | Fix lint errors in changed code. Pre-existing errors: note but don't block |
182
- | 2. Tests | `<pm> run test` (scoped to package in monorepos) | Investigate immediately. If your fix broke it, revert or correct. Pre-existing: note and continue |
183
- | 3. Build | `<pm> run build` (scoped to package in monorepos) | Likely missing export or type error from your change — fix before continuing |
184
-
185
- **Detect lint auto-fix support**: check if the `lint` script wraps eslint (`--fix`), biome (`--write`), or oxlint (`--fix`). If uncertain, run without `--fix` first.
186
-
187
- **Monorepo scoping**: prefer `<pm> workspace <pkg> test` or `cd packages/<pkg> && <pm> run test` over root-level runs — faster feedback loop.
188
-
189
- ---
190
-
191
- ## TDD Fix Playbook
192
-
193
- For behavioral fixes (logic changes, bug fixes, refactors that change observable behavior):
194
-
195
- | Step | Action | Tool |
196
- |------|--------|------|
197
- | 1. Understand behavior | Read the code and its callers | `localGetFileContent`, `lspCallHierarchy(incoming)` |
198
- | 2. Write failing test | Add a test that describes the expected post-fix behavior | Manual edit in test file |
199
- | 3. Run test | Confirm it fails for the right reason | `<pm> run test -- <test-file>` |
200
- | 4. Apply fix | Make the minimal change | Edit source file |
201
- | 5. Run test | Confirm it passes | `<pm> run test -- <test-file>` |
202
- | 6. Run full suite | Confirm no regressions | `<pm> run test` |
203
-
204
- **Skip TDD for**: comment removal, dead re-export deletion, import path rewrites, formatting, any change where the test would just assert "file doesn't contain X" — those are validated by lint + build instead.
@@ -1,136 +0,0 @@
1
- # Present Results
2
-
3
- Read `summary.md` first — it has everything needed for a top-level presentation. Only drill into feature JSONs for investigation.
4
-
5
- For confidence tiers and how to label findings, see the **Confidence Tiers** table in [SKILL.md](../SKILL.md).
6
-
7
- ---
8
-
9
- ## Summary Sections
10
-
11
- Fixed order — read top-down, stop when enough:
12
-
13
- 1. **Scan Scope** — files, functions, flows, dependency files, packages
14
- 2. **Findings Overview** — severity table + truncation notice + features-filter / scope / semantic notices
15
- 3. **Health Scores** — 0-100 per pillar (Overall, Architecture, Code Quality, Dead Code, and conditionally Security, Test Quality) with letter grades (A-F)
16
- 4. **Top Concern Tags** — searchable tags ranked by frequency, top 12 (filter `findings.json` with `jq '.optimizationFindings[] | select(.tags | contains(["coupling"]))'`)
17
- 5. **Analysis Signals** — strongest graph signal, strongest AST signal, combined interpretation, confidence, recommended validation
18
- 6. **Architecture Health** — dep graph metrics (modules, edges, cycles, critical paths, roots, leaves, test-only, unresolved) + all architecture categories with counts (0 = clean, `skipped` = filtered)
19
- 7. **Change Risk Hotspots** — top 15 riskiest files (riskScore, fanIn, fanOut, complexity, exports, cycle/critical-path flags)
20
- 8. **Code Quality** — all code-quality categories with counts
21
- 9. **Dead Code & Hygiene** — all dead-code categories with counts
22
- 10. **Security** *(conditional — only when security findings exist)* — all security categories with counts
23
- 11. **Test Quality** *(conditional — only when test quality findings exist)* — all test-quality categories with counts
24
- 12. **Top Recommendations** — 10 highest-severity findings (diverse by `--max-recs-per-category`)
25
- 13. **AST Trees** *(conditional — only when tree output enabled)* — format guide + grep commands for navigation
26
- 14. **Output Files** — table with file names, sizes, descriptions
27
- 15. **Parse Errors** *(conditional — only when files failed to parse)* — up to 10 parse failures with file + message
28
-
29
- ---
30
-
31
- ## Decision Heuristics
32
-
33
- The summary is not just a list of findings. Use it to choose the right investigation path.
34
-
35
- When the summary is ambiguous:
36
-
37
- - rerun with `--graph --graph-advanced` if the question is about cycles, chokepoints, package chatter, or startup risk
38
- - rerun with `--flow` if the question is about validation paths, cleanup behavior, or path-sensitive evidence
39
- - if graph and AST signals conflict, present that conflict and recommend a hybrid investigation instead of forcing one explanation
40
-
41
- ### Graph-first signals
42
-
43
- Use graph-first language when the summary shows:
44
-
45
- - non-trivial `dependency-cycle` counts
46
- - multiple `criticalPaths`
47
- - high-risk entries in **Change Risk Hotspots**
48
- - `layer-violation`, `inferred-layer-violation`, or `distance-from-main-sequence`
49
- - `import-side-effect-risk` on high fan-in modules
50
-
51
- Good phrases:
52
-
53
- - "The architecture risk is concentrated around a small set of chokepoint modules."
54
- - "The dependency graph suggests a boundary leak between layers."
55
- - "The import graph shows startup risk because a high fan-in module performs work at import time."
56
-
57
- ### AST-first signals
58
-
59
- Use AST-first language when the summary shows:
60
-
61
- - `low-cohesion` paired with `feature-envy`
62
- - duplicate flow or similar-function findings
63
- - large top-level side effects in `file-inventory.json`
64
- - structurally repeated orchestration or control-flow complexity
65
-
66
- Good phrases:
67
-
68
- - "The code shape suggests this module is doing multiple unrelated jobs."
69
- - "The repeated control-flow structure suggests orchestration duplication rather than an isolated bug."
70
- - "The AST evidence points to hidden initialization logic at module scope."
71
-
72
- ### Combined signals
73
-
74
- Escalate when graph and AST signals align:
75
-
76
- - `critical-path` + `low-maintainability`
77
- - `feature-envy` + `layer-violation`
78
- - `import-side-effect-risk` + high `fanIn`
79
- - `low-cohesion` + many exports + disjoint consumers
80
-
81
- When they align, say so explicitly. That helps the user prioritize architectural work over local cleanup.
82
-
83
- ---
84
-
85
- ## Presentation Template
86
-
87
- ```markdown
88
- ## Scan Summary
89
- - **Scope**: <n> files, <n> functions, <n> flows, <n> dependency edges
90
- - **Health**: Overall <n>/100 (grade) | Architecture <n>/100 | Quality <n>/100 | Hygiene <n>/100
91
- - **Findings**: <n> total — <n> critical, <n> high, <n> medium, <n> low
92
- - **Top Tags**: `coupling` (<n>), `dead-code` (<n>), `complexity` (<n>)
93
- - **Graph Signal**: <highest-signal graph interpretation backed by summary/architecture.json>
94
- - **AST Signal**: <highest-signal structural interpretation backed by findings/file-inventory>
95
- - **Combined Interpretation**: <how the graph and AST signals align or conflict>
96
- - **Confidence**: <high|medium|low>
97
- - **Recommended Validation**: <next Octocode local-tool step>
98
-
99
- ## Top Findings (by severity)
100
- ### Critical
101
- - `<file>:<line>` — <title> — <reason>
102
- ### High
103
- - `<file>:<line>` — <title> — <reason>
104
-
105
- ## Next Step
106
- Which findings should I investigate first?
107
- ```
108
-
109
- Severity order: `critical` > `high` > `medium` > `low` > `info`.
110
-
111
- ---
112
-
113
- ## Example Output
114
-
115
- A condensed real scan result for reference:
116
-
117
- ```markdown
118
- ## Scan Summary
119
- - **Scope**: 47 files, 312 functions, 89 flows, 186 dependency edges across 1 package
120
- - **Health**: Overall 61/100 (D) | Architecture 54/100 | Quality 72/100 | Hygiene 58/100
121
- - **Findings**: 83 total — 2 critical, 14 high, 41 medium, 26 low (capped to 50 by --findings-limit)
122
- - **Top Tags**: `coupling` (12), `dead-code` (9), `complexity` (8), `change-risk` (6), `duplication` (5)
123
-
124
- ## Top Findings (by severity)
125
- ### Critical
126
- - `src/tools/toolsManager.ts:45` — Critical dependency chain risk: 27 files — Break chain at `src/providers/factory.ts` (fan-out: 12, fan-in: 8) *(dependency-critical-path)*
127
- - `src/server.ts:12` — Dependency cycle detected (4 node cycle) — src/server.ts -> src/session.ts -> src/config.ts -> src/server.ts *(dependency-cycle)*
128
-
129
- ### High
130
- - `src/utils/helpers.ts:1` — 6 unused exports — Exported symbols have no observed import usage *(dead-export)*
131
- - `src/providers/github.ts:89` — Potential function refactor: fetchWithRetries — Cyclomatic-like complexity is high (>=30). Branch depth is very deep. *(function-optimization)*
132
- - `src/tools/localSearch.ts:142` — Input passthrough without validation — Parameter `query` flows to child_process.spawn without sanitization *(input-passthrough-risk)*
133
-
134
- ## Next Step
135
- Which findings should I investigate first?
136
- ```