checkchange 0.4.0 → 0.4.1
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 +88 -22
- package/dist/crapCalc.d.ts +1 -1
- package/dist/crapCalc.js +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/rules.d.ts +1 -1
- package/dist/rules.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# checkchange
|
|
2
|
+
|
|
2
3
|
Independent, deterministic evidence and verification layer for AI-assisted software development.
|
|
3
4
|
|
|
4
5
|
[](LICENSE)
|
|
@@ -6,33 +7,64 @@ Independent, deterministic evidence and verification layer for AI-assisted softw
|
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Registry is live at `0.4.1` (`npm view checkchange version` → `0.4.1`).
|
|
11
|
+
|
|
12
|
+
### npm / pnpm (recommended)
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
pnpm run build
|
|
15
|
+
npm install -g checkchange
|
|
16
|
+
npx checkchange --help
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
pnpm add -g checkchange
|
|
21
|
+
pnpm dlx checkchange check --base main --json
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
```bash
|
|
25
|
+
npm install checkchange
|
|
26
|
+
npx checkchange check --base main --json
|
|
27
|
+
```
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
### From-source (GitHub clone)
|
|
25
30
|
|
|
26
31
|
```bash
|
|
27
|
-
|
|
32
|
+
git clone https://github.com/victor-petropoulos/CheckChange.git
|
|
33
|
+
cd CheckChange
|
|
34
|
+
corepack enable
|
|
35
|
+
pnpm install --frozen-lockfile
|
|
36
|
+
pnpm run build
|
|
37
|
+
node dist/cli.js check --base main --json
|
|
28
38
|
```
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
> **Warning:** Git URL install (`npm install git+https://…`) is not supported. `prepare` runs `pnpm run build` (needs pnpm + TypeScript toolchain). The npm registry tarball ships prebuilt `dist/cli.js`; from-source always builds.
|
|
41
|
+
|
|
42
|
+
The lean repo is public (125 files in the current snapshot).
|
|
43
|
+
|
|
44
|
+
### Requirements
|
|
45
|
+
|
|
46
|
+
- Node 24 (`.nvmrc:1`)
|
|
47
|
+
- pnpm 11.17.0 (`package.json:5`)
|
|
33
48
|
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
### Registry choice
|
|
50
|
+
|
|
51
|
+
Published to **npmjs.org** as unscoped `checkchange` (`package.json:2`). GitHub Packages only supports scoped packages (`@NAMESPACE/...`), would require rename to `@victor-petropoulos/checkchange` and consumer `.npmrc` mapping — no `publishConfig` or scope-to-registry mapping is used.
|
|
52
|
+
|
|
53
|
+
## What it does
|
|
54
|
+
|
|
55
|
+
checkchange looks at the functions you changed since `--base`, measures their complexity and test coverage, computes a CRAP score (complexity × uncovered), and emits **PASS / WARN / NOT_EVALUATED** with a deterministic evidence JSON you can feed to CI (`src/rules.ts:8`, `src/evidence.ts:464`).
|
|
56
|
+
|
|
57
|
+
- **What it is**: Independent verification layer for AI-assisted development (verbatim from `package.json:43`).
|
|
58
|
+
- **How**: 8-stage pipeline — git diff → complexity → coverage → attribution → crapCalc → rules → evidence → output (`src/evidence.ts:828`, `src/cli.ts:17` SUBCOMMANDS, `src/cli.ts:22` extensions `.ts/.tsx/.js/.jsx/.mjs/.cjs/.py`).
|
|
59
|
+
- **Default threshold**: CRAP 30 (`src/help.ts:49`, `src/help.ts:66`).
|
|
60
|
+
- **Output schema**: 0.5 (`src/evidence.ts:644`).
|
|
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`).
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm exec vitest run --coverage
|
|
36
68
|
```
|
|
37
69
|
|
|
38
70
|
```bash
|
|
@@ -43,7 +75,7 @@ node dist/cli.js check --base main --json
|
|
|
43
75
|
{
|
|
44
76
|
"schemaVersion": "0.5",
|
|
45
77
|
"analysis": {
|
|
46
|
-
"base": "
|
|
78
|
+
"base": "<resolved-base-sha>",
|
|
47
79
|
"target": "current"
|
|
48
80
|
},
|
|
49
81
|
"capabilities": {
|
|
@@ -62,8 +94,7 @@ node dist/cli.js check --base main --json
|
|
|
62
94
|
}
|
|
63
95
|
```
|
|
64
96
|
|
|
65
|
-
`diagnostics.lineage` and `diagnostics.quality` follow; omitted
|
|
66
|
-
checkout has no changed functions, so `changedFunctions` is empty and the gate is not evaluated.
|
|
97
|
+
`diagnostics.lineage` and `diagnostics.quality` follow; omitted for brevity. A clean checkout has no changed functions, so `changedFunctions` is empty and the gate is not evaluated.
|
|
67
98
|
|
|
68
99
|
```bash
|
|
69
100
|
node dist/cli.js doctor
|
|
@@ -98,7 +129,7 @@ Primary subcommands (`src/cli.ts:17`):
|
|
|
98
129
|
|
|
99
130
|
| Command | Purpose |
|
|
100
131
|
|---------|---------|
|
|
101
|
-
| `check` | Analyze changed functions, emit PASS/WARN/
|
|
132
|
+
| `check` | Analyze changed functions, emit PASS/WARN/NOT_EVALUATED with evidence |
|
|
102
133
|
| `doctor` | Verify runtime prerequisites (Node, pnpm, coverage, git) |
|
|
103
134
|
| `prepare-repo` | Bootstrap test runners & coverage tooling (detect → plan → approve → install → verify) |
|
|
104
135
|
| `explain` | Show rule rationale for a given verdict |
|
|
@@ -112,7 +143,7 @@ Supported languages: TypeScript, JavaScript, Python (`src/cli.ts:22`).
|
|
|
112
143
|
Eight-stage pipeline (git → complexity → coverage → attribution → crapCalc → rules → evidence):
|
|
113
144
|
|
|
114
145
|
1. **Git diff** — enumerate changed functions since `--base` (default: `origin/HEAD` → `main`/`master`)
|
|
115
|
-
2. **Complexity** — per-function CRAP via `crap-typescript` (TS/JS) or `
|
|
146
|
+
2. **Complexity** — per-function CRAP via `crap-typescript` (TS/JS) or Python AST (`src/complexity-providers/pythonASTComplexityProvider.ts`)
|
|
116
147
|
3. **Coverage** — map LCOV/istanbul lines to changed functions (`src/coverage-providers/lcovProvider.ts`)
|
|
117
148
|
4. **Attribution** — case-insensitive suffix match to provider-lowercased paths (`src/attribution.ts:91`)
|
|
118
149
|
5. **crapCalc** — combine complexity + coverage → CRAP score (`src/crapCalc.ts:5`)
|
|
@@ -122,8 +153,6 @@ Eight-stage pipeline (git → complexity → coverage → attribution → crapCa
|
|
|
122
153
|
|
|
123
154
|
Default CRAP threshold: **30** (`src/help.ts:49`, `src/help.ts:66`).
|
|
124
155
|
|
|
125
|
-
Test suite: **122 test files**, 872 tests (`pnpm exec vitest run --coverage` in a clean clone). Hand-written specs live in `src/` (8) and `test/` (55); the run also picks up compiled `dist/` specs and spike suites.
|
|
126
|
-
|
|
127
156
|
## Configuration
|
|
128
157
|
|
|
129
158
|
Key options (`src/help.ts` for full list):
|
|
@@ -137,13 +166,50 @@ Key options (`src/help.ts` for full list):
|
|
|
137
166
|
|
|
138
167
|
Provider config precedence: explicit `--provider-config <path>` > repo-root `./checkchange.providers.json` > builtin providers.
|
|
139
168
|
|
|
169
|
+
## Dependencies & credits
|
|
170
|
+
|
|
171
|
+
### Runtime dependencies
|
|
172
|
+
|
|
173
|
+
| Package | Version | Purpose | Link |
|
|
174
|
+
|---------|---------|---------|------|
|
|
175
|
+
| `@barney-media/crap-typescript` | 0.5.0 | CLI wrapper `npx crap-typescript --format json` (legacy `src/crap.ts:43`), source fallback in `src/evidence.ts:717-718` | [npm](https://www.npmjs.com/package/@barney-media/crap-typescript) |
|
|
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) |
|
|
177
|
+
|
|
178
|
+
### Dev dependencies
|
|
179
|
+
|
|
180
|
+
| Package | Version | Purpose | Link |
|
|
181
|
+
|---------|---------|---------|------|
|
|
182
|
+
| `typescript` | 6.0.3 | Build (`package.json:16` `tsc && chmod +x dist/cli.js`) | [npm](https://www.npmjs.com/package/typescript) |
|
|
183
|
+
| `vitest` | 4.1.11 | Test runner (`package.json:17` `vitest run`) | [npm](https://www.npmjs.com/package/vitest) |
|
|
184
|
+
| `@vitest/coverage-v8` | ^4.1.11 | Coverage provider (`package.json:33`; config `vitest.config.ts:4`) | [npm](https://www.npmjs.com/package/@vitest/coverage-v8) |
|
|
185
|
+
| `@types/node` | latest | Node type defs for the bin shebang (`package.json:30`, `src/cli.ts:1`) | [npm](https://www.npmjs.com/package/@types/node) |
|
|
186
|
+
| `eslint` + `@eslint/js` + `@typescript-eslint/{eslint-plugin,parser}` | latest | Flat-config lint rules; `eslint.config.js` exists but `package.json` has no `lint` script and CI runs no lint step | [npm](https://www.npmjs.com/package/eslint) |
|
|
187
|
+
| `tsx` | ^4.23.12 | Run TS directly (dev) | [npm](https://www.npmjs.com/package/tsx) |
|
|
188
|
+
|
|
189
|
+
### External tools / runtimes
|
|
190
|
+
|
|
191
|
+
| Tool | Version / Requirement | Purpose | Evidence |
|
|
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` |
|
|
198
|
+
|
|
199
|
+
### Providers
|
|
200
|
+
|
|
201
|
+
| Provider | Purpose | Source |
|
|
202
|
+
|----------|---------|--------|
|
|
203
|
+
| `genericCommand` | Pluggable `complexityCmd` → `ComplexityInfo[]` via allowlisted argv, tokens `{cwd} {out} {ext}`, 30s timeout, PATH-only env | `src/providers/genericCommand.ts:1,11,38,48,56,60` |
|
|
204
|
+
| `lcovProvider` | `parseLcovContent(lcovContent, cwd) → Map<string,FileCoverage>` rebasing + suffix logic | `src/coverage-providers/lcovProvider.ts:17` |
|
|
205
|
+
|
|
140
206
|
## Contributing
|
|
141
207
|
|
|
142
208
|
Contributions via GitHub issues and pull requests.
|
|
143
209
|
|
|
144
210
|
## License
|
|
145
211
|
|
|
146
|
-
MIT — see [LICENSE
|
|
212
|
+
MIT — see [LICENSE:1-3](LICENSE).
|
|
147
213
|
|
|
148
214
|
## Changelog
|
|
149
215
|
|
package/dist/crapCalc.d.ts
CHANGED
package/dist/crapCalc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Provenance for the crapCalc lineage stage. Self tool version tracks package.json
|
|
2
2
|
// (matches existing hard-coded '0.5.0' style for the core package).
|
|
3
|
-
export const crapCalcProvenance = { tool: 'checkchange', version: '0.4.
|
|
3
|
+
export const crapCalcProvenance = { tool: 'checkchange', version: '0.4.1' };
|
|
4
4
|
export function calculateCrap(cc, coveragePercent) {
|
|
5
5
|
if (coveragePercent == null) {
|
|
6
6
|
return null;
|
package/dist/evidence.d.ts
CHANGED
package/dist/evidence.js
CHANGED
|
@@ -19,7 +19,7 @@ import * as path from 'path';
|
|
|
19
19
|
import { loadProviderConfig, deriveRegistry, builtinConfig, createGenericCommandProvider } from './providers/index.js';
|
|
20
20
|
const requireFromEvidence = createRequire(import.meta.url);
|
|
21
21
|
// Self provenance; version mirrors package.json (existing codebase style hard-codes '0.5.0').
|
|
22
|
-
export const evidenceProvenance = { tool: 'checkchange', version: '0.4.
|
|
22
|
+
export const evidenceProvenance = { tool: 'checkchange', version: '0.4.1' };
|
|
23
23
|
function sha256Hex(content) {
|
|
24
24
|
return createHash('sha256').update(content).digest('hex');
|
|
25
25
|
}
|
package/dist/rules.d.ts
CHANGED
package/dist/rules.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Provenance for the rules lineage stage. Self tool version tracks package.json.
|
|
2
|
-
export const rulesProvenance = { tool: 'checkchange', version: '0.4.
|
|
2
|
+
export const rulesProvenance = { tool: 'checkchange', version: '0.4.1' };
|
|
3
3
|
/**
|
|
4
4
|
* Evaluate changed functions against the high-CRAP rule.
|
|
5
5
|
* @param changed Array of changed functions
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "checkchange",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"packageManager": "pnpm@11.17.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"checkchange": "dist/cli.js",
|
|
9
|
-
"code-risk": "dist/cli.js"
|
|
8
|
+
"checkchange": "./dist/cli.js",
|
|
9
|
+
"code-risk": "./dist/cli.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/",
|