@shrkcrft/cli 0.1.0-alpha.24 → 0.1.0-alpha.25
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/commands/changelog-data.d.ts +25 -0
- package/dist/commands/changelog-data.d.ts.map +1 -0
- package/dist/commands/changelog-data.js +70 -0
- package/dist/commands/changelog.command.d.ts +3 -0
- package/dist/commands/changelog.command.d.ts.map +1 -0
- package/dist/commands/changelog.command.js +100 -0
- package/dist/commands/changes.command.d.ts.map +1 -1
- package/dist/commands/changes.command.js +4 -0
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +73 -15
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +8 -0
- package/dist/commands/compress.command.d.ts.map +1 -1
- package/dist/commands/compress.command.js +15 -1
- package/dist/commands/constructs.command.d.ts.map +1 -1
- package/dist/commands/constructs.command.js +49 -14
- package/dist/commands/context.command.d.ts.map +1 -1
- package/dist/commands/context.command.js +31 -19
- package/dist/commands/gate.command.d.ts.map +1 -1
- package/dist/commands/gate.command.js +6 -1
- package/dist/commands/gen.command.d.ts.map +1 -1
- package/dist/commands/gen.command.js +65 -9
- package/dist/commands/graph-code-subverbs.d.ts.map +1 -1
- package/dist/commands/graph-code-subverbs.js +14 -2
- package/dist/commands/policy-lint.command.d.ts.map +1 -1
- package/dist/commands/policy-lint.command.js +46 -8
- package/dist/commands/registry.command.d.ts.map +1 -1
- package/dist/commands/registry.command.js +71 -13
- package/dist/commands/reuse.command.d.ts.map +1 -1
- package/dist/commands/reuse.command.js +80 -14
- package/dist/commands/smart-context.command.d.ts.map +1 -1
- package/dist/commands/smart-context.command.js +20 -5
- package/dist/commands/task.command.d.ts.map +1 -1
- package/dist/commands/task.command.js +33 -16
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/validation/typecheck-emitted.d.ts +36 -0
- package/dist/validation/typecheck-emitted.d.ts.map +1 -0
- package/dist/validation/typecheck-emitted.js +109 -0
- package/package.json +33 -33
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine-readable command-SURFACE delta, shipped inside the binary so
|
|
3
|
+
* `shrk changelog` is authoritative for the exact build in use and works
|
|
4
|
+
* offline. This is NOT the full human CHANGELOG.md — it records only the delta
|
|
5
|
+
* an agent needs to re-orient after an upgrade: which verbs/flags were added,
|
|
6
|
+
* which changed behavior, which were removed. Keep it in sync with CHANGELOG.md
|
|
7
|
+
* when a release lands; the version keys must match `SHARKCRAFT_VERSION`.
|
|
8
|
+
*
|
|
9
|
+
* Ordered oldest → newest; the renderer sorts as needed.
|
|
10
|
+
*/
|
|
11
|
+
/** One version's command-surface delta. */
|
|
12
|
+
export interface IReleaseSurfaceDelta {
|
|
13
|
+
/** Exact release version, e.g. `0.1.0-alpha.24`. */
|
|
14
|
+
readonly version: string;
|
|
15
|
+
/** One-line headline for the release. */
|
|
16
|
+
readonly title: string;
|
|
17
|
+
/** New verbs / flags this version introduced. */
|
|
18
|
+
readonly added: readonly string[];
|
|
19
|
+
/** Verbs / flags whose behavior or defaults changed. */
|
|
20
|
+
readonly changed: readonly string[];
|
|
21
|
+
/** Verbs / flags removed or renamed away. */
|
|
22
|
+
readonly removed: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const RELEASE_SURFACE_DELTAS: readonly IReleaseSurfaceDelta[];
|
|
25
|
+
//# sourceMappingURL=changelog-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-data.d.ts","sourceRoot":"","sources":["../../src/commands/changelog-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,sBAAsB,EAAE,SAAS,oBAAoB,EA2DjE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine-readable command-SURFACE delta, shipped inside the binary so
|
|
3
|
+
* `shrk changelog` is authoritative for the exact build in use and works
|
|
4
|
+
* offline. This is NOT the full human CHANGELOG.md — it records only the delta
|
|
5
|
+
* an agent needs to re-orient after an upgrade: which verbs/flags were added,
|
|
6
|
+
* which changed behavior, which were removed. Keep it in sync with CHANGELOG.md
|
|
7
|
+
* when a release lands; the version keys must match `SHARKCRAFT_VERSION`.
|
|
8
|
+
*
|
|
9
|
+
* Ordered oldest → newest; the renderer sorts as needed.
|
|
10
|
+
*/
|
|
11
|
+
export const RELEASE_SURFACE_DELTAS = [
|
|
12
|
+
{
|
|
13
|
+
version: '0.1.0-alpha.23',
|
|
14
|
+
title: 'Correctness, gate trust, security & pack-distributable invariants',
|
|
15
|
+
added: [
|
|
16
|
+
'`shrk registry <name> list | exists <id> | where <id>` — declarable registry inventory (pack-distributable).',
|
|
17
|
+
'`shrk policy run --changed-only` / `--since` — finding-diff-scoped policy runs.',
|
|
18
|
+
'`shrk search tuning explain` — why a query ranked the way it did.',
|
|
19
|
+
],
|
|
20
|
+
changed: [
|
|
21
|
+
'`graph context`/`search`/`callers`/`impact` report a true `total` + `truncated` instead of a silent per-file cap.',
|
|
22
|
+
'Incremental reindex no longer drops inbound edges; renamed barrel re-exports (`export { X as Y }`) now resolve.',
|
|
23
|
+
],
|
|
24
|
+
removed: [],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
version: '0.1.0-alpha.24',
|
|
28
|
+
title: 'Runtime wiring, write-safety & the author loop',
|
|
29
|
+
added: [
|
|
30
|
+
'`shrk wiring chain | unprovided | orphans` — the registration/DI graph beside the import graph.',
|
|
31
|
+
'`shrk wiring test <candidate>` / `shrk check wiring --explain <ruleId>` — declared vs registered set, no config write.',
|
|
32
|
+
'`shrk trace "<literal>"` — generalize registry tracing to any cross-layer string contract.',
|
|
33
|
+
'`shrk check orphans [--since <ref>] [--staged]` — first-class diff-robust reverse-closure.',
|
|
34
|
+
'`shrk finish` (a.k.a. `review --run`) — one changed-only "safe to finish?" verdict.',
|
|
35
|
+
'`--limit N` (`--limit 0` = all) on graph read commands (default 50).',
|
|
36
|
+
],
|
|
37
|
+
changed: [
|
|
38
|
+
'`shrk impact --deleted` no longer ENOBUFS — the git diff is streamed via a shared `runGitLines`.',
|
|
39
|
+
'Pack-health scores quality (resolved cross-refs, runnable verification), not mere presence.',
|
|
40
|
+
'`compress --type code` is a real strategy (was markdown-only).',
|
|
41
|
+
],
|
|
42
|
+
removed: [],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
version: '0.1.0-alpha.25',
|
|
46
|
+
title: 'Earned & change-attributable verdicts',
|
|
47
|
+
added: [
|
|
48
|
+
'`shrk changelog [--since <version>] [--all] [--json]` — the command-surface delta of the running build.',
|
|
49
|
+
'`shrk registry <name> exists <id> --fail-if-taken | --fail-if-missing` — guard-mode exit codes for pre-author checks.',
|
|
50
|
+
'`shrk registry <name> exists <id> --resolve` — map a synonym to the canonical id (registry `aliases`) before the test.',
|
|
51
|
+
'`shrk check registry-lifecycle --changed-only` — diff-scoped lifecycle check that terminates in seconds.',
|
|
52
|
+
'`shrk gen --typecheck` — compile the emitted file set against the detected tsconfig as a PRE-WRITE gate (a template bug fails at generation and REFUSES the write; nothing lands on disk).',
|
|
53
|
+
'`shrk gen --print` — inspect the rendered file bodies in one step (alias of `--show-content`).',
|
|
54
|
+
'`shrk graph cycles --include-type-edges` — opt back into counting type-only import edges.',
|
|
55
|
+
'`shrk context` / `shrk task --summary` (`--brief`) — the terse orientation view (now opt-in).',
|
|
56
|
+
],
|
|
57
|
+
changed: [
|
|
58
|
+
'`shrk check wiring --changed-only` never renders a green verdict over 0 evaluated rules; reports `M of N (K skipped)`.',
|
|
59
|
+
'`shrk check registry-lifecycle` no longer hangs — bounded scan + wall-clock budget + partial-result flush; skip-dirs are configurable via `registryLifecycle.skipDirs`.',
|
|
60
|
+
'Cycle detection excludes type-only import edges by default (clears phantom architecture reds).',
|
|
61
|
+
'`shrk gate` is change-scoped by default — reds only on change-introduced findings; baseline debt is a non-blocking bucket.',
|
|
62
|
+
'`shrk context` / `shrk task` render the FULL body by default (parity with why/reuse/knowledge get).',
|
|
63
|
+
'`shrk reuse` applies a confidence floor (weak keyword collisions → did-you-mean, score exposed) and shows the consumer total.',
|
|
64
|
+
'`compress --type code` labels its lossy fidelity (banner + JSON `fidelity`).',
|
|
65
|
+
'`changes summary` attributes areas from the declared layer/area taxonomy instead of bucketing to `unknown`.',
|
|
66
|
+
'`smart-context "<task>"` accepts `--task`, and fails loud (banner) when the local model is degraded instead of returning a stale guide dump.',
|
|
67
|
+
],
|
|
68
|
+
removed: [],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.command.d.ts","sourceRoot":"","sources":["../../src/commands/changelog.command.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA4ChC,eAAO,MAAM,gBAAgB,EAAE,eA4D9B,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { SHARKCRAFT_VERSION } from '@shrkcrft/shared';
|
|
2
|
+
import { flagBool, flagString, } from "../command-registry.js";
|
|
3
|
+
import { asJson, header } from "../output/format-output.js";
|
|
4
|
+
import { RELEASE_SURFACE_DELTAS } from "./changelog-data.js";
|
|
5
|
+
/** Parse `X.Y.Z[-alpha.N]` into a comparable tuple. A release outranks its prerelease. */
|
|
6
|
+
function parseVersion(v) {
|
|
7
|
+
const [coreStr, preStr] = v.replace(/^v/, '').split('-');
|
|
8
|
+
const parts = (coreStr ?? '').split('.').map((n) => Number(n) || 0);
|
|
9
|
+
const core = [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];
|
|
10
|
+
// No prerelease sorts ABOVE any prerelease of the same core; a prerelease
|
|
11
|
+
// sorts by its trailing number (alpha.24 < alpha.25).
|
|
12
|
+
let pre = Number.POSITIVE_INFINITY;
|
|
13
|
+
if (preStr) {
|
|
14
|
+
const m = preStr.match(/(\d+)/);
|
|
15
|
+
pre = m ? Number(m[1]) : 0;
|
|
16
|
+
}
|
|
17
|
+
return { core, pre };
|
|
18
|
+
}
|
|
19
|
+
/** -1 / 0 / 1 comparator over version strings. */
|
|
20
|
+
function compareVersions(a, b) {
|
|
21
|
+
const pa = parseVersion(a);
|
|
22
|
+
const pb = parseVersion(b);
|
|
23
|
+
for (let i = 0; i < 3; i += 1) {
|
|
24
|
+
const d = (pa.core[i] ?? 0) - (pb.core[i] ?? 0);
|
|
25
|
+
if (d !== 0)
|
|
26
|
+
return d < 0 ? -1 : 1;
|
|
27
|
+
}
|
|
28
|
+
if (pa.pre === pb.pre)
|
|
29
|
+
return 0;
|
|
30
|
+
return pa.pre < pb.pre ? -1 : 1;
|
|
31
|
+
}
|
|
32
|
+
function renderDeltaText(d) {
|
|
33
|
+
const lines = [`\n${d.version} — ${d.title}`];
|
|
34
|
+
const section = (label, items) => {
|
|
35
|
+
if (items.length === 0)
|
|
36
|
+
return;
|
|
37
|
+
lines.push(` ${label}:`);
|
|
38
|
+
for (const it of items)
|
|
39
|
+
lines.push(` • ${it}`);
|
|
40
|
+
};
|
|
41
|
+
section('Added', d.added);
|
|
42
|
+
section('Changed', d.changed);
|
|
43
|
+
section('Removed', d.removed);
|
|
44
|
+
return lines.join('\n') + '\n';
|
|
45
|
+
}
|
|
46
|
+
export const changelogCommand = {
|
|
47
|
+
name: 'changelog',
|
|
48
|
+
description: "The shrk command-surface delta of the running build — which verbs/flags were added, changed, or removed. Sourced from an in-binary release-notes asset (offline, authoritative for this exact build). `--since <version>` shows the cumulative delta since a prior version.",
|
|
49
|
+
usage: 'shrk changelog [--since <version>] [--all] [--json]',
|
|
50
|
+
booleanFlags: new Set(['all', 'json']),
|
|
51
|
+
run(args) {
|
|
52
|
+
const wantJson = flagBool(args, 'json');
|
|
53
|
+
const since = flagString(args, 'since');
|
|
54
|
+
const all = flagBool(args, 'all');
|
|
55
|
+
const current = SHARKCRAFT_VERSION;
|
|
56
|
+
// Newest-first for display.
|
|
57
|
+
const sorted = [...RELEASE_SURFACE_DELTAS].sort((a, b) => compareVersions(b.version, a.version));
|
|
58
|
+
let selected;
|
|
59
|
+
let scope;
|
|
60
|
+
if (all) {
|
|
61
|
+
selected = sorted;
|
|
62
|
+
scope = 'all recorded versions';
|
|
63
|
+
}
|
|
64
|
+
else if (since) {
|
|
65
|
+
// Cumulative delta: every recorded version strictly newer than `since`.
|
|
66
|
+
selected = sorted.filter((d) => compareVersions(d.version, since) > 0);
|
|
67
|
+
scope = `since ${since}`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Default: the entry matching the running build, else the newest recorded.
|
|
71
|
+
const exact = sorted.find((d) => compareVersions(d.version, current) === 0);
|
|
72
|
+
selected = exact ? [exact] : sorted.slice(0, 1);
|
|
73
|
+
scope = exact ? `running build (${current})` : `latest recorded (running build ${current} has no recorded surface delta)`;
|
|
74
|
+
}
|
|
75
|
+
if (wantJson) {
|
|
76
|
+
process.stdout.write(asJson({
|
|
77
|
+
schema: 'sharkcraft.changelog/v1',
|
|
78
|
+
runningVersion: current,
|
|
79
|
+
scope,
|
|
80
|
+
...(since ? { since } : {}),
|
|
81
|
+
count: selected.length,
|
|
82
|
+
versions: selected,
|
|
83
|
+
}) + '\n');
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
process.stdout.write(header(`shrk changelog — ${scope}`));
|
|
87
|
+
if (selected.length === 0) {
|
|
88
|
+
process.stdout.write(since
|
|
89
|
+
? ` No recorded surface changes since ${since}.\n`
|
|
90
|
+
: ' No recorded surface changes.\n');
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
for (const d of selected)
|
|
94
|
+
process.stdout.write(renderDeltaText(d));
|
|
95
|
+
if (!all && !since) {
|
|
96
|
+
process.stdout.write('\n(pass --since <version> for the cumulative delta, or --all for every recorded version.)\n');
|
|
97
|
+
}
|
|
98
|
+
return 0;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.command.d.ts","sourceRoot":"","sources":["../../src/commands/changes.command.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"changes.command.d.ts","sourceRoot":"","sources":["../../src/commands/changes.command.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAiIhC,eAAO,MAAM,cAAc,EAAE,eAwB5B,CAAC"}
|
|
@@ -59,6 +59,10 @@ async function runChangesSummary(args) {
|
|
|
59
59
|
for (const [area, list] of Object.entries(report.filesByArea)) {
|
|
60
60
|
process.stdout.write(` ${area.padEnd(20)} (${list.length})\n`);
|
|
61
61
|
}
|
|
62
|
+
if (report.unknownFiles > 0) {
|
|
63
|
+
process.stdout.write(` ! ${report.unknownFiles}/${report.totalFiles} file(s) (${Math.round(report.unknownRate * 100)}%) matched no declared area — ` +
|
|
64
|
+
'the layer/area taxonomy may be missing globs (classifier diagnostic, not a low-risk signal).\n');
|
|
65
|
+
}
|
|
62
66
|
if (report.touchedMcpTools.length > 0) {
|
|
63
67
|
process.stdout.write('\nMCP tools touched (verify read-only invariant):\n');
|
|
64
68
|
for (const m of report.touchedMcpTools)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.command.d.ts","sourceRoot":"","sources":["../../src/commands/check.command.ts"],"names":[],"mappings":"AAoBA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"check.command.d.ts","sourceRoot":"","sources":["../../src/commands/check.command.ts"],"names":[],"mappings":"AAoBA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAm1BhC,eAAO,MAAM,YAAY,EAAE,eAoG1B,CAAC"}
|
|
@@ -593,20 +593,42 @@ async function checkWiring(args) {
|
|
|
593
593
|
const report = planeDiagnostics.length > 0
|
|
594
594
|
? { ...reportRaw, diagnostics: [...reportRaw.diagnostics, ...planeDiagnostics] }
|
|
595
595
|
: reportRaw;
|
|
596
|
+
// Truthful evaluation accounting so a subset run never reads as a full green.
|
|
597
|
+
// configured — every wiring rule declared (the honest denominator).
|
|
598
|
+
// selected — rules that survived --changed-only / --only narrowing.
|
|
599
|
+
// evaluated — rules that actually ran a comparison (globs matched >0 files).
|
|
600
|
+
// skippedByScope — configured − selected (dropped by the diff/only narrowing).
|
|
601
|
+
// matchedNothing — selected − evaluated (in scope but matched 0 files).
|
|
602
|
+
const configured = rules.length;
|
|
603
|
+
const selected = report.rules.length;
|
|
604
|
+
const evaluated = report.evaluated;
|
|
605
|
+
const skippedByScope = Math.max(0, configured - selected);
|
|
606
|
+
const matchedNothing = Math.max(0, selected - evaluated);
|
|
607
|
+
const notVerified = Math.max(0, configured - evaluated);
|
|
608
|
+
const allEvaluated = evaluated === configured;
|
|
609
|
+
const scopeNote = changedOnly || since ? ' by --changed-only' : '';
|
|
610
|
+
const parts = [];
|
|
611
|
+
if (skippedByScope > 0)
|
|
612
|
+
parts.push(`${skippedByScope} skipped${scopeNote}`);
|
|
613
|
+
if (matchedNothing > 0)
|
|
614
|
+
parts.push(`${matchedNothing} matched no files`);
|
|
615
|
+
const breakdown = parts.length > 0 ? ` (${parts.join(', ')})` : '';
|
|
596
616
|
if (wantJson) {
|
|
597
|
-
|
|
617
|
+
// Carry the honest counts so a machine consumer can tell "0 evaluated" from
|
|
618
|
+
// a real green, and see how many rules the scope skipped.
|
|
619
|
+
process.stdout.write(asJson({ ...report, configured, selected, evaluated, skippedByScope, matchedNothing, notVerified }) + '\n');
|
|
598
620
|
return report.verdict === 'errors' ? 1 : 0;
|
|
599
621
|
}
|
|
600
622
|
process.stdout.write(header('Wiring check'));
|
|
601
623
|
// `evaluated` counts rules that actually ran a comparison (globs matched >0
|
|
602
624
|
// files). When 0 rules evaluated but rules ARE configured, say so loudly —
|
|
603
625
|
// "checked nothing" must never read as the green "every token is wired" pass.
|
|
604
|
-
if (
|
|
605
|
-
process.stdout.write(` !
|
|
606
|
-
|
|
626
|
+
if (evaluated === 0) {
|
|
627
|
+
process.stdout.write(` ! 0 rules evaluated — NOT verified. ${configured} rule(s) configured${breakdown}; ` +
|
|
628
|
+
'none ran a comparison in scope. Wiring was not checked — this is not a pass.\n');
|
|
607
629
|
return 0;
|
|
608
630
|
}
|
|
609
|
-
process.stdout.write(kv('rules evaluated', `${
|
|
631
|
+
process.stdout.write(kv('rules evaluated', `${evaluated} of ${configured}${breakdown}`) + '\n');
|
|
610
632
|
const errors = report.violations.filter((v) => v.severity === 'error').length;
|
|
611
633
|
const warnings = report.violations.filter((v) => v.severity === 'warning').length;
|
|
612
634
|
process.stdout.write(kv('violations', `${errors} error(s), ${warnings} warning(s)`) + '\n');
|
|
@@ -618,7 +640,16 @@ async function checkWiring(args) {
|
|
|
618
640
|
process.stdout.write(` ! ${d}\n`);
|
|
619
641
|
}
|
|
620
642
|
if (report.violations.length === 0 && report.diagnostics.length === 0) {
|
|
621
|
-
|
|
643
|
+
if (allEvaluated) {
|
|
644
|
+
// Every configured rule ran — the earned full green.
|
|
645
|
+
process.stdout.write('\nNo wiring violations — every declared token is registered. ✓\n');
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
// A subset ran: no violations AMONG WHAT RAN, but not a full green. Never
|
|
649
|
+
// print the unqualified "every declared token is wired" success sentence.
|
|
650
|
+
process.stdout.write(`\nNo wiring violations among the ${evaluated} rule(s) evaluated — ` +
|
|
651
|
+
`${notVerified} of ${configured} NOT verified${breakdown}. Not a full green.\n`);
|
|
652
|
+
}
|
|
622
653
|
return 0;
|
|
623
654
|
}
|
|
624
655
|
if (report.violations.length === 0) {
|
|
@@ -756,21 +787,48 @@ export const checkCommand = {
|
|
|
756
787
|
return checkOrphans(args);
|
|
757
788
|
if (sub === 'registry-lifecycle') {
|
|
758
789
|
const cwd = resolveCwd(args);
|
|
790
|
+
const changedOnly = flagBool(args, 'changed-only');
|
|
791
|
+
const since = flagString(args, 'since');
|
|
792
|
+
const scope = flagString(args, 'scope');
|
|
759
793
|
const { buildRegistryLifecycleReport, renderRegistryLifecycleReportText } = await import('@shrkcrft/inspector');
|
|
760
|
-
//
|
|
761
|
-
//
|
|
762
|
-
//
|
|
763
|
-
|
|
764
|
-
if (
|
|
765
|
-
|
|
794
|
+
// `--changed-only` scopes the scan to the diff (tracked + untracked), so it
|
|
795
|
+
// runs inline in seconds; the full-tree scan is bounded by a wall-clock
|
|
796
|
+
// budget and flushes partial results on timeout instead of hanging.
|
|
797
|
+
let files;
|
|
798
|
+
if (changedOnly || since) {
|
|
799
|
+
const changed = resolveChangedFiles({
|
|
800
|
+
projectRoot: cwd,
|
|
801
|
+
...(since ? { since } : {}),
|
|
802
|
+
...(changedOnly && !since ? { includeWorktree: true } : {}),
|
|
803
|
+
});
|
|
804
|
+
files = changed.files;
|
|
805
|
+
}
|
|
806
|
+
// Full-tree walk honors the project's skipDirs override (so a repo that
|
|
807
|
+
// registers code under tools/ etc. isn't blinded by the default set).
|
|
808
|
+
let skipDirs;
|
|
809
|
+
if (files === undefined) {
|
|
810
|
+
const loaded = await resolveProjectConfig(cwd);
|
|
811
|
+
if (loaded.ok)
|
|
812
|
+
skipDirs = loaded.value.config.registryLifecycle?.skipDirs;
|
|
813
|
+
}
|
|
814
|
+
// Only the slow full-tree path needs the heartbeat (JSON keeps stdout clean).
|
|
815
|
+
if (!flagBool(args, 'json') && files === undefined) {
|
|
816
|
+
process.stderr.write('⏳ Scanning source + registries for lifecycle coverage (bounded by a wall-clock budget)…\n');
|
|
766
817
|
}
|
|
767
|
-
const report = buildRegistryLifecycleReport({
|
|
818
|
+
const report = buildRegistryLifecycleReport({
|
|
819
|
+
projectRoot: cwd,
|
|
820
|
+
...(files !== undefined ? { files } : {}),
|
|
821
|
+
...(scope ? { scope } : {}),
|
|
822
|
+
...(skipDirs ? { skipDirs } : {}),
|
|
823
|
+
});
|
|
824
|
+
// Deterministic non-zero on timeout so a wedged scan fails loud, not silent.
|
|
825
|
+
const exit = report.timedOut ? 2 : report.missingRemovers.length === 0 ? 0 : 1;
|
|
768
826
|
if (flagBool(args, 'json')) {
|
|
769
827
|
process.stdout.write(asJson(report) + '\n');
|
|
770
|
-
return
|
|
828
|
+
return exit;
|
|
771
829
|
}
|
|
772
830
|
process.stdout.write(renderRegistryLifecycleReportText(report));
|
|
773
|
-
return
|
|
831
|
+
return exit;
|
|
774
832
|
}
|
|
775
833
|
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
776
834
|
const readiness = buildAiReadinessReport(inspection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/command-catalog.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,cAAc;IACtB,iBAAiB,mBAAmB;IACpC,gBAAgB,kBAAkB;IAClC,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,cAAc,oBAAoB;CACnC;AAED;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;IACf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EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,oBAAoB,
|
|
1
|
+
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/command-catalog.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,cAAc;IACtB,iBAAiB,mBAAmB;IACpC,gBAAgB,kBAAkB;IAClC,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,cAAc,oBAAoB;CACnC;AAED;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,EAAE,OAAO;IACT,UAAU,gBAAgB;IAC1B,UAAU,eAAe;CAC1B;AAED;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;CA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AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAwC9D;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,wBAAwB,IAAI,SAAS,uBAAuB,EAAE,CAsB7E;AAED,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,SAAS,uBAAuB,EAAE,GACvC,MAAM,CAaR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,CAAC,CAW/C"}
|
|
@@ -1160,6 +1160,14 @@ export const COMMAND_CATALOG = Object.freeze([
|
|
|
1160
1160
|
safetyLevel: SafetyLevel.ReadOnly,
|
|
1161
1161
|
surface: CommandSurface.Common,
|
|
1162
1162
|
}),
|
|
1163
|
+
entry({
|
|
1164
|
+
command: 'changelog',
|
|
1165
|
+
description: 'The shrk command-surface delta of the running build (added / changed / removed verbs & flags). `--since <version>` for the cumulative delta; offline, authoritative for this exact build.',
|
|
1166
|
+
category: 'meta',
|
|
1167
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
1168
|
+
surface: CommandSurface.Common,
|
|
1169
|
+
intendedAudience: [CommandAudience.Human, CommandAudience.Agent],
|
|
1170
|
+
}),
|
|
1163
1171
|
entry({
|
|
1164
1172
|
command: 'completion',
|
|
1165
1173
|
description: 'Print a sourcable shell-completion script for the `shrk` CLI (bash | zsh | fish). Pipe into your shell rc.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.command.d.ts","sourceRoot":"","sources":["../../src/commands/compress.command.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAqEhC,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"compress.command.d.ts","sourceRoot":"","sources":["../../src/commands/compress.command.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAqEhC,eAAO,MAAM,eAAe,EAAE,eAqH7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eA4B3B,CAAC"}
|
|
@@ -60,7 +60,7 @@ const COMPRESS_BOOLEAN_FLAGS = new Set([
|
|
|
60
60
|
]);
|
|
61
61
|
export const compressCommand = {
|
|
62
62
|
name: 'compress',
|
|
63
|
-
description: 'Compress a blob (file or stdin) deterministically to cut tokens — JSON→table, logs/search/diffs→signal. Reversible via `shrk expand`.',
|
|
63
|
+
description: 'Compress a blob (file or stdin) deterministically to cut tokens — JSON→table, logs/search/diffs→signal. Reversible via `shrk expand`. NOTE: `--type code` emits a LOSSY outline (function bodies elided) — good for fitting more code into context, NOT for line-accurate reading; use plain Read (or `--lossless`) to inspect a file.',
|
|
64
64
|
usage: 'shrk [--cwd <dir>] compress [<file>|-] [--stdin] [--type <content-type>] [--query <text>] [--max <n>] [--lossless] [--no-cache] [--json]',
|
|
65
65
|
booleanFlags: COMPRESS_BOOLEAN_FLAGS,
|
|
66
66
|
run(args) {
|
|
@@ -118,6 +118,13 @@ export const compressCommand = {
|
|
|
118
118
|
tokensSaved: result.savings.saved,
|
|
119
119
|
savedRatio: result.savings.ratio,
|
|
120
120
|
tokensAreEstimated: true,
|
|
121
|
+
// Explicit fidelity signal so a caller never mistakes a lossy code
|
|
122
|
+
// outline for a line-accurate read.
|
|
123
|
+
fidelity: result.strategy === ECompressionStrategy.Code
|
|
124
|
+
? 'lossy-outline (not line-accurate; use Read or --lossless to inspect)'
|
|
125
|
+
: result.lossy
|
|
126
|
+
? 'lossy'
|
|
127
|
+
: 'lossless',
|
|
121
128
|
queryApplied,
|
|
122
129
|
ccrKey: result.ccrKey ?? null,
|
|
123
130
|
note: result.note,
|
|
@@ -136,6 +143,13 @@ export const compressCommand = {
|
|
|
136
143
|
process.stdout.write(result.compressed + '\n');
|
|
137
144
|
const cached = result.ccrKey ? ` · original cached as ${result.ccrKey} (shrk expand ${result.ccrKey})` : '';
|
|
138
145
|
process.stderr.write(`${result.strategy}: ~${result.savings.before} → ~${result.savings.after} tokens (−${pct}%, est.)${cached}\n`);
|
|
146
|
+
// Fidelity banner: the code outline elides function bodies, so it is a
|
|
147
|
+
// footgun as a cheaper Read. Say so loudly — same failure mode as a lossy
|
|
148
|
+
// result that doesn't *look* lossy.
|
|
149
|
+
if (result.strategy === ECompressionStrategy.Code) {
|
|
150
|
+
process.stderr.write('note: code outline is LOSSY (bodies elided) — for bulk context, not line-accurate reading; ' +
|
|
151
|
+
'use `Read` or `--lossless` for inspection.\n');
|
|
152
|
+
}
|
|
139
153
|
// Token-economy guard: when auto-detect declines to compress a non-trivial
|
|
140
154
|
// input, a silent `−0%` re-emit looks like success. Nudge toward `--type`
|
|
141
155
|
// (stdout stays the verbatim blob; exit code unchanged).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructs.command.d.ts","sourceRoot":"","sources":["../../src/commands/constructs.command.ts"],"names":[],"mappings":"AA8BA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"constructs.command.d.ts","sourceRoot":"","sources":["../../src/commands/constructs.command.ts"],"names":[],"mappings":"AA8BA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAkKhC,eAAO,MAAM,qBAAqB,EAAE,eAqBnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,eAmDlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAgGpC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAyErC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAkCtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eA2BpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,eAiClC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAiBrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAkBrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eA2BrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eA8BrC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eA0DpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eA0LpC,CAAC"}
|
|
@@ -4,6 +4,48 @@ import { AdoptionCheckpointStatus, buildConstructAdoptionDiff, buildConstructAdo
|
|
|
4
4
|
import { GraphQueryApi, GraphStore } from '@shrkcrft/graph';
|
|
5
5
|
import { flagBool, flagNumber, flagString, resolveCwd, } from "../command-registry.js";
|
|
6
6
|
import { asJson, header } from "../output/format-output.js";
|
|
7
|
+
/**
|
|
8
|
+
* A construct subverb was handed an id that is NOT a registered construct.
|
|
9
|
+
* `constructs *` matches a curated construct-registry ID, not a raw code symbol
|
|
10
|
+
* — so a miss must never read as an existence claim about the symbol. Probe the
|
|
11
|
+
* code graph and redirect to the tools that actually answer "where does X live /
|
|
12
|
+
* who calls it" instead of a definitive-sounding "No construct". Returns exit 1.
|
|
13
|
+
*/
|
|
14
|
+
function emitConstructMiss(id, args) {
|
|
15
|
+
const cwd = resolveCwd(args);
|
|
16
|
+
const store = new GraphStore(cwd);
|
|
17
|
+
let isCodeSymbol = false;
|
|
18
|
+
if (store.exists()) {
|
|
19
|
+
const api = GraphQueryApi.fromStore(cwd);
|
|
20
|
+
isCodeSymbol =
|
|
21
|
+
api.findSymbol(id, { exact: true }).length > 0 ||
|
|
22
|
+
api.findSymbol(id, { exact: false, limit: 1 }).length > 0;
|
|
23
|
+
}
|
|
24
|
+
if (flagBool(args, 'json')) {
|
|
25
|
+
process.stdout.write(asJson({
|
|
26
|
+
schema: 'sharkcraft.constructs-miss/v1',
|
|
27
|
+
id,
|
|
28
|
+
found: false,
|
|
29
|
+
reason: 'not-a-construct-id',
|
|
30
|
+
isCodeSymbol,
|
|
31
|
+
hint: isCodeSymbol
|
|
32
|
+
? `"${id}" is a code symbol, not a construct — try 'shrk graph callers ${id}' or 'shrk graph search ${id}'.`
|
|
33
|
+
: `"${id}" is not a registered construct ID; list them with 'shrk constructs list', or search code with 'shrk graph search ${id}'.`,
|
|
34
|
+
}) + '\n');
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
if (isCodeSymbol) {
|
|
38
|
+
process.stderr.write(`"${id}" is not a construct ID — did you mean a code symbol?\n` +
|
|
39
|
+
` shrk graph callers ${id} # who references it (path:line)\n` +
|
|
40
|
+
` shrk graph search ${id} # find its declaration\n`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
process.stderr.write(`"${id}" is not a registered construct ID, and no code symbol by that name was found.\n` +
|
|
44
|
+
` shrk constructs list # the curated construct IDs\n` +
|
|
45
|
+
` shrk graph search ${id} # search the code graph\n`);
|
|
46
|
+
}
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
7
49
|
async function loadAll(args) {
|
|
8
50
|
const cwd = resolveCwd(args);
|
|
9
51
|
const inspection = await inspectSharkcraft({ cwd });
|
|
@@ -116,8 +158,7 @@ export const constructsGetCommand = {
|
|
|
116
158
|
const { constructs } = await loadAll(args);
|
|
117
159
|
const c = constructs.find((x) => x.id === id);
|
|
118
160
|
if (!c) {
|
|
119
|
-
|
|
120
|
-
return 1;
|
|
161
|
+
return emitConstructMiss(id, args);
|
|
121
162
|
}
|
|
122
163
|
if (flagBool(args, 'json')) {
|
|
123
164
|
process.stdout.write(asJson(c) + '\n');
|
|
@@ -175,8 +216,7 @@ export const constructsTraceCommand = {
|
|
|
175
216
|
const { constructs } = await loadAll(args);
|
|
176
217
|
const c = constructs.find((x) => x.id === id);
|
|
177
218
|
if (!c) {
|
|
178
|
-
|
|
179
|
-
return 1;
|
|
219
|
+
return emitConstructMiss(id, args);
|
|
180
220
|
}
|
|
181
221
|
const trace = traceConstruct(c);
|
|
182
222
|
const deep = flagBool(args, 'deep');
|
|
@@ -274,8 +314,7 @@ export const constructsImpactCommand = {
|
|
|
274
314
|
const { constructs, inspection } = await loadAll(args);
|
|
275
315
|
const c = constructs.find((x) => x.id === id);
|
|
276
316
|
if (!c) {
|
|
277
|
-
|
|
278
|
-
return 1;
|
|
317
|
+
return emitConstructMiss(id, args);
|
|
279
318
|
}
|
|
280
319
|
const trace = traceConstruct(c);
|
|
281
320
|
/**
|
|
@@ -352,8 +391,7 @@ export const constructsRelatedCommand = {
|
|
|
352
391
|
const { constructs } = await loadAll(args);
|
|
353
392
|
const c = constructs.find((x) => x.id === id);
|
|
354
393
|
if (!c) {
|
|
355
|
-
|
|
356
|
-
return 1;
|
|
394
|
+
return emitConstructMiss(id, args);
|
|
357
395
|
}
|
|
358
396
|
const related = [
|
|
359
397
|
...(c.relatedKnowledge ?? []).map((id) => ({ kind: 'knowledge', id })),
|
|
@@ -389,8 +427,7 @@ export const constructsFilesCommand = {
|
|
|
389
427
|
const { constructs } = await loadAll(args);
|
|
390
428
|
const c = constructs.find((x) => x.id === id);
|
|
391
429
|
if (!c) {
|
|
392
|
-
|
|
393
|
-
return 1;
|
|
430
|
+
return emitConstructMiss(id, args);
|
|
394
431
|
}
|
|
395
432
|
const trace = traceConstruct(c);
|
|
396
433
|
// Emit the graph-resolved files (globs expanded), not the raw declared
|
|
@@ -419,8 +456,7 @@ export const constructsApiCommand = {
|
|
|
419
456
|
const { constructs } = await loadAll(args);
|
|
420
457
|
const c = constructs.find((x) => x.id === id);
|
|
421
458
|
if (!c) {
|
|
422
|
-
|
|
423
|
-
return 1;
|
|
459
|
+
return emitConstructMiss(id, args);
|
|
424
460
|
}
|
|
425
461
|
const publicApi = c.publicApi ?? [];
|
|
426
462
|
if (flagBool(args, 'json')) {
|
|
@@ -493,8 +529,7 @@ export const constructsFacetsCommand = {
|
|
|
493
529
|
const { constructs } = await loadAll(args);
|
|
494
530
|
const c = constructs.find((x) => x.id === id);
|
|
495
531
|
if (!c) {
|
|
496
|
-
|
|
497
|
-
return 1;
|
|
532
|
+
return emitConstructMiss(id, args);
|
|
498
533
|
}
|
|
499
534
|
const facets = c.facets ?? {};
|
|
500
535
|
if (flagBool(args, 'json')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.command.d.ts","sourceRoot":"","sources":["../../src/commands/context.command.ts"],"names":[],"mappings":"AAiBA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.command.d.ts","sourceRoot":"","sources":["../../src/commands/context.command.ts"],"names":[],"mappings":"AAiBA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA0ChC,eAAO,MAAM,cAAc,EAAE,eA8I5B,CAAC"}
|