code-auditor-mcp 5.0.2 → 5.2.0
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +184 -3
- package/README.md +24 -2
- package/configs/hhra-compat.json +12 -118
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js +11 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +57 -52
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
- package/dist/analyzers/provenance.d.ts +9 -4
- package/dist/analyzers/provenance.d.ts.map +1 -1
- package/dist/analyzers/provenance.js +8 -25
- package/dist/analyzers/provenance.js.map +1 -1
- package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/reactAnalyzer.js +0 -5
- package/dist/analyzers/reactAnalyzer.js.map +1 -1
- package/dist/analyzers/ruleRegistry.js +4 -4
- package/dist/analyzers/ruleRegistry.js.map +1 -1
- package/dist/analyzers/ruleTiming.d.ts +1 -1
- package/dist/analyzers/ruleTiming.js +2 -2
- package/dist/analyzers/ruleTiming.js.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +22 -26
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +32 -15
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +189 -115
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -2
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +0 -5
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +2 -10
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js +7 -49
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/config.js +0 -2
- package/dist/analyzers/universal/schema/config.js.map +1 -1
- package/dist/analyzers/universal/schema/types.d.ts +0 -2
- package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
- package/dist/analyzers/vendorSurfaces.d.ts +126 -0
- package/dist/analyzers/vendorSurfaces.d.ts.map +1 -0
- package/dist/analyzers/vendorSurfaces.js +580 -0
- package/dist/analyzers/vendorSurfaces.js.map +1 -0
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +136 -142
- package/dist/auditRunner.js.map +1 -1
- package/dist/churn/churnExtractor.d.ts +0 -1
- package/dist/churn/churnExtractor.d.ts.map +1 -1
- package/dist/churn/churnExtractor.js +2 -4
- package/dist/churn/churnExtractor.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +195 -26
- package/dist/cli.js.map +1 -1
- package/dist/codeIndex/migrations.d.ts.map +1 -1
- package/dist/codeIndex/migrations.js +4 -3
- package/dist/codeIndex/migrations.js.map +1 -1
- package/dist/codeIndexDB.d.ts +11 -2
- package/dist/codeIndexDB.d.ts.map +1 -1
- package/dist/codeIndexDB.js +27 -2
- package/dist/codeIndexDB.js.map +1 -1
- package/dist/config/configLoader.d.ts +60 -7
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +252 -60
- package/dist/config/configLoader.js.map +1 -1
- package/dist/config/defaults.d.ts +77 -18
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +105 -43
- package/dist/config/defaults.js.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/daemon/main.d.ts +0 -1
- package/dist/daemon/main.d.ts.map +1 -1
- package/dist/daemon/main.js +11 -4
- package/dist/daemon/main.js.map +1 -1
- package/dist/dataPaths.d.ts +17 -11
- package/dist/dataPaths.d.ts.map +1 -1
- package/dist/dataPaths.js +51 -16
- package/dist/dataPaths.js.map +1 -1
- package/dist/hookLog.d.ts +54 -0
- package/dist/hookLog.d.ts.map +1 -0
- package/dist/hookLog.js +105 -0
- package/dist/hookLog.js.map +1 -0
- package/dist/hookLogPath.generated.d.ts +3 -0
- package/dist/hookLogPath.generated.d.ts.map +1 -0
- package/dist/hookLogPath.generated.js +8 -0
- package/dist/hookLogPath.generated.js.map +1 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +1 -1
- package/dist/installConfig.d.ts +15 -2
- package/dist/installConfig.d.ts.map +1 -1
- package/dist/installConfig.js +17 -2
- package/dist/installConfig.js.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +18 -3
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
- package/dist/mcp-tools/workflowGuide.js +8 -8
- package/dist/mcp-tools/workflowGuide.js.map +1 -1
- package/dist/mcp-tools-shared.d.ts.map +1 -1
- package/dist/mcp-tools-shared.js +5 -2
- package/dist/mcp-tools-shared.js.map +1 -1
- package/dist/mcp-ui-simple.d.ts +5 -0
- package/dist/mcp-ui-simple.d.ts.map +1 -1
- package/dist/mcp-ui-simple.js +9 -2
- package/dist/mcp-ui-simple.js.map +1 -1
- package/dist/mcp.d.ts +0 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +36 -33
- package/dist/mcp.js.map +1 -1
- package/dist/mcpAuditJobs.d.ts +10 -0
- package/dist/mcpAuditJobs.d.ts.map +1 -1
- package/dist/mcpAuditJobs.js +10 -1
- package/dist/mcpAuditJobs.js.map +1 -1
- package/dist/mcpAutoIndex.d.ts.map +1 -1
- package/dist/mcpAutoIndex.js +2 -1
- package/dist/mcpAutoIndex.js.map +1 -1
- package/dist/phase/colorMath.d.ts +18 -5
- package/dist/phase/colorMath.d.ts.map +1 -1
- package/dist/phase/colorMath.js +88 -5
- package/dist/phase/colorMath.js.map +1 -1
- package/dist/phase/dataAccessCallsCandidates.js +1 -1
- package/dist/phase/dataAccessCallsCandidates.js.map +1 -1
- package/dist/phase/goFunctionAnalysis.d.ts +2 -2
- package/dist/phase/goFunctionAnalysis.js +2 -2
- package/dist/phase/goFunctions.d.ts +2 -2
- package/dist/phase/goFunctions.js +2 -2
- package/dist/phase/goImports.d.ts +2 -2
- package/dist/phase/goImports.js +2 -2
- package/dist/phase/goSwitches.d.ts +2 -2
- package/dist/phase/goSwitches.js +2 -2
- package/dist/phase/loopQueryCandidates.js +1 -1
- package/dist/phase/loopQueryCandidates.js.map +1 -1
- package/dist/phase/phaseModel.d.ts +37 -8
- package/dist/phase/phaseModel.d.ts.map +1 -1
- package/dist/phase/phaseModel.js +33 -8
- package/dist/phase/phaseModel.js.map +1 -1
- package/dist/phase/producers.d.ts.map +1 -1
- package/dist/phase/producers.js +24 -17
- package/dist/phase/producers.js.map +1 -1
- package/dist/phase/reachability.d.ts +44 -1
- package/dist/phase/reachability.d.ts.map +1 -1
- package/dist/phase/reachability.js +79 -0
- package/dist/phase/reachability.js.map +1 -1
- package/dist/phase/rules/crossDomain.d.ts.map +1 -1
- package/dist/phase/rules/crossDomain.js +16 -6
- package/dist/phase/rules/crossDomain.js.map +1 -1
- package/dist/phase/rules/dry.d.ts.map +1 -1
- package/dist/phase/rules/dry.js +0 -1
- package/dist/phase/rules/dry.js.map +1 -1
- package/dist/phase/rules/goRules.d.ts +2 -2
- package/dist/phase/rules/goRules.js +2 -2
- package/dist/phase/rules/secrets.d.ts +22 -8
- package/dist/phase/rules/secrets.d.ts.map +1 -1
- package/dist/phase/rules/secrets.js +48 -67
- package/dist/phase/rules/secrets.js.map +1 -1
- package/dist/phase/rules/styles.d.ts +23 -9
- package/dist/phase/rules/styles.d.ts.map +1 -1
- package/dist/phase/rules/styles.js +47 -15
- package/dist/phase/rules/styles.js.map +1 -1
- package/dist/phase/rules/unreferencedModule.d.ts.map +1 -1
- package/dist/phase/rules/unreferencedModule.js +16 -5
- package/dist/phase/rules/unreferencedModule.js.map +1 -1
- package/dist/phase/runner.d.ts +16 -7
- package/dist/phase/runner.d.ts.map +1 -1
- package/dist/phase/runner.js +32 -20
- package/dist/phase/runner.js.map +1 -1
- package/dist/phase/stylesCss.d.ts.map +1 -1
- package/dist/phase/stylesCss.js +4 -0
- package/dist/phase/stylesCss.js.map +1 -1
- package/dist/phase/stylesMarkup.d.ts.map +1 -1
- package/dist/phase/stylesMarkup.js +4 -0
- package/dist/phase/stylesMarkup.js.map +1 -1
- package/dist/phase/stylesSource.d.ts.map +1 -1
- package/dist/phase/stylesSource.js +6 -0
- package/dist/phase/stylesSource.js.map +1 -1
- package/dist/phase/testProgram.d.ts +57 -0
- package/dist/phase/testProgram.d.ts.map +1 -0
- package/dist/phase/testProgram.js +244 -0
- package/dist/phase/testProgram.js.map +1 -0
- package/dist/phase/typeDeclarations.d.ts +2 -2
- package/dist/phase/typeDeclarations.js +2 -2
- package/dist/phase/types.d.ts +46 -0
- package/dist/phase/types.d.ts.map +1 -1
- package/dist/pipelineAdapters.d.ts +1 -171
- package/dist/pipelineAdapters.d.ts.map +1 -1
- package/dist/pipelineAdapters.js +47 -1281
- package/dist/pipelineAdapters.js.map +1 -1
- package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
- package/dist/reporting/csvReportGenerator.js +0 -6
- package/dist/reporting/csvReportGenerator.js.map +1 -1
- package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
- package/dist/reporting/htmlReportGenerator.js +0 -4
- package/dist/reporting/htmlReportGenerator.js.map +1 -1
- package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
- package/dist/reporting/jsonReportGenerator.js +0 -1
- package/dist/reporting/jsonReportGenerator.js.map +1 -1
- package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
- package/dist/reporting/sarifReportGenerator.js +0 -7
- package/dist/reporting/sarifReportGenerator.js.map +1 -1
- package/dist/sqlite/driver.d.ts +17 -1
- package/dist/sqlite/driver.d.ts.map +1 -1
- package/dist/sqlite/driver.js +28 -5
- package/dist/sqlite/driver.js.map +1 -1
- package/dist/styles/cssInJsHarvest.d.ts +36 -0
- package/dist/styles/cssInJsHarvest.d.ts.map +1 -0
- package/dist/styles/cssInJsHarvest.js +78 -0
- package/dist/styles/cssInJsHarvest.js.map +1 -0
- package/dist/styles/definedClasses.d.ts +95 -0
- package/dist/styles/definedClasses.d.ts.map +1 -0
- package/dist/styles/definedClasses.js +129 -0
- package/dist/styles/definedClasses.js.map +1 -0
- package/dist/styles/markupStyleHarvest.d.ts +33 -0
- package/dist/styles/markupStyleHarvest.d.ts.map +1 -0
- package/dist/styles/markupStyleHarvest.js +73 -0
- package/dist/styles/markupStyleHarvest.js.map +1 -0
- package/dist/styles/styleExtractor.d.ts +37 -0
- package/dist/styles/styleExtractor.d.ts.map +1 -1
- package/dist/styles/styleExtractor.js +89 -33
- package/dist/styles/styleExtractor.js.map +1 -1
- package/dist/styles/styleIndexer.d.ts.map +1 -1
- package/dist/styles/styleIndexer.js +11 -10
- package/dist/styles/styleIndexer.js.map +1 -1
- package/dist/styles/tailwindExpander.d.ts.map +1 -1
- package/dist/styles/tailwindExpander.js +31 -10
- package/dist/styles/tailwindExpander.js.map +1 -1
- package/dist/telemetry.d.ts +67 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +100 -20
- package/dist/telemetry.js.map +1 -1
- package/dist/types/crossLanguage.d.ts +1 -0
- package/dist/types/crossLanguage.d.ts.map +1 -1
- package/dist/types.d.ts +23 -56
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -4
- package/dist/types.js.map +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/examples/.auditrc.example.json +7 -22
- package/examples/.auditrc.json +12 -155
- package/examples/.code-auditor.json +8 -51
- package/examples/nextjs.auditrc.json +7 -34
- package/examples/node-api.auditrc.json +6 -46
- package/examples/react.auditrc.json +8 -25
- package/examples/tolerant-solid.auditrc.json +12 -44
- package/package.json +6 -5
- package/plugin/.claude-plugin/manifest.json +10 -9
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +4 -4
- package/plugin/scripts/hook-audit.sh +9 -0
- package/plugin/scripts/hook-common.sh +8 -2
- package/plugin/scripts/hook-drift-check.sh +10 -1
- package/plugin/scripts/hook-log-path.sh +7 -0
- package/plugin/scripts/hook-self-audit.sh +9 -0
- package/plugin/scripts/hook-warm.sh +17 -11
- package/plugin/skills/code-auditor/SKILL.md +26 -3
- package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts +0 -6
- package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-20/scripts/tool.js +0 -12
- package/dist/__tests__/fixtures/spec-20/scripts/tool.js.map +0 -1
- package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts +0 -7
- package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-20/src/demo-module.js +0 -13
- package/dist/__tests__/fixtures/spec-20/src/demo-module.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts +0 -14
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js +0 -16
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts +0 -15
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js +0 -17
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +0 -14
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +0 -19
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +0 -18
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +0 -19
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts +0 -19
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js +0 -19
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +0 -17
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js +0 -19
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +0 -25
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js +0 -21
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts +0 -15
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js +0 -19
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts +0 -14
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js +0 -14
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +0 -15
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +0 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js +0 -16
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +0 -1
- package/dist/languages/go/analyzer-darwin-amd64 +0 -0
- package/dist/languages/go/analyzer-darwin-arm64 +0 -0
- package/dist/languages/go/analyzer-linux-amd64 +0 -0
- package/dist/languages/go/analyzer-linux-arm64 +0 -0
- package/dist/languages/go/analyzer-src/analyzer.go +0 -643
- package/dist/languages/go/analyzer-src/dataaccess.go +0 -388
- package/dist/languages/go/analyzer-src/go.mod +0 -3
- package/dist/languages/go/analyzer-src/indexer.go +0 -268
- package/dist/languages/go/analyzer-src/parser.go +0 -461
- package/dist/languages/go/analyzer-src/solid.go +0 -311
- package/dist/languages/go/analyzer-src/testconventions.go +0 -25
- package/dist/languages/go/analyzer-src/types.go +0 -156
- package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
- package/dist/languages/go/go.mod +0 -7
- package/dist/languages/go/main.go +0 -203
- package/dist/native/ast-grep-napi.darwin-arm64.node +0 -0
- package/dist/native/ast-grep-napi.darwin-x64.node +0 -0
- package/dist/native/ast-grep-napi.linux-arm64-gnu.node +0 -0
- package/dist/native/ast-grep-napi.linux-arm64-musl.node +0 -0
- package/dist/native/ast-grep-napi.linux-x64-gnu.node +0 -0
- package/dist/native/ast-grep-napi.linux-x64-musl.node +0 -0
- package/dist/native/ast-grep-napi.win32-x64-msvc.node +0 -0
- package/dist/native-bootstrap.d.ts +0 -15
- package/dist/native-bootstrap.d.ts.map +0 -1
- package/dist/native-bootstrap.js +0 -75
- package/dist/native-bootstrap.js.map +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"projectRoot": ".",
|
|
3
|
-
"reportTitle": "Node.js API Audit",
|
|
4
|
-
|
|
5
2
|
"includePaths": [
|
|
6
3
|
"src/**/*.{ts,js}",
|
|
7
4
|
"lib/**/*.{ts,js}",
|
|
@@ -11,7 +8,7 @@
|
|
|
11
8
|
"services/**/*.{ts,js}",
|
|
12
9
|
"models/**/*.{ts,js}"
|
|
13
10
|
],
|
|
14
|
-
|
|
11
|
+
|
|
15
12
|
"excludePaths": [
|
|
16
13
|
"**/node_modules/**",
|
|
17
14
|
"**/dist/**",
|
|
@@ -21,55 +18,18 @@
|
|
|
21
18
|
"**/__tests__/**",
|
|
22
19
|
"**/coverage/**"
|
|
23
20
|
],
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"security": {
|
|
27
|
-
"authPatterns": ["authenticate", "authorize", "requireAuth", "passport"],
|
|
28
|
-
"rateLimitPatterns": ["rateLimit", "throttle", "limiter"],
|
|
29
|
-
"securityHeaders": [
|
|
30
|
-
"helmet",
|
|
31
|
-
"cors",
|
|
32
|
-
"Content-Security-Policy"
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"data-access": {
|
|
36
|
-
"databasePatterns": {
|
|
37
|
-
"postgres": ["pg", "postgres"],
|
|
38
|
-
"mysql": ["mysql", "mysql2"],
|
|
39
|
-
"mongodb": ["mongodb", "mongoose"]
|
|
40
|
-
},
|
|
41
|
-
"securityPatterns": {
|
|
42
|
-
"parameterized": ["?", "$1", ":id"],
|
|
43
|
-
"sanitized": ["sanitize", "escape", "validator"]
|
|
44
|
-
},
|
|
45
|
-
"performanceThresholds": {
|
|
46
|
-
"maxJoins": 4,
|
|
47
|
-
"warnOnSelectStar": true
|
|
48
|
-
}
|
|
49
|
-
},
|
|
21
|
+
|
|
22
|
+
"analyzerConfigs": {
|
|
50
23
|
"solid": {
|
|
51
24
|
"maxMethodsPerClass": 12,
|
|
52
25
|
"maxLinesPerMethod": 60,
|
|
53
26
|
"maxParametersPerMethod": 5
|
|
54
27
|
}
|
|
55
28
|
},
|
|
56
|
-
|
|
57
|
-
"outputFormats": ["json", "html"],
|
|
58
|
-
"outputDirectory": "./audit-reports",
|
|
59
|
-
|
|
29
|
+
|
|
60
30
|
"minSeverity": "severe",
|
|
61
|
-
|
|
62
|
-
|
|
31
|
+
|
|
63
32
|
"thresholds": {
|
|
64
|
-
"maxCritical": 0,
|
|
65
|
-
"maxWarnings": 10,
|
|
66
33
|
"minHealthScore": 90
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
"integrations": {
|
|
70
|
-
"ci": {
|
|
71
|
-
"provider": "github",
|
|
72
|
-
"failOnThreshold": true
|
|
73
|
-
}
|
|
74
34
|
}
|
|
75
|
-
}
|
|
35
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"projectRoot": ".",
|
|
3
|
-
"reportTitle": "React Project Audit",
|
|
4
|
-
|
|
5
2
|
"includePaths": [
|
|
6
3
|
"src/**/*.{ts,tsx,js,jsx}"
|
|
7
4
|
],
|
|
8
|
-
|
|
5
|
+
|
|
9
6
|
"excludePaths": [
|
|
10
7
|
"**/node_modules/**",
|
|
11
8
|
"**/build/**",
|
|
@@ -16,18 +13,10 @@
|
|
|
16
13
|
"**/coverage/**",
|
|
17
14
|
"**/*.stories.{ts,tsx,js,jsx}"
|
|
18
15
|
],
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"checkPropTypes": true,
|
|
24
|
-
"maxComplexity": 12,
|
|
25
|
-
"frameworkPatterns": {
|
|
26
|
-
"react": {
|
|
27
|
-
"hooks": ["use*"],
|
|
28
|
-
"context": ["*Context", "*Provider"]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
16
|
+
|
|
17
|
+
"analyzerConfigs": {
|
|
18
|
+
"react": {
|
|
19
|
+
"maxComponentComplexity": 12
|
|
31
20
|
},
|
|
32
21
|
"solid": {
|
|
33
22
|
"maxMethodsPerClass": 8,
|
|
@@ -38,16 +27,10 @@
|
|
|
38
27
|
"checkImports": true
|
|
39
28
|
}
|
|
40
29
|
},
|
|
41
|
-
|
|
42
|
-
"outputFormats": ["html", "json"],
|
|
43
|
-
"outputDirectory": "./audit-reports",
|
|
44
|
-
|
|
30
|
+
|
|
45
31
|
"minSeverity": "severe",
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
|
|
48
33
|
"thresholds": {
|
|
49
|
-
"maxCritical": 0,
|
|
50
|
-
"maxWarnings": 30,
|
|
51
34
|
"minHealthScore": 75
|
|
52
35
|
}
|
|
53
|
-
}
|
|
36
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"projectRoot": ".",
|
|
3
|
-
"reportTitle": "Project Audit with Relaxed SOLID Tolerances",
|
|
4
|
-
|
|
5
2
|
"includePaths": [
|
|
6
3
|
"src/**/*.{ts,tsx,js,jsx}"
|
|
7
4
|
],
|
|
8
|
-
|
|
5
|
+
|
|
9
6
|
"excludePaths": [
|
|
10
7
|
"**/node_modules/**",
|
|
11
8
|
"**/build/**",
|
|
@@ -13,53 +10,24 @@
|
|
|
13
10
|
"**/*.test.{ts,tsx,js,jsx}",
|
|
14
11
|
"**/*.spec.{ts,tsx,js,jsx}"
|
|
15
12
|
],
|
|
16
|
-
|
|
13
|
+
|
|
17
14
|
"analyzerConfigs": {
|
|
18
15
|
"solid": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"dashboard": 4,
|
|
23
|
-
"table": 3,
|
|
24
|
-
"form": 3
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
"classResponsibilityThresholds": {
|
|
28
|
-
"default": 2,
|
|
29
|
-
"repository": 2,
|
|
30
|
-
"service": 3,
|
|
31
|
-
"controller": 3,
|
|
32
|
-
"model": 3
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
"ifElseChainThreshold": 5,
|
|
36
|
-
"switchCaseThreshold": 7,
|
|
37
|
-
"classMethodThreshold": 12,
|
|
38
|
-
"interfaceMemberThreshold": 20,
|
|
39
|
-
"dependencyInjectionLimit": 6
|
|
16
|
+
"classMethodsThreshold": 40,
|
|
17
|
+
"maxInterfaceMembers": 50,
|
|
18
|
+
"maxMethodComplexity": 100
|
|
40
19
|
},
|
|
41
|
-
|
|
20
|
+
|
|
42
21
|
"dry": {
|
|
43
|
-
"minLineThreshold": 15,
|
|
44
|
-
"similarityThreshold": 0.85,
|
|
45
|
-
"checkImports": true
|
|
46
|
-
"unusedImportsConfig": {
|
|
47
|
-
"checkLevel": "function",
|
|
48
|
-
"includeTypeOnlyImports": false,
|
|
49
|
-
"ignorePatterns": ["React", "^_", "test.*"]
|
|
50
|
-
}
|
|
22
|
+
"minLineThreshold": 15,
|
|
23
|
+
"similarityThreshold": 0.85,
|
|
24
|
+
"checkImports": true
|
|
51
25
|
}
|
|
52
26
|
},
|
|
53
|
-
|
|
54
|
-
"outputFormats": ["html", "json"],
|
|
55
|
-
"outputDirectory": "./audit-reports",
|
|
56
|
-
|
|
27
|
+
|
|
57
28
|
"minSeverity": "severe",
|
|
58
|
-
|
|
59
|
-
|
|
29
|
+
|
|
60
30
|
"thresholds": {
|
|
61
|
-
"maxCritical": 5,
|
|
62
|
-
"maxWarnings": 50,
|
|
63
31
|
"minHealthScore": 70
|
|
64
32
|
}
|
|
65
|
-
}
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-auditor-mcp",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Enforces architectural invariants and code quality rules inside your AI agent's edit loop.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"code-auditor-daemon": "dist/daemon/main.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "pnpm run build:version &&
|
|
15
|
+
"build": "pnpm run build:version && pnpm run build:hooklog && tsc && pnpm run build:grammars && pnpm run build:skills && pnpm run build:manifest",
|
|
16
16
|
"build:version": "node scripts/write-version.mjs",
|
|
17
|
-
"
|
|
17
|
+
"build:hooklog": "node scripts/write-hook-log-path.mjs",
|
|
18
18
|
"build:grammars": "mkdir -p dist/grammars && cp node_modules/tree-sitter-typescript/tree-sitter-typescript.wasm node_modules/tree-sitter-typescript/tree-sitter-tsx.wasm node_modules/tree-sitter-go/tree-sitter-go.wasm node_modules/tree-sitter-css/tree-sitter-css.wasm grammars/tree-sitter-scss.wasm dist/grammars/",
|
|
19
19
|
"build:skills": "node scripts/build-skills.mjs",
|
|
20
20
|
"build:manifest": "node scripts/build-manifest.mjs",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"verify:disk-space": "node scripts/verify-disk-space.mjs",
|
|
37
37
|
"verify:types": "tsc --noEmit",
|
|
38
38
|
"verify:dist-fresh": "node scripts/verify-dist-fresh.mjs",
|
|
39
|
+
"verify:hook-log-path": "node scripts/verify-hook-log-path.mjs",
|
|
40
|
+
"verify:version-fresh": "node scripts/verify-version-fresh.mjs",
|
|
39
41
|
"verify:clean-install": "bash scripts/verify-clean-install.sh",
|
|
40
42
|
"verify:dist": "npm pack --silent && bash scripts/verify-dist.sh && rm -f code-auditor-mcp-*.tgz",
|
|
41
43
|
"verify:self": "node scripts/verify-self.mjs && node scripts/verify-languages.mjs",
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
"verify:gate-budget": "node scripts/verify-gate-budget.mjs",
|
|
46
48
|
"verify:recall-value-drift": "tsx scripts/verify-recall-value-drift.ts",
|
|
47
49
|
"verify:extraction-completeness": "tsx scripts/verify-extraction-completeness.ts",
|
|
48
|
-
"verify:
|
|
50
|
+
"verify:recall-cases": "tsx scripts/verify-recall-cases.ts",
|
|
49
51
|
"verify:close": "node scripts/verify-close.mjs"
|
|
50
52
|
},
|
|
51
53
|
"keywords": [
|
|
@@ -122,7 +124,6 @@
|
|
|
122
124
|
"files": [
|
|
123
125
|
"dist/**/*",
|
|
124
126
|
"dist/grammars/",
|
|
125
|
-
"dist/native/",
|
|
126
127
|
"plugin/**/*",
|
|
127
128
|
".claude-plugin/**/*",
|
|
128
129
|
"examples/**/*",
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.0
|
|
2
|
+
"version": "5.2.0",
|
|
3
3
|
"files": {
|
|
4
|
-
".claude-plugin/plugin.json": "
|
|
4
|
+
".claude-plugin/plugin.json": "b492a180519f2991d0aa18211c3c9e45e6569c4715339e79d2032bbeec6ff44d",
|
|
5
5
|
"README.md": "6e51516ead6c7d0b4e77629e071e139b899d30a47838e8721c0d534eb733ad45",
|
|
6
|
-
"hooks/hooks.json": "
|
|
7
|
-
"scripts/hook-audit.sh": "
|
|
8
|
-
"scripts/hook-common.sh": "
|
|
9
|
-
"scripts/hook-drift-check.sh": "
|
|
10
|
-
"scripts/hook-
|
|
11
|
-
"scripts/hook-
|
|
6
|
+
"hooks/hooks.json": "f9817f337d147bbd0e175741e57c6bd0718c64352ddbff15b5ba9357272b6725",
|
|
7
|
+
"scripts/hook-audit.sh": "3fa178a87c8ac4d4d49d0cac16df308a37ccc89d778a5eda614799fc69e3e6c8",
|
|
8
|
+
"scripts/hook-common.sh": "0f29ac77e94ca7ba3f6ffe23bc91f9ce0c77f1568d9f13e29288d0cf5eef6bd8",
|
|
9
|
+
"scripts/hook-drift-check.sh": "4e6ed8e4e33d0765a5ed6adfda6fb3ecec5750d836632aa4ee6d7a6acce69665",
|
|
10
|
+
"scripts/hook-log-path.sh": "4ac27ac22dcb29fd82cbd9a936b3da7115c5182386a0e3290ed5ac9e529bc132",
|
|
11
|
+
"scripts/hook-self-audit.sh": "593926cd4714c653269791ed53675b46fbc92310074bff9194772e25665b0257",
|
|
12
|
+
"scripts/hook-warm.sh": "22d750e8e36164920515c8370f02dd48f9f09f26bfe4a21e67de91f45b5ffef9",
|
|
12
13
|
"skills/code-auditor/SKILL-RULE-KINDS.md": "be1bbe1b56b19dc112c2657c1f5984f6f704b2ac9c1c0f78a561a58b110d508a",
|
|
13
14
|
"skills/code-auditor/SKILL-SEARCH.md": "95d2df4474995bc5b18e14cc55ac55fb828024541463f109239567e2aa5ab7b0",
|
|
14
|
-
"skills/code-auditor/SKILL.md": "
|
|
15
|
+
"skills/code-auditor/SKILL.md": "0f88508c4549f4b53fdfee431e43a27c7eba2ac99e0eaad64ba55492429be41b"
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-auditor",
|
|
3
3
|
"description": "Diff-scoped code quality auditing on every edit. Indexes your codebase, enforces invariants, and feeds violations back to the agent so fixes happen inline.",
|
|
4
|
-
"version": "5.0
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ben Hammond",
|
|
7
7
|
"email": "ben@benhammond.tech"
|
package/plugin/hooks/hooks.json
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-warm.sh"
|
|
9
|
+
"command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then dir=\"${XDG_CACHE_HOME:-$HOME/.cache}/code-auditor/logs\"; mkdir -p \"$dir\" 2>/dev/null || true; echo \"[$(date -u +%Y-%m-%dT%H:%M:%SZ)] [code-auditor] HOOK NOT RUNNING: CLAUDE_PLUGIN_ROOT is unset — could not locate the plugin; the warm-up is not running.\" >> \"$dir/hook.log\" 2>/dev/null || true; exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-warm.sh"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"type": "command",
|
|
13
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-drift-check.sh"
|
|
13
|
+
"command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then dir=\"${XDG_CACHE_HOME:-$HOME/.cache}/code-auditor/logs\"; mkdir -p \"$dir\" 2>/dev/null || true; echo \"[$(date -u +%Y-%m-%dT%H:%M:%SZ)] [code-auditor] HOOK NOT RUNNING: CLAUDE_PLUGIN_ROOT is unset — could not locate the plugin; the drift check is not running.\" >> \"$dir/hook.log\" 2>/dev/null || true; exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-drift-check.sh"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"hooks": [
|
|
22
22
|
{
|
|
23
23
|
"type": "command",
|
|
24
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-audit.sh"
|
|
24
|
+
"command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then dir=\"${XDG_CACHE_HOME:-$HOME/.cache}/code-auditor/logs\"; mkdir -p \"$dir\" 2>/dev/null || true; echo \"[$(date -u +%Y-%m-%dT%H:%M:%SZ)] [code-auditor] HOOK NOT RUNNING: CLAUDE_PLUGIN_ROOT is unset — could not locate the plugin; the audit is not running.\" >> \"$dir/hook.log\" 2>/dev/null || true; exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-audit.sh"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"type": "command",
|
|
28
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-self-audit.sh"
|
|
28
|
+
"command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then dir=\"${XDG_CACHE_HOME:-$HOME/.cache}/code-auditor/logs\"; mkdir -p \"$dir\" 2>/dev/null || true; echo \"[$(date -u +%Y-%m-%dT%H:%M:%SZ)] [code-auditor] HOOK NOT RUNNING: CLAUDE_PLUGIN_ROOT is unset — could not locate the plugin; the self-audit is not running.\" >> \"$dir/hook.log\" 2>/dev/null || true; exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-self-audit.sh"
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
}
|
|
@@ -92,6 +92,15 @@ fi
|
|
|
92
92
|
exit_code=$?
|
|
93
93
|
set -e
|
|
94
94
|
|
|
95
|
+
# A completed run — clean (0) or finding (2) — is the positive "the hook is
|
|
96
|
+
# alive and enqueueing" signal. Write it so the explicit-audit reader
|
|
97
|
+
# (src/hookLog.ts) can clear a prior HOOK NOT RUNNING condition: the reader
|
|
98
|
+
# resolves a condition by newest-record order, and without this line a hook that
|
|
99
|
+
# recovered would leave the stale condition live forever.
|
|
100
|
+
if [ "${exit_code}" -eq 0 ] || [ "${exit_code}" -eq 2 ]; then
|
|
101
|
+
hook_log "[code-auditor] HOOK RAN"
|
|
102
|
+
fi
|
|
103
|
+
|
|
95
104
|
# Exit 2 = a finding read from the daemon cache; propagate so Claude Code feeds
|
|
96
105
|
# stdout back.
|
|
97
106
|
if [ ${exit_code} -eq 2 ]; then
|
|
@@ -53,6 +53,12 @@ plugin_root() {
|
|
|
53
53
|
printf '%s' "${root}"
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
# The hook-log path tail + file name are single-sourced in hook-log-path.sh,
|
|
57
|
+
# generated by scripts/write-hook-log-path.mjs from the same source as
|
|
58
|
+
# src/hookLogPath.generated.ts (the reader's copy). Sourced here so the write
|
|
59
|
+
# half and the read half (src/hookLog.ts) can never drift apart.
|
|
60
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)/hook-log-path.sh"
|
|
61
|
+
|
|
56
62
|
# hook_log_dir / hook_log_file / hook_log — the hook's diagnostic log.
|
|
57
63
|
#
|
|
58
64
|
# The PostToolUse hook must never write stderr: the host may block on stderr
|
|
@@ -61,10 +67,10 @@ plugin_root() {
|
|
|
61
67
|
# still exits 0. A broken install therefore surfaces on the next explicit audit
|
|
62
68
|
# (and in this log), never on the edit itself.
|
|
63
69
|
hook_log_dir() {
|
|
64
|
-
printf '%s' "${XDG_CACHE_HOME:-$HOME/.cache}
|
|
70
|
+
printf '%s' "${XDG_CACHE_HOME:-$HOME/.cache}/${HOOK_LOG_DIR_TAIL}"
|
|
65
71
|
}
|
|
66
72
|
hook_log_file() {
|
|
67
|
-
printf '%s' "$(hook_log_dir)
|
|
73
|
+
printf '%s' "$(hook_log_dir)/${HOOK_LOG_FILE}"
|
|
68
74
|
}
|
|
69
75
|
hook_log() {
|
|
70
76
|
mkdir -p "$(hook_log_dir)" 2>/dev/null || return 0
|
|
@@ -33,7 +33,13 @@ manifest=""
|
|
|
33
33
|
for f in "${ROOT}/.claude-plugin/manifest.json" "${ROOT}/manifest.json"; do
|
|
34
34
|
if [ -f "$f" ]; then manifest="$f"; break; fi
|
|
35
35
|
done
|
|
36
|
-
[ -
|
|
36
|
+
if [ -z "${manifest}" ]; then
|
|
37
|
+
# No manifest to compare against is still a completed run — the drift check
|
|
38
|
+
# never exits non-zero, so write the success record that resolves a prior
|
|
39
|
+
# HOOK NOT RUNNING condition before the no-op exit.
|
|
40
|
+
hook_log "[code-auditor] HOOK RAN"
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
37
43
|
|
|
38
44
|
MANIFEST_PATH="${manifest}" PLUGIN_ROOT="${ROOT}" node <<'NODE'
|
|
39
45
|
const fs = require('fs');
|
|
@@ -73,4 +79,7 @@ if (problems.length > 0) {
|
|
|
73
79
|
}
|
|
74
80
|
NODE
|
|
75
81
|
|
|
82
|
+
# A completed run (drift found or not) resolves a prior HOOK NOT RUNNING
|
|
83
|
+
# condition — the drift check never exits non-zero.
|
|
84
|
+
hook_log "[code-auditor] HOOK RAN"
|
|
76
85
|
exit 0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @generated — do not edit. Written by `scripts/write-hook-log-path.mjs`.
|
|
2
|
+
#
|
|
3
|
+
# Single source of truth for the hook-log path, shared by the TS reader
|
|
4
|
+
# (src/hookLog.ts) and the bash writer (plugin/scripts/hook-common.sh).
|
|
5
|
+
# Regenerate with `npm run build:hooklog`.
|
|
6
|
+
HOOK_LOG_DIR_TAIL='code-auditor/logs'
|
|
7
|
+
HOOK_LOG_FILE='hook.log'
|
|
@@ -92,6 +92,15 @@ fi
|
|
|
92
92
|
exit_code=$?
|
|
93
93
|
set -e
|
|
94
94
|
|
|
95
|
+
# A completed run — clean (0) or finding (2) — is the positive "the hook is
|
|
96
|
+
# alive" signal, mirroring hook-audit.sh. Write it so the reader (src/hookLog.ts)
|
|
97
|
+
# can clear a prior HOOK NOT RUNNING condition: the reader resolves by
|
|
98
|
+
# newest-record order, and without this line a recovered hook would leave the
|
|
99
|
+
# stale condition live forever.
|
|
100
|
+
if [ "${exit_code}" -eq 0 ] || [ "${exit_code}" -eq 2 ]; then
|
|
101
|
+
hook_log "[code-auditor] HOOK RAN"
|
|
102
|
+
fi
|
|
103
|
+
|
|
95
104
|
# Exit 2 = a blocking self-audit finding; propagate so Claude Code feeds it back.
|
|
96
105
|
if [ ${exit_code} -eq 2 ]; then
|
|
97
106
|
exit 2
|
|
@@ -26,18 +26,24 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
|
|
26
26
|
# Nothing safe to warm if the manifest version can't be read: warming @latest
|
|
27
27
|
# could pin a different version than resolve_code_audit's fallback would fetch.
|
|
28
28
|
pv="$(plugin_version)"
|
|
29
|
-
[ -n "${pv}" ] || exit 0
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
if [ -n "${pv}" ]; then
|
|
31
|
+
dir="$(pin_dir)"
|
|
32
|
+
bin="${dir}/node_modules/.bin/code-audit"
|
|
33
33
|
|
|
34
|
-
# Already installed — nothing to warm. Re-running npm install here would re-check
|
|
35
|
-
# the registry on every session, which is exactly the cost this hook exists to avoid.
|
|
36
|
-
[ -x "${bin}" ]
|
|
34
|
+
# Already installed — nothing to warm. Re-running npm install here would re-check
|
|
35
|
+
# the registry on every session, which is exactly the cost this hook exists to avoid.
|
|
36
|
+
if [ ! -x "${bin}" ]; then
|
|
37
|
+
# Background the exact install the hook's last-resort path runs. Output to
|
|
38
|
+
# /dev/null (silent), stdin from /dev/null (don't hold the hook's stdin open),
|
|
39
|
+
# nohup so the install survives this hook's exit.
|
|
40
|
+
nohup npm install --prefer-offline --prefix "${dir}" "code-auditor-mcp@${pv}" \
|
|
41
|
+
--no-audit --no-fund --ignore-scripts --silent >/dev/null 2>&1 </dev/null &
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
37
44
|
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
--no-audit --no-fund --ignore-scripts --silent >/dev/null 2>&1 </dev/null &
|
|
45
|
+
# A completed run — the warm hook never exits non-zero, so every path through it
|
|
46
|
+
# is a success — writes the positive record that resolves a prior HOOK NOT RUNNING
|
|
47
|
+
# condition (CLAUDE_PLUGIN_ROOT unset) in the reader (src/hookLog.ts).
|
|
48
|
+
hook_log "[code-auditor] HOOK RAN"
|
|
43
49
|
exit 0
|
|
@@ -5,7 +5,7 @@ description: Audit code quality, search the codebase semantically, enforce invar
|
|
|
5
5
|
|
|
6
6
|
# Code Auditor Skill
|
|
7
7
|
|
|
8
|
-
> **Version 5.0
|
|
8
|
+
> **Version 5.2.0** • Run `code-audit --version` to check your installed version.
|
|
9
9
|
> If versions differ, the CLI is authoritative — use `code-audit <command> --help` to see what your install actually supports.
|
|
10
10
|
|
|
11
11
|
You have the `code-audit` CLI available. It indexes every function, component, and struct in the codebase for semantic search and invariant enforcement. Use these commands instead of raw grep/find whenever possible.
|
|
@@ -82,10 +82,31 @@ A dismissal is for *this finding is not relevant*, not for *I don't want to fix
|
|
|
82
82
|
|
|
83
83
|
The tool can send dismissed findings to an anonymous feedback service that collects them. It is **off by default** and is turned on only by an explicit opt-in:
|
|
84
84
|
|
|
85
|
-
- `
|
|
85
|
+
- `code-audit telemetry status` / `enable` / `disable` manage the opt-in (the `mcp__code-auditor__telemetry` tool mirrors the same toggle). `enable` needs no arguments — it opts in against the built-in service endpoint and generates the anonymous install ID.
|
|
86
86
|
- When opted in, each dismissal sends only the reason plus a structural shape — **no code, identifiers, or file paths**.
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
On first contact, run `code-audit telemetry status` and read its `decided` field:
|
|
89
|
+
|
|
90
|
+
- **`decided` is false** — the user has never been asked. Tell them the privacy facts (below), then ask **once** whether to opt in. Run `code-audit telemetry enable` on yes and `code-audit telemetry disable` on no — either records the decision so the question is never repeated.
|
|
91
|
+
- **`decided` is true** — the user has already chosen. Never ask again; leave the setting exactly as it is.
|
|
92
|
+
|
|
93
|
+
The privacy facts: each submission contains the tool version, the rule ID, the urgency level, the dismissal reason exactly as typed, a structural AST signature (grammar node types only, never their contents), a coarse language hint, a timestamp, and an anonymous install ID generated locally on your machine. Source code, identifiers, literals, file paths, and environment details are never sent, unless the user types them into the reason.
|
|
94
|
+
|
|
95
|
+
### `code-audit request-rule` — request a rule for an unflagged defect
|
|
96
|
+
|
|
97
|
+
When you find a *class* of defect the audit did not flag, request a new rule instead of silently working around it:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
code-audit request-rule \
|
|
101
|
+
--title "Flag unbounded loops" \
|
|
102
|
+
--symptom "A loop with no exit condition hangs the process at runtime." \
|
|
103
|
+
--signal "A for-loop over a dynamic collection with no bound check." \
|
|
104
|
+
--language typescript \
|
|
105
|
+
--fires bad.ts \
|
|
106
|
+
--clean fixed.ts
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Call `lookup_rule` or `explain_symptom` first to confirm no existing rule covers it. Provide a minimal example that *should* be flagged (`--fires`) and a corrected example that *should not* (`--clean`), each reduced to the smallest code that shows the difference, with secrets and proprietary identifiers removed. The CLI prints a receipt id so the request can be tracked.
|
|
89
110
|
|
|
90
111
|
### `code-audit config` — know the project's laws
|
|
91
112
|
|
|
@@ -235,6 +256,8 @@ The hook auto-installs the package to a cache dir on first use — no manual npm
|
|
|
235
256
|
| Resolve file profiles | `code-audit config profiles --file <path>` |
|
|
236
257
|
| Next file to fix | `code-audit next-file` |
|
|
237
258
|
| Dismiss a false positive | `code-audit dismiss <fingerprint> --reason "…"` |
|
|
259
|
+
| Telemetry opt-in | `code-audit telemetry status` / `enable` / `disable` |
|
|
260
|
+
| Request a new rule | `code-audit request-rule` |
|
|
238
261
|
| Sync index | `code-audit index sync --path .` |
|
|
239
262
|
| Codebase map | `code-audit map -p .` |
|
|
240
263
|
| Mine conventions | `code-audit conventions list` |
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/scripts/tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMtD"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scripts-tree module with an undocumented exported function.
|
|
3
|
-
* Same code as src/demo-module.ts — the profile controls what fires.
|
|
4
|
-
*/
|
|
5
|
-
export function calculateTotal(items) {
|
|
6
|
-
let total = 0;
|
|
7
|
-
for (const item of items) {
|
|
8
|
-
total += item * 1.1;
|
|
9
|
-
}
|
|
10
|
-
return total;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/scripts/tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-tree module with an undocumented exported function.
|
|
3
|
-
* When requireFunctionDocs is true (default), the documentation analyzer
|
|
4
|
-
* flags this. When a profile sets requireFunctionDocs=false, skip entirely.
|
|
5
|
-
*/
|
|
6
|
-
export declare function calculateTotal(items: number[]): number;
|
|
7
|
-
//# sourceMappingURL=demo-module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demo-module.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/src/demo-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMtD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-tree module with an undocumented exported function.
|
|
3
|
-
* When requireFunctionDocs is true (default), the documentation analyzer
|
|
4
|
-
* flags this. When a profile sets requireFunctionDocs=false, skip entirely.
|
|
5
|
-
*/
|
|
6
|
-
export function calculateTotal(items) {
|
|
7
|
-
let total = 0;
|
|
8
|
-
for (const item of items) {
|
|
9
|
-
total += item * 1.1;
|
|
10
|
-
}
|
|
11
|
-
return total;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=demo-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demo-module.js","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/src/demo-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spec-52 R1 item 1 — loop-query FALSE positive (oracle: MUST NOT fire).
|
|
3
|
-
*
|
|
4
|
-
* `db.prepare(sql)` inside a loop builds a statement object; it performs no I/O.
|
|
5
|
-
* The statements are accumulated and executed once by a single `.batch()` after
|
|
6
|
-
* the loop. This is the `mod.ts:213/218/223/266` shape — not an N+1.
|
|
7
|
-
*/
|
|
8
|
-
interface Row {
|
|
9
|
-
id: number;
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function insertMany(db: any, rows: Row[]): Promise<void>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=item-01-prepare-in-loop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"item-01-prepare-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-01-prepare-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,UAAU,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spec-52 R1 item 1 — loop-query FALSE positive (oracle: MUST NOT fire).
|
|
3
|
-
*
|
|
4
|
-
* `db.prepare(sql)` inside a loop builds a statement object; it performs no I/O.
|
|
5
|
-
* The statements are accumulated and executed once by a single `.batch()` after
|
|
6
|
-
* the loop. This is the `mod.ts:213/218/223/266` shape — not an N+1.
|
|
7
|
-
*/
|
|
8
|
-
export async function insertMany(db, rows) {
|
|
9
|
-
const stmts = [];
|
|
10
|
-
for (const row of rows) {
|
|
11
|
-
const stmt = db.prepare('INSERT INTO items (id, name) VALUES (?, ?)');
|
|
12
|
-
stmts.push(stmt);
|
|
13
|
-
}
|
|
14
|
-
await db.batch(stmts);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=item-01-prepare-in-loop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"item-01-prepare-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-01-prepare-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAO,EAAE,IAAW;IACnD,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACtE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spec-52 R1 item 2 — accumulate-then-batch (oracle: MUST NOT fire).
|
|
3
|
-
*
|
|
4
|
-
* The explicit accumulate-then-batch shape: each loop iteration prepares and
|
|
5
|
-
* binds a statement (statement construction — no I/O), pushes it to an array,
|
|
6
|
-
* and a single `.batch()` after the loop executes them all. The eager call sits
|
|
7
|
-
* outside the loop, so this is not an N+1.
|
|
8
|
-
*/
|
|
9
|
-
interface ScoreRow {
|
|
10
|
-
id: number;
|
|
11
|
-
score: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function rescoreMany(db: any, items: ScoreRow[]): Promise<void>;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=item-02-prepare-bind-accumulate-batch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"item-02-prepare-bind-accumulate-batch.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3E"}
|