@dzhechkov/harness-cli 0.3.238 → 0.3.239
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/.dz-manifest.json +7 -7
- package/README.md +53 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +175 -2
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
- package/sbom.json +6 -6
- package/src/cli.ts +193 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/harness-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.239",
|
|
4
4
|
"description": "The dz CLI — install AI skills for Claude Code, Codex, OpenCode, Hermes, OpenClaude, GitHub Copilot. 35 commands, 13 presets, 6 platform targets.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@dzhechkov/skills-reverse-engineering": "^0.1.0",
|
|
58
58
|
"@dzhechkov/skills-presentation-storyteller": "^0.1.0",
|
|
59
59
|
"@dzhechkov/skills-website-cloner": "^0.1.0",
|
|
60
|
-
"@dzhechkov/harness-core": "0.3.
|
|
60
|
+
"@dzhechkov/harness-core": "0.3.130"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "^25.6.0",
|
package/sbom.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"hashes": [
|
|
26
26
|
{
|
|
27
27
|
"alg": "SHA-256",
|
|
28
|
-
"content": "
|
|
28
|
+
"content": "6cdf43e972df9144b6eb93beed515bb216c1545bdd69b696b773a3dbe2d5b679"
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
},
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"hashes": [
|
|
106
106
|
{
|
|
107
107
|
"alg": "SHA-256",
|
|
108
|
-
"content": "
|
|
108
|
+
"content": "dfb260e21d46dfc8020eef0bf5ba570f9c335964181cf90446c1c5d761626415"
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
},
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"hashes": [
|
|
116
116
|
{
|
|
117
117
|
"alg": "SHA-256",
|
|
118
|
-
"content": "
|
|
118
|
+
"content": "a5b7d2fc4f582c507dfab54f1cc4754ca6700f7e686a3c72871afa807cceac25"
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
121
|
},
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"hashes": [
|
|
126
126
|
{
|
|
127
127
|
"alg": "SHA-256",
|
|
128
|
-
"content": "
|
|
128
|
+
"content": "8fb0c46e092ac7240af9d254f272da649d911b3307b39dc60ac1ef43d349834f"
|
|
129
129
|
}
|
|
130
130
|
]
|
|
131
131
|
},
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"hashes": [
|
|
186
186
|
{
|
|
187
187
|
"alg": "SHA-256",
|
|
188
|
-
"content": "
|
|
188
|
+
"content": "82a481991b03522d4da62fe49c032c03445928a46a226e8cbb05498eb9321950"
|
|
189
189
|
}
|
|
190
190
|
]
|
|
191
191
|
},
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"hashes": [
|
|
206
206
|
{
|
|
207
207
|
"alg": "SHA-256",
|
|
208
|
-
"content": "
|
|
208
|
+
"content": "ccb1af3966a258b17eed99ce8b830639166ad8a8a5075ca027d8f30077025d19"
|
|
209
209
|
}
|
|
210
210
|
]
|
|
211
211
|
},
|
package/src/cli.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
8
8
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import { execSync } from 'node:child_process';
|
|
10
|
+
import { execSync, spawn } from 'node:child_process';
|
|
11
11
|
import { homedir, tmpdir } from 'node:os';
|
|
12
12
|
import { createRequire } from 'node:module';
|
|
13
13
|
|
|
@@ -192,6 +192,11 @@ import {
|
|
|
192
192
|
classifyDelivery,
|
|
193
193
|
isUsablePlaneResult,
|
|
194
194
|
renderDeliveryReview,
|
|
195
|
+
scanSkillsLayout,
|
|
196
|
+
parseInitFacts,
|
|
197
|
+
verifyRegistration,
|
|
198
|
+
registrationExitCode,
|
|
199
|
+
renderRegistrationReport,
|
|
195
200
|
} from '@dzhechkov/harness-core';
|
|
196
201
|
import type { Family, ModelRung, Candidate as BtoCandidate, DimScores } from '@dzhechkov/harness-core';
|
|
197
202
|
import type { SetupSpec } from '@dzhechkov/harness-core';
|
|
@@ -222,6 +227,7 @@ Usage:
|
|
|
222
227
|
dz release [--filter <name>] [--tag] [--publish] [--json] [--dry-run] [--no-issue] (VERIFIED release: 4 HARD gates in FRONT of dz publish — full package test suites, audit >=high, node --check of every dist/bin file, bin smoke-boot via "node <bin> --help" — any red gate STOPS the release (exit 1) + best-effort gh issue; all green ⇒ re-sign reminder, then prints the ready dz publish command (or chains with --publish); never duplicates publish's own gates)
|
|
223
228
|
dz parity [--target <name>] [--json] (the honest feature×target map, COMPUTED from the capability model — which harness feature is full / manual / absent on each of the ${TARGET_NAMES.length} targets, and via which form)
|
|
224
229
|
dz delivery-check --slug <slug> [--context-only] [--findings <f.json>] [--strict] [--author <model>] [--json] (portable Step-10 Delivery Gate: prints the 4-plane review brief + artifact probes; --findings classifies a fed-back review into a fail-closed ready|blocked hand-off and writes features/<slug>/10_delivery_review.md; --strict exits 1 on blocked)
|
|
230
|
+
dz skills-verify [--dir <project>] [--expect a,b] [--static] [--strict] [--json] (does .claude/skills/ actually REGISTER? --static = instant layout scan for CI; default reads the authoritative system/init listing from a real session. exit 0 pass / 1 fail / 2 inconclusive — never a false pass)
|
|
225
231
|
dz setup --target <name> [--preset <name>] [--select id,id,...] [--skills-dir <dir>] [--project <dir>] [--memory agentdb] [--no-memory] [--no-hooks] [--install-driver] [--force] [--enrich]
|
|
226
232
|
dz teach "<pattern>" [--reward <0-1>] [--domain <name>] [--type rule|success-pattern|lesson-learned] [--project <dir>] [--no-mirror] (--project pins the learned store to <dir>/.dz, not the cwd — pin to a canonical brain)
|
|
227
233
|
dz teach --from-json <file> [--project <dir>] [--no-mirror] (bulk-import a 'dz recall --all --json' export — share a learned store across machines)
|
|
@@ -5552,6 +5558,190 @@ function nameFor(t: { file: string; name?: string }, outcome: 'pass' | 'fail' |
|
|
|
5552
5558
|
* --author <model> cosmetic: the reviewer to dispatch, printed alongside the brief
|
|
5553
5559
|
* --json machine contract { planesChecked, planesSkipped, findings, handoff, artifact }
|
|
5554
5560
|
*/
|
|
5561
|
+
/**
|
|
5562
|
+
* Env vars an INHERITED Claude session leaks into a child. Left in place, the probe can silently
|
|
5563
|
+
* read the parent's project instead of the target — the exact confound that made a hand-rolled
|
|
5564
|
+
* 2026-07-23 probe untrustworthy until controls were added (feature skills-verify, ADR-001).
|
|
5565
|
+
*/
|
|
5566
|
+
const PROBE_SCRUB_ENV = [
|
|
5567
|
+
'CLAUDE_CODE_CHILD_SESSION',
|
|
5568
|
+
'CLAUDE_CODE_SESSION_ID',
|
|
5569
|
+
'CLAUDECODE',
|
|
5570
|
+
'CLAUDE_CODE_ENTRYPOINT',
|
|
5571
|
+
'CLAUDE_CODE_EXECPATH',
|
|
5572
|
+
'CLAUDE_PLUGIN_DATA',
|
|
5573
|
+
'AI_AGENT',
|
|
5574
|
+
];
|
|
5575
|
+
|
|
5576
|
+
/**
|
|
5577
|
+
* Start a real Claude session in `projectDir` and capture its stream until the `system/init` event
|
|
5578
|
+
* lands, then kill it — the model never answers, so the probe costs ~no tokens. Never throws:
|
|
5579
|
+
* every failure becomes an `error` string, which the pure classifier turns into `inconclusive`.
|
|
5580
|
+
*/
|
|
5581
|
+
function probeInitStream(projectDir: string, timeoutMs: number): Promise<{ stream: string; error: string | null }> {
|
|
5582
|
+
return new Promise((resolveProbe) => {
|
|
5583
|
+
const env: NodeJS.ProcessEnv = { ...process.env };
|
|
5584
|
+
for (const key of PROBE_SCRUB_ENV) delete env[key];
|
|
5585
|
+
env.CLAUDE_PROJECT_DIR = projectDir;
|
|
5586
|
+
|
|
5587
|
+
let out = '';
|
|
5588
|
+
let err = '';
|
|
5589
|
+
let settled = false;
|
|
5590
|
+
let child: ReturnType<typeof spawn>;
|
|
5591
|
+
|
|
5592
|
+
const finish = (error: string | null): void => {
|
|
5593
|
+
if (settled) return;
|
|
5594
|
+
settled = true;
|
|
5595
|
+
clearTimeout(timer);
|
|
5596
|
+
try {
|
|
5597
|
+
child?.kill('SIGTERM');
|
|
5598
|
+
} catch {
|
|
5599
|
+
/* the child may already be gone */
|
|
5600
|
+
}
|
|
5601
|
+
resolveProbe({ stream: out, error });
|
|
5602
|
+
};
|
|
5603
|
+
|
|
5604
|
+
const timer = setTimeout(
|
|
5605
|
+
() => finish(`no init event within ${Math.round(timeoutMs / 1000)}s (is \`claude\` logged in?)`),
|
|
5606
|
+
timeoutMs,
|
|
5607
|
+
);
|
|
5608
|
+
|
|
5609
|
+
try {
|
|
5610
|
+
// NOT `--bare`: that mode skips plugin credentials and fails with "Not logged in".
|
|
5611
|
+
child = spawn('claude', ['-p', 'ok', '--output-format', 'stream-json', '--verbose'], {
|
|
5612
|
+
cwd: projectDir,
|
|
5613
|
+
env,
|
|
5614
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
5615
|
+
});
|
|
5616
|
+
} catch (error) {
|
|
5617
|
+
finish(`cannot run \`claude\`: ${error instanceof Error ? error.message : String(error)}`);
|
|
5618
|
+
return;
|
|
5619
|
+
}
|
|
5620
|
+
|
|
5621
|
+
child.stdout?.on('data', (chunk: Buffer) => {
|
|
5622
|
+
out += chunk.toString();
|
|
5623
|
+
// Reuse the pure parser so a partially-flushed line simply waits for more data.
|
|
5624
|
+
if (parseInitFacts(out)) finish(null);
|
|
5625
|
+
});
|
|
5626
|
+
child.stderr?.on('data', (chunk: Buffer) => {
|
|
5627
|
+
err += chunk.toString();
|
|
5628
|
+
});
|
|
5629
|
+
child.on('error', (error: Error) => finish(`cannot run \`claude\`: ${error.message}`));
|
|
5630
|
+
child.on('close', (code) => {
|
|
5631
|
+
if (parseInitFacts(out)) finish(null);
|
|
5632
|
+
else finish(err.trim() || `\`claude\` exited ${code} without an init event`);
|
|
5633
|
+
});
|
|
5634
|
+
});
|
|
5635
|
+
}
|
|
5636
|
+
|
|
5637
|
+
/**
|
|
5638
|
+
* `dz skills-verify` — does this project's `.claude/skills/` actually REGISTER? (feature
|
|
5639
|
+
* skills-verify, ADR-001.) L1 static scan is instant and CI-safe; the live layer reads the
|
|
5640
|
+
* authoritative `system/init` listing. Fail-closed: unobservable ⇒ inconclusive, never pass.
|
|
5641
|
+
*/
|
|
5642
|
+
async function cmdSkillsVerify(
|
|
5643
|
+
options: Map<string, string>,
|
|
5644
|
+
flags: Set<string>,
|
|
5645
|
+
cwd: string,
|
|
5646
|
+
write: Write,
|
|
5647
|
+
): Promise<number> {
|
|
5648
|
+
const json = flags.has('json');
|
|
5649
|
+
if (flags.has('help')) {
|
|
5650
|
+
write('dz skills-verify [--dir <project>] [--expect a,b] [--static] [--strict] [--timeout <s>] [--json]');
|
|
5651
|
+
write(' Verifies that a project\'s .claude/skills/ actually register in Claude Code.');
|
|
5652
|
+
write(' --static layout scan only (no Claude session, CI-safe): flags dirs that can never register');
|
|
5653
|
+
write(' default also starts a real session and reads the authoritative system/init listing');
|
|
5654
|
+
write(' exit: 0 pass · 1 fail · 2 inconclusive (--strict makes inconclusive exit 1)');
|
|
5655
|
+
return 0;
|
|
5656
|
+
}
|
|
5657
|
+
|
|
5658
|
+
const allowedFlags = new Set(['json', 'help', 'static', 'strict']);
|
|
5659
|
+
const allowedOptions = new Set(['dir', 'expect', 'timeout']);
|
|
5660
|
+
const usage = ' allowed: --dir <project>, --expect a,b, --timeout <s>, --static, --strict, --json';
|
|
5661
|
+
if (options.has('_positional_0')) {
|
|
5662
|
+
const message = `unexpected argument "${options.get('_positional_0')}"`;
|
|
5663
|
+
write(json ? JSON.stringify({ error: message, exitCode: 1 }) : `dz skills-verify: ${message}\n${usage}`);
|
|
5664
|
+
return 1;
|
|
5665
|
+
}
|
|
5666
|
+
for (const flag of flags) {
|
|
5667
|
+
if (!allowedFlags.has(flag)) {
|
|
5668
|
+
write(json ? JSON.stringify({ error: `unknown option --${flag}`, exitCode: 1 }) : `dz skills-verify: unknown option --${flag}\n${usage}`);
|
|
5669
|
+
return 1;
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5672
|
+
for (const key of options.keys()) {
|
|
5673
|
+
if (key.startsWith('_positional_')) continue;
|
|
5674
|
+
if (!allowedOptions.has(key)) {
|
|
5675
|
+
write(json ? JSON.stringify({ error: `unknown option --${key}`, exitCode: 1 }) : `dz skills-verify: unknown option --${key}\n${usage}`);
|
|
5676
|
+
return 1;
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
|
|
5680
|
+
const projectDir = resolve(cwd, options.get('dir') ?? '.');
|
|
5681
|
+
const scan = scanSkillsLayout(projectDir);
|
|
5682
|
+
|
|
5683
|
+
const expected = options.has('expect')
|
|
5684
|
+
? (options.get('expect') ?? '')
|
|
5685
|
+
.split(',')
|
|
5686
|
+
.map((s) => s.trim())
|
|
5687
|
+
.filter(Boolean)
|
|
5688
|
+
: scan.registrable;
|
|
5689
|
+
|
|
5690
|
+
// ── L1 only: deterministic, no session, safe for CI ──
|
|
5691
|
+
if (flags.has('static')) {
|
|
5692
|
+
const exitCode = scan.findings.length > 0 ? 1 : 0;
|
|
5693
|
+
if (json) {
|
|
5694
|
+
write(JSON.stringify({ mode: 'static', ...scan, expected, exitCode }, null, 2));
|
|
5695
|
+
} else {
|
|
5696
|
+
write(`dz skills-verify (static): ${scan.registrable.length} registrable skill dir(s) under ${scan.skillsRoot}`);
|
|
5697
|
+
if (!scan.exists) write(' no .claude/skills/ directory here');
|
|
5698
|
+
for (const f of scan.findings) write(` [${f.kind}] ${f.detail}`);
|
|
5699
|
+
write(scan.findings.length ? ` ${scan.findings.length} layout problem(s) — these can never register` : ' no layout problems found');
|
|
5700
|
+
write(' (static is a PROXY — run without --static to read the real registration listing)');
|
|
5701
|
+
}
|
|
5702
|
+
return exitCode;
|
|
5703
|
+
}
|
|
5704
|
+
|
|
5705
|
+
// ── L2: the authoritative listing ──
|
|
5706
|
+
const timeoutSec = Number(options.get('timeout') ?? '180');
|
|
5707
|
+
const timeoutMs = Number.isFinite(timeoutSec) && timeoutSec > 0 ? timeoutSec * 1000 : 180_000;
|
|
5708
|
+
if (!json) write(`dz skills-verify: starting a session in ${projectDir} to read the real registration listing…`);
|
|
5709
|
+
|
|
5710
|
+
const { stream, error } = await probeInitStream(projectDir, timeoutMs);
|
|
5711
|
+
|
|
5712
|
+
// `init.skills` carries names, not provenance: a USER-level skill of the same name would satisfy
|
|
5713
|
+
// the expectation while the project's own copy stays broken. Collect the collisions so the
|
|
5714
|
+
// classifier can refuse to attribute registration to this project (Codex QE #2).
|
|
5715
|
+
const userSkillsDir = join(homedir(), '.claude', 'skills');
|
|
5716
|
+
const ambiguous = expected.filter((name) => existsSync(join(userSkillsDir, name, 'SKILL.md')));
|
|
5717
|
+
|
|
5718
|
+
// realpath so a symlinked project still matches its canonical cwd (Codex QE #6).
|
|
5719
|
+
const canonical = (p: string): string => {
|
|
5720
|
+
try {
|
|
5721
|
+
return realpathSync(p);
|
|
5722
|
+
} catch {
|
|
5723
|
+
return resolve(p);
|
|
5724
|
+
}
|
|
5725
|
+
};
|
|
5726
|
+
|
|
5727
|
+
const result = verifyRegistration(
|
|
5728
|
+
{
|
|
5729
|
+
projectDir,
|
|
5730
|
+
scan,
|
|
5731
|
+
probe: error === null ? { ok: true, stream } : { ok: false, error },
|
|
5732
|
+
// The provenance check RAN (that is what `checked: true` asserts) — see `ambiguous` above.
|
|
5733
|
+
provenance: { checked: true, ambiguous },
|
|
5734
|
+
...(options.has('expect') ? { expected } : {}),
|
|
5735
|
+
},
|
|
5736
|
+
{ resolvePath: canonical },
|
|
5737
|
+
);
|
|
5738
|
+
const exitCode = registrationExitCode(result.verdict, flags.has('strict'));
|
|
5739
|
+
|
|
5740
|
+
if (json) write(JSON.stringify({ mode: 'live', ...result, skillsRoot: scan.skillsRoot, exitCode }, null, 2));
|
|
5741
|
+
else write(renderRegistrationReport(result, scan));
|
|
5742
|
+
return exitCode;
|
|
5743
|
+
}
|
|
5744
|
+
|
|
5555
5745
|
function cmdDeliveryCheck(options: Map<string, string>, flags: Set<string>, cwd: string, write: Write): number {
|
|
5556
5746
|
let repoRoot = cwd;
|
|
5557
5747
|
try { repoRoot = execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { /* not git */ }
|
|
@@ -6095,6 +6285,8 @@ export async function runCli(argv: string[], io: CliIo = {}): Promise<number> {
|
|
|
6095
6285
|
return cmdDiscriminationCheck(options, flags, cwd, write);
|
|
6096
6286
|
case 'delivery-check':
|
|
6097
6287
|
return cmdDeliveryCheck(options, flags, cwd, write);
|
|
6288
|
+
case 'skills-verify':
|
|
6289
|
+
return cmdSkillsVerify(options, flags, cwd, write);
|
|
6098
6290
|
case 'routing':
|
|
6099
6291
|
return cmdRouting(options, flags, cwd, write);
|
|
6100
6292
|
case 'bto-optimize':
|