dsh-triage 0.2.0 → 0.3.0
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/dist/audit-data.d.ts.map +1 -1
- package/dist/audit-data.js +5 -2
- package/dist/audit-data.js.map +1 -1
- package/dist/cli.js +352 -27
- package/dist/cli.js.map +1 -1
- package/dist/fix.d.ts +115 -0
- package/dist/fix.d.ts.map +1 -0
- package/dist/fix.js +267 -0
- package/dist/fix.js.map +1 -0
- package/dist/serve.d.ts +49 -14
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +1023 -141
- package/dist/serve.js.map +1 -1
- package/dist/summary.d.ts +78 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +235 -0
- package/dist/summary.js.map +1 -0
- package/package.json +7 -4
package/dist/audit-data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-data.d.ts","sourceRoot":"","sources":["../src/audit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAIL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"audit-data.d.ts","sourceRoot":"","sources":["../src/audit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAIL,qBAAqB,EAWrB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAwC,WAAW,EAAE,MAAM,WAAW,CAAA;AAE7E,8FAA8F;AAC9F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAA;IAC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CAAA;CAAE,GACvD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8EzB;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,UAAU,CAOnE"}
|
package/dist/audit-data.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { readFileSync } from 'node:fs';
|
|
15
15
|
import { homedir, tmpdir } from 'node:os';
|
|
16
|
-
import { compareInventory, extractEntryClaims, extractPresetDeclarations, findEntryIdCollisions, groupClaimsBySource, parseInventorySnapshot, parsePatchYaml, redactEnv, redactPath, redactVerdict, rowTargets, verdictsFromInventory, verdictsFromRowAdmission, } from '@dsh-triage/core';
|
|
16
|
+
import { compareInventory, extractEntryClaims, extractPresetDeclarations, findEntryIdCollisions, groupClaimsBySource, parseInventorySnapshot, parsePatchYaml, redactEnv, redactPath, redactVerdict, rowTargets, verdictsFromInventory, readProfileExemptions, verdictsFromRowAdmission, } from '@dsh-triage/core';
|
|
17
17
|
import { discoverLocalArtifacts } from '@dsh-triage/signals';
|
|
18
18
|
import { findDuplicateCopies, loadComposition, resolveRows } from './load.js';
|
|
19
19
|
/**
|
|
@@ -36,7 +36,10 @@ export async function loadAuditData(input) {
|
|
|
36
36
|
// every row, not only for the denied ones (R8 adversary finding F11).
|
|
37
37
|
const rows = await resolveRows(input.env, rowTargetsOf(claims));
|
|
38
38
|
// T-105: `why` and `audit` must reach the SAME row-level admission conclusion.
|
|
39
|
-
|
|
39
|
+
// A profile can exempt an exact plugin@version for an exact runtime. The loader honours it at
|
|
40
|
+
// boot, so judging the row blind would make this tool disagree with the running profile.
|
|
41
|
+
const exemptions = readProfileExemptions(input.env.profileDir).exemptions;
|
|
42
|
+
const rowVerdicts = verdictsFromRowAdmission({ env: input.env, rows, exemptions, generatedAt: input.stamp });
|
|
40
43
|
let snapshot = null;
|
|
41
44
|
let inventoryVerdicts = [];
|
|
42
45
|
let diff = { missing: [], undeclared: [], ambiguous: [] };
|
package/dist/audit-data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-data.js","sourceRoot":"","sources":["../src/audit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,wBAAwB,GAOzB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAsB,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAyC7E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAqB;IACvD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACnE,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;IACjD,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;IACzE,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;IAC9E,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,KAAK,CAAC,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;YAC3D,MAAM,MAAM,GAAG,UAAU,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;YACtD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACxC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;gBACvE,SAAQ;YACV,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,GAAG,yBAAyB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Exit codes: 0 ok · 1 findings (audit always, others only with --strict) · 2 usage · 3 unavailable
|
|
13
13
|
*/
|
|
14
|
-
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
15
15
|
import { createHash } from 'node:crypto';
|
|
16
16
|
import { homedir, tmpdir } from 'node:os';
|
|
17
|
-
import { join, resolve } from 'node:path';
|
|
17
|
+
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
18
18
|
import process from 'node:process';
|
|
19
|
-
import { catalogFor, compareInventory, evaluateAdmission, extractEntryClaims, extractPresetDeclarations, findEntryIdCollisions, findPresetDivergence, format, groupClaimsBySource, hasNewDenials, judgeUpgradeImpact, judgeVersionDrift, loadEnv, parseInventorySnapshot, parsePatchYaml, redactEnv, redactPath, redactVerdict, registryFactFor, renderUpgradeImpact, renderVerdict, rowTargets, upgradeTargetProblem, verdictFromAdmission, verdictsFromCollisions, verdictsFromDuplicateCopies, verdictsFromInventory, verdictsFromRowAdmission, } from '@dsh-triage/core';
|
|
19
|
+
import { catalogFor, compareInventory, DIST_TAG_PACKAGE, distTagTargetOf, evaluateAdmission, extractEntryClaims, extractPresetDeclarations, findEntryIdCollisions, findPresetDivergence, format, groupClaimsBySource, hasNewDenials, judgeUpgradeImpact, judgeVersionDrift, loadEnv, parseInventorySnapshot, parsePatchYaml, redactEnv, redactPath, redactVerdict, registryFactFor, renderUpgradeImpact, renderUpgradeCard, renderVerdict, resolveDistTagTarget, rowTargets, upgradeTargetProblem, verdictFromAdmission, verdictsFromCollisions, verdictsFromDuplicateCopies, verdictsFromInventory, verdictsFromRowAdmission, } from '@dsh-triage/core';
|
|
20
20
|
import { buildProbePlan, executeProbe, findFreePort, judgeProbe, probeVerdict } from '@dsh-triage/probe';
|
|
21
21
|
import { discoverLocalArtifacts, fetchPackument } from '@dsh-triage/signals';
|
|
22
22
|
import { auditExitOutcome, auditJsonPayload, auditRedactRoots, loadAuditData, redactedEnv, redactedVerdicts, } from './audit-data.js';
|
|
@@ -28,7 +28,9 @@ import { localPriorFor, renderPrior } from './outcomes/prior.js';
|
|
|
28
28
|
import { outcomeStatus, purgeOutcomes, renderPurge, renderStatus } from './outcomes/purge.js';
|
|
29
29
|
import { recordOutcomes } from './outcomes/store.js';
|
|
30
30
|
import { candidatePackageName, normalizeCandidateSpec, probeScratchRoot, realDshHomeOf, realProbeDeps, sandboxBundles, } from './probe-run.js';
|
|
31
|
+
import { applyExemptionFixes, planFixes, readProfileDependencies, runtimeSupportsExemptions, undoFix } from './fix.js';
|
|
31
32
|
import { startPanel } from './serve.js';
|
|
33
|
+
import { buildProfileSummary, formatProfileSummary } from './summary.js';
|
|
32
34
|
const EXIT_OK = 0;
|
|
33
35
|
const EXIT_FINDINGS = 1;
|
|
34
36
|
const EXIT_USAGE = 2;
|
|
@@ -41,19 +43,25 @@ const MAX_RENDERED_VERDICTS = 20;
|
|
|
41
43
|
const HELP = `dsh-triage — the judgment layer for DeepSeek Harness plugins
|
|
42
44
|
|
|
43
45
|
Usage
|
|
46
|
+
dsh-triage one screen: is this profile broken, which row, what to type
|
|
47
|
+
dsh-triage status the same answer, as an explicit command
|
|
44
48
|
dsh-triage env environment fingerprint
|
|
45
49
|
dsh-triage why why did a plugin silently disappear?
|
|
46
50
|
dsh-triage check <pkg[@version]> judge a candidate before installing
|
|
47
|
-
dsh-triage audit
|
|
51
|
+
dsh-triage audit the same answer, plus the full ledger with --all
|
|
48
52
|
dsh-triage probe <pkg[@version]> print an isolated probe plan (dry-run)
|
|
49
|
-
dsh-triage serve open
|
|
53
|
+
dsh-triage serve open the local panel (127.0.0.1, token-gated)
|
|
50
54
|
dsh-triage badge <pkg[@version]> shields-style SVG rendered from recorded evidence
|
|
51
55
|
dsh-triage index format-1 market index of versions measured "go" here
|
|
52
56
|
dsh-triage outcomes local outcome store: status / --enable / --disable / --purge
|
|
53
57
|
dsh-triage upgrade --to <version> which rows/bundles the target dsh would deny, and how to fix
|
|
58
|
+
dsh-triage upgrade --to next|latest same judgement, with the target resolved from npm dist-tags
|
|
59
|
+
dsh-triage fix what can be repaired automatically; --apply writes, --undo reverts
|
|
54
60
|
Flags
|
|
55
61
|
--json machine-readable output
|
|
56
|
-
--all include findings that are not blocking
|
|
62
|
+
--all include findings that are not blocking (audit: print the full ledger)
|
|
63
|
+
--apply (fix) actually write the plan; without it nothing is written
|
|
64
|
+
--undo <journal> (fix) restore the files an earlier --apply changed
|
|
57
65
|
--strict exit 1 when a conclusion is not "go"
|
|
58
66
|
--profile <name> profile name (default: web)
|
|
59
67
|
--dsh-home <path> override $DSH_HOME (default: ~/.dsh)
|
|
@@ -72,16 +80,18 @@ Flags
|
|
|
72
80
|
--copy-profile <name> (probe) measure inside a copy of this profile's declarations (T-304)
|
|
73
81
|
--port <n> (serve) port to bind on 127.0.0.1; 0 picks a free one
|
|
74
82
|
--results <dir> (serve, badge) directory of evidence to read (default: ./data/results)
|
|
75
|
-
--out <file> (badge) write the SVG here
|
|
83
|
+
--out <file> (badge) write the SVG here; (upgrade --card) write the card here, print the path
|
|
76
84
|
--allow-execute (serve) enable actions; without it the panel is read-only
|
|
85
|
+
--no-audit (serve) artifacts only; skip reading the current profile
|
|
77
86
|
--audit (serve) expose GET /api/audit (current composition, same engine as the CLI)
|
|
78
87
|
--outcomes <mode> (check, probe) record this verdict locally: off | local (per-run, not saved)
|
|
79
88
|
--enable (outcomes) opt in to the local outcome store
|
|
80
89
|
--disable (outcomes) opt out again; existing records are kept until --purge
|
|
81
90
|
--purge (outcomes) delete every record this tool stored, then the directory
|
|
82
91
|
--status (outcomes) how many records exist (default when no verb is given)
|
|
83
|
-
--to <version> (upgrade) target dsh
|
|
92
|
+
--to <version> (upgrade) target dsh: exact semver (e.g. 0.3.0), or next / latest (resolved from npm)
|
|
84
93
|
--registry (upgrade) annotate with published builds that declare the target (offline by default)
|
|
94
|
+
--card (upgrade) paste-ready markdown for the release discussion (four buckets + boundary)
|
|
85
95
|
--help this text
|
|
86
96
|
|
|
87
97
|
Exit codes: 0 ok · 1 findings (audit always, others only with --strict) · 2 usage · 3 unavailable
|
|
@@ -97,6 +107,10 @@ async function run(argv) {
|
|
|
97
107
|
case 'help':
|
|
98
108
|
process.stdout.write(HELP);
|
|
99
109
|
return EXIT_OK;
|
|
110
|
+
case 'status':
|
|
111
|
+
return commandStatus(flags);
|
|
112
|
+
case 'fix':
|
|
113
|
+
return commandFix(flags);
|
|
100
114
|
case 'env':
|
|
101
115
|
return commandEnv(flags);
|
|
102
116
|
case 'why':
|
|
@@ -379,23 +393,36 @@ async function commandWhy(flags) {
|
|
|
379
393
|
* Nothing here re-implements a range, and nothing here claims a boot was measured.
|
|
380
394
|
*
|
|
381
395
|
* NOT DONE ON PURPOSE: no profile edit, no automatic pin, no probe run, and no network unless
|
|
382
|
-
* `--registry` is passed
|
|
396
|
+
* `--registry` is passed or the target is one of the two dist-tag keywords (`next` / `latest`,
|
|
397
|
+
* M6 C9). Registry facts are annotations that cannot move a unit; a dist-tag only decides which
|
|
398
|
+
* exact version gets judged, and then the same engine judges it.
|
|
383
399
|
*/
|
|
384
400
|
async function commandUpgrade(flags) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
401
|
+
// No target, no judgement (M6 C8): the guidance reports what could be read and never invents
|
|
402
|
+
// a target, a bucket or a verdict.
|
|
403
|
+
if (flags.to === null)
|
|
404
|
+
return commandUpgradeGuidance(flags);
|
|
405
|
+
const stamp = stampOf(flags);
|
|
389
406
|
// Validate BEFORE reading anything: a bad target must be a usage error whether or not the
|
|
390
407
|
// profile exists, and must never reach `satisfies()` (which returns false for garbage and
|
|
391
408
|
// would turn "bad flag" into "everything will break").
|
|
392
|
-
|
|
409
|
+
let target = flags.to.trim();
|
|
410
|
+
let distTag = null;
|
|
411
|
+
const requestedTag = distTagTargetOf(target);
|
|
412
|
+
if (requestedTag !== null) {
|
|
413
|
+
const resolved = await resolveUpgradeTag(requestedTag, stamp);
|
|
414
|
+
if (resolved === null)
|
|
415
|
+
return EXIT_UNAVAILABLE;
|
|
416
|
+
target = resolved.version;
|
|
417
|
+
distTag = resolved;
|
|
418
|
+
// stdout stays the report — the card gets pasted in public, so the resolution goes to stderr.
|
|
419
|
+
process.stderr.write(`target ${distTag.tag} → ${distTag.version} (npm ${DIST_TAG_PACKAGE})\n`);
|
|
420
|
+
}
|
|
421
|
+
const problem = upgradeTargetProblem(target);
|
|
393
422
|
if (problem !== null) {
|
|
394
423
|
process.stderr.write(`${problem}\n`);
|
|
395
424
|
return EXIT_USAGE;
|
|
396
425
|
}
|
|
397
|
-
const target = flags.to.trim();
|
|
398
|
-
const stamp = stampOf(flags);
|
|
399
426
|
const warnings = [];
|
|
400
427
|
let env;
|
|
401
428
|
let bundles;
|
|
@@ -468,7 +495,35 @@ async function commandUpgrade(flags) {
|
|
|
468
495
|
}
|
|
469
496
|
const impact = judged.impact;
|
|
470
497
|
if (flags.json) {
|
|
471
|
-
|
|
498
|
+
// One output per run (M6 N7): `--json` wins, and the ignored `--card` / `--out` are said out loud
|
|
499
|
+
// rather than dropped silently.
|
|
500
|
+
if (flags.card)
|
|
501
|
+
process.stderr.write('card: ignored because --json was given (one output per run)\n');
|
|
502
|
+
if (flags.out !== null)
|
|
503
|
+
process.stderr.write('out: ignored because --json was given (one output per run)\n');
|
|
504
|
+
writeJson(upgradeJsonPayload(impact, distTag));
|
|
505
|
+
}
|
|
506
|
+
else if (flags.card) {
|
|
507
|
+
const card = renderUpgradeCard(impact, {
|
|
508
|
+
locale: flags.locale,
|
|
509
|
+
redactRoots: [homedir(), flags.dshHome ?? resolveDshHome(flags)],
|
|
510
|
+
});
|
|
511
|
+
if (flags.out === null) {
|
|
512
|
+
process.stdout.write(card);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
// M6 C10: the file gets the same bytes a bare `--card` prints, written atomically. Nothing
|
|
516
|
+
// half-written is left behind, and stdout carries only the path a user can copy.
|
|
517
|
+
const written = writeCardFile(flags.out, card);
|
|
518
|
+
if (!written.ok) {
|
|
519
|
+
process.stderr.write(`${written.detail}\n`);
|
|
520
|
+
return written.reason === 'exists' ? EXIT_USAGE : EXIT_UNAVAILABLE;
|
|
521
|
+
}
|
|
522
|
+
process.stdout.write(`${written.display}\n`);
|
|
523
|
+
}
|
|
524
|
+
// The card is pasted in public, so warnings go to stderr: a `warn` line inside the markdown would be copied too.
|
|
525
|
+
for (const warning of warnings)
|
|
526
|
+
process.stderr.write(`warn ${warning}\n`);
|
|
472
527
|
}
|
|
473
528
|
else {
|
|
474
529
|
process.stdout.write(renderUpgradeImpact(impact, flags.locale));
|
|
@@ -477,6 +532,113 @@ async function commandUpgrade(flags) {
|
|
|
477
532
|
}
|
|
478
533
|
return flags.strict && hasNewDenials(impact) ? EXIT_FINDINGS : EXIT_OK;
|
|
479
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Turn `next` / `latest` into the exact version the registry publishes (`T-806`, M6 C9).
|
|
537
|
+
*
|
|
538
|
+
* Two refusals, both exit 3 and both producing **no bucket**: npm did not answer, or the tag exists
|
|
539
|
+
* but does not name an exact version. Neither is a finding about the user's composition, so neither
|
|
540
|
+
* may be reported as one.
|
|
541
|
+
*/
|
|
542
|
+
async function resolveUpgradeTag(tag, stamp) {
|
|
543
|
+
const packument = await fetchPackument(DIST_TAG_PACKAGE, { at: stamp });
|
|
544
|
+
if (!packument.ok) {
|
|
545
|
+
process.stderr.write(`cannot resolve --to ${tag}: npm did not answer for ${DIST_TAG_PACKAGE} (${packument.error.code}) — ${packument.error.detail}\n`);
|
|
546
|
+
process.stderr.write('hint: pass the exact version instead — that path never touches the network\n');
|
|
547
|
+
return null;
|
|
548
|
+
}
|
|
549
|
+
const resolved = resolveDistTagTarget({ requested: tag, distTags: packument.value.distTags });
|
|
550
|
+
if (!resolved.ok) {
|
|
551
|
+
process.stderr.write(`${resolved.detail}\n`);
|
|
552
|
+
process.stderr.write('hint: pass the exact version instead — that path never touches the network\n');
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
return { tag: resolved.tag, version: resolved.version };
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* `upgrade` with no `--to` (`T-807`, M6 C8): say what could be read, and refuse to judge.
|
|
559
|
+
*
|
|
560
|
+
* WHY IT STILL EXITS 2: without a target there is nothing to judge, and an empty report would read
|
|
561
|
+
* as "nothing will break". The guidance is on stderr for the same reason every other usage path is:
|
|
562
|
+
* a non-zero exit must never put a report-shaped thing on stdout.
|
|
563
|
+
*
|
|
564
|
+
* WHY IT READS THE REGISTRY ONCE: "your options are next=X / latest=Z" is the whole point of the
|
|
565
|
+
* guidance (a stranger should not have to guess a version string). That single read is bounded and
|
|
566
|
+
* read-only; when it fails the line says `unknown` and no value is invented.
|
|
567
|
+
*/
|
|
568
|
+
async function commandUpgradeGuidance(flags) {
|
|
569
|
+
const catalog = catalogFor(flags.locale);
|
|
570
|
+
const line = (id, params) => {
|
|
571
|
+
const template = catalog.messages[id];
|
|
572
|
+
return template === undefined ? id : format(template, params);
|
|
573
|
+
};
|
|
574
|
+
const out = [line('upgrade.guidance.headline')];
|
|
575
|
+
const dshHome = resolve(resolveDshHome(flags));
|
|
576
|
+
const envReading = await loadEnv({ dshHome, profile: flags.profile });
|
|
577
|
+
if (!envReading.ok) {
|
|
578
|
+
out.push(line('upgrade.guidance.current-unknown', { detail: `${envReading.error.code} — ${envReading.error.detail}` }));
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
const runtime = envReading.value.dsh === null ? null : envReading.value.dsh.trim();
|
|
582
|
+
out.push(runtime === null || runtime === ''
|
|
583
|
+
? line('upgrade.guidance.current-unknown', { detail: 'this profile declares no dsh version' })
|
|
584
|
+
: line('upgrade.guidance.current', { version: runtime, profile: envReading.value.profile }));
|
|
585
|
+
}
|
|
586
|
+
const packument = await fetchPackument(DIST_TAG_PACKAGE, { at: stampOf(flags) });
|
|
587
|
+
if (!packument.ok) {
|
|
588
|
+
out.push(line('upgrade.guidance.targets-unknown', { detail: `npm ${packument.error.code}` }));
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
const next = packument.value.distTags['next'];
|
|
592
|
+
const latest = packument.value.distTags['latest'];
|
|
593
|
+
out.push(next === undefined && latest === undefined
|
|
594
|
+
? line('upgrade.guidance.targets-unknown', { detail: `${DIST_TAG_PACKAGE} publishes no next/latest dist-tag` })
|
|
595
|
+
: line('upgrade.guidance.targets', { next: next ?? '—', latest: latest ?? '—', package: DIST_TAG_PACKAGE }));
|
|
596
|
+
}
|
|
597
|
+
out.push(line('upgrade.guidance.next-step'));
|
|
598
|
+
process.stderr.write(`${out.join('\n')}\n`);
|
|
599
|
+
return EXIT_USAGE;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Write the card atomically (`T-808`, M6 C10).
|
|
603
|
+
*
|
|
604
|
+
* Refuses to overwrite (a card is evidence a user may be about to paste; silently replacing it is
|
|
605
|
+
* how two different readings end up in one file), and never leaves a partial file: the text lands
|
|
606
|
+
* in a sibling temp file first and is renamed into place.
|
|
607
|
+
*
|
|
608
|
+
* The printed path is relative when the file is under the current directory: the card's stdout is
|
|
609
|
+
* the thing users copy into a public issue, and `C:\\Users\\<name>` must never ride along.
|
|
610
|
+
*/
|
|
611
|
+
function writeCardFile(rawPath, text) {
|
|
612
|
+
const target = resolve(rawPath);
|
|
613
|
+
if (existsSync(target)) {
|
|
614
|
+
// A usage error, not an outage: the user picked a path that already holds something.
|
|
615
|
+
return {
|
|
616
|
+
ok: false,
|
|
617
|
+
reason: 'exists',
|
|
618
|
+
detail: `refusing to overwrite existing file: ${rawPath} (move it or pick another path)`,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
const temp = `${target}.tmp-${process.pid}`;
|
|
622
|
+
try {
|
|
623
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
624
|
+
writeFileSync(temp, text, 'utf8');
|
|
625
|
+
renameSync(temp, target);
|
|
626
|
+
}
|
|
627
|
+
catch (error) {
|
|
628
|
+
// Best effort: a leftover temp file is still a partial artifact on disk.
|
|
629
|
+
try {
|
|
630
|
+
if (existsSync(temp))
|
|
631
|
+
unlinkSync(temp);
|
|
632
|
+
}
|
|
633
|
+
catch {
|
|
634
|
+
/* the original error is the one worth reporting */
|
|
635
|
+
}
|
|
636
|
+
return { ok: false, reason: 'unwritable', detail: `cannot write ${rawPath}: ${error instanceof Error ? error.message : String(error)}` };
|
|
637
|
+
}
|
|
638
|
+
const fromCwd = relative(process.cwd(), target);
|
|
639
|
+
const display = fromCwd !== '' && !fromCwd.startsWith('..') && !isAbsolute(fromCwd) ? fromCwd : target;
|
|
640
|
+
return { ok: true, display };
|
|
641
|
+
}
|
|
480
642
|
/** At most this many registry lookups per run (spec §6 rule 6): a 95-row profile must not fan out. */
|
|
481
643
|
const MAX_REGISTRY_LOOKUPS = 12;
|
|
482
644
|
/**
|
|
@@ -522,7 +684,7 @@ async function registryLookupFor(impact, target, stamp) {
|
|
|
522
684
|
* are copied out of it here, so the payload still says which tier the judgement rests on —
|
|
523
685
|
* and no `Verdict` object means no `profileDir` in a file that is meant to be shareable.
|
|
524
686
|
*/
|
|
525
|
-
function upgradeJsonPayload(impact) {
|
|
687
|
+
function upgradeJsonPayload(impact, distTag) {
|
|
526
688
|
return {
|
|
527
689
|
schema_version: 1,
|
|
528
690
|
command: 'upgrade',
|
|
@@ -531,6 +693,10 @@ function upgradeJsonPayload(impact) {
|
|
|
531
693
|
current: impact.current,
|
|
532
694
|
current_valid: impact.current_valid,
|
|
533
695
|
target: impact.target,
|
|
696
|
+
// Where the target came from (M6 C9): an exact version is judged offline; a dist-tag says which
|
|
697
|
+
// word was resolved and against which package, so a reader can re-check the registry themselves.
|
|
698
|
+
target_source: distTag === null ? 'explicit' : 'dist-tag',
|
|
699
|
+
dist_tag: distTag === null ? null : { tag: distTag.tag, version: distTag.version, package: DIST_TAG_PACKAGE },
|
|
534
700
|
target_relation: impact.target_relation,
|
|
535
701
|
buckets: impact.buckets,
|
|
536
702
|
counts: impact.counts,
|
|
@@ -788,6 +954,131 @@ function countPresetRows(preset) {
|
|
|
788
954
|
}
|
|
789
955
|
return `${active} active · ${disabled} disabled · ${conditional} conditional · ${other} other`;
|
|
790
956
|
}
|
|
957
|
+
async function commandStatus(flags) {
|
|
958
|
+
const env = await requireEnv(flags);
|
|
959
|
+
if (env === null)
|
|
960
|
+
return EXIT_UNAVAILABLE;
|
|
961
|
+
const dshHome = resolveDshHome(flags);
|
|
962
|
+
const loaded = await loadAuditData({
|
|
963
|
+
env,
|
|
964
|
+
dshHome,
|
|
965
|
+
stamp: stampOf(flags),
|
|
966
|
+
snapshotPath: flags.snapshot,
|
|
967
|
+
noRedact: flags.noRedact,
|
|
968
|
+
});
|
|
969
|
+
if (!loaded.ok) {
|
|
970
|
+
process.stderr.write(`${loaded.message}\n`);
|
|
971
|
+
return EXIT_UNAVAILABLE;
|
|
972
|
+
}
|
|
973
|
+
const summary = buildProfileSummary(loaded.data, { locale: flags.locale });
|
|
974
|
+
// Same exit contract as `audit` (one function, not a second opinion).
|
|
975
|
+
const outcome = auditExitOutcome(loaded.data) === 'ok' ? EXIT_OK : EXIT_FINDINGS;
|
|
976
|
+
if (flags.json) {
|
|
977
|
+
writeJson({
|
|
978
|
+
schema_version: 1,
|
|
979
|
+
command: 'status',
|
|
980
|
+
env: redactedEnv(env, { noRedact: flags.noRedact, roots: auditRedactRoots(dshHome) }),
|
|
981
|
+
...summary,
|
|
982
|
+
});
|
|
983
|
+
return outcome;
|
|
984
|
+
}
|
|
985
|
+
process.stdout.write(formatProfileSummary(summary, { locale: flags.locale, env }));
|
|
986
|
+
return outcome;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* `dsh-triage fix` — the autofix surface (M7, `docs/specs/M7-autofix.md`).
|
|
990
|
+
*
|
|
991
|
+
* Prints a plan by default and writes NOTHING. `--apply` writes only the items the plan marked
|
|
992
|
+
* `ready`, backs the file up first, and records a journal so `--undo` can put it back.
|
|
993
|
+
*/
|
|
994
|
+
async function commandFix(flags) {
|
|
995
|
+
if (flags.undo !== null) {
|
|
996
|
+
try {
|
|
997
|
+
const { restored } = undoFix(flags.undo);
|
|
998
|
+
if (flags.json) {
|
|
999
|
+
writeJson({ schema_version: 1, command: 'fix', undo: flags.undo, restored });
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
process.stdout.write(`restored ${restored.length} file(s):\n`);
|
|
1003
|
+
for (const file of restored)
|
|
1004
|
+
process.stdout.write(` ${file}\n`);
|
|
1005
|
+
}
|
|
1006
|
+
return EXIT_OK;
|
|
1007
|
+
}
|
|
1008
|
+
catch (error) {
|
|
1009
|
+
process.stderr.write(`cannot undo: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
1010
|
+
return EXIT_UNAVAILABLE;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
const env = await requireEnv(flags);
|
|
1014
|
+
if (env === null)
|
|
1015
|
+
return EXIT_UNAVAILABLE;
|
|
1016
|
+
const dshHome = resolveDshHome(flags);
|
|
1017
|
+
const loaded = await loadAuditData({
|
|
1018
|
+
env,
|
|
1019
|
+
dshHome,
|
|
1020
|
+
stamp: stampOf(flags),
|
|
1021
|
+
snapshotPath: flags.snapshot,
|
|
1022
|
+
noRedact: flags.noRedact,
|
|
1023
|
+
});
|
|
1024
|
+
if (!loaded.ok) {
|
|
1025
|
+
process.stderr.write(`${loaded.message}\n`);
|
|
1026
|
+
return EXIT_UNAVAILABLE;
|
|
1027
|
+
}
|
|
1028
|
+
const exemptionSupport = runtimeSupportsExemptions(env.profileDir);
|
|
1029
|
+
const plan = planFixes(loaded.data, {
|
|
1030
|
+
exemptionSupport,
|
|
1031
|
+
installable: readProfileDependencies(env.profileDir),
|
|
1032
|
+
});
|
|
1033
|
+
let run = { journal: '', changes: [], skipped: [], dryRun: true };
|
|
1034
|
+
if (flags.apply && plan.applicable > 0) {
|
|
1035
|
+
try {
|
|
1036
|
+
run = applyExemptionFixes(plan, { stamp: stampOf(flags), dryRun: false });
|
|
1037
|
+
}
|
|
1038
|
+
catch (error) {
|
|
1039
|
+
process.stderr.write(`cannot apply: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
1040
|
+
return EXIT_UNAVAILABLE;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (flags.json) {
|
|
1044
|
+
// Same rule as every other command: absolute home paths are redacted unless --no-redact.
|
|
1045
|
+
const safePlan = flags.noRedact
|
|
1046
|
+
? plan
|
|
1047
|
+
: { ...plan, profileDir: plan.profileDir.replace(/^[A-Za-z]:\\Users\\[^\\]+/u, '~').replace(/^\/home\/[^/]+/u, '~') };
|
|
1048
|
+
writeJson({ schema_version: 1, command: 'fix', plan: safePlan, run });
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
const zh = flags.locale === 'zh';
|
|
1052
|
+
if (plan.items.length === 0) {
|
|
1053
|
+
process.stdout.write(zh ? '没有需要修复的项。\n' : 'nothing to fix.\n');
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
process.stdout.write(zh ? `可修复 ${plan.applicable} / ${plan.items.length} 项\n` : `${plan.applicable} of ${plan.items.length} fixable\n`);
|
|
1057
|
+
for (const item of plan.items) {
|
|
1058
|
+
const mark = item.status === 'ready' ? '✓' : '·';
|
|
1059
|
+
process.stdout.write(` ${mark} ${item.id} [${item.action}/${item.status}]\n ${item.detail}\n`);
|
|
1060
|
+
if (item.status !== 'ready' && item.command !== null)
|
|
1061
|
+
process.stdout.write(` ${item.command}\n`);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
if (!plan.exemptionSupport) {
|
|
1065
|
+
process.stdout.write(zh
|
|
1066
|
+
? `\n本机运行时(dsh ${plan.runtime ?? '?'})不读取 compatibility.json,因此豁免类修复不可用。\n`
|
|
1067
|
+
: `\nthis runtime (dsh ${plan.runtime ?? '?'}) does not read compatibility.json, so exemptions cannot be applied here.\n`);
|
|
1068
|
+
}
|
|
1069
|
+
if (run.dryRun) {
|
|
1070
|
+
if (plan.applicable > 0) {
|
|
1071
|
+
process.stdout.write(zh ? '\n只出了计划,没有写任何文件。要执行:dsh-triage fix --apply\n' : '\nplan only — nothing was written. To apply: dsh-triage fix --apply\n');
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
process.stdout.write(zh ? `\n已写入 ${run.changes.length} 处,撤销:dsh-triage fix --undo ${run.journal}\n` : `\nwrote ${run.changes.length} change(s); undo with: dsh-triage fix --undo ${run.journal}\n`);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
if (plan.items.length === 0)
|
|
1079
|
+
return EXIT_OK;
|
|
1080
|
+
return run.dryRun ? EXIT_FINDINGS : plan.applicable === run.changes.length ? EXIT_OK : EXIT_FINDINGS;
|
|
1081
|
+
}
|
|
791
1082
|
async function commandAudit(flags) {
|
|
792
1083
|
const env = await requireEnv(flags);
|
|
793
1084
|
if (env === null)
|
|
@@ -813,7 +1104,15 @@ async function commandAudit(flags) {
|
|
|
813
1104
|
writeJson(auditJsonPayload(data, { noRedact: flags.noRedact, roots: auditRedactRoots(dshHome) }));
|
|
814
1105
|
return auditExitOutcome(data) === 'ok' ? EXIT_OK : EXIT_FINDINGS;
|
|
815
1106
|
}
|
|
816
|
-
|
|
1107
|
+
// R49: the human answer first. The ledger below is the evidence, and it is one flag away
|
|
1108
|
+
// (`--all`) instead of being the only thing between the user and their answer.
|
|
1109
|
+
const summary = buildProfileSummary(data, { locale: flags.locale });
|
|
1110
|
+
process.stdout.write(formatProfileSummary(summary, { locale: flags.locale, env }));
|
|
1111
|
+
if (!flags.all) {
|
|
1112
|
+
process.stdout.write('\n(full ledger behind --all; `audit --json` carries every field)\n');
|
|
1113
|
+
return auditExitOutcome(data) === 'ok' ? EXIT_OK : EXIT_FINDINGS;
|
|
1114
|
+
}
|
|
1115
|
+
process.stdout.write(`\ncapability ledger · dsh ${env.dsh ?? 'unknown'} · profile ${env.profile}\n`);
|
|
817
1116
|
for (const [source, list] of grouped) {
|
|
818
1117
|
process.stdout.write(`\n${source} (${list.length} rows)\n`);
|
|
819
1118
|
for (const claim of list) {
|
|
@@ -1089,10 +1388,12 @@ async function commandProbe(flags, spec) {
|
|
|
1089
1388
|
async function commandServe(flags) {
|
|
1090
1389
|
const resultsDir = flags.results === null ? resolve(process.cwd(), 'data/results') : resolve(flags.results);
|
|
1091
1390
|
const dshHome = resolveDshHome(flags);
|
|
1092
|
-
//
|
|
1093
|
-
//
|
|
1094
|
-
|
|
1095
|
-
|
|
1391
|
+
// R49: the panel's whole purpose is the current composition, so it reads the profile by
|
|
1392
|
+
// default. `--no-audit` keeps the old artifacts-only mode (and `/api/audit` answers 501,
|
|
1393
|
+
// never an empty ledger that looks clean).
|
|
1394
|
+
const audit = flags.noAudit
|
|
1395
|
+
? null
|
|
1396
|
+
: async () => {
|
|
1096
1397
|
const loadedEnv = await loadEnv({ dshHome, profile: flags.profile });
|
|
1097
1398
|
if (!loadedEnv.ok) {
|
|
1098
1399
|
return { ok: false, message: `cannot read the profile: ${loadedEnv.error.code} — ${loadedEnv.error.detail}` };
|
|
@@ -1111,9 +1412,12 @@ async function commandServe(flags) {
|
|
|
1111
1412
|
return {
|
|
1112
1413
|
ok: true,
|
|
1113
1414
|
payload: auditJsonPayload(loaded.data, { noRedact: false, roots: auditRedactRoots(dshHome) }),
|
|
1415
|
+
// Same object the CLI's first screen prints, from the same scan.
|
|
1416
|
+
// The panel has room the terminal does not: show more than the CLI's default so
|
|
1417
|
+
// "show all" in the UI is not a lie. The counts are unaffected by the cap.
|
|
1418
|
+
summary: buildProfileSummary(loaded.data, { locale: flags.locale, limit: 50 }),
|
|
1114
1419
|
};
|
|
1115
|
-
}
|
|
1116
|
-
: null;
|
|
1420
|
+
};
|
|
1117
1421
|
const panel = await startPanel({
|
|
1118
1422
|
resultsDir,
|
|
1119
1423
|
port: flags.port ?? 0,
|
|
@@ -1330,7 +1634,10 @@ function parseArgs(argv) {
|
|
|
1330
1634
|
let results = null;
|
|
1331
1635
|
let out = null;
|
|
1332
1636
|
let allowExecute = false;
|
|
1637
|
+
let apply = false;
|
|
1638
|
+
let undo = null;
|
|
1333
1639
|
let audit = false;
|
|
1640
|
+
let noAudit = false;
|
|
1334
1641
|
let readinessTimeoutMs = null;
|
|
1335
1642
|
let unsettledReadinessMs = null;
|
|
1336
1643
|
let copyProfile = null;
|
|
@@ -1341,6 +1648,7 @@ function parseArgs(argv) {
|
|
|
1341
1648
|
let status = false;
|
|
1342
1649
|
let to = null;
|
|
1343
1650
|
let registry = false;
|
|
1651
|
+
let card = false;
|
|
1344
1652
|
for (let index = 0; index < argv.length; index += 1) {
|
|
1345
1653
|
const token = argv[index];
|
|
1346
1654
|
if (token === undefined)
|
|
@@ -1381,6 +1689,16 @@ function parseArgs(argv) {
|
|
|
1381
1689
|
case '--explain':
|
|
1382
1690
|
explain = true;
|
|
1383
1691
|
break;
|
|
1692
|
+
case '--apply':
|
|
1693
|
+
apply = true;
|
|
1694
|
+
break;
|
|
1695
|
+
case '--undo': {
|
|
1696
|
+
const value = takeValue();
|
|
1697
|
+
if (value === null)
|
|
1698
|
+
return null;
|
|
1699
|
+
undo = value;
|
|
1700
|
+
break;
|
|
1701
|
+
}
|
|
1384
1702
|
case '--help':
|
|
1385
1703
|
case '-h':
|
|
1386
1704
|
help = true;
|
|
@@ -1458,6 +1776,9 @@ function parseArgs(argv) {
|
|
|
1458
1776
|
case '--audit':
|
|
1459
1777
|
audit = true;
|
|
1460
1778
|
break;
|
|
1779
|
+
case '--no-audit':
|
|
1780
|
+
noAudit = true;
|
|
1781
|
+
break;
|
|
1461
1782
|
case '--readiness-timeout': {
|
|
1462
1783
|
const value = takeValue();
|
|
1463
1784
|
if (value === null)
|
|
@@ -1514,6 +1835,9 @@ function parseArgs(argv) {
|
|
|
1514
1835
|
case '--registry':
|
|
1515
1836
|
registry = true;
|
|
1516
1837
|
break;
|
|
1838
|
+
case '--card':
|
|
1839
|
+
card = true;
|
|
1840
|
+
break;
|
|
1517
1841
|
case '--locale': {
|
|
1518
1842
|
const value = takeValue();
|
|
1519
1843
|
if (value !== 'en' && value !== 'zh')
|
|
@@ -1525,10 +1849,11 @@ function parseArgs(argv) {
|
|
|
1525
1849
|
return null;
|
|
1526
1850
|
}
|
|
1527
1851
|
}
|
|
1528
|
-
const flags = { json, all, strict, execute, dshHome, profile, stamp, locale, noRedact, snapshot, explain, dshMain, noHttp, browser, port, results, allowExecute, audit, readinessTimeoutMs, unsettledReadinessMs, copyProfile, profileExplicit, out, outcomes, enable, disable, purge, status, to, registry };
|
|
1852
|
+
const flags = { json, all, strict, execute, dshHome, profile, stamp, locale, noRedact, snapshot, explain, dshMain, noHttp, browser, port, results, allowExecute, apply, undo, audit, noAudit, readinessTimeoutMs, unsettledReadinessMs, copyProfile, profileExplicit, out, outcomes, enable, disable, purge, status, to, registry, card };
|
|
1529
1853
|
if (help)
|
|
1530
1854
|
return { command: 'help', positionals: [], flags };
|
|
1531
|
-
|
|
1855
|
+
// R49: no subcommand is not an error. It is the question the product exists to answer.
|
|
1856
|
+
const command = positionals.shift() ?? 'status';
|
|
1532
1857
|
return { command, positionals, flags };
|
|
1533
1858
|
}
|
|
1534
1859
|
function splitFlag(token) {
|