@dzhechkov/harness-cli 0.3.227 → 0.3.228
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 +14 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +151 -22
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +129 -25
package/README.md
CHANGED
|
@@ -289,6 +289,10 @@ Ed25519 over a file manifest, plus a CycloneDX SBOM. Zero dependencies (`node:cr
|
|
|
289
289
|
tamper-evidence, never truthfulness.
|
|
290
290
|
|
|
291
291
|
```bash
|
|
292
|
+
# One-time: generate the Ed25519 keypair. The PRIVATE key is written OUTSIDE the repo (mode 0600);
|
|
293
|
+
# the PUBLIC key is printed — commit it as keys/dz.pub. dz refuses an --out inside the repo tree.
|
|
294
|
+
dz sign --init --out ~/.dz/keys/dz.key
|
|
295
|
+
|
|
292
296
|
# Sign a pack. The private key MUST live outside the repo — dz refuses otherwise.
|
|
293
297
|
dz sign --pack packages/@dzhechkov/skills-qe --key ~/.dz/keys/dz.key
|
|
294
298
|
|
|
@@ -296,11 +300,17 @@ dz sign --pack packages/@dzhechkov/skills-qe --key ~/.dz/keys/dz.key
|
|
|
296
300
|
# whoever replaced the pack would have replaced a key shipped inside it.
|
|
297
301
|
dz verify-pack --pack packages/@dzhechkov/skills-qe # exit 0 = unmodified
|
|
298
302
|
dz verify-pack --pack ./downloaded-pack --pubkey keys/dz.pub # explicit trust root
|
|
303
|
+
|
|
304
|
+
# The SBOM on its own (CycloneDX 1.5, a file-level bill of materials for the pack):
|
|
305
|
+
dz sbom --pack packages/@dzhechkov/skills-qe # print to stdout
|
|
306
|
+
dz sbom --pack packages/@dzhechkov/skills-qe --out sbom.json # write to a file
|
|
299
307
|
```
|
|
300
308
|
|
|
301
309
|
A single flipped byte, a deleted file, or an **added** file all fail verification and the offending
|
|
302
310
|
path is named. Every degenerate input (no manifest, empty file list, empty signature, no public key)
|
|
303
|
-
fails **closed** — absence never reads as success.
|
|
311
|
+
fails **closed** — absence never reads as success. `dz doctor` **and** `dz drift-check` run this check
|
|
312
|
+
over the installed packs: a **tampered** pack is fatal (blocks); an **unsigned** pack or a missing trust
|
|
313
|
+
root is reported, not fatal (transitional — the existing packs are not yet signed).
|
|
304
314
|
|
|
305
315
|
`dz publish` runs the check before publishing anything. With `keys/dz.pub` committed, an unsigned or
|
|
306
316
|
mismatching pack **blocks the release**. Until then, packs publish unsigned and `dz publish` says so on
|
|
@@ -433,7 +443,7 @@ Get the whole set with `dz init --target claude-code --preset meta`, or pick one
|
|
|
433
443
|
|
|
434
444
|
> **A skill and its npx toolkit are not duplicates — they're a graduation.** Several skills (e.g. `feature-adr`, `design-thinking`) exist BOTH as a skill inside a `dz` preset AND as a standalone `npx` package. The preset's SKILL.md is **fully functional on its own** (the whole methodology — modules + references — travels with it, and it auto-activates by description), and it's the only way to compile that capability to the **non-Claude platforms** (Codex/OpenCode/Hermes/OpenClaude) via `dz`. The npx package adds **project-level runtime governance** around the same skill: a slash command, governance rules, a context shard, and (for feature-adr) reward-learning + `/harvest`. So: pick the **skill/preset** for a working capability across platforms; pick the **npx toolkit** when you want it as a governed, command-driven fixture of one project.
|
|
435
445
|
|
|
436
|
-
## All Commands (
|
|
446
|
+
## All Commands (53)
|
|
437
447
|
|
|
438
448
|
```
|
|
439
449
|
dz setup --target <name> [--preset <name>] [--select id,id,...] [--skills-dir <dir>] [--memory agentdb] [--no-memory] [--no-hooks] [--install-driver] [--force]
|
|
@@ -488,6 +498,8 @@ dz challenge --plan <plan.md> [--json] [--context-only] [--author <model>] # a
|
|
|
488
498
|
dz routing [--stage <s>] [--json] # inspect the learned cost-optimal routing store: what `args.models.<stage>='auto-cost'` believes per (stage, complexity-tier, model) — gated attempts/successes/rate (feeds feature-adr model selection)
|
|
489
499
|
dz bto-optimize --split|--plan|--select|--scope-check|--diff [--json] # deterministic engine behind /bto-optimize: hold-out split + hard-capped budget + no-regress-on-holdout winner selection (defeats judge-gaming); prose-only, diff-confirmed, never auto-writes
|
|
490
500
|
dz discrimination-check --test <f[,f]> [--base <ref>] [--name <filter>] [--runner <cmd>] [--json] # §42 test-discrimination gate for feature-adr Step-8: run the ADR's property test in an isolated git worktree at pre-feature base — it MUST go red without the fix; a green is a false green (HIGH finding, advisory, never auto-aborts)
|
|
501
|
+
dz sign --init --out <path> | --pack <dir> --key <path> # --init: generate the Ed25519 keypair (private OUTSIDE the repo, prints the public key for keys/dz.pub); else sign a pack's manifest + CycloneDX SBOM
|
|
502
|
+
dz sbom --pack <dir> [--out <file>] # emit the CycloneDX 1.5 SBOM for a pack standalone (file-level bill of materials); print to stdout or write to a file
|
|
491
503
|
dz publish [--filter <name>] [--bump-only] [--claim-check <off|warn|error>] (dry-run by default; pass --yes/--confirm to go live; claim-check gate defaults to warn — surfaces README claim findings, never blocks)
|
|
492
504
|
dz auto-canonicalize --source <github-url> --pack <skills-pack>
|
|
493
505
|
dz sync-upstream [--package <dir>] [--list] [--all]
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4OH,2EAA2E;AAC3E,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAovJD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA0I5E"}
|
package/dist/cli.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, renameSync, rmdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { execSync } from 'node:child_process';
|
|
10
10
|
import { homedir, tmpdir } from 'node:os';
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
|
-
import { createSkill, getSkillInfo, getWorkflow, isTargetName, listSkills, runDoctor, runInit, benchmarkSkill, benchmarkSkills, scanMcp, reconcileCapabilities, RECONCILE_BANNER, buildRegistry, discoverSkillPackDirs, checkUpstream, compareSkills, checkAllUpstream, sweepSkillDrift, syncCanonicalSkill, checkUpgrades, discoverPackages, discoverSourcePackages, fetchAllDownloads, filterByCategory, pretrain, recommend, generatePlugin, publishPackages, runSetup, runMigrate, searchRegistry, runSync, runVerify, runInitAgentsMd, runInitGeminiMd, TARGET_NAMES, WORKFLOW_NAMES, importEcc, recordPattern, resolveLearningBackend, storeStats, consolidateSessions, pruneNoisePatterns, lessonDeltaReport, removePatternsByIds, snapshotStore, recallHybrid, teachGuard, mirrorPatternsToVector, vectorMirrorEnabled, vectorTierStatus, resolveVectorEngine, reindexVectorStore, harmonizeVectorStore, importRvfCheckpoint, statuslineData, writeFeatureAdrState, computeUsage, deriveUsageCalibration, normalizeClaudeUsageModelKey, readUsageLimits, claimCheck, summarize, queryBookKnowledge, loadStorePatternsSync, patternRecordId, loadStoreRecords, recordToPattern, bundleSkills, brainHome, listBrain, promoteProjectToBrain, updateBrainSource, queryBrain, groundPrompt, expandKu, reindexBrainVectors, buildPrimer, exportBrainSlice, importBrainSlice, registerKusToBrain, RECALL_USAGE_LOG_RELATIVE, RECALL_USAGE_LOG_MAX_BYTES, parseRecallUsageLog, buildRecallUsageReport, buildManifest, buildSbom, resolveTrustRoot, decideVerifyPolicy, decideProvenance, isInsideTree, signManifest, verifyManifest, assertKeyOutsideTree, decidePublishGate, MANIFEST_NAME, SBOM_NAME, buildArchitectureMap, renderMapHuman, findArchitectureDrift, renderDriftReport, scanWorkspacePackages, loadSubsystemManifest, loadProductVision, checkFeatureAgainstArchitecture, renderArchCheck, planProjectSkills, guidanceForStage, renderInjectionReport, analyzeCorpus, renderRakeReport, renderCriticSection, rakeAsLesson, rakeReward, DEFAULT_RAKE_THRESHOLDS, streamSessionEvents, findLatestTranscript, detectProcessRakes, buildRetro, renderRetro, retroLessonText, PROCESS_SIGNATURES, RETRO_DOMAIN, scanForSetup, buildSetupPlan, scaffoldFromSpec, renderScaffoldPreview, readExistingForScaffold, assembleChallengeContext, buildChallengeBrief, planDiscriminationCheck, classifyDiscrimination, pickAdversaryModel, CHALLENGE_QUESTIONS, loadOutcomes, renderOutcomes, statsForKey, selectAutoCost, recordProvisional, finalizeOutcome, COST_LADDER, splitScenarios, budgetPlan, selectWinner, proseScopeOk, renderProseDiff, readScenarioIds, DEFAULT_MAX_JUDGE_RUNS, } from '@dzhechkov/harness-core';
|
|
12
|
+
import { createSkill, getSkillInfo, getWorkflow, isTargetName, listSkills, runDoctor, runInit, benchmarkSkill, benchmarkSkills, scanMcp, reconcileCapabilities, RECONCILE_BANNER, buildRegistry, discoverSkillPackDirs, checkUpstream, compareSkills, checkAllUpstream, sweepSkillDrift, syncCanonicalSkill, checkUpgrades, discoverPackages, discoverSourcePackages, fetchAllDownloads, filterByCategory, pretrain, recommend, generatePlugin, publishPackages, runSetup, runMigrate, searchRegistry, runSync, runVerify, runInitAgentsMd, runInitGeminiMd, TARGET_NAMES, WORKFLOW_NAMES, importEcc, recordPattern, resolveLearningBackend, storeStats, consolidateSessions, pruneNoisePatterns, lessonDeltaReport, removePatternsByIds, snapshotStore, recallHybrid, teachGuard, mirrorPatternsToVector, vectorMirrorEnabled, vectorTierStatus, resolveVectorEngine, reindexVectorStore, harmonizeVectorStore, importRvfCheckpoint, statuslineData, writeFeatureAdrState, computeUsage, deriveUsageCalibration, normalizeClaudeUsageModelKey, readUsageLimits, claimCheck, summarize, queryBookKnowledge, loadStorePatternsSync, patternRecordId, loadStoreRecords, recordToPattern, bundleSkills, brainHome, listBrain, promoteProjectToBrain, updateBrainSource, queryBrain, groundPrompt, expandKu, reindexBrainVectors, buildPrimer, exportBrainSlice, importBrainSlice, registerKusToBrain, RECALL_USAGE_LOG_RELATIVE, RECALL_USAGE_LOG_MAX_BYTES, parseRecallUsageLog, buildRecallUsageReport, buildManifest, buildSbom, resolveTrustRoot, decideVerifyPolicy, generateSigningKeypair, decideProvenance, isInsideTree, signManifest, verifyManifest, assertKeyOutsideTree, decidePublishGate, MANIFEST_NAME, SBOM_NAME, buildArchitectureMap, renderMapHuman, findArchitectureDrift, renderDriftReport, scanWorkspacePackages, loadSubsystemManifest, loadProductVision, checkFeatureAgainstArchitecture, renderArchCheck, planProjectSkills, guidanceForStage, renderInjectionReport, analyzeCorpus, renderRakeReport, renderCriticSection, rakeAsLesson, rakeReward, DEFAULT_RAKE_THRESHOLDS, streamSessionEvents, findLatestTranscript, detectProcessRakes, buildRetro, renderRetro, retroLessonText, PROCESS_SIGNATURES, RETRO_DOMAIN, scanForSetup, buildSetupPlan, scaffoldFromSpec, renderScaffoldPreview, readExistingForScaffold, assembleChallengeContext, buildChallengeBrief, planDiscriminationCheck, classifyDiscrimination, pickAdversaryModel, CHALLENGE_QUESTIONS, loadOutcomes, renderOutcomes, statsForKey, selectAutoCost, recordProvisional, finalizeOutcome, COST_LADDER, splitScenarios, budgetPlan, selectWinner, proseScopeOk, renderProseDiff, readScenarioIds, DEFAULT_MAX_JUDGE_RUNS, } from '@dzhechkov/harness-core';
|
|
13
13
|
import { getPreset, PRESET_NAMES } from '@dzhechkov/harness-presets';
|
|
14
14
|
import { scanGitHub, analyzeRepo, generateReport, deepAnalyze, scanAllSources, ScoutMemory } from '@dzhechkov/scout';
|
|
15
15
|
const USAGE = `dz - DZ cross-platform harness CLI
|
|
@@ -2912,10 +2912,86 @@ function reportPackVerification(cwd, explicitPubkey, requireSigning, write) {
|
|
|
2912
2912
|
return fatal > 0 ? 1 : 0;
|
|
2913
2913
|
}
|
|
2914
2914
|
function cmdSign(options, flags, cwd, write) {
|
|
2915
|
+
// `dz sign --init` — one-time keygen. Writes the PRIVATE key OUTSIDE the repo (default ~/.dz/keys/dz.key,
|
|
2916
|
+
// mode 0600) and prints the PUBLIC key for the operator to commit as keys/dz.pub. The private key never
|
|
2917
|
+
// touches the repo or a tarball (the hard invariant — enforced by assertKeyOutsideTree).
|
|
2918
|
+
if (flags.has('init')) {
|
|
2919
|
+
const outPath = resolve(cwd, options.get('out') ?? join(homedir(), '.dz', 'keys', 'dz.key'));
|
|
2920
|
+
// Resolve symlinks BEFORE the containment check: an --out (or a parent dir) that is a symlink pointing
|
|
2921
|
+
// INTO the repo would otherwise slip the private key inside the tree past a string-only guard — including a
|
|
2922
|
+
// DANGLING symlink whose target does not exist yet (existsSync follows the link and reports false, so the
|
|
2923
|
+
// symlink itself must be resolved via lstat/readlink, not existsSync).
|
|
2924
|
+
const realTarget = (() => {
|
|
2925
|
+
// walk up to the deepest path that exists as ANY entry (file, dir, or even a dangling symlink).
|
|
2926
|
+
let anc = outPath;
|
|
2927
|
+
const tail = [];
|
|
2928
|
+
for (;;) {
|
|
2929
|
+
try {
|
|
2930
|
+
lstatSync(anc);
|
|
2931
|
+
break;
|
|
2932
|
+
}
|
|
2933
|
+
catch { /* not present */ }
|
|
2934
|
+
const parent = dirname(anc);
|
|
2935
|
+
if (parent === anc)
|
|
2936
|
+
return outPath; // reached root without an existing entry
|
|
2937
|
+
tail.unshift(basename(anc));
|
|
2938
|
+
anc = parent;
|
|
2939
|
+
}
|
|
2940
|
+
let base;
|
|
2941
|
+
try {
|
|
2942
|
+
base = realpathSync(anc); // resolves dirs/files and any RESOLVABLE symlink chain
|
|
2943
|
+
}
|
|
2944
|
+
catch {
|
|
2945
|
+
// `anc` exists but realpath threw → a dangling symlink: resolve its immediate target by hand.
|
|
2946
|
+
try {
|
|
2947
|
+
base = resolve(dirname(anc), readlinkSync(anc));
|
|
2948
|
+
}
|
|
2949
|
+
catch {
|
|
2950
|
+
return outPath;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
return tail.length ? join(base, ...tail) : base;
|
|
2954
|
+
})();
|
|
2955
|
+
try {
|
|
2956
|
+
assertKeyOutsideTree(realTarget, cwd);
|
|
2957
|
+
}
|
|
2958
|
+
catch (err) {
|
|
2959
|
+
write(`dz sign --init: ${err.message}`);
|
|
2960
|
+
write(' choose an --out path (and parent) OUTSIDE the repository (e.g. ~/.dz/keys/dz.key)');
|
|
2961
|
+
return 1;
|
|
2962
|
+
}
|
|
2963
|
+
if (existsSync(outPath) && !flags.has('force')) {
|
|
2964
|
+
write(`dz sign --init: ${outPath} already exists — refusing to overwrite (pass --force to replace)`);
|
|
2965
|
+
write(' overwriting a signing key orphans every pack signed with the old one.');
|
|
2966
|
+
return 1;
|
|
2967
|
+
}
|
|
2968
|
+
const { privateKey, publicKey } = generateSigningKeypair();
|
|
2969
|
+
try {
|
|
2970
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
2971
|
+
// Unlink an existing file first: writeFileSync's `mode` is ignored when the file already exists, so a
|
|
2972
|
+
// pre-existing 0644 key would stay world-readable after --force. Removing it forces a fresh 0600 create.
|
|
2973
|
+
if (existsSync(outPath))
|
|
2974
|
+
rmSync(outPath, { force: true });
|
|
2975
|
+
writeFileSync(outPath, privateKey, { mode: 0o600 });
|
|
2976
|
+
chmodSync(outPath, 0o600); // belt-and-suspenders: guarantee 0600 regardless of umask/prior state
|
|
2977
|
+
}
|
|
2978
|
+
catch (err) {
|
|
2979
|
+
write(`dz sign --init: could not write the private key to ${outPath}: ${err.message}`);
|
|
2980
|
+
return 1;
|
|
2981
|
+
}
|
|
2982
|
+
write(`dz sign --init: Ed25519 keypair generated.`);
|
|
2983
|
+
write(` private key → ${outPath} (mode 0600, OUTSIDE the repo — never commit it)`);
|
|
2984
|
+
write(` public key → commit the block below as ${TRUST_ROOT_REL}:`);
|
|
2985
|
+
write('');
|
|
2986
|
+
write(publicKey.trimEnd());
|
|
2987
|
+
write('');
|
|
2988
|
+
write(` then: dz sign --pack <dir> --key ${outPath} (sign a pack)`);
|
|
2989
|
+
return 0;
|
|
2990
|
+
}
|
|
2915
2991
|
const pack = options.get('pack');
|
|
2916
2992
|
const key = options.get('key');
|
|
2917
2993
|
if (!pack || !key) {
|
|
2918
|
-
write('dz sign: --pack <dir> and --key <path> are both required');
|
|
2994
|
+
write('dz sign: --pack <dir> and --key <path> are both required (or: dz sign --init to generate a keypair)');
|
|
2919
2995
|
write(' the key path MUST be outside the repository working tree (a leaked signing key is not revertible)');
|
|
2920
2996
|
return 1;
|
|
2921
2997
|
}
|
|
@@ -2984,6 +3060,49 @@ function cmdVerifyPack(options, flags, cwd, write) {
|
|
|
2984
3060
|
write(` ${f.path}: ${f.reason}`);
|
|
2985
3061
|
return 1;
|
|
2986
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* `dz sbom` — emit a CycloneDX 1.5 SBOM (Software Bill of Materials) for a pack, standalone (no signing).
|
|
3065
|
+
* The same inventory `dz sign` writes as `sbom.json`, available on its own for audit/procurement. Components
|
|
3066
|
+
* are the pack's shipped files with their SHA-256 — a file-level bill of materials for the pack.
|
|
3067
|
+
* --pack <dir> the pack to inventory (required)
|
|
3068
|
+
* --out <file> write here (default: print to stdout)
|
|
3069
|
+
* --json (implied) SPDX/CycloneDX is already JSON
|
|
3070
|
+
*/
|
|
3071
|
+
function cmdSbom(options, flags, cwd, write) {
|
|
3072
|
+
const pack = options.get('pack');
|
|
3073
|
+
if (!pack) {
|
|
3074
|
+
write('dz sbom: --pack <dir> is required');
|
|
3075
|
+
return 1;
|
|
3076
|
+
}
|
|
3077
|
+
const packDir = resolve(cwd, pack);
|
|
3078
|
+
if (!existsSync(packDir)) {
|
|
3079
|
+
write(`dz sbom: no such pack: ${packDir}`);
|
|
3080
|
+
return 1;
|
|
3081
|
+
}
|
|
3082
|
+
const files = packFiles(packDir);
|
|
3083
|
+
if (files.length === 0) {
|
|
3084
|
+
write('dz sbom: the pack contains no files');
|
|
3085
|
+
return 1;
|
|
3086
|
+
}
|
|
3087
|
+
const manifest = buildManifest(packDir, basename(packDir), files);
|
|
3088
|
+
const sbom = buildSbom(manifest);
|
|
3089
|
+
const out = JSON.stringify(sbom, null, 2);
|
|
3090
|
+
const outOpt = options.get('out');
|
|
3091
|
+
if (outOpt !== undefined) {
|
|
3092
|
+
const outPath = resolve(cwd, outOpt);
|
|
3093
|
+
try {
|
|
3094
|
+
writeFileSync(outPath, out + '\n');
|
|
3095
|
+
}
|
|
3096
|
+
catch (err) {
|
|
3097
|
+
write(`dz sbom: could not write ${outPath}: ${err.message}`);
|
|
3098
|
+
return 1;
|
|
3099
|
+
}
|
|
3100
|
+
write(`dz sbom: ${sbom.components.length} component(s) → ${outPath} (CycloneDX ${sbom.specVersion})`);
|
|
3101
|
+
return 0;
|
|
3102
|
+
}
|
|
3103
|
+
write(out);
|
|
3104
|
+
return 0;
|
|
3105
|
+
}
|
|
2987
3106
|
function cmdPublish(options, flags, cwd, write) {
|
|
2988
3107
|
// Reject unknown flags/options so a typo (e.g. `--dry-rum`) can NEVER be
|
|
2989
3108
|
// silently swallowed and flip the command into live-publish mode.
|
|
@@ -3739,29 +3858,37 @@ function cmdDriftCheck(options, flags, cwd, write) {
|
|
|
3739
3858
|
write(`allowlisted (accepted drift): ${r.allowlisted.map((d) => d.name).join(', ')}`);
|
|
3740
3859
|
}
|
|
3741
3860
|
write(`DRIFTED (unexpected, byte-differences between copies): ${r.drifted.length}`);
|
|
3861
|
+
let driftExit = 0;
|
|
3742
3862
|
if (r.drifted.length === 0) {
|
|
3743
3863
|
write('✓ no unexpected intra-monorepo skill drift');
|
|
3744
|
-
return 0;
|
|
3745
|
-
}
|
|
3746
|
-
write('');
|
|
3747
|
-
write('skill'.padEnd(34) + 'copies drift/total');
|
|
3748
|
-
for (const d of r.drifted) {
|
|
3749
|
-
write(d.name.padEnd(34) +
|
|
3750
|
-
String(d.copies).padStart(4) +
|
|
3751
|
-
' ' +
|
|
3752
|
-
`${d.driftFiles}/${d.totalFiles}` +
|
|
3753
|
-
(d.missingFiles ? ` (+${d.missingFiles} missing)` : ''));
|
|
3754
3864
|
}
|
|
3865
|
+
else {
|
|
3866
|
+
write('');
|
|
3867
|
+
write('skill'.padEnd(34) + 'copies drift/total');
|
|
3868
|
+
for (const d of r.drifted) {
|
|
3869
|
+
write(d.name.padEnd(34) +
|
|
3870
|
+
String(d.copies).padStart(4) +
|
|
3871
|
+
' ' +
|
|
3872
|
+
`${d.driftFiles}/${d.totalFiles}` +
|
|
3873
|
+
(d.missingFiles ? ` (+${d.missingFiles} missing)` : ''));
|
|
3874
|
+
}
|
|
3875
|
+
write('');
|
|
3876
|
+
write('→ fix each: heal drift, then commit. Remediation per skill:');
|
|
3877
|
+
for (const d of r.drifted) {
|
|
3878
|
+
const hasMeta = existsSync(join(root, 'packages', '@dzhechkov', 'skills-meta', d.name));
|
|
3879
|
+
write(hasMeta
|
|
3880
|
+
? ` dz sync-canonical ${d.name}`
|
|
3881
|
+
: ` dz sync-canonical ${d.name} --from <a-known-good-copy> (no skills-meta canonical)`);
|
|
3882
|
+
}
|
|
3883
|
+
write(' (accept a drift intentionally: add its name to .dz/drift-allowlist.json with a reason)');
|
|
3884
|
+
driftExit = 1; // EXIT CODE 1 = the CI gate trips
|
|
3885
|
+
}
|
|
3886
|
+
// Supplementary CI check: installed-pack signatures. A TAMPERED pack trips the gate (fatal); an unsigned
|
|
3887
|
+
// pack or a missing trust root is reported, not fatal — the same warn/block posture as `dz doctor` (the
|
|
3888
|
+
// primary signature gate). drift-check surfaces it so the CI drift view also flags a tampered pack.
|
|
3755
3889
|
write('');
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
const hasMeta = existsSync(join(root, 'packages', '@dzhechkov', 'skills-meta', d.name));
|
|
3759
|
-
write(hasMeta
|
|
3760
|
-
? ` dz sync-canonical ${d.name}`
|
|
3761
|
-
: ` dz sync-canonical ${d.name} --from <a-known-good-copy> (no skills-meta canonical)`);
|
|
3762
|
-
}
|
|
3763
|
-
write(' (accept a drift intentionally: add its name to .dz/drift-allowlist.json with a reason)');
|
|
3764
|
-
return 1; // EXIT CODE 1 = the CI gate trips
|
|
3890
|
+
const sigFatal = reportPackVerification(root, options.get('pubkey'), flags.has('require-signing'), write);
|
|
3891
|
+
return driftExit || sigFatal;
|
|
3765
3892
|
}
|
|
3766
3893
|
/**
|
|
3767
3894
|
* `dz sync-canonical <skill>` — the healer. Treats the resolved canonical (`--from` →
|
|
@@ -4784,6 +4911,8 @@ export async function runCli(argv, io = {}) {
|
|
|
4784
4911
|
return cmdClaimCheck(options, optionLists, flags, cwd, write);
|
|
4785
4912
|
case 'sign':
|
|
4786
4913
|
return cmdSign(options, flags, cwd, write);
|
|
4914
|
+
case 'sbom':
|
|
4915
|
+
return cmdSbom(options, flags, cwd, write);
|
|
4787
4916
|
case 'verify-pack':
|
|
4788
4917
|
return cmdVerifyPack(options, flags, cwd, write);
|
|
4789
4918
|
case 'setup':
|