checkchange 0.4.1 → 0.4.3
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 +421 -106
- package/dist/attribution.d.ts +1 -8
- package/dist/attribution.js +15 -1
- package/dist/auto-coverage.js +7 -1
- package/dist/cache.js +62 -6
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +40 -2
- package/dist/complexity-providers/csharpComplexityProvider.d.ts +9 -0
- package/dist/complexity-providers/csharpComplexityProvider.js +142 -0
- package/dist/complexity-providers/csharpDescriptorProvider.d.ts +84 -0
- package/dist/complexity-providers/csharpDescriptorProvider.js +397 -0
- package/dist/complexity-providers/csharpFallbackParser.d.ts +17 -0
- package/dist/complexity-providers/csharpFallbackParser.js +422 -0
- package/dist/complexity-providers/pythonASTComplexityProvider.js +18 -1
- package/dist/complexity.d.ts +51 -0
- package/dist/complexity.js +38 -0
- package/dist/coverage-providers/coberturaProvider.d.ts +28 -0
- package/dist/coverage-providers/coberturaProvider.js +188 -0
- package/dist/coverage.d.ts +87 -0
- package/dist/coverage.js +270 -6
- package/dist/crapCalc.d.ts +1 -1
- package/dist/crapCalc.js +1 -1
- package/dist/evidence.d.ts +2 -2
- package/dist/evidence.js +46 -15
- package/dist/help.js +4 -3
- package/dist/providers/config.d.ts +0 -1
- package/dist/providers/config.js +62 -2
- package/dist/providers/prepare.d.ts +5 -2
- package/dist/providers/prepare.js +123 -15
- package/dist/rules.d.ts +1 -1
- package/dist/rules.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,76 +1,324 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CheckChange
|
|
2
2
|
|
|
3
|
-
Independent, deterministic evidence
|
|
3
|
+
**Independent, deterministic evidence for AI-assisted software development.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[](.nvmrc)
|
|
5
|
+
AI coding tools can make a lot of software changes very quickly. That's useful, but it also creates a new question:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
**How do we independently check the change without simply asking another AI what it thinks?**
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
That's what CheckChange is for.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
CheckChange looks at the functions changed in a Git repository and uses measurable evidence such as complexity, test coverage, coverage attribution, and deterministic CRAP calculations to produce evidence about the change.
|
|
12
|
+
|
|
13
|
+
It is not trying to decide whether the code is correct. It is not another AI code reviewer. It gives developers, CI systems, and other tools something concrete to look at.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## What it does
|
|
19
|
+
|
|
20
|
+
At a high level:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
Git change
|
|
24
|
+
↓
|
|
25
|
+
Changed functions
|
|
26
|
+
↓
|
|
27
|
+
Complexity + coverage
|
|
28
|
+
↓
|
|
29
|
+
Coverage attribution
|
|
30
|
+
↓
|
|
31
|
+
CRAP calculation
|
|
32
|
+
↓
|
|
33
|
+
Deterministic rules
|
|
34
|
+
↓
|
|
35
|
+
Evidence
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The result tells you what CheckChange was able to establish about the change, rather than pretending that missing evidence is the same thing as good evidence.
|
|
39
|
+
|
|
40
|
+
For example, a changed function might produce:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Complexity
|
|
44
|
+
12 → 17
|
|
45
|
+
|
|
46
|
+
Coverage
|
|
47
|
+
84% → 61%
|
|
48
|
+
|
|
49
|
+
CRAP
|
|
50
|
+
increased
|
|
51
|
+
|
|
52
|
+
Result
|
|
53
|
+
WARN
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
That does **not** mean the function is defective. It means there is evidence worth looking at.
|
|
57
|
+
|
|
58
|
+
CheckChange is intended to be used as:
|
|
59
|
+
|
|
60
|
+
- a developer-side check
|
|
61
|
+
- a CI step
|
|
62
|
+
- a pull-request signal
|
|
63
|
+
- an input to another automated system
|
|
64
|
+
- an independent verification step after an AI coding agent makes a change
|
|
65
|
+
|
|
66
|
+
The important part is the separation:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
AI coding agent
|
|
70
|
+
|
|
|
71
|
+
| makes a change
|
|
72
|
+
v
|
|
73
|
+
CheckChange
|
|
74
|
+
|
|
|
75
|
+
| produces evidence
|
|
76
|
+
v
|
|
77
|
+
Human / CI / downstream system
|
|
78
|
+
|
|
|
79
|
+
v
|
|
80
|
+
decision
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The system that made the change does not get to decide whether the evidence is sufficient.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## What CheckChange is not
|
|
88
|
+
|
|
89
|
+
CheckChange does **not** claim to:
|
|
90
|
+
|
|
91
|
+
- prove that code is correct
|
|
92
|
+
- predict defects
|
|
93
|
+
- replace human code review
|
|
94
|
+
- replace testing
|
|
95
|
+
- certify production readiness
|
|
96
|
+
- provide a universal software-quality score
|
|
97
|
+
|
|
98
|
+
A `PASS` means the available evidence satisfied the applicable deterministic rules.
|
|
99
|
+
|
|
100
|
+
A `WARN` means the evidence crossed a condition worth investigating.
|
|
101
|
+
|
|
102
|
+
An `INCOMPLETE` or `NOT_EVALUATED` result means CheckChange could not establish everything needed for a meaningful evaluation.
|
|
103
|
+
|
|
104
|
+
Those are evidence states, not judgments about whether the software is ultimately good or bad.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
# Install
|
|
109
|
+
|
|
110
|
+
The package is published on npm as `checkchange`.
|
|
111
|
+
|
|
112
|
+
Current registry version: **0.4.2**
|
|
113
|
+
|
|
114
|
+
### npm
|
|
13
115
|
|
|
14
116
|
```bash
|
|
15
117
|
npm install -g checkchange
|
|
16
|
-
|
|
118
|
+
checkchange --help
|
|
17
119
|
```
|
|
18
120
|
|
|
121
|
+
Or use it without installing globally:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx checkchange check --base main --json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### pnpm
|
|
128
|
+
|
|
19
129
|
```bash
|
|
20
130
|
pnpm add -g checkchange
|
|
21
|
-
pnpm dlx checkchange check --base main --json
|
|
22
131
|
```
|
|
23
132
|
|
|
133
|
+
Or:
|
|
134
|
+
|
|
24
135
|
```bash
|
|
25
|
-
|
|
26
|
-
npx checkchange check --base main --json
|
|
136
|
+
pnpm dlx checkchange check --base main --json
|
|
27
137
|
```
|
|
28
138
|
|
|
29
|
-
### From
|
|
139
|
+
### From source
|
|
30
140
|
|
|
31
141
|
```bash
|
|
32
142
|
git clone https://github.com/victor-petropoulos/CheckChange.git
|
|
33
143
|
cd CheckChange
|
|
144
|
+
|
|
34
145
|
corepack enable
|
|
35
146
|
pnpm install --frozen-lockfile
|
|
36
147
|
pnpm run build
|
|
148
|
+
|
|
37
149
|
node dist/cli.js check --base main --json
|
|
38
150
|
```
|
|
39
151
|
|
|
40
|
-
|
|
152
|
+
---
|
|
41
153
|
|
|
42
|
-
|
|
154
|
+
# Requirements
|
|
43
155
|
|
|
44
|
-
|
|
156
|
+
- Node **24**
|
|
157
|
+
- pnpm **11.17.0**
|
|
158
|
+
- Git
|
|
45
159
|
|
|
46
|
-
|
|
47
|
-
- pnpm 11.17.0 (`package.json:5`)
|
|
160
|
+
The repository includes an `.nvmrc` and the required pnpm version is specified in `package.json`.
|
|
48
161
|
|
|
49
|
-
|
|
162
|
+
For repositories using the Python analysis path, Python 3 plus the relevant testing/coverage tooling may also be required. For C# repositories, the .NET SDK is optional — without it, CheckChange analyses `.cs` files via a pure-TypeScript fallback parser in degraded mode rather than failing.
|
|
50
163
|
|
|
51
|
-
|
|
164
|
+
---
|
|
52
165
|
|
|
53
|
-
|
|
166
|
+
# Quickstart
|
|
54
167
|
|
|
55
|
-
|
|
168
|
+
If you are working from a source checkout:
|
|
56
169
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- **Where/who**: any git repo that produces coverage output — a PR pipeline, a developer's pre-commit hook, or an AI coding agent checking its own change. The latter two are common setups; this CLI installs neither.
|
|
62
|
-
- **Verified CI output formats**: `--format github|junit|sarif` (`src/help.ts:39`).
|
|
170
|
+
```bash
|
|
171
|
+
pnpm install
|
|
172
|
+
pnpm run build
|
|
173
|
+
```
|
|
63
174
|
|
|
64
|
-
|
|
175
|
+
Then run:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
node dist/cli.js check --base main --json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
If CheckChange is installed globally:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
checkchange check --base main --json
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
You can also run the project's own test suite with:
|
|
65
188
|
|
|
66
189
|
```bash
|
|
67
190
|
pnpm exec vitest run --coverage
|
|
68
191
|
```
|
|
69
192
|
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
# Basic usage
|
|
196
|
+
|
|
197
|
+
The three most common starting points are:
|
|
198
|
+
|
|
70
199
|
```bash
|
|
71
|
-
|
|
200
|
+
checkchange check --base main --json
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Analyze the changes relative to `main` and produce machine-readable evidence.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
checkchange check --crap-threshold 25 --format github
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Run the analysis with a custom CRAP threshold and GitHub-oriented output.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
checkchange check --auto-coverage --verbose
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Allow CheckChange to detect/configure the appropriate coverage path and show additional diagnostic information.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
# Commands
|
|
220
|
+
|
|
221
|
+
| Command | Purpose |
|
|
222
|
+
|---|---|
|
|
223
|
+
| `check` | Analyze changed functions and produce evidence |
|
|
224
|
+
| `doctor` | Check runtime and repository prerequisites |
|
|
225
|
+
| `prepare-repo` | Detect, plan, approve, install, and verify test/coverage tooling |
|
|
226
|
+
| `explain` | Explain the rationale behind a result |
|
|
227
|
+
| `trace` | Show the evidence trace for a function |
|
|
228
|
+
| `delta` | Compare evidence between two states |
|
|
229
|
+
|
|
230
|
+
Run:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
checkchange --help
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
for the current command and option list.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
# Configuration
|
|
241
|
+
|
|
242
|
+
Some of the most useful options are:
|
|
243
|
+
|
|
244
|
+
| Option | Description | Default |
|
|
245
|
+
|---|---|---|
|
|
246
|
+
| `--base <ref>` | Git base reference for the change | auto-detect |
|
|
247
|
+
| `--crap-threshold <n>` | CRAP warning threshold | `30` |
|
|
248
|
+
| `--coverage-file <path>` | Explicit coverage file | auto-detect |
|
|
249
|
+
| `--format <github\|junit\|sarif>` | CI output format | none |
|
|
250
|
+
| `--json` | Produce machine-readable evidence | off |
|
|
251
|
+
| `--verbose` | Show additional diagnostics | off |
|
|
252
|
+
| `--auto-coverage` | Attempt automatic coverage setup | off |
|
|
253
|
+
|
|
254
|
+
The base reference is automatically detected when `--base` is not supplied.
|
|
255
|
+
|
|
256
|
+
Provider configuration can be supplied explicitly or discovered from the repository.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
# Supported languages and coverage
|
|
261
|
+
|
|
262
|
+
The current implementation supports analysis for:
|
|
263
|
+
|
|
264
|
+
- TypeScript
|
|
265
|
+
- JavaScript
|
|
266
|
+
- Python
|
|
267
|
+
- C#
|
|
268
|
+
|
|
269
|
+
Coverage can be supplied through the supported coverage paths, including Istanbul-compatible coverage, LCOV, and Coverlet Cobertura XML.
|
|
270
|
+
|
|
271
|
+
CheckChange also supports CI-oriented output formats:
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
github
|
|
275
|
+
junit
|
|
276
|
+
sarif
|
|
72
277
|
```
|
|
73
278
|
|
|
279
|
+
The supported provider/configuration surface is intentionally narrower than "anything that can produce a coverage report." Check the current documentation before assuming a particular repository or coverage setup is supported.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
# How the analysis works
|
|
284
|
+
|
|
285
|
+
The current pipeline is roughly:
|
|
286
|
+
|
|
287
|
+
1. **Git diff**
|
|
288
|
+
Determine what changed relative to the selected base.
|
|
289
|
+
|
|
290
|
+
2. **Changed functions**
|
|
291
|
+
Identify the functions affected by the change.
|
|
292
|
+
|
|
293
|
+
3. **Complexity**
|
|
294
|
+
Measure complexity using the appropriate provider.
|
|
295
|
+
|
|
296
|
+
4. **Coverage**
|
|
297
|
+
Find available test-coverage evidence.
|
|
298
|
+
|
|
299
|
+
5. **Attribution**
|
|
300
|
+
Associate coverage evidence with the changed functions.
|
|
301
|
+
|
|
302
|
+
6. **CRAP calculation**
|
|
303
|
+
Combine complexity and coverage into the deterministic CRAP signal.
|
|
304
|
+
|
|
305
|
+
7. **Rules**
|
|
306
|
+
Apply the project's deterministic rules and thresholds.
|
|
307
|
+
|
|
308
|
+
8. **Evidence**
|
|
309
|
+
Produce the structured evidence result.
|
|
310
|
+
|
|
311
|
+
9. **Output**
|
|
312
|
+
Present the result for a developer, CI system, or another machine.
|
|
313
|
+
|
|
314
|
+
The evidence output includes information about completeness and provenance so that a number is not presented without context.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
# Example
|
|
319
|
+
|
|
320
|
+
A typical machine-readable result looks roughly like:
|
|
321
|
+
|
|
74
322
|
```json
|
|
75
323
|
{
|
|
76
324
|
"schemaVersion": "0.5",
|
|
@@ -78,11 +326,6 @@ node dist/cli.js check --base main --json
|
|
|
78
326
|
"base": "<resolved-base-sha>",
|
|
79
327
|
"target": "current"
|
|
80
328
|
},
|
|
81
|
-
"capabilities": {
|
|
82
|
-
"git": "available",
|
|
83
|
-
"complexity": "unavailable",
|
|
84
|
-
"coverageArtifact": "unavailable"
|
|
85
|
-
},
|
|
86
329
|
"changedFunctions": [],
|
|
87
330
|
"ruleResults": [],
|
|
88
331
|
"policy": {
|
|
@@ -94,123 +337,195 @@ node dist/cli.js check --base main --json
|
|
|
94
337
|
}
|
|
95
338
|
```
|
|
96
339
|
|
|
97
|
-
|
|
340
|
+
The exact output depends on the repository and evidence available.
|
|
341
|
+
|
|
342
|
+
For example, a clean checkout may have no changed functions. In that case there is nothing to evaluate and `NOT_EVALUATED` is a valid result.
|
|
343
|
+
|
|
344
|
+
You can use:
|
|
98
345
|
|
|
99
346
|
```bash
|
|
100
|
-
|
|
347
|
+
checkchange doctor
|
|
101
348
|
```
|
|
102
349
|
|
|
350
|
+
to see why a repository is or is not ready for analysis.
|
|
351
|
+
|
|
352
|
+
Example:
|
|
353
|
+
|
|
103
354
|
```text
|
|
104
355
|
gitExecutable: ok
|
|
105
356
|
gitRepo: ok
|
|
106
357
|
defaultBase: ok (origin/main)
|
|
358
|
+
|
|
107
359
|
providerAvailability: no-changed-files
|
|
108
|
-
↳ no changed files detected against the base
|
|
360
|
+
↳ no changed files detected against the base
|
|
361
|
+
|
|
109
362
|
coverageArtifact: present
|
|
110
363
|
```
|
|
111
364
|
|
|
112
|
-
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
# Why the evidence matters
|
|
113
368
|
|
|
114
|
-
|
|
369
|
+
One of the design goals of CheckChange is to distinguish **"we measured it"** from **"we don't have enough evidence."**
|
|
370
|
+
|
|
371
|
+
For example:
|
|
372
|
+
|
|
373
|
+
```text
|
|
374
|
+
Coverage: 72%
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
is less useful than:
|
|
378
|
+
|
|
379
|
+
```text
|
|
380
|
+
Coverage: 72%
|
|
381
|
+
Evidence: ATTRIBUTED
|
|
382
|
+
Provider: LCOV
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
And that is still different from:
|
|
386
|
+
|
|
387
|
+
```text
|
|
388
|
+
Coverage: unavailable
|
|
389
|
+
Completeness: INCOMPLETE
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
The goal is to make those distinctions visible rather than hide them behind a single score.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
# Deterministic by design
|
|
397
|
+
|
|
398
|
+
The core evidence pipeline does not use an LLM to decide whether a change looks risky.
|
|
399
|
+
|
|
400
|
+
Given the same relevant inputs and CheckChange version, the goal is reproducible evidence.
|
|
401
|
+
|
|
402
|
+
That makes the output suitable for:
|
|
403
|
+
|
|
404
|
+
- CI
|
|
405
|
+
- automated workflows
|
|
406
|
+
- comparison between runs
|
|
407
|
+
- downstream AI systems
|
|
408
|
+
- human review
|
|
409
|
+
|
|
410
|
+
An AI system can consume the evidence if that's useful. CheckChange itself does not need to become another AI reviewer.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
# CI
|
|
415
|
+
|
|
416
|
+
CheckChange can produce output intended for CI systems, including:
|
|
115
417
|
|
|
116
418
|
```bash
|
|
117
|
-
checkchange check --
|
|
419
|
+
checkchange check --format github
|
|
118
420
|
```
|
|
119
421
|
|
|
120
422
|
```bash
|
|
121
|
-
checkchange check --
|
|
423
|
+
checkchange check --format junit
|
|
122
424
|
```
|
|
123
425
|
|
|
124
426
|
```bash
|
|
125
|
-
checkchange check --
|
|
427
|
+
checkchange check --format sarif
|
|
126
428
|
```
|
|
127
429
|
|
|
128
|
-
|
|
430
|
+
Machine-readable JSON is also available:
|
|
129
431
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
| `doctor` | Verify runtime prerequisites (Node, pnpm, coverage, git) |
|
|
134
|
-
| `prepare-repo` | Bootstrap test runners & coverage tooling (detect → plan → approve → install → verify) |
|
|
135
|
-
| `explain` | Show rule rationale for a given verdict |
|
|
136
|
-
| `trace` | Print evidence trace for a specific function |
|
|
137
|
-
| `delta` | Compare evidence between two refs |
|
|
432
|
+
```bash
|
|
433
|
+
checkchange check --json
|
|
434
|
+
```
|
|
138
435
|
|
|
139
|
-
|
|
436
|
+
This makes it possible to use the same evidence both for human-facing development workflows and automated pipelines.
|
|
140
437
|
|
|
141
|
-
|
|
438
|
+
---
|
|
142
439
|
|
|
143
|
-
|
|
440
|
+
# Dependencies and external tools
|
|
144
441
|
|
|
145
|
-
|
|
146
|
-
2. **Complexity** — per-function CRAP via `crap-typescript` (TS/JS) or Python AST (`src/complexity-providers/pythonASTComplexityProvider.ts`)
|
|
147
|
-
3. **Coverage** — map LCOV/istanbul lines to changed functions (`src/coverage-providers/lcovProvider.ts`)
|
|
148
|
-
4. **Attribution** — case-insensitive suffix match to provider-lowercased paths (`src/attribution.ts:91`)
|
|
149
|
-
5. **crapCalc** — combine complexity + coverage → CRAP score (`src/crapCalc.ts:5`)
|
|
150
|
-
6. **Rules** — INV-01..04 evaluated against thresholds (`src/evidence.ts:828`)
|
|
151
|
-
7. **Evidence** — schema 0.5 (`src/evidence.ts:644`, `src/delta.ts:35`)
|
|
152
|
-
8. **Output** — human-readable summary by default; JSON via `--json`, or `--format github|junit|sarif` for CI annotations
|
|
442
|
+
CheckChange uses a small number of external packages and tools for its analysis.
|
|
153
443
|
|
|
154
|
-
|
|
444
|
+
The main runtime requirements are:
|
|
155
445
|
|
|
156
|
-
|
|
446
|
+
- Node 24
|
|
447
|
+
- pnpm 11.17.0
|
|
448
|
+
- Git
|
|
157
449
|
|
|
158
|
-
|
|
450
|
+
The supported analysis paths also use packages for TypeScript/JavaScript complexity and coverage processing, along with Python tooling where the Python analysis path is used. For C# analysis, the .NET SDK is optional — when present, CheckChange probes for a Roslyn-based vehicle (`dotnet-crap`, the Crap4DotNet 0.1.1 tool); if the SDK is available and the tool is installed, it serves rich cyclomatic complexity with a fallback bodySpan hybrid join when the vehicle succeeds; `csharp-analysis-failed` is emitted only when the vehicle itself fails (spawn error, no coverage artifact, unparseable payload, or no span join). When the SDK is absent, a `csharp-sdk-missing` diagnostic and fix proposal are emitted with the fallback parser.
|
|
159
451
|
|
|
160
|
-
|
|
161
|
-
|------|-------------|---------|
|
|
162
|
-
| `--base <ref>` | Git base ref for diff | auto-detect |
|
|
163
|
-
| `--crap-threshold <n>` | CRAP WARN threshold | 30 |
|
|
164
|
-
| `--coverage-file <path>` | Explicit LCOV/istanbul path | auto-detect |
|
|
165
|
-
| `--format <github\|junit\|sarif>` | Output format; JSON is the `--json` flag | none |
|
|
452
|
+
For the authoritative dependency versions and provider details, see `package.json` and the project documentation.
|
|
166
453
|
|
|
167
|
-
|
|
454
|
+
---
|
|
168
455
|
|
|
169
|
-
|
|
456
|
+
# Development
|
|
170
457
|
|
|
171
|
-
|
|
458
|
+
Install dependencies:
|
|
172
459
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| `@barney-media/crap-typescript-core` | 0.5.0 | Core engine: `findAllTypeScriptFilesUnderSourceRoots` + `parseFileMethods` (`src/complexity.ts:1`), `parseCoverageReport` + `coverageForMethods` (`src/coverage.ts:6`, `src/attribution.ts:1-2`), CRAP calc provenance (`src/evidence.ts:684`, `src/attribution.ts:17`) | [npm](https://www.npmjs.com/package/@barney-media/crap-typescript-core) |
|
|
460
|
+
```bash
|
|
461
|
+
pnpm install
|
|
462
|
+
```
|
|
177
463
|
|
|
178
|
-
|
|
464
|
+
Run tests:
|
|
179
465
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
466
|
+
```bash
|
|
467
|
+
pnpm test
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Run the TypeScript compiler:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
npx tsc --noEmit
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Build:
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
pnpm run build
|
|
480
|
+
```
|
|
188
481
|
|
|
189
|
-
|
|
482
|
+
Before making changes, check the repository's development documentation and current project status. CheckChange has a fairly deliberate evidence contract, and changes to evidence semantics should not be treated like ordinary refactoring.
|
|
190
483
|
|
|
191
|
-
|
|
192
|
-
|------|----------------------|---------|----------|
|
|
193
|
-
| `node` | 24 | Runtime; bin shebang `src/cli.ts:1` `#!/usr/bin/env node` | `.nvmrc:1` |
|
|
194
|
-
| `pnpm` | 11.17.0 | Install + build; `prepare` needs pnpm+tsc | `package.json:5` |
|
|
195
|
-
| `git` | system | Diff enumeration `git diff --unified=0` (`src/evidence.ts:839`), `git ls-files` (`src/complexity.ts:20`) | `src/git.ts:1,18,35,59,145` |
|
|
196
|
-
| `lcov` | file format `.info`/`.lcov` | Alternate coverage input; parsed via `parseLcovContent` (`src/coverage-providers/lcovProvider.ts:17`) | `src/coverage.ts:404,469` |
|
|
197
|
-
| `python` + `coverage.py` + `pytest` | python3 | Python stack detection + coverage conversion (`src/providers/config.ts:67-73,92-96`) | `src/coverage.ts:65,247` |
|
|
484
|
+
---
|
|
198
485
|
|
|
199
|
-
|
|
486
|
+
# Contributing
|
|
200
487
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
488
|
+
Issues and pull requests are welcome.
|
|
489
|
+
|
|
490
|
+
If you want to contribute, please keep the project's core ideas in mind:
|
|
491
|
+
|
|
492
|
+
- evidence should be deterministic where practical
|
|
493
|
+
- provenance should remain visible
|
|
494
|
+
- incomplete evidence should not be disguised as complete evidence
|
|
495
|
+
- technical behavior should be reproducible
|
|
496
|
+
- evidence and interpretation should remain separate
|
|
497
|
+
- new capabilities should be justified by actual use cases
|
|
498
|
+
|
|
499
|
+
The repository contains additional architecture, contract, testing, experiment, and development documentation.
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
# Where this is going
|
|
504
|
+
|
|
505
|
+
The immediate goal is not to turn CheckChange into a giant platform.
|
|
506
|
+
|
|
507
|
+
The more interesting question is whether an independent evidence layer becomes genuinely useful as AI-assisted development becomes more common.
|
|
508
|
+
|
|
509
|
+
The basic model is:
|
|
510
|
+
|
|
511
|
+
```text
|
|
512
|
+
AI writes
|
|
513
|
+
↓
|
|
514
|
+
CheckChange checks the change
|
|
515
|
+
↓
|
|
516
|
+
Evidence
|
|
517
|
+
↓
|
|
518
|
+
Human / CI / another system decides what to do
|
|
519
|
+
```
|
|
205
520
|
|
|
206
|
-
|
|
521
|
+
If that turns out to be useful, there is plenty more we can build around it.
|
|
207
522
|
|
|
208
|
-
|
|
523
|
+
---
|
|
209
524
|
|
|
210
|
-
|
|
525
|
+
# License
|
|
211
526
|
|
|
212
|
-
MIT — see [LICENSE
|
|
527
|
+
MIT — see [`LICENSE`](LICENSE).
|
|
213
528
|
|
|
214
|
-
|
|
529
|
+
# Changelog
|
|
215
530
|
|
|
216
|
-
See [CHANGELOG.md](CHANGELOG.md).
|
|
531
|
+
See [`CHANGELOG.md`](CHANGELOG.md).
|
package/dist/attribution.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { CoverageResult } from './coverage.js';
|
|
2
|
-
|
|
3
|
-
file: string;
|
|
4
|
-
method: string;
|
|
5
|
-
lineStart: number;
|
|
6
|
-
lineEnd: number;
|
|
7
|
-
cc: number;
|
|
8
|
-
}
|
|
2
|
+
import type { ComplexityInfo } from './complexity.js';
|
|
9
3
|
export declare const attributionProvenance: {
|
|
10
4
|
readonly tool: "@barney-media/crap-typescript-core";
|
|
11
5
|
readonly version: "0.5.0";
|
|
@@ -16,4 +10,3 @@ export interface AttributedComplexity {
|
|
|
16
10
|
coverageKind: string | null;
|
|
17
11
|
}
|
|
18
12
|
export declare function attachCoverage(complexityInfo: ComplexityInfo[], coverageResult: CoverageResult): Promise<AttributedComplexity[]>;
|
|
19
|
-
export {};
|
package/dist/attribution.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { parseFileMethods } from '@barney-media/crap-typescript-core';
|
|
2
2
|
import { coverageForMethods } from '@barney-media/crap-typescript-core';
|
|
3
3
|
import { parsePythonFileMethods } from './complexity-providers/pythonDescriptorProvider.js';
|
|
4
|
+
// Language-specific descriptor parsers. `coverageForMethods` is language-
|
|
5
|
+
// agnostic (it attributes by `bodySpan` containment), so a parser that emits
|
|
6
|
+
// the shared MethodDescriptor shape is all the join needs per language.
|
|
7
|
+
//
|
|
8
|
+
// KNOWN LIMITATION (deliberate, not an oversight): the rich vehicle's output is
|
|
9
|
+
// NOT consulted here. `csharpDescriptorProvider.isRichDescriptor`
|
|
10
|
+
// (csharpDescriptorProvider.ts:65) does not require `bodySpan`, so a descriptor
|
|
11
|
+
// set from that path can be missing the field `coverageForMethods` needs.
|
|
12
|
+
// Attribution therefore always uses the fallback parser's span. Closing that
|
|
13
|
+
// gap means teaching the rich vehicle to emit bodySpan, which is a larger
|
|
14
|
+
// change than this fix and is tracked separately.
|
|
15
|
+
import { parseCsharpFileMethods } from './complexity-providers/csharpFallbackParser.js';
|
|
4
16
|
// Provenance for the attribution lineage stage: coverageForMethods/parseFileMethods from the core package.
|
|
5
17
|
export const attributionProvenance = { tool: '@barney-media/crap-typescript-core', version: '0.5.0' };
|
|
6
18
|
export async function attachCoverage(complexityInfo, coverageResult) {
|
|
@@ -93,7 +105,9 @@ async function descriptorsForFile(filePath, descriptorCache) {
|
|
|
93
105
|
try {
|
|
94
106
|
const methodDescriptors = filePath.endsWith('.py')
|
|
95
107
|
? await parsePythonFileMethods(filePath)
|
|
96
|
-
:
|
|
108
|
+
: filePath.endsWith('.cs')
|
|
109
|
+
? await parseCsharpFileMethods(filePath)
|
|
110
|
+
: await parseFileMethods(filePath);
|
|
97
111
|
descriptorCache.set(filePath, methodDescriptors);
|
|
98
112
|
return methodDescriptors;
|
|
99
113
|
}
|