claude-crap 0.3.7 → 0.4.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 (100) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +74 -7
  3. package/dist/adapters/common.d.ts +1 -1
  4. package/dist/adapters/common.d.ts.map +1 -1
  5. package/dist/adapters/common.js +1 -1
  6. package/dist/adapters/common.js.map +1 -1
  7. package/dist/adapters/dart-analyzer.d.ts +41 -0
  8. package/dist/adapters/dart-analyzer.d.ts.map +1 -0
  9. package/dist/adapters/dart-analyzer.js +120 -0
  10. package/dist/adapters/dart-analyzer.js.map +1 -0
  11. package/dist/adapters/dotnet-format.d.ts +35 -0
  12. package/dist/adapters/dotnet-format.d.ts.map +1 -0
  13. package/dist/adapters/dotnet-format.js +96 -0
  14. package/dist/adapters/dotnet-format.js.map +1 -0
  15. package/dist/adapters/index.d.ts +2 -0
  16. package/dist/adapters/index.d.ts.map +1 -1
  17. package/dist/adapters/index.js +8 -0
  18. package/dist/adapters/index.js.map +1 -1
  19. package/dist/crap-config.d.ts +4 -0
  20. package/dist/crap-config.d.ts.map +1 -1
  21. package/dist/crap-config.js +51 -28
  22. package/dist/crap-config.js.map +1 -1
  23. package/dist/dashboard/file-detail.d.ts.map +1 -1
  24. package/dist/dashboard/file-detail.js.map +1 -1
  25. package/dist/dashboard/server.d.ts +2 -0
  26. package/dist/dashboard/server.d.ts.map +1 -1
  27. package/dist/dashboard/server.js +7 -12
  28. package/dist/dashboard/server.js.map +1 -1
  29. package/dist/index.js +89 -5
  30. package/dist/index.js.map +1 -1
  31. package/dist/metrics/workspace-walker.d.ts +4 -1
  32. package/dist/metrics/workspace-walker.d.ts.map +1 -1
  33. package/dist/metrics/workspace-walker.js +12 -28
  34. package/dist/metrics/workspace-walker.js.map +1 -1
  35. package/dist/monorepo/project-map.d.ts +112 -0
  36. package/dist/monorepo/project-map.d.ts.map +1 -0
  37. package/dist/monorepo/project-map.js +384 -0
  38. package/dist/monorepo/project-map.js.map +1 -0
  39. package/dist/scanner/auto-scan.d.ts +1 -0
  40. package/dist/scanner/auto-scan.d.ts.map +1 -1
  41. package/dist/scanner/auto-scan.js +14 -5
  42. package/dist/scanner/auto-scan.js.map +1 -1
  43. package/dist/scanner/bootstrap.d.ts +1 -1
  44. package/dist/scanner/bootstrap.d.ts.map +1 -1
  45. package/dist/scanner/bootstrap.js +15 -1
  46. package/dist/scanner/bootstrap.js.map +1 -1
  47. package/dist/scanner/complexity-scanner.d.ts +2 -0
  48. package/dist/scanner/complexity-scanner.d.ts.map +1 -1
  49. package/dist/scanner/complexity-scanner.js +11 -26
  50. package/dist/scanner/complexity-scanner.js.map +1 -1
  51. package/dist/scanner/detector.d.ts +24 -4
  52. package/dist/scanner/detector.d.ts.map +1 -1
  53. package/dist/scanner/detector.js +110 -10
  54. package/dist/scanner/detector.js.map +1 -1
  55. package/dist/scanner/runner.d.ts +4 -1
  56. package/dist/scanner/runner.d.ts.map +1 -1
  57. package/dist/scanner/runner.js +25 -3
  58. package/dist/scanner/runner.js.map +1 -1
  59. package/dist/schemas/tool-schemas.d.ts +16 -1
  60. package/dist/schemas/tool-schemas.d.ts.map +1 -1
  61. package/dist/schemas/tool-schemas.js +16 -1
  62. package/dist/schemas/tool-schemas.js.map +1 -1
  63. package/dist/shared/exclusions.d.ts +53 -0
  64. package/dist/shared/exclusions.d.ts.map +1 -0
  65. package/dist/shared/exclusions.js +126 -0
  66. package/dist/shared/exclusions.js.map +1 -0
  67. package/package.json +3 -1
  68. package/plugin/.claude-plugin/plugin.json +1 -1
  69. package/plugin/CLAUDE.md +37 -0
  70. package/plugin/bundle/mcp-server.mjs +762 -144
  71. package/plugin/bundle/mcp-server.mjs.map +4 -4
  72. package/plugin/package-lock.json +15 -2
  73. package/plugin/package.json +2 -1
  74. package/scripts/bundle-plugin.mjs +2 -1
  75. package/src/adapters/common.ts +1 -1
  76. package/src/adapters/dart-analyzer.ts +161 -0
  77. package/src/adapters/dotnet-format.ts +125 -0
  78. package/src/adapters/index.ts +8 -0
  79. package/src/crap-config.ts +78 -18
  80. package/src/dashboard/file-detail.ts +0 -2
  81. package/src/dashboard/server.ts +9 -10
  82. package/src/index.ts +103 -5
  83. package/src/metrics/workspace-walker.ts +15 -27
  84. package/src/monorepo/project-map.ts +476 -0
  85. package/src/scanner/auto-scan.ts +17 -6
  86. package/src/scanner/bootstrap.ts +18 -1
  87. package/src/scanner/complexity-scanner.ts +15 -26
  88. package/src/scanner/detector.ts +119 -10
  89. package/src/scanner/runner.ts +25 -2
  90. package/src/schemas/tool-schemas.ts +17 -1
  91. package/src/shared/exclusions.ts +156 -0
  92. package/src/tests/adapters/dispatch.test.ts +2 -2
  93. package/src/tests/auto-scan.test.ts +2 -2
  94. package/src/tests/boot-monorepo.test.ts +804 -0
  95. package/src/tests/boot-scanner-detection.test.ts +692 -0
  96. package/src/tests/boot-single-project.test.ts +780 -0
  97. package/src/tests/exclusions.test.ts +117 -0
  98. package/src/tests/integration/mcp-server.integration.test.ts +2 -1
  99. package/src/tests/project-map.test.ts +302 -0
  100. package/src/tests/scanner-detector.test.ts +31 -11
@@ -118,10 +118,25 @@ export declare const scoreProjectSchema: {
118
118
  readonly enum: readonly ["markdown", "json", "both"];
119
119
  readonly description: "Output format. `markdown` returns only the chat summary, `json` returns only the structured snapshot, `both` (default) returns both as separate content blocks.";
120
120
  };
121
+ readonly scope: {
122
+ readonly type: "string";
123
+ readonly description: "Optional project name from the project map. When provided, the score is computed only for files within that project's subtree. Omit to score the entire workspace.";
124
+ };
121
125
  };
122
126
  readonly required: readonly [];
123
127
  readonly additionalProperties: false;
124
128
  };
129
+ /**
130
+ * Schema for the `list_projects` tool. Returns the discovered sub-projects
131
+ * in the workspace, or an empty list for single-project workspaces.
132
+ */
133
+ export declare const listProjectsSchema: {
134
+ readonly type: "object";
135
+ readonly description: "List all discovered sub-projects in the workspace. In a monorepo, returns each sub-project with its type, path, and recommended scanner. In a single-project workspace, returns an empty list.";
136
+ readonly properties: {};
137
+ readonly required: readonly [];
138
+ readonly additionalProperties: false;
139
+ };
125
140
  /**
126
141
  * Schema for the `require_test_harness` tool. Checks whether a production
127
142
  * source file has an accompanying test file in any of the conventional
@@ -160,7 +175,7 @@ export declare const ingestScannerOutputSchema: {
160
175
  readonly properties: {
161
176
  readonly scanner: {
162
177
  readonly type: "string";
163
- readonly enum: readonly ["semgrep", "eslint", "bandit", "stryker"];
178
+ readonly enum: readonly ["semgrep", "eslint", "bandit", "stryker", "dart_analyze", "dotnet_format"];
164
179
  readonly description: "Identifier of the producing scanner.";
165
180
  };
166
181
  readonly rawOutput: {
@@ -1 +1 @@
1
- {"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAyBnB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;CAuBvB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;CAcrB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAgB3B,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAkB5B,CAAC;AAEX;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;CAOzB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;CAOjB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBpB,CAAC"}
1
+ {"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAyBnB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;CAuBvB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAkBrB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAgB3B,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAkB5B,CAAC;AAEX;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;CAOzB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;CAOjB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBpB,CAAC"}
@@ -124,10 +124,25 @@ export const scoreProjectSchema = {
124
124
  enum: ["markdown", "json", "both"],
125
125
  description: "Output format. `markdown` returns only the chat summary, `json` returns only the structured snapshot, `both` (default) returns both as separate content blocks.",
126
126
  },
127
+ scope: {
128
+ type: "string",
129
+ description: "Optional project name from the project map. When provided, the score is computed only for files within that project's subtree. Omit to score the entire workspace.",
130
+ },
127
131
  },
128
132
  required: [],
129
133
  additionalProperties: false,
130
134
  };
135
+ /**
136
+ * Schema for the `list_projects` tool. Returns the discovered sub-projects
137
+ * in the workspace, or an empty list for single-project workspaces.
138
+ */
139
+ export const listProjectsSchema = {
140
+ type: "object",
141
+ description: "List all discovered sub-projects in the workspace. In a monorepo, returns each sub-project with its type, path, and recommended scanner. In a single-project workspace, returns an empty list.",
142
+ properties: {},
143
+ required: [],
144
+ additionalProperties: false,
145
+ };
131
146
  /**
132
147
  * Schema for the `require_test_harness` tool. Checks whether a production
133
148
  * source file has an accompanying test file in any of the conventional
@@ -166,7 +181,7 @@ export const ingestScannerOutputSchema = {
166
181
  properties: {
167
182
  scanner: {
168
183
  type: "string",
169
- enum: ["semgrep", "eslint", "bandit", "stryker"],
184
+ enum: ["semgrep", "eslint", "bandit", "stryker", "dart_analyze", "dotnet_format"],
170
185
  description: "Identifier of the producing scanner.",
171
186
  },
172
187
  rawOutput: {
@@ -1 +1 @@
1
- {"version":3,"file":"tool-schemas.js","sourceRoot":"","sources":["../../src/schemas/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2EAA2E;AAC3E,0EAA0E;AAC1E,wCAAwC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,sQAAsQ;IACxQ,UAAU,EAAE;QACV,oBAAoB,EAAE;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,+EAA+E;SAC7F;QACD,eAAe,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,mEAAmE;SACjF;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,gCAAgC;YACzC,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,GAAG;YACd,WAAW,EAAE,mFAAmF;SACjG;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,oFAAoF;SAClG;KACF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cAAc,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,oSAAoS;IACtS,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,wQAAwQ;IAC1Q,UAAU,EAAE;QACV,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6DAA6D;YAC1E,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE;gBAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE;aACrC;YACD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;SAC9B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,wBAAwB;YACjC,WAAW,EAAE,8FAA8F;SAC5G;KACF;IACD,QAAQ,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;IACzC,oBAAoB,EAAE,KAAK;CACnB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Centralized file and directory exclusion system.
3
+ *
4
+ * Every filesystem walker in the codebase (workspace-walker,
5
+ * complexity-scanner, dashboard file-detail) imports from this module
6
+ * instead of maintaining its own `SKIP_DIRS` constant. This
7
+ * guarantees all subsystems agree on what to exclude.
8
+ *
9
+ * User-configurable exclusions from `.claude-crap.json` are layered
10
+ * on top of the defaults via {@link createExclusionFilter}.
11
+ *
12
+ * @module shared/exclusions
13
+ */
14
+ /**
15
+ * Directories excluded by name at any depth. A walker that encounters
16
+ * a directory entry whose name is in this set should skip the entire
17
+ * subtree. The set covers package managers, VCS, build outputs for
18
+ * all major frameworks, language-specific caches, and plugin state.
19
+ */
20
+ export declare const DEFAULT_SKIP_DIRS: ReadonlySet<string>;
21
+ /**
22
+ * Filename-level glob patterns that match generated or minified files
23
+ * regardless of which directory they live in. Matched against the
24
+ * bare filename (not the full path).
25
+ */
26
+ export declare const DEFAULT_SKIP_PATTERNS: ReadonlyArray<string>;
27
+ /**
28
+ * Stateless, pre-compiled filter that every filesystem walker uses
29
+ * to decide whether to skip a directory or file.
30
+ */
31
+ export interface ExclusionFilter {
32
+ /** Returns `true` when the directory should be skipped entirely. */
33
+ shouldSkipDir(dirName: string): boolean;
34
+ /** Returns `true` when the file should be excluded from analysis. */
35
+ shouldSkipFile(relativePath: string, fileName: string): boolean;
36
+ }
37
+ /**
38
+ * Create an {@link ExclusionFilter} that combines the built-in
39
+ * defaults with optional user-defined patterns from `.claude-crap.json`.
40
+ *
41
+ * User patterns follow `.gitignore`-style conventions:
42
+ * - `apps/legacy/` → trailing `/` means directory exclusion
43
+ * - `*.proto.ts` → glob matched against workspace-relative path
44
+ * - `src/generated/**` → path-prefix glob
45
+ *
46
+ * Picomatch matchers are compiled once at construction, so per-file
47
+ * checks are O(1) set lookups plus O(n) matcher calls where n is
48
+ * the small number of user patterns (typically < 20).
49
+ *
50
+ * @param userExclusions Optional patterns from `.claude-crap.json`.
51
+ */
52
+ export declare function createExclusionFilter(userExclusions?: ReadonlyArray<string>): ExclusionFilter;
53
+ //# sourceMappingURL=exclusions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exclusions.d.ts","sourceRoot":"","sources":["../../src/shared/exclusions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CA0ChD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAOvD,CAAC;AAIF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,qEAAqE;IACrE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CACjE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GACrC,eAAe,CA2CjB"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Centralized file and directory exclusion system.
3
+ *
4
+ * Every filesystem walker in the codebase (workspace-walker,
5
+ * complexity-scanner, dashboard file-detail) imports from this module
6
+ * instead of maintaining its own `SKIP_DIRS` constant. This
7
+ * guarantees all subsystems agree on what to exclude.
8
+ *
9
+ * User-configurable exclusions from `.claude-crap.json` are layered
10
+ * on top of the defaults via {@link createExclusionFilter}.
11
+ *
12
+ * @module shared/exclusions
13
+ */
14
+ import picomatch from "picomatch";
15
+ // ── Default exclusions ──────────────────────────────────────────
16
+ /**
17
+ * Directories excluded by name at any depth. A walker that encounters
18
+ * a directory entry whose name is in this set should skip the entire
19
+ * subtree. The set covers package managers, VCS, build outputs for
20
+ * all major frameworks, language-specific caches, and plugin state.
21
+ */
22
+ export const DEFAULT_SKIP_DIRS = new Set([
23
+ // Package managers / vendored deps
24
+ "node_modules",
25
+ "vendor",
26
+ // Version control
27
+ ".git",
28
+ // Build outputs (general)
29
+ "dist",
30
+ "build",
31
+ "bundle",
32
+ "out",
33
+ "target",
34
+ "coverage",
35
+ // Framework build outputs
36
+ ".next", // Next.js
37
+ ".nuxt", // Nuxt 2
38
+ ".output", // Nuxt 3
39
+ ".vercel", // Vercel
40
+ ".svelte-kit", // SvelteKit
41
+ ".astro", // Astro
42
+ ".angular", // Angular
43
+ ".turbo", // Turborepo
44
+ ".parcel-cache", // Parcel
45
+ ".expo", // Expo / React Native
46
+ // Language-specific caches
47
+ ".venv",
48
+ "venv",
49
+ "__pycache__",
50
+ ".cache",
51
+ ".dart_tool", // Dart / Flutter
52
+ ".gradle", // Gradle
53
+ // IDE state
54
+ ".idea",
55
+ // Plugin state
56
+ ".claude-crap",
57
+ ".codesight",
58
+ ]);
59
+ /**
60
+ * Filename-level glob patterns that match generated or minified files
61
+ * regardless of which directory they live in. Matched against the
62
+ * bare filename (not the full path).
63
+ */
64
+ export const DEFAULT_SKIP_PATTERNS = [
65
+ "*.min.js",
66
+ "*.min.css",
67
+ "*.min.mjs",
68
+ "*.min.cjs",
69
+ "*.bundle.js",
70
+ "*.chunk.js",
71
+ ];
72
+ /**
73
+ * Create an {@link ExclusionFilter} that combines the built-in
74
+ * defaults with optional user-defined patterns from `.claude-crap.json`.
75
+ *
76
+ * User patterns follow `.gitignore`-style conventions:
77
+ * - `apps/legacy/` → trailing `/` means directory exclusion
78
+ * - `*.proto.ts` → glob matched against workspace-relative path
79
+ * - `src/generated/**` → path-prefix glob
80
+ *
81
+ * Picomatch matchers are compiled once at construction, so per-file
82
+ * checks are O(1) set lookups plus O(n) matcher calls where n is
83
+ * the small number of user patterns (typically < 20).
84
+ *
85
+ * @param userExclusions Optional patterns from `.claude-crap.json`.
86
+ */
87
+ export function createExclusionFilter(userExclusions) {
88
+ // Split user patterns into directory exclusions and file globs
89
+ const extraDirs = new Set();
90
+ const fileGlobs = [];
91
+ for (const pattern of userExclusions ?? []) {
92
+ if (pattern.endsWith("/")) {
93
+ // Directory exclusion — strip trailing slash
94
+ extraDirs.add(pattern.slice(0, -1));
95
+ }
96
+ else {
97
+ fileGlobs.push(pattern);
98
+ }
99
+ }
100
+ // Compile filename-level matchers once
101
+ const defaultFileMatchers = DEFAULT_SKIP_PATTERNS.map((p) => picomatch(p, { dot: true }));
102
+ const userFileMatchers = fileGlobs.map((p) => picomatch(p, { dot: true }));
103
+ return {
104
+ shouldSkipDir(dirName) {
105
+ // Hidden directories are always skipped except .claude-plugin
106
+ if (dirName.startsWith(".") && dirName !== ".claude-plugin") {
107
+ return DEFAULT_SKIP_DIRS.has(dirName) || true;
108
+ }
109
+ return DEFAULT_SKIP_DIRS.has(dirName) || extraDirs.has(dirName);
110
+ },
111
+ shouldSkipFile(relativePath, fileName) {
112
+ // Check filename against default minified/bundled patterns
113
+ for (const matcher of defaultFileMatchers) {
114
+ if (matcher(fileName))
115
+ return true;
116
+ }
117
+ // Check against user-defined globs (matched on relative path)
118
+ for (const matcher of userFileMatchers) {
119
+ if (matcher(relativePath) || matcher(fileName))
120
+ return true;
121
+ }
122
+ return false;
123
+ },
124
+ };
125
+ }
126
+ //# sourceMappingURL=exclusions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exclusions.js","sourceRoot":"","sources":["../../src/shared/exclusions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,mEAAmE;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IAC5D,mCAAmC;IACnC,cAAc;IACd,QAAQ;IAER,kBAAkB;IAClB,MAAM;IAEN,0BAA0B;IAC1B,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,UAAU;IAEV,0BAA0B;IAC1B,OAAO,EAAS,UAAU;IAC1B,OAAO,EAAS,SAAS;IACzB,SAAS,EAAO,SAAS;IACzB,SAAS,EAAO,SAAS;IACzB,aAAa,EAAG,YAAY;IAC5B,QAAQ,EAAQ,QAAQ;IACxB,UAAU,EAAM,UAAU;IAC1B,QAAQ,EAAQ,YAAY;IAC5B,eAAe,EAAC,SAAS;IACzB,OAAO,EAAS,sBAAsB;IAEtC,2BAA2B;IAC3B,OAAO;IACP,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY,EAAI,iBAAiB;IACjC,SAAS,EAAO,SAAS;IAEzB,YAAY;IACZ,OAAO;IAEP,eAAe;IACf,cAAc;IACd,YAAY;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB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ClE,CAAC;QAED,cAAc,CAAC,YAAoB,EAAE,QAAgB;YACnD,2DAA2D;YAC3D,KAAK,MAAM,OAAO,IAAI,mBAAmB,EAAE,CAAC;gBAC1C,IAAI,OAAO,CAAC,QAAQ,CAAC;oBAAE,OAAO,IAAI,CAAC;YACrC,CAAC;YACD,8DAA8D;YAC9D,KAAK,MAAM,OAAO,IAAI,gBAAgB,EAAE,CAAC;gBACvC,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC;oBAAE,OAAO,IAAI,CAAC;YAC9D,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-crap",
3
- "version": "0.3.7",
3
+ "version": "0.4.0",
4
4
  "description": "Deterministic QA plugin for Claude Code — CRAP index, Technical Debt Ratio, tree-sitter AST, SARIF 2.1.0, hooks, and a local Vue dashboard.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -123,6 +123,7 @@
123
123
  "ajv-formats": "^3.0.1",
124
124
  "fast-glob": "^3.3.2",
125
125
  "fastify": "^5.2.0",
126
+ "picomatch": "^2.3.2",
126
127
  "pino": "^9.5.0",
127
128
  "tree-sitter-wasms": "^0.1.12",
128
129
  "web-tree-sitter": "^0.24.4"
@@ -130,6 +131,7 @@
130
131
  "devDependencies": {
131
132
  "@eslint/js": "^10.0.1",
132
133
  "@types/node": "^22.10.2",
134
+ "@types/picomatch": "^4.0.3",
133
135
  "esbuild": "^0.28.0",
134
136
  "eslint": "^10.2.0",
135
137
  "globals": "^17.5.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://code.claude.com/schemas/plugin.json",
3
3
  "name": "claude-crap",
4
- "version": "0.3.7",
4
+ "version": "0.4.0",
5
5
  "description": "Deterministic Quality Assurance plugin for Claude Code. Wraps every Write / Edit / Bash tool call with a PreToolUse gatekeeper, a PostToolUse verifier, and a Stop quality gate backed by CRAP index, Technical Debt Ratio, tree-sitter AST metrics, and SARIF 2.1.0 reports. Forbids the agent from writing functional code before a test safety net exists.",
6
6
  "author": {
7
7
  "name": "Alan Hernandez",
package/plugin/CLAUDE.md CHANGED
@@ -101,6 +101,43 @@ Proposed change : <syntactic summary, ≤3 lines>
101
101
  Do not omit fields. Do not merge cells. Do not add sections. If a field
102
102
  does not apply, write `n/a` and justify on a single line.
103
103
 
104
+ ## Monorepo Project Discovery
105
+
106
+ When the workspace is a monorepo (multiple sub-projects under one
107
+ root), the plugin auto-discovers sub-projects at session start from
108
+ npm workspaces and conventional directories (`apps/`, `packages/`,
109
+ `libs/`, etc.). However, **non-standard layouts require your help.**
110
+
111
+ If you detect that the workspace has sub-projects in directories not
112
+ covered by the defaults (e.g. projects at the root level like
113
+ `root/app1`, `root/app2`, or nested like `root/domain/app1`), you
114
+ should:
115
+
116
+ 1. Call `list_projects` to see what was auto-discovered.
117
+ 2. If projects are missing, update `.claude-crap.json` to add the
118
+ `projectDirs` field with the correct paths:
119
+
120
+ ```jsonc
121
+ // .claude-crap.json
122
+ {
123
+ "strictness": "strict",
124
+ "projectDirs": ["frontend", "backend", "tools/cli"]
125
+ }
126
+ ```
127
+
128
+ Each entry can be:
129
+ - A **parent directory** scanned one level deep: `"frontend"` discovers
130
+ `frontend/app1`, `frontend/app2`, etc.
131
+ - A **direct project path**: `"tools/cli"` treats that directory itself
132
+ as a project.
133
+
134
+ The plugin merges user-configured `projectDirs` with npm workspaces
135
+ and the built-in defaults. You do NOT need to repeat `apps/` or
136
+ `packages/` — those are always probed automatically.
137
+
138
+ **Do this early in the session** — before running `score_project` or
139
+ any scanner tool — so the quality gate covers all sub-projects.
140
+
104
141
  ## Context Virtualization (anti Context Bloat)
105
142
 
106
143
  - It is **forbidden** to run iterative `grep`/`glob` searches over the