checkchange 0.5.9 → 0.5.10
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 +1 -0
- package/README.md +21 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +16 -0
- package/dist/complexity-providers/csharpDescriptorProvider.js +2 -2
- 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/help.js +2 -1
- package/dist/rules.d.ts +1 -1
- package/dist/rules.js +1 -1
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ Correct use of `checkchange check`: prevents hallucination, enforces WARN blocks
|
|
|
67
67
|
- Exit codes: FAILED→1, SUCCESS+WARN→1, UNSUPPORTED+NOT_APPLICABLE→0.
|
|
68
68
|
- Malformed artifact: analysisStatus=FAILED, gate=FAILED, completeness=INCOMPLETE.
|
|
69
69
|
- Trace sidecar: `{command:"trace", correlationId, spans:[{stage,durationMs,status}]}`.
|
|
70
|
+
- Doctor skill announcement: `checkchange doctor` (also `doctor --json`) reports the packaged `using-checkchange/SKILL.md` as `present` or `absent` with its path and reinstall remediation when absent. Announce-only: the CLI never installs or syncs skill files; copy it manually as described in the README "For AI agents (skill file)" section.
|
|
70
71
|
|
|
71
72
|
# Implementation
|
|
72
73
|
```bash
|
package/README.md
CHANGED
|
@@ -117,6 +117,8 @@ npm install -g checkchange
|
|
|
117
117
|
checkchange --help
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
The bundled agent skill: see [For AI agents (skill file)](#for-ai-agents-skill-file) below.
|
|
121
|
+
|
|
120
122
|
Or use it without installing globally:
|
|
121
123
|
|
|
122
124
|
```bash
|
|
@@ -129,6 +131,8 @@ npx checkchange check --base main --json
|
|
|
129
131
|
pnpm add -g checkchange
|
|
130
132
|
```
|
|
131
133
|
|
|
134
|
+
The bundled agent skill: see [For AI agents (skill file)](#for-ai-agents-skill-file) below.
|
|
135
|
+
|
|
132
136
|
Or:
|
|
133
137
|
|
|
134
138
|
```bash
|
|
@@ -168,6 +172,23 @@ If you need a pinned version for reproducibility, use `checkchange@<version>`
|
|
|
168
172
|
with the version you want (list available versions with
|
|
169
173
|
`npm view checkchange versions`).
|
|
170
174
|
|
|
175
|
+
### For AI agents (skill file)
|
|
176
|
+
|
|
177
|
+
The npm tarball ships `.agents/skills/using-checkchange/SKILL.md` inside the
|
|
178
|
+
installed package. npm does not install it into any agent's skills directory,
|
|
179
|
+
and the CLI never writes to your agent config. `checkchange doctor` reports the
|
|
180
|
+
exact path under the `agentSkill` probe (text output or `doctor --json`).
|
|
181
|
+
|
|
182
|
+
Copying the file into your agent's skills directory is your call:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cp node_modules/checkchange/.agents/skills/using-checkchange/SKILL.md ~/.config/opencode/skills/using-checkchange/SKILL.md
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Use `npm root -g` instead of `node_modules/checkchange` for a global install,
|
|
189
|
+
or copy into `.agents/skills/using-checkchange/SKILL.md` in your repo. Create
|
|
190
|
+
the destination directory first if it does not exist.
|
|
191
|
+
|
|
171
192
|
---
|
|
172
193
|
|
|
173
194
|
# Requirements
|
package/dist/cli.d.ts
CHANGED
|
@@ -46,6 +46,14 @@ export declare function detectBase(base: string | null, verbose: boolean): Promi
|
|
|
46
46
|
* from pre-dispatcher CLI.
|
|
47
47
|
*/
|
|
48
48
|
export declare function formatOutput(output: EvidenceOutputShape, opts: CheckArgs, resolvedBase: string, cacheEnabled: boolean): void;
|
|
49
|
+
interface DoctorProbe {
|
|
50
|
+
name: string;
|
|
51
|
+
status: string;
|
|
52
|
+
detail?: string;
|
|
53
|
+
remediation?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function agentSkillCandidate(moduleDir: string): string;
|
|
56
|
+
export declare function agentSkillProbe(moduleDir: string): DoctorProbe;
|
|
49
57
|
/**
|
|
50
58
|
* Main CLI function: subcommand dispatcher. First argument selects the
|
|
51
59
|
* subcommand; a non-subcommand first argument (e.g. legacy `--base HEAD check`)
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,8 @@ import { FORMATS, format } from './formatters/index.js';
|
|
|
9
9
|
import { compareFromFiles } from './delta.js';
|
|
10
10
|
import { resolveRunner, detectStack, createInstallPlan, promptApproval, executeInstallPlan, flushConfigUpdates, verifyInstall } from './providers/index.js';
|
|
11
11
|
import * as path from 'node:path';
|
|
12
|
+
import * as fs from 'node:fs';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
12
14
|
import { formatHelpText, formatHelpJson, formatVersion } from './help.js';
|
|
13
15
|
import { probeDotnetSdk } from './complexity-providers/csharpDescriptorProvider.js';
|
|
14
16
|
// Subcommand dispatcher (check|doctor|explain|trace|delta). Legacy check path
|
|
@@ -366,6 +368,18 @@ function probe(name, status, detail, remediation) {
|
|
|
366
368
|
function errorMessage(error) {
|
|
367
369
|
return error instanceof Error ? error.message : String(error);
|
|
368
370
|
}
|
|
371
|
+
// Announce-only: the packaged skill is reported, never copied or installed.
|
|
372
|
+
// moduleDir is src/ (repo dev) or dist/ (published package); both parents are
|
|
373
|
+
// the package root. Same idiom as src/evidence.ts:78 and src/help.ts:314.
|
|
374
|
+
export function agentSkillCandidate(moduleDir) {
|
|
375
|
+
return path.resolve(moduleDir, '..', '.agents', 'skills', 'using-checkchange', 'SKILL.md');
|
|
376
|
+
}
|
|
377
|
+
export function agentSkillProbe(moduleDir) {
|
|
378
|
+
const candidate = agentSkillCandidate(moduleDir);
|
|
379
|
+
return fs.existsSync(candidate)
|
|
380
|
+
? probe('agentSkill', 'present', candidate)
|
|
381
|
+
: probe('agentSkill', 'absent', 'skill not found next to the installed CLI', 'reinstall checkchange; the npm package bundles .agents/skills/using-checkchange/SKILL.md');
|
|
382
|
+
}
|
|
369
383
|
// GAP 5: the .NET/Coverlet half of the coverageArtifact remediation. The command
|
|
370
384
|
// is the builtin DOTNET_RUNNER command (src/providers/config.ts:94) and the
|
|
371
385
|
// artifact note is honest about the GUID directory readCoverage actually scans
|
|
@@ -467,6 +481,8 @@ async function runDoctor(argv) {
|
|
|
467
481
|
probes.push(sdk.available
|
|
468
482
|
? probe('csharpSdk', 'ok', sdk.version ?? undefined)
|
|
469
483
|
: probe('csharpSdk', 'unfixable', sdk.diagnostic?.detail, sdk.diagnostic?.fix));
|
|
484
|
+
// 7. packaged agent skill (informational: no install, no exit-code impact)
|
|
485
|
+
probes.push(agentSkillProbe(path.dirname(fileURLToPath(import.meta.url))));
|
|
470
486
|
if (json) {
|
|
471
487
|
console.log(JSON.stringify({ command: 'doctor', probes }, null, 2));
|
|
472
488
|
}
|
|
@@ -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.10
|
|
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.10';
|
|
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,5 +1,5 @@
|
|
|
1
1
|
// Provenance for the crapCalc lineage stage. Self tool version tracks package.json.
|
|
2
|
-
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.
|
|
2
|
+
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.10' };
|
|
3
3
|
export function calculateCrap(cc, coveragePercent) {
|
|
4
4
|
if (coveragePercent == null) {
|
|
5
5
|
return null;
|
package/dist/evidence.d.ts
CHANGED
package/dist/evidence.js
CHANGED
|
@@ -22,7 +22,7 @@ import { filterDiffedFiles } from './generated-filter.js';
|
|
|
22
22
|
import { noRunnerHint } from './auto-coverage.js';
|
|
23
23
|
const requireFromEvidence = createRequire(import.meta.url);
|
|
24
24
|
// Self provenance; version mirrors package.json.
|
|
25
|
-
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.
|
|
25
|
+
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.10' };
|
|
26
26
|
function sha256Hex(content) {
|
|
27
27
|
return createHash('sha256').update(content).digest('hex');
|
|
28
28
|
}
|
package/dist/help.js
CHANGED
|
@@ -61,7 +61,8 @@ Probes (always run):
|
|
|
61
61
|
defaultBase origin/main or main auto-detected
|
|
62
62
|
providerAvailability changed file extensions have registered providers
|
|
63
63
|
coverageArtifact Istanbul JSON, Cobertura XML, or LCOV artifact present and parseable
|
|
64
|
-
csharpSdk dotnet --version exits 0 (C# complexity is SDK-based)
|
|
64
|
+
csharpSdk dotnet --version exits 0 (C# complexity is SDK-based)
|
|
65
|
+
agentSkill bundled SKILL.md alongside the installed CLI`,
|
|
65
66
|
flags: [
|
|
66
67
|
{ name: '--json', type: 'boolean', default: false, description: 'Output JSON' },
|
|
67
68
|
{ name: '--provider-config', type: 'string', default: null, description: 'Path to checkchange.providers.json' },
|
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.10' };
|
|
3
3
|
/**
|
|
4
4
|
* Evaluate changed functions against the high-CRAP rule.
|
|
5
5
|
* @param changed Array of changed functions
|