code-auditor-mcp 5.0.1 → 5.0.2

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 (58) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +43 -0
  3. package/dist/analyzers/handleIdentification.d.ts.map +1 -1
  4. package/dist/analyzers/handleIdentification.js +4 -1
  5. package/dist/analyzers/handleIdentification.js.map +1 -1
  6. package/dist/analyzers/receiverRoot.d.ts +20 -0
  7. package/dist/analyzers/receiverRoot.d.ts.map +1 -1
  8. package/dist/analyzers/receiverRoot.js +42 -0
  9. package/dist/analyzers/receiverRoot.js.map +1 -1
  10. package/dist/analyzers/tsEcosystem.d.ts.map +1 -1
  11. package/dist/analyzers/tsEcosystem.js +10 -0
  12. package/dist/analyzers/tsEcosystem.js.map +1 -1
  13. package/dist/auditRunner.d.ts +2 -0
  14. package/dist/auditRunner.d.ts.map +1 -1
  15. package/dist/auditRunner.js +23 -18
  16. package/dist/auditRunner.js.map +1 -1
  17. package/dist/cli.js +17 -3
  18. package/dist/cli.js.map +1 -1
  19. package/dist/constants.d.ts +1 -1
  20. package/dist/daemon/main.d.ts.map +1 -1
  21. package/dist/daemon/main.js +20 -4
  22. package/dist/daemon/main.js.map +1 -1
  23. package/dist/graph/resolutionEnvironment.d.ts +61 -0
  24. package/dist/graph/resolutionEnvironment.d.ts.map +1 -0
  25. package/dist/graph/resolutionEnvironment.js +57 -0
  26. package/dist/graph/resolutionEnvironment.js.map +1 -0
  27. package/dist/phase/phaseModel.d.ts.map +1 -1
  28. package/dist/phase/phaseModel.js +61 -38
  29. package/dist/phase/phaseModel.js.map +1 -1
  30. package/dist/phase/producers.d.ts.map +1 -1
  31. package/dist/phase/producers.js +3 -0
  32. package/dist/phase/producers.js.map +1 -1
  33. package/dist/phase/receiverConsumers.d.ts +8 -1
  34. package/dist/phase/receiverConsumers.d.ts.map +1 -1
  35. package/dist/phase/receiverConsumers.js +59 -21
  36. package/dist/phase/receiverConsumers.js.map +1 -1
  37. package/dist/phase/receiverProvenance.d.ts +23 -0
  38. package/dist/phase/receiverProvenance.d.ts.map +1 -1
  39. package/dist/phase/receiverProvenance.js +40 -0
  40. package/dist/phase/receiverProvenance.js.map +1 -1
  41. package/dist/phase/types.d.ts +8 -0
  42. package/dist/phase/types.d.ts.map +1 -1
  43. package/dist/types.d.ts +13 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/types.js.map +1 -1
  46. package/dist/version.generated.d.ts +1 -1
  47. package/dist/version.generated.js +1 -1
  48. package/package.json +8 -5
  49. package/plugin/.claude-plugin/manifest.json +9 -9
  50. package/plugin/.claude-plugin/plugin.json +1 -1
  51. package/plugin/hooks/hooks.json +4 -4
  52. package/plugin/scripts/hook-audit.sh +5 -2
  53. package/plugin/scripts/hook-common.sh +33 -9
  54. package/plugin/scripts/hook-drift-check.sh +9 -5
  55. package/plugin/scripts/hook-self-audit.sh +5 -2
  56. package/plugin/scripts/hook-warm.sh +5 -6
  57. package/plugin/skills/code-auditor/SKILL.md +1 -1
  58. package/server.json +10 -4
@@ -1,16 +1,16 @@
1
1
  {
2
- "version": "5.0.1",
2
+ "version": "5.0.2",
3
3
  "files": {
4
- ".claude-plugin/plugin.json": "3703d82b6985618b4d93577d72542790d36b38bf9ffd84a8a84c5f200ab5add9",
4
+ ".claude-plugin/plugin.json": "1b950b987f07b25990f29959dc696fd1323dc4dfdda367e2c21fb32638e083be",
5
5
  "README.md": "6e51516ead6c7d0b4e77629e071e139b899d30a47838e8721c0d534eb733ad45",
6
- "hooks/hooks.json": "4480d9d4fe80dbeb8fc8dacb0a6c67a46f45bf4610b42718876ed4a01935e7b1",
7
- "scripts/hook-audit.sh": "5286ee058a73ce9cf3a2fdbb325b8835ae70d85436365d691e95ad6c52bcb84c",
8
- "scripts/hook-common.sh": "e6a7b8da6a5e5d528c297c9ab381c77a1d360a6813775ef85342ff200d07a020",
9
- "scripts/hook-drift-check.sh": "6fcb897fc5fe6814e9a4cae3138532e6783bb44044c549f89fbfe8eb44580e44",
10
- "scripts/hook-self-audit.sh": "4b218f754ca466052da16b0578e2889bdff1abf16d7cbc27a259f71e332af392",
11
- "scripts/hook-warm.sh": "9923fe1434e5579abebae868772aba1e53d25d7392b4181ccd4a41dc3692dd55",
6
+ "hooks/hooks.json": "28c4d7e87f1bb0daae8d9c714a196c39809039509568cf89a67c0377090f7211",
7
+ "scripts/hook-audit.sh": "25353d88a020d71586bb52ec6800438ab1f500e987c639837be52529fe2dc5fe",
8
+ "scripts/hook-common.sh": "85fd91c7a3817c01557383aadeff578696a9400698806d2d310ffd1caa954e06",
9
+ "scripts/hook-drift-check.sh": "fdf1f8098d9dda8911daedfd4b038c310c8383da57938a6737131cd33cb9492e",
10
+ "scripts/hook-self-audit.sh": "1a19f4ddec4cf66d9feb97999e70eb664817b0d6dd811f498d3cdef2f26d63b2",
11
+ "scripts/hook-warm.sh": "3d0fa8d811a26eda29c1a4dcbd88e6861eef93425355c87d6fe72356b3e7b5b3",
12
12
  "skills/code-auditor/SKILL-RULE-KINDS.md": "be1bbe1b56b19dc112c2657c1f5984f6f704b2ac9c1c0f78a561a58b110d508a",
13
13
  "skills/code-auditor/SKILL-SEARCH.md": "95d2df4474995bc5b18e14cc55ac55fb828024541463f109239567e2aa5ab7b0",
14
- "skills/code-auditor/SKILL.md": "f120c4b45fe38deeeb2f76ea74df763e87269a15defa6c0508413a41972447ec"
14
+ "skills/code-auditor/SKILL.md": "a66b4849ffa98adac0817e6ef0712e6b5e1fa292ceaa094717795aeb7299b9a6"
15
15
  }
16
16
  }
@@ -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.1",
4
+ "version": "5.0.2",
5
5
  "author": {
6
6
  "name": "Ben Hammond",
7
7
  "email": "ben@benhammond.tech"
@@ -6,11 +6,11 @@
6
6
  "hooks": [
7
7
  {
8
8
  "type": "command",
9
- "command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-warm.sh"
9
+ "command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-warm.sh"
10
10
  },
11
11
  {
12
12
  "type": "command",
13
- "command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-drift-check.sh"
13
+ "command": "\"${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": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-audit.sh"
24
+ "command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-audit.sh"
25
25
  },
26
26
  {
27
27
  "type": "command",
28
- "command": "if [ -z \"${CLAUDE_PLUGIN_ROOT}\" ]; then exit 0; fi; \"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-self-audit.sh"
28
+ "command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/hook-self-audit.sh"
29
29
  }
30
30
  ]
31
31
  }
@@ -16,8 +16,11 @@
16
16
  # failure surfaces on the next explicit audit, never on the edit.
17
17
  set -euo pipefail
18
18
 
19
- # Shared resolver + compatibility pinning (see hook-common.sh).
20
- . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh"
19
+ # Shared resolver + compatibility pinning (see hook-common.sh). Source it from
20
+ # this script's own directory — the plugin's scripts/ — never from a host
21
+ # environment variable.
22
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
23
+ . "${SCRIPT_DIR}/hook-common.sh"
21
24
 
22
25
  # Read event JSON from stdin
23
26
  event="$(cat)"
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
  # Shared helpers for the code-auditor PostToolUse hooks.
3
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).
4
+ # Sourced by hook-audit.sh, hook-self-audit.sh, hook-warm.sh, and
5
+ # hook-drift-check.sh. The plugin root is derived from where THIS file lives —
6
+ # `<plugin>/scripts/hook-common.sh`, so the root is its grand-parent — never
7
+ # from a host environment variable. `CLAUDE_PLUGIN_ROOT` is honored only as a
8
+ # validated override (see plugin_root below), so an unset or wrong value can
9
+ # never decide whether the tool runs.
7
10
  #
8
11
  # Two rules enforced here are the fix for "the hook died quietly" (three times:
9
12
  # unset CLAUDE_PLUGIN_ROOT, a stale global binary, a removed CLI flag):
@@ -30,6 +33,26 @@
30
33
  #
31
34
  # The sourcing hook runs with `set -euo pipefail`.
32
35
 
36
+ # plugin_root — the plugin's install root.
37
+ #
38
+ # This file ships at `<plugin>/scripts/hook-common.sh`, so the plugin root is the
39
+ # grand-parent of its own location. That fixed, known-at-build-time offset is the
40
+ # single source of truth: every path a hook needs (the manifest, the bundled CLI
41
+ # sibling) is derived from here, not read from a host variable that may be unset.
42
+ # `CLAUDE_PLUGIN_ROOT` is honored only when it actually points at a plugin — it
43
+ # must contain this same `scripts/hook-common.sh` — so a stale or wrong value
44
+ # never shadows the real location, and an absent one is a non-event.
45
+ plugin_root() {
46
+ local here root
47
+ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
48
+ root="$(dirname "${here}")"
49
+ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh" ]; then
50
+ printf '%s' "${CLAUDE_PLUGIN_ROOT}"
51
+ return
52
+ fi
53
+ printf '%s' "${root}"
54
+ }
55
+
33
56
  # hook_log_dir / hook_log_file / hook_log — the hook's diagnostic log.
34
57
  #
35
58
  # The PostToolUse hook must never write stderr: the host may block on stderr
@@ -55,7 +78,7 @@ hook_log() {
55
78
  # manifest version. A stale candidate is warned about and skipped, so a mismatched
56
79
  # binary no longer turns the hook into a hard failure.
57
80
  #
58
- # 1. The plugin's bundled CLI (`${CLAUDE_PLUGIN_ROOT}/../dist/cli.js` ships in the
81
+ # 1. The plugin's bundled CLI (`$(plugin_root)/../dist/cli.js` ships in the
59
82
  # same npm package, so it usually matches) — but a marketplace checkout has no
60
83
  # npm-paired dist/, and a locally built one can be stale, so it is
61
84
  # version-checked like everything else.
@@ -66,9 +89,10 @@ hook_log() {
66
89
  # 3. Project-local install (consumer project's own node_modules) — if compatible.
67
90
  # 4. Global install / PATH — if compatible.
68
91
  resolve_code_audit() {
69
- local candidate
70
- if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/../dist/cli.js" ]; then
71
- candidate="${CLAUDE_PLUGIN_ROOT}/../dist/cli.js"
92
+ local candidate root
93
+ root="$(plugin_root)"
94
+ if [ -f "${root}/../dist/cli.js" ]; then
95
+ candidate="${root}/../dist/cli.js"
72
96
  if cli_is_compatible "${candidate}"; then
73
97
  echo "${candidate}"
74
98
  return
@@ -165,7 +189,7 @@ plugin_version() {
165
189
  return
166
190
  fi
167
191
  __CODE_AUDITOR_PLUGIN_VERSION="$(
168
- node -e "const fs=require('fs');const p=process.env.CLAUDE_PLUGIN_ROOT;for(const f of [p+'/.claude-plugin/plugin.json', p+'/plugin.json']){try{const v=JSON.parse(fs.readFileSync(f,'utf8')).version;if(v){process.stdout.write(v);break}}catch(e){}}" 2>/dev/null
192
+ node -e 'const fs=require("fs");const p=process.argv[1];for(const f of [p+"/.claude-plugin/plugin.json", p+"/plugin.json"]){try{const v=JSON.parse(fs.readFileSync(f,"utf8")).version;if(v){process.stdout.write(v);break}}catch(e){}}' "$(plugin_root)" 2>/dev/null
169
193
  )"
170
194
  __CODE_AUDITOR_PLUGIN_VERSION_RESOLVED=1
171
195
  printf '%s' "${__CODE_AUDITOR_PLUGIN_VERSION}"
@@ -220,7 +244,7 @@ assert_compatible() {
220
244
  # bundled sibling, a project-local install, a global on PATH) are NOT
221
245
  # path-guaranteed — the resolver's `cli_is_compatible` already version-checked
222
246
  # them, and the full check below remains the loud backstop for any of them.
223
- if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ "${bin}" = "$(pin_dir)/node_modules/.bin/code-audit" ]; then
247
+ if [ "${bin}" = "$(pin_dir)/node_modules/.bin/code-audit" ]; then
224
248
  return 0
225
249
  fi
226
250
  pv="$(plugin_version)"
@@ -18,20 +18,24 @@
18
18
  # single source of truth; the fix is to reinstall (or restore the file).
19
19
  set -uo pipefail
20
20
 
21
- # The hooks.json command already guards an unset CLAUDE_PLUGIN_ROOT, but keep
22
- # this a no-op if it is somehow absent here.
23
- [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] || exit 0
21
+ # Source the shared resolver from this script's own directory — the plugin's
22
+ # scripts/ — never from a host environment variable. plugin_root() self-locates
23
+ # the plugin root, so an unset or wrong CLAUDE_PLUGIN_ROOT is a non-event.
24
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
25
+ . "${SCRIPT_DIR}/hook-common.sh"
26
+
27
+ ROOT="$(plugin_root)"
24
28
 
25
29
  # The manifest ships at .claude-plugin/manifest.json; a few installs flatten the
26
30
  # plugin.json to the plugin root, so check both locations (mirrors
27
31
  # hook-common.sh's plugin_version).
28
32
  manifest=""
29
- for f in "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/manifest.json" "${CLAUDE_PLUGIN_ROOT}/manifest.json"; do
33
+ for f in "${ROOT}/.claude-plugin/manifest.json" "${ROOT}/manifest.json"; do
30
34
  if [ -f "$f" ]; then manifest="$f"; break; fi
31
35
  done
32
36
  [ -n "${manifest}" ] || exit 0
33
37
 
34
- MANIFEST_PATH="${manifest}" PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}" node <<'NODE'
38
+ MANIFEST_PATH="${manifest}" PLUGIN_ROOT="${ROOT}" node <<'NODE'
35
39
  const fs = require('fs');
36
40
  const crypto = require('crypto');
37
41
  const path = require('path');
@@ -20,8 +20,11 @@
20
20
  # the log file, not stderr, and still exits 0 (Spec 68 §hook-contract).
21
21
  set -euo pipefail
22
22
 
23
- # Shared resolver + compatibility pinning (see hook-common.sh).
24
- . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh"
23
+ # Shared resolver + compatibility pinning (see hook-common.sh). Source it from
24
+ # this script's own directory — the plugin's scripts/ — never from a host
25
+ # environment variable.
26
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
27
+ . "${SCRIPT_DIR}/hook-common.sh"
25
28
 
26
29
  # Read event JSON from stdin
27
30
  event="$(cat)"
@@ -17,12 +17,11 @@
17
17
  # at all — a warm session must not re-check on every launch.
18
18
  set -uo pipefail
19
19
 
20
- # Belt-and-suspenders: the hooks.json command already guards an unset
21
- # CLAUDE_PLUGIN_ROOT, but keep the warm a no-op if it is somehow absent here.
22
- [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] || exit 0
23
-
24
- # Shared version lookup (plugin_version / semver_of / pin_dir).
25
- . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-common.sh"
20
+ # Source the shared resolver from this script's own directory — the plugin's
21
+ # scripts/ — never from a host environment variable. plugin_root() self-locates
22
+ # the plugin root, so an unset or wrong CLAUDE_PLUGIN_ROOT is a non-event.
23
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
24
+ . "${SCRIPT_DIR}/hook-common.sh"
26
25
 
27
26
  # Nothing safe to warm if the manifest version can't be read: warming @latest
28
27
  # could pin a different version than resolve_code_audit's fallback would fetch.
@@ -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.1** • Run `code-audit --version` to check your installed version.
8
+ > **Version 5.0.2** • 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.
package/server.json CHANGED
@@ -1,21 +1,27 @@
1
1
  {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.BenAHammond/code-auditor-mcp",
4
- "description": "Architectural invariants and code quality analysis, enforced inside your AI agent's edit loop. MCP server + CLI + Claude Code plugin. TypeScript, JavaScript, Go.",
4
+ "description": "Enforces architectural invariants and code quality rules inside your AI agent's edit loop.",
5
5
  "repository": {
6
6
  "url": "https://github.com/BenAHammond/code-auditor-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "5.0.1",
9
+ "version": "5.0.2",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "registryBaseUrl": "https://registry.npmjs.org",
14
14
  "identifier": "code-auditor-mcp",
15
- "version": "5.0.1",
15
+ "version": "5.0.2",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }
19
19
  }
20
+ ],
21
+ "remotes": [
22
+ {
23
+ "type": "streamable-http",
24
+ "url": "https://www.codeauditormcp.com/api/mcp"
25
+ }
20
26
  ]
21
27
  }