@rulvar/cli 1.16.0 → 1.16.2

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/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { r as runCli, t as processIo } from "./io-Bex4Du1t.js";
2
+ import { r as runCli, t as processIo } from "./io-lNmGU5Lv.js";
3
+ import { inspect } from "node:util";
3
4
  //#region src/cli.ts
4
5
  /**
5
6
  * The `rulvar` bin entry: thin wrapper over runCli with process io.
@@ -10,7 +11,7 @@ runCli(process.argv.slice(2), {
10
11
  }).then((code) => {
11
12
  process.exitCode = code;
12
13
  }, (thrown) => {
13
- process.stderr.write(`${thrown instanceof Error ? thrown.stack : String(thrown)}\n`);
14
+ process.stderr.write(`${inspect(thrown)}\n`);
14
15
  process.exitCode = 1;
15
16
  });
16
17
  //#endregion
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-Bex4Du1t.js";
1
+ import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-lNmGU5Lv.js";
2
2
  import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, costReportFromJournal, maskSecrets, normalizeEntry, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
3
3
  //#region src/server.ts
4
4
  /**
@@ -314,6 +314,32 @@ function reportOutcome(outcome, io) {
314
314
  * `plan` and `kb` land with M6+/M10. Every command builds strictly from
315
315
  * the public @rulvar/core API.
316
316
  */
317
+ /**
318
+ * True exactly when a companion dynamic import failed because THAT
319
+ * package is not installed (the v1.16.1 review P1): the Node code must
320
+ * be ERR_MODULE_NOT_FOUND and the quoted missing specifier must be the
321
+ * requested companion itself. A transitive miss inside a found
322
+ * companion (same code, different quoted specifier) or any throw during
323
+ * module evaluation is that package's own defect, never install advice.
324
+ */
325
+ function isCompanionMissing(error, specifier) {
326
+ return error instanceof Error && error.code === "ERR_MODULE_NOT_FOUND" && error.message.includes(`'${specifier}'`);
327
+ }
328
+ /**
329
+ * Awaits a command-local companion import. Call sites keep the literal
330
+ * `import('@rulvar/...')` so the specifier stays analyzable and the
331
+ * tsdown external rule preserves it in dist. Missing package: the
332
+ * friendly ConfigError install hint. Anything else: the original error
333
+ * survives as `cause` under a command-prefixed message.
334
+ */
335
+ async function loadCompanion(loading, specifier, command, missingMessage) {
336
+ try {
337
+ return await loading;
338
+ } catch (error) {
339
+ if (isCompanionMissing(error, specifier)) throw new ConfigError(missingMessage);
340
+ throw new Error(`${command}: ${specifier} is installed but failed to load; the cause below is a defect in the installed package or its dependencies, not a missing install`, { cause: error });
341
+ }
342
+ }
317
343
  function parseRunFlags(argv) {
318
344
  const { values, positionals } = parseArgs({
319
345
  args: argv,
@@ -479,12 +505,7 @@ async function planCommand(argv, context) {
479
505
  });
480
506
  const goal = parsed.positionals[0];
481
507
  if (goal === void 0 || parsed.positionals.length > 1) throw new ConfigError("usage: rulvar plan \"<goal>\" [--dry-run]");
482
- let plannerModule;
483
- try {
484
- plannerModule = await import("./dist-D9g28MUP.js");
485
- } catch {
486
- throw new ConfigError("rulvar plan requires @rulvar/planner (the plan agent, compileScript, and the worker sandbox live there); install it next to the CLI");
487
- }
508
+ const plannerModule = await loadCompanion(import("@rulvar/planner"), "@rulvar/planner", "rulvar plan", "rulvar plan requires @rulvar/planner (the plan agent, compileScript, and the worker sandbox live there); install it next to the CLI");
488
509
  const assembled = assembleEngine({
489
510
  config: await loadCliConfig(context.cwd),
490
511
  cwd: context.cwd
@@ -555,12 +576,7 @@ function renderKbList(snapshot, context) {
555
576
  async function kbInboxCommand(argv, context) {
556
577
  const flags = parseCommonFlags(argv);
557
578
  if (flags.positionals.length > 0) throw new ConfigError("usage: rulvar kb inbox [--store PATH]");
558
- let plan;
559
- try {
560
- plan = await import("./dist-A5zLp_kr.js");
561
- } catch {
562
- throw new ConfigError("rulvar kb inbox requires @rulvar/plan (the RunLedger fold behind the LedgerExport seam)");
563
- }
579
+ const plan = await loadCompanion(import("@rulvar/plan"), "@rulvar/plan", "rulvar kb inbox", "rulvar kb inbox requires @rulvar/plan (the RunLedger fold behind the LedgerExport seam)");
564
580
  const assembled = assembleEngine({
565
581
  config: await loadCliConfig(context.cwd),
566
582
  ...flags.store === void 0 ? {} : { storePath: flags.store },
@@ -698,12 +714,7 @@ async function kbGateCommand(argv, context) {
698
714
  "medium",
699
715
  "low"
700
716
  ].includes(confidence)) throw new ConfigError(`--confidence must be high, medium or low, got '${String(values.confidence)}'`);
701
- let plan;
702
- try {
703
- plan = await import("./dist-A5zLp_kr.js");
704
- } catch {
705
- throw new ConfigError("rulvar kb gate requires @rulvar/plan (the RunLedger fold behind the LedgerExport seam)");
706
- }
717
+ const plan = await loadCompanion(import("@rulvar/plan"), "@rulvar/plan", "rulvar kb gate", "rulvar kb gate requires @rulvar/plan (the RunLedger fold behind the LedgerExport seam)");
707
718
  const assembled = assembleEngine({
708
719
  config: await loadCliConfig(context.cwd),
709
720
  ...values.store === void 0 ? {} : { storePath: values.store },
@@ -797,12 +808,7 @@ async function kbSweepCommand(argv, context) {
797
808
  const config = await loadCliConfig(context.cwd);
798
809
  const sweep = config.kbSweep;
799
810
  if (sweep === void 0) throw new ConfigError("rulvar kb sweep requires a kbSweep section in rulvar.config.mjs ({ committerId, models, cases })");
800
- let evals;
801
- try {
802
- evals = await import("./dist-CdhvWszV.js");
803
- } catch {
804
- throw new ConfigError("rulvar kb sweep requires @rulvar/evals (matrix sweeps, the eval-committer identity, and the canary live there); install it next to the CLI");
805
- }
811
+ const evals = await loadCompanion(import("@rulvar/evals"), "@rulvar/evals", "rulvar kb sweep", "rulvar kb sweep requires @rulvar/evals (matrix sweeps, the eval-committer identity, and the canary live there); install it next to the CLI");
806
812
  const store = new FileModelKnowledgeStore({ path: join(context.cwd, "rulvar.models.json") });
807
813
  const snapshot = await store.current();
808
814
  const observedAt = (/* @__PURE__ */ new Date()).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/cli",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "description": "Rulvar shell: run/resume/runs/inspect/plan/kb commands, TUI progress, createServer, createWorker, OTel exporter.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -22,17 +22,17 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@rulvar/core": "1.16.0"
25
+ "@rulvar/core": "1.16.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.20.0",
29
29
  "tsdown": "^0.22.3",
30
30
  "typescript": "~6.0.3",
31
- "@rulvar/store-sqlite": "1.16.0",
32
- "@rulvar/planner": "1.16.0",
33
- "@rulvar/testing": "1.16.0",
34
- "@rulvar/plan": "1.16.0",
35
- "@rulvar/evals": "1.16.0"
31
+ "@rulvar/testing": "1.16.2",
32
+ "@rulvar/planner": "1.16.2",
33
+ "@rulvar/store-sqlite": "1.16.2",
34
+ "@rulvar/plan": "1.16.2",
35
+ "@rulvar/evals": "1.16.2"
36
36
  },
37
37
  "bin": {
38
38
  "rulvar": "./dist/cli.js"