@shrkcrft/cli 0.1.0-alpha.25 → 0.1.0-alpha.27

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.
Files changed (42) hide show
  1. package/dist/command-registry.d.ts +22 -0
  2. package/dist/command-registry.d.ts.map +1 -1
  3. package/dist/command-registry.js +41 -0
  4. package/dist/commands/changelog-data.d.ts.map +1 -1
  5. package/dist/commands/changelog-data.js +45 -0
  6. package/dist/commands/check.command.d.ts.map +1 -1
  7. package/dist/commands/check.command.js +65 -8
  8. package/dist/commands/compress.command.d.ts.map +1 -1
  9. package/dist/commands/compress.command.js +31 -1
  10. package/dist/commands/delegate.command.d.ts +76 -1
  11. package/dist/commands/delegate.command.d.ts.map +1 -1
  12. package/dist/commands/delegate.command.js +585 -25
  13. package/dist/commands/finish.command.js +4 -4
  14. package/dist/commands/gate.command.d.ts.map +1 -1
  15. package/dist/commands/gate.command.js +57 -2
  16. package/dist/commands/graph.command.d.ts.map +1 -1
  17. package/dist/commands/graph.command.js +68 -1
  18. package/dist/commands/help.command.d.ts.map +1 -1
  19. package/dist/commands/help.command.js +73 -0
  20. package/dist/commands/registry-resolve.d.ts +48 -0
  21. package/dist/commands/registry-resolve.d.ts.map +1 -0
  22. package/dist/commands/registry-resolve.js +115 -0
  23. package/dist/commands/registry.command.d.ts.map +1 -1
  24. package/dist/commands/registry.command.js +23 -8
  25. package/dist/commands/reuse.command.d.ts +20 -0
  26. package/dist/commands/reuse.command.d.ts.map +1 -1
  27. package/dist/commands/reuse.command.js +81 -11
  28. package/dist/commands/trace.command.d.ts.map +1 -1
  29. package/dist/commands/trace.command.js +7 -1
  30. package/dist/commands/wiring.command.d.ts.map +1 -1
  31. package/dist/commands/wiring.command.js +88 -14
  32. package/dist/exit-codes.d.ts +90 -0
  33. package/dist/exit-codes.d.ts.map +1 -0
  34. package/dist/exit-codes.js +146 -0
  35. package/dist/finish/run-finish.d.ts +22 -3
  36. package/dist/finish/run-finish.d.ts.map +1 -1
  37. package/dist/finish/run-finish.js +185 -15
  38. package/dist/main.d.ts.map +1 -1
  39. package/dist/main.js +44 -4
  40. package/dist/output/output-compression.d.ts.map +1 -1
  41. package/dist/output/output-compression.js +4 -1
  42. package/package.json +33 -33
@@ -139,6 +139,18 @@ export declare function extractGlobalCompress(argv: readonly string[]): {
139
139
  directive?: IGlobalCompressDirective;
140
140
  rest: string[];
141
141
  };
142
+ /**
143
+ * Strip the global `--exit-trailer` flag so it can appear anywhere (even after a
144
+ * command) without any per-command flag-guard rejecting it as unknown — exactly
145
+ * like `--cwd`. The stripped `rest` is what the trie descent + `parseArgs` see;
146
+ * the returned `trailer` boolean tells {@link runCli} whether to emit the
147
+ * `shrk-exit: <code>` trailer. Everything after the POSIX `--` sentinel is a
148
+ * literal positional and is preserved verbatim.
149
+ */
150
+ export declare function extractGlobalExitTrailer(argv: readonly string[]): {
151
+ trailer: boolean;
152
+ rest: string[];
153
+ };
142
154
  /**
143
155
  * Returns the absolute cwd for the current command:
144
156
  * 1. Command-level --cwd flag (if passed after the command)
@@ -191,5 +203,15 @@ export interface IFlagListOptions {
191
203
  }
192
204
  export declare function flagList(args: ParsedArgs, name: string, options?: IFlagListOptions): string[];
193
205
  export declare function flagVars(args: ParsedArgs): Record<string, string>;
206
+ /**
207
+ * Return the first parsed flag whose name is NOT in `allowed`, or `undefined`
208
+ * when every flag is recognized. The parser does not reject unknown flags on its
209
+ * own — without a per-command allow-list a typo'd flag (`--no-such-flag`) parses
210
+ * as `true`, reads as a confident opt-in, and the verb runs the bare command at
211
+ * exit `0`. A verb that opts into strict flag handling calls this with its known
212
+ * set and rejects the result loudly, so a mistyped/renamed flag can never read
213
+ * as success (see docs/exit-codes.md · a25 §2.1).
214
+ */
215
+ export declare function firstUnknownFlag(args: ParsedArgs, allowed: ReadonlySet<string>): string | undefined;
194
216
  export {};
195
217
  //# sourceMappingURL=command-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-registry.d.ts","s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,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKxF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;CACrC;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,MAAM,EAAE,CAkCV;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,MAAM,GAAG,SAAS,CAKpB"}
@@ -367,6 +367,31 @@ export function extractGlobalCompress(argv) {
367
367
  directive.query = query;
368
368
  return { directive, rest };
369
369
  }
370
+ /**
371
+ * Strip the global `--exit-trailer` flag so it can appear anywhere (even after a
372
+ * command) without any per-command flag-guard rejecting it as unknown — exactly
373
+ * like `--cwd`. The stripped `rest` is what the trie descent + `parseArgs` see;
374
+ * the returned `trailer` boolean tells {@link runCli} whether to emit the
375
+ * `shrk-exit: <code>` trailer. Everything after the POSIX `--` sentinel is a
376
+ * literal positional and is preserved verbatim.
377
+ */
378
+ export function extractGlobalExitTrailer(argv) {
379
+ const rest = [];
380
+ let trailer = false;
381
+ for (let i = 0; i < argv.length; i += 1) {
382
+ const t = argv[i];
383
+ if (t === '--') {
384
+ rest.push(...argv.slice(i));
385
+ break;
386
+ }
387
+ if (t === '--exit-trailer') {
388
+ trailer = true;
389
+ continue;
390
+ }
391
+ rest.push(t);
392
+ }
393
+ return { trailer, rest };
394
+ }
370
395
  /**
371
396
  * Returns the absolute cwd for the current command:
372
397
  * 1. Command-level --cwd flag (if passed after the command)
@@ -451,3 +476,19 @@ export function flagVars(args) {
451
476
  }
452
477
  return out;
453
478
  }
479
+ /**
480
+ * Return the first parsed flag whose name is NOT in `allowed`, or `undefined`
481
+ * when every flag is recognized. The parser does not reject unknown flags on its
482
+ * own — without a per-command allow-list a typo'd flag (`--no-such-flag`) parses
483
+ * as `true`, reads as a confident opt-in, and the verb runs the bare command at
484
+ * exit `0`. A verb that opts into strict flag handling calls this with its known
485
+ * set and rejects the result loudly, so a mistyped/renamed flag can never read
486
+ * as success (see docs/exit-codes.md · a25 §2.1).
487
+ */
488
+ export function firstUnknownFlag(args, allowed) {
489
+ for (const key of args.flags.keys()) {
490
+ if (!allowed.has(key))
491
+ return key;
492
+ }
493
+ return undefined;
494
+ }
@@ -1 +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"}
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,EAwGjE,CAAC"}
@@ -67,4 +67,49 @@ export const RELEASE_SURFACE_DELTAS = [
67
67
  ],
68
68
  removed: [],
69
69
  },
70
+ {
71
+ version: '0.1.0-alpha.26',
72
+ title: 'Honest exit codes',
73
+ added: [
74
+ 'A unified exit-code contract across every gate/verify/check verb: `0` verified pass, `1` failure, `2` NOT-verified (empty scope / degraded / timeout). See docs/exit-codes.md.',
75
+ 'Global `--strict` — promote a NOT-verified (`2`) verdict to a failure-class nonzero (`1`) across every gate, for a hard CI gate in one switch.',
76
+ '`shrk gate baseline --refreeze` — re-freeze the architecture baseline to the current state (operational reset).',
77
+ '`shrk check wiring --base <ref>` (synonym of `--since`); `check wiring` now shows the rule ids selected by footprint under a scoped run.',
78
+ '`shrk reuse … --all` — the full candidate catalog (default is now a scored top-K did-you-mean).',
79
+ ],
80
+ changed: [
81
+ '`shrk check wiring` (0 rules evaluated) and `shrk registry lifecycle` / `check registry-lifecycle` (0 registrations, or wall-clock timeout) now exit `2` (NOT verified), not a green `0` a chained `&& next` would march past.',
82
+ 'The graph/query family (`graph cycles|hubs|callers|impact|search|context|…`) rejects an unknown/misspelled flag (`unknown option --x`, exit `2`) instead of silently swallowing it as a confident success.',
83
+ 'Piping any streaming list (`… | head`, `| grep`) no longer crashes with `write EPIPE` — a downstream early-close is swallowed and the real exit code is preserved.',
84
+ '`shrk check wiring --help` documents its own scoping flags instead of running the bare check.',
85
+ '`shrk reuse "<intent>"` returns a scored top-K did-you-mean (score per row) on a weak/no-match intent instead of dumping the whole catalog.',
86
+ '`shrk registry <name> exists <id> --resolve` also normalizes (case-fold, singular/plural, suffix strip/append), not just the declared `aliases` map.',
87
+ '`shrk compress` prints a `fidelity: lossy|lossless|passthrough` banner on the human text path (parity with `--json`).',
88
+ '`shrk changes summary` ships a built-in config/tooling area for non-lib paths — only genuinely unclassifiable files stay `unknown`.',
89
+ '`shrk gen` saved plans persist the rendered file `body` + a per-entry `sha256` digest (reviewable/diffable/re-appliable), not just `sizeBytes`.',
90
+ '`shrk gate` counts only change-attributable (diff-vs-HEAD) architecture errors as blocking; stale-baseline drift in untouched files is informational.',
91
+ ],
92
+ removed: [],
93
+ },
94
+ {
95
+ version: '0.1.0-alpha.27',
96
+ title: 'Runtime-wiring queries, the composite finish verdict & pipe-safe exit codes',
97
+ added: [
98
+ '`shrk wiring unprovided | orphans --changed-only | --base <ref>` — scope the DI/registration-graph verdict to the changeset (the silent-at-runtime tokens THIS change left unprovided); an empty changed scope exits `2` (NOT verified), never a green `0`.',
99
+ '`shrk finish` returns an honest `0`/`1`/`2` (0 pass · 1 fail · 2 not-verified) and now runs two more sub-gates over tracked AND untracked changes: `unprovided` (the DI-graph gate — diff-aware, so it also catches a DELETED provider that leaves a token silently unresolved) and an advisory `arch` (does a changed file sit in a runtime import cycle).',
100
+ 'Global `--exit-trailer` — print the final verdict as the LAST stderr line (`shrk-exit: <code>`) so a piped gate’s exit survives `| head` / `| grep` (which report the downstream command’s `$?`).',
101
+ '`shrk trace literal "<string>"` classifies a distinct `render`/handle role, completing the declare → register → consume → render chain; a bare `trace "<literal>"` with no fuzzy match now hints the `trace literal` form.',
102
+ 'MCP: `get_wiring_graph` — the read-only registration/DI-graph query (unprovided / orphans / chain) exposed to agents, mirroring `shrk wiring` without a shell-out.',
103
+ ],
104
+ changed: [
105
+ '`shrk finish` no longer paints a green `0` when it evaluated NOTHING — a markdown-only change or an empty scope is now `2` (not-verified). Only deciding (non-advisory) gates set the verdict; a change to non-code files skips the boundary/import/wiring gates loudly instead of trivially passing.',
106
+ 'Any gate/verify verb whose stdout is piped prints a one-line stderr note when a NON-zero exit would otherwise be masked by the downstream command’s `$?` (a masked `0`→`0` is harmless, so the note is reserved for a real `1`/`2`).',
107
+ '`shrk help <unknown-topic>` errors to stderr with a nearest-topic did-you-mean and a nonzero exit, instead of re-printing the whole command list re-prefixed with the bogus topic (false self-discovery).',
108
+ '`shrk registry <name> exists <id> --resolve` chains normalization strategies (plural-strip THEN suffix strip/append) so a doubly-off noun (`buttons` → `button` → `button-command`) resolves instead of no-op’ing.',
109
+ 'Cycle detection’s type-only exclusion is verified end-to-end from real `import type` source (not just synthetic edges): a pure interface↔interface loop is `0` runtime cycles by default and `1` under `--include-type-edges`.',
110
+ '`shrk finish`’s import-hygiene sub-gate no longer false-fails on a changed TEST file whose fixture strings contain import-like text — the explicit-files path now applies the same `__tests__`/`__fixtures__` exclusion `check imports` already used (both paths share one rule).',
111
+ '`shrk wiring unprovided|orphans` reject a bad `--base <ref>` with a distinct error (not a silent empty "nothing changed" scope), and exclude SHRK’s own `.sharkcraft/` writes so a clean tree with `--changed-only` reads as not-verified (`2`), never a false green.',
112
+ ],
113
+ removed: [],
114
+ },
70
115
  ];
@@ -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;AAm1BhC,eAAO,MAAM,YAAY,EAAE,eAoG1B,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;AAu4BhC,eAAO,MAAM,YAAY,EAAE,eA+G1B,CAAC"}
@@ -3,6 +3,7 @@ import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
3
3
  import * as nodePath from 'node:path';
4
4
  import { flagBool, flagNumber, flagString, flagVars, resolveCwd, } from "../command-registry.js";
5
5
  import { asJson, header, kv } from "../output/format-output.js";
6
+ import { ExitCode } from "../exit-codes.js";
6
7
  import { maybeRunInWatchMode } from "../output/watch-loop.js";
7
8
  import { computeDeletedOrphans } from "../diff/deleted-orphans.js";
8
9
  import { renderWiringExplain } from "./wiring.command.js";
@@ -522,11 +523,29 @@ async function checkBoundariesOnce(args) {
522
523
  // ────────────────────────────────────────────────────────────────────────
523
524
  // Subcommand: wiring — "declared but not wired" completeness checks
524
525
  // ────────────────────────────────────────────────────────────────────────
526
+ const WIRING_CHECK_USAGE = 'shrk check wiring [--changed-only] [--since <ref>] [--base <ref>] [--only <ids>] [--explain <ruleId>] [--json] [--strict]\n' +
527
+ ' Cross-file "declared but not wired" completeness gate. Scope flags select rules by\n' +
528
+ ' FOOTPRINT — a rule fires when the diff touches EITHER its declared or its registered\n' +
529
+ ' side (so a registration edited in file B fires a rule declared in file A).\n' +
530
+ ' --changed-only run only rules whose footprint intersects the working diff\n' +
531
+ ' --since <ref> scope the diff to changes since <ref> (--base is a synonym)\n' +
532
+ ' --only <ids> run only these rule ids (comma-separated)\n' +
533
+ ' --explain <id> dry-run ONE rule and print the declared/registered sets it extracts\n' +
534
+ ' Exit: 0 verified pass · 1 violations · 2 not-verified (0 rules evaluated in scope).';
525
535
  async function checkWiring(args) {
526
536
  const cwd = resolveCwd(args);
537
+ // `--help`/`-h` on the subverb documents its own scoping flags instead of
538
+ // silently running the bare check (a25 §3.2). The check dispatcher doesn't
539
+ // intercept a subverb-level `--help`, so handle it here.
540
+ if (flagBool(args, 'help') || flagBool(args, 'h')) {
541
+ process.stdout.write(WIRING_CHECK_USAGE + '\n');
542
+ return 0;
543
+ }
527
544
  const wantJson = flagBool(args, 'json');
528
545
  const changedOnly = flagBool(args, 'changed-only');
529
- const since = flagString(args, 'since');
546
+ // `--base <ref>` is an accepted synonym for `--since <ref>` (a25 §3.2)
547
+ // scope the footprint diff to changes since an arbitrary ref.
548
+ const since = flagString(args, 'since') ?? flagString(args, 'base');
530
549
  const only = flagString(args, 'only');
531
550
  // Distinguish "config is invalid" from "config valid with no wiring rules":
532
551
  // an invalid config (e.g. a malformed wiringRule) must NOT fail open with a
@@ -613,22 +632,50 @@ async function checkWiring(args) {
613
632
  if (matchedNothing > 0)
614
633
  parts.push(`${matchedNothing} matched no files`);
615
634
  const breakdown = parts.length > 0 ? ` (${parts.join(', ')})` : '';
635
+ // Rule ids selected by footprint (declared OR registered side intersecting the
636
+ // diff) — positive evidence the gate ran the RIGHT rules for the change's
637
+ // blast radius, not just the rules whose literal files were edited (a25 §3.2).
638
+ const selectedRuleIds = report.rules.map((r) => r.ruleId);
639
+ const scoped = changedOnly || since !== undefined;
616
640
  if (wantJson) {
617
641
  // 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');
620
- return report.verdict === 'errors' ? 1 : 0;
642
+ // a real green, and see how many rules the scope skipped + which fired.
643
+ process.stdout.write(asJson({
644
+ ...report,
645
+ configured,
646
+ selected,
647
+ evaluated,
648
+ skippedByScope,
649
+ matchedNothing,
650
+ notVerified,
651
+ selectedRuleIds,
652
+ // Distinguish verified-pass / failure / not-verified for a chained gate.
653
+ exitCode: evaluated === 0 ? ExitCode.NotVerified : report.verdict === 'errors' ? ExitCode.Failure : ExitCode.VerifiedPass,
654
+ }) + '\n');
655
+ // `evaluated === 0` = nothing checked in scope → NOT verified (`2`), never a
656
+ // silent `0` an agent's `&& next` would march past (a25 §1.1).
657
+ return evaluated === 0
658
+ ? ExitCode.NotVerified
659
+ : report.verdict === 'errors'
660
+ ? ExitCode.Failure
661
+ : ExitCode.VerifiedPass;
621
662
  }
622
663
  process.stdout.write(header('Wiring check'));
623
664
  // `evaluated` counts rules that actually ran a comparison (globs matched >0
624
665
  // files). When 0 rules evaluated but rules ARE configured, say so loudly —
625
- // "checked nothing" must never read as the green "every token is wired" pass.
666
+ // "checked nothing" must never read as the green "every token is wired" pass,
667
+ // and the exit code must say NOT verified (`2`) too, not a lying `0`.
626
668
  if (evaluated === 0) {
627
669
  process.stdout.write(` ! 0 rules evaluated — NOT verified. ${configured} rule(s) configured${breakdown}; ` +
628
670
  'none ran a comparison in scope. Wiring was not checked — this is not a pass.\n');
629
- return 0;
671
+ return ExitCode.NotVerified;
630
672
  }
631
673
  process.stdout.write(kv('rules evaluated', `${evaluated} of ${configured}${breakdown}`) + '\n');
674
+ if (scoped && selectedRuleIds.length > 0) {
675
+ // Show WHICH rules the diff's footprint selected so the scoping is provable,
676
+ // not indistinguishable from plain changed-file scoping.
677
+ process.stdout.write(kv('selected by footprint', selectedRuleIds.join(', ')) + '\n');
678
+ }
632
679
  const errors = report.violations.filter((v) => v.severity === 'error').length;
633
680
  const warnings = report.violations.filter((v) => v.severity === 'warning').length;
634
681
  process.stdout.write(kv('violations', `${errors} error(s), ${warnings} warning(s)`) + '\n');
@@ -821,8 +868,18 @@ export const checkCommand = {
821
868
  ...(scope ? { scope } : {}),
822
869
  ...(skipDirs ? { skipDirs } : {}),
823
870
  });
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;
871
+ // Honest exit-code contract (a25 §1 / §2.5):
872
+ // timedOut → NOT verified (2): the budget flushed partial results.
873
+ // registersFound=0 → NOT verified (2): nothing to check in scope — a
874
+ // "nothing to verify" run must never read as a green
875
+ // pass (an agent's `&& next` would march past it).
876
+ // missingRemovers>0 → failure (1).
877
+ // otherwise → verified pass (0).
878
+ const exit = report.timedOut || report.registersFound === 0
879
+ ? ExitCode.NotVerified
880
+ : report.missingRemovers.length === 0
881
+ ? ExitCode.VerifiedPass
882
+ : ExitCode.Failure;
826
883
  if (flagBool(args, 'json')) {
827
884
  process.stdout.write(asJson(report) + '\n');
828
885
  return exit;
@@ -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,eAqH7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eA4B3B,CAAC"}
1
+ {"version":3,"file":"compress.command.d.ts","sourceRoot":"","sources":["../../src/commands/compress.command.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA8FhC,eAAO,MAAM,eAAe,EAAE,eA0H7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eA4B3B,CAAC"}
@@ -38,6 +38,31 @@ function resolveContentType(raw) {
38
38
  // legitimately have nothing to compress). Above it, a silent `−0%` re-emit is
39
39
  // the opposite of the tool's purpose — nudge the user toward `--type`.
40
40
  const PASSTHROUGH_HINT_MIN_BYTES = 128;
41
+ /**
42
+ * The no-win / passthrough test, shared by the `--json` envelope and the human
43
+ * text banner: a Passthrough strategy or a non-positive saving means the engine
44
+ * declined to compress and `compressed` is the verbatim original. Keeping it in
45
+ * one place is what makes the two output paths agree on fidelity.
46
+ */
47
+ function isNoWin(result) {
48
+ return result.strategy === ECompressionStrategy.Passthrough || result.savings.saved <= 0;
49
+ }
50
+ /**
51
+ * The fidelity label for the human text path, mirroring the `fidelity` field
52
+ * the `--json` envelope surfaces: `passthrough` for a no-win re-emit, `lossy`
53
+ * for a reduction that drops detail (markdown line-omission or the code
54
+ * outline), and `lossless` otherwise. Same classification as `--json` — the
55
+ * text path just names the no-win case explicitly instead of via a separate
56
+ * `passthrough` boolean, so an agent reading stderr sees the fidelity at a
57
+ * glance.
58
+ */
59
+ function textFidelity(result) {
60
+ if (isNoWin(result))
61
+ return 'passthrough';
62
+ if (result.strategy === ECompressionStrategy.Code || result.lossy)
63
+ return 'lossy';
64
+ return 'lossless';
65
+ }
41
66
  function readInput(args) {
42
67
  const positional = args.positional[0];
43
68
  const useStdin = flagBool(args, 'stdin') || positional === undefined || positional === '-';
@@ -133,7 +158,7 @@ export const compressCommand = {
133
158
  // VERBATIM original as `compressed`. Echoing it back inside the JSON
134
159
  // envelope (plus scaffold) costs more tokens than the input. Signal
135
160
  // passthrough and omit the duplicated content — the caller still has it.
136
- const noWin = result.strategy === ECompressionStrategy.Passthrough || result.savings.saved <= 0;
161
+ const noWin = isNoWin(result);
137
162
  const payload = noWin
138
163
  ? { ...base, passthrough: true, inputBytes: Buffer.byteLength(content, 'utf8') }
139
164
  : { ...base, compressed: result.compressed };
@@ -143,6 +168,11 @@ export const compressCommand = {
143
168
  process.stdout.write(result.compressed + '\n');
144
169
  const cached = result.ccrKey ? ` · original cached as ${result.ccrKey} (shrk expand ${result.ccrKey})` : '';
145
170
  process.stderr.write(`${result.strategy}: ~${result.savings.before} → ~${result.savings.after} tokens (−${pct}%, est.)${cached}\n`);
171
+ // Fidelity parity with `--json`: print the same classification the JSON
172
+ // envelope carries as a one-line banner so an agent reading only stderr can
173
+ // see the output was lossy — and see the no-win `passthrough` case named
174
+ // explicitly rather than inferred from a bare `−0%` ratio.
175
+ process.stderr.write(`fidelity: ${textFidelity(result)}\n`);
146
176
  // Fidelity banner: the code outline elides function bodies, so it is a
147
177
  // footgun as a cheaper Read. Say so loudly — same failure mode as a lossy
148
178
  // result that doesn't *look* lossy.
@@ -1,5 +1,6 @@
1
- import { type IAiProvider } from '@shrkcrft/ai';
1
+ import { type IAiProvider, type IQueryDescriptor, type QueryExecutor } from '@shrkcrft/ai';
2
2
  import { type IDelegateRecipe } from '@shrkcrft/config';
3
+ import { type IDelegateAnalysisReport, type IDelegateFailureContext, type IGroundingFacts, type IResolvedDelegateRecipe, type ISharkcraftInspection } from '@shrkcrft/inspector';
3
4
  import { type IDroppedOp } from '@shrkcrft/generator';
4
5
  import { type ICommandHandler } from '../command-registry.js';
5
6
  export type DelegateRunStatus = 'no-provider' | 'generate-failed' | 'guardrail-refused' | 'package-error' | 'conflicts' | 'sign-failed' | 'no-verification' | 'generated' | 'applied' | 'apply-failed' | 'verify-failed';
@@ -16,6 +17,14 @@ export interface IExecuteDelegateRunInput {
16
17
  planSecret?: string;
17
18
  /** Validation report dir. Default `.sharkcraft/delegate/reports`. */
18
19
  reportDir?: string;
20
+ /**
21
+ * Optional retry advisor (Phase 2, `--assisted-retry`). Between retryable
22
+ * failures it may return a corrected-instruction string, appended to the
23
+ * deterministic retry feedback. Best-effort: a null return / throw is ignored,
24
+ * so the deterministic loop is never blocked by the advisor. Injectable for
25
+ * tests; the cli wires one from a `retry-analysis` recipe.
26
+ */
27
+ retryAdvisor?: (failure: IDelegateFailureContext, attempt: number) => Promise<string | null>;
19
28
  }
20
29
  export interface IExecuteDelegateRunResult {
21
30
  status: DelegateRunStatus;
@@ -61,5 +70,71 @@ export declare function gatherRecipeContext(projectRoot: string, recipe: IDelega
61
70
  * retried. Takes an already-resolved recipe + provider so tests inject a fake.
62
71
  */
63
72
  export declare function executeDelegateRun(input: IExecuteDelegateRunInput): Promise<IExecuteDelegateRunResult>;
73
+ export type DelegateAnalyzeStatus = 'no-provider' | 'analyze-failed' | 'analyzed';
74
+ export interface IExecuteDelegateAnalyzeInput {
75
+ task: string;
76
+ /** An analysis recipe (mode === 'analysis'); its provider/model are folded. */
77
+ recipe: IResolvedDelegateRecipe;
78
+ /** The deterministic ground truth produced by `runGroundingReport`. */
79
+ facts: IGroundingFacts;
80
+ /** Injectable for tests; `null` means no local LLM is reachable. */
81
+ provider: IAiProvider | null;
82
+ /** Drop non-grounded findings instead of keeping+flagging them. */
83
+ strict?: boolean;
84
+ /**
85
+ * Read-only query executor for the bounded query loop (Phase 3). Injected by
86
+ * the cli from the inspection; absent (or a recipe with no `allowedQueries` /
87
+ * `maxQueryRounds`) ⇒ single-shot analysis. Tests inject a fake.
88
+ */
89
+ queryExecutor?: QueryExecutor;
90
+ /** Human-readable provider label for the report when no model id is returned. */
91
+ providerLabel: string;
92
+ /** Timestamp source (kept out of the core so tests are deterministic). */
93
+ generatedAt: string;
94
+ }
95
+ /** Human descriptions of the read-only queries shown to the model in the loop. */
96
+ export declare const DELEGATE_QUERY_CATALOG: readonly IQueryDescriptor[];
97
+ /**
98
+ * Build the read-only query executor: maps each `DELEGATE_QUERY_IDS` value to a
99
+ * deterministic inspector function. Every query is read-only — there is no
100
+ * write/apply query. Returns compact text + the entities it surfaced (merged
101
+ * into the analysis ground truth so a finding citing a pulled fact is grounded).
102
+ */
103
+ export declare function buildAnalysisQueryExecutor(inspection: ISharkcraftInspection, task: string): QueryExecutor;
104
+ export interface IExecuteDelegateAnalyzeResult {
105
+ status: DelegateAnalyzeStatus;
106
+ recipeId: string;
107
+ report: IDelegateAnalysisReport;
108
+ usage?: {
109
+ inputTokens?: number;
110
+ outputTokens?: number;
111
+ };
112
+ retried?: boolean;
113
+ }
114
+ /**
115
+ * The testable analysis core (no I/O beyond the injected provider). Runs the
116
+ * model on the deterministic ground truth, cross-checks its findings, and
117
+ * assembles the advisory report. NEVER writes — analysis mode is read-only.
118
+ * `provider === null` degrades to a deterministic grounding-only report (ok).
119
+ */
120
+ export declare function executeDelegateAnalyze(input: IExecuteDelegateAnalyzeInput): Promise<IExecuteDelegateAnalyzeResult>;
121
+ /** The single corrected instruction to feed back: a grounded finding wins. */
122
+ export declare function correctedInstruction(report: IDelegateAnalysisReport): string | null;
123
+ export interface IRetryAdvisorDeps {
124
+ /** A `mode: 'analysis'`, `groundedOn: 'delegate-failure'` recipe. */
125
+ retryRecipe: IResolvedDelegateRecipe;
126
+ provider: IAiProvider | null;
127
+ providerLabel: string;
128
+ /** The patch recipe being retried (named in the advisor prompt). */
129
+ patchRecipeId: string;
130
+ }
131
+ /**
132
+ * Build a retry advisor from a `retry-analysis` recipe: it grounds on the failed
133
+ * attempt (`buildDelegateFailureFacts`), runs the analysis model, and returns the
134
+ * single corrected instruction. Read-only — it never writes; a null provider or
135
+ * an empty analysis yields `null` (no enrichment). The corrected instruction is
136
+ * cross-checked against the failure ground truth just like any analysis finding.
137
+ */
138
+ export declare function buildRetryAnalysisAdvisor(deps: IRetryAdvisorDeps): (failure: IDelegateFailureContext, attempt: number) => Promise<string | null>;
64
139
  export declare const delegateCommand: ICommandHandler;
65
140
  //# sourceMappingURL=delegate.command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delegate.command.d.ts","sourceRoot":"","sources":["../../src/commands/delegate.command.ts"],"names":[],"mappings":"AAgBA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAqB,KAAK,eAAe,EAA0B,MAAM,kBAAkB,CAAC;AASnG,OAAO,EAOL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,iBAAiB,GACjB,mBAAmB,GACnB,eAAe,GACf,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,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