code-auditor-mcp 3.0.7 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +245 -0
  3. package/README.md +24 -0
  4. package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.d.ts +21 -0
  5. package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.d.ts.map +1 -0
  6. package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.js +21 -0
  7. package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.js.map +1 -0
  8. package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.d.ts +13 -0
  9. package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.d.ts.map +1 -0
  10. package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.js +12 -0
  11. package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.js.map +1 -0
  12. package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.d.ts +11 -0
  13. package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.d.ts.map +1 -0
  14. package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.js +22 -0
  15. package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.js.map +1 -0
  16. package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.d.ts +9 -0
  17. package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.d.ts.map +1 -0
  18. package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.js +13 -0
  19. package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.js.map +1 -0
  20. package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.d.ts +13 -0
  21. package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.d.ts.map +1 -0
  22. package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.js +18 -0
  23. package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.js.map +1 -0
  24. package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.d.ts +10 -0
  25. package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.d.ts.map +1 -0
  26. package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.js +16 -0
  27. package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.js.map +1 -0
  28. package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.d.ts +14 -0
  29. package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.d.ts.map +1 -0
  30. package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.js +18 -0
  31. package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.js.map +1 -0
  32. package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.d.ts +13 -0
  33. package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.d.ts.map +1 -0
  34. package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.js +22 -0
  35. package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.js.map +1 -0
  36. package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.d.ts +10 -0
  37. package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.d.ts.map +1 -0
  38. package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.js +20 -0
  39. package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.js.map +1 -0
  40. package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.d.ts +18 -0
  41. package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.d.ts.map +1 -0
  42. package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.js +28 -0
  43. package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.js.map +1 -0
  44. package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.d.ts +11 -0
  45. package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.d.ts.map +1 -0
  46. package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.js +31 -0
  47. package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.js.map +1 -0
  48. package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.d.ts +11 -0
  49. package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.d.ts.map +1 -0
  50. package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.js +18 -0
  51. package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.js.map +1 -0
  52. package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.d.ts +13 -0
  53. package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.d.ts.map +1 -0
  54. package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.js +61 -0
  55. package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.js.map +1 -0
  56. package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.d.ts +10 -0
  57. package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.d.ts.map +1 -0
  58. package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.js +15 -0
  59. package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.js.map +1 -0
  60. package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.d.ts +11 -0
  61. package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.d.ts.map +1 -0
  62. package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.js +49 -0
  63. package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.js.map +1 -0
  64. package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.d.ts +10 -0
  65. package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.d.ts.map +1 -0
  66. package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.js +19 -0
  67. package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.js.map +1 -0
  68. package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.d.ts +37 -0
  69. package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.d.ts.map +1 -0
  70. package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.js +73 -0
  71. package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.js.map +1 -0
  72. package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.d.ts +12 -0
  73. package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.d.ts.map +1 -0
  74. package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.js +82 -0
  75. package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.js.map +1 -0
  76. package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.d.ts +10 -0
  77. package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.d.ts.map +1 -0
  78. package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.js +15 -0
  79. package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.js.map +1 -0
  80. package/dist/analyzers/cross-language/APIContractAnalyzer.d.ts.map +1 -1
  81. package/dist/analyzers/cross-language/APIContractAnalyzer.js +3 -5
  82. package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
  83. package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.d.ts.map +1 -1
  84. package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.js +1 -3
  85. package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.js.map +1 -1
  86. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
  87. package/dist/analyzers/cross-language/DependencyGraphBuilder.js +2 -5
  88. package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
  89. package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
  90. package/dist/analyzers/cross-language/SchemaValidator.js +2 -5
  91. package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
  92. package/dist/analyzers/reactAnalyzer.js +7 -22
  93. package/dist/analyzers/reactAnalyzer.js.map +1 -1
  94. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +40 -2
  95. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
  96. package/dist/analyzers/universal/UniversalDRYAnalyzer.js +186 -29
  97. package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
  98. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +30 -0
  99. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  100. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +164 -61
  101. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  102. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts +51 -7
  103. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
  104. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +354 -48
  105. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
  106. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +8 -4
  107. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  108. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +51 -38
  109. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
  110. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +59 -39
  111. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
  112. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +412 -153
  113. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
  114. package/dist/auditRunner.d.ts.map +1 -1
  115. package/dist/auditRunner.js +26 -2
  116. package/dist/auditRunner.js.map +1 -1
  117. package/dist/cli.js.map +1 -1
  118. package/dist/config/defaults.d.ts +32 -0
  119. package/dist/config/defaults.d.ts.map +1 -1
  120. package/dist/config/defaults.js +62 -4
  121. package/dist/config/defaults.js.map +1 -1
  122. package/dist/index.d.ts +0 -3
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +2 -4
  125. package/dist/index.js.map +1 -1
  126. package/dist/languages/UniversalAnalyzer.d.ts +7 -0
  127. package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
  128. package/dist/languages/UniversalAnalyzer.js +16 -23
  129. package/dist/languages/UniversalAnalyzer.js.map +1 -1
  130. package/dist/mcp-tools/whitelistTools.d.ts +1 -1
  131. package/package.json +2 -1
  132. package/plugin/.claude-plugin/plugin.json +1 -1
@@ -10,7 +10,7 @@
10
10
  "name": "code-auditor",
11
11
  "source": "./plugin",
12
12
  "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.",
13
- "version": "3.0.6",
13
+ "version": "3.1.1",
14
14
  "author": {
15
15
  "name": "Ben Hammond"
16
16
  },
package/CHANGELOG.md ADDED
@@ -0,0 +1,245 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Code Auditor MCP project.
4
+
5
+ ## [3.1.0] — 2026-07-20
6
+
7
+ ### Spec-17: Signal Hotfix — Noise Reduction Across All Analyzers
8
+
9
+ Large-scale noise reduction targeting all 6 analyzers based on a real-corpus diagnostic report (3,871 files, 6,159 functions, 26,119 findings — ~96% noise). Every noise class in the diagnostic is addressed at the defect level.
10
+
11
+ #### R1: Documentation Analyzer
12
+
13
+ - **R1.1 — Anonymous callbacks skipped**: Arrow functions and function expressions used as arguments (`.map()`, `.forEach()`, event handlers) are no longer flagged. Uses AST parent-walking, not name whitelists.
14
+ - **R1.2 — Default scope is public API surface only**: Only exported functions and public class methods are flagged at default scope. Private/protected/`#`-prefixed/`_`-prefixed methods are skipped.
15
+ - **R1.3 — Minimum-size gate**: Functions with body length < `docsMinLines` (default 5) are skipped.
16
+ - **R1.4 — `scope: "all"`**: Restores broader coverage minus callbacks. Named internal functions are flagged but anonymous callbacks are still skipped.
17
+ - **R1.5 — File-header checks default OFF**: `fileHeaders` (default `false`) replaces `requireFileDocs`. When enabled, barrel/index/test/migration/config files are excluded by `headerSkipGlobs`.
18
+ - **R1.6 — Audience-reason messages**: Messages state *why* a function is in scope (e.g., "exported function without JSDoc").
19
+ - **Deprecation**: `requireFileDocs` is deprecated in favor of `fileHeaders`. It maps to `fileHeaders` for back-compat but the combined default is `false` (off). `checkExportedOnly` is replaced by `scope`.
20
+
21
+ #### R2: Schema Analyzer
22
+
23
+ - **R2.1 — SQL-context-only extraction**: Table references are now extracted only from SQL-tagged templates (`` sql`...` ``), DB-call patterns (`db.exec(...)`, `db.query(...)`), and `.sql`/migration files. The 11 raw-regex scan-all-strings approach that caused ~4,500 false positives (including "the", "node:child_process" imports) has been replaced with AST-based detection.
24
+ - **R2.2 — File gate**: `.tsx` and `.ts` files without DB imports or DB-call patterns are never scanned for schema violations.
25
+ - **R2.3 — Template expression handling**: Dynamic prefixes (`` `${prefix}_builds` ``) resolve to wildcards for known-table matching. Fully-dynamic table names produce no false findings.
26
+ - **R2.4 — Unknown-table findings**: Report extracted name, SQL statement kind, call-site line (from AST location), and nearest known-table suggestions (Levenshtein ≤ 2).
27
+
28
+ #### R3: DRY Analyzer
29
+
30
+ - **R3.1 — Self-reference fix**: A code block can no longer match itself. Span-overlap check ensures `fileA !== fileB || (endA < startB || endB < startA)`.
31
+ - **R3.2 — Minimum block size 5 → 15**: `minLineThreshold` increased from 5 to 15. Short repeated blocks no longer produce false findings.
32
+ - **R3.3 — Rule-id split**: `dry/duplicate` (warning) for exact token-identical blocks (SHA-256 hash). `dry/structural-similarity` (suggestion) for identical token-type sequences with differing identifiers/literals.
33
+ - **Fingerprint warning**: The rule-id split changes fingerprints for previously-reported structural matches. `tasks.from_audit` treats them as new findings.
34
+
35
+ #### R4: Data Access Analyzer
36
+
37
+ - **R4.1 — Loop-query (N+1) detection**: Database queries inside `for`/`while`/`do` loops and iterator callbacks (`.forEach`/`.map`/`.filter` with `await`) are now detected via AST ancestor traversal. Each finding cites the innermost loop span + query call line (never line 1).
38
+ - **R4.2 — Nested-loop attribution**: Deeply nested loops note nesting depth in the finding message.
39
+ - **R4.3 — `directAccess` config**: When set to `"allow"`, `direct-sql` and `hardcoded-connection` violations are skipped. Supports Cloudflare Workers/D1 and similar platforms where direct connections are the documented pattern. Default is `"flag"`.
40
+ - **Fixed**: Node type checks corrected from PascalCase (`CallExpression`, `NewExpression`) to tree-sitter snake_case (`call_expression`, `new_expression`). Previously prevented `isFunctionCall` from ever matching.
41
+ - **`sql-injection-risk` demoted from `critical` to `warning`**: SQL injection detection uses AST-level heuristics (string concatenation in query construction, dynamic SQL patterns) without type information. These are high-signal but not proof of exploitable injection — flagged at `warning` rather than `critical` to keep `--fail-on critical` reserved for user invariants. See "Severity Overrides" below for restoring `critical`.
42
+
43
+ #### R5: SOLID Analyzer
44
+
45
+ - **R5.1 — Method-level cyclomatic complexity → `solid/method-complexity`**: Replaced the heuristic `calculateClassComplexity()` (`1 + 2×methods + 5×extends + Σ(lines/10)`) with true cyclomatic complexity per method via `adapter.getComplexity()`. Standalone functions are also checked. Severity: `warning`.
46
+ - **R5.2 — Class-level aggregation → `solid/class-size`**: Separate rule id for class-level metrics (`classMethodsThreshold`, default 15; `classAggregateComplexity`, default 100). Severity: `suggestion`.
47
+ - **Metric-semantics change**: Complexity numbers are fundamentally non-comparable across this release. The old heuristic produced inflated values unrelated to actual branching. All prior threshold configs and reports are non-comparable across this release. This is a larger user-facing change than the rule renames.
48
+ - **Deprecation**: `maxClassComplexity` is deprecated. Use `maxMethodComplexity` and `classAggregateComplexity` instead.
49
+ - **Fingerprint warning**: The rule-id split (`single-responsibility` → `solid/method-complexity` + `solid/class-size`) changes fingerprints. `tasks.from_audit` treats them as new findings.
50
+
51
+ #### R7: Severity Defaults
52
+
53
+ All severity values normalized. No class at `critical` — the `--fail-on critical` hook path is reserved for user invariants.
54
+
55
+ | Rule | Severity |
56
+ |------|----------|
57
+ | documentation/* (all) | suggestion |
58
+ | schema/unknown-table | suggestion |
59
+ | dry/duplicate | warning |
60
+ | dry/structural-similarity | suggestion |
61
+ | data-access/loop-query | warning |
62
+ | data-access/direct-access | suggestion |
63
+ | sql-injection-risk | warning |
64
+ | solid/method-complexity | warning |
65
+ | solid/class-size | suggestion |
66
+
67
+ #### R8: Regression Fixtures
68
+
69
+ 19 synthetic test fixtures in `src/analyzers/__tests__/fixtures/spec-17/` with corresponding test file `spec-17.test.ts`. Each fixture cites its report section and exercises a specific noise-reduction rule.
70
+
71
+ #### Severity Overrides
72
+
73
+ A `severityOverrides` map in analyzer config allows restoring or adjusting any rule's severity without modifying code. This is the user path back for rules whose default severity changed in this release:
74
+
75
+ ```json
76
+ {
77
+ "analyzerConfigs": {
78
+ "data-access": {
79
+ "severityOverrides": {
80
+ "sql-injection-risk": "critical"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ Keys are rule IDs, values are `critical | warning | suggestion`. Overrides apply to all violations after the analyzer runs — individual analyzers don't need to know about them. The mechanism lives in the `UniversalAnalyzer` base class, so all Universal analyzers inherit it.
88
+
89
+ #### Spec 11 Triage Flag
90
+
91
+ `sql-injection-risk` is flagged first-in-line for Spec 11 measurement. The heuristic AST-level detection (string concatenation in query construction) produces findings that are high-signal but unverified without type information. Spec 11 will measure true-positive rate on the ExcAlDraw and Gin corpora to calibrate whether the detection heuristics should be tightened or the severity should be re-escalated.
92
+
93
+ ### Changed — Spec-16 R5.3: Config generator re-verification
94
+
95
+ - **All 12 generators standardized to npx-based stdio MCP transport**: Replaced fictional `/api/*` HTTP endpoints (e.g. `/api/cursor`, `/api/copilot`, `/api/codeium`, `/api/awsq`, `/api/aider`, `/api/jetbrains`) with the single standard pattern: `npx -y code-auditor-mcp --mcp-mode`. This reflects the actual MCP implementation and the post-SKILL.md ecosystem where every tool supports native MCP.
96
+ - **ClaudeConfigGenerator**: Updated from Claude Desktop to Claude Code. Uses `.mcp.json` with npx transport. Instructions include skill install and hook wiring.
97
+ - **CursorConfigGenerator**: Rewrote from fictional `/api/cursor/*` endpoints to `.cursor/mcp.json` with stdio MCP. Notes: Cursor skills are project-only; `afterFileEdit` hook is advisory (fire-and-forget).
98
+ - **CopilotConfigGenerator**: Rewrote from fictional `/api/copilot/*` endpoints to `.vscode/mcp.json` with stdio MCP.
99
+ - **CodeiumConfigGenerator**: Rewrote from fictional `/api/codeium/*` endpoints to `.windsurf/mcp.json` with stdio MCP.
100
+ - **AWSQConfigGenerator**: Rewrote from fictional `/api/awsq` endpoint to `.amazonq/mcp.json` with stdio MCP.
101
+ - **AiderConfigGenerator**: Rewrote from fictional `/api/aider` endpoint to `.aider.mcp.json` with stdio MCP.
102
+ - **JetBrainsConfigGenerator**: Rewrote from fictional `/api/jetbrains` endpoint to `.idea/mcp.json` with stdio MCP.
103
+ - **ContinueConfigGenerator**: Removed fictional `/api/continue` endpoint. Retained MCP stdio transport, simplified to `.continue/mcp.json`.
104
+ - **VSCodeConfigGenerator**: Standardized to npx-based stdio MCP transport, standard `mcpServers` object format.
105
+ - **ClineConfigGenerator**: Standardized to npx-based stdio MCP transport.
106
+ - **CodexConfigGenerator (NEW)**: Added `.codex/mcp.json` generator. Codex has blocking PostToolUse hooks (exit 2 replaces tool result with violation feedback).
107
+ - **GeminiConfigGenerator (NEW)**: Added `.gemini/mcp.json` generator. Gemini CLI has no edit hooks but supports SKILL.md and MCP.
108
+ - **ConfigGeneratorFactory**: Updated with new Codex and Gemini entries. Total 12 generators, all matching the support matrix.
109
+
110
+ ## [3.0.6] — 2026-07-19
111
+
112
+ ### Fixed
113
+
114
+ - **#85 — `audit --fail-on` missing**: The `audit` command (default command) now supports `--fail-on <severity>` for severity-gated exit codes. Exit code 2 when violations at or above the specified severity exist. Mirrors the existing behavior on `code-audit changed`.
115
+ - **#86 — `generate-config` output**: The `generate-config` command now generates `.codeauditor.json` (invariant rules config) instead of MCP tool host configurations. Non-interactive mode writes a scaffold template with example rules for all five rule kinds. Interactive mode (`--interactive`) walks through building rules one at a time via inquirer prompts.
116
+
117
+ ## [3.0.5] — 2026-07-19
118
+
119
+ ### Fixed
120
+
121
+ - **#82 — `dep:` search operator**: Module-level dependencies (package names like `react`) are now stored in the `function_dependencies` table during indexing. The `dep:` operator correctly finds functions that depend on a given package.
122
+ - **#83 — `file:` search operator**: GLOB patterns are now wrapped with `*...*` wildcards so relative paths correctly match against absolute paths stored in the database.
123
+ - **#84 — Nested/inner functions**: Functions declared inside function bodies now coexist correctly in the index. Previously, same-named functions at different lines in the same file would collide due to a unique constraint on `(name, file_path)` only. Schema migration v1→v2 adds `line_number` to the unique constraint so nested functions are stored as distinct entries.
124
+
125
+ ## [3.0.4] — 2026-07-19
126
+
127
+ ### Fixed
128
+
129
+ - **#77 — Populate relational/derived data during indexing**: The index sync path (`FunctionScanner.scanFunctions`) was a stripped-down duplicate of `extractFunctionsFromFile` that computed zero relational data — no `functionCalls`, `usedImports`, `unusedImports`, or `complexity`. This caused `function_calls` and `function_dependencies` tables to stay empty, `complexity` to always be 0, and `has_unused_imports` to always be 0 — breaking 5 of 11 search operators (`calls:`, `dep:`, `complexity:>`, `unused-imports`). Fixed by extracting `extractFunctionsFromSource(content, filePath, options?)` as the single canonical implementation and routing both the audit runner and index sync paths through it. Also added `calculateComplexity()` for all function types (function declarations, arrow functions, class methods) — previously only computed for React components.
130
+
131
+ ## [3.0.3] — 2026-07-19
132
+
133
+ ### Fixed
134
+
135
+ - **#73 — Silence DEBUG logging flood**: Removed unguarded `console.error` debug lines from `UniversalSOLIDAnalyzer`, `UniversalDocumentationAnalyzer`, `UniversalAnalyzer`, and `mcp-tools-shared.ts`. Audit output reduced from ~28,000 lines to ~17 lines. Remaining debug lines are properly gated by `IS_DEV_MODE`.
136
+ - **#74 — Fix report JSON inconsistencies**: `summary.totalFiles` was always 0 (wrong source field) and `summary.topIssues` was always empty (never computed). Fixed in both `mcpAuditJobs.ts` (`summarizeAnalyzerResults`) and `auditRunner.ts` (`generateSummary`). SARIF reconstruction path now reads `topIssues` from stored summary instead of hardcoding `[]`.
137
+ - **#72 — Doc vs reality**: Fixed flag and command mismatches in `SKILL.md` — `--json` flag and `--fail-on` flag syntax corrected to match actual CLI behavior.
138
+
139
+ ### Changed
140
+
141
+ - **#75 — Path scoping**: Added `docs`, `specs`, `backup`, `backups` to `DEFAULT_EXCLUDED_DIRS` in `fileDiscovery.ts`. These directories are now skipped by default during full audits to reduce noise. Explicitly targeted files are still audited regardless.
142
+
143
+ ## [3.0.0] — 2026-07-17
144
+
145
+ Complete re-architecture. The entire Spec 01–09 arc ships as a single breaking release. The individual spec-architected version increments (2.7.0 through 4.0.1) were never published to npm — this is publish point one.
146
+
147
+ ### Spec 01: Dead Architecture Removal & Canonical Language Layer
148
+
149
+ - **Removed** archived code: legacy `src/analyzers/` implementations predating the functional analyzer pattern, dead config generators, and the dual entry-point tangle.
150
+ - **Established** `LanguageAdapter` as the single seam for language support. All analysis paths consume `LanguageAdapter`; no analyzer imports a language-specific parser directly.
151
+ - **Canonical language layer**: `src/languages/` with `LanguageRegistry`, adapter interface (`types.ts`), and one adapter per language.
152
+
153
+ ### Spec 02: MCP Surface Consolidation
154
+
155
+ - **Breaking**: MCP tool names and entry points consolidated. Seven tools replace the previous fragmented surface.
156
+
157
+ | v2 tool | v3 tool / action |
158
+ |---------|-----------------|
159
+ | `start_audit` | `audit.run` |
160
+ | `audit_health` | `audit.health` |
161
+ | `search_code` | `search.query` |
162
+ | `find_definition` | `search.definition` |
163
+ | `sync_index` | `index.sync` |
164
+ | `generate_ai_config` | removed (CLI `generate-config` for host configs) |
165
+ | `get_workflow_guide` | `guide.get` |
166
+ | — (new) | `code_map.get` |
167
+ | — (new) | `tasks` (create, list, get, update, delete, from_audit) |
168
+ | — (new) | `config` (get, set, list, rules_list, rules_check) |
169
+
170
+ - **Single entry point**: `mcp.ts` as the sole MCP server entry; `cli.ts` for the CLI. `tool-registry.ts` dispatches all tool calls.
171
+ - **Fingerprint utility**: stable violation fingerprints for dedup across audit runs.
172
+
173
+ ### Spec 03: SQLite Data Layer
174
+
175
+ - **Replaced LokiJS** with `better-sqlite3`. The code index, audit results, task list, and config all live in a single SQLite database at `<cwd>/.code-index/index.db`.
176
+ - **Replaced FlexSearch** with SQLite FTS5 for full-text search.
177
+ - **`content_hash`** added to `EnhancedFunctionMetadata` for diff detection.
178
+ - **QueryParser** compiles to SQL via `compileToSQL()`.
179
+ - **Migration**: existing LokiJS data is migrated automatically on first run.
180
+ - **Tasks survive index reset**: clearing the analysis index does not delete the task list.
181
+
182
+ ### Spec 04: Diff-Scoped Auditing & Agent Hook Integration
183
+
184
+ - **`code-audit changed`** command audits only files modified since the last index sync.
185
+ - **Scope options**: `changed` (default), `git:<ref>`, `[paths...]`, `--stdin`.
186
+ - **Hook contract**: `--json`, `--quiet`, `--fail-on <severity>` flags. Exit code 2 on critical violations.
187
+ - **Claude Code hook recipe**: `PostToolUse` hook on Edit/Write pipes changed file paths to `code-audit changed --stdin --json --fail-on critical`.
188
+ - **Scoped result isolation**: `getMostRecentAuditResults` filters by scope.
189
+
190
+ ### Spec 05: Custom Invariant Rules Engine
191
+
192
+ - **`.codeauditor.json`** in the project root defines project-specific rules enforced on every audit run.
193
+ - **Four initial rule kinds**: `import-ban`, `call-constraint`, `module-boundary`, `naming`.
194
+ - **JSON Schema** (`invariant-rules.schema.json`) validates rule configs on startup — bad globs, duplicate IDs, missing fields fail the audit rather than being silently skipped.
195
+ - **`config rules_list`** and **`config rules_check`** MCP actions introspect the active ruleset.
196
+ - **Rule engine** (`ruleEngine.ts`) runs rules per-file during audits, including diff-scoped runs.
197
+
198
+ ### Spec 06: SARIF Output
199
+
200
+ - **SARIF formatter** (`sarifReportGenerator.ts`) emits SARIF 2.1.0 for GitHub Code Scanning.
201
+ - **CLI**: `code-audit -f sarif -o results.sarif`.
202
+ - **CI recipe**: GitHub Actions workflow uploads SARIF to CodeQL for PR annotations.
203
+ - **Diff-scoped SARIF**: `code-audit changed --scope git:origin/main -f sarif` with `--sarif-category` for scoped uploads.
204
+ - **Stable fingerprints** per violation for dedup in GitHub's SARIF consumer.
205
+
206
+ ### Spec 07: Claude Code Plugin & Skill Packaging (A2 Rework)
207
+
208
+ - **Skill-first packaging** (A2): The plugin contains manifest, hooks, hook script, and skill. The bundled MCP server was stripped — the skill teaches the CLI; the MCP server remains the standalone path for shell-less hosts.
209
+ - **`plugin/.claude-plugin/plugin.json`**: manifest with name `code-auditor`, version synced to package.
210
+ - **Repo as marketplace**: `.claude-plugin/marketplace.json` at repo root. Install: `claude plugin marketplace add BenAHammond/code-auditor-mcp` → `claude plugin install code-auditor`.
211
+ - **`PostToolUse` hook** on Edit/Write: pipes edited file paths to `code-audit changed --stdin --json --fail-on critical`. Degrades cleanly (exit 0 with notice) when package not installed or no index exists.
212
+ - **SKILL.md** rewritten CLI-first: teaches `code-audit changed` before claiming work complete, semantic search operators, `tasks from-audit` remediation queue, and reading invariants at session start.
213
+ - **CLI parity subcommands** (A2 R2): `code-audit search`, `code-audit map`, `code-audit tasks` — thin argv adapters over the same service layer as MCP handlers.
214
+ - **Rule-kind reference file** in the skill folder documents all five rule kinds including `ast-pattern` (Spec 08).
215
+
216
+ ### Spec 08: tree-sitter Migration & `ast-pattern` Rule Kind
217
+
218
+ #### tree-sitter Migration
219
+
220
+ - **Replaced TypeScript compiler API** with tree-sitter behind the `LanguageAdapter` interface. All 16 direct TS consumers migrated to `adapterBridge.ts`.
221
+ - **`typescript` moved to `devDependencies`** — the production build no longer depends on the TS compiler.
222
+ - **`adapterBridge.ts`**: synchronous facade over tree-sitter parsers — `getASTForFile()`, `walkAST()`, `findNodes()`, `calculateComplexity()`.
223
+ - **Real Go adapter**: `GoAdapter.ts` rewritten with `tree-sitter-go` WASM grammar. Previously returned empty ASTs; now parses actual Go source.
224
+ - **WASM grammars** shipped at `dist/grammars/` (tree-sitter-typescript, tree-sitter-javascript, tree-sitter-go). Zero native compilation required — `web-tree-sitter` runtime is pure JS.
225
+ - **Parser initialization**: `initParsers()` called once at CLI boot / MCP server start. `adapterBridge` throws if used uninitialized — a loud programmer error, never silent.
226
+ - **Complexity definition**: Now documented cyclomatic complexity — decision-point count (if, for, while, do, switch_case, ternary, `&&`, `||`) + 1. This is the canonical definition; previous TS-API-based numbers may differ slightly.
227
+
228
+ #### `ast-pattern` Rule Kind
229
+
230
+ - **New invariant rule kind**: `ast-pattern` — match AST node patterns in source using `@ast-grep/napi`.
231
+ - **Pattern syntax**: ast-grep patterns (e.g., `new Function($$$)` matches any `new Function(...)` call).
232
+ - **Language support**: `typescript` (via `tsx` parser), `javascript`. Go is not supported by `@ast-grep/napi` — rules targeting Go will skip gracefully.
233
+ - **Configuration fields**: `pattern` (required, non-empty), `language` (optional, defaults to `typescript`), `path` (optional file glob filter).
234
+ - **Dogfood rule**: This repo's `.codeauditor.json` includes a `no-new-function` ast-pattern rule banning `new Function()`.
235
+
236
+ ### Spec 09: Positioning Rewrite
237
+
238
+ - **Repositioned** from "multi-language code quality auditor" to "architectural invariants and code quality analysis, enforced inside your AI agent's edit loop."
239
+ - **README rewrite**: 9-section structure, agent-loop-first framing. Invariant rules moved to flagship section. Every example reproducible against the shipped version.
240
+ - **Metadata**: `package.json` description and keywords updated. `server.json` description and version updated. `plugin.json` version synced.
241
+ - **GitHub About**: updated to the R1 positioning line.
242
+
243
+ ### Mid-series note
244
+
245
+ The internal version increments spec-architected for individual specs (2.7.0, 3.0.0–4.0.1) were never published to npm. The last published version before this release was 2.6.2. This 3.0.0 release absorbs the entire nine-spec arc into a single breaking release per Amendment A1.
package/README.md CHANGED
@@ -69,6 +69,30 @@ One skill, one CLI, one MCP server. Every agent gets the same audit engine — t
69
69
 
70
70
  Hook behavior: **Blocking** means violations at or above `--fail-on` severity prevent the edit from landing (the agent sees the violation and fixes inline). **Advisory** means violations are reported through the strongest available feedback channel but the edit has already occurred. Cursor's `afterFileEdit` hook is fire-and-forget with no output consumption. MCP is available everywhere for shell-less use.
71
71
 
72
+ ## Security
73
+
74
+ ### SQL Injection Detection
75
+
76
+ The `sql-injection-risk` rule uses AST-level heuristics — it detects string concatenation and dynamic patterns in query construction (e.g., `"SELECT * FROM " + table`) without type information. These findings are **high-signal, not proof of exploitable injection**.
77
+
78
+ By default, `sql-injection-risk` is `warning` severity. The `--fail-on critical` hook path is reserved for user invariant rules — Code Auditor never ships rules at `critical`, so your `.codeauditor.json` invariants have a clean escalation path.
79
+
80
+ **To block on SQL injection findings** in your hook, restore `critical` via `severityOverrides` in your analyzer config:
81
+
82
+ ```json
83
+ {
84
+ "analyzerConfigs": {
85
+ "data-access": {
86
+ "severityOverrides": {
87
+ "sql-injection-risk": "critical"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ With this config, `code-audit changed --fail-on critical` will exit 2 on SQL injection findings, and your agent's hook will block the edit.
95
+
72
96
  ## License
73
97
 
74
98
  MIT
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 1: anonymous-callback-map
3
+ * Report section: R1.1 — Skip anonymous/inline callables
4
+ *
5
+ * .map() callback arrows should produce ZERO documentation findings.
6
+ */
7
+ declare const users: {
8
+ id: number;
9
+ name: string;
10
+ }[];
11
+ declare const result: {
12
+ slug: string;
13
+ displayName: string;
14
+ score: number;
15
+ }[];
16
+ declare const filtered: {
17
+ id: number;
18
+ name: string;
19
+ }[];
20
+ declare const doubled: number;
21
+ //# sourceMappingURL=anonymous-callback-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anonymous-callback-map.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,QAAA,MAAM,KAAK;;;GAIV,CAAC;AAGF,QAAA,MAAM,MAAM;;;;GAIT,CAAC;AAEJ,QAAA,MAAM,QAAQ;;;GAAgC,CAAC;AAE/C,QAAA,MAAM,OAAO,QAA8C,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Spec-17 R8 Fixture 1: anonymous-callback-map
4
+ * Report section: R1.1 — Skip anonymous/inline callables
5
+ *
6
+ * .map() callback arrows should produce ZERO documentation findings.
7
+ */
8
+ const users = [
9
+ { id: 1, name: "Alice" },
10
+ { id: 2, name: "Bob" },
11
+ { id: 3, name: "Charlie" },
12
+ ];
13
+ // These are anonymous callbacks — not export-level API surface
14
+ const result = users.map((r) => ({
15
+ slug: r.name.toLowerCase(),
16
+ displayName: r.name.toUpperCase(),
17
+ score: r.id * 10,
18
+ }));
19
+ const filtered = users.filter((u) => u.id > 1);
20
+ const doubled = users.reduce((acc, u) => acc + u.id * 2, 0);
21
+ //# sourceMappingURL=anonymous-callback-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anonymous-callback-map.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;IACxB,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;IACtB,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;CAC3B,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;CACjB,CAAC,CAAC,CAAC;AAEJ,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAE/C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 5: barrel-test-migration
3
+ * Report section: R1.5 — File-header checks default OFF
4
+ *
5
+ * With fileHeaders disabled (default), this barrel export file
6
+ * should produce ZERO file-header findings. Also verifies that
7
+ * migration-style test files don't trigger header checks even
8
+ * if fileHeaders were enabled (due to headerSkipGlobs).
9
+ */
10
+ export { UserService } from "./services";
11
+ export { UserController } from "./controllers";
12
+ export type { User, UserRole } from "./types";
13
+ //# sourceMappingURL=barrel-test-migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel-test-migration.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 5: barrel-test-migration
3
+ * Report section: R1.5 — File-header checks default OFF
4
+ *
5
+ * With fileHeaders disabled (default), this barrel export file
6
+ * should produce ZERO file-header findings. Also verifies that
7
+ * migration-style test files don't trigger header checks even
8
+ * if fileHeaders were enabled (due to headerSkipGlobs).
9
+ */
10
+ export { UserService } from "./services";
11
+ export { UserController } from "./controllers";
12
+ //# sourceMappingURL=barrel-test-migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel-test-migration.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 18: direct-access-allow-config
3
+ * Report section: R4.3 — directAccess: "allow" skips direct-access findings
4
+ *
5
+ * When directAccess is set to "allow", direct SQL connections should
6
+ * produce ZERO `direct-access` findings (they're allowed on this platform).
7
+ * This supports Cloudflare Workers/D1 use cases where direct connections
8
+ * are the documented pattern.
9
+ */
10
+ export declare function getUsers(): Promise<unknown[]>;
11
+ //# sourceMappingURL=direct-access-allow-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct-access-allow-config.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAKnD"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 18: direct-access-allow-config
3
+ * Report section: R4.3 — directAccess: "allow" skips direct-access findings
4
+ *
5
+ * When directAccess is set to "allow", direct SQL connections should
6
+ * produce ZERO `direct-access` findings (they're allowed on this platform).
7
+ * This supports Cloudflare Workers/D1 use cases where direct connections
8
+ * are the documented pattern.
9
+ */
10
+ // @ts-ignore — stub
11
+ import { Client } from "pg";
12
+ const client = new Client({
13
+ host: "localhost",
14
+ database: "myapp",
15
+ });
16
+ export async function getUsers() {
17
+ await client.connect();
18
+ const result = await client.query("SELECT * FROM users");
19
+ await client.end();
20
+ return result.rows;
21
+ }
22
+ //# sourceMappingURL=direct-access-allow-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct-access-allow-config.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oBAAoB;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;IACxB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,OAAO;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 3: exported-undocumented
3
+ * Report section: R1.2 — Default scope is public API surface only
4
+ *
5
+ * Exported function without JSDoc should produce EXACTLY ONE finding,
6
+ * and the message should cite "exported".
7
+ */
8
+ export declare function calculateTotal(price: number, quantity: number, tax: number): number;
9
+ //# sourceMappingURL=exported-undocumented.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exported-undocumented.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/exported-undocumented.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAInF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 3: exported-undocumented
3
+ * Report section: R1.2 — Default scope is public API surface only
4
+ *
5
+ * Exported function without JSDoc should produce EXACTLY ONE finding,
6
+ * and the message should cite "exported".
7
+ */
8
+ export function calculateTotal(price, quantity, tax) {
9
+ const subtotal = price * quantity;
10
+ const taxAmount = subtotal * tax;
11
+ return subtotal + taxAmount;
12
+ }
13
+ //# sourceMappingURL=exported-undocumented.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exported-undocumented.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/exported-undocumented.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,QAAgB,EAAE,GAAW;IACzE,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;IAClC,MAAM,SAAS,GAAG,QAAQ,GAAG,GAAG,CAAC;IACjC,OAAO,QAAQ,GAAG,SAAS,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 15: for-loop-query
3
+ * Report section: R4.1 — Loop-query findings with correct locations
4
+ *
5
+ * A database query inside a `for` loop should produce a `loop-query`
6
+ * finding where:
7
+ * - The location cites the query-call line (NOT line 1)
8
+ * - The message cites the enclosing loop span line
9
+ */
10
+ export declare function processUsers(db: {
11
+ query(sql: string, params: unknown[]): unknown[];
12
+ }): void;
13
+ //# sourceMappingURL=for-loop-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"for-loop-query.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/for-loop-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wBAAgB,YAAY,CAAC,EAAE,EAAE;IAC/B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;CAClD,GAAG,IAAI,CAWP"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 15: for-loop-query
3
+ * Report section: R4.1 — Loop-query findings with correct locations
4
+ *
5
+ * A database query inside a `for` loop should produce a `loop-query`
6
+ * finding where:
7
+ * - The location cites the query-call line (NOT line 1)
8
+ * - The message cites the enclosing loop span line
9
+ */
10
+ export function processUsers(db) {
11
+ const users = ["alice", "bob", "charlie"];
12
+ for (const user of users) {
13
+ // This query is inside the for loop — N+1 pattern
14
+ const result = db.query("SELECT * FROM orders WHERE username = ?", [user]);
15
+ console.log(result);
16
+ }
17
+ }
18
+ //# sourceMappingURL=for-loop-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"for-loop-query.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/for-loop-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,UAAU,YAAY,CAAC,EAE5B;IACC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAE1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,kDAAkD;QAClD,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CACrB,yCAAyC,EACzC,CAAC,IAAI,CAAC,CACP,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 6: import-node-builtin
3
+ * Report section: R2.1 — SQL-context-only extraction
4
+ *
5
+ * Importing "node:child_process" should produce ZERO schema findings.
6
+ * This was a top false positive in the diagnostic: the old regex-based
7
+ * analyzer flagged "process" in node:child_process as a table reference.
8
+ */
9
+ export declare function runCommand(cmd: string): void;
10
+ //# sourceMappingURL=import-node-builtin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-node-builtin.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/import-node-builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAK5C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 6: import-node-builtin
3
+ * Report section: R2.1 — SQL-context-only extraction
4
+ *
5
+ * Importing "node:child_process" should produce ZERO schema findings.
6
+ * This was a top false positive in the diagnostic: the old regex-based
7
+ * analyzer flagged "process" in node:child_process as a table reference.
8
+ */
9
+ import { spawn } from "node:child_process";
10
+ export function runCommand(cmd) {
11
+ const child = spawn(cmd, [], { stdio: "inherit" });
12
+ child.on("exit", (code) => {
13
+ console.log(`Process exited with code ${code}`);
14
+ });
15
+ }
16
+ //# sourceMappingURL=import-node-builtin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-node-builtin.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/import-node-builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 2: jsx-event-handler
3
+ * Report section: R1.1 — Skip anonymous/inline callables
4
+ *
5
+ * JSX event-handler arrow functions should produce ZERO documentation findings.
6
+ */
7
+ export declare function Button({ label, onAction }: {
8
+ label: string;
9
+ onAction: () => void;
10
+ }): any;
11
+ export declare function List({ items }: {
12
+ items: string[];
13
+ }): any;
14
+ //# sourceMappingURL=jsx-event-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-event-handler.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;CAAE,OASlF;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,OAQlD"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 2: jsx-event-handler
3
+ * Report section: R1.1 — Skip anonymous/inline callables
4
+ *
5
+ * JSX event-handler arrow functions should produce ZERO documentation findings.
6
+ */
7
+ import React from "react";
8
+ export function Button({ label, onAction }) {
9
+ return (<button onClick={() => onAction()} onFocus={(e) => e.currentTarget.classList.add("focused")}>
10
+ {label}
11
+ </button>);
12
+ }
13
+ export function List({ items }) {
14
+ return (<ul>
15
+ {items.map((item) => (<li key={item}>{item}</li>))}
16
+ </ul>);
17
+ }
18
+ //# sourceMappingURL=jsx-event-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-event-handler.js","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAA2C;IACjF,OAAO,CACL,CAAC,MAAM,CACL,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAC1B,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAEzD;MAAA,CAAC,KAAK,CACR;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EAAE,KAAK,EAAuB;IACjD,OAAO,CACL,CAAC,EAAE,CACD;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAC3B,CAAC,CACJ;IAAA,EAAE,EAAE,CAAC,CACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 16: nested-loops-query
3
+ * Report section: R4.2 — Nested-loop attribution
4
+ *
5
+ * A query inside nested loops should produce a `loop-query` finding where:
6
+ * - The innermost enclosing loop is cited
7
+ * - The nesting depth (>1) is noted in the message
8
+ * - The location is the query-call line, never line 1
9
+ */
10
+ export declare function checkPermissions(db: {
11
+ query(sql: string, params: unknown[]): unknown[];
12
+ }): void;
13
+ //# sourceMappingURL=nested-loops-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nested-loops-query.d.ts","sourceRoot":"","sources":["../../../../../src/analyzers/__tests__/fixtures/spec-17/nested-loops-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IACnC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;CAClD,GAAG,IAAI,CAeP"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Spec-17 R8 Fixture 16: nested-loops-query
3
+ * Report section: R4.2 — Nested-loop attribution
4
+ *
5
+ * A query inside nested loops should produce a `loop-query` finding where:
6
+ * - The innermost enclosing loop is cited
7
+ * - The nesting depth (>1) is noted in the message
8
+ * - The location is the query-call line, never line 1
9
+ */
10
+ export function checkPermissions(db) {
11
+ const users = ["admin", "editor"];
12
+ const resources = ["page:home", "page:settings", "api:users"];
13
+ for (const user of users) {
14
+ for (const resource of resources) {
15
+ // Query inside nested loops — should cite innermost loop (line ~18)
16
+ // and note depth 2 in the message
17
+ const result = db.query("SELECT * FROM permissions WHERE username = ? AND resource = ?", [user, resource]);
18
+ console.log(result);
19
+ }
20
+ }
21
+ }
22
+ //# sourceMappingURL=nested-loops-query.js.map