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.
- package/LICENSE +21 -63
- package/README.md +85 -142
- package/out/octocode-cli.js +7026 -6945
- package/package.json +8 -6
- package/skills/README.md +97 -120
- package/skills/octocode-code-engineer/.claude/settings.local.json +18 -0
- package/skills/octocode-code-engineer/.octocode/rfc/RFC-code-engineer-weakness-fixes.md +255 -0
- package/skills/octocode-code-engineer/.plan/VALIDATED_PLAN.md +223 -0
- package/skills/octocode-code-engineer/README.md +178 -0
- package/skills/octocode-code-engineer/SKILL.md +418 -0
- package/skills/octocode-code-engineer/coverage/architecture.ts.html +7828 -0
- package/skills/octocode-code-engineer/coverage/ast-helpers.ts.html +211 -0
- package/skills/octocode-code-engineer/coverage/ast-search.ts.html +1795 -0
- package/skills/octocode-code-engineer/coverage/base.css +224 -0
- package/skills/octocode-code-engineer/coverage/block-navigation.js +87 -0
- package/skills/octocode-code-engineer/coverage/cache.ts.html +376 -0
- package/skills/octocode-code-engineer/coverage/cli.ts.html +982 -0
- package/skills/octocode-code-engineer/coverage/clover.xml +3217 -0
- package/skills/octocode-code-engineer/coverage/collect-effects.ts.html +664 -0
- package/skills/octocode-code-engineer/coverage/collect-input-sources.ts.html +577 -0
- package/skills/octocode-code-engineer/coverage/collect-performance.ts.html +331 -0
- package/skills/octocode-code-engineer/coverage/collect-prototype-pollution.ts.html +421 -0
- package/skills/octocode-code-engineer/coverage/collect-security.ts.html +604 -0
- package/skills/octocode-code-engineer/coverage/collect-test-profile.ts.html +589 -0
- package/skills/octocode-code-engineer/coverage/coverage-final.json +30 -0
- package/skills/octocode-code-engineer/coverage/dependencies.ts.html +997 -0
- package/skills/octocode-code-engineer/coverage/dependency-summary.ts.html +688 -0
- package/skills/octocode-code-engineer/coverage/discovery.ts.html +322 -0
- package/skills/octocode-code-engineer/coverage/favicon.png +0 -0
- package/skills/octocode-code-engineer/coverage/graph-analytics.ts.html +1510 -0
- package/skills/octocode-code-engineer/coverage/index.html +536 -0
- package/skills/octocode-code-engineer/coverage/index.ts.html +826 -0
- package/skills/octocode-code-engineer/coverage/metrics.ts.html +553 -0
- package/skills/octocode-code-engineer/coverage/pipeline.ts.html +2044 -0
- package/skills/octocode-code-engineer/coverage/prettify.css +1 -0
- package/skills/octocode-code-engineer/coverage/prettify.js +2 -0
- package/skills/octocode-code-engineer/coverage/report-analysis.ts.html +1570 -0
- package/skills/octocode-code-engineer/coverage/report-writer.ts.html +1102 -0
- package/skills/octocode-code-engineer/coverage/security-detectors.ts.html +1747 -0
- package/skills/octocode-code-engineer/coverage/semantic-detectors.ts.html +2152 -0
- package/skills/octocode-code-engineer/coverage/semantic.ts.html +1897 -0
- package/skills/octocode-code-engineer/coverage/sort-arrow-sprite.png +0 -0
- package/skills/octocode-code-engineer/coverage/sorter.js +210 -0
- package/skills/octocode-code-engineer/coverage/summary-md.ts.html +1222 -0
- package/skills/octocode-code-engineer/coverage/test-quality-detectors.ts.html +1039 -0
- package/skills/octocode-code-engineer/coverage/tree-sitter-analyzer.ts.html +955 -0
- package/skills/octocode-code-engineer/coverage/ts-analyzer.ts.html +1213 -0
- package/skills/octocode-code-engineer/coverage/types.ts.html +2473 -0
- package/skills/octocode-code-engineer/coverage/utils.ts.html +820 -0
- package/skills/octocode-code-engineer/eslint.config.mjs +54 -0
- package/skills/octocode-code-engineer/minify-scripts.mjs +32 -0
- package/skills/octocode-code-engineer/package.json +54 -0
- package/skills/octocode-code-engineer/references/agent-ast-reading-rfc.md +95 -0
- package/skills/octocode-code-engineer/references/architecture-techniques.md +121 -0
- package/skills/octocode-code-engineer/references/ast-search.md +210 -0
- package/skills/octocode-code-engineer/references/ast-tree-search.md +151 -0
- package/skills/octocode-code-engineer/references/cli-reference.md +167 -0
- package/skills/octocode-code-engineer/references/concepts.md +107 -0
- package/skills/octocode-code-engineer/references/finding-categories.md +128 -0
- package/skills/octocode-code-engineer/references/improvement-roadmap.md +304 -0
- package/skills/octocode-code-engineer/references/output-files.md +144 -0
- package/skills/octocode-code-engineer/references/playbooks.md +204 -0
- package/skills/octocode-code-engineer/references/present-results.md +136 -0
- package/skills/octocode-code-engineer/references/tool-workflows.md +566 -0
- package/skills/octocode-code-engineer/references/validate-investigate.md +225 -0
- package/skills/octocode-code-engineer/scripts/analysis/dependencies.js +1 -0
- package/skills/octocode-code-engineer/scripts/analysis/dependency-summary.js +1 -0
- package/skills/octocode-code-engineer/scripts/analysis/discovery.js +1 -0
- package/skills/octocode-code-engineer/scripts/analysis/graph-analytics.js +1 -0
- package/skills/octocode-code-engineer/scripts/analysis/semantic.js +1 -0
- package/skills/octocode-code-engineer/scripts/ast/helpers.js +1 -0
- package/skills/octocode-code-engineer/scripts/ast/metrics.js +1 -0
- package/skills/octocode-code-engineer/scripts/ast/search.js +2 -0
- package/skills/octocode-code-engineer/scripts/ast/tree-search.js +2 -0
- package/skills/octocode-code-engineer/scripts/ast/tree-sitter.js +1 -0
- package/skills/octocode-code-engineer/scripts/ast/ts-analyzer.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/chains.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/effects.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/input-sources.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/performance.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/prototype-pollution.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/security.js +1 -0
- package/skills/octocode-code-engineer/scripts/collectors/test-profile.js +1 -0
- package/skills/octocode-code-engineer/scripts/common/is-direct-run.js +1 -0
- package/skills/octocode-code-engineer/scripts/common/utils.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/code-quality.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/cohesion.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/coupling.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/cycle.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/dead-code.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/import-style.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/index.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/security.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/semantic.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/shared.js +1 -0
- package/skills/octocode-code-engineer/scripts/detectors/test-quality.js +1 -0
- package/skills/octocode-code-engineer/scripts/index.js +1 -0
- package/skills/octocode-code-engineer/scripts/pipeline/cache.js +1 -0
- package/skills/octocode-code-engineer/scripts/pipeline/cli.js +1 -0
- package/skills/octocode-code-engineer/scripts/pipeline/main.js +2 -0
- package/skills/octocode-code-engineer/scripts/reporting/analysis.js +1 -0
- package/skills/octocode-code-engineer/scripts/reporting/summary-md.js +1 -0
- package/skills/octocode-code-engineer/scripts/reporting/writer.js +1 -0
- package/skills/octocode-code-engineer/scripts/types/constants.js +1 -0
- package/skills/octocode-code-engineer/scripts/types/index.js +1 -0
- package/skills/octocode-code-engineer/scripts/types/interfaces.js +1 -0
- package/skills/octocode-code-engineer/src/analysis/dependencies.test.ts +545 -0
- package/skills/octocode-code-engineer/src/analysis/dependencies.ts +406 -0
- package/skills/octocode-code-engineer/src/analysis/dependency-summary.test.ts +566 -0
- package/skills/octocode-code-engineer/src/analysis/dependency-summary.ts +257 -0
- package/skills/octocode-code-engineer/src/analysis/discovery.test.ts +420 -0
- package/skills/octocode-code-engineer/src/analysis/discovery.ts +87 -0
- package/skills/octocode-code-engineer/src/analysis/graph-analytics.test.ts +449 -0
- package/skills/octocode-code-engineer/src/analysis/graph-analytics.ts +534 -0
- package/skills/octocode-code-engineer/src/analysis/semantic.test.ts +1533 -0
- package/skills/octocode-code-engineer/src/analysis/semantic.ts +830 -0
- package/skills/octocode-code-engineer/src/ast/helpers.test.ts +185 -0
- package/skills/octocode-code-engineer/src/ast/helpers.ts +62 -0
- package/skills/octocode-code-engineer/src/ast/metrics.test.ts +304 -0
- package/skills/octocode-code-engineer/src/ast/metrics.ts +204 -0
- package/skills/octocode-code-engineer/src/ast/search.test.ts +647 -0
- package/skills/octocode-code-engineer/src/ast/search.ts +648 -0
- package/skills/octocode-code-engineer/src/ast/tree-search.test.ts +199 -0
- package/skills/octocode-code-engineer/src/ast/tree-search.ts +392 -0
- package/skills/octocode-code-engineer/src/ast/tree-sitter.test.ts +407 -0
- package/skills/octocode-code-engineer/src/ast/tree-sitter.ts +402 -0
- package/skills/octocode-code-engineer/src/ast/ts-analyzer.test.ts +1864 -0
- package/skills/octocode-code-engineer/src/ast/ts-analyzer.ts +509 -0
- package/skills/octocode-code-engineer/src/collectors/chains.ts +74 -0
- package/skills/octocode-code-engineer/src/collectors/effects.test.ts +490 -0
- package/skills/octocode-code-engineer/src/collectors/effects.ts +332 -0
- package/skills/octocode-code-engineer/src/collectors/input-sources.test.ts +144 -0
- package/skills/octocode-code-engineer/src/collectors/input-sources.ts +196 -0
- package/skills/octocode-code-engineer/src/collectors/performance.test.ts +82 -0
- package/skills/octocode-code-engineer/src/collectors/performance.ts +141 -0
- package/skills/octocode-code-engineer/src/collectors/prototype-pollution.test.ts +55 -0
- package/skills/octocode-code-engineer/src/collectors/prototype-pollution.ts +162 -0
- package/skills/octocode-code-engineer/src/collectors/security.test.ts +124 -0
- package/skills/octocode-code-engineer/src/collectors/security.ts +309 -0
- package/skills/octocode-code-engineer/src/collectors/test-profile.test.ts +97 -0
- package/skills/octocode-code-engineer/src/collectors/test-profile.ts +269 -0
- package/skills/octocode-code-engineer/src/common/is-direct-run.test.ts +32 -0
- package/skills/octocode-code-engineer/src/common/is-direct-run.ts +13 -0
- package/skills/octocode-code-engineer/src/common/utils.test.ts +463 -0
- package/skills/octocode-code-engineer/src/common/utils.ts +304 -0
- package/skills/octocode-code-engineer/src/detectors/code-quality.ts +966 -0
- package/skills/octocode-code-engineer/src/detectors/cohesion.ts +539 -0
- package/skills/octocode-code-engineer/src/detectors/coupling.ts +323 -0
- package/skills/octocode-code-engineer/src/detectors/cycle.ts +349 -0
- package/skills/octocode-code-engineer/src/detectors/dead-code.ts +320 -0
- package/skills/octocode-code-engineer/src/detectors/import-style.ts +376 -0
- package/skills/octocode-code-engineer/src/detectors/index.test.ts +3061 -0
- package/skills/octocode-code-engineer/src/detectors/index.ts +88 -0
- package/skills/octocode-code-engineer/src/detectors/security.test.ts +882 -0
- package/skills/octocode-code-engineer/src/detectors/security.ts +821 -0
- package/skills/octocode-code-engineer/src/detectors/semantic.ts +758 -0
- package/skills/octocode-code-engineer/src/detectors/shared.ts +49 -0
- package/skills/octocode-code-engineer/src/detectors/test-quality.test.ts +388 -0
- package/skills/octocode-code-engineer/src/detectors/test-quality.ts +367 -0
- package/skills/octocode-code-engineer/src/index.test.ts +4425 -0
- package/skills/octocode-code-engineer/src/index.ts +403 -0
- package/skills/octocode-code-engineer/src/pipeline/cache.test.ts +199 -0
- package/skills/octocode-code-engineer/src/pipeline/cache.ts +130 -0
- package/skills/octocode-code-engineer/src/pipeline/cli.test.ts +493 -0
- package/skills/octocode-code-engineer/src/pipeline/cli.ts +344 -0
- package/skills/octocode-code-engineer/src/pipeline/main.test.ts +174 -0
- package/skills/octocode-code-engineer/src/pipeline/main.ts +1074 -0
- package/skills/octocode-code-engineer/src/pipeline.test.ts +84 -0
- package/skills/octocode-code-engineer/src/reporting/analysis.test.ts +782 -0
- package/skills/octocode-code-engineer/src/reporting/analysis.ts +688 -0
- package/skills/octocode-code-engineer/src/reporting/output-contract.test.ts +463 -0
- package/skills/octocode-code-engineer/src/reporting/summary-md.test.ts +421 -0
- package/skills/octocode-code-engineer/src/reporting/summary-md.ts +714 -0
- package/skills/octocode-code-engineer/src/reporting/writer.ts +430 -0
- package/skills/octocode-code-engineer/src/sanity.test.ts +47 -0
- package/skills/octocode-code-engineer/src/types/constants.ts +248 -0
- package/skills/octocode-code-engineer/src/types/index.ts +80 -0
- package/skills/octocode-code-engineer/src/types/interfaces.ts +682 -0
- package/skills/octocode-code-engineer/tsconfig.json +17 -0
- package/skills/octocode-code-engineer/vitest.config.ts +8 -0
- package/skills/octocode-documentation-writer/README.md +113 -0
- package/skills/octocode-documentation-writer/SKILL.md +886 -0
- package/skills/octocode-documentation-writer/references/agent-discovery-analysis.md +453 -0
- package/skills/octocode-documentation-writer/references/agent-documentation-writer.md +255 -0
- package/skills/octocode-documentation-writer/references/agent-engineer-questions.md +247 -0
- package/skills/octocode-documentation-writer/references/agent-orchestrator.md +370 -0
- package/skills/octocode-documentation-writer/references/agent-qa-validator.md +227 -0
- package/skills/octocode-documentation-writer/references/agent-researcher.md +250 -0
- package/skills/octocode-documentation-writer/schemas/analysis-schema.json +886 -0
- package/skills/octocode-documentation-writer/schemas/discovery-tasks.json +96 -0
- package/skills/octocode-documentation-writer/schemas/documentation-structure.json +373 -0
- package/skills/octocode-documentation-writer/schemas/partial-discovery-schema.json +102 -0
- package/skills/octocode-documentation-writer/schemas/partial-research-schema.json +98 -0
- package/skills/octocode-documentation-writer/schemas/qa-results-schema.json +113 -0
- package/skills/octocode-documentation-writer/schemas/questions-schema.json +228 -0
- package/skills/octocode-documentation-writer/schemas/research-schema.json +104 -0
- package/skills/octocode-documentation-writer/schemas/state-schema.json +222 -0
- package/skills/octocode-documentation-writer/schemas/work-assignments-schema.json +74 -0
- package/skills/octocode-plan/SKILL.md +122 -116
- package/skills/octocode-prompt-optimizer/SKILL.md +617 -0
- package/skills/octocode-pull-request-reviewer/README.md +249 -0
- package/skills/octocode-pull-request-reviewer/SKILL.md +479 -0
- package/skills/octocode-pull-request-reviewer/references/dependency-check.md +74 -0
- package/skills/octocode-pull-request-reviewer/references/domain-reviewers.md +24 -0
- package/skills/octocode-pull-request-reviewer/references/execution-lifecycle.md +441 -0
- package/skills/octocode-pull-request-reviewer/references/flow-analysis-protocol.md +64 -0
- package/skills/octocode-pull-request-reviewer/references/output-template.md +174 -0
- package/skills/octocode-pull-request-reviewer/references/parallel-agent-protocol.md +182 -0
- package/skills/octocode-pull-request-reviewer/references/review-guidelines.md +26 -0
- package/skills/octocode-pull-request-reviewer/references/verification-checklist.md +40 -0
- package/skills/octocode-research/.claude/settings.local.json +46 -0
- package/skills/octocode-research/.octocode/plan/code-review-fixes/plan.md +312 -0
- package/skills/octocode-research/.octocode/plan/code-review-fixes/research.md +212 -0
- package/skills/octocode-research/.octocode/plans/NODE_SERVER_START_PLAN.md +755 -0
- package/skills/octocode-research/.octocode/research/code-review/research.md +371 -0
- package/skills/octocode-research/.octocode/review/IMPROVEMENTS.md +391 -0
- package/skills/octocode-research/.octocode/review/REVIEW_PLAN.md +289 -0
- package/skills/octocode-research/.octocode/review/REVIEW_REPORT.md +356 -0
- package/skills/octocode-research/AGENTS.md +349 -0
- package/skills/octocode-research/README.md +494 -0
- package/skills/octocode-research/SKILL.md +652 -274
- package/skills/octocode-research/docs/API_REFERENCE.md +562 -0
- package/skills/octocode-research/docs/ARCHITECTURE.md +554 -0
- package/skills/octocode-research/docs/FLOWS.md +577 -0
- package/skills/octocode-research/docs/OVERVIEW.md +564 -0
- package/skills/octocode-research/docs/SERVER_FLOWS.md +631 -0
- package/skills/octocode-research/ecosystem.config.cjs +88 -0
- package/skills/octocode-research/eslint.config.mjs +27 -0
- package/skills/octocode-research/package.json +84 -0
- package/skills/octocode-research/references/GUARDRAILS.md +40 -0
- package/skills/octocode-research/references/PARALLEL_AGENT_PROTOCOL.md +178 -0
- package/skills/octocode-research/references/roast-prompt.md +149 -0
- package/skills/octocode-research/scripts/server-init.d.ts +2 -0
- package/skills/octocode-research/scripts/server-init.js +2 -0
- package/skills/octocode-research/scripts/server.d.ts +8 -0
- package/skills/octocode-research/scripts/server.js +445 -0
- package/skills/octocode-research/src/__tests__/integration/circuitBreaker.test.ts +205 -0
- package/skills/octocode-research/src/__tests__/integration/routes.test.ts +374 -0
- package/skills/octocode-research/src/__tests__/unit/circuitBreaker.test.ts +245 -0
- package/skills/octocode-research/src/__tests__/unit/errorHandler.test.ts +183 -0
- package/skills/octocode-research/src/__tests__/unit/httpPreprocess.test.ts +157 -0
- package/skills/octocode-research/src/__tests__/unit/logger.test.ts +143 -0
- package/skills/octocode-research/src/__tests__/unit/queryParser.test.ts +130 -0
- package/skills/octocode-research/src/__tests__/unit/responseBuilder.test.ts +469 -0
- package/skills/octocode-research/src/__tests__/unit/retry.test.ts +205 -0
- package/skills/octocode-research/src/index.ts +186 -0
- package/skills/octocode-research/src/mcpCache.ts +49 -0
- package/skills/octocode-research/src/middleware/errorHandler.ts +65 -0
- package/skills/octocode-research/src/middleware/logger.ts +61 -0
- package/skills/octocode-research/src/middleware/queryParser.ts +115 -0
- package/skills/octocode-research/src/middleware/readiness.ts +17 -0
- package/skills/octocode-research/src/routes/github.ts +197 -0
- package/skills/octocode-research/src/routes/local.ts +175 -0
- package/skills/octocode-research/src/routes/lsp.ts +177 -0
- package/skills/octocode-research/src/routes/package.ts +127 -0
- package/skills/octocode-research/src/routes/prompts.ts +138 -0
- package/skills/octocode-research/src/routes/tools.ts +677 -0
- package/skills/octocode-research/src/server-init.ts +363 -0
- package/skills/octocode-research/src/server.ts +285 -0
- package/skills/octocode-research/src/types/errorGuards.ts +151 -0
- package/skills/octocode-research/src/types/express.d.ts +76 -0
- package/skills/octocode-research/src/types/guards.ts +98 -0
- package/skills/octocode-research/src/types/mcp.ts +119 -0
- package/skills/octocode-research/src/types/responses.ts +199 -0
- package/skills/octocode-research/src/types/toolTypes.ts +33 -0
- package/skills/octocode-research/src/utils/asyncTimeout.ts +116 -0
- package/skills/octocode-research/src/utils/circuitBreaker.ts +492 -0
- package/skills/octocode-research/src/utils/colors.ts +53 -0
- package/skills/octocode-research/src/utils/errorQueue.ts +71 -0
- package/skills/octocode-research/src/utils/logEmoji.ts +103 -0
- package/skills/octocode-research/src/utils/logger.ts +413 -0
- package/skills/octocode-research/src/utils/resilience.ts +169 -0
- package/skills/octocode-research/src/utils/responseBuilder.ts +495 -0
- package/skills/octocode-research/src/utils/responseFactory.ts +100 -0
- package/skills/octocode-research/src/utils/responseParser.ts +272 -0
- package/skills/octocode-research/src/utils/retry.ts +280 -0
- package/skills/octocode-research/src/utils/routeFactory.ts +117 -0
- package/skills/octocode-research/src/utils/url.ts +20 -0
- package/skills/octocode-research/src/validation/httpPreprocess.ts +155 -0
- package/skills/octocode-research/src/validation/index.ts +2 -0
- package/skills/octocode-research/src/validation/schemas.ts +578 -0
- package/skills/octocode-research/src/validation/toolCallSchema.ts +132 -0
- package/skills/octocode-research/tsconfig.json +21 -0
- package/skills/octocode-research/tsdown.config.ts +42 -0
- package/skills/octocode-research/vitest.config.ts +20 -0
- package/skills/octocode-researcher/SKILL.md +461 -0
- package/skills/octocode-researcher/references/fallbacks.md +120 -0
- package/skills/{octocode-local-search → octocode-researcher}/references/tool-reference.md +132 -49
- package/skills/{octocode-local-search → octocode-researcher}/references/workflow-patterns.md +204 -4
- package/skills/octocode-rfc-generator/SKILL.md +223 -0
- package/skills/octocode-rfc-generator/references/rfc-template.md +193 -0
- package/skills/octocode-roast/SKILL.md +63 -21
- package/skills/octocode-implement/SKILL.md +0 -293
- package/skills/octocode-implement/references/execution-phases.md +0 -317
- package/skills/octocode-implement/references/tool-reference.md +0 -403
- package/skills/octocode-implement/references/workflow-patterns.md +0 -385
- package/skills/octocode-local-search/SKILL.md +0 -449
- package/skills/octocode-pr-review/SKILL.md +0 -391
- package/skills/octocode-pr-review/references/domain-reviewers.md +0 -105
- package/skills/octocode-pr-review/references/execution-lifecycle.md +0 -116
- package/skills/octocode-pr-review/references/research-flows.md +0 -75
- package/skills/octocode-research/references/tool-reference.md +0 -304
- package/skills/octocode-research/references/workflow-patterns.md +0 -325
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# Octocode Research Skill - Code Review Report
|
|
2
|
+
|
|
3
|
+
> **Target**: `/Users/guybary/octocode-mcp/skills/octocode-research`
|
|
4
|
+
> **Version**: 2.0.0
|
|
5
|
+
> **Date**: 2026-01-16
|
|
6
|
+
> **Reviewer**: Claude (automated review)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
The octocode-research skill is a well-architected Express.js HTTP server with strong security practices, comprehensive validation, and good resilience patterns. The main areas for improvement are **test coverage** and **documentation accuracy**.
|
|
13
|
+
|
|
14
|
+
### Overall Assessment: **GOOD** with recommendations
|
|
15
|
+
|
|
16
|
+
| Category | Rating | Notes |
|
|
17
|
+
|----------|--------|-------|
|
|
18
|
+
| Security | **A-** | Strong path validation, one medium-risk logging issue |
|
|
19
|
+
| Architecture | **A** | Clean separation, proper middleware order |
|
|
20
|
+
| Validation | **A** | Comprehensive Zod schemas with type-safe preprocessors |
|
|
21
|
+
| Utilities | **B+** | Well-designed but responseBuilder is complex |
|
|
22
|
+
| Testing | **C** | Critical coverage gaps in utilities |
|
|
23
|
+
| Documentation | **B** | ARCHITECTURE.md has outdated endpoint references |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. Security Review
|
|
28
|
+
|
|
29
|
+
### 1.1 Path Traversal Protection - LOW RISK
|
|
30
|
+
|
|
31
|
+
**File**: `src/validation/schemas.ts:48-56`
|
|
32
|
+
|
|
33
|
+
**Implementation**:
|
|
34
|
+
```typescript
|
|
35
|
+
const safePath = z.string().refine(
|
|
36
|
+
(p) => {
|
|
37
|
+
const normalized = path.normalize(p);
|
|
38
|
+
if (normalized.includes('..')) return false; // Blocks traversal
|
|
39
|
+
if (p.includes('\0')) return false; // Blocks null byte
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
{ message: 'Path contains invalid traversal patterns' }
|
|
43
|
+
);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Findings**:
|
|
47
|
+
- Path normalization before `..` check is correct
|
|
48
|
+
- Null byte injection properly blocked
|
|
49
|
+
- All local routes use `safePath` validator
|
|
50
|
+
- URL encoding handled by Express before validation
|
|
51
|
+
|
|
52
|
+
**Recommendation**: Consider adding symlink traversal documentation warning.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### 1.2 Token Handling - LOW RISK
|
|
57
|
+
|
|
58
|
+
**Files**: `src/routes/github.ts`, `src/validation/schemas.ts`
|
|
59
|
+
|
|
60
|
+
**Findings**:
|
|
61
|
+
- No token parameters in any HTTP route schemas
|
|
62
|
+
- Token management delegated to `octocode-mcp/public` module
|
|
63
|
+
- Tokens never appear in query parameters or logs
|
|
64
|
+
|
|
65
|
+
**Verification**: Checked all 5 GitHub schemas - none accept token parameters.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 1.3 Error Message Information Leakage - MEDIUM RISK
|
|
70
|
+
|
|
71
|
+
**File**: `src/middleware/errorHandler.ts:21-29`
|
|
72
|
+
|
|
73
|
+
**Issue**:
|
|
74
|
+
```typescript
|
|
75
|
+
if (isValidationError) {
|
|
76
|
+
logWarn(`[VALIDATION] ${req.method} ${req.path}: ${error.message}`, {
|
|
77
|
+
path: req.path,
|
|
78
|
+
query: req.query, // <-- Full query params logged without sanitization
|
|
79
|
+
details: error.details,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Risk**: If sensitive data is inadvertently passed in query parameters, it will be logged to `~/.octocode/logs/errors.log`.
|
|
85
|
+
|
|
86
|
+
**Recommendation**: Sanitize or mask sensitive query parameters before logging.
|
|
87
|
+
|
|
88
|
+
**Client Response**: Safe - only Zod validation details exposed (acceptable for 400 errors), no stack traces.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 2. Core Architecture Review
|
|
93
|
+
|
|
94
|
+
### 2.1 Server Setup - GOOD
|
|
95
|
+
|
|
96
|
+
**File**: `src/server.ts`
|
|
97
|
+
|
|
98
|
+
**Middleware Order** (correct):
|
|
99
|
+
1. `express.json()` - Parse JSON bodies
|
|
100
|
+
2. `requestLogger` - Log requests
|
|
101
|
+
3. Route handlers
|
|
102
|
+
4. `errorHandler` - Catch errors (last)
|
|
103
|
+
|
|
104
|
+
**Graceful Shutdown** (correct):
|
|
105
|
+
- Handles SIGTERM, SIGINT
|
|
106
|
+
- Stops context cleanup interval
|
|
107
|
+
- 10-second forced shutdown timeout
|
|
108
|
+
|
|
109
|
+
**Route Mounting**:
|
|
110
|
+
```typescript
|
|
111
|
+
app.use('/', localRoutes); // /localSearchCode, etc.
|
|
112
|
+
app.use('/', lspRoutes); // /lspGotoDefinition, etc.
|
|
113
|
+
app.use('/', githubRoutes); // /githubSearchCode, etc.
|
|
114
|
+
app.use('/', packageRoutes); // /packageSearch
|
|
115
|
+
app.use('/tools', toolsRoutes);
|
|
116
|
+
app.use('/prompts', promptsRoutes);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 2.2 Middleware Review
|
|
122
|
+
|
|
123
|
+
| Middleware | Status | Notes |
|
|
124
|
+
|------------|--------|-------|
|
|
125
|
+
| `requestLogger.ts` | GOOD | Clean request/response logging |
|
|
126
|
+
| `errorHandler.ts` | GOOD | Proper error classification, safe responses |
|
|
127
|
+
| `contextPropagation.ts` | OK | Mostly placeholder (cleanup logic empty) |
|
|
128
|
+
| `queryParser.ts` | GOOD | Zod validation with batch mode support |
|
|
129
|
+
|
|
130
|
+
**Note**: `contextPropagation.ts` contains dead code (interface defined but not used). The cleanup interval logs but doesn't actually clean anything.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 3. Validation Review
|
|
135
|
+
|
|
136
|
+
### 3.1 Schema Completeness - EXCELLENT
|
|
137
|
+
|
|
138
|
+
**File**: `src/validation/schemas.ts` (623 lines)
|
|
139
|
+
|
|
140
|
+
**Strengths**:
|
|
141
|
+
- Type-safe preprocessors (`toNumber`, `toBoolean`, `toArray`)
|
|
142
|
+
- Comprehensive field validation for all endpoints
|
|
143
|
+
- Enum constraints prevent injection
|
|
144
|
+
- Complex validation (e.g., `githubReposSchema` requires keywords OR topics)
|
|
145
|
+
- Backwards compatibility via transform functions
|
|
146
|
+
|
|
147
|
+
**Coverage**:
|
|
148
|
+
- Local routes: 4 schemas
|
|
149
|
+
- LSP routes: 3 schemas
|
|
150
|
+
- GitHub routes: 5 schemas
|
|
151
|
+
- Package routes: 1 schema
|
|
152
|
+
|
|
153
|
+
All schemas properly validated against endpoint usage.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 4. Utilities Review
|
|
158
|
+
|
|
159
|
+
### 4.1 Response Builder
|
|
160
|
+
|
|
161
|
+
**File**: `src/utils/responseBuilder.ts` (497 lines)
|
|
162
|
+
|
|
163
|
+
**Assessment**: **NOT over-engineered**
|
|
164
|
+
|
|
165
|
+
The file provides 7 specialized response formatters:
|
|
166
|
+
- `searchResults` - Search result formatting
|
|
167
|
+
- `fileContent` - File content with code fence
|
|
168
|
+
- `lspResult` - LSP definition/reference/calls
|
|
169
|
+
- `repoStructure` - Repository structure
|
|
170
|
+
- `packageSearch` - Package search results
|
|
171
|
+
- `pullRequests` - PR search results
|
|
172
|
+
- `bulkResult` - Generic bulk operations
|
|
173
|
+
|
|
174
|
+
**Design**:
|
|
175
|
+
- Uses MCP role-based response API
|
|
176
|
+
- Properly passes through MCP hints
|
|
177
|
+
- Handles empty/paginated states
|
|
178
|
+
- Language detection for syntax highlighting
|
|
179
|
+
|
|
180
|
+
**Recommendation**: Well-designed, no refactoring needed.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### 4.2 Resilience Utilities
|
|
185
|
+
|
|
186
|
+
**Files**: `circuitBreaker.ts`, `retry.ts`, `resilience.ts`
|
|
187
|
+
|
|
188
|
+
**Circuit Breaker** (`circuitBreaker.ts:266 lines`):
|
|
189
|
+
- Pre-configured for LSP (10s timeout, 3 failures)
|
|
190
|
+
- Pre-configured for GitHub (60s timeout, 2 failures)
|
|
191
|
+
- Proper state machine (closed → open → half-open → closed)
|
|
192
|
+
- Manual reset capability
|
|
193
|
+
|
|
194
|
+
**Retry** (`retry.ts:261 lines`):
|
|
195
|
+
- Exponential backoff with max delay cap
|
|
196
|
+
- Category-specific configs (LSP, GitHub, local, package)
|
|
197
|
+
- Error type detection (rate limit, timeout, connection refused, etc.)
|
|
198
|
+
|
|
199
|
+
**Integration** (`resilience.ts:114 lines`):
|
|
200
|
+
- Circuit breaker wraps retry (correct order)
|
|
201
|
+
- Clean category-based wrapper functions
|
|
202
|
+
|
|
203
|
+
**Assessment**: Well-implemented resilience patterns.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### 4.3 Logger
|
|
208
|
+
|
|
209
|
+
**File**: `src/utils/logger.ts` (298 lines)
|
|
210
|
+
|
|
211
|
+
**Features**:
|
|
212
|
+
- Log rotation at 10MB
|
|
213
|
+
- Old log cleanup (keeps last 5)
|
|
214
|
+
- Cross-platform paths (`~/.octocode/logs/`)
|
|
215
|
+
- Graceful fallback on file write errors
|
|
216
|
+
|
|
217
|
+
**Potential Issue**: Concurrent write safety not explicitly handled (Node.js `appendFileSync` should be atomic for small writes).
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 5. Testing Review
|
|
222
|
+
|
|
223
|
+
### 5.1 Current Coverage
|
|
224
|
+
|
|
225
|
+
| Test File | Lines | Coverage |
|
|
226
|
+
|-----------|-------|----------|
|
|
227
|
+
| `routes.test.ts` | 375 | All routes - validation and success cases |
|
|
228
|
+
| `circuitBreaker.test.ts` | 206 | Full state machine coverage |
|
|
229
|
+
|
|
230
|
+
### 5.2 Critical Test Gaps
|
|
231
|
+
|
|
232
|
+
**CRITICAL - No tests**:
|
|
233
|
+
|
|
234
|
+
| Utility | Lines | Risk |
|
|
235
|
+
|---------|-------|------|
|
|
236
|
+
| `responseBuilder.ts` | 497 | HIGH - 7 formatters untested |
|
|
237
|
+
| `logger.ts` | 298 | MEDIUM - File I/O untested |
|
|
238
|
+
| `retry.ts` | 261 | HIGH - Backoff logic untested |
|
|
239
|
+
|
|
240
|
+
**HIGH - No tests**:
|
|
241
|
+
|
|
242
|
+
| Utility | Lines | Risk |
|
|
243
|
+
|---------|-------|------|
|
|
244
|
+
| `resilience.ts` | 114 | MEDIUM - Integration untested |
|
|
245
|
+
| `routeFactory.ts` | 113 | MEDIUM - Factory pattern untested |
|
|
246
|
+
|
|
247
|
+
**MEDIUM - No tests**:
|
|
248
|
+
|
|
249
|
+
| Utility | Lines | Risk |
|
|
250
|
+
|---------|-------|------|
|
|
251
|
+
| `responseParser.ts` | 152 | LOW - YAML parsing |
|
|
252
|
+
| `responseFactory.ts` | 159 | LOW - Transformations |
|
|
253
|
+
|
|
254
|
+
### 5.3 Test Recommendations (Priority Order)
|
|
255
|
+
|
|
256
|
+
1. **responseBuilder.ts** - Test each formatter, pagination, empty states
|
|
257
|
+
2. **retry.ts** - Test backoff calculation, error detection functions
|
|
258
|
+
3. **logger.ts** - Test rotation, fallback, cross-platform paths
|
|
259
|
+
4. **resilience.ts** - Test circuit breaker + retry integration
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 6. Documentation Review
|
|
264
|
+
|
|
265
|
+
### 6.1 SKILL.md - ACCURATE
|
|
266
|
+
|
|
267
|
+
Comprehensive skill guide with:
|
|
268
|
+
- Execution lifecycle
|
|
269
|
+
- Prompt selection matrix
|
|
270
|
+
- API format examples
|
|
271
|
+
- Security guardrails
|
|
272
|
+
|
|
273
|
+
**Status**: Up-to-date with actual implementation.
|
|
274
|
+
|
|
275
|
+
### 6.2 ARCHITECTURE.md - OUTDATED
|
|
276
|
+
|
|
277
|
+
**Issues Found**:
|
|
278
|
+
|
|
279
|
+
1. **Endpoint references incorrect**:
|
|
280
|
+
- Document says: `/local/search`, `/lsp/definition`
|
|
281
|
+
- Actual routes: `/localSearchCode`, `/lspGotoDefinition`
|
|
282
|
+
|
|
283
|
+
2. **Directory structure incomplete**:
|
|
284
|
+
- Missing: `routes/tools.ts`, `routes/prompts.ts`
|
|
285
|
+
- Lists non-existent: `rateLimitHandler.ts`
|
|
286
|
+
|
|
287
|
+
3. **Known Issues section**:
|
|
288
|
+
- References `rawResult.structuredContent` issue - may be outdated
|
|
289
|
+
|
|
290
|
+
**Recommendation**: Update ARCHITECTURE.md endpoint table and directory structure.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## 7. Prioritized Recommendations
|
|
295
|
+
|
|
296
|
+
### Priority 1 - Critical
|
|
297
|
+
|
|
298
|
+
| # | Issue | File | Action |
|
|
299
|
+
|---|-------|------|--------|
|
|
300
|
+
| 1 | Test coverage gaps | `__tests__/` | Add unit tests for utilities |
|
|
301
|
+
| 2 | Query param logging | `errorHandler.ts:24` | Sanitize sensitive params |
|
|
302
|
+
|
|
303
|
+
### Priority 2 - Important
|
|
304
|
+
|
|
305
|
+
| # | Issue | File | Action |
|
|
306
|
+
|---|-------|------|--------|
|
|
307
|
+
| 3 | Documentation mismatch | `ARCHITECTURE.md` | Update endpoint references |
|
|
308
|
+
| 4 | Dead code | `contextPropagation.ts` | Remove unused context tracking |
|
|
309
|
+
|
|
310
|
+
### Priority 3 - Nice to Have
|
|
311
|
+
|
|
312
|
+
| # | Issue | File | Action |
|
|
313
|
+
|---|-------|------|--------|
|
|
314
|
+
| 5 | Coverage thresholds | `vitest.config.ts` | Add minimum coverage requirements |
|
|
315
|
+
| 6 | Symlink warning | `SKILL.md` | Document `followSymlinks` security note |
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 8. Verification Checklist
|
|
320
|
+
|
|
321
|
+
Run after making changes:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Run existing tests
|
|
325
|
+
npm test
|
|
326
|
+
|
|
327
|
+
# Build project
|
|
328
|
+
npm run build
|
|
329
|
+
|
|
330
|
+
# Start server
|
|
331
|
+
npm run server:start
|
|
332
|
+
|
|
333
|
+
# Test health endpoint
|
|
334
|
+
curl http://localhost:1987/health
|
|
335
|
+
|
|
336
|
+
# Test sample endpoint
|
|
337
|
+
curl "http://localhost:1987/localSearchCode?pattern=export&path=/src"
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Appendix: Files Reviewed
|
|
343
|
+
|
|
344
|
+
| Category | Files |
|
|
345
|
+
|----------|-------|
|
|
346
|
+
| Server | `server.ts`, `index.ts`, `mcpCache.ts` |
|
|
347
|
+
| Routes | `local.ts`, `github.ts`, `lsp.ts`, `package.ts`, `tools.ts`, `prompts.ts` |
|
|
348
|
+
| Middleware | `errorHandler.ts`, `logger.ts`, `contextPropagation.ts`, `queryParser.ts` |
|
|
349
|
+
| Validation | `schemas.ts` |
|
|
350
|
+
| Utilities | `responseBuilder.ts`, `circuitBreaker.ts`, `retry.ts`, `resilience.ts`, `logger.ts` |
|
|
351
|
+
| Tests | `routes.test.ts`, `circuitBreaker.test.ts` |
|
|
352
|
+
| Docs | `SKILL.md`, `ARCHITECTURE.md` |
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
*Generated by automated code review*
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# Octocode Research Skill - Agent Development Guide
|
|
2
|
+
|
|
3
|
+
> HTTP API server wrapping `octocode-mcp` tools for code research at `localhost:1987` by default (configurable via `OCTOCODE_RESEARCH_HOST` / `OCTOCODE_RESEARCH_PORT`)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
| Attribute | Value |
|
|
8
|
+
|-----------|-------|
|
|
9
|
+
| **Type** | Express.js HTTP Server |
|
|
10
|
+
| **Host** | localhost (default) |
|
|
11
|
+
| **Port** | 1987 (default) |
|
|
12
|
+
| **Package** | `octocode-research` |
|
|
13
|
+
| **Version** | 2.0.0 |
|
|
14
|
+
| **Main Dependency** | `octocode-mcp` |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Quick Commands
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Development
|
|
22
|
+
npm run build # Bundle with tsdown
|
|
23
|
+
npm start # Run bundled server
|
|
24
|
+
npm run dev # Run with tsx watch mode
|
|
25
|
+
npm test # Run tests with Vitest
|
|
26
|
+
npm run test:watch # Watch mode testing
|
|
27
|
+
npm run lint # ESLint check
|
|
28
|
+
npm run lint:fix # Auto-fix lint issues
|
|
29
|
+
|
|
30
|
+
# Server Health Check
|
|
31
|
+
curl http://localhost:1987/health
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Project Structure
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
octocode-research/
|
|
40
|
+
├── src/
|
|
41
|
+
│ ├── server.ts # Express server entry point
|
|
42
|
+
│ ├── index.ts # Re-exports from octocode-mcp
|
|
43
|
+
│ ├── mcpCache.ts # MCP client caching
|
|
44
|
+
│ ├── routes/
|
|
45
|
+
│ │ ├── local.ts # Local tool handlers (used in tests)
|
|
46
|
+
│ │ ├── lsp.ts # LSP tool handlers (used in tests)
|
|
47
|
+
│ │ ├── github.ts # GitHub tool handlers (used in tests)
|
|
48
|
+
│ │ ├── package.ts # Package tool handlers (used in tests)
|
|
49
|
+
│ │ ├── tools.ts # /tools/* - MAIN tool API (mounted)
|
|
50
|
+
│ │ └── prompts.ts # /prompts/* - prompt discovery (mounted)
|
|
51
|
+
│ ├── middleware/
|
|
52
|
+
│ │ ├── errorHandler.ts # Error response formatting
|
|
53
|
+
│ │ ├── logger.ts # Request/response logging
|
|
54
|
+
│ │ ├── queryParser.ts # Zod validation
|
|
55
|
+
│ │ └── readiness.ts # Server readiness check
|
|
56
|
+
│ ├── validation/
|
|
57
|
+
│ │ ├── index.ts # Schema exports
|
|
58
|
+
│ │ ├── schemas.ts # HTTP schemas (import from octocode-mcp)
|
|
59
|
+
│ │ └── httpPreprocess.ts # HTTP query string preprocessing
|
|
60
|
+
│ ├── utils/
|
|
61
|
+
│ │ ├── colors.ts # Console color functions
|
|
62
|
+
│ │ ├── logger.ts # File-based logging
|
|
63
|
+
│ │ ├── responseBuilder.ts # Role-based response formatting
|
|
64
|
+
│ │ ├── responseFactory.ts # Response creation helpers
|
|
65
|
+
│ │ ├── responseParser.ts # MCP response parsing
|
|
66
|
+
│ │ ├── resilience.ts # Resilience utilities
|
|
67
|
+
│ │ ├── retry.ts # Retry with backoff
|
|
68
|
+
│ │ ├── circuitBreaker.ts # Circuit breaker pattern
|
|
69
|
+
│ │ └── routeFactory.ts # Route handler factory
|
|
70
|
+
│ ├── types/
|
|
71
|
+
│ │ ├── express.d.ts # Express type extensions
|
|
72
|
+
│ │ ├── guards.ts # Type guard functions
|
|
73
|
+
│ │ ├── mcp.ts # MCP protocol types
|
|
74
|
+
│ │ ├── responses.ts # Response types
|
|
75
|
+
│ │ └── toolTypes.ts # Tool parameter types
|
|
76
|
+
│ └── __tests__/
|
|
77
|
+
│ ├── integration/ # Integration tests
|
|
78
|
+
│ │ ├── circuitBreaker.test.ts
|
|
79
|
+
│ │ └── routes.test.ts
|
|
80
|
+
│ └── unit/ # Unit tests
|
|
81
|
+
│ ├── circuitBreaker.test.ts
|
|
82
|
+
│ ├── logger.test.ts
|
|
83
|
+
│ ├── responseBuilder.test.ts
|
|
84
|
+
│ └── retry.test.ts
|
|
85
|
+
├── docs/
|
|
86
|
+
│ ├── API_REFERENCE.md # Complete HTTP API reference
|
|
87
|
+
│ ├── ARCHITECTURE.md # Architecture documentation
|
|
88
|
+
│ └── FLOWS.md # Main flows & connections
|
|
89
|
+
├── references/
|
|
90
|
+
│ └── GUARDRAILS.md # Safety guardrails
|
|
91
|
+
├── scripts/ # Bundled output
|
|
92
|
+
│ ├── server.js # Bundled server
|
|
93
|
+
│ └── server.d.ts # Type declarations
|
|
94
|
+
├── SKILL.md # Skill definition for AI agents
|
|
95
|
+
├── AGENTS.md # This file
|
|
96
|
+
├── tsdown.config.ts # tsdown bundler configuration
|
|
97
|
+
├── package.json
|
|
98
|
+
├── tsconfig.json
|
|
99
|
+
├── eslint.config.mjs
|
|
100
|
+
└── vitest.config.ts # Test configuration
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## API Endpoints
|
|
106
|
+
|
|
107
|
+
### Available Routes
|
|
108
|
+
|
|
109
|
+
| Endpoint | Description |
|
|
110
|
+
|----------|-------------|
|
|
111
|
+
| `GET /health` | Server health check |
|
|
112
|
+
| `GET /tools/list` | List all tools (concise) |
|
|
113
|
+
| `GET /tools/info` | List all tools with details |
|
|
114
|
+
| `GET /tools/info/:toolName` | Get specific tool schema (call BEFORE using!) |
|
|
115
|
+
| `GET /tools/system` | Get system prompt (load FIRST) |
|
|
116
|
+
| `GET /tools/initContext` | Combined system prompt + all tool schemas (recommended for init) |
|
|
117
|
+
| `POST /tools/call/:toolName` | **Execute any tool** |
|
|
118
|
+
| `GET /prompts/list` | List all prompts |
|
|
119
|
+
| `GET /prompts/info/:promptName` | Get specific prompt content |
|
|
120
|
+
|
|
121
|
+
### Tool Execution (Unified API)
|
|
122
|
+
|
|
123
|
+
**All tools are called via `POST /tools/call/:toolName`** with JSON body:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
curl -X POST http://localhost:1987/tools/call/localSearchCode \
|
|
127
|
+
-H "Content-Type: application/json" \
|
|
128
|
+
-d '{"queries":[{
|
|
129
|
+
"pattern":"useState",
|
|
130
|
+
"path":"/project",
|
|
131
|
+
"mainResearchGoal":"Find React hooks",
|
|
132
|
+
"researchGoal":"Locate useState",
|
|
133
|
+
"reasoning":"Need source location"
|
|
134
|
+
}]}'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Available Tools (via `/tools/call/:toolName`)
|
|
138
|
+
|
|
139
|
+
| Tool Name | Category | Description |
|
|
140
|
+
|-----------|----------|-------------|
|
|
141
|
+
| `localSearchCode` | Local | Code search via ripgrep |
|
|
142
|
+
| `localGetFileContent` | Local | Read file content |
|
|
143
|
+
| `localFindFiles` | Local | Find files by pattern/metadata |
|
|
144
|
+
| `localViewStructure` | Local | View directory tree |
|
|
145
|
+
| `lspGotoDefinition` | LSP | Go to symbol definition |
|
|
146
|
+
| `lspFindReferences` | LSP | Find all references |
|
|
147
|
+
| `lspCallHierarchy` | LSP | Call hierarchy (incoming/outgoing) |
|
|
148
|
+
| `githubSearchCode` | GitHub | Search GitHub code |
|
|
149
|
+
| `githubGetFileContent` | GitHub | Read GitHub files |
|
|
150
|
+
| `githubSearchRepositories` | GitHub | Search repositories |
|
|
151
|
+
| `githubViewRepoStructure` | GitHub | View repo structure |
|
|
152
|
+
| `githubSearchPullRequests` | GitHub | Search pull requests |
|
|
153
|
+
| `packageSearch` | Package | Search npm/PyPI packages |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Key Files & Responsibilities
|
|
158
|
+
|
|
159
|
+
### Entry Points
|
|
160
|
+
|
|
161
|
+
| File | Purpose |
|
|
162
|
+
|------|---------|
|
|
163
|
+
| `src/server.ts` | Express app creation, route mounting, graceful shutdown |
|
|
164
|
+
| `src/index.ts` | Re-exports octocode-mcp functions with cleaner names |
|
|
165
|
+
| `src/mcpCache.ts` | MCP client instance caching and management |
|
|
166
|
+
|
|
167
|
+
### Routes
|
|
168
|
+
|
|
169
|
+
Each route file follows the pattern:
|
|
170
|
+
1. Import tool function from `../index.js`
|
|
171
|
+
2. Define Express Router
|
|
172
|
+
3. Apply validation middleware
|
|
173
|
+
4. Execute tool and format response
|
|
174
|
+
|
|
175
|
+
### Middleware
|
|
176
|
+
|
|
177
|
+
| File | Purpose |
|
|
178
|
+
|------|---------|
|
|
179
|
+
| `queryParser.ts` | Validates query params against Zod schemas |
|
|
180
|
+
| `errorHandler.ts` | Catches errors, formats consistent responses |
|
|
181
|
+
| `logger.ts` | Logs requests to console and file |
|
|
182
|
+
| `readiness.ts` | Server readiness check middleware |
|
|
183
|
+
|
|
184
|
+
### Validation
|
|
185
|
+
|
|
186
|
+
Schemas are imported from `octocode-mcp/public` (source of truth) and wrapped with HTTP preprocessing.
|
|
187
|
+
|
|
188
|
+
| File | Purpose |
|
|
189
|
+
|------|---------|
|
|
190
|
+
| `schemas.ts` | HTTP-wrapped schemas importing from `octocode-mcp/public` |
|
|
191
|
+
| `httpPreprocess.ts` | Query string conversion (string→number/boolean/array) |
|
|
192
|
+
|
|
193
|
+
When adding/modifying endpoints:
|
|
194
|
+
1. Check if schema exists in `octocode-mcp/public`
|
|
195
|
+
2. Create HTTP wrapper in `validation/schemas.ts` with preprocessing
|
|
196
|
+
3. Apply schema validation in route handler
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Development Guidelines
|
|
201
|
+
|
|
202
|
+
### Adding a New Endpoint
|
|
203
|
+
|
|
204
|
+
1. **Add schema** in `src/validation/schemas.ts`
|
|
205
|
+
2. **Create route handler** in appropriate `src/routes/*.ts`
|
|
206
|
+
3. **Add route to server.ts** if new route group
|
|
207
|
+
4. **Update types** if needed
|
|
208
|
+
5. **Add tests** in `src/__tests__/`
|
|
209
|
+
6. **Document** in docs/ARCHITECTURE.md
|
|
210
|
+
|
|
211
|
+
### Code Style
|
|
212
|
+
|
|
213
|
+
- **TypeScript strict mode** enabled
|
|
214
|
+
- **Zod** for runtime validation
|
|
215
|
+
- **Express async handlers** - wrap with try/catch or error middleware
|
|
216
|
+
- **Consistent logging** - use `agentLog`, `successLog`, `errorLog` from colors.ts
|
|
217
|
+
|
|
218
|
+
### Testing
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
yarn test # Run all tests
|
|
222
|
+
yarn test:watch # Watch mode
|
|
223
|
+
yarn test -- --coverage # With coverage report
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Response Format
|
|
229
|
+
|
|
230
|
+
### Single Query Response (`POST /tools/call/:toolName`)
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
{
|
|
234
|
+
tool: "localSearchCode",
|
|
235
|
+
success: true,
|
|
236
|
+
data: { files: [...], totalMatches: 10 },
|
|
237
|
+
hints: ["Use lineHint for LSP tools", ...],
|
|
238
|
+
research: {
|
|
239
|
+
mainResearchGoal: "...",
|
|
240
|
+
researchGoal: "...",
|
|
241
|
+
reasoning: "..."
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Bulk Query Response (2-3 queries)
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
{
|
|
250
|
+
tool: "localSearchCode",
|
|
251
|
+
bulk: true,
|
|
252
|
+
success: true,
|
|
253
|
+
instructions: "...",
|
|
254
|
+
results: [
|
|
255
|
+
{ id: 1, status: "hasResults", data: {...}, research: {...} },
|
|
256
|
+
{ id: 2, status: "empty", data: {...}, research: {...} }
|
|
257
|
+
],
|
|
258
|
+
hints: { hasResults: [...], empty: [...], error: [...] },
|
|
259
|
+
counts: { total: 2, hasResults: 1, empty: 1, error: 0 }
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Error Response
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
{
|
|
267
|
+
tool: "localSearchCode",
|
|
268
|
+
success: false,
|
|
269
|
+
data: {},
|
|
270
|
+
hints: ["Error recovery hint..."],
|
|
271
|
+
research: {...}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Key Dependencies
|
|
278
|
+
|
|
279
|
+
| Package | Purpose |
|
|
280
|
+
|---------|---------|
|
|
281
|
+
| `octocode-mcp` | Core tool implementations |
|
|
282
|
+
| `express` | HTTP server framework |
|
|
283
|
+
| `zod` | Schema validation |
|
|
284
|
+
| `@modelcontextprotocol/sdk` | MCP format types |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Documentation References
|
|
289
|
+
|
|
290
|
+
| Doc | Purpose |
|
|
291
|
+
|-----|---------|
|
|
292
|
+
| [SKILL.md](./SKILL.md) | How AI agents should USE this skill |
|
|
293
|
+
| [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) | Detailed architecture |
|
|
294
|
+
| [docs/FLOWS.md](./docs/FLOWS.md) | Main flows & component connections |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Console Output Colors
|
|
299
|
+
|
|
300
|
+
| Category | Color | Function |
|
|
301
|
+
|----------|-------|----------|
|
|
302
|
+
| Agent messages | 🟣 Purple | `agentLog()` |
|
|
303
|
+
| Tool results | 🔵 Blue | `resultLog()` |
|
|
304
|
+
| Success | 🟢 Green | `successLog()` |
|
|
305
|
+
| Errors | 🔴 Red | `errorLog()` |
|
|
306
|
+
| Warnings | 🟡 Yellow | `warnLog()` |
|
|
307
|
+
| Secondary info | Gray | `dimLog()` |
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Troubleshooting
|
|
312
|
+
|
|
313
|
+
### Server won't start
|
|
314
|
+
```bash
|
|
315
|
+
# Check if port 1987 is in use
|
|
316
|
+
lsof -i :1987
|
|
317
|
+
|
|
318
|
+
# Kill existing process
|
|
319
|
+
kill -9 $(lsof -ti :1987)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Build errors
|
|
323
|
+
```bash
|
|
324
|
+
# Clean and rebuild
|
|
325
|
+
rm -rf scripts/
|
|
326
|
+
npm run build
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Missing dependencies
|
|
330
|
+
```bash
|
|
331
|
+
# Reinstall
|
|
332
|
+
rm -rf node_modules/
|
|
333
|
+
yarn install
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Access Control
|
|
339
|
+
|
|
340
|
+
| Path | Access |
|
|
341
|
+
|------|--------|
|
|
342
|
+
| `src/`, `src/__tests__/` | ✅ Auto |
|
|
343
|
+
| `docs/`, `references/` | ✅ Auto |
|
|
344
|
+
| `*.json`, `*.config.*` | ⚠️ Ask first |
|
|
345
|
+
| `.env*`, `node_modules/`, `scripts/` | ❌ Never modify |
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
*This skill wraps `octocode-mcp` tools as HTTP endpoints. For tool-specific documentation, see the [octocode-mcp package](https://github.com/bgauryy/octocode-mcp/blob/main/packages/octocode-mcp/AGENTS.md).*
|