@biffo/cli 0.323.0 → 0.324.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.
Files changed (2) hide show
  1. package/dist/index.js +98 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7565,6 +7565,14 @@ function resolveCoreRoot(input) {
7565
7565
  }
7566
7566
  return cache;
7567
7567
  }
7568
+ function resolveCoreRootForCli(explicit, runner) {
7569
+ return resolveCoreRoot({
7570
+ ...explicit ? { explicit } : {},
7571
+ env: process.env,
7572
+ coreTag: `core-v${getLatestCoreVersion()}`,
7573
+ runner
7574
+ });
7575
+ }
7568
7576
 
7569
7577
  // src/lib/plugin-compose/dev-up.ts
7570
7578
  import { existsSync as existsSync24 } from "fs";
@@ -7683,9 +7691,10 @@ function isGitIgnored(deps, cwd, file) {
7683
7691
  return status !== 1;
7684
7692
  }
7685
7693
  async function runDevUp(options, deps, hooks) {
7694
+ const label = options.label ?? "dev up";
7686
7695
  if (options.configFile && !isGitIgnored(deps, options.pluginRoot, options.configFile)) {
7687
7696
  log.warn(
7688
- `dev up: ${options.configFile} may hold secret values and is NOT git-ignored \u2014 add it to .gitignore before it is committed (Secret Scan reads history, not just your diff)`
7697
+ `${label}: ${options.configFile} may hold secret values and is NOT git-ignored \u2014 add it to .gitignore before it is committed (Secret Scan reads history, not just your diff)`
7689
7698
  );
7690
7699
  }
7691
7700
  let stack;
@@ -7693,10 +7702,10 @@ async function runDevUp(options, deps, hooks) {
7693
7702
  stack = await composeStack({ ...options, readyTimeoutMs: 12e4 }, deps);
7694
7703
  } catch (err) {
7695
7704
  if (options.signal?.aborted) {
7696
- log.info("dev up: interrupted \u2014 everything started so far was torn down");
7705
+ log.info(`${label}: interrupted \u2014 everything started so far was torn down`);
7697
7706
  return INTERRUPTED_EXIT;
7698
7707
  }
7699
- log.error(`dev up: ${err.message}`);
7708
+ log.error(`${label}: ${err.message}`);
7700
7709
  return 1;
7701
7710
  }
7702
7711
  try {
@@ -7710,23 +7719,23 @@ async function runDevUp(options, deps, hooks) {
7710
7719
  wrongKeyToken: mintDevToken(wrongKey.privateKeyPem, { groups: stack.groups })
7711
7720
  });
7712
7721
  const results = await runProbes(probes, deps.fetchFn);
7713
- hooks.write(`dev up: ${results.filter((r) => r.ok).length}/${results.length} probes matched`);
7722
+ hooks.write(`${label}: ${results.filter((r) => r.ok).length}/${results.length} probes matched`);
7714
7723
  for (const line of formatProbeTable(results)) hooks.write(line);
7715
7724
  for (const note of notes) hooks.write(` note: ${note}`);
7716
7725
  const verdict = probesGreen(results, stack.manifest);
7717
7726
  if (stack.sink.unexpected.length > 0) {
7718
7727
  hooks.write(
7719
- `dev up: WARNING ${stack.sink.unexpected.length} AWS call(s) hit the local sink with no implementation (${[...new Set(stack.sink.unexpected)].join(", ")}) \u2014 refused, not forwarded`
7728
+ `${label}: WARNING ${stack.sink.unexpected.length} AWS call(s) hit the local sink with no implementation (${[...new Set(stack.sink.unexpected)].join(", ")}) \u2014 refused, not forwarded`
7720
7729
  );
7721
7730
  }
7722
7731
  if (options.check) {
7723
7732
  if (options.signal?.aborted) return INTERRUPTED_EXIT;
7724
- if (!verdict.ok) log.error(`dev up --check: ${verdict.reason}`);
7725
- else log.success("dev up --check: composition healthy");
7733
+ if (!verdict.ok) log.error(`${label} --check: ${verdict.reason}`);
7734
+ else log.success(`${label} --check: composition healthy`);
7726
7735
  return verdict.ok ? 0 : 1;
7727
7736
  }
7728
7737
  if (!verdict.ok)
7729
- log.warn(`dev up: ${verdict.reason} \u2014 the stack is up, but do not trust it yet`);
7738
+ log.warn(`${label}: ${verdict.reason} \u2014 the stack is up, but do not trust it yet`);
7730
7739
  hooks.write("");
7731
7740
  hooks.write(` Core ${stack.coreUrl}/api/v1 (health: /health)`);
7732
7741
  hooks.write(` Plugin host ${stack.hostUrl}/${stack.manifest.name}/<route>`);
@@ -7744,13 +7753,17 @@ async function runDevUp(options, deps, hooks) {
7744
7753
  ` curl -H "Authorization: Bearer $TOKEN" ${stack.hostUrl}/${stack.manifest.name}/<declared route>`
7745
7754
  );
7746
7755
  hooks.write("");
7747
- hooks.write("dev up: running \u2014 Ctrl-C to stop");
7756
+ hooks.write(`${label}: running \u2014 Ctrl-C to stop`);
7748
7757
  await hooks.untilInterrupted();
7749
7758
  return 0;
7750
7759
  } finally {
7751
7760
  await stack.close();
7752
7761
  }
7753
7762
  }
7763
+ function runCompositionCheck(options, deps, write) {
7764
+ return runDevUp({ ...options, check: true }, deps, { write, untilInterrupted: async () => {
7765
+ } });
7766
+ }
7754
7767
 
7755
7768
  // src/lib/plugin-compose/interrupt.ts
7756
7769
  var INTERRUPTS = ["SIGINT", "SIGTERM", "SIGHUP"];
@@ -7780,12 +7793,7 @@ var devUpCommand = new Command10("up").description(
7780
7793
  const runner = new RealCommandRunner();
7781
7794
  let coreRoot;
7782
7795
  try {
7783
- coreRoot = resolveCoreRoot({
7784
- ...options.coreRoot ? { explicit: options.coreRoot } : {},
7785
- env: process.env,
7786
- coreTag: `core-v${getLatestCoreVersion()}`,
7787
- runner
7788
- });
7796
+ coreRoot = resolveCoreRootForCli(options.coreRoot, runner);
7789
7797
  } catch (err) {
7790
7798
  log.error(`dev up: ${err.message}`);
7791
7799
  process.exit(1);
@@ -12255,10 +12263,19 @@ function runChecksOnce(runner, cwd, dsn) {
12255
12263
  }
12256
12264
 
12257
12265
  // src/lib/plugin-verify/run-plugin-verify.ts
12266
+ var REAL_CORE_LABEL = "plugin verify (real_core)";
12258
12267
  var PG_TEST_DB_SCRIPT2 = "scripts/pg-test-db.sh";
12259
12268
  async function runPluginVerify(options, deps) {
12260
12269
  if (options.listChecks) {
12261
- return listChecks(deps.runner, options.cwd);
12270
+ const status = listChecks(deps.runner, options.cwd);
12271
+ log.info(
12272
+ "real_core composition-owned: run by `biffo plugin verify` itself via plugin-compose/compose-stack (not by `conformance run`); --no-real-core skips it"
12273
+ );
12274
+ return status;
12275
+ }
12276
+ if (options.realCore && !deps.realCore) {
12277
+ log.error("plugin verify: the real_core seam is required but no composition was wired in");
12278
+ return 2;
12262
12279
  }
12263
12280
  const script = deps.findScript(PG_TEST_DB_SCRIPT2);
12264
12281
  if (!script) {
@@ -12287,24 +12304,76 @@ async function runPluginVerify(options, deps) {
12287
12304
  return second;
12288
12305
  }
12289
12306
  log.success("plugin verify: green twice against the same database");
12290
- return 0;
12307
+ if (!options.realCore) {
12308
+ log.warn(
12309
+ "plugin verify: the real_core seam was SKIPPED (--no-real-core) -- Core + the plugin host were NOT composed, so nothing here proves the plugin starts under real Core"
12310
+ );
12311
+ return 0;
12312
+ }
12313
+ return runRealCore(options, deps.realCore);
12314
+ }
12315
+ async function runRealCore(options, real) {
12316
+ let coreRoot;
12317
+ try {
12318
+ coreRoot = real.coreRoot();
12319
+ } catch (err) {
12320
+ log.error(`${REAL_CORE_LABEL}: ${err.message}`);
12321
+ return 1;
12322
+ }
12323
+ log.info(`${REAL_CORE_LABEL}: composing Core + plugin host (the stack \`biffo dev up\` runs)`);
12324
+ const status = await runCompositionCheck(
12325
+ {
12326
+ pluginRoot: options.cwd,
12327
+ coreRoot,
12328
+ configFile: pickConfigFile(options.cwd, options.configFile),
12329
+ reload: false,
12330
+ label: REAL_CORE_LABEL,
12331
+ ...options.signal ? { signal: options.signal } : {}
12332
+ },
12333
+ real.compose,
12334
+ (line) => log.info(line)
12335
+ );
12336
+ if (status === 0) log.success("plugin verify: real_core green");
12337
+ return status;
12291
12338
  }
12292
12339
 
12293
12340
  // src/commands/plugin-verify.ts
12294
12341
  var pluginVerifyCommand = new Command22("verify").description(
12295
12342
  "Real-execution conformance harness for a plugin repo: raises a real Postgres, runs every implemented biffo_plugin_sdk.conformance check twice against it, and exits non-zero on the first failure (biffo-template#1523/#1924)."
12296
- ).option("--cwd <path>", "Plugin repo root to check (defaults to the current directory)").option("--list-checks", "Print every declared #1523 seam and its implemented state, then exit").action(async (options) => {
12297
- const cwd = options.cwd ? resolve20(options.cwd) : process.cwd();
12298
- const here = dirname12(fileURLToPath7(import.meta.url));
12299
- const exitCode = await runPluginVerify(
12300
- { cwd, listChecks: options.listChecks ?? false },
12301
- {
12302
- runner: new RealCommandRunner(),
12303
- findScript: (relativePath) => findPackagedScript(here, relativePath)
12304
- }
12305
- );
12306
- process.exit(exitCode);
12307
- });
12343
+ ).option("--cwd <path>", "Plugin repo root to check (defaults to the current directory)").option("--list-checks", "Print every declared #1523 seam and its implemented state, then exit").option("--core-root <path>", "A biffo-template checkout to run Core from (or BIFFO_CORE_ROOT)").option(
12344
+ "--config-file <path>",
12345
+ "Local plugin config JSON for the real_core composition (default: biffo.dev.json if present)"
12346
+ ).option(
12347
+ "--no-real-core",
12348
+ "SKIP the real_core seam (Core + plugin host composition) \u2014 loud, never silent"
12349
+ ).action(
12350
+ async (options) => {
12351
+ const cwd = options.cwd ? resolve20(options.cwd) : process.cwd();
12352
+ const here = dirname12(fileURLToPath7(import.meta.url));
12353
+ const runner = new RealCommandRunner();
12354
+ const findScript = (relativePath) => findPackagedScript(here, relativePath);
12355
+ const interrupt = installInterruptSignal();
12356
+ const exitCode = await runPluginVerify(
12357
+ {
12358
+ cwd,
12359
+ listChecks: options.listChecks ?? false,
12360
+ realCore: options.realCore,
12361
+ ...options.configFile ? { configFile: resolve20(options.configFile) } : {},
12362
+ signal: interrupt.signal
12363
+ },
12364
+ {
12365
+ runner,
12366
+ findScript,
12367
+ realCore: {
12368
+ coreRoot: () => resolveCoreRootForCli(options.coreRoot, runner),
12369
+ compose: realComposeDeps(runner, findScript, (l) => log.info(l))
12370
+ }
12371
+ }
12372
+ );
12373
+ interrupt.dispose();
12374
+ process.exit(exitCode);
12375
+ }
12376
+ );
12308
12377
 
12309
12378
  // src/commands/plugin.ts
12310
12379
  var pluginCommand = new Command23("plugin").description("Manage Biffo plugins");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.323.0",
3
+ "version": "0.324.0",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",