claude-crap 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/adapters/common.d.ts +1 -1
- package/dist/adapters/common.d.ts.map +1 -1
- package/dist/adapters/common.js +1 -1
- package/dist/adapters/common.js.map +1 -1
- package/dist/adapters/dart-analyzer.d.ts +41 -0
- package/dist/adapters/dart-analyzer.d.ts.map +1 -0
- package/dist/adapters/dart-analyzer.js +120 -0
- package/dist/adapters/dart-analyzer.js.map +1 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/crap-config.d.ts +2 -0
- package/dist/crap-config.d.ts.map +1 -1
- package/dist/crap-config.js +36 -28
- package/dist/crap-config.js.map +1 -1
- package/dist/dashboard/file-detail.d.ts +77 -0
- package/dist/dashboard/file-detail.d.ts.map +1 -0
- package/dist/dashboard/file-detail.js +120 -0
- package/dist/dashboard/file-detail.js.map +1 -0
- package/dist/dashboard/server.d.ts +5 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +103 -1
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/metrics/workspace-walker.d.ts +4 -1
- package/dist/metrics/workspace-walker.d.ts.map +1 -1
- package/dist/metrics/workspace-walker.js +12 -28
- package/dist/metrics/workspace-walker.js.map +1 -1
- package/dist/scanner/auto-scan.d.ts +9 -1
- package/dist/scanner/auto-scan.d.ts.map +1 -1
- package/dist/scanner/auto-scan.js +27 -5
- package/dist/scanner/auto-scan.js.map +1 -1
- package/dist/scanner/bootstrap.d.ts +1 -1
- package/dist/scanner/bootstrap.d.ts.map +1 -1
- package/dist/scanner/bootstrap.js +9 -0
- package/dist/scanner/bootstrap.js.map +1 -1
- package/dist/scanner/complexity-scanner.d.ts +56 -0
- package/dist/scanner/complexity-scanner.d.ts.map +1 -0
- package/dist/scanner/complexity-scanner.js +161 -0
- package/dist/scanner/complexity-scanner.js.map +1 -0
- package/dist/scanner/detector.d.ts +24 -4
- package/dist/scanner/detector.d.ts.map +1 -1
- package/dist/scanner/detector.js +105 -10
- package/dist/scanner/detector.js.map +1 -1
- package/dist/scanner/runner.d.ts +4 -1
- package/dist/scanner/runner.d.ts.map +1 -1
- package/dist/scanner/runner.js +12 -3
- package/dist/scanner/runner.js.map +1 -1
- package/dist/schemas/tool-schemas.d.ts +1 -1
- package/dist/schemas/tool-schemas.js +1 -1
- package/dist/schemas/tool-schemas.js.map +1 -1
- package/dist/shared/exclusions.d.ts +53 -0
- package/dist/shared/exclusions.d.ts.map +1 -0
- package/dist/shared/exclusions.js +126 -0
- package/dist/shared/exclusions.js.map +1 -0
- package/package.json +3 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/bundle/dashboard/public/index.html +432 -12
- package/plugin/bundle/mcp-server.mjs +747 -137
- package/plugin/bundle/mcp-server.mjs.map +4 -4
- package/plugin/package-lock.json +15 -2
- package/plugin/package.json +2 -1
- package/scripts/bundle-plugin.mjs +2 -1
- package/src/adapters/common.ts +1 -1
- package/src/adapters/dart-analyzer.ts +161 -0
- package/src/adapters/index.ts +4 -0
- package/src/crap-config.ts +55 -18
- package/src/dashboard/file-detail.ts +195 -0
- package/src/dashboard/public/index.html +432 -12
- package/src/dashboard/server.ts +140 -1
- package/src/index.ts +37 -4
- package/src/metrics/workspace-walker.ts +15 -27
- package/src/scanner/auto-scan.ts +41 -4
- package/src/scanner/bootstrap.ts +11 -0
- package/src/scanner/complexity-scanner.ts +222 -0
- package/src/scanner/detector.ts +114 -10
- package/src/scanner/runner.ts +12 -2
- package/src/schemas/tool-schemas.ts +1 -1
- package/src/shared/exclusions.ts +156 -0
- package/src/tests/adapters/dispatch.test.ts +2 -2
- package/src/tests/auto-scan.test.ts +2 -2
- package/src/tests/complexity-scanner.test.ts +263 -0
- package/src/tests/exclusions.test.ts +117 -0
- package/src/tests/file-detail-api.test.ts +258 -0
- package/src/tests/scanner-detector.test.ts +31 -11
|
@@ -166,7 +166,7 @@ export const ingestScannerOutputSchema = {
|
|
|
166
166
|
properties: {
|
|
167
167
|
scanner: {
|
|
168
168
|
type: "string",
|
|
169
|
-
enum: ["semgrep", "eslint", "bandit", "stryker"],
|
|
169
|
+
enum: ["semgrep", "eslint", "bandit", "stryker", "dart_analyze"],
|
|
170
170
|
description: "Identifier of the producing scanner.",
|
|
171
171
|
},
|
|
172
172
|
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;IACD,QAAQ,EAAE,CAAC,sBAAsB,EAAE,iBAAiB,EAA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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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,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.
|
|
3
|
+
"version": "0.3.8",
|
|
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.
|
|
4
|
+
"version": "0.3.8",
|
|
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",
|