octocode-cli 1.2.6 → 1.2.7

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 (303) hide show
  1. package/LICENSE +21 -63
  2. package/README.md +85 -142
  3. package/out/octocode-cli.js +7026 -6945
  4. package/package.json +8 -6
  5. package/skills/README.md +97 -120
  6. package/skills/octocode-code-engineer/.claude/settings.local.json +18 -0
  7. package/skills/octocode-code-engineer/.octocode/rfc/RFC-code-engineer-weakness-fixes.md +255 -0
  8. package/skills/octocode-code-engineer/.plan/VALIDATED_PLAN.md +223 -0
  9. package/skills/octocode-code-engineer/README.md +178 -0
  10. package/skills/octocode-code-engineer/SKILL.md +418 -0
  11. package/skills/octocode-code-engineer/coverage/architecture.ts.html +7828 -0
  12. package/skills/octocode-code-engineer/coverage/ast-helpers.ts.html +211 -0
  13. package/skills/octocode-code-engineer/coverage/ast-search.ts.html +1795 -0
  14. package/skills/octocode-code-engineer/coverage/base.css +224 -0
  15. package/skills/octocode-code-engineer/coverage/block-navigation.js +87 -0
  16. package/skills/octocode-code-engineer/coverage/cache.ts.html +376 -0
  17. package/skills/octocode-code-engineer/coverage/cli.ts.html +982 -0
  18. package/skills/octocode-code-engineer/coverage/clover.xml +3217 -0
  19. package/skills/octocode-code-engineer/coverage/collect-effects.ts.html +664 -0
  20. package/skills/octocode-code-engineer/coverage/collect-input-sources.ts.html +577 -0
  21. package/skills/octocode-code-engineer/coverage/collect-performance.ts.html +331 -0
  22. package/skills/octocode-code-engineer/coverage/collect-prototype-pollution.ts.html +421 -0
  23. package/skills/octocode-code-engineer/coverage/collect-security.ts.html +604 -0
  24. package/skills/octocode-code-engineer/coverage/collect-test-profile.ts.html +589 -0
  25. package/skills/octocode-code-engineer/coverage/coverage-final.json +30 -0
  26. package/skills/octocode-code-engineer/coverage/dependencies.ts.html +997 -0
  27. package/skills/octocode-code-engineer/coverage/dependency-summary.ts.html +688 -0
  28. package/skills/octocode-code-engineer/coverage/discovery.ts.html +322 -0
  29. package/skills/octocode-code-engineer/coverage/favicon.png +0 -0
  30. package/skills/octocode-code-engineer/coverage/graph-analytics.ts.html +1510 -0
  31. package/skills/octocode-code-engineer/coverage/index.html +536 -0
  32. package/skills/octocode-code-engineer/coverage/index.ts.html +826 -0
  33. package/skills/octocode-code-engineer/coverage/metrics.ts.html +553 -0
  34. package/skills/octocode-code-engineer/coverage/pipeline.ts.html +2044 -0
  35. package/skills/octocode-code-engineer/coverage/prettify.css +1 -0
  36. package/skills/octocode-code-engineer/coverage/prettify.js +2 -0
  37. package/skills/octocode-code-engineer/coverage/report-analysis.ts.html +1570 -0
  38. package/skills/octocode-code-engineer/coverage/report-writer.ts.html +1102 -0
  39. package/skills/octocode-code-engineer/coverage/security-detectors.ts.html +1747 -0
  40. package/skills/octocode-code-engineer/coverage/semantic-detectors.ts.html +2152 -0
  41. package/skills/octocode-code-engineer/coverage/semantic.ts.html +1897 -0
  42. package/skills/octocode-code-engineer/coverage/sort-arrow-sprite.png +0 -0
  43. package/skills/octocode-code-engineer/coverage/sorter.js +210 -0
  44. package/skills/octocode-code-engineer/coverage/summary-md.ts.html +1222 -0
  45. package/skills/octocode-code-engineer/coverage/test-quality-detectors.ts.html +1039 -0
  46. package/skills/octocode-code-engineer/coverage/tree-sitter-analyzer.ts.html +955 -0
  47. package/skills/octocode-code-engineer/coverage/ts-analyzer.ts.html +1213 -0
  48. package/skills/octocode-code-engineer/coverage/types.ts.html +2473 -0
  49. package/skills/octocode-code-engineer/coverage/utils.ts.html +820 -0
  50. package/skills/octocode-code-engineer/eslint.config.mjs +54 -0
  51. package/skills/octocode-code-engineer/minify-scripts.mjs +32 -0
  52. package/skills/octocode-code-engineer/package.json +54 -0
  53. package/skills/octocode-code-engineer/references/agent-ast-reading-rfc.md +95 -0
  54. package/skills/octocode-code-engineer/references/architecture-techniques.md +121 -0
  55. package/skills/octocode-code-engineer/references/ast-search.md +210 -0
  56. package/skills/octocode-code-engineer/references/ast-tree-search.md +151 -0
  57. package/skills/octocode-code-engineer/references/cli-reference.md +167 -0
  58. package/skills/octocode-code-engineer/references/concepts.md +107 -0
  59. package/skills/octocode-code-engineer/references/finding-categories.md +128 -0
  60. package/skills/octocode-code-engineer/references/improvement-roadmap.md +304 -0
  61. package/skills/octocode-code-engineer/references/output-files.md +144 -0
  62. package/skills/octocode-code-engineer/references/playbooks.md +204 -0
  63. package/skills/octocode-code-engineer/references/present-results.md +136 -0
  64. package/skills/octocode-code-engineer/references/tool-workflows.md +566 -0
  65. package/skills/octocode-code-engineer/references/validate-investigate.md +225 -0
  66. package/skills/octocode-code-engineer/scripts/analysis/dependencies.js +1 -0
  67. package/skills/octocode-code-engineer/scripts/analysis/dependency-summary.js +1 -0
  68. package/skills/octocode-code-engineer/scripts/analysis/discovery.js +1 -0
  69. package/skills/octocode-code-engineer/scripts/analysis/graph-analytics.js +1 -0
  70. package/skills/octocode-code-engineer/scripts/analysis/semantic.js +1 -0
  71. package/skills/octocode-code-engineer/scripts/ast/helpers.js +1 -0
  72. package/skills/octocode-code-engineer/scripts/ast/metrics.js +1 -0
  73. package/skills/octocode-code-engineer/scripts/ast/search.js +2 -0
  74. package/skills/octocode-code-engineer/scripts/ast/tree-search.js +2 -0
  75. package/skills/octocode-code-engineer/scripts/ast/tree-sitter.js +1 -0
  76. package/skills/octocode-code-engineer/scripts/ast/ts-analyzer.js +1 -0
  77. package/skills/octocode-code-engineer/scripts/collectors/chains.js +1 -0
  78. package/skills/octocode-code-engineer/scripts/collectors/effects.js +1 -0
  79. package/skills/octocode-code-engineer/scripts/collectors/input-sources.js +1 -0
  80. package/skills/octocode-code-engineer/scripts/collectors/performance.js +1 -0
  81. package/skills/octocode-code-engineer/scripts/collectors/prototype-pollution.js +1 -0
  82. package/skills/octocode-code-engineer/scripts/collectors/security.js +1 -0
  83. package/skills/octocode-code-engineer/scripts/collectors/test-profile.js +1 -0
  84. package/skills/octocode-code-engineer/scripts/common/is-direct-run.js +1 -0
  85. package/skills/octocode-code-engineer/scripts/common/utils.js +1 -0
  86. package/skills/octocode-code-engineer/scripts/detectors/code-quality.js +1 -0
  87. package/skills/octocode-code-engineer/scripts/detectors/cohesion.js +1 -0
  88. package/skills/octocode-code-engineer/scripts/detectors/coupling.js +1 -0
  89. package/skills/octocode-code-engineer/scripts/detectors/cycle.js +1 -0
  90. package/skills/octocode-code-engineer/scripts/detectors/dead-code.js +1 -0
  91. package/skills/octocode-code-engineer/scripts/detectors/import-style.js +1 -0
  92. package/skills/octocode-code-engineer/scripts/detectors/index.js +1 -0
  93. package/skills/octocode-code-engineer/scripts/detectors/security.js +1 -0
  94. package/skills/octocode-code-engineer/scripts/detectors/semantic.js +1 -0
  95. package/skills/octocode-code-engineer/scripts/detectors/shared.js +1 -0
  96. package/skills/octocode-code-engineer/scripts/detectors/test-quality.js +1 -0
  97. package/skills/octocode-code-engineer/scripts/index.js +1 -0
  98. package/skills/octocode-code-engineer/scripts/pipeline/cache.js +1 -0
  99. package/skills/octocode-code-engineer/scripts/pipeline/cli.js +1 -0
  100. package/skills/octocode-code-engineer/scripts/pipeline/main.js +2 -0
  101. package/skills/octocode-code-engineer/scripts/reporting/analysis.js +1 -0
  102. package/skills/octocode-code-engineer/scripts/reporting/summary-md.js +1 -0
  103. package/skills/octocode-code-engineer/scripts/reporting/writer.js +1 -0
  104. package/skills/octocode-code-engineer/scripts/types/constants.js +1 -0
  105. package/skills/octocode-code-engineer/scripts/types/index.js +1 -0
  106. package/skills/octocode-code-engineer/scripts/types/interfaces.js +1 -0
  107. package/skills/octocode-code-engineer/src/analysis/dependencies.test.ts +545 -0
  108. package/skills/octocode-code-engineer/src/analysis/dependencies.ts +406 -0
  109. package/skills/octocode-code-engineer/src/analysis/dependency-summary.test.ts +566 -0
  110. package/skills/octocode-code-engineer/src/analysis/dependency-summary.ts +257 -0
  111. package/skills/octocode-code-engineer/src/analysis/discovery.test.ts +420 -0
  112. package/skills/octocode-code-engineer/src/analysis/discovery.ts +87 -0
  113. package/skills/octocode-code-engineer/src/analysis/graph-analytics.test.ts +449 -0
  114. package/skills/octocode-code-engineer/src/analysis/graph-analytics.ts +534 -0
  115. package/skills/octocode-code-engineer/src/analysis/semantic.test.ts +1533 -0
  116. package/skills/octocode-code-engineer/src/analysis/semantic.ts +830 -0
  117. package/skills/octocode-code-engineer/src/ast/helpers.test.ts +185 -0
  118. package/skills/octocode-code-engineer/src/ast/helpers.ts +62 -0
  119. package/skills/octocode-code-engineer/src/ast/metrics.test.ts +304 -0
  120. package/skills/octocode-code-engineer/src/ast/metrics.ts +204 -0
  121. package/skills/octocode-code-engineer/src/ast/search.test.ts +647 -0
  122. package/skills/octocode-code-engineer/src/ast/search.ts +648 -0
  123. package/skills/octocode-code-engineer/src/ast/tree-search.test.ts +199 -0
  124. package/skills/octocode-code-engineer/src/ast/tree-search.ts +392 -0
  125. package/skills/octocode-code-engineer/src/ast/tree-sitter.test.ts +407 -0
  126. package/skills/octocode-code-engineer/src/ast/tree-sitter.ts +402 -0
  127. package/skills/octocode-code-engineer/src/ast/ts-analyzer.test.ts +1864 -0
  128. package/skills/octocode-code-engineer/src/ast/ts-analyzer.ts +509 -0
  129. package/skills/octocode-code-engineer/src/collectors/chains.ts +74 -0
  130. package/skills/octocode-code-engineer/src/collectors/effects.test.ts +490 -0
  131. package/skills/octocode-code-engineer/src/collectors/effects.ts +332 -0
  132. package/skills/octocode-code-engineer/src/collectors/input-sources.test.ts +144 -0
  133. package/skills/octocode-code-engineer/src/collectors/input-sources.ts +196 -0
  134. package/skills/octocode-code-engineer/src/collectors/performance.test.ts +82 -0
  135. package/skills/octocode-code-engineer/src/collectors/performance.ts +141 -0
  136. package/skills/octocode-code-engineer/src/collectors/prototype-pollution.test.ts +55 -0
  137. package/skills/octocode-code-engineer/src/collectors/prototype-pollution.ts +162 -0
  138. package/skills/octocode-code-engineer/src/collectors/security.test.ts +124 -0
  139. package/skills/octocode-code-engineer/src/collectors/security.ts +309 -0
  140. package/skills/octocode-code-engineer/src/collectors/test-profile.test.ts +97 -0
  141. package/skills/octocode-code-engineer/src/collectors/test-profile.ts +269 -0
  142. package/skills/octocode-code-engineer/src/common/is-direct-run.test.ts +32 -0
  143. package/skills/octocode-code-engineer/src/common/is-direct-run.ts +13 -0
  144. package/skills/octocode-code-engineer/src/common/utils.test.ts +463 -0
  145. package/skills/octocode-code-engineer/src/common/utils.ts +304 -0
  146. package/skills/octocode-code-engineer/src/detectors/code-quality.ts +966 -0
  147. package/skills/octocode-code-engineer/src/detectors/cohesion.ts +539 -0
  148. package/skills/octocode-code-engineer/src/detectors/coupling.ts +323 -0
  149. package/skills/octocode-code-engineer/src/detectors/cycle.ts +349 -0
  150. package/skills/octocode-code-engineer/src/detectors/dead-code.ts +320 -0
  151. package/skills/octocode-code-engineer/src/detectors/import-style.ts +376 -0
  152. package/skills/octocode-code-engineer/src/detectors/index.test.ts +3061 -0
  153. package/skills/octocode-code-engineer/src/detectors/index.ts +88 -0
  154. package/skills/octocode-code-engineer/src/detectors/security.test.ts +882 -0
  155. package/skills/octocode-code-engineer/src/detectors/security.ts +821 -0
  156. package/skills/octocode-code-engineer/src/detectors/semantic.ts +758 -0
  157. package/skills/octocode-code-engineer/src/detectors/shared.ts +49 -0
  158. package/skills/octocode-code-engineer/src/detectors/test-quality.test.ts +388 -0
  159. package/skills/octocode-code-engineer/src/detectors/test-quality.ts +367 -0
  160. package/skills/octocode-code-engineer/src/index.test.ts +4425 -0
  161. package/skills/octocode-code-engineer/src/index.ts +403 -0
  162. package/skills/octocode-code-engineer/src/pipeline/cache.test.ts +199 -0
  163. package/skills/octocode-code-engineer/src/pipeline/cache.ts +130 -0
  164. package/skills/octocode-code-engineer/src/pipeline/cli.test.ts +493 -0
  165. package/skills/octocode-code-engineer/src/pipeline/cli.ts +344 -0
  166. package/skills/octocode-code-engineer/src/pipeline/main.test.ts +174 -0
  167. package/skills/octocode-code-engineer/src/pipeline/main.ts +1074 -0
  168. package/skills/octocode-code-engineer/src/pipeline.test.ts +84 -0
  169. package/skills/octocode-code-engineer/src/reporting/analysis.test.ts +782 -0
  170. package/skills/octocode-code-engineer/src/reporting/analysis.ts +688 -0
  171. package/skills/octocode-code-engineer/src/reporting/output-contract.test.ts +463 -0
  172. package/skills/octocode-code-engineer/src/reporting/summary-md.test.ts +421 -0
  173. package/skills/octocode-code-engineer/src/reporting/summary-md.ts +714 -0
  174. package/skills/octocode-code-engineer/src/reporting/writer.ts +430 -0
  175. package/skills/octocode-code-engineer/src/sanity.test.ts +47 -0
  176. package/skills/octocode-code-engineer/src/types/constants.ts +248 -0
  177. package/skills/octocode-code-engineer/src/types/index.ts +80 -0
  178. package/skills/octocode-code-engineer/src/types/interfaces.ts +682 -0
  179. package/skills/octocode-code-engineer/tsconfig.json +17 -0
  180. package/skills/octocode-code-engineer/vitest.config.ts +8 -0
  181. package/skills/octocode-documentation-writer/README.md +113 -0
  182. package/skills/octocode-documentation-writer/SKILL.md +886 -0
  183. package/skills/octocode-documentation-writer/references/agent-discovery-analysis.md +453 -0
  184. package/skills/octocode-documentation-writer/references/agent-documentation-writer.md +255 -0
  185. package/skills/octocode-documentation-writer/references/agent-engineer-questions.md +247 -0
  186. package/skills/octocode-documentation-writer/references/agent-orchestrator.md +370 -0
  187. package/skills/octocode-documentation-writer/references/agent-qa-validator.md +227 -0
  188. package/skills/octocode-documentation-writer/references/agent-researcher.md +250 -0
  189. package/skills/octocode-documentation-writer/schemas/analysis-schema.json +886 -0
  190. package/skills/octocode-documentation-writer/schemas/discovery-tasks.json +96 -0
  191. package/skills/octocode-documentation-writer/schemas/documentation-structure.json +373 -0
  192. package/skills/octocode-documentation-writer/schemas/partial-discovery-schema.json +102 -0
  193. package/skills/octocode-documentation-writer/schemas/partial-research-schema.json +98 -0
  194. package/skills/octocode-documentation-writer/schemas/qa-results-schema.json +113 -0
  195. package/skills/octocode-documentation-writer/schemas/questions-schema.json +228 -0
  196. package/skills/octocode-documentation-writer/schemas/research-schema.json +104 -0
  197. package/skills/octocode-documentation-writer/schemas/state-schema.json +222 -0
  198. package/skills/octocode-documentation-writer/schemas/work-assignments-schema.json +74 -0
  199. package/skills/octocode-plan/SKILL.md +122 -116
  200. package/skills/octocode-prompt-optimizer/SKILL.md +617 -0
  201. package/skills/octocode-pull-request-reviewer/README.md +249 -0
  202. package/skills/octocode-pull-request-reviewer/SKILL.md +479 -0
  203. package/skills/octocode-pull-request-reviewer/references/dependency-check.md +74 -0
  204. package/skills/octocode-pull-request-reviewer/references/domain-reviewers.md +24 -0
  205. package/skills/octocode-pull-request-reviewer/references/execution-lifecycle.md +441 -0
  206. package/skills/octocode-pull-request-reviewer/references/flow-analysis-protocol.md +64 -0
  207. package/skills/octocode-pull-request-reviewer/references/output-template.md +174 -0
  208. package/skills/octocode-pull-request-reviewer/references/parallel-agent-protocol.md +182 -0
  209. package/skills/octocode-pull-request-reviewer/references/review-guidelines.md +26 -0
  210. package/skills/octocode-pull-request-reviewer/references/verification-checklist.md +40 -0
  211. package/skills/octocode-research/.claude/settings.local.json +46 -0
  212. package/skills/octocode-research/.octocode/plan/code-review-fixes/plan.md +312 -0
  213. package/skills/octocode-research/.octocode/plan/code-review-fixes/research.md +212 -0
  214. package/skills/octocode-research/.octocode/plans/NODE_SERVER_START_PLAN.md +755 -0
  215. package/skills/octocode-research/.octocode/research/code-review/research.md +371 -0
  216. package/skills/octocode-research/.octocode/review/IMPROVEMENTS.md +391 -0
  217. package/skills/octocode-research/.octocode/review/REVIEW_PLAN.md +289 -0
  218. package/skills/octocode-research/.octocode/review/REVIEW_REPORT.md +356 -0
  219. package/skills/octocode-research/AGENTS.md +349 -0
  220. package/skills/octocode-research/README.md +494 -0
  221. package/skills/octocode-research/SKILL.md +652 -274
  222. package/skills/octocode-research/docs/API_REFERENCE.md +562 -0
  223. package/skills/octocode-research/docs/ARCHITECTURE.md +554 -0
  224. package/skills/octocode-research/docs/FLOWS.md +577 -0
  225. package/skills/octocode-research/docs/OVERVIEW.md +564 -0
  226. package/skills/octocode-research/docs/SERVER_FLOWS.md +631 -0
  227. package/skills/octocode-research/ecosystem.config.cjs +88 -0
  228. package/skills/octocode-research/eslint.config.mjs +27 -0
  229. package/skills/octocode-research/package.json +84 -0
  230. package/skills/octocode-research/references/GUARDRAILS.md +40 -0
  231. package/skills/octocode-research/references/PARALLEL_AGENT_PROTOCOL.md +178 -0
  232. package/skills/octocode-research/references/roast-prompt.md +149 -0
  233. package/skills/octocode-research/scripts/server-init.d.ts +2 -0
  234. package/skills/octocode-research/scripts/server-init.js +2 -0
  235. package/skills/octocode-research/scripts/server.d.ts +8 -0
  236. package/skills/octocode-research/scripts/server.js +445 -0
  237. package/skills/octocode-research/src/__tests__/integration/circuitBreaker.test.ts +205 -0
  238. package/skills/octocode-research/src/__tests__/integration/routes.test.ts +374 -0
  239. package/skills/octocode-research/src/__tests__/unit/circuitBreaker.test.ts +245 -0
  240. package/skills/octocode-research/src/__tests__/unit/errorHandler.test.ts +183 -0
  241. package/skills/octocode-research/src/__tests__/unit/httpPreprocess.test.ts +157 -0
  242. package/skills/octocode-research/src/__tests__/unit/logger.test.ts +143 -0
  243. package/skills/octocode-research/src/__tests__/unit/queryParser.test.ts +130 -0
  244. package/skills/octocode-research/src/__tests__/unit/responseBuilder.test.ts +469 -0
  245. package/skills/octocode-research/src/__tests__/unit/retry.test.ts +205 -0
  246. package/skills/octocode-research/src/index.ts +186 -0
  247. package/skills/octocode-research/src/mcpCache.ts +49 -0
  248. package/skills/octocode-research/src/middleware/errorHandler.ts +65 -0
  249. package/skills/octocode-research/src/middleware/logger.ts +61 -0
  250. package/skills/octocode-research/src/middleware/queryParser.ts +115 -0
  251. package/skills/octocode-research/src/middleware/readiness.ts +17 -0
  252. package/skills/octocode-research/src/routes/github.ts +197 -0
  253. package/skills/octocode-research/src/routes/local.ts +175 -0
  254. package/skills/octocode-research/src/routes/lsp.ts +177 -0
  255. package/skills/octocode-research/src/routes/package.ts +127 -0
  256. package/skills/octocode-research/src/routes/prompts.ts +138 -0
  257. package/skills/octocode-research/src/routes/tools.ts +677 -0
  258. package/skills/octocode-research/src/server-init.ts +363 -0
  259. package/skills/octocode-research/src/server.ts +285 -0
  260. package/skills/octocode-research/src/types/errorGuards.ts +151 -0
  261. package/skills/octocode-research/src/types/express.d.ts +76 -0
  262. package/skills/octocode-research/src/types/guards.ts +98 -0
  263. package/skills/octocode-research/src/types/mcp.ts +119 -0
  264. package/skills/octocode-research/src/types/responses.ts +199 -0
  265. package/skills/octocode-research/src/types/toolTypes.ts +33 -0
  266. package/skills/octocode-research/src/utils/asyncTimeout.ts +116 -0
  267. package/skills/octocode-research/src/utils/circuitBreaker.ts +492 -0
  268. package/skills/octocode-research/src/utils/colors.ts +53 -0
  269. package/skills/octocode-research/src/utils/errorQueue.ts +71 -0
  270. package/skills/octocode-research/src/utils/logEmoji.ts +103 -0
  271. package/skills/octocode-research/src/utils/logger.ts +413 -0
  272. package/skills/octocode-research/src/utils/resilience.ts +169 -0
  273. package/skills/octocode-research/src/utils/responseBuilder.ts +495 -0
  274. package/skills/octocode-research/src/utils/responseFactory.ts +100 -0
  275. package/skills/octocode-research/src/utils/responseParser.ts +272 -0
  276. package/skills/octocode-research/src/utils/retry.ts +280 -0
  277. package/skills/octocode-research/src/utils/routeFactory.ts +117 -0
  278. package/skills/octocode-research/src/utils/url.ts +20 -0
  279. package/skills/octocode-research/src/validation/httpPreprocess.ts +155 -0
  280. package/skills/octocode-research/src/validation/index.ts +2 -0
  281. package/skills/octocode-research/src/validation/schemas.ts +578 -0
  282. package/skills/octocode-research/src/validation/toolCallSchema.ts +132 -0
  283. package/skills/octocode-research/tsconfig.json +21 -0
  284. package/skills/octocode-research/tsdown.config.ts +42 -0
  285. package/skills/octocode-research/vitest.config.ts +20 -0
  286. package/skills/octocode-researcher/SKILL.md +461 -0
  287. package/skills/octocode-researcher/references/fallbacks.md +120 -0
  288. package/skills/{octocode-local-search → octocode-researcher}/references/tool-reference.md +132 -49
  289. package/skills/{octocode-local-search → octocode-researcher}/references/workflow-patterns.md +204 -4
  290. package/skills/octocode-rfc-generator/SKILL.md +223 -0
  291. package/skills/octocode-rfc-generator/references/rfc-template.md +193 -0
  292. package/skills/octocode-roast/SKILL.md +63 -21
  293. package/skills/octocode-implement/SKILL.md +0 -293
  294. package/skills/octocode-implement/references/execution-phases.md +0 -317
  295. package/skills/octocode-implement/references/tool-reference.md +0 -403
  296. package/skills/octocode-implement/references/workflow-patterns.md +0 -385
  297. package/skills/octocode-local-search/SKILL.md +0 -449
  298. package/skills/octocode-pr-review/SKILL.md +0 -391
  299. package/skills/octocode-pr-review/references/domain-reviewers.md +0 -105
  300. package/skills/octocode-pr-review/references/execution-lifecycle.md +0 -116
  301. package/skills/octocode-pr-review/references/research-flows.md +0 -75
  302. package/skills/octocode-research/references/tool-reference.md +0 -304
  303. package/skills/octocode-research/references/workflow-patterns.md +0 -325
@@ -0,0 +1,648 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AST-aware structural code search powered by @ast-grep/napi.
4
+ *
5
+ * Usage:
6
+ * node scripts/ast/search.js --pattern 'console.log($$$ARGS)' --root ./src
7
+ * node scripts/ast/search.js --preset empty-catch --root ./packages
8
+ * node scripts/ast/search.js --kind function_declaration --root ./src --json
9
+ */
10
+
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
+
14
+ import { js as astJs, ts as astTs, tsx as astTsx } from '@ast-grep/napi';
15
+
16
+ import { isDirectRun } from '../common/is-direct-run.js';
17
+ import { ALLOWED_EXTS } from '../types/index.js';
18
+
19
+ import type { NapiConfig, SgNode, SgRoot } from '@ast-grep/napi';
20
+
21
+ export interface AstSearchOptions {
22
+ root: string;
23
+ pattern: string | null;
24
+ kind: string | null;
25
+ preset: string | null;
26
+ rule: NapiConfig | null;
27
+ json: boolean;
28
+ limit: number;
29
+ includeTests: boolean;
30
+ ignoreDirs: Set<string>;
31
+ context: number;
32
+ }
33
+
34
+ export interface AstMatch {
35
+ file: string;
36
+ kind: string;
37
+ text: string;
38
+ lineStart: number;
39
+ lineEnd: number;
40
+ columnStart: number;
41
+ columnEnd: number;
42
+ metaVariables?: Record<string, string>;
43
+ }
44
+
45
+ export interface AstSearchResult {
46
+ query: string;
47
+ queryType: 'pattern' | 'kind' | 'preset' | 'rule';
48
+ totalMatches: number;
49
+ totalFiles: number;
50
+ matches: AstMatch[];
51
+ /** Source lines keyed by relative file path — only populated when context > 0 */
52
+ _sourceByFile?: Map<string, string[]>;
53
+ }
54
+
55
+ type PresetRule = NapiConfig & { description: string };
56
+
57
+ export const PRESETS: Record<string, PresetRule> = {
58
+ 'empty-catch': {
59
+ rule: {
60
+ kind: 'catch_clause',
61
+ has: {
62
+ kind: 'statement_block',
63
+ regex: '^\\{\\s*\\}$',
64
+ },
65
+ },
66
+ description: 'Empty catch blocks that silently swallow errors',
67
+ },
68
+ 'console-log': {
69
+ rule: {
70
+ pattern: 'console.log($$$ARGS)',
71
+ },
72
+ description: 'console.log calls left in production code',
73
+ },
74
+ 'console-any': {
75
+ rule: {
76
+ pattern: 'console.$METHOD($$$ARGS)',
77
+ },
78
+ description: 'Any console method call (log, warn, error, debug, etc.)',
79
+ },
80
+ debugger: {
81
+ rule: {
82
+ kind: 'debugger_statement',
83
+ },
84
+ description: 'Debugger statements left in code',
85
+ },
86
+ 'todo-fixme': {
87
+ rule: {
88
+ kind: 'comment',
89
+ regex: '(?i)(TODO|FIXME|HACK|XXX|BUG)',
90
+ },
91
+ description: 'TODO, FIXME, HACK, XXX, BUG comments',
92
+ },
93
+ 'any-type': {
94
+ rule: {
95
+ kind: 'predefined_type',
96
+ regex: '^any$',
97
+ },
98
+ description: 'Explicit `any` type annotations',
99
+ },
100
+ 'type-assertion': {
101
+ rule: {
102
+ kind: 'as_expression',
103
+ },
104
+ description: 'TypeScript type assertions (as X)',
105
+ },
106
+ 'non-null-assertion': {
107
+ rule: {
108
+ kind: 'non_null_expression',
109
+ },
110
+ description: 'Non-null assertions (x!)',
111
+ },
112
+ 'fat-arrow-body': {
113
+ rule: {
114
+ kind: 'arrow_function',
115
+ has: {
116
+ kind: 'statement_block',
117
+ },
118
+ },
119
+ description:
120
+ 'Arrow functions with statement block bodies (could be expression)',
121
+ },
122
+ 'nested-ternary': {
123
+ rule: {
124
+ kind: 'ternary_expression',
125
+ has: {
126
+ kind: 'ternary_expression',
127
+ stopBy: 'end',
128
+ },
129
+ },
130
+ description: 'Nested ternary expressions (hard to read)',
131
+ },
132
+ 'throw-string': {
133
+ rule: {
134
+ kind: 'throw_statement',
135
+ has: {
136
+ kind: 'string',
137
+ },
138
+ },
139
+ description: 'Throwing string literals instead of Error objects',
140
+ },
141
+ 'switch-no-default': {
142
+ rule: {
143
+ kind: 'switch_statement',
144
+ not: {
145
+ has: {
146
+ kind: 'switch_default',
147
+ stopBy: 'end',
148
+ },
149
+ },
150
+ },
151
+ description: 'Switch statements without a default case',
152
+ },
153
+ 'class-declaration': {
154
+ rule: {
155
+ kind: 'class_declaration',
156
+ },
157
+ description: 'All class declarations',
158
+ },
159
+ 'async-function': {
160
+ rule: {
161
+ kind: 'function_declaration',
162
+ regex: '^async ',
163
+ },
164
+ description: 'Async function declarations',
165
+ },
166
+ 'export-default': {
167
+ rule: {
168
+ kind: 'export_statement',
169
+ has: {
170
+ field: 'default',
171
+ },
172
+ },
173
+ description: 'Default exports',
174
+ },
175
+ 'import-star': {
176
+ rule: {
177
+ kind: 'import_statement',
178
+ has: {
179
+ kind: 'namespace_import',
180
+ },
181
+ },
182
+ description: 'Namespace imports (import * as X)',
183
+ },
184
+ };
185
+
186
+ function isTestFile(filePath: string): boolean {
187
+ const base = path.basename(filePath);
188
+ return (
189
+ /\.(test|spec)\.(ts|tsx|js|jsx|mjs|cjs)$/.test(base) ||
190
+ base.startsWith('test_') ||
191
+ filePath.includes('__tests__')
192
+ );
193
+ }
194
+
195
+ export function collectSearchFiles(
196
+ root: string,
197
+ opts: Pick<AstSearchOptions, 'includeTests' | 'ignoreDirs'>
198
+ ): string[] {
199
+ const files: string[] = [];
200
+ const walk = (dir: string): void => {
201
+ let entries: fs.Dirent[];
202
+ try {
203
+ entries = fs.readdirSync(dir, { withFileTypes: true });
204
+ } catch {
205
+ return;
206
+ }
207
+ entries.sort((a, b) => a.name.localeCompare(b.name));
208
+ for (const entry of entries) {
209
+ if (opts.ignoreDirs.has(entry.name)) continue;
210
+ if (entry.isSymbolicLink()) continue;
211
+ const next = path.join(dir, entry.name);
212
+ if (entry.isDirectory()) {
213
+ walk(next);
214
+ continue;
215
+ }
216
+ if (!entry.isFile()) continue;
217
+ if (entry.name.endsWith('.d.ts')) continue;
218
+ const ext = path.extname(entry.name);
219
+ if (!ALLOWED_EXTS.has(ext)) continue;
220
+ if (!opts.includeTests && isTestFile(next)) continue;
221
+ files.push(next);
222
+ }
223
+ };
224
+ walk(root);
225
+ return files;
226
+ }
227
+
228
+ type AstParser = { parse(src: string): SgRoot };
229
+
230
+ function parserForExt(ext: string): AstParser {
231
+ switch (ext) {
232
+ case '.tsx':
233
+ return astTsx;
234
+ case '.jsx':
235
+ return astJs;
236
+ case '.js':
237
+ case '.mjs':
238
+ case '.cjs':
239
+ return astJs;
240
+ case '.ts':
241
+ default:
242
+ return astTs;
243
+ }
244
+ }
245
+
246
+ function extractMetaVars(
247
+ node: SgNode,
248
+ pattern: string
249
+ ): Record<string, string> {
250
+ const vars: Record<string, string> = {};
251
+ let match: RegExpExecArray | null;
252
+
253
+ const triplePattern = /\$\$\$([A-Z_][A-Z0-9_]*)/g;
254
+ const triplNames = new Set<string>();
255
+ while ((match = triplePattern.exec(pattern)) !== null) {
256
+ const name = match[1];
257
+ triplNames.add(name);
258
+ const multiMatch = node.getMultipleMatches(name);
259
+ if (multiMatch.length > 0) {
260
+ vars[`$$$${name}`] = multiMatch.map(n => n.text()).join(', ');
261
+ }
262
+ }
263
+
264
+ const singlePattern = /(?<!\$)\$([A-Z_][A-Z0-9_]*)(?!\$)/g;
265
+ while ((match = singlePattern.exec(pattern)) !== null) {
266
+ const name = match[1];
267
+ if (triplNames.has(name)) continue;
268
+ const matchNode = node.getMatch(name);
269
+ if (matchNode) vars[`$${name}`] = matchNode.text();
270
+ }
271
+
272
+ return vars;
273
+ }
274
+
275
+ function nodeToMatch(
276
+ node: SgNode,
277
+ file: string,
278
+ pattern: string | null
279
+ ): AstMatch {
280
+ const range = node.range();
281
+ const result: AstMatch = {
282
+ file,
283
+ kind: String(node.kind()),
284
+ text: node.text(),
285
+ lineStart: range.start.line + 1,
286
+ lineEnd: range.end.line + 1,
287
+ columnStart: range.start.column,
288
+ columnEnd: range.end.column,
289
+ };
290
+ if (pattern) {
291
+ const vars = extractMetaVars(node, pattern);
292
+ if (Object.keys(vars).length > 0) result.metaVariables = vars;
293
+ }
294
+ return result;
295
+ }
296
+
297
+ export function searchFile(
298
+ filePath: string,
299
+ source: string,
300
+ matcher: string | number | NapiConfig,
301
+ patternStr: string | null,
302
+ limit: number
303
+ ): AstMatch[] {
304
+ const ext = path.extname(filePath);
305
+ const parser = parserForExt(ext);
306
+ let nodes: SgNode[];
307
+ try {
308
+ const root = parser.parse(source).root();
309
+ nodes = root.findAll(matcher);
310
+ } catch {
311
+ return [];
312
+ }
313
+ const matches: AstMatch[] = [];
314
+ for (const node of nodes) {
315
+ if (matches.length >= limit) break;
316
+ matches.push(nodeToMatch(node, filePath, patternStr));
317
+ }
318
+ return matches;
319
+ }
320
+
321
+ export function runSearch(
322
+ files: string[],
323
+ opts: AstSearchOptions,
324
+ root: string
325
+ ): AstSearchResult {
326
+ let matcher: string | NapiConfig;
327
+ let queryLabel: string;
328
+ let queryType: AstSearchResult['queryType'];
329
+ let patternStr: string | null = null;
330
+
331
+ if (opts.preset) {
332
+ const preset = PRESETS[opts.preset];
333
+ if (!preset) {
334
+ const available = Object.keys(PRESETS).join(', ');
335
+ throw new Error(
336
+ `Unknown preset: "${opts.preset}". Available: ${available}`
337
+ );
338
+ }
339
+ matcher = preset;
340
+ queryLabel = `preset:${opts.preset} — ${preset.description}`;
341
+ queryType = 'preset';
342
+ } else if (opts.rule) {
343
+ matcher = opts.rule;
344
+ queryLabel = `rule:${JSON.stringify(opts.rule)}`;
345
+ queryType = 'rule';
346
+ } else if (opts.kind) {
347
+ matcher = { rule: { kind: opts.kind } } as NapiConfig;
348
+ queryLabel = `kind:${opts.kind}`;
349
+ queryType = 'kind';
350
+ } else if (opts.pattern) {
351
+ matcher = opts.pattern;
352
+ patternStr = opts.pattern;
353
+ queryLabel = `pattern:${opts.pattern}`;
354
+ queryType = 'pattern';
355
+ } else {
356
+ throw new Error('Must provide --pattern, --kind, --preset, or --rule');
357
+ }
358
+
359
+ const allMatches: AstMatch[] = [];
360
+ const filesWithMatches = new Set<string>();
361
+ const sourceByFile =
362
+ opts.context > 0 ? new Map<string, string[]>() : undefined;
363
+
364
+ for (const filePath of files) {
365
+ if (allMatches.length >= opts.limit) break;
366
+ let source: string;
367
+ try {
368
+ source = fs.readFileSync(filePath, 'utf8');
369
+ } catch {
370
+ continue;
371
+ }
372
+ const relFile = path.relative(root, filePath);
373
+ const remaining = opts.limit - allMatches.length;
374
+ const fileMatches = searchFile(
375
+ relFile,
376
+ source,
377
+ matcher,
378
+ patternStr,
379
+ remaining
380
+ );
381
+ if (fileMatches.length > 0) {
382
+ filesWithMatches.add(relFile);
383
+ allMatches.push(...fileMatches);
384
+ if (sourceByFile) sourceByFile.set(relFile, source.split('\n'));
385
+ }
386
+ }
387
+
388
+ const result: AstSearchResult = {
389
+ query: queryLabel,
390
+ queryType,
391
+ totalMatches: allMatches.length,
392
+ totalFiles: filesWithMatches.size,
393
+ matches: allMatches,
394
+ };
395
+ if (sourceByFile) result._sourceByFile = sourceByFile;
396
+ return result;
397
+ }
398
+
399
+ interface ParsedSearchArgs {
400
+ opts: AstSearchOptions;
401
+ listPresets: boolean;
402
+ }
403
+
404
+ export function parseSearchArgs(argv: string[]): ParsedSearchArgs {
405
+ const opts: AstSearchOptions = {
406
+ root: process.cwd(),
407
+ pattern: null,
408
+ kind: null,
409
+ preset: null,
410
+ rule: null,
411
+ json: false,
412
+ limit: 500,
413
+ includeTests: false,
414
+ ignoreDirs: new Set([
415
+ '.git',
416
+ '.next',
417
+ '.yarn',
418
+ '.cache',
419
+ '.octocode',
420
+ 'node_modules',
421
+ 'dist',
422
+ 'coverage',
423
+ 'out',
424
+ ]),
425
+ context: 0,
426
+ };
427
+ let listPresets = false;
428
+
429
+ for (let i = 0; i < argv.length; i++) {
430
+ const arg = argv[i];
431
+ if (arg === '--pattern' || arg === '-p') {
432
+ opts.pattern = argv[++i];
433
+ continue;
434
+ }
435
+ if (arg.startsWith('--pattern=')) {
436
+ opts.pattern = arg.slice('--pattern='.length);
437
+ continue;
438
+ }
439
+ if (arg === '--kind' || arg === '-k') {
440
+ opts.kind = argv[++i];
441
+ continue;
442
+ }
443
+ if (arg.startsWith('--kind=')) {
444
+ opts.kind = arg.slice('--kind='.length);
445
+ continue;
446
+ }
447
+ if (arg === '--preset') {
448
+ opts.preset = argv[++i];
449
+ continue;
450
+ }
451
+ if (arg.startsWith('--preset=')) {
452
+ opts.preset = arg.slice('--preset='.length);
453
+ continue;
454
+ }
455
+ if (arg === '--rule') {
456
+ const raw = argv[++i];
457
+ try {
458
+ opts.rule = JSON.parse(raw) as NapiConfig;
459
+ } catch {
460
+ throw new Error(
461
+ `Invalid --rule JSON: ${raw?.slice(0, 100) ?? '(empty)'}`
462
+ );
463
+ }
464
+ continue;
465
+ }
466
+ if (arg === '--root') {
467
+ opts.root = path.resolve(argv[++i]);
468
+ continue;
469
+ }
470
+ if (arg.startsWith('--root=')) {
471
+ opts.root = path.resolve(arg.slice('--root='.length));
472
+ continue;
473
+ }
474
+ if (arg === '--json') {
475
+ opts.json = true;
476
+ continue;
477
+ }
478
+ if (arg === '--limit') {
479
+ opts.limit = parseInt(argv[++i], 10);
480
+ continue;
481
+ }
482
+ if (arg === '--include-tests') {
483
+ opts.includeTests = true;
484
+ continue;
485
+ }
486
+ if (arg === '--context' || arg === '-C') {
487
+ opts.context = parseInt(argv[++i], 10);
488
+ continue;
489
+ }
490
+ if (arg === '--list-presets') {
491
+ listPresets = true;
492
+ continue;
493
+ }
494
+ if (arg === '--help' || arg === '-h') {
495
+ printSearchHelp();
496
+ process.exit(0);
497
+ }
498
+ }
499
+
500
+ if (Number.isNaN(opts.limit)) opts.limit = 500;
501
+ if (Number.isNaN(opts.context)) opts.context = 0;
502
+
503
+ return { opts, listPresets };
504
+ }
505
+
506
+ function printSearchHelp(): void {
507
+ console.log(`
508
+ ast-search — Structural code search powered by ast-grep
509
+
510
+ Usage:
511
+ node scripts/ast/search.js [options]
512
+
513
+ Search modes (pick one):
514
+ --pattern, -p <code> Match code structurally (e.g. 'console.log($$$ARGS)')
515
+ --kind, -k <kind> Match AST node kind (e.g. 'function_declaration')
516
+ --preset <name> Use a built-in search preset (e.g. 'empty-catch')
517
+ --rule <json> Raw ast-grep rule object as JSON
518
+
519
+ Options:
520
+ --root <path> Search root directory (default: cwd)
521
+ --json Output as JSON
522
+ --limit N Max matches (default: 500)
523
+ --include-tests Include test files
524
+ --context, -C N Lines of context around matches (text output only)
525
+ --list-presets Show available presets and exit
526
+ --help, -h Show this message
527
+
528
+ Pattern wildcards:
529
+ $NAME Match any single AST node
530
+ $$$NAME Match zero or more nodes (variadic)
531
+
532
+ Examples:
533
+ node scripts/ast/search.js -p 'console.log($$$ARGS)' --root ./src
534
+ node scripts/ast/search.js --preset empty-catch --root ./packages
535
+ node scripts/ast/search.js -k function_declaration --json --limit 20
536
+ node scripts/ast/search.js --preset todo-fixme --include-tests
537
+ node scripts/ast/search.js -p 'if ($COND) { return $VAL }' --root ./src
538
+ node scripts/ast/search.js --rule '{"rule":{"kind":"catch_clause"}}' --root ./src
539
+
540
+ Presets:
541
+ ${Object.entries(PRESETS)
542
+ .map(([name, p]) => ` ${name.padEnd(22)} ${p.description}`)
543
+ .join('\n')}
544
+ `);
545
+ }
546
+
547
+ export function formatTextOutput(
548
+ result: AstSearchResult,
549
+ opts: AstSearchOptions,
550
+ _root: string
551
+ ): string {
552
+ const lines: string[] = [];
553
+ lines.push(`\nšŸ” ${result.query}`);
554
+ lines.push(
555
+ ` ${result.totalMatches} matches across ${result.totalFiles} files\n`
556
+ );
557
+
558
+ const ctx = opts.context;
559
+ const sourceMap = result._sourceByFile;
560
+
561
+ let currentFile = '';
562
+ for (const m of result.matches) {
563
+ if (m.file !== currentFile) {
564
+ currentFile = m.file;
565
+ lines.push(`\n── ${currentFile} ──`);
566
+ }
567
+
568
+ if (ctx > 0 && sourceMap) {
569
+ const srcLines = sourceMap.get(m.file);
570
+ if (srcLines) {
571
+ const start = Math.max(0, m.lineStart - 1 - ctx);
572
+ const end = Math.min(srcLines.length, m.lineEnd + ctx);
573
+ for (let i = start; i < end; i++) {
574
+ const lineNum = i + 1;
575
+ const marker =
576
+ lineNum >= m.lineStart && lineNum <= m.lineEnd ? '>' : ' ';
577
+ lines.push(
578
+ ` ${marker} ${String(lineNum).padStart(4)} | ${srcLines[i]}`
579
+ );
580
+ }
581
+ lines.push('');
582
+ continue;
583
+ }
584
+ }
585
+
586
+ const truncatedText =
587
+ m.text.length > 200 ? m.text.slice(0, 200) + '…' : m.text;
588
+ const singleLine = truncatedText.replace(/\n/g, '↵').replace(/\s+/g, ' ');
589
+ lines.push(
590
+ ` L${m.lineStart}:${m.columnStart} [${m.kind}] ${singleLine}`
591
+ );
592
+
593
+ if (m.metaVariables && Object.keys(m.metaVariables).length > 0) {
594
+ for (const [k, v] of Object.entries(m.metaVariables)) {
595
+ const truncV = v.length > 80 ? v.slice(0, 80) + '…' : v;
596
+ lines.push(` ${k} = ${truncV}`);
597
+ }
598
+ }
599
+ }
600
+
601
+ lines.push('');
602
+ return lines.join('\n');
603
+ }
604
+
605
+ async function main(): Promise<void> {
606
+ const { opts, listPresets } = parseSearchArgs(process.argv.slice(2));
607
+
608
+ if (listPresets) {
609
+ if (opts.json) {
610
+ console.log(JSON.stringify(PRESETS));
611
+ } else {
612
+ console.log('\nAvailable presets:\n');
613
+ for (const [name, preset] of Object.entries(PRESETS)) {
614
+ console.log(` ${name.padEnd(22)} ${preset.description}`);
615
+ }
616
+ console.log('');
617
+ }
618
+ return;
619
+ }
620
+
621
+ if (!opts.pattern && !opts.kind && !opts.preset && !opts.rule) {
622
+ console.error('Error: Must provide --pattern, --kind, --preset, or --rule');
623
+ console.error('Run with --help for usage information.');
624
+ process.exit(1);
625
+ }
626
+
627
+ const files = collectSearchFiles(opts.root, opts);
628
+
629
+ if (files.length === 0) {
630
+ console.error(`No files found in ${opts.root}`);
631
+ process.exit(1);
632
+ }
633
+
634
+ const result = runSearch(files, opts, opts.root);
635
+
636
+ if (opts.json) {
637
+ console.log(JSON.stringify(result));
638
+ } else {
639
+ console.log(formatTextOutput(result, opts, opts.root));
640
+ }
641
+ }
642
+
643
+ if (isDirectRun(import.meta.url)) {
644
+ main().catch((error: unknown) => {
645
+ console.error(error);
646
+ process.exit(1);
647
+ });
648
+ }