code-auditor-mcp 3.5.0 → 3.7.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.
Files changed (110) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +62 -0
  3. package/dist/analyzers/applicability.d.ts +6 -5
  4. package/dist/analyzers/applicability.d.ts.map +1 -1
  5. package/dist/analyzers/applicability.js +1 -26
  6. package/dist/analyzers/applicability.js.map +1 -1
  7. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
  8. package/dist/analyzers/cross-language/DependencyGraphBuilder.js +12 -1
  9. package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
  10. package/dist/analyzers/ruleRegistry.d.ts +14 -12
  11. package/dist/analyzers/ruleRegistry.d.ts.map +1 -1
  12. package/dist/analyzers/ruleRegistry.js +138 -98
  13. package/dist/analyzers/ruleRegistry.js.map +1 -1
  14. package/dist/analyzers/ruleTiming.d.ts +2 -2
  15. package/dist/analyzers/ruleTiming.js +2 -2
  16. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +29 -0
  17. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
  18. package/dist/analyzers/universal/UniversalDRYAnalyzer.js +376 -6
  19. package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
  20. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +6 -0
  21. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  22. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +41 -7
  23. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  24. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
  25. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +13 -2
  26. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
  27. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +20 -5
  28. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  29. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +83 -14
  30. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
  31. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
  32. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +5 -2
  33. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
  34. package/dist/analyzers/universal/UniversalSecretsAnalyzer.d.ts +55 -0
  35. package/dist/analyzers/universal/UniversalSecretsAnalyzer.d.ts.map +1 -0
  36. package/dist/analyzers/universal/UniversalSecretsAnalyzer.js +318 -0
  37. package/dist/analyzers/universal/UniversalSecretsAnalyzer.js.map +1 -0
  38. package/dist/analyzers/universal/functionConcerns.d.ts +52 -0
  39. package/dist/analyzers/universal/functionConcerns.d.ts.map +1 -0
  40. package/dist/analyzers/universal/functionConcerns.js +225 -0
  41. package/dist/analyzers/universal/functionConcerns.js.map +1 -0
  42. package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
  43. package/dist/analyzers/universal/schema/codeAnalysis.js +9 -3
  44. package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
  45. package/dist/analyzers/universal/schema/discovery.d.ts +29 -1
  46. package/dist/analyzers/universal/schema/discovery.d.ts.map +1 -1
  47. package/dist/analyzers/universal/schema/discovery.js +76 -21
  48. package/dist/analyzers/universal/schema/discovery.js.map +1 -1
  49. package/dist/auditRunner.d.ts.map +1 -1
  50. package/dist/auditRunner.js +73 -74
  51. package/dist/auditRunner.js.map +1 -1
  52. package/dist/cli.js +109 -105
  53. package/dist/cli.js.map +1 -1
  54. package/dist/codeIndexDB.js +6 -6
  55. package/dist/codeIndexDB.js.map +1 -1
  56. package/dist/config/configLoader.d.ts.map +1 -1
  57. package/dist/config/configLoader.js +15 -0
  58. package/dist/config/configLoader.js.map +1 -1
  59. package/dist/config/defaults.d.ts +11 -1
  60. package/dist/config/defaults.d.ts.map +1 -1
  61. package/dist/config/defaults.js +25 -3
  62. package/dist/config/defaults.js.map +1 -1
  63. package/dist/config/effectiveConfig.d.ts.map +1 -1
  64. package/dist/config/effectiveConfig.js +2 -0
  65. package/dist/config/effectiveConfig.js.map +1 -1
  66. package/dist/dataPaths.js +18 -1
  67. package/dist/dataPaths.js.map +1 -1
  68. package/dist/enforcement/gate.d.ts +14 -19
  69. package/dist/enforcement/gate.d.ts.map +1 -1
  70. package/dist/enforcement/gate.js +27 -45
  71. package/dist/enforcement/gate.js.map +1 -1
  72. package/dist/graph/importGraph.d.ts +11 -0
  73. package/dist/graph/importGraph.d.ts.map +1 -1
  74. package/dist/graph/importGraph.js +11 -3
  75. package/dist/graph/importGraph.js.map +1 -1
  76. package/dist/installer.d.ts.map +1 -1
  77. package/dist/installer.js +2 -5
  78. package/dist/installer.js.map +1 -1
  79. package/dist/mcp.js +1 -1
  80. package/dist/mcp.js.map +1 -1
  81. package/dist/pipeline.d.ts.map +1 -1
  82. package/dist/pipeline.js +21 -3
  83. package/dist/pipeline.js.map +1 -1
  84. package/dist/pipelineAdapters.d.ts +1 -0
  85. package/dist/pipelineAdapters.d.ts.map +1 -1
  86. package/dist/pipelineAdapters.js +227 -4
  87. package/dist/pipelineAdapters.js.map +1 -1
  88. package/dist/styles/styleExtractor.js +2 -2
  89. package/dist/styles/styleExtractor.js.map +1 -1
  90. package/dist/styles/styleIndexer.js +7 -6
  91. package/dist/styles/styleIndexer.js.map +1 -1
  92. package/dist/styles/tailwindProbe.d.ts +8 -0
  93. package/dist/styles/tailwindProbe.d.ts.map +1 -1
  94. package/dist/styles/tailwindProbe.js +11 -1
  95. package/dist/styles/tailwindProbe.js.map +1 -1
  96. package/dist/styles/types.d.ts +3 -2
  97. package/dist/styles/types.d.ts.map +1 -1
  98. package/dist/types/crossLanguage.d.ts +1 -0
  99. package/dist/types/crossLanguage.d.ts.map +1 -1
  100. package/dist/types.d.ts +23 -30
  101. package/dist/types.d.ts.map +1 -1
  102. package/dist/types.js.map +1 -1
  103. package/package.json +13 -4
  104. package/plugin/.claude-plugin/plugin.json +1 -1
  105. package/plugin/README.md +5 -3
  106. package/plugin/scripts/hook-audit.sh +20 -30
  107. package/plugin/scripts/hook-common.sh +63 -0
  108. package/plugin/scripts/hook-self-audit.sh +23 -31
  109. package/plugin/skills/code-auditor/SKILL-RULE-KINDS.md +4 -2
  110. package/plugin/skills/code-auditor/SKILL.md +20 -12
@@ -5,10 +5,15 @@
5
5
  # and runs `code-audit changed --stdin --json` against it.
6
6
  #
7
7
  # Exit codes:
8
- # 0 — all clear or degraded (binary not found, no index, no gating findings)
9
- # 2 — a new gating-rule finding was introduced (Claude Code feeds stdout back)
8
+ # 0 — clean pass
9
+ # 2 — a gating finding was introduced (Claude Code feeds stdout back)
10
+ # 1 — the hook itself broke (binary missing, version mismatch, CLI error) —
11
+ # reported loudly, never a silent no-op.
10
12
  set -euo pipefail
11
13
 
14
+ # Shared resolver + compatibility pinning (see hook-common.sh).
15
+ . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh"
16
+
12
17
  # Read event JSON from stdin
13
18
  event="$(cat)"
14
19
 
@@ -43,46 +48,31 @@ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -n "${file}" ]; then
43
48
  esac
44
49
  fi
45
50
 
46
- # Resolve the code-audit binary: project-local → PATH → npx auto-install
47
- resolve_code_audit() {
48
- # 1. Project-local install (plugin project's own node_modules)
49
- if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -x "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit" ]; then
50
- echo "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit"
51
- return
52
- fi
53
-
54
- # 2. Global install or PATH
55
- if command -v code-audit &>/dev/null; then
56
- echo "code-audit"
57
- return
58
- fi
59
-
60
- # 3. npx auto-install (first use downloads the package; subsequent runs use the npx cache)
61
- echo "npx -y -p code-auditor-mcp@^3.0.0 code-audit"
62
- }
63
51
  CODE_AUDIT_BIN="$(resolve_code_audit)"
64
52
 
65
- # Run diff-scoped audit on the changed file
66
- # stdout/stderr are fed back to the agent by Claude Code
53
+ # Pin the plugin to a compatible CLI version — fail loudly on mismatch.
54
+ assert_compatible "${CODE_AUDIT_BIN}" || exit 1
55
+
56
+ # Run diff-scoped audit on the changed file. stdout/stderr feed back to the agent.
67
57
  set +e
68
58
  if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
69
- echo "${file}" | ${CODE_AUDIT_BIN} changed --stdin --json -p "${CLAUDE_PROJECT_DIR}"
70
- else
71
- echo "${file}" | ${CODE_AUDIT_BIN} changed --stdin --json
72
- fi
59
+ echo "${file}" | ${CODE_AUDIT_BIN} changed --stdin --json -p "${CLAUDE_PROJECT_DIR}"
60
+ else
61
+ echo "${file}" | ${CODE_AUDIT_BIN} changed --stdin --json
62
+ fi
73
63
  exit_code=$?
74
64
  set -e
75
65
 
76
- # Exit code 2 = binary gate triggered (a new gating-rule finding)
77
- # Let it propagate so Claude Code feeds the finding back to the agent
66
+ # Exit 2 = a finding blocked the edit; propagate so Claude Code feeds it back.
78
67
  if [ ${exit_code} -eq 2 ]; then
79
68
  exit 2
80
69
  fi
81
70
 
82
- # Non-zero exit: npx auto-install failed, network issue, unsupported platform, etc.
83
- # Degrade gracefullynever wedge the agent loop.
71
+ # Any other non-zero exit is the hook breaking, not a clean pass. Report loudly
72
+ # and faila silent no-op here is exactly the failure mode this guards.
84
73
  if [ ${exit_code} -ne 0 ]; then
85
- echo "[code-auditor] code-audit could not run (exit ${exit_code}). If npx auto-install failed, check your network or install manually: npm install code-auditor-mcp" >&2
74
+ echo "[code-auditor] HOOK BROKEN: code-audit exited ${exit_code} (neither clean nor a finding). Fix the install do not treat this as a clean pass." >&2
75
+ exit 1
86
76
  fi
87
77
 
88
78
  exit 0
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ # Shared helpers for the code-auditor PostToolUse hooks.
3
+ #
4
+ # Sourced by hook-audit.sh and hook-self-audit.sh. CLAUDE_PLUGIN_ROOT is
5
+ # guaranteed set before either hook runs (the hooks.json guard exits 1 when it
6
+ # is unset), so resolving the plugin's own bundled CLI is always possible here.
7
+ #
8
+ # Two rules enforced here are the fix for "the hook died quietly" (three times:
9
+ # unset CLAUDE_PLUGIN_ROOT, a stale global binary, a removed CLI flag):
10
+ # 1. always prefer the plugin's bundled CLI so a stale global/project binary
11
+ # can never drive the hook, and
12
+ # 2. a non-zero CLI exit that is NOT a finding (2) is a broken hook and must
13
+ # fail loudly, never degrade to a silent no-op.
14
+ #
15
+ # The sourcing hook runs with `set -euo pipefail`.
16
+
17
+ # resolve_code_audit — emit the CLI invocation to use.
18
+ #
19
+ # 1. The plugin's bundled CLI (dist/cli.js ships in the same npm package, so it
20
+ # is always the exact version this plugin was built against).
21
+ # 2. Project-local install (consumer project's own node_modules).
22
+ # 3. Global install / PATH.
23
+ # 4. npx auto-install (only if nothing else resolves).
24
+ resolve_code_audit() {
25
+ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js" ]; then
26
+ echo "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js"
27
+ return
28
+ fi
29
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -x "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit" ]; then
30
+ echo "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit"
31
+ return
32
+ fi
33
+ if command -v code-audit &>/dev/null; then
34
+ echo "code-audit"
35
+ return
36
+ fi
37
+ echo "npx -y -p code-auditor-mcp@^3.0.0 code-audit"
38
+ }
39
+
40
+ # plugin_version — the version this plugin declares in its manifest, or ''.
41
+ plugin_version() {
42
+ node -e "try{process.stdout.write(JSON.parse(require('fs').readFileSync(process.env.CLAUDE_PLUGIN_ROOT+'/.claude-plugin/plugin.json','utf8')).version||'')}catch(e){process.stdout.write('')}" 2>/dev/null
43
+ }
44
+
45
+ # assert_compatible <bin> — pin the plugin to a compatible CLI.
46
+ #
47
+ # The bundled CLI always matches (same package), so it needs no check. Any
48
+ # fallback path can drift — a stale global, a project-local pin, or a wider npx
49
+ # range — and a 3.4.0 plugin silently driving a 3.5.0 CLI is exactly the
50
+ # failure this guards. Print a loud error and return 1 on a detected mismatch.
51
+ assert_compatible() {
52
+ local bin="$1" pv cv
53
+ case "${bin}" in
54
+ "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js") return 0 ;; # pinned by construction
55
+ esac
56
+ pv="$(plugin_version)"
57
+ cv="$($bin --version 2>/dev/null || true)"
58
+ if [ -n "${pv}" ] && [ -n "${cv}" ] && [ "${pv}" != "${cv}" ]; then
59
+ echo "[code-auditor] version mismatch: plugin ${pv} vs CLI ${cv} — pin the CLI to the plugin version" >&2
60
+ return 1
61
+ fi
62
+ return 0
63
+ }
@@ -4,15 +4,24 @@
4
4
  #
5
5
  # Reads the PostToolUse event JSON from stdin, extracts the edited file path,
6
6
  # and — only when that file is production source in the self-audit scope — runs
7
- # `code-audit self-audit --stdin --json` against it. Exit code 2 blocks the edit
8
- # and feeds the finding JSON back to the agent.
7
+ # `code-audit self-audit` against it. Exit code 2 blocks the edit and feeds the
8
+ # finding JSON back to the agent.
9
9
  #
10
10
  # This hook is a no-op for every edit outside the self-audit scope (consumer
11
11
  # projects, tests, fixtures, and the declarative ruleRegistry table), so it adds
12
12
  # no latency to ordinary edits. It runs *in addition to* hook-audit.sh, whose
13
13
  # diff-gate enforces invariant rules on every edit.
14
+ #
15
+ # Exit codes:
16
+ # 0 — clean pass or out of scope
17
+ # 2 — a blocking self-audit finding (Claude Code feeds stdout back)
18
+ # 1 — the hook itself broke (binary missing, version mismatch, CLI error) —
19
+ # reported loudly, never a silent no-op.
14
20
  set -euo pipefail
15
21
 
22
+ # Shared resolver + compatibility pinning (see hook-common.sh).
23
+ . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh"
24
+
16
25
  # Read event JSON from stdin
17
26
  event="$(cat)"
18
27
 
@@ -60,33 +69,12 @@ case "${file_abs}" in
60
69
  *"__tests__"*|*".test."*|*".spec."*|*"fixtures"*|*"ruleRegistry.ts"*) exit 0 ;;
61
70
  esac
62
71
 
63
- # Resolve the code-audit binary. The `self-audit` command is new in 3.5.0, so a
64
- # stale PATH/global binary would silently lack it — prefer the plugin's own
65
- # bundled CLI first (guaranteed to be the version that ships with this hook),
66
- # then fall back to project-local → PATH → npx auto-install.
67
- resolve_code_audit() {
68
- # 1. The plugin's own bundled CLI (ships alongside this script in the package;
69
- # dist/cli.js is the `code-audit` bin target, so npm marks it executable).
70
- if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js" ]; then
71
- echo "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js"
72
- return
73
- fi
74
- # 2. Project-local install (consumer project's own node_modules).
75
- if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -x "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit" ]; then
76
- echo "${CLAUDE_PROJECT_DIR}/node_modules/.bin/code-audit"
77
- return
78
- fi
79
- # 3. Global install or PATH.
80
- if command -v code-audit &>/dev/null; then
81
- echo "code-audit"
82
- return
83
- fi
84
- # 4. npx auto-install (first use downloads the package; subsequent runs use the npx cache).
85
- echo "npx -y -p code-auditor-mcp@^3.0.0 code-audit"
86
- }
87
72
  CODE_AUDIT_BIN="$(resolve_code_audit)"
88
73
 
89
- # Run the self-audit on the edited file. stdout/stderr are fed back to the agent.
74
+ # Pin the plugin to a compatible CLI version fail loudly on mismatch.
75
+ assert_compatible "${CODE_AUDIT_BIN}" || exit 1
76
+
77
+ # Run the self-audit on the edited file. stdout/stderr feed back to the agent.
90
78
  set +e
91
79
  if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
92
80
  echo "${file_abs}" | ${CODE_AUDIT_BIN} self-audit --stdin --json -p "${CLAUDE_PROJECT_DIR}"
@@ -96,12 +84,16 @@ fi
96
84
  exit_code=$?
97
85
  set -e
98
86
 
99
- # Exit code 2 = a blocking self-audit finding; let it propagate so Claude Code
100
- # feeds the finding back to the agent.
87
+ # Exit 2 = a blocking self-audit finding; propagate so Claude Code feeds it back.
101
88
  if [ ${exit_code} -eq 2 ]; then
102
89
  exit 2
103
90
  fi
104
91
 
105
- # Non-zero exit (npx auto-install failure, network issue, etc.) degrades
106
- # gracefullynever wedge the agent loop.
92
+ # Any other non-zero exit is the hook breaking, not a clean pass. Report loudly
93
+ # and fail a silent no-op here is exactly the failure mode this guards.
94
+ if [ ${exit_code} -ne 0 ]; then
95
+ echo "[code-auditor] HOOK BROKEN: self-audit exited ${exit_code} (neither clean nor a finding). Fix the install — do not treat this as a clean pass." >&2
96
+ exit 1
97
+ fi
98
+
107
99
  exit 0
@@ -178,8 +178,10 @@ Require designated CSS properties to reference a design token instead of a raw v
178
178
 
179
179
  Severity ranks how urgent a finding is to fix. It never decides whether a
180
180
  finding is real, and it never licenses leaving one unresolved. Whether an edit
181
- is *blocked* is a separate axis: the edit hook gates on invariant rules that
182
- declare `gating: true` (a binary, per-rule flag), not on severity.
181
+ is *blocked* is decided by severity: the edit hook blocks on any finding at a
182
+ blocking severity (`critical` and `warning` by default, configurable via
183
+ `gateSeverities` in `.codeauditor.json`), from any rule — there is no per-rule
184
+ opt-in.
183
185
 
184
186
  | Severity | What it means |
185
187
  |----------|---------------|
@@ -5,11 +5,19 @@ description: Audit code quality, search the codebase semantically, enforce invar
5
5
 
6
6
  # Code Auditor Skill
7
7
 
8
- > **Version 3.4.8** • Run `code-audit --version` to check your installed version.
8
+ > **Version 3.7.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.
12
12
 
13
+ ## The diagnostic frame
14
+
15
+ `code-audit` is a diagnostic instrument, not a judge. Three terms carry that:
16
+
17
+ - **Reading** — one rule observation (a "finding" in the JSON). The audit *takes* readings; it does not issue verdicts.
18
+ - **Coverage panel** — the report leads with what was measured (which rules fired, which were clean, which were not applicable), so a zero-reading run is not mistaken for a clean tree.
19
+ - **Triage** — severity is the order to act (`critical` → `warning` → `suggestion`), not a truth score. A suggestion reading is as real as a critical one; it is just lower in the queue.
20
+
13
21
  ## When to use which command
14
22
 
15
23
  ### `code-audit search` — find code by meaning, not just text
@@ -43,20 +51,20 @@ code-audit changed --json # Diff-scoped audit (hook c
43
51
 
44
52
  Use `code-audit changed` after edits to confirm you haven't introduced violations. If the hook is active it already runs `code-audit changed` automatically on Write/Edit — pay attention to its output.
45
53
 
46
- **Every finding is a defect to resolve, not a suggestion to weigh.** After a full audit, work the violations in severity order — criticals first, then warnings, then suggestions — and fix them all. Severity ranks urgency, never whether a finding is real; there is no "noise" tier. Documentation findings (missing JSDoc) are maintainability defects, not stylistic niceties. If you choose not to fix one, record why before moving on — never silently dismiss it.
54
+ **Every reading is a measurement, not a verdict.** The audit is a diagnostic instrument: it reports what it measured (the coverage panel) and takes one reading per rule violation. Work readings in triage order — critical first, then warning, then suggestion — and resolve them all. Severity is triage, the order to act, never a judgment on whether a reading is real; there is no "noise" tier. Documentation readings (missing JSDoc) are maintainability gaps, not stylistic niceties. If you choose not to resolve one, record why before moving on — never silently dismiss it.
47
55
 
48
- Expected output: JSON violation list (with `--json`) or colored terminal summary. The full `audit` command exits non-zero when violations at or above `--fail-on` severity exist; the diff-scoped `changed` hook gates on per-rule `gating: true` flags, not severity.
56
+ Expected output: JSON violation list (with `--json`) or colored terminal summary. The full `audit` command exits non-zero when violations at or above `--fail-on` severity exist; the `changed` hook blocks on any reading at a blocking severity — `critical` and `warning` by default, configurable via `gateSeverities` in `.codeauditor.json` — from any rule, and enforcement is not diff-scoped (a pre-existing reading in the audited file blocks exactly like a new one).
49
57
 
50
58
  ### `code-audit next-file` — fix violations one file at a time
51
59
 
52
60
  ```bash
53
- code-audit next-file --path . # Highest-priority file + all its findings
61
+ code-audit next-file --path . # Highest-priority file + all its readings
54
62
  code-audit next-file --path . --json # Machine-readable
55
63
  ```
56
64
 
57
- This is the refactoring loop. `next-file` audits the project and returns the single highest-priority file — ranked by highest-severity finding, then total finding count — with every finding on it, ordered critical → warning → suggestion. Fix that file, then run it again: a still-broken file comes back, otherwise the next-worst file surfaces. `{done:true}` means the tree is clean.
65
+ This is the refactoring loop. `next-file` audits the project and returns the single highest-priority file — ranked by highest-severity reading, then total reading count — with every reading on it, ordered critical → warning → suggestion. Fix that file, then run it again: a still-broken file comes back, otherwise the next-worst file surfaces. `{done:true}` means the tree is clean.
58
66
 
59
- There is **no skip or decline affordance**. A finding leaves the queue only by being fixed, or by editing the rule that produces it in `.codeauditor.json` (your rules editor). If a rule keeps firing on something you judge correct, change the rule — never work around it.
67
+ There is **no skip or decline affordance**. A reading leaves the queue only by being fixed, or by editing the rule that produces it in `.codeauditor.json` (your rules editor). If a rule keeps firing on something you judge correct, change the rule — never work around it.
60
68
 
61
69
  ### `code-audit config` — know the project's laws
62
70
 
@@ -73,7 +81,7 @@ These are the codebase's declared constraints — "no importing X from Y," "modu
73
81
 
74
82
  ### Path Profiles — "my scripts directory is noisy"
75
83
 
76
- When an audit produces too many findings in scripts, tests, or fixtures, use **path profiles** in `.codeauditor.json` to exclude a directory from the blocking gate:
84
+ When an audit produces too many readings in scripts, tests, or fixtures, use **path profiles** in `.codeauditor.json` to exclude a directory from the blocking gate:
77
85
 
78
86
  ```json
79
87
  {
@@ -84,11 +92,11 @@ When an audit produces too many findings in scripts, tests, or fixtures, use **p
84
92
  }
85
93
  ```
86
94
 
87
- Path profiles are an ordered array — files matching multiple profiles merge overrides (later wins). The `excludeFromGate: true` key excludes all findings in matching files from the blocking gate. Findings still report at their real severity — a path profile excludes a file from the gate, it never softens a finding within it.
95
+ Path profiles are an ordered array — files matching multiple profiles merge overrides (later wins). The `excludeFromGate: true` key excludes all readings in matching files from the blocking gate. Readings still report at their real severity — a path profile excludes a file from the gate, it never softens a reading within it.
88
96
 
89
97
  A **built-in** `scripts-and-tests` profile ships with every install — it excludes `scripts/**`, `tests/**`, `__tests__/**`, `fixtures/**`, and `*.test.*`/`*.spec.*` files from the gate. Disable it with `"builtin": false` in `.codeauditor.json`.
90
98
 
91
- Invariant violations are **immune** to path profile gate exclusion — invariants enforce declared laws and always block.
99
+ Invariant violations are **immune** to path profile gate exclusion — invariants enforce declared laws and block on the same severity gate as every other rule (`critical` and `warning` by default).
92
100
 
93
101
  ### `code-audit index` — refresh the index after structural changes
94
102
 
@@ -138,7 +146,7 @@ code-audit conventions propose --json # JSON proposal array
138
146
 
139
147
  **Usage:** Run a full audit or `code-audit index sync` to mine conventions from the codebase index. Then `code-audit conventions list` to see what was found, and `code-audit conventions propose` to get the rules. Paste the proposals into the `rules` array in `.codeauditor.json`.
140
148
 
141
- Convention violations ship at `suggestion` severity by default. Severity ranks how a finding blocks the edit gate, not whether it matters resolve suggestions the same way you resolve warnings, and promote them with `severityOverrides` if your team wants them to block edits too.
149
+ Convention readings ship at `suggestion` severity by default. Severity is triage — how a reading blocks the edit gate, not whether it matters. Resolve suggestions the same way you resolve warnings, and promote them with `severityOverrides` if your team wants them to block edits too.
142
150
 
143
151
  ### `code-audit hotspots` — identify churn-prone code
144
152
 
@@ -171,7 +179,7 @@ Use `--format dot` to generate a directed call-graph diagram (Graphviz DOT forma
171
179
 
172
180
  Terminal output shows rank, function name, file path, PageRank percentile, betweenness percentile, complexity percentile, untested status, and composite risk score. JSON output fields: `functionName`, `filePath`, `pageRankPercentile`, `betweennessPercentile`, `complexityPercentile`, `untested`, `riskScore`.
173
181
 
174
- > **Release checklist**: When bumping the version on a release, update the version stamp on line 8 of all three canonical SKILL.md copies. `npm run verify:close` gates on test + integration + dist verification — the tag cannot move without all three green.
182
+ > **Release checklist**: The version banner above is stamped by `npm run build:skills` from `package.json` (the single source of truth) do not hand-edit it. Bump the version in `package.json`, run the build, and the skill copies it. `npm run verify:close` gates on test + integration + dist verification — the tag cannot move without all three green.
175
183
 
176
184
  ## Interpreting hook feedback
177
185
 
@@ -180,7 +188,7 @@ When an edit hook blocks your edit with a violation message:
180
188
  1. **Read the violation** — it includes the invariant rule's `message` field explaining *why* the edit was blocked
181
189
  2. **Fix the violation** — change your approach to comply with the invariant
182
190
  3. **Do NOT retry the same edit** — the hook will block it again
183
- 4. The hook runs `code-audit changed`, and its gate is binary and per-rule: an invariant rule blocks the edit only if it declares `gating: true` (regardless of severity). Warnings and suggestions are still violations and must be fixed — they pass the gate, they are not resolved.
191
+ 4. The hook runs `code-audit changed`, and its gate is severity-scoped: any reading at a blocking severity (`critical` and `warning` by default, configurable via `gateSeverities` in `.codeauditor.json`) blocks the edit, from any rule. Suggestions are still readings and must be resolved — they report but do not block by default.
184
192
 
185
193
  The hook auto-installs the package via npx on first use — no manual npm step needed. If the hook reports `[code-auditor] code-audit could not run`, the npx auto-install failed (network, unsupported platform). The agent should try again; if it persists, `npm install code-auditor-mcp` is the manual fix.
186
194