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 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: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
@@ -6,33 +7,64 @@ Independent, deterministic evidence and verification layer for AI-assisted softw
6
7
 
7
8
  ## Install
8
9
 
9
- Verified from-source (registry install available **after npm publish** — gated on `npm view checkchange version` returning 2xx):
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
- corepack enable
13
- pnpm install --frozen-lockfile
14
- pnpm run build
15
+ npm install -g checkchange
16
+ npx checkchange --help
15
17
  ```
16
18
 
17
19
  ```bash
18
- # after npm publish only:
19
- npm install -g checkchange
20
+ pnpm add -g checkchange
21
+ pnpm dlx checkchange check --base main --json
20
22
  ```
21
23
 
22
- > **Warning:** Git URL install 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.
24
+ ```bash
25
+ npm install checkchange
26
+ npx checkchange check --base main --json
27
+ ```
23
28
 
24
- ## Quickstart (<30s)
29
+ ### From-source (GitHub clone)
25
30
 
26
31
  ```bash
27
- pnpm exec vitest run --coverage
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
- ```text
31
- Test Files 122 passed (122)
32
- Tests 872 passed (872)
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
- % Coverage report from v8
35
- All files | 86.47 | 78.74 | 90.16 | 88.42 |
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": "2ca94cddb9c2f91a1a56cd6e065d34f4ca1c8de0",
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 above for brevity. A clean
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/FAIL with evidence |
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 `radon` (Python)
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](LICENSE:1-3).
212
+ MIT — see [LICENSE:1-3](LICENSE).
147
213
 
148
214
  ## Changelog
149
215
 
@@ -1,5 +1,5 @@
1
1
  export declare const crapCalcProvenance: {
2
2
  readonly tool: "checkchange";
3
- readonly version: "0.4.0";
3
+ readonly version: "0.4.1";
4
4
  };
5
5
  export declare function calculateCrap(cc: number, coveragePercent: number | null): number | null;
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.0' };
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;
@@ -31,7 +31,7 @@ export interface DiagnosticLineageEntry {
31
31
  }
32
32
  export declare const evidenceProvenance: {
33
33
  readonly tool: "checkchange";
34
- readonly version: "0.4.0";
34
+ readonly version: "0.4.1";
35
35
  };
36
36
  export interface EvidenceOutput {
37
37
  schemaVersion: string;
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.0' };
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
@@ -1,7 +1,7 @@
1
1
  import { ChangedFunction } from './evidence.js';
2
2
  export declare const rulesProvenance: {
3
3
  readonly tool: "checkchange";
4
- readonly version: "0.4.0";
4
+ readonly version: "0.4.1";
5
5
  };
6
6
  export interface RuleResult {
7
7
  ruleId: string;
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.0' };
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.0",
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/",