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.
- package/CHANGELOG.md +33 -0
- package/README.md +74 -7
- 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/dotnet-format.d.ts +35 -0
- package/dist/adapters/dotnet-format.d.ts.map +1 -0
- package/dist/adapters/dotnet-format.js +96 -0
- package/dist/adapters/dotnet-format.js.map +1 -0
- package/dist/adapters/index.d.ts +2 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +8 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/crap-config.d.ts +4 -0
- package/dist/crap-config.d.ts.map +1 -1
- package/dist/crap-config.js +51 -28
- package/dist/crap-config.js.map +1 -1
- package/dist/dashboard/file-detail.d.ts.map +1 -1
- package/dist/dashboard/file-detail.js.map +1 -1
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +7 -12
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +89 -5
- 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/monorepo/project-map.d.ts +112 -0
- package/dist/monorepo/project-map.d.ts.map +1 -0
- package/dist/monorepo/project-map.js +384 -0
- package/dist/monorepo/project-map.js.map +1 -0
- package/dist/scanner/auto-scan.d.ts +1 -0
- package/dist/scanner/auto-scan.d.ts.map +1 -1
- package/dist/scanner/auto-scan.js +14 -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 +15 -1
- package/dist/scanner/bootstrap.js.map +1 -1
- package/dist/scanner/complexity-scanner.d.ts +2 -0
- package/dist/scanner/complexity-scanner.d.ts.map +1 -1
- package/dist/scanner/complexity-scanner.js +11 -26
- package/dist/scanner/complexity-scanner.js.map +1 -1
- package/dist/scanner/detector.d.ts +24 -4
- package/dist/scanner/detector.d.ts.map +1 -1
- package/dist/scanner/detector.js +110 -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 +25 -3
- package/dist/scanner/runner.js.map +1 -1
- package/dist/schemas/tool-schemas.d.ts +16 -1
- package/dist/schemas/tool-schemas.d.ts.map +1 -1
- package/dist/schemas/tool-schemas.js +16 -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/CLAUDE.md +37 -0
- package/plugin/bundle/mcp-server.mjs +762 -144
- 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/dotnet-format.ts +125 -0
- package/src/adapters/index.ts +8 -0
- package/src/crap-config.ts +78 -18
- package/src/dashboard/file-detail.ts +0 -2
- package/src/dashboard/server.ts +9 -10
- package/src/index.ts +103 -5
- package/src/metrics/workspace-walker.ts +15 -27
- package/src/monorepo/project-map.ts +476 -0
- package/src/scanner/auto-scan.ts +17 -6
- package/src/scanner/bootstrap.ts +18 -1
- package/src/scanner/complexity-scanner.ts +15 -26
- package/src/scanner/detector.ts +119 -10
- package/src/scanner/runner.ts +25 -2
- package/src/schemas/tool-schemas.ts +17 -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/boot-monorepo.test.ts +804 -0
- package/src/tests/boot-scanner-detection.test.ts +692 -0
- package/src/tests/boot-single-project.test.ts +780 -0
- package/src/tests/exclusions.test.ts +117 -0
- package/src/tests/integration/mcp-server.integration.test.ts +2 -1
- package/src/tests/project-map.test.ts +302 -0
- package/src/tests/scanner-detector.test.ts +31 -11
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.0] - 2026-04-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Monorepo project map** — auto-discovers sub-projects at session boot
|
|
13
|
+
by probing npm workspaces and `apps/`, `packages/`, `libs/` directories.
|
|
14
|
+
Persisted to `.claude-crap/projects.json`.
|
|
15
|
+
- **`list_projects` MCP tool** — returns all sub-projects with type, path,
|
|
16
|
+
recommended scanner, and availability.
|
|
17
|
+
- **Scoped `score_project`** — optional `scope` parameter to score a
|
|
18
|
+
single sub-project instead of the entire monorepo.
|
|
19
|
+
- **Dart analyzer scanner** — `dart analyze --format=json` → SARIF 2.1.0.
|
|
20
|
+
Auto-detected in monorepo subdirectories via `pubspec.yaml`.
|
|
21
|
+
- **`dotnet format` scanner** — built-in Roslyn analyzer for C# projects.
|
|
22
|
+
No extra install needed when .NET SDK is present.
|
|
23
|
+
- **Centralized file exclusions** — shared module replaces 3 independent
|
|
24
|
+
`SKIP_DIRS` sets. Covers `bundle/`, `vendor/`, `.astro`, `.svelte-kit`,
|
|
25
|
+
`.dart_tool`, `.expo`, `.angular`, `.turbo`, and 15+ more.
|
|
26
|
+
- **User-configurable `exclude`** — `.claude-crap.json` now supports an
|
|
27
|
+
`exclude` array with glob patterns and directory exclusions.
|
|
28
|
+
- **Auto-bootstrap ESLint** in monorepos — detects JS/TS sub-projects
|
|
29
|
+
and installs ESLint at root automatically.
|
|
30
|
+
- **Auto-sync plugin cache** — `npm run build:plugin` syncs to all
|
|
31
|
+
cached versions under `~/.claude/plugins/cache/`.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- C# projects now use `dotnet format` instead of Semgrep.
|
|
36
|
+
- Scanner detector validates `node_modules/.bin/` binary exists before
|
|
37
|
+
marking a package.json dependency as available.
|
|
38
|
+
- Workspace LOC excludes bundle/vendor files (dropped from ~25K to ~15K
|
|
39
|
+
for the claude-crap repo itself).
|
|
40
|
+
|
|
8
41
|
## [0.3.6] - 2026-04-12
|
|
9
42
|
|
|
10
43
|
### Fixed
|
package/README.md
CHANGED
|
@@ -100,8 +100,9 @@ CRAP formula, TDR formula, letter ratings, and adoption strategy.
|
|
|
100
100
|
| **Stop quality gate** | `plugin/hooks/stop-quality-gate.mjs` | Reads the SARIF store, computes CRAP / TDR / reliability / security ratings, and blocks task close if any metric is outside policy. |
|
|
101
101
|
| **MCP server** | `src/index.ts` | Stdio-transport server exposing CRAP, TDR, tree-sitter AST, and SARIF engines as deterministic tools. |
|
|
102
102
|
| **SARIF store** | `src/sarif/sarif-store.ts` | On-disk consolidated report with finding deduplication. Tolerates malformed entries so a tampered file can't DoS the boot. |
|
|
103
|
-
| **Scanner adapters** | `src/adapters/` |
|
|
104
|
-
| **
|
|
103
|
+
| **Scanner adapters** | `src/adapters/` | ESLint, Semgrep, Bandit, Stryker, `dart analyze`, `dotnet format` — each stamps `effortMinutes` for uniform TDR computation. |
|
|
104
|
+
| **Project map** | `src/monorepo/project-map.ts` | Auto-discovers monorepo sub-projects at boot, persists to `.claude-crap/projects.json`. |
|
|
105
|
+
| **Dashboard** | `src/dashboard/server.ts` | Fastify on `127.0.0.1:5117` serving a Vue 3 SPA. Offline-capable (vendored runtime). PID-based port management. |
|
|
105
106
|
|
|
106
107
|
All findings are normalized to **SARIF 2.1.0** — one vocabulary,
|
|
107
108
|
exact coordinates, no grep walls in the context window.
|
|
@@ -113,7 +114,7 @@ for the boot sequence, data flow, and design decisions.
|
|
|
113
114
|
|
|
114
115
|
## MCP Tools
|
|
115
116
|
|
|
116
|
-
|
|
117
|
+
Ten deterministic tools and two resources, all with strict JSON Schema validation.
|
|
117
118
|
|
|
118
119
|
| Tool | Purpose |
|
|
119
120
|
| :--- | :------ |
|
|
@@ -121,11 +122,12 @@ Nine deterministic tools and two resources, all with strict JSON Schema validati
|
|
|
121
122
|
| `compute_tdr` | Technical Debt Ratio and A..E maintainability rating. |
|
|
122
123
|
| `analyze_file_ast` | Tree-sitter AST metrics: LOC + per-function cyclomatic complexity. TypeScript, JavaScript, Python, Java, C#. |
|
|
123
124
|
| `ingest_sarif` | Merge a raw SARIF 2.1.0 document into the store with deduplication. |
|
|
124
|
-
| `ingest_scanner_output` | Route native scanner output through adapter, enrich with `effortMinutes`, persist as SARIF. |
|
|
125
|
+
| `ingest_scanner_output` | Route native scanner output through adapter, enrich with `effortMinutes`, persist as SARIF. Supports ESLint, Semgrep, Bandit, Stryker, `dart_analyze`, and `dotnet_format`. |
|
|
125
126
|
| `require_test_harness` | Check whether a source file has an accompanying test file. |
|
|
126
|
-
| `score_project` | Aggregate workspace into
|
|
127
|
-
| `auto_scan` | Auto-detect scanners, run them, ingest findings. |
|
|
127
|
+
| `score_project` | Aggregate workspace into A..E grades. Optional `scope` parameter to score a single monorepo sub-project. |
|
|
128
|
+
| `auto_scan` | Auto-detect scanners (including monorepo subdirectories), run them, ingest findings. |
|
|
128
129
|
| `bootstrap_scanner` | Detect project type, install the right scanner, configure, and verify. |
|
|
130
|
+
| `list_projects` | List all discovered monorepo sub-projects with type, scanner, and availability. |
|
|
129
131
|
|
|
130
132
|
| Resource | Description |
|
|
131
133
|
| :------- | :---------- |
|
|
@@ -149,6 +151,71 @@ See [docs/contributing.md](./docs/contributing.md) for Windows setup details.
|
|
|
149
151
|
|
|
150
152
|
---
|
|
151
153
|
|
|
154
|
+
## Supported Languages & Scanners
|
|
155
|
+
|
|
156
|
+
| Language | Extensions | AST analysis | Scanner | Setup |
|
|
157
|
+
| :------- | :--------- | :----------: | :------ | :---- |
|
|
158
|
+
| TypeScript | `.ts` `.tsx` `.mts` `.cts` | Cyclomatic complexity | ESLint | **Auto-installed** via npm |
|
|
159
|
+
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` | Cyclomatic complexity | ESLint | **Auto-installed** via npm |
|
|
160
|
+
| Python | `.py` `.pyi` | Cyclomatic complexity | Bandit | `pip install bandit` |
|
|
161
|
+
| Java | `.java` | Cyclomatic complexity | Semgrep | `brew install semgrep` |
|
|
162
|
+
| C# / .NET | `.cs` | Cyclomatic complexity | `dotnet format` | **Included in .NET SDK** |
|
|
163
|
+
| Dart / Flutter | `.dart` | LOC only | `dart analyze` | **Included in Dart/Flutter SDK** |
|
|
164
|
+
| Vue | `.vue` | LOC only | ESLint (via root config) | Auto with TypeScript |
|
|
165
|
+
| Go | `.go` | LOC only | — | — |
|
|
166
|
+
| Rust | `.rs` | LOC only | — | — |
|
|
167
|
+
| Ruby | `.rb` | LOC only | — | — |
|
|
168
|
+
| PHP | `.php` | LOC only | — | — |
|
|
169
|
+
| Swift | `.swift` | LOC only | — | — |
|
|
170
|
+
| Kotlin | `.kt` | LOC only | — | — |
|
|
171
|
+
| Scala | `.scala` | LOC only | — | — |
|
|
172
|
+
|
|
173
|
+
**AST analysis** = tree-sitter cyclomatic complexity per function.
|
|
174
|
+
**LOC only** = counted toward workspace metrics but no per-function analysis.
|
|
175
|
+
|
|
176
|
+
### Monorepo auto-discovery
|
|
177
|
+
|
|
178
|
+
In monorepos, claude-crap automatically discovers sub-projects at
|
|
179
|
+
session startup — no per-project configuration needed. The plugin
|
|
180
|
+
probes npm workspaces and common directories (`apps/`, `packages/`,
|
|
181
|
+
`libs/`, `modules/`, `services/`) to build a **project map**:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
Session start
|
|
185
|
+
→ discover project map
|
|
186
|
+
→ detect: www (TypeScript), app (TypeScript), mobile (Dart), api (C#)
|
|
187
|
+
→ ESLint not installed? → auto-install at monorepo root
|
|
188
|
+
→ run ESLint from root (covers all JS/TS)
|
|
189
|
+
→ run dart analyze from apps/mobile/
|
|
190
|
+
→ run dotnet format from apps/api/
|
|
191
|
+
→ aggregate all findings into one SARIF store
|
|
192
|
+
→ score_project ready with real data
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The project map is persisted to `.claude-crap/projects.json` and
|
|
196
|
+
exposed via the `list_projects` MCP tool. Use `score_project` with
|
|
197
|
+
the optional `scope` parameter to score a single sub-project:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
// Score only the mobile app
|
|
201
|
+
score_project({ format: "both", scope: "mobile" })
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**File exclusions** are centralized and cover all major frameworks
|
|
205
|
+
out of the box: `dist/`, `build/`, `bundle/`, `vendor/`,
|
|
206
|
+
`.next`, `.nuxt`, `.astro`, `.svelte-kit`, `.dart_tool`,
|
|
207
|
+
`.expo`, `.angular`, `.turbo`, and more. Custom exclusions can be
|
|
208
|
+
added via `.claude-crap.json`:
|
|
209
|
+
|
|
210
|
+
```jsonc
|
|
211
|
+
{
|
|
212
|
+
"strictness": "strict",
|
|
213
|
+
"exclude": ["apps/legacy/", "generated/", "*.proto.ts"]
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
152
219
|
## Documentation
|
|
153
220
|
|
|
154
221
|
| Section | Link |
|
|
@@ -170,7 +237,7 @@ See [docs/contributing.md](./docs/contributing.md) for Windows setup details.
|
|
|
170
237
|
|
|
171
238
|
```bash
|
|
172
239
|
npm install # postinstall builds dist/ automatically
|
|
173
|
-
npm test #
|
|
240
|
+
npm test # 265 tests across 46 suites
|
|
174
241
|
npm run build:fast # esbuild dev build (10-20x faster than tsc)
|
|
175
242
|
npm run doctor # full diagnostic
|
|
176
243
|
```
|
|
@@ -21,7 +21,7 @@ import type { SarifLevel } from "../sarif/sarif-builder.js";
|
|
|
21
21
|
* `ingest_scanner_output` MCP tool uses this as its `enum` constraint,
|
|
22
22
|
* so keeping it narrow prevents drift.
|
|
23
23
|
*/
|
|
24
|
-
export declare const KNOWN_SCANNERS: readonly ["semgrep", "eslint", "bandit", "stryker"];
|
|
24
|
+
export declare const KNOWN_SCANNERS: readonly ["semgrep", "eslint", "bandit", "stryker", "dart_analyze", "dotnet_format"];
|
|
25
25
|
/**
|
|
26
26
|
* Union of supported scanner identifiers.
|
|
27
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,cAAc,sFAAuF,CAAC;AAEnH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAK1E,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,gFAAgF;IAChF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,YAAY,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAC7B,cAAc,CAgBhB;AAyBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9F"}
|
package/dist/adapters/common.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* `ingest_scanner_output` MCP tool uses this as its `enum` constraint,
|
|
20
20
|
* so keeping it narrow prevents drift.
|
|
21
21
|
*/
|
|
22
|
-
export const KNOWN_SCANNERS = ["semgrep", "eslint", "bandit", "stryker"];
|
|
22
|
+
export const KNOWN_SCANNERS = ["semgrep", "eslint", "bandit", "stryker", "dart_analyze", "dotnet_format"];
|
|
23
23
|
/**
|
|
24
24
|
* Default remediation effort in minutes per SARIF severity level. These
|
|
25
25
|
* numbers are deliberately conservative — real projects should override
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;GAIG;AACH,MA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AC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: `dart analyze --format=json` → SARIF 2.1.0.
|
|
3
|
+
*
|
|
4
|
+
* The Dart analyzer emits JSON with this shape:
|
|
5
|
+
*
|
|
6
|
+
* {
|
|
7
|
+
* "version": 1,
|
|
8
|
+
* "diagnostics": [
|
|
9
|
+
* {
|
|
10
|
+
* "code": "unused_import",
|
|
11
|
+
* "severity": "WARNING",
|
|
12
|
+
* "type": "STATIC_WARNING",
|
|
13
|
+
* "location": {
|
|
14
|
+
* "file": "/absolute/path/to/file.dart",
|
|
15
|
+
* "range": {
|
|
16
|
+
* "start": { "offset": 7, "line": 1, "column": 8 },
|
|
17
|
+
* "end": { "offset": 16, "line": 1, "column": 17 }
|
|
18
|
+
* }
|
|
19
|
+
* },
|
|
20
|
+
* "problemMessage": "Unused import: 'dart:io'.",
|
|
21
|
+
* "correctionMessage": "Try removing the import directive.",
|
|
22
|
+
* "documentation": "https://dart.dev/diagnostics/unused_import"
|
|
23
|
+
* }
|
|
24
|
+
* ]
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* Severity mapping:
|
|
28
|
+
* - "ERROR" → SARIF "error" (30 min effort)
|
|
29
|
+
* - "WARNING" → SARIF "warning" (15 min effort)
|
|
30
|
+
* - "INFO" → SARIF "note" (5 min effort)
|
|
31
|
+
*
|
|
32
|
+
* @module adapters/dart-analyzer
|
|
33
|
+
*/
|
|
34
|
+
import { type AdapterResult } from "./common.js";
|
|
35
|
+
/**
|
|
36
|
+
* Convert `dart analyze --format=json` output to SARIF 2.1.0.
|
|
37
|
+
*
|
|
38
|
+
* @param rawOutput The JSON string or pre-parsed object from `dart analyze`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function adaptDartAnalyzer(rawOutput: unknown): AdapterResult;
|
|
41
|
+
//# sourceMappingURL=dart-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dart-analyzer.d.ts","sourceRoot":"","sources":["../../src/adapters/dart-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AAsDrB;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,CA+DnE"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: `dart analyze --format=json` → SARIF 2.1.0.
|
|
3
|
+
*
|
|
4
|
+
* The Dart analyzer emits JSON with this shape:
|
|
5
|
+
*
|
|
6
|
+
* {
|
|
7
|
+
* "version": 1,
|
|
8
|
+
* "diagnostics": [
|
|
9
|
+
* {
|
|
10
|
+
* "code": "unused_import",
|
|
11
|
+
* "severity": "WARNING",
|
|
12
|
+
* "type": "STATIC_WARNING",
|
|
13
|
+
* "location": {
|
|
14
|
+
* "file": "/absolute/path/to/file.dart",
|
|
15
|
+
* "range": {
|
|
16
|
+
* "start": { "offset": 7, "line": 1, "column": 8 },
|
|
17
|
+
* "end": { "offset": 16, "line": 1, "column": 17 }
|
|
18
|
+
* }
|
|
19
|
+
* },
|
|
20
|
+
* "problemMessage": "Unused import: 'dart:io'.",
|
|
21
|
+
* "correctionMessage": "Try removing the import directive.",
|
|
22
|
+
* "documentation": "https://dart.dev/diagnostics/unused_import"
|
|
23
|
+
* }
|
|
24
|
+
* ]
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* Severity mapping:
|
|
28
|
+
* - "ERROR" → SARIF "error" (30 min effort)
|
|
29
|
+
* - "WARNING" → SARIF "warning" (15 min effort)
|
|
30
|
+
* - "INFO" → SARIF "note" (5 min effort)
|
|
31
|
+
*
|
|
32
|
+
* @module adapters/dart-analyzer
|
|
33
|
+
*/
|
|
34
|
+
import { wrapResultsInSarif, estimateEffortMinutes, } from "./common.js";
|
|
35
|
+
// ── Severity mapping ───────────────────────────────────────────────
|
|
36
|
+
function mapSeverity(dartSeverity) {
|
|
37
|
+
switch (dartSeverity.toUpperCase()) {
|
|
38
|
+
case "ERROR":
|
|
39
|
+
return "error";
|
|
40
|
+
case "WARNING":
|
|
41
|
+
return "warning";
|
|
42
|
+
case "INFO":
|
|
43
|
+
return "note";
|
|
44
|
+
default:
|
|
45
|
+
return "warning";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// ── Effort estimates per severity ──────────────────────────────────
|
|
49
|
+
const EFFORT_BY_SEVERITY = {
|
|
50
|
+
error: 30,
|
|
51
|
+
warning: 15,
|
|
52
|
+
note: 5,
|
|
53
|
+
none: 0,
|
|
54
|
+
};
|
|
55
|
+
// ── Public API ─────────────────────────────────────────────────────
|
|
56
|
+
/**
|
|
57
|
+
* Convert `dart analyze --format=json` output to SARIF 2.1.0.
|
|
58
|
+
*
|
|
59
|
+
* @param rawOutput The JSON string or pre-parsed object from `dart analyze`.
|
|
60
|
+
*/
|
|
61
|
+
export function adaptDartAnalyzer(rawOutput) {
|
|
62
|
+
let parsed;
|
|
63
|
+
if (typeof rawOutput === "string") {
|
|
64
|
+
try {
|
|
65
|
+
parsed = JSON.parse(rawOutput);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
throw new Error("[dart-analyzer adapter] rawOutput is not valid JSON");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (rawOutput && typeof rawOutput === "object" && "diagnostics" in rawOutput) {
|
|
72
|
+
parsed = rawOutput;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
throw new Error("[dart-analyzer adapter] rawOutput must be a JSON string or an object with a 'diagnostics' array");
|
|
76
|
+
}
|
|
77
|
+
if (!Array.isArray(parsed.diagnostics)) {
|
|
78
|
+
throw new Error("[dart-analyzer adapter] 'diagnostics' must be an array");
|
|
79
|
+
}
|
|
80
|
+
const results = [];
|
|
81
|
+
let totalEffortMinutes = 0;
|
|
82
|
+
for (const diag of parsed.diagnostics) {
|
|
83
|
+
const level = mapSeverity(diag.severity);
|
|
84
|
+
const effort = EFFORT_BY_SEVERITY[level] ?? estimateEffortMinutes(level);
|
|
85
|
+
totalEffortMinutes += effort;
|
|
86
|
+
results.push({
|
|
87
|
+
ruleId: diag.code,
|
|
88
|
+
level,
|
|
89
|
+
message: {
|
|
90
|
+
text: diag.problemMessage + (diag.correctionMessage ? ` ${diag.correctionMessage}` : ""),
|
|
91
|
+
},
|
|
92
|
+
locations: [
|
|
93
|
+
{
|
|
94
|
+
physicalLocation: {
|
|
95
|
+
artifactLocation: {
|
|
96
|
+
uri: diag.location.file,
|
|
97
|
+
},
|
|
98
|
+
region: {
|
|
99
|
+
startLine: diag.location.range.start.line,
|
|
100
|
+
startColumn: diag.location.range.start.column,
|
|
101
|
+
endLine: diag.location.range.end.line,
|
|
102
|
+
endColumn: diag.location.range.end.column,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
properties: {
|
|
108
|
+
effortMinutes: effort,
|
|
109
|
+
...(diag.documentation ? { helpUri: diag.documentation } : {}),
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
document: wrapResultsInSarif("dart_analyze", "1.0.0", results),
|
|
115
|
+
sourceTool: "dart_analyze",
|
|
116
|
+
findingCount: parsed.diagnostics.length,
|
|
117
|
+
totalEffortMinutes,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=dart-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dart-analyzer.js","sourceRoot":"","sources":["../../src/adapters/dart-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,GACtB,MA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,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM;QACvC,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: `dotnet format --report <path>` JSON output → SARIF 2.1.0.
|
|
3
|
+
*
|
|
4
|
+
* The dotnet format tool emits a JSON array with this shape:
|
|
5
|
+
*
|
|
6
|
+
* [
|
|
7
|
+
* {
|
|
8
|
+
* "DocumentId": { "ProjectId": { "Id": "..." }, "Id": "..." },
|
|
9
|
+
* "FileName": "AuthController.cs",
|
|
10
|
+
* "FilePath": "/absolute/path/to/AuthController.cs",
|
|
11
|
+
* "FileChanges": [
|
|
12
|
+
* {
|
|
13
|
+
* "LineNumber": 84,
|
|
14
|
+
* "CharNumber": 16,
|
|
15
|
+
* "DiagnosticId": "WHITESPACE",
|
|
16
|
+
* "FormatDescription": "Fix whitespace formatting. Delete 5 characters."
|
|
17
|
+
* }
|
|
18
|
+
* ]
|
|
19
|
+
* }
|
|
20
|
+
* ]
|
|
21
|
+
*
|
|
22
|
+
* All dotnet format findings are style/formatting issues, so they
|
|
23
|
+
* map uniformly to SARIF "warning" level with a 5-minute effort
|
|
24
|
+
* estimate (formatting fixes are quick, mechanical changes).
|
|
25
|
+
*
|
|
26
|
+
* @module adapters/dotnet-format
|
|
27
|
+
*/
|
|
28
|
+
import { type AdapterResult } from "./common.js";
|
|
29
|
+
/**
|
|
30
|
+
* Convert `dotnet format --report <path>` JSON output to SARIF 2.1.0.
|
|
31
|
+
*
|
|
32
|
+
* @param rawOutput The JSON string or pre-parsed array from `dotnet format`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function adaptDotnetFormat(rawOutput: unknown): AdapterResult;
|
|
35
|
+
//# sourceMappingURL=dotnet-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotnet-format.d.ts","sourceRoot":"","sources":["../../src/adapters/dotnet-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,aAAa,CAAC;AAuBrB;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,CAiEnE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: `dotnet format --report <path>` JSON output → SARIF 2.1.0.
|
|
3
|
+
*
|
|
4
|
+
* The dotnet format tool emits a JSON array with this shape:
|
|
5
|
+
*
|
|
6
|
+
* [
|
|
7
|
+
* {
|
|
8
|
+
* "DocumentId": { "ProjectId": { "Id": "..." }, "Id": "..." },
|
|
9
|
+
* "FileName": "AuthController.cs",
|
|
10
|
+
* "FilePath": "/absolute/path/to/AuthController.cs",
|
|
11
|
+
* "FileChanges": [
|
|
12
|
+
* {
|
|
13
|
+
* "LineNumber": 84,
|
|
14
|
+
* "CharNumber": 16,
|
|
15
|
+
* "DiagnosticId": "WHITESPACE",
|
|
16
|
+
* "FormatDescription": "Fix whitespace formatting. Delete 5 characters."
|
|
17
|
+
* }
|
|
18
|
+
* ]
|
|
19
|
+
* }
|
|
20
|
+
* ]
|
|
21
|
+
*
|
|
22
|
+
* All dotnet format findings are style/formatting issues, so they
|
|
23
|
+
* map uniformly to SARIF "warning" level with a 5-minute effort
|
|
24
|
+
* estimate (formatting fixes are quick, mechanical changes).
|
|
25
|
+
*
|
|
26
|
+
* @module adapters/dotnet-format
|
|
27
|
+
*/
|
|
28
|
+
import { wrapResultsInSarif, } from "./common.js";
|
|
29
|
+
// ── Public API ─────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Convert `dotnet format --report <path>` JSON output to SARIF 2.1.0.
|
|
32
|
+
*
|
|
33
|
+
* @param rawOutput The JSON string or pre-parsed array from `dotnet format`.
|
|
34
|
+
*/
|
|
35
|
+
export function adaptDotnetFormat(rawOutput) {
|
|
36
|
+
let parsed;
|
|
37
|
+
if (typeof rawOutput === "string") {
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(rawOutput);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error("[dotnet-format adapter] rawOutput is not valid JSON");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (Array.isArray(rawOutput)) {
|
|
46
|
+
parsed = rawOutput;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new Error("[dotnet-format adapter] rawOutput must be a JSON string or an array of document entries");
|
|
50
|
+
}
|
|
51
|
+
if (!Array.isArray(parsed)) {
|
|
52
|
+
throw new Error("[dotnet-format adapter] parsed output must be an array");
|
|
53
|
+
}
|
|
54
|
+
const EFFORT_MINUTES = 5;
|
|
55
|
+
const results = [];
|
|
56
|
+
let findingCount = 0;
|
|
57
|
+
let totalEffortMinutes = 0;
|
|
58
|
+
for (const doc of parsed) {
|
|
59
|
+
if (!Array.isArray(doc.FileChanges))
|
|
60
|
+
continue;
|
|
61
|
+
for (const change of doc.FileChanges) {
|
|
62
|
+
findingCount++;
|
|
63
|
+
totalEffortMinutes += EFFORT_MINUTES;
|
|
64
|
+
results.push({
|
|
65
|
+
ruleId: change.DiagnosticId,
|
|
66
|
+
level: "warning",
|
|
67
|
+
message: {
|
|
68
|
+
text: change.FormatDescription,
|
|
69
|
+
},
|
|
70
|
+
locations: [
|
|
71
|
+
{
|
|
72
|
+
physicalLocation: {
|
|
73
|
+
artifactLocation: {
|
|
74
|
+
uri: doc.FilePath,
|
|
75
|
+
},
|
|
76
|
+
region: {
|
|
77
|
+
startLine: change.LineNumber,
|
|
78
|
+
startColumn: change.CharNumber,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
properties: {
|
|
84
|
+
effortMinutes: EFFORT_MINUTES,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
document: wrapResultsInSarif("dotnet_format", "1.0.0", results),
|
|
91
|
+
sourceTool: "dotnet_format",
|
|
92
|
+
findingCount,
|
|
93
|
+
totalEffortMinutes,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=dotnet-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotnet-format.js","sourceRoot":"","sources":["../../src/adapters/dotnet-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAEL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAqBrB,sEAAsE;AAEtE;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAkB;IAClD,IAAI,MAA8B,CAAC;IAEnC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAA2B,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACpC,MAAM,GAAG,SAAmC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,cAAc,GAAG,CAAC,CAAC;IACzB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,kBAAkB,GAAG,CAAC,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;YAAE,SAAS;QAE9C,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;YACrC,YAAY,EAAE,CAAC;YACf,kBAAkB,IAAI,cAAc,CAAC;YAErC,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM,EAAE,MAAM,CAAC,YAAY;gBAC3B,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,CAAC,iBAAiB;iBAC/B;gBACD,SAAS,EAAE;oBACT;wBACE,gBAAgB,EAAE;4BAChB,gBAAgB,EAAE;gCAChB,GAAG,EAAE,GAAG,CAAC,QAAQ;6BAClB;4BACD,MAAM,EAAE;gCACN,SAAS,EAAE,MAAM,CAAC,UAAU;gCAC5B,WAAW,EAAE,MAAM,CAAC,UAAU;6BAC/B;yBACF;qBACF;iBACF;gBACD,UAAU,EAAE;oBACV,aAAa,EAAE,cAAc;iBAC9B;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC;QAC/D,UAAU,EAAE,eAAe;QAC3B,YAAY;QACZ,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export { adaptSemgrep } from "./semgrep.js";
|
|
|
29
29
|
export { adaptEslint } from "./eslint.js";
|
|
30
30
|
export { adaptBandit } from "./bandit.js";
|
|
31
31
|
export { adaptStryker } from "./stryker.js";
|
|
32
|
+
export { adaptDartAnalyzer } from "./dart-analyzer.js";
|
|
33
|
+
export { adaptDotnetFormat } from "./dotnet-format.js";
|
|
32
34
|
export { DEFAULT_EFFORT_BY_SEVERITY, KNOWN_SCANNERS, estimateEffortMinutes, wrapResultsInSarif, } from "./common.js";
|
|
33
35
|
export type { AdapterResult, KnownScanner } from "./common.js";
|
|
34
36
|
import type { AdapterResult, KnownScanner } from "./common.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ/D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,OAAO,GACjB,aAAa,CAmBf"}
|
package/dist/adapters/index.js
CHANGED
|
@@ -29,11 +29,15 @@ export { adaptSemgrep } from "./semgrep.js";
|
|
|
29
29
|
export { adaptEslint } from "./eslint.js";
|
|
30
30
|
export { adaptBandit } from "./bandit.js";
|
|
31
31
|
export { adaptStryker } from "./stryker.js";
|
|
32
|
+
export { adaptDartAnalyzer } from "./dart-analyzer.js";
|
|
33
|
+
export { adaptDotnetFormat } from "./dotnet-format.js";
|
|
32
34
|
export { DEFAULT_EFFORT_BY_SEVERITY, KNOWN_SCANNERS, estimateEffortMinutes, wrapResultsInSarif, } from "./common.js";
|
|
33
35
|
import { adaptSemgrep } from "./semgrep.js";
|
|
34
36
|
import { adaptEslint } from "./eslint.js";
|
|
35
37
|
import { adaptBandit } from "./bandit.js";
|
|
36
38
|
import { adaptStryker } from "./stryker.js";
|
|
39
|
+
import { adaptDartAnalyzer } from "./dart-analyzer.js";
|
|
40
|
+
import { adaptDotnetFormat } from "./dotnet-format.js";
|
|
37
41
|
/**
|
|
38
42
|
* Route a raw scanner output to the correct adapter based on its
|
|
39
43
|
* name. Preferred entry point for the `ingest_scanner_output` MCP
|
|
@@ -55,6 +59,10 @@ export function adaptScannerOutput(scanner, rawOutput) {
|
|
|
55
59
|
return adaptBandit(rawOutput);
|
|
56
60
|
case "stryker":
|
|
57
61
|
return adaptStryker(rawOutput);
|
|
62
|
+
case "dart_analyze":
|
|
63
|
+
return adaptDartAnalyzer(rawOutput);
|
|
64
|
+
case "dotnet_format":
|
|
65
|
+
return adaptDotnetFormat(rawOutput);
|
|
58
66
|
default: {
|
|
59
67
|
const exhaustive = scanner;
|
|
60
68
|
throw new Error(`[adapters] Unknown scanner: ${String(exhaustive)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;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;YACjB,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACtC,KAAK,eAAe;YAClB,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,UAAU,GAAU,OAAO,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/crap-config.d.ts
CHANGED
|
@@ -70,6 +70,10 @@ export interface CrapConfig {
|
|
|
70
70
|
readonly strictness: Strictness;
|
|
71
71
|
/** Where the strictness value actually came from. Useful for diagnostics. */
|
|
72
72
|
readonly strictnessSource: "env" | "file" | "default";
|
|
73
|
+
/** User-defined exclusion patterns (directories with trailing `/`, or file globs). */
|
|
74
|
+
readonly exclude: ReadonlyArray<string>;
|
|
75
|
+
/** Relative paths to directories containing sub-projects (e.g. `["apps", "packages"]`). */
|
|
76
|
+
readonly projectDirs: ReadonlyArray<string>;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Options accepted by {@link loadCrapConfig}. The only required
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crap-config.d.ts","sourceRoot":"","sources":["../src/crap-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,yCAA0C,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAqB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,QAAQ,C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