checkchange 0.5.0 → 0.5.2
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/.agents/skills/using-checkchange/SKILL.md +120 -0
- package/README.md +4 -0
- package/dist/cli.js +88 -27
- package/dist/complexity-providers/csharpDescriptorProvider.js +2 -2
- package/dist/crapCalc.d.ts +1 -1
- package/dist/crapCalc.js +2 -2
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +2 -2
- package/dist/formatters/sarif.js +3 -0
- package/dist/git.js +6 -0
- package/dist/help.js +2 -1
- package/dist/rules.d.ts +1 -1
- package/dist/rules.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-checkchange
|
|
3
|
+
description: Use when running checkchange check to enforce quality gates. Ensures correct invocation, WARN block invariant, coverage artifact validation, base branch handling, and CRAP literacy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Overview
|
|
7
|
+
Correct use of `checkchange check`: prevents hallucination, enforces WARN blocks merge, validates artifact, handles base, ensures CRAP understanding.
|
|
8
|
+
|
|
9
|
+
# When to Use
|
|
10
|
+
- Running `checkchange check` in PR/CI.
|
|
11
|
+
- Verifying changed functions within CRAP thresholds.
|
|
12
|
+
- Validating coverage artifact before gate eval.
|
|
13
|
+
- Auto-detecting base or specifying --base.
|
|
14
|
+
- Diagnosing environment with `doctor`.
|
|
15
|
+
- Explaining rule derivation with `explain`.
|
|
16
|
+
- Tracing pipeline spans with `trace`.
|
|
17
|
+
- Comparing evidence runs with `delta`.
|
|
18
|
+
|
|
19
|
+
# What It Entails
|
|
20
|
+
1. `pnpm vitest run --coverage` → `coverage/coverage-final.json` (or jest coverage) — required before check
|
|
21
|
+
2. `checkchange check [--base <ref>] [--json] [--cache] [--auto-coverage] [--crap-threshold <n>] [--coverage-file <path>] [--format github|junit|sarif] [--provider-config <path>] [--allow-external-config] [--verbose]` — auto-detects base if omitted (origin/HEAD → origin/master/main → master/main)
|
|
22
|
+
3. Read gate + changedFunctions
|
|
23
|
+
|
|
24
|
+
# Requires
|
|
25
|
+
- `checkchange` CLI in PATH.
|
|
26
|
+
- Coverage artifact (JSON with `analysisStatus`, `coverageArtifact`).
|
|
27
|
+
- Git repo with detectable base (origin/master, origin/main, master, main) unless --base.
|
|
28
|
+
|
|
29
|
+
# Returns
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"schemaVersion": "0.5",
|
|
33
|
+
"analysis": { "base": "...", "target": "current" },
|
|
34
|
+
"capabilities": { "git": "available", "complexity": "available|failed", "coverageArtifact": "available|absent|failed" },
|
|
35
|
+
"changedFunctions": [{"file","method","lineStart","lineEnd","cc","crap","coverage","coverageKind","analyzerStatus","source":{"tool","version"},"language?","framework?"}],
|
|
36
|
+
"policy": { "crapThreshold": 30 },
|
|
37
|
+
"ruleResults": [{"ruleId":"changed-function-high-crap","result":"PASS|WARN|NOT_EVALUATED","crap","threshold":30}],
|
|
38
|
+
"analysisStatus": "SUCCESS|FAILED|UNSUPPORTED",
|
|
39
|
+
"gate": "PASS|WARN|NOT_EVALUATED|FAILED",
|
|
40
|
+
"completeness": "COMPLETE|INCOMPLETE|NOT_APPLICABLE",
|
|
41
|
+
"diagnostics?": {
|
|
42
|
+
"lineage": [{"stage","tool","version","inputs"}],
|
|
43
|
+
"quality": {"coverage":"DIRECT|UNAVAILABLE","complexity":"NATIVE|UNAVAILABLE","score":0-100|null,"stageComplete":{...},"uncoveredFunctions?":[{file,method,lineStart,lineEnd}]},
|
|
44
|
+
"fingerprints?": {"file:method:lineStart": "sha256hex"}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
# Quick Reference
|
|
50
|
+
- Command: `checkchange check [--base <ref>] [--json] [--cache] [--crap-threshold <n>] [--coverage-file <path>] [--format github|junit|sarif] [--verbose]`
|
|
51
|
+
- Subcommands: `check` | `doctor` | `explain` | `trace` | `delta` | `prepare-repo`
|
|
52
|
+
- Flags are per-command (since 0.5.1): top-level `--help` lists only `--help`/`--version`; run `checkchange check --help` for `--format`, `--base`, etc. Unknown flags on any subcommand are rejected with `Error: Unknown option <arg>` (exit 1) — never silently ignored.
|
|
53
|
+
- Gate: WARN = FAIL (blocks merge). FAILED = analysis failed (exit 1). UNSUPPORTED → gate NOT_EVALUATED (gateReason explains why). Gate never null since 0.5.0.
|
|
54
|
+
- Artifact: `coverageArtifact` = available|absent|failed. Missing → absent; malformed → failed.
|
|
55
|
+
- Base: auto-detects origin/master, origin/main, master, main. Outside a git repo the error is `Not a git repository` (0.5.1), not `Cannot resolve base reference`.
|
|
56
|
+
- CRAP: = CC + uncovered lines; 0% coverage → high CRAP.
|
|
57
|
+
- Cache: `--cache` opt-in (default off). Also `CHECKCHANGE_CACHE=1` env.
|
|
58
|
+
- Format: `--format github|junit|sarif` (sidecar, separate from --json). Valid only on `check`. SARIF sidecar emits canonical `$schema` key (`https://json.schemastore.org/sarif-2.1.0.json`) since 0.5.1 — strict SARIF validators accept it.
|
|
59
|
+
- Value flags: inline (`--base=HEAD`) and next-token (`--base HEAD`) both honored; bare or empty-inline (`--base`, `--base=`) errors `<flag> requires a value`; `--crap-threshold abc` errors instead of producing NaN.
|
|
60
|
+
- Threshold: default 30 via `--crap-threshold <n>`.
|
|
61
|
+
- Exit codes: FAILED→1, SUCCESS+WARN→1, UNSUPPORTED+NOT_APPLICABLE→0.
|
|
62
|
+
- Malformed artifact: analysisStatus=FAILED, gate=FAILED, completeness=INCOMPLETE.
|
|
63
|
+
- Trace sidecar: `{command:"trace", correlationId, spans:[{stage,durationMs,status}]}`.
|
|
64
|
+
|
|
65
|
+
# Implementation
|
|
66
|
+
```bash
|
|
67
|
+
checkchange check --verbose # with verbose
|
|
68
|
+
checkchange check --base origin/main # explicit base
|
|
69
|
+
checkchange check --cache # incremental cache (opt-in)
|
|
70
|
+
checkchange check --format github # formatter sidecar
|
|
71
|
+
checkchange check --format junit --json # formatter + JSON
|
|
72
|
+
checkchange doctor # environment probes
|
|
73
|
+
checkchange explain --crap-threshold 25 # rule derivation
|
|
74
|
+
checkchange trace --json # pipeline spans
|
|
75
|
+
checkchange delta --baseline a.json --current b.json --json # compare runs
|
|
76
|
+
|
|
77
|
+
# CI gate (FAILED or WARN → exit 1)
|
|
78
|
+
if ! checkchange check --base $BASE_REF; then exit 1; fi
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
# Common Mistakes
|
|
82
|
+
- Expecting lint/test/SonarQube output (not produced).
|
|
83
|
+
- Treating WARN as pass or lowering thresholds.
|
|
84
|
+
- Skipping artifact validation.
|
|
85
|
+
- Assuming base without verification.
|
|
86
|
+
- Probing top-level `--help` for `--format`/`--base` — flags are per-command (0.5.1); `checkchange delta --format sarif` is an error, not a hidden feature.
|
|
87
|
+
- Using `--cache` without coverage data (no benefit).
|
|
88
|
+
- Using `--format` without understanding sidecar output is separate from `--json`.
|
|
89
|
+
|
|
90
|
+
# Rationalization Table
|
|
91
|
+
| Rationalization | Reality |
|
|
92
|
+
|-----------------|---------|
|
|
93
|
+
| Tests suffice; checkchange redundant. | Checkchange predicts risk from changed functions; tests incomplete. |
|
|
94
|
+
| WARN is just a warning. | WARN blocks merge; ignoring risks quality escape. |
|
|
95
|
+
| Artifact probably fine; skip check. | Missing artifact → false PASS; gate requires artifact. |
|
|
96
|
+
| Base is main; no auto-detect. | Auto-detection avoids errors in repos with master/main. |
|
|
97
|
+
| Cache default-on is fine. | Default OFF; cache only helps repeat runs with same inputs. |
|
|
98
|
+
| --format replaces --json. | --format emits sidecar; --json emits EvidenceOutput. Both can run together. |
|
|
99
|
+
|
|
100
|
+
# Red Flags
|
|
101
|
+
- "WARN is just warning": ignoring WARN risks escape (WARN blocks).
|
|
102
|
+
- "Lower threshold to pass": gate evasion.
|
|
103
|
+
- "Skip coverage artifact": missing artifact invalidates gate.
|
|
104
|
+
- "Shrink diff via HEAD~1 gaming": base manipulation.
|
|
105
|
+
- "Claim false positive": dismissing WARN/FAIL without fix.
|
|
106
|
+
- "Enable cache by default": cache is opt-in; default OFF.
|
|
107
|
+
|
|
108
|
+
# Dealing With Feedback
|
|
109
|
+
| Status/Condition | Action |
|
|
110
|
+
|---------------------------|------------------------------------------------------------------------|
|
|
111
|
+
| PASS | Merge. |
|
|
112
|
+
| WARN | Fix CRAP; don't lower thresholds. |
|
|
113
|
+
| FAILED | Check coverageErrorReason (missing|malformed); fix artifact. |
|
|
114
|
+
| UNSUPPORTED | Non-code changes only; gate=NOT_EVALUATED (+gateReason), merge allowed. |
|
|
115
|
+
| INCOMPLETE | Check artifact and analysisStatus. |
|
|
116
|
+
| absent artifact | Run tests with coverage. |
|
|
117
|
+
| failed artifact | Fix tests/coverage (malformed JSON, truncation, etc.). |
|
|
118
|
+
| NOT_EVALUATED in tests/** | Ignore. |
|
|
119
|
+
|
|
120
|
+
(End of file)
|
package/README.md
CHANGED
|
@@ -251,6 +251,10 @@ Some of the most useful options are:
|
|
|
251
251
|
| `--verbose` | Show additional diagnostics | off |
|
|
252
252
|
| `--auto-coverage` | Attempt automatic coverage setup | off |
|
|
253
253
|
|
|
254
|
+
Flags are per-command: `checkchange check --help` lists `--format`, `--base`,
|
|
255
|
+
`--json`; every subcommand lists its own flags. Unknown flags are rejected
|
|
256
|
+
with `Error: Unknown option <arg>` (exit 1) rather than silently ignored.
|
|
257
|
+
|
|
254
258
|
The base reference is automatically detected when `--base` is not supplied.
|
|
255
259
|
|
|
256
260
|
Provider configuration can be supplied explicitly or discovered from the repository.
|
package/dist/cli.js
CHANGED
|
@@ -42,8 +42,9 @@ function splitValue(argv, i, name) {
|
|
|
42
42
|
// value slot is mistaken for the flag (`check --base --version` printed the
|
|
43
43
|
// version instead of resolving `--version` as the base ref). Skip value slots.
|
|
44
44
|
// Mirrors how each subcommand consumes them: --base is exact-match next-slot in
|
|
45
|
-
// parseCliArgs
|
|
46
|
-
//
|
|
45
|
+
// parseCliArgs (check); --baseline/--current are exact-match next-slot in
|
|
46
|
+
// runDelta; doctor/explain/trace take --provider-config/--crap-threshold/
|
|
47
|
+
// --coverage-file/--format and explain/trace also --base as inline-or-next.
|
|
47
48
|
const VALUE_FLAGS_NEXT_SLOT_ONLY = new Set([
|
|
48
49
|
'--base',
|
|
49
50
|
'--baseline',
|
|
@@ -55,6 +56,8 @@ const VALUE_FLAGS_INLINE_OR_NEXT = [
|
|
|
55
56
|
'--coverage-file',
|
|
56
57
|
'--format',
|
|
57
58
|
];
|
|
59
|
+
// Allowed value flags for the two commands that share a flag set (explain/trace).
|
|
60
|
+
const EXPLAIN_TRACE_VALUE_FLAGS = ['--base', '--crap-threshold', '--coverage-file'];
|
|
58
61
|
// One pass, two questions: the duplication was the loop, not the data.
|
|
59
62
|
// A1 asks "was --version passed as a flag?"; A2 asks "is there a positional
|
|
60
63
|
// argument at all?" — the dispatcher resolves any argv whose first token is
|
|
@@ -84,6 +87,28 @@ function scanArgv(args) {
|
|
|
84
87
|
}
|
|
85
88
|
return { hasVersion, hasPositional };
|
|
86
89
|
}
|
|
90
|
+
// A3: doctor/explain/trace used to accept any stray flag silently (argv.includes
|
|
91
|
+
// never rejected), so `doctor --format sarif` ran as if --format were
|
|
92
|
+
// absent. delta/prepare-repo already reject; this makes the other three agree.
|
|
93
|
+
// Value slots are skipped by the loop below (same convention as scanArgv); a
|
|
94
|
+
// bare value flag like `--base --json` is not "Unknown option" here — the
|
|
95
|
+
// value parser (flagValueInlineOrNext) reports `requires a value` instead.
|
|
96
|
+
function assertKnownFlags(argv, allowedValueFlags, allowedBooleans) {
|
|
97
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
98
|
+
const arg = argv[i];
|
|
99
|
+
if (!arg.startsWith('-'))
|
|
100
|
+
continue; // value slot or ruleId positional
|
|
101
|
+
const inline = arg.includes('=');
|
|
102
|
+
const name = inline ? arg.slice(0, arg.indexOf('=')) : arg;
|
|
103
|
+
if (allowedValueFlags.includes(name)) {
|
|
104
|
+
if (!inline)
|
|
105
|
+
i += 1;
|
|
106
|
+
}
|
|
107
|
+
else if (!allowedBooleans.includes(arg)) {
|
|
108
|
+
throw new Error(`Unknown option ${arg}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
87
112
|
function parseCrapThreshold(value) {
|
|
88
113
|
const parsed = parseFloat(value);
|
|
89
114
|
if (!isFinite(parsed) || parsed < 0) {
|
|
@@ -340,10 +365,11 @@ const DOTNET_COVERAGE_HINT = ' or `dotnet test --collect:"XPlat Code Coverage"`
|
|
|
340
365
|
* no analysis engine duplication.
|
|
341
366
|
*/
|
|
342
367
|
async function runDoctor(argv) {
|
|
368
|
+
assertKnownFlags(argv, ['--provider-config'], ['--json', '--allow-external-config']);
|
|
343
369
|
const json = argv.includes('--json');
|
|
344
|
-
//
|
|
345
|
-
|
|
346
|
-
const providerConfigPath =
|
|
370
|
+
// --provider-config is inline-or-next; a bare flag now errors instead of
|
|
371
|
+
// silently treating the following token (e.g. --json) as a path.
|
|
372
|
+
const providerConfigPath = flagValueInlineOrNext(argv, '--provider-config');
|
|
347
373
|
const allowExternalConfig = argv.includes('--allow-external-config');
|
|
348
374
|
const { registry, source: providerSource } = initProviderConfig(providerConfigPath, allowExternalConfig);
|
|
349
375
|
SUPPORTED_EXTENSIONS = new Set(registry.keys());
|
|
@@ -442,15 +468,54 @@ async function runDoctor(argv) {
|
|
|
442
468
|
}
|
|
443
469
|
}
|
|
444
470
|
/**
|
|
445
|
-
* Reads
|
|
446
|
-
*
|
|
471
|
+
* Reads a value-taking flag in either `--flag=value` or `--flag value` form.
|
|
472
|
+
* Absent flag → undefined. Present without a value (missing next slot, or the
|
|
473
|
+
* next slot is another flag) → throws; main maps it to `Error: ...` + exit 1.
|
|
447
474
|
*/
|
|
448
|
-
function
|
|
449
|
-
const
|
|
475
|
+
function flagValueInlineOrNext(argv, name) {
|
|
476
|
+
const inlinePrefix = `${name}=`;
|
|
477
|
+
const index = argv.findIndex((arg) => arg === name || arg.startsWith(inlinePrefix));
|
|
450
478
|
if (index === -1)
|
|
451
479
|
return undefined;
|
|
480
|
+
const arg = argv[index];
|
|
481
|
+
if (arg.startsWith(inlinePrefix)) {
|
|
482
|
+
// `--base=` is an empty value, same as a bare flag: reject rather than
|
|
483
|
+
// silently default (parseCliArgs rejects empty --coverage-file the same way).
|
|
484
|
+
const value = arg.slice(inlinePrefix.length);
|
|
485
|
+
if (value === '') {
|
|
486
|
+
throw new Error(`${name} requires a value`);
|
|
487
|
+
}
|
|
488
|
+
return value;
|
|
489
|
+
}
|
|
452
490
|
const value = argv[index + 1];
|
|
453
|
-
|
|
491
|
+
if (value === undefined || value.startsWith('-')) {
|
|
492
|
+
throw new Error(`${name} requires a value`);
|
|
493
|
+
}
|
|
494
|
+
return value;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Provider source for the complexity measurement: the engine-reported quality
|
|
498
|
+
* wins; otherwise infer it from the complexity stage capability.
|
|
499
|
+
*/
|
|
500
|
+
function deriveComplexity(output) {
|
|
501
|
+
return (output.diagnostics?.quality?.complexity ??
|
|
502
|
+
(output.capabilities?.complexity === 'failed' ? 'UNAVAILABLE' : 'NATIVE'));
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Coverage quality: the engine-reported value wins; otherwise DIRECT only when
|
|
506
|
+
* the coverage artifact was actually available.
|
|
507
|
+
*/
|
|
508
|
+
function deriveCoverageQuality(output) {
|
|
509
|
+
return (output.diagnostics?.quality?.coverage ??
|
|
510
|
+
(output.capabilities?.coverageArtifact === 'available' ? 'DIRECT' : 'UNAVAILABLE'));
|
|
511
|
+
}
|
|
512
|
+
/** Reason the score fell back to null, from the run's status and coverage quality. */
|
|
513
|
+
function deriveFallback(analysisStatus, coverageQuality) {
|
|
514
|
+
if (analysisStatus === 'UNSUPPORTED')
|
|
515
|
+
return 'analysis skipped — unsupported source';
|
|
516
|
+
if (coverageQuality === 'DIRECT')
|
|
517
|
+
return 'none — coverage direct evidence used';
|
|
518
|
+
return 'coverage direct evidence absent — score null (INV-01: null, not 0%)';
|
|
454
519
|
}
|
|
455
520
|
/**
|
|
456
521
|
* `explain` subcommand: prints provider/input/threshold/fallback derivation for
|
|
@@ -458,12 +523,13 @@ function flagValue(argv, name) {
|
|
|
458
523
|
* derivation logic. Optional ruleId positional filters rule results.
|
|
459
524
|
*/
|
|
460
525
|
async function runExplain(argv) {
|
|
526
|
+
assertKnownFlags(argv, EXPLAIN_TRACE_VALUE_FLAGS, ['--json']);
|
|
461
527
|
const json = argv.includes('--json');
|
|
462
528
|
const ruleId = argv.find((a) => !a.startsWith('-'));
|
|
463
|
-
const rawThreshold =
|
|
464
|
-
const threshold = rawThreshold
|
|
465
|
-
const baseArg =
|
|
466
|
-
const coverageFile =
|
|
529
|
+
const rawThreshold = flagValueInlineOrNext(argv, '--crap-threshold');
|
|
530
|
+
const threshold = rawThreshold === undefined ? 30 : parseCrapThreshold(rawThreshold);
|
|
531
|
+
const baseArg = flagValueInlineOrNext(argv, '--base');
|
|
532
|
+
const coverageFile = flagValueInlineOrNext(argv, '--coverage-file');
|
|
467
533
|
const base = baseArg ?? (await detectDefaultBase(false));
|
|
468
534
|
if (base === null) {
|
|
469
535
|
throw new Error('Cannot auto-detect base branch. Provide --base <ref> explicitly.');
|
|
@@ -472,15 +538,9 @@ async function runExplain(argv) {
|
|
|
472
538
|
const resolvedBase = await resolveBaseRef(base);
|
|
473
539
|
const { intervals } = await getChangedIntervals(resolvedBase);
|
|
474
540
|
const output = await buildEvidenceOutput(resolvedBase, intervals, process.cwd(), threshold, coverageFile);
|
|
475
|
-
const complexity = output
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
(output.capabilities?.coverageArtifact === 'available' ? 'DIRECT' : 'UNAVAILABLE');
|
|
479
|
-
const fallback = output.analysisStatus === 'UNSUPPORTED'
|
|
480
|
-
? 'analysis skipped — unsupported source'
|
|
481
|
-
: coverageQuality === 'DIRECT'
|
|
482
|
-
? 'none — coverage direct evidence used'
|
|
483
|
-
: 'coverage direct evidence absent — score null (INV-01: null, not 0%)';
|
|
541
|
+
const complexity = deriveComplexity(output);
|
|
542
|
+
const coverageQuality = deriveCoverageQuality(output);
|
|
543
|
+
const fallback = deriveFallback(output.analysisStatus, coverageQuality);
|
|
484
544
|
const ruleResults = ruleId === undefined
|
|
485
545
|
? output.ruleResults
|
|
486
546
|
: output.ruleResults.filter((r) => r.ruleId === ruleId);
|
|
@@ -518,11 +578,12 @@ async function runExplain(argv) {
|
|
|
518
578
|
* (evidence-contract.md:341) carries no timing, so `check --json` is unchanged.
|
|
519
579
|
*/
|
|
520
580
|
async function runTrace(argv) {
|
|
581
|
+
assertKnownFlags(argv, EXPLAIN_TRACE_VALUE_FLAGS, ['--json']);
|
|
521
582
|
const json = argv.includes('--json');
|
|
522
|
-
const rawThreshold =
|
|
523
|
-
const threshold = rawThreshold
|
|
524
|
-
const baseArg =
|
|
525
|
-
const coverageFile =
|
|
583
|
+
const rawThreshold = flagValueInlineOrNext(argv, '--crap-threshold');
|
|
584
|
+
const threshold = rawThreshold === undefined ? 30 : parseCrapThreshold(rawThreshold);
|
|
585
|
+
const baseArg = flagValueInlineOrNext(argv, '--base');
|
|
586
|
+
const coverageFile = flagValueInlineOrNext(argv, '--coverage-file');
|
|
526
587
|
const base = baseArg ?? (await detectDefaultBase(false));
|
|
527
588
|
if (base === null) {
|
|
528
589
|
throw new Error('Cannot auto-detect base branch. Provide --base <ref> explicitly.');
|
|
@@ -174,10 +174,10 @@ export function vehicleRejection() {
|
|
|
174
174
|
return lastVehicleRejection;
|
|
175
175
|
}
|
|
176
176
|
// The fallback parser is checkchange's OWN code (./csharpFallbackParser.ts), so
|
|
177
|
-
// its tool is checkchange and its version is the package version — same 0.5.
|
|
177
|
+
// its tool is checkchange and its version is the package version — same 0.5.2
|
|
178
178
|
// the other self-provenance consts hard-code (src/crapCalc.ts:3, src/rules.ts:4).
|
|
179
179
|
const FALLBACK_TOOL = 'checkchange';
|
|
180
|
-
const FALLBACK_TOOL_VERSION = '0.5.
|
|
180
|
+
const FALLBACK_TOOL_VERSION = '0.5.2';
|
|
181
181
|
// The vehicle's INSTALLED version is never probed: the rich path is
|
|
182
182
|
// documented-unreachable (see SPAWN FORM above), so `dotnet-crap --version` is
|
|
183
183
|
// never spawned to learn it, and no version is fabricated here. `unknown` is the
|
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
|
-
// (matches existing hard-coded '0.5.
|
|
3
|
-
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.
|
|
2
|
+
// (matches existing hard-coded '0.5.2' style for the core package).
|
|
3
|
+
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.2' };
|
|
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,8 +19,8 @@ import * as fs from 'fs';
|
|
|
19
19
|
import * as path from 'path';
|
|
20
20
|
import { loadProviderConfig, deriveRegistry, builtinConfig, createGenericCommandProvider } from './providers/index.js';
|
|
21
21
|
const requireFromEvidence = createRequire(import.meta.url);
|
|
22
|
-
// Self provenance; version mirrors package.json (existing codebase style hard-codes '0.5.
|
|
23
|
-
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.
|
|
22
|
+
// Self provenance; version mirrors package.json (existing codebase style hard-codes '0.5.2').
|
|
23
|
+
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.2' };
|
|
24
24
|
function sha256Hex(content) {
|
|
25
25
|
return createHash('sha256').update(content).digest('hex');
|
|
26
26
|
}
|
package/dist/formatters/sarif.js
CHANGED
|
@@ -18,6 +18,9 @@ export function formatSARIF(out, opts) {
|
|
|
18
18
|
message: { text: `${r.method} CRAP ${r.crap} > ${r.threshold} (cc ${r.cc}, cov ${r.coverage})` },
|
|
19
19
|
}));
|
|
20
20
|
return JSON.stringify({
|
|
21
|
+
// SARIF 2.1.0 top-level schema key is `$schema`; the schemastore schema
|
|
22
|
+
// has additionalProperties:false, so `schema` would make the doc invalid.
|
|
23
|
+
$schema: 'https://json.schemastore.org/sarif-2.1.0.json',
|
|
21
24
|
version: '2.1.0',
|
|
22
25
|
runs: [
|
|
23
26
|
{
|
package/dist/git.js
CHANGED
|
@@ -29,6 +29,12 @@ export async function resolveBaseRef(base, cwd = process.cwd(), trace) {
|
|
|
29
29
|
throw new Error('Git executable not found');
|
|
30
30
|
}
|
|
31
31
|
if (result.exitCode !== 0) {
|
|
32
|
+
// git prints `fatal: not a git repository` when run outside a repo; surface
|
|
33
|
+
// that distinction instead of reporting a ref-resolution failure, which
|
|
34
|
+
// sends users hunting for the wrong base ref.
|
|
35
|
+
if (result.stderr.includes('not a git repository')) {
|
|
36
|
+
throw new Error('Not a git repository — run from a repo root or initialize one with `git init`.');
|
|
37
|
+
}
|
|
32
38
|
throw new Error(`Cannot resolve base reference: ${base}`);
|
|
33
39
|
}
|
|
34
40
|
return result.stdout.trim();
|
package/dist/help.js
CHANGED
|
@@ -216,7 +216,8 @@ Options:
|
|
|
216
216
|
--version Print version and exit
|
|
217
217
|
|
|
218
218
|
Run 'checkchange <command> --help' for command-specific help.
|
|
219
|
-
Tip: 'checkchange <command> --help --json' for machine-readable help
|
|
219
|
+
Tip: 'checkchange <command> --help --json' for machine-readable help.
|
|
220
|
+
Flags are per-command: run 'checkchange check --help' to list --format, --base, --json; every subcommand lists its own flags.`;
|
|
220
221
|
function jsonTip(command) {
|
|
221
222
|
return `Tip: 'checkchange ${command} --help --json' for machine-readable help.`;
|
|
222
223
|
}
|
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.5.
|
|
2
|
+
export const rulesProvenance = { tool: 'checkchange', version: '0.5.2' };
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "checkchange",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"packageManager": "pnpm@11.17.0",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/",
|
|
13
|
+
".agents/skills/using-checkchange/SKILL.md",
|
|
13
14
|
"!dist/**/*.test.*"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|