octocode-cli 1.2.8 → 1.2.10
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/README.md +45 -38
- package/out/octocode-cli.js +73 -11763
- package/package.json +35 -36
- package/skills/README.md +42 -114
- package/skills/{octocode-code-engineer → octocode-engineer}/.claude/settings.local.json +2 -1
- package/skills/octocode-engineer/README.md +99 -0
- package/skills/octocode-engineer/SKILL.md +413 -0
- package/skills/octocode-engineer/build.mjs +29 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/eslint.config.mjs +3 -13
- package/skills/{octocode-code-engineer → octocode-engineer}/package.json +28 -27
- package/skills/octocode-engineer/references/ast-reference.md +166 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/references/cli-reference.md +80 -6
- package/skills/octocode-engineer/references/externals.md +86 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/references/output-files.md +46 -6
- package/skills/octocode-engineer/references/quality-indicators.md +202 -0
- package/skills/octocode-engineer/references/tool-workflows.md +298 -0
- package/skills/octocode-engineer/references/validation-playbooks.md +99 -0
- package/skills/octocode-engineer/scripts/ast/search.js +45 -0
- package/skills/octocode-engineer/scripts/ast/tree-search.js +27 -0
- package/skills/octocode-engineer/scripts/index.js +173 -0
- package/skills/octocode-engineer/scripts/run.js +179 -0
- package/skills/octocode-engineer/src/analysis/dependencies.ts +378 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/discovery.test.ts +57 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/discovery.ts +43 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/search.test.ts +113 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/search.ts +64 -1
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-sitter.test.ts +118 -2
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-sitter.ts +65 -3
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/ts-analyzer.test.ts +281 -1
- package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/ts-analyzer.ts +173 -3
- package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/security.test.ts +73 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/security.ts +62 -4
- package/skills/octocode-engineer/src/detector-gating.test.ts +59 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/code-quality.ts +342 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/index.ts +8 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/index.test.ts +565 -11
- package/skills/octocode-engineer/src/index.ts +468 -0
- package/skills/octocode-engineer/src/pipeline/affected.test.ts +147 -0
- package/skills/octocode-engineer/src/pipeline/affected.ts +68 -0
- package/skills/octocode-engineer/src/pipeline/baseline.test.ts +276 -0
- package/skills/octocode-engineer/src/pipeline/baseline.ts +76 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cli.test.ts +300 -53
- package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cli.ts +180 -36
- package/skills/octocode-engineer/src/pipeline/config-loader.test.ts +264 -0
- package/skills/octocode-engineer/src/pipeline/config-loader.ts +109 -0
- package/skills/octocode-engineer/src/pipeline/create-options.ts +55 -0
- package/skills/octocode-engineer/src/pipeline/health-score.test.ts +65 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/main.ts +130 -17
- package/skills/octocode-engineer/src/pipeline/progress.ts +51 -0
- package/skills/octocode-engineer/src/pipeline/reporters.test.ts +155 -0
- package/skills/octocode-engineer/src/pipeline/reporters.ts +64 -0
- package/skills/octocode-engineer/src/reporting/graph-features.test.ts +279 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/output-contract.test.ts +6 -0
- package/skills/octocode-engineer/src/reporting/summary-md.test.ts +1066 -0
- package/skills/octocode-engineer/src/reporting/summary-md.ts +1604 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/writer.ts +136 -13
- package/skills/octocode-engineer/src/run.ts +78 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/sanity.test.ts +1 -1
- package/skills/octocode-engineer/src/types/analysis.ts +25 -0
- package/skills/octocode-engineer/src/types/collectors.ts +134 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/types/constants.ts +75 -41
- package/skills/octocode-engineer/src/types/core.ts +203 -0
- package/skills/octocode-engineer/src/types/dependency.ts +215 -0
- package/skills/octocode-engineer/src/types/file-entry.ts +108 -0
- package/skills/octocode-engineer/src/types/findings.ts +105 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/src/types/index.ts +60 -30
- package/skills/octocode-engineer/src/types/tree-sitter.ts +38 -0
- package/skills/{octocode-code-engineer → octocode-engineer}/tsconfig.json +1 -0
- package/skills/octocode-research/.octocode/scan/.cache/analysis-cache.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/architecture.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/ast-trees.txt +5566 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/code-quality.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/dead-code.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/file-inventory.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/findings.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/graph.md +189 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/security.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/summary.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-32-27-073Z/summary.md +265 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/architecture.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/ast-trees.txt +5555 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/code-quality.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/dead-code.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/file-inventory.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/findings.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/graph.md +190 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/security.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/summary.json +1 -0
- package/skills/octocode-research/.octocode/scan/2026-03-22T10-40-10-469Z/summary.md +265 -0
- package/skills/octocode-research/CHANGELOG.md +60 -0
- package/skills/octocode-research/README.md +102 -388
- package/skills/octocode-research/SKILL.md +169 -498
- package/skills/octocode-research/package.json +19 -31
- package/skills/octocode-research/references/PARALLEL_AGENT_PROTOCOL.md +19 -0
- package/skills/octocode-research/references/SESSION_MANAGEMENT.md +38 -0
- package/skills/octocode-research/scripts/server-init.js +1 -1
- package/skills/octocode-research/scripts/server.d.ts +2 -1
- package/skills/octocode-research/scripts/server.js +329 -233
- package/skills/octocode-research/src/__tests__/integration/promptsRoutes.test.ts +180 -0
- package/skills/octocode-research/src/__tests__/integration/serverHttp.test.ts +221 -0
- package/skills/octocode-research/src/__tests__/integration/serverLifecycle.test.ts +194 -0
- package/skills/octocode-research/src/__tests__/integration/toolsRoutes.test.ts +501 -0
- package/skills/octocode-research/src/__tests__/unit/readiness.test.ts +61 -0
- package/skills/octocode-research/src/__tests__/unit/resilience.test.ts +192 -0
- package/skills/octocode-research/src/__tests__/unit/responseFactory.test.ts +172 -0
- package/skills/octocode-research/src/__tests__/unit/responseParser.test.ts +288 -0
- package/skills/octocode-research/src/__tests__/unit/schemas.test.ts +509 -0
- package/skills/octocode-research/src/index.ts +4 -124
- package/skills/octocode-research/src/middleware/queryParser.ts +0 -26
- package/skills/octocode-research/src/routes/lsp.ts +58 -59
- package/skills/octocode-research/src/routes/package.ts +35 -65
- package/skills/octocode-research/src/routes/prompts.ts +3 -3
- package/skills/octocode-research/src/routes/tools.ts +8 -20
- package/skills/octocode-research/src/server-init.ts +30 -237
- package/skills/octocode-research/src/server.ts +50 -23
- package/skills/octocode-research/src/types/errorGuards.ts +9 -80
- package/skills/octocode-research/src/types/guards.ts +0 -28
- package/skills/octocode-research/src/types/mcp.ts +11 -66
- package/skills/octocode-research/src/types/responses.ts +11 -129
- package/skills/octocode-research/src/utils/circuitBreaker.ts +0 -21
- package/skills/octocode-research/src/utils/logger.ts +1 -97
- package/skills/octocode-research/src/utils/resilience.ts +2 -12
- package/skills/octocode-research/src/utils/responseFactory.ts +0 -42
- package/skills/octocode-research/src/utils/responseParser.ts +3 -25
- package/skills/octocode-research/src/utils/retry.ts +0 -63
- package/skills/octocode-research/src/utils/routeFactory.ts +1 -1
- package/skills/octocode-research/src/validation/httpPreprocess.ts +0 -3
- package/skills/octocode-research/src/validation/index.ts +0 -1
- package/skills/octocode-research/src/validation/schemas.ts +0 -63
- package/skills/octocode-research/src/validation/toolCallSchema.ts +3 -3
- package/skills/octocode-research/tsdown.config.ts +4 -0
- package/skills/octocode-research/vitest.config.ts +3 -0
- package/skills/octocode-code-engineer/.plan/VALIDATED_PLAN.md +0 -223
- package/skills/octocode-code-engineer/README.md +0 -178
- package/skills/octocode-code-engineer/SKILL.md +0 -418
- package/skills/octocode-code-engineer/minify-scripts.mjs +0 -32
- package/skills/octocode-code-engineer/references/agent-ast-reading-rfc.md +0 -95
- package/skills/octocode-code-engineer/references/architecture-techniques.md +0 -121
- package/skills/octocode-code-engineer/references/ast-search.md +0 -210
- package/skills/octocode-code-engineer/references/ast-tree-search.md +0 -151
- package/skills/octocode-code-engineer/references/concepts.md +0 -107
- package/skills/octocode-code-engineer/references/finding-categories.md +0 -128
- package/skills/octocode-code-engineer/references/improvement-roadmap.md +0 -304
- package/skills/octocode-code-engineer/references/playbooks.md +0 -204
- package/skills/octocode-code-engineer/references/present-results.md +0 -136
- package/skills/octocode-code-engineer/references/tool-workflows.md +0 -566
- package/skills/octocode-code-engineer/references/validate-investigate.md +0 -225
- package/skills/octocode-code-engineer/scripts/analysis/dependencies.js +0 -1
- package/skills/octocode-code-engineer/scripts/analysis/dependency-summary.js +0 -1
- package/skills/octocode-code-engineer/scripts/analysis/discovery.js +0 -1
- package/skills/octocode-code-engineer/scripts/analysis/graph-analytics.js +0 -1
- package/skills/octocode-code-engineer/scripts/analysis/semantic.js +0 -1
- package/skills/octocode-code-engineer/scripts/ast/helpers.js +0 -1
- package/skills/octocode-code-engineer/scripts/ast/metrics.js +0 -1
- package/skills/octocode-code-engineer/scripts/ast/search.js +0 -2
- package/skills/octocode-code-engineer/scripts/ast/tree-search.js +0 -2
- package/skills/octocode-code-engineer/scripts/ast/tree-sitter.js +0 -1
- package/skills/octocode-code-engineer/scripts/ast/ts-analyzer.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/chains.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/effects.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/input-sources.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/performance.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/prototype-pollution.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/security.js +0 -1
- package/skills/octocode-code-engineer/scripts/collectors/test-profile.js +0 -1
- package/skills/octocode-code-engineer/scripts/common/is-direct-run.js +0 -1
- package/skills/octocode-code-engineer/scripts/common/utils.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/code-quality.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/cohesion.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/coupling.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/cycle.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/dead-code.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/import-style.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/index.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/security.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/semantic.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/shared.js +0 -1
- package/skills/octocode-code-engineer/scripts/detectors/test-quality.js +0 -1
- package/skills/octocode-code-engineer/scripts/index.js +0 -1
- package/skills/octocode-code-engineer/scripts/pipeline/cache.js +0 -1
- package/skills/octocode-code-engineer/scripts/pipeline/cli.js +0 -1
- package/skills/octocode-code-engineer/scripts/pipeline/main.js +0 -2
- package/skills/octocode-code-engineer/scripts/reporting/analysis.js +0 -1
- package/skills/octocode-code-engineer/scripts/reporting/summary-md.js +0 -1
- package/skills/octocode-code-engineer/scripts/reporting/writer.js +0 -1
- package/skills/octocode-code-engineer/scripts/types/constants.js +0 -1
- package/skills/octocode-code-engineer/scripts/types/index.js +0 -1
- package/skills/octocode-code-engineer/scripts/types/interfaces.js +0 -1
- package/skills/octocode-code-engineer/src/analysis/dependencies.ts +0 -406
- package/skills/octocode-code-engineer/src/index.ts +0 -403
- package/skills/octocode-code-engineer/src/reporting/summary-md.test.ts +0 -421
- package/skills/octocode-code-engineer/src/reporting/summary-md.ts +0 -714
- package/skills/octocode-code-engineer/src/types/interfaces.ts +0 -682
- package/skills/octocode-research/src/types/toolTypes.ts +0 -33
- package/skills/octocode-research/src/utils/logEmoji.ts +0 -103
- /package/skills/{octocode-code-engineer → octocode-engineer}/.octocode/rfc/RFC-code-engineer-weakness-fixes.md +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/architecture.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ast-helpers.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ast-search.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/base.css +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/block-navigation.js +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/cache.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/cli.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/clover.xml +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-effects.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-input-sources.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-performance.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-prototype-pollution.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-security.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/collect-test-profile.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/coverage-final.json +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/dependencies.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/dependency-summary.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/discovery.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/favicon.png +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/graph-analytics.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/index.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/index.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/metrics.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/pipeline.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/prettify.css +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/prettify.js +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/report-analysis.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/report-writer.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/security-detectors.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/semantic-detectors.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/semantic.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/sort-arrow-sprite.png +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/sorter.js +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/summary-md.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/test-quality-detectors.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/tree-sitter-analyzer.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/ts-analyzer.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/types.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/coverage/utils.ts.html +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependencies.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependency-summary.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/dependency-summary.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/graph-analytics.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/graph-analytics.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/semantic.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/analysis/semantic.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/helpers.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/helpers.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/metrics.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/metrics.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-search.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/ast/tree-search.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/chains.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/effects.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/effects.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/input-sources.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/input-sources.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/performance.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/performance.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/prototype-pollution.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/prototype-pollution.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/test-profile.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/collectors/test-profile.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/is-direct-run.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/is-direct-run.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/utils.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/common/utils.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/cohesion.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/coupling.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/cycle.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/dead-code.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/import-style.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/index.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/security.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/security.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/semantic.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/shared.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/test-quality.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/detectors/test-quality.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cache.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/cache.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline/main.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/pipeline.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/analysis.test.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/src/reporting/analysis.ts +0 -0
- /package/skills/{octocode-code-engineer → octocode-engineer}/vitest.config.ts +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# AST Reference
|
|
2
|
+
|
|
3
|
+
Single AST guide for both tools:
|
|
4
|
+
- `scripts/ast/tree-search.js` — fast triage on `ast-trees.txt` from a scan
|
|
5
|
+
- `scripts/ast/search.js` — structural proof on live source files
|
|
6
|
+
|
|
7
|
+
Use this as the only AST reference for agents.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Which tool when
|
|
12
|
+
|
|
13
|
+
| Goal | Tool | Why |
|
|
14
|
+
|------|------|-----|
|
|
15
|
+
| Quickly decide where to read next | `tree-search.js` | Works on scan artifact, very fast triage |
|
|
16
|
+
| Prove a code shape exists in source | `search.js` | AST-accurate structural matching |
|
|
17
|
+
| Validate a finding before presenting | `search.js` | Live-source evidence (not snapshot-only) |
|
|
18
|
+
|
|
19
|
+
Golden rule: **triage with tree-search, prove with search**.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## `ast-trees.txt` format
|
|
24
|
+
|
|
25
|
+
Each scan writes `ast-trees.txt` — a flattened AST snapshot of every analyzed file. The file is markdown-ish with a fixed structure:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
# AST Trees — <timestamp>
|
|
29
|
+
|
|
30
|
+
## <package> — <filepath>
|
|
31
|
+
SourceFile[1:200]
|
|
32
|
+
ImportDeclaration[1]
|
|
33
|
+
ImportClause[1]
|
|
34
|
+
NamedImports[1]
|
|
35
|
+
ImportSpecifier[1] ...
|
|
36
|
+
FunctionDeclaration[10:35]
|
|
37
|
+
ExportKeyword[10]
|
|
38
|
+
AsyncKeyword[10]
|
|
39
|
+
Identifier[10]
|
|
40
|
+
Parameter[10]
|
|
41
|
+
Identifier[10]
|
|
42
|
+
StringKeyword[10]
|
|
43
|
+
Block[10:35]
|
|
44
|
+
IfStatement[12] ...
|
|
45
|
+
ReturnStatement[34] ...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Format rules:**
|
|
49
|
+
- `## <package> — <filepath>` — section header per file
|
|
50
|
+
- `Kind[line]` — single-line node at that source line
|
|
51
|
+
- `Kind[startLine:endLine]` — multi-line node spanning those source lines
|
|
52
|
+
- **Indentation** (2 spaces per level) = AST depth
|
|
53
|
+
- `...` suffix = children truncated by `--tree-depth` (default: 4)
|
|
54
|
+
- Suppress with `--no-tree`. Control depth with `--tree-depth N`.
|
|
55
|
+
|
|
56
|
+
**Reading directly:** you can read sections with standard tools (`grep`, `head`) or use `localGetFileContent(matchString="## <package> — <filepath>")` to jump to a file's AST. But prefer `tree-search.js` for structured queries.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## `tree-search.js` (scan artifact triage)
|
|
61
|
+
|
|
62
|
+
Queries `ast-trees.txt` programmatically — faster and more reliable than reading the raw file.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
node <SKILL_DIR>/scripts/ast/tree-search.js -i .octocode/scan -k function_declaration --limit 25
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Useful options:
|
|
69
|
+
- `--ignore-case` case-insensitive matching
|
|
70
|
+
- `-i, --input` scan root or timestamp directory
|
|
71
|
+
- `-k` node kind filter (supports `snake_case` and `PascalCase`)
|
|
72
|
+
- `-p` regex pattern to match against any AST tree line
|
|
73
|
+
- `--file` narrow to file (regex on filepath)
|
|
74
|
+
- `--section` narrow to section header (regex)
|
|
75
|
+
- `-C` context lines around each match
|
|
76
|
+
- `--limit` max matches (default: 50, `0` = all)
|
|
77
|
+
- `--json` structured JSON output
|
|
78
|
+
|
|
79
|
+
Use cases:
|
|
80
|
+
- identify large functions and nested regions before deep reading
|
|
81
|
+
- find candidate files for a category-specific validation pass
|
|
82
|
+
|
|
83
|
+
Do not use as final proof of live behavior.
|
|
84
|
+
|
|
85
|
+
**Scan selection**: when `-i` points to `.octocode/scan` (the root), `tree-search` picks the **most recently modified** scan directory. If the latest scan was a narrow `--scope` run, the artifact will only contain AST trees for those scoped files — not the full codebase. To target a specific full scan, pass the exact timestamp directory: `-i .octocode/scan/<timestamp>`.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## `search.js` (live structural proof)
|
|
90
|
+
|
|
91
|
+
Runs against source files via `@ast-grep/napi`.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
node <SKILL_DIR>/scripts/ast/search.js [options]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Modes:
|
|
98
|
+
- **Pattern** `-p` for AST shape matching with metavariables (`$X`, `$$$X`)
|
|
99
|
+
- **Kind** `-k` for syntax-node class matching
|
|
100
|
+
- **Rule** `--rule` for advanced JSON rules
|
|
101
|
+
- **Preset** `--preset` for built-in smell checks
|
|
102
|
+
|
|
103
|
+
Examples:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
node <SKILL_DIR>/scripts/ast/search.js -p 'console.$METHOD($$$ARGS)' --json --root src/
|
|
107
|
+
node <SKILL_DIR>/scripts/ast/search.js -k function_declaration --json --root src/
|
|
108
|
+
node <SKILL_DIR>/scripts/ast/search.js --preset any-type --json --root src/
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
All presets (run `--list-presets` to verify against your version):
|
|
112
|
+
|
|
113
|
+
| Preset | Detects |
|
|
114
|
+
|--------|---------|
|
|
115
|
+
| `empty-catch` | Empty catch blocks that silently swallow errors |
|
|
116
|
+
| `console-log` | `console.log` calls left in production code |
|
|
117
|
+
| `console-any` | Any `console` method call (log, warn, error, debug, etc.) |
|
|
118
|
+
| `debugger` | Debugger statements left in code |
|
|
119
|
+
| `todo-fixme` | TODO, FIXME, HACK, XXX, BUG comments |
|
|
120
|
+
| `any-type` | Explicit `any` type annotations |
|
|
121
|
+
| `type-assertion` | TypeScript type assertions (`as X`) |
|
|
122
|
+
| `non-null-assertion` | Non-null assertions (`x!`) |
|
|
123
|
+
| `fat-arrow-body` | Arrow functions with statement block bodies (could be expression) |
|
|
124
|
+
| `nested-ternary` | Nested ternary expressions (hard to read) |
|
|
125
|
+
| `throw-string` | Throwing string literals instead of Error objects |
|
|
126
|
+
| `switch-no-default` | Switch statements without a default case |
|
|
127
|
+
| `class-declaration` | All class declarations |
|
|
128
|
+
| `async-function` | Async function declarations |
|
|
129
|
+
| `export-default` | Default exports |
|
|
130
|
+
| `import-star` | Namespace imports (`import * as X`) |
|
|
131
|
+
| `catch-rethrow` | Catch blocks that only re-throw the caught error |
|
|
132
|
+
| `promise-all` | `Promise.all` calls (check for missing error handling) |
|
|
133
|
+
| `boolean-param` | Function parameters typed as `boolean` |
|
|
134
|
+
| `magic-number` | Numeric literals (excluding 0 and 1) — potential magic numbers |
|
|
135
|
+
| `deep-callback` | Deeply nested arrow function callbacks (3+ levels) |
|
|
136
|
+
| `unused-var` | Variable declarations without call expressions (dead code candidates) |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## TypeScript pattern matching — best practices
|
|
141
|
+
|
|
142
|
+
Pattern mode (`-p`) matches the full AST structure. In TypeScript, type annotations are part of the AST, so patterns must account for them or they will silently miss matches.
|
|
143
|
+
|
|
144
|
+
**Common pitfall:** `async function $NAME($$$PARAMS)` returns 0 matches on functions with return types like `async function foo(): Promise<void>` — the `: Promise<void>` is a required part of the AST shape.
|
|
145
|
+
|
|
146
|
+
| Scenario | Approach | Why |
|
|
147
|
+
|----------|----------|-----|
|
|
148
|
+
| Find all functions | `-k function_declaration` | Kind ignores type annotations |
|
|
149
|
+
| Find all async functions | `--preset async-function` | Preset uses kind + regex internally |
|
|
150
|
+
| Find specific call patterns | `-p 'JSON.parse($X)'` | Call expressions don't have TS types |
|
|
151
|
+
| Find method calls | `-p 'console.$M($$$A)'` | Method calls don't have TS types |
|
|
152
|
+
| Match including types | `-p 'function $N($P: string): string { $$$B }'` | Must include exact type shape |
|
|
153
|
+
| Structural smells | `--preset empty-catch` etc. | Presets are TS-aware by design |
|
|
154
|
+
|
|
155
|
+
**Rule of thumb:** Use `--kind` or `--preset` for declarations (functions, classes, exports, imports). Use `-p` pattern for call expressions, assignments, and code shapes where type annotations are not involved.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Recommended AST workflow
|
|
160
|
+
|
|
161
|
+
1. `tree-search.js` to narrow candidate files/functions
|
|
162
|
+
2. `search.js` (`--preset`, `-p`, or `-k`) to get structural proof
|
|
163
|
+
3. `localGetFileContent`/LSP tools for semantic context and impact
|
|
164
|
+
|
|
165
|
+
This keeps investigation fast and reduces false positives.
|
|
166
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CLI Reference
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
node <SKILL_DIR>/scripts/
|
|
4
|
+
node <SKILL_DIR>/scripts/run.js [flags]
|
|
5
5
|
```
|
|
6
6
|
|
|
7
7
|
Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached — subsequent runs skip unchanged files (~4x faster).
|
|
@@ -28,7 +28,7 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
28
28
|
| Single category | `--features=cognitive-complexity` |
|
|
29
29
|
| Mix pillars + categories | `--features=dead-code,dependency-cycle` |
|
|
30
30
|
| Everything except X | `--exclude=architecture` |
|
|
31
|
-
| Exclude specific categories | `--exclude=dead-export,
|
|
31
|
+
| Exclude specific categories | `--exclude=dead-export,unsafe-any` |
|
|
32
32
|
| Cap findings (diverse) | `--findings-limit 500` |
|
|
33
33
|
| Cap findings (pure severity) | `--findings-limit 500 --no-diversify` |
|
|
34
34
|
| Include tests | `--include-tests` |
|
|
@@ -45,13 +45,20 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
45
45
|
| Enable semantic analysis | `--semantic` |
|
|
46
46
|
| Semantic + scope combo | `--semantic --scope=packages/my-package` |
|
|
47
47
|
| Only semantic categories | `--semantic --features=unused-parameter,shotgun-surgery` |
|
|
48
|
-
|
|
|
48
|
+
| Deeper override-chain threshold | `--semantic --override-chain-threshold 6` |
|
|
49
49
|
| Detect near-clones | `--similarity-threshold 0.8` |
|
|
50
50
|
| Strict security | `--secret-entropy-threshold 4.0 --secret-min-length 16` |
|
|
51
51
|
| Strict test quality | `--mock-threshold 5 --include-tests --features=test-quality` |
|
|
52
52
|
| Force full re-parse | `--no-cache` |
|
|
53
53
|
| Clear cache | `--clear-cache` |
|
|
54
54
|
| JSON to stdout | `--json` |
|
|
55
|
+
| CI gate | `--reporter github-actions --at-least 60` |
|
|
56
|
+
| PR diff check | `--affected HEAD~1 --reporter compact` |
|
|
57
|
+
| Progressive adoption (save) | `--save-baseline` |
|
|
58
|
+
| Progressive adoption (check) | `--ignore-known --at-least 60` |
|
|
59
|
+
| Module neighborhood graph | `--graph --focus=src/session.ts --focus-depth 2` |
|
|
60
|
+
| High-level architecture | `--graph --collapse 2` |
|
|
61
|
+
| Use config file | `--config .octocode-scan.json` |
|
|
55
62
|
|
|
56
63
|
---
|
|
57
64
|
|
|
@@ -59,6 +66,8 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
59
66
|
|
|
60
67
|
`--scope` focuses on specific paths (comma-separated, relative to root). Use `file:symbol` syntax to drill into a specific function or exported variable — only findings whose line range overlaps with that symbol are returned. The full dependency graph is still built so architecture findings involving scoped files are reported. Combinable with `--features`/`--exclude`.
|
|
61
68
|
|
|
69
|
+
**Symbol scope fallback**: if the scanner cannot resolve a `file:symbol` target (e.g., the symbol name doesn't match an exported function or the file uses patterns that prevent resolution), it falls back to file-level scope and emits a warning: `"symbol scope could not resolve: <path>. Falling back to file-level scope."` If you see this warning, check the exact exported function name and try again, or use file-level scope directly.
|
|
70
|
+
|
|
62
71
|
`--features` and `--exclude` are mutually exclusive. Both accept pillar names (`architecture`, `code-quality`, `dead-code`, `security`, `test-quality`) and individual category names, comma-separated.
|
|
63
72
|
|
|
64
73
|
`--semantic` enables TypeChecker + LanguageService analysis (additional categories). Off by default since it adds ~3-5s. Semantic categories require `--semantic` to appear in results.
|
|
@@ -69,6 +78,37 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
69
78
|
|
|
70
79
|
---
|
|
71
80
|
|
|
81
|
+
## Feature and Category Index
|
|
82
|
+
|
|
83
|
+
Use this section to quickly verify feature coverage.
|
|
84
|
+
|
|
85
|
+
### Pillar features (`--features=...`)
|
|
86
|
+
|
|
87
|
+
- `architecture`
|
|
88
|
+
- `code-quality`
|
|
89
|
+
- `dead-code`
|
|
90
|
+
- `security`
|
|
91
|
+
- `test-quality`
|
|
92
|
+
|
|
93
|
+
### Semantic-only categories
|
|
94
|
+
|
|
95
|
+
Require `--semantic` to appear in results. The set of semantic categories evolves across versions — run `--help` or `--semantic --help` to see the current list for your installed version.
|
|
96
|
+
|
|
97
|
+
### How to list all available categories in your current version
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
node <SKILL_DIR>/scripts/run.js --help
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then verify which categories were emitted in a run:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cat .octocode/scan/<latest>/summary.md
|
|
107
|
+
cat .octocode/scan/<latest>/findings.json | jq '.optimizationFindings[].category' | sort -u
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
72
112
|
## All Flags Reference
|
|
73
113
|
|
|
74
114
|
### Core
|
|
@@ -94,6 +134,15 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
94
134
|
| `--no-cache` | off | Disable incremental cache; re-parse all files |
|
|
95
135
|
| `--clear-cache` | — | Delete the analysis cache and exit (no scan) |
|
|
96
136
|
| `--all` | off | Enable all features: `--include-tests --semantic` |
|
|
137
|
+
| `--affected [revision]` | off | Scope to git-changed files + transitive dependents (default: HEAD) |
|
|
138
|
+
| `--save-baseline` | off | Save current findings to `.octocode/baseline.json` |
|
|
139
|
+
| `--ignore-known [file]` | off | Suppress findings matching baseline (default: `.octocode/baseline.json`) |
|
|
140
|
+
| `--reporter <format>` | `default` | Output format: `default`, `compact`, `github-actions` |
|
|
141
|
+
| `--focus <module>` | off | Show only this module and neighbors in graph (requires `--graph`). Supports `--focus=path` syntax |
|
|
142
|
+
| `--focus-depth N` | 1 | Neighbor depth for `--focus` |
|
|
143
|
+
| `--collapse N` | off | Collapse graph nodes to folder depth N |
|
|
144
|
+
| `--at-least N` | off | Fail (exit 1) if gate score below N (0-100). Uses count-based formula, distinct from severity-weighted feature scores in `summary.md` |
|
|
145
|
+
| `--config <file>` | auto-discover | Config file path. Auto-discovers `.octocode-scan.json`, `.octocode-scan.jsonc`, or `package.json#octocode` |
|
|
97
146
|
| `--help`, `-h` | — | Show help message |
|
|
98
147
|
|
|
99
148
|
### Thresholds — Architecture
|
|
@@ -105,6 +154,8 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
105
154
|
| `--fan-out-threshold N` | 15 | Fan-out threshold for `god-module-coupling` |
|
|
106
155
|
| `--layer-order <layers>` | _(none)_ | Comma-separated layer names for violation detection |
|
|
107
156
|
| `--deep-link-topn N` | 12 | Max critical dependency paths to report |
|
|
157
|
+
| `--sdp-min-delta N` | 0.15 | Min instability delta for SDP violations |
|
|
158
|
+
| `--sdp-max-source-instability N` | 0.6 | Max source instability to report SDP violations |
|
|
108
159
|
|
|
109
160
|
### Thresholds — Code Quality
|
|
110
161
|
|
|
@@ -112,27 +163,30 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
112
163
|
|------|---------|----------|
|
|
113
164
|
| `--critical-complexity-threshold N` | 30 | Complexity for HIGH findings + critical path weighting |
|
|
114
165
|
| `--cognitive-complexity-threshold N` | 15 | Cognitive complexity threshold |
|
|
115
|
-
| `--cyclomatic-density-threshold N` | 0.5 | CC/LOC ratio threshold |
|
|
116
166
|
| `--halstead-effort-threshold N` | 500000 | Halstead effort threshold |
|
|
117
167
|
| `--maintainability-index-threshold N` | 20 | MI below this triggers a finding (0-100 scale) |
|
|
118
168
|
| `--parameter-threshold N` | 5 | Max function parameters before flagging |
|
|
119
169
|
| `--any-threshold N` | 5 | Max `any` type usages per file |
|
|
120
|
-
| `--magic-number-threshold N` | 3 | Max magic number occurrences per file |
|
|
121
170
|
| `--god-module-statements N` | 500 | Statement threshold for `god-module` |
|
|
122
171
|
| `--god-module-exports N` | 20 | Export threshold for `god-module` |
|
|
123
172
|
| `--god-function-statements N` | 100 | Statement threshold for `god-function` |
|
|
173
|
+
| `--god-function-mi-threshold N` | 10 | MI threshold for `god-function` (fires when MI < N and LOC > 30) |
|
|
124
174
|
| `--min-function-statements N` | 6 | Min function body statements for duplicate matching |
|
|
125
175
|
| `--min-flow-statements N` | 6 | Min control-flow statements for duplicate matching |
|
|
126
176
|
| `--flow-dup-threshold N` | 3 | Min occurrences for a repeated flow to become a finding |
|
|
127
177
|
| `--similarity-threshold N` | 0.85 | Jaccard similarity threshold for near-clone detection |
|
|
178
|
+
| `--deep-nesting-threshold N` | 5 | Max branch/loop nesting depth before flagging |
|
|
179
|
+
| `--multiple-return-threshold N` | 6 | Max return/throw paths per function before flagging |
|
|
180
|
+
| `--magic-string-min-occurrences N` | 3 | Min repetitions of a string literal to flag as magic string |
|
|
181
|
+
| `--boolean-param-threshold N` | 3 | Min boolean params per function to flag as cluster |
|
|
128
182
|
| `--max-recs-per-category N` | 2 | Max findings per category in top recommendations |
|
|
129
183
|
|
|
130
184
|
### Thresholds — Semantic (require `--semantic`)
|
|
131
185
|
|
|
132
186
|
| Flag | Default | Controls |
|
|
133
187
|
|------|---------|----------|
|
|
134
|
-
| `--type-hierarchy-threshold N` | 4 | Max inheritance depth before flagging |
|
|
135
188
|
| `--override-chain-threshold N` | 3 | Max method override depth before flagging |
|
|
189
|
+
| `--shotgun-threshold N` | 8 | Unique-file threshold for `shotgun-surgery` |
|
|
136
190
|
|
|
137
191
|
### Thresholds — Security
|
|
138
192
|
|
|
@@ -156,6 +210,26 @@ Output goes to `.octocode/scan/<timestamp>/` by default. Results are cached —
|
|
|
156
210
|
|
|
157
211
|
---
|
|
158
212
|
|
|
213
|
+
## Scope Sanity Checks
|
|
214
|
+
|
|
215
|
+
Low or zero findings can mean the codebase is clean — or the scope missed analyzable files. Before trusting a clean result:
|
|
216
|
+
|
|
217
|
+
1. **Confirm the scope has source files**: `--scope=docs/` or a path with only `.md` files will produce 0 findings. Use `localViewStructure` or `ls` to verify the scope contains `.ts`/`.js`/`.tsx` files.
|
|
218
|
+
2. **Test-quality needs test files**: `--features=test-quality` without `--include-tests` will produce 0 findings — test files are excluded by default.
|
|
219
|
+
3. **Suspiciously low count? Broaden one level**: try removing `--scope` or removing `--features` temporarily to compare against a baseline full run. If the full run has findings and the scoped run doesn't, the scope was too narrow.
|
|
220
|
+
4. **Scoped scans affect downstream tools**: `ast-trees.txt` from a scoped scan only contains AST trees for scoped files. If you later run `tree-search.js -i .octocode/scan`, it picks the latest scan — which may be the narrow one. Either point to a full-scan timestamp explicitly or re-run a full scan.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Baseline (broad)
|
|
224
|
+
node <SKILL_DIR>/scripts/run.js --graph --flow
|
|
225
|
+
# Test-quality focused
|
|
226
|
+
node <SKILL_DIR>/scripts/run.js --features=test-quality --include-tests --scope=<test-containing-path>
|
|
227
|
+
# Source-quality focused
|
|
228
|
+
node <SKILL_DIR>/scripts/run.js --features=code-quality,security --scope=src/
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
159
233
|
## Drill-Down Workflow
|
|
160
234
|
|
|
161
235
|
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# External Tools
|
|
2
|
+
|
|
3
|
+
**Ask user before running.** Use `npx` — no install needed.
|
|
4
|
+
|
|
5
|
+
## Scanner Already Covers
|
|
6
|
+
|
|
7
|
+
| Domain | Categories | Flags |
|
|
8
|
+
|--------|-----------|-------|
|
|
9
|
+
| Duplicates | `duplicate-function-body`, `similar-function-body`, `duplicate-flow-structure` | `--similarity-threshold 0.8` |
|
|
10
|
+
| Unused deps | `unused-npm-dependency` | `--features=dead-code` |
|
|
11
|
+
| Dead exports | `dead-export`, `dead-re-export`, `semantic-dead-export` | `--features=dead-code --semantic` |
|
|
12
|
+
|
|
13
|
+
## eslint
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx eslint --fix <target>
|
|
17
|
+
npx eslint --format json <target>
|
|
18
|
+
npx eslint --rule '{"complexity": ["error", 10]}' <target>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## tsc
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx tsc --noEmit
|
|
25
|
+
npx tsc --noEmit --strict
|
|
26
|
+
npx tsc --noEmit -p tsconfig.json --pretty --noErrorTruncation
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## stylelint — CSS/SCSS/Less
|
|
30
|
+
|
|
31
|
+
Use when project has CSS files. Scanner only handles JS/TS.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx stylelint "**/*.css"
|
|
35
|
+
npx stylelint "**/*.scss"
|
|
36
|
+
npx stylelint --fix "**/*.css"
|
|
37
|
+
npx stylelint --formatter json "**/*.css"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## knip — Framework-aware dead code
|
|
41
|
+
|
|
42
|
+
100+ plugins (Next.js, Remix, Angular) detect framework-specific usage scanner can't see.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx knip
|
|
46
|
+
npx knip --exports
|
|
47
|
+
npx knip --dependencies
|
|
48
|
+
npx knip --files
|
|
49
|
+
npx knip --workspace packages/my-pkg
|
|
50
|
+
npx knip --fix
|
|
51
|
+
npx knip --reporter json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## type-coverage — Type safety %
|
|
55
|
+
|
|
56
|
+
Project-wide typed-vs-any ratio. Scanner counts per-file `any`; this gives one number.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx type-coverage
|
|
60
|
+
npx type-coverage --strict --at-least 90
|
|
61
|
+
npx type-coverage --detail
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## dependency-cruiser — Custom arch rules
|
|
65
|
+
|
|
66
|
+
Declarative rule DSL (`forbidden`/`allowed`/`required`). Scanner has 28 built-in detectors; this adds project-specific constraints.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx depcruise --no-config --output-type err src/
|
|
70
|
+
npx depcruise --no-config --output-type metrics src/
|
|
71
|
+
npx depcruise --no-config --output-type mermaid src/ > deps.md
|
|
72
|
+
npx depcruise --no-config --output-type mermaid --focus "^src/session" src/
|
|
73
|
+
npx depcruise --no-config --output-type err --affected HEAD src/
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick Reference
|
|
77
|
+
|
|
78
|
+
| Finding | Tool | Command |
|
|
79
|
+
|---------|------|---------|
|
|
80
|
+
| `dependency-cycle` | dep-cruiser | `npx depcruise --no-config -T err <path>` |
|
|
81
|
+
| `dead-export` | knip | `npx knip --exports` |
|
|
82
|
+
| `unsafe-any` | type-coverage | `npx type-coverage --strict --detail` |
|
|
83
|
+
| `layer-violation` | dep-cruiser | `npx depcruise --no-config -T err <path>` |
|
|
84
|
+
| Lint issues | eslint | `npx eslint <path>` |
|
|
85
|
+
| Type errors | tsc | `npx tsc --noEmit` |
|
|
86
|
+
| CSS issues | stylelint | `npx stylelint "**/*.css"` |
|
|
@@ -4,11 +4,13 @@ Each scan writes to `.octocode/scan/<timestamp>/`:
|
|
|
4
4
|
|
|
5
5
|
| File | Contents | When to Read |
|
|
6
6
|
|------|----------|-------------|
|
|
7
|
-
| `summary.md` | Health scores, tags, severity, per-pillar counts, top recs, change risk hotspots | **Always first** |
|
|
8
|
-
| `summary.json` | Machine-readable scan metadata, `agentOutput`, `analysisSummary`, `investigationPrompts`, `parseErrors[]` | Programmatic access |
|
|
7
|
+
| `summary.md` | Health scores, **per-feature scores**, **AI + Structure hybrid ratings**, tags, severity, per-pillar counts, top recs, change risk hotspots | **Always first** |
|
|
8
|
+
| `summary.json` | Machine-readable scan metadata, `agentOutput`, `analysisSummary`, `featureScores[]`, `qualityRating`, `investigationPrompts`, `parseErrors[]` | Programmatic access |
|
|
9
9
|
| `architecture.json` | Dep graph, arch findings, `hotFiles[]`, `graphSignals[]`, chokepoints, optional advanced graph overlays | Cycles, coupling, SDP, D metric, test gaps, side-effect risk |
|
|
10
|
-
| `code-quality.json` |
|
|
11
|
-
| `dead-code.json` |
|
|
10
|
+
| `code-quality.json` | Quality findings, severity/category breakdowns | Duplicates, complexity, perf |
|
|
11
|
+
| `dead-code.json` | Dead-code findings, severity/category breakdowns | Dead code cleanup |
|
|
12
|
+
| `security.json` | Security findings, severity/category breakdowns (emitted only when findings exist) | Secrets, sinks, unsafe eval |
|
|
13
|
+
| `test-quality.json` | Test quality findings, severity/category breakdowns (emitted only when findings exist, requires `--include-tests`) | Mock density, brittle tests |
|
|
12
14
|
| `file-inventory.json` | Per-file: functions, flows, metrics, `issueIds[]` | Deep-diving a specific file |
|
|
13
15
|
| `findings.json` | ALL findings sorted by severity with `ruleId`, `analysisLens`, `confidence`, `impact`, `correlatedSignals[]`, `recommendedValidation`, and optional `flowTrace[]` | Complete sorted list |
|
|
14
16
|
| `ast-trees.txt` | `Kind[startLine:endLine]` per file (on by default, disable with `--no-tree`) | Structural overview |
|
|
@@ -28,6 +30,8 @@ agentOutput { totalFindings, highPriority, mediumPriority, lowPriority,
|
|
|
28
30
|
filesWithIssues[] { file, issueCount, issueIds } },
|
|
29
31
|
analysisSummary { graphSignals[], astSignals[], strongestGraphSignal, strongestAstSignal, combinedSignals[], recommendedValidation },
|
|
30
32
|
strongestGraphSignal, strongestAstSignal, combinedSignals[], recommendedValidation, investigationPrompts[],
|
|
33
|
+
featureScores[] { category, pillar, findings, affectedFiles, hotspotHits, hotspotMaxRisk, contextPenalty, severityBreakdown { critical, high, medium, low, info }, score, grade },
|
|
34
|
+
qualityRating { model, overallScore, overallGrade, aspects[] { aspect, label, weight, score, grade, confidence, rationale, signals[] } },
|
|
31
35
|
parseErrors[] { file, message },
|
|
32
36
|
outputFiles { summary, architecture, codeQuality, deadCode, fileInventory, findings, ... }
|
|
33
37
|
```
|
|
@@ -35,10 +39,26 @@ outputFiles { summary, architecture, codeQuality, deadCode, fileInventory, findi
|
|
|
35
39
|
Use `summary.json` to drive the first decision:
|
|
36
40
|
|
|
37
41
|
- Use `agentOutput.topRecommendations[]` and `filesWithIssues[]` to decide where to drill in first
|
|
42
|
+
- Use `featureScores[]` to rank worst categories across the currently active feature set
|
|
43
|
+
- Use `qualityRating.aspects[]` for non-rigid repo-shape scoring (architecture/folder/naming/common/shared/maintainability/consistency)
|
|
38
44
|
- Use `summary.md` or `architecture.json` for graph-specific detail such as `cycles`, `criticalPaths`, and hotspots
|
|
39
45
|
- If top recommendations are mostly complexity, duplication, or side-effect findings, switch to AST-first investigation
|
|
40
46
|
- If graph-heavy recommendations and AST-heavy recommendations appear together, plan a combined investigation before proposing refactors
|
|
41
47
|
|
|
48
|
+
### Scoring model (current)
|
|
49
|
+
|
|
50
|
+
- Severity weights: `critical=25`, `high=10`, `medium=3`, `low=1`, `info=0`
|
|
51
|
+
- Score formula: `round(100 / (1 + (weightedFindingsPerFile / 10)))`
|
|
52
|
+
- Guardrails: non-info findings cannot score perfect `100`; critical/high findings are capped (`95`/`98`)
|
|
53
|
+
- Feature context penalties: hotspot overlap lowers category scores (`hotspotHits`, `hotspotMaxRisk`, `contextPenalty`)
|
|
54
|
+
- Hybrid quality model (`qualityRating`): weighted soft-signal scoring, not rigid checks:
|
|
55
|
+
- Architecture & Structure (30%)
|
|
56
|
+
- Folder Topology (15%)
|
|
57
|
+
- Naming Quality (15%)
|
|
58
|
+
- Common/Shared Layer Health (15%)
|
|
59
|
+
- Maintainability & Evolvability (15%)
|
|
60
|
+
- Codebase Consistency (10%)
|
|
61
|
+
|
|
42
62
|
### `findings.json`
|
|
43
63
|
|
|
44
64
|
```
|
|
@@ -103,6 +123,26 @@ findings[], findingsCount, severityBreakdown, categoryBreakdown
|
|
|
103
123
|
generatedAt, findings[], findingsCount, severityBreakdown, categoryBreakdown
|
|
104
124
|
```
|
|
105
125
|
|
|
126
|
+
### `security.json`
|
|
127
|
+
|
|
128
|
+
Emitted only when security findings exist. Same schema as `dead-code.json`:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
generatedAt, findings[], findingsCount, severityBreakdown, categoryBreakdown
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Categories: `hardcoded-secret`, `eval-usage`, `command-injection-risk`, `path-traversal-risk`, `sql-injection-risk`, `unsafe-html`, `unsafe-regex`, `prototype-pollution-risk`, `sensitive-data-logging`, `debug-log-leakage`, `input-passthrough-risk`, `unvalidated-input-sink`.
|
|
135
|
+
|
|
136
|
+
### `test-quality.json`
|
|
137
|
+
|
|
138
|
+
Emitted only when test quality findings exist (requires `--include-tests`). Same schema as `dead-code.json`:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
generatedAt, findings[], findingsCount, severityBreakdown, categoryBreakdown
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Categories: `test-no-assertion`, `low-assertion-density`, `excessive-mocking`, `shared-mutable-state`, `missing-test-cleanup`, `focused-test`, `fake-timer-no-restore`, `missing-mock-restoration`.
|
|
145
|
+
|
|
106
146
|
### `file-inventory.json`
|
|
107
147
|
|
|
108
148
|
```
|
|
@@ -133,9 +173,9 @@ If `architecture.json` names a hotspot, use `file-inventory.json` to explain why
|
|
|
133
173
|
|
|
134
174
|
## Reading `ast-trees.txt`
|
|
135
175
|
|
|
136
|
-
|
|
176
|
+
Flattened AST snapshot: `## <package> — <filepath>` section headers, then indented `Kind[startLine:endLine]` nodes (2 spaces = 1 depth level, `...` = truncated children). On by default (`--emit-tree`). Suppress with `--no-tree`. Tree depth: `--tree-depth N` (default: 4).
|
|
137
177
|
|
|
138
|
-
|
|
178
|
+
Query with `tree-search.js` (`-k`, `-p`, `--file`, `-C`). For format details and tool reference, see [ast-reference.md](./ast-reference.md).
|
|
139
179
|
|
|
140
180
|
---
|
|
141
181
|
|