@biffo/cli 0.324.12 → 0.324.14

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 +192 -104
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,13 +8,14 @@ import { Command as Command4 } from "commander";
8
8
 
9
9
  // src/commands/core-diff.ts
10
10
  import { existsSync as existsSync3 } from "fs";
11
- import { join as join3, resolve } from "path";
11
+ import { join as join3, resolve as resolve2 } from "path";
12
12
  import chalk2 from "chalk";
13
13
  import { Command } from "commander";
14
14
 
15
15
  // src/lib/core-manifest.ts
16
16
  import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync } from "fs";
17
- import { dirname as dirname2, join as join2, relative, sep } from "path";
17
+ import { tmpdir } from "os";
18
+ import { dirname as dirname2, join as join2, relative, resolve, sep } from "path";
18
19
  import { fileURLToPath as fileURLToPath2 } from "url";
19
20
  import { z as z2 } from "zod";
20
21
 
@@ -280,9 +281,12 @@ var HARD_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
280
281
  // of a core upgrade — the tracked terraform is the .tf files, not .terraform/.
281
282
  ".terraform"
282
283
  ]);
284
+ var osScratchRoot = () => resolve(tmpdir());
283
285
  function findTemplateRoot(startDir) {
284
286
  let dir = startDir;
287
+ const scratch = osScratchRoot();
285
288
  for (; ; ) {
289
+ if (resolve(dir) === scratch) return null;
286
290
  if (existsSync2(join2(dir, CORE_MANIFEST_FILE)) && !existsSync2(join2(dir, INSTANCE_CORE_FILE))) {
287
291
  return dir;
288
292
  }
@@ -484,9 +488,9 @@ var coreDiffCommand = new Command("diff").description(
484
488
  "--template <path>",
485
489
  "Path to a biffo-template checkout to compare against (defaults to the template this CLI ships with)"
486
490
  ).option("--json", "Emit the classification as JSON on stdout instead of the human report").action(async (options) => {
487
- const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
491
+ const cwd = options.cwd ? resolve2(options.cwd) : process.cwd();
488
492
  const runOptions = { cwd };
489
- if (options.template) runOptions.templateRoot = resolve(options.template);
493
+ if (options.template) runOptions.templateRoot = resolve2(options.template);
490
494
  if (options.json) runOptions.json = true;
491
495
  try {
492
496
  await runCoreDiff(runOptions);
@@ -556,11 +560,11 @@ function printGroup(label, files, color) {
556
560
  }
557
561
 
558
562
  // src/commands/core-status.ts
559
- import { resolve as resolve2 } from "path";
563
+ import { resolve as resolve3 } from "path";
560
564
  import chalk3 from "chalk";
561
565
  import { Command as Command2 } from "commander";
562
566
  var coreStatusCommand = new Command2("status").description("Show this instance's Biffo core version and whether an upgrade is available").option("--cwd <path>", "Instance repo root to inspect (defaults to the current directory)").action(async (options) => {
563
- const cwd = options.cwd ? resolve2(options.cwd) : process.cwd();
567
+ const cwd = options.cwd ? resolve3(options.cwd) : process.cwd();
564
568
  try {
565
569
  await runCoreStatus({ cwd });
566
570
  } catch (err) {
@@ -604,7 +608,7 @@ async function runCoreStatus(options) {
604
608
  // src/commands/core-upgrade.ts
605
609
  import { execSync as execSync2 } from "child_process";
606
610
  import { existsSync as existsSync15, rmSync as rmSync5 } from "fs";
607
- import { join as join16, resolve as resolve3 } from "path";
611
+ import { join as join16, resolve as resolve4 } from "path";
608
612
  import chalk4 from "chalk";
609
613
 
610
614
  // src/lib/exec.ts
@@ -631,7 +635,7 @@ import { Command as Command3 } from "commander";
631
635
  import { randomUUID } from "crypto";
632
636
  import { existsSync as existsSync6, mkdtempSync as mkdtempSync2, rmSync as rmSync2 } from "fs";
633
637
  import { readFile as readFile2, rm } from "fs/promises";
634
- import { tmpdir as tmpdir2 } from "os";
638
+ import { tmpdir as tmpdir3 } from "os";
635
639
  import { join as join6 } from "path";
636
640
 
637
641
  // src/lib/core-upgrade.ts
@@ -646,7 +650,7 @@ import {
646
650
  statSync,
647
651
  writeFileSync as writeFileSync2
648
652
  } from "fs";
649
- import { tmpdir } from "os";
653
+ import { tmpdir as tmpdir2 } from "os";
650
654
  import { basename, dirname as dirname3, join as join5 } from "path";
651
655
  import { z as z4 } from "zod";
652
656
 
@@ -793,7 +797,7 @@ function checkCoreOwnership({
793
797
 
794
798
  // src/lib/core-upgrade.ts
795
799
  var gitMergeFile = async (base, ours, theirs) => {
796
- const dir = mkdtempSync(join5(tmpdir(), "biffo-merge-"));
800
+ const dir = mkdtempSync(join5(tmpdir2(), "biffo-merge-"));
797
801
  try {
798
802
  const b = join5(dir, "base");
799
803
  const o = join5(dir, "ours");
@@ -1154,7 +1158,7 @@ var GitAdapter = class {
1154
1158
  * it raw leaked the token into CLI output and CI logs (#1169).
1155
1159
  */
1156
1160
  async cloneToTemp(repoUrl, namePrefix, token) {
1157
- const dir = mkdtempSync2(join6(tmpdir2(), `${namePrefix}-${randomUUID().slice(0, 8)}-`));
1161
+ const dir = mkdtempSync2(join6(tmpdir3(), `${namePrefix}-${randomUUID().slice(0, 8)}-`));
1158
1162
  const cloneUrl = token ? injectToken(repoUrl, token) : repoUrl;
1159
1163
  try {
1160
1164
  await execa("git", ["clone", "--depth", "1", cloneUrl, dir]);
@@ -1177,7 +1181,7 @@ var GitAdapter = class {
1177
1181
  * method have no need for.
1178
1182
  */
1179
1183
  async cloneForEditing(repoUrl, namePrefix, token) {
1180
- const dir = mkdtempSync2(join6(tmpdir2(), `${namePrefix}-${randomUUID().slice(0, 8)}-`));
1184
+ const dir = mkdtempSync2(join6(tmpdir3(), `${namePrefix}-${randomUUID().slice(0, 8)}-`));
1181
1185
  const cloneUrl = token ? injectToken(repoUrl, token) : repoUrl;
1182
1186
  try {
1183
1187
  await execa("git", ["clone", cloneUrl, dir]);
@@ -1984,7 +1988,7 @@ var GitHubAdapter = class {
1984
1988
  } catch (err) {
1985
1989
  if (err.status !== 404) throw err;
1986
1990
  }
1987
- await new Promise((resolve24) => setTimeout(resolve24, intervalMs));
1991
+ await new Promise((resolve25) => setTimeout(resolve25, intervalMs));
1988
1992
  }
1989
1993
  throw new Error(
1990
1994
  `Branch "${branch}" not found in ${org}/${repo} after ${timeoutMs / 1e3}s \u2014 GitHub template generation may have stalled. Check the repository and re-run biffo init.`
@@ -1999,7 +2003,7 @@ var GitHubAdapter = class {
1999
2003
  } catch (err) {
2000
2004
  if (err.status !== 404) throw err;
2001
2005
  }
2002
- await new Promise((resolve24) => setTimeout(resolve24, intervalMs));
2006
+ await new Promise((resolve25) => setTimeout(resolve25, intervalMs));
2003
2007
  }
2004
2008
  throw new Error(
2005
2009
  `Ref "${ref}" not found in ${org}/${repo} after ${timeoutMs / 1e3}s \u2014 GitHub template generation may have stalled. Check the repository and re-run biffo init.`
@@ -2233,7 +2237,7 @@ var GitHubAdapter = class {
2233
2237
  }
2234
2238
  if (status !== 404 || Date.now() >= deadline) throw err;
2235
2239
  log.info("Branch protection endpoint not yet ready, retrying...");
2236
- await new Promise((resolve24) => setTimeout(resolve24, protectionIntervalMs));
2240
+ await new Promise((resolve25) => setTimeout(resolve25, protectionIntervalMs));
2237
2241
  }
2238
2242
  }
2239
2243
  }
@@ -2406,7 +2410,7 @@ var GitHubAdapter = class {
2406
2410
  }
2407
2411
  if (status !== 404 || Date.now() >= deadline) throw err;
2408
2412
  log.info("Branch protection endpoint not yet ready, retrying...");
2409
- await new Promise((resolve24) => setTimeout(resolve24, protectionIntervalMs));
2413
+ await new Promise((resolve25) => setTimeout(resolve25, protectionIntervalMs));
2410
2414
  }
2411
2415
  }
2412
2416
  } catch (err) {
@@ -2679,7 +2683,7 @@ var GitHubAdapter = class {
2679
2683
  } catch (err) {
2680
2684
  if (err.status !== 404 || Date.now() >= deadline) throw err;
2681
2685
  log.info(`Workflow ${workflowId} not yet indexed by GitHub Actions, retrying...`);
2682
- await new Promise((resolve24) => setTimeout(resolve24, intervalMs));
2686
+ await new Promise((resolve25) => setTimeout(resolve25, intervalMs));
2683
2687
  }
2684
2688
  }
2685
2689
  }
@@ -2698,7 +2702,7 @@ var GitHubAdapter = class {
2698
2702
  } catch (err) {
2699
2703
  if (err.status !== 404 || Date.now() >= deadline) throw err;
2700
2704
  log.info(`Workflow ${workflowId} not yet indexed by GitHub Actions, retrying...`);
2701
- await new Promise((resolve24) => setTimeout(resolve24, intervalMs));
2705
+ await new Promise((resolve25) => setTimeout(resolve25, intervalMs));
2702
2706
  }
2703
2707
  }
2704
2708
  }
@@ -2722,7 +2726,7 @@ var GitHubAdapter = class {
2722
2726
  } else {
2723
2727
  log.info(" Waiting for run to be queued...");
2724
2728
  }
2725
- await new Promise((resolve24) => setTimeout(resolve24, intervalMs));
2729
+ await new Promise((resolve25) => setTimeout(resolve25, intervalMs));
2726
2730
  }
2727
2731
  throw new Error(
2728
2732
  `Workflow ${workflowId} did not complete within ${timeoutMs / 1e3 / 60} minutes`
@@ -3254,7 +3258,7 @@ function applyMigrationCarry(instanceDir, plan) {
3254
3258
  // src/lib/core-template-trees.ts
3255
3259
  import { execFileSync as execFileSync3 } from "child_process";
3256
3260
  import { mkdtempSync as mkdtempSync3, rmSync as rmSync3 } from "fs";
3257
- import { tmpdir as tmpdir3 } from "os";
3261
+ import { tmpdir as tmpdir4 } from "os";
3258
3262
  import { join as join8 } from "path";
3259
3263
  function coreTag(version) {
3260
3264
  parseCoreVersion(version);
@@ -3294,7 +3298,7 @@ function materializeTemplateAtTag(repo, version, git = defaultGit2) {
3294
3298
  `No git tag ${tag} in ${repo}. The template tree at core version ${version} is unavailable, so it can't be used as a merge base. Ensure the tag exists (it is pushed by the Core Version Tag workflow on release), or pass an explicit --from-template / --to-template checkout.`
3295
3299
  );
3296
3300
  }
3297
- const dir = mkdtempSync3(join8(tmpdir3(), `biffo-core-${version}-`));
3301
+ const dir = mkdtempSync3(join8(tmpdir4(), `biffo-core-${version}-`));
3298
3302
  const tarball = join8(dir, ".tree.tar");
3299
3303
  try {
3300
3304
  git(["-C", repo, "archive", "--format=tar", "-o", tarball, tag]);
@@ -3982,7 +3986,7 @@ function describeInstallFailures(outcomes) {
3982
3986
  // src/commands/core-upgrade.ts
3983
3987
  var MISSING_TEMPLATE_ROOT_GUIDANCE2 = "Pass --template-repo <path> to a biffo-template git checkout, e.g. `biffo core upgrade --template-repo /path/to/biffo-template`.";
3984
3988
  function resolveTemplateRepoFlag(templateRepo, template) {
3985
- if (templateRepo !== void 0 && template !== void 0 && resolve3(templateRepo) !== resolve3(template)) {
3989
+ if (templateRepo !== void 0 && template !== void 0 && resolve4(templateRepo) !== resolve4(template)) {
3986
3990
  throw new Error(
3987
3991
  `Both --template-repo (${templateRepo}) and --template (${template}) were given, with different paths. They are the same argument \u2014 --template is an alias for --template-repo (#1138) \u2014 so pass only one.`
3988
3992
  );
@@ -4013,7 +4017,7 @@ var coreUpgradeCommand = new Command3("upgrade").description("Three-way-merge te
4013
4017
  ).action(
4014
4018
  async (options) => {
4015
4019
  try {
4016
- const cwd = options.cwd ? resolve3(options.cwd) : process.cwd();
4020
+ const cwd = options.cwd ? resolve4(options.cwd) : process.cwd();
4017
4021
  const runOptions = {
4018
4022
  cwd,
4019
4023
  apply: options.apply ?? false,
@@ -4022,10 +4026,10 @@ var coreUpgradeCommand = new Command3("upgrade").description("Three-way-merge te
4022
4026
  allowDirty: options.allowDirty ?? false
4023
4027
  };
4024
4028
  const templateRepoFlag = resolveTemplateRepoFlag(options.templateRepo, options.template);
4025
- if (templateRepoFlag) runOptions.templateRepo = resolve3(templateRepoFlag);
4029
+ if (templateRepoFlag) runOptions.templateRepo = resolve4(templateRepoFlag);
4026
4030
  if (options.to) runOptions.toVersion = options.to;
4027
- if (options.fromTemplate) runOptions.baseDir = resolve3(options.fromTemplate);
4028
- if (options.toTemplate) runOptions.theirsDir = resolve3(options.toTemplate);
4031
+ if (options.fromTemplate) runOptions.baseDir = resolve4(options.fromTemplate);
4032
+ if (options.toTemplate) runOptions.theirsDir = resolve4(options.toTemplate);
4029
4033
  if (options.base) runOptions.base = options.base;
4030
4034
  if (options.remote) runOptions.remote = options.remote;
4031
4035
  if (options.reap) runOptions.reap = true;
@@ -4127,7 +4131,7 @@ async function runCoreUpgradeResolved(options, deps, cleanups) {
4127
4131
  await checkInstanceCurrency(deps.git, options.cwd, options.allowDirty ?? false);
4128
4132
  const materialize = deps.materialize ?? materializeTemplateAtTag;
4129
4133
  const treeMatchesTag = deps.workingTreeMatchesTag ?? workingTreeMatchesTag;
4130
- const templateRepo = options.templateRepo ? resolve3(options.templateRepo) : resolveTemplateRoot({ guidance: MISSING_TEMPLATE_ROOT_GUIDANCE2 });
4134
+ const templateRepo = options.templateRepo ? resolve4(options.templateRepo) : resolveTemplateRoot({ guidance: MISSING_TEMPLATE_ROOT_GUIDANCE2 });
4131
4135
  const instanceVersion = readInstanceCoreVersion(options.cwd);
4132
4136
  let theirsDir;
4133
4137
  let toVersion;
@@ -4951,7 +4955,7 @@ import { Command as Command8 } from "commander";
4951
4955
 
4952
4956
  // src/commands/data-apply.ts
4953
4957
  import { existsSync as existsSync17, readFileSync as readFileSync12 } from "fs";
4954
- import { resolve as resolve4 } from "path";
4958
+ import { resolve as resolve5 } from "path";
4955
4959
  import chalk5 from "chalk";
4956
4960
  import { Command as Command5 } from "commander";
4957
4961
  import inquirer from "inquirer";
@@ -5081,7 +5085,7 @@ var AwsAdapter = class {
5081
5085
  const code = err.Code;
5082
5086
  if (code === "OperationAborted" && attempt < maxAttempts) {
5083
5087
  log.info(` Waiting for S3 to release "${bucketName}"... (${attempt}/${maxAttempts})`);
5084
- await new Promise((resolve24) => setTimeout(resolve24, retryDelayMs));
5088
+ await new Promise((resolve25) => setTimeout(resolve25, retryDelayMs));
5085
5089
  } else if (code === "OperationAborted") {
5086
5090
  return false;
5087
5091
  } else {
@@ -5581,7 +5585,7 @@ async function runDataApply(name, environment, config, aws) {
5581
5585
  }
5582
5586
  async function resolveConfig(options) {
5583
5587
  if (options.config) {
5584
- const raw = JSON.parse(readFileSync12(resolve4(options.config), "utf8"));
5588
+ const raw = JSON.parse(readFileSync12(resolve5(options.config), "utf8"));
5585
5589
  const result = BiffoConfigSchema.safeParse(raw);
5586
5590
  if (!result.success) {
5587
5591
  log.error(`Invalid config at ${options.config}:`);
@@ -5600,7 +5604,7 @@ async function resolveConfig(options) {
5600
5604
  }
5601
5605
  return cfg;
5602
5606
  }
5603
- const localConfigPath = resolve4(process.cwd(), "biffo.config.json");
5607
+ const localConfigPath = resolve5(process.cwd(), "biffo.config.json");
5604
5608
  if (existsSync17(localConfigPath)) {
5605
5609
  const raw = JSON.parse(readFileSync12(localConfigPath, "utf8"));
5606
5610
  const result = BiffoConfigSchema.safeParse(raw);
@@ -5649,7 +5653,7 @@ async function resolveConfig(options) {
5649
5653
  // src/commands/data-import.ts
5650
5654
  import { execSync as execSync3 } from "child_process";
5651
5655
  import { cpSync, existsSync as existsSync18, mkdirSync as mkdirSync5, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
5652
- import { join as join18, resolve as resolve5 } from "path";
5656
+ import { join as join18, resolve as resolve6 } from "path";
5653
5657
  import chalk6 from "chalk";
5654
5658
  import { Command as Command6 } from "commander";
5655
5659
  import inquirer2 from "inquirer";
@@ -5664,7 +5668,7 @@ var dataImportCommand = new Command6("import").description(
5664
5668
  "Subdirectory containing .sql files \u2014 within the local directory or the cloned repo"
5665
5669
  ).option("--token <pat>", "GitHub Personal Access Token, for a private repo --source").option("--dry-run", "Resolve the source and print planned changes without modifying the repo").option("--cwd <path>", "Project root to import into (defaults to the current directory)").action(
5666
5670
  async (name, options) => {
5667
- const cwd = options.cwd ? resolve5(options.cwd) : process.cwd();
5671
+ const cwd = options.cwd ? resolve6(options.cwd) : process.cwd();
5668
5672
  try {
5669
5673
  await runDataImport(
5670
5674
  name,
@@ -5794,11 +5798,11 @@ function printDryRun(name, sqlFiles) {
5794
5798
 
5795
5799
  // src/commands/data-list.ts
5796
5800
  import { existsSync as existsSync19, readdirSync as readdirSync6 } from "fs";
5797
- import { join as join19, resolve as resolve6 } from "path";
5801
+ import { join as join19, resolve as resolve7 } from "path";
5798
5802
  import chalk7 from "chalk";
5799
5803
  import { Command as Command7 } from "commander";
5800
5804
  var dataListCommand = new Command7("list").description("List DDL imports vendored in this project checkout").option("--cwd <path>", "Project root to scan (defaults to the current directory)").action(async (options) => {
5801
- const cwd = options.cwd ? resolve6(options.cwd) : process.cwd();
5805
+ const cwd = options.cwd ? resolve7(options.cwd) : process.cwd();
5802
5806
  try {
5803
5807
  await runDataList({ cwd });
5804
5808
  } catch (err) {
@@ -5846,7 +5850,7 @@ dataCommand.addCommand(dataListCommand);
5846
5850
  // src/commands/deploy.ts
5847
5851
  import { execSync as execSync4 } from "child_process";
5848
5852
  import { existsSync as existsSync20, readFileSync as readFileSync13 } from "fs";
5849
- import { resolve as resolve7 } from "path";
5853
+ import { resolve as resolve8 } from "path";
5850
5854
  import chalk8 from "chalk";
5851
5855
  import { Command as Command9 } from "commander";
5852
5856
 
@@ -6202,7 +6206,7 @@ var deployCommand = new Command9("deploy").description("Deploy infrastructure an
6202
6206
  );
6203
6207
  async function resolveConfig2(options) {
6204
6208
  if (options.config) {
6205
- const raw = JSON.parse(readFileSync13(resolve7(options.config), "utf8"));
6209
+ const raw = JSON.parse(readFileSync13(resolve8(options.config), "utf8"));
6206
6210
  const result = BiffoConfigSchema.safeParse(raw);
6207
6211
  if (!result.success) {
6208
6212
  log.error(`Invalid config at ${options.config}:`);
@@ -6221,7 +6225,7 @@ async function resolveConfig2(options) {
6221
6225
  }
6222
6226
  return cfg;
6223
6227
  }
6224
- const localConfigPath = resolve7(process.cwd(), "biffo.config.json");
6228
+ const localConfigPath = resolve8(process.cwd(), "biffo.config.json");
6225
6229
  if (existsSync20(localConfigPath)) {
6226
6230
  const raw = JSON.parse(readFileSync13(localConfigPath, "utf8"));
6227
6231
  const result = BiffoConfigSchema.safeParse(raw);
@@ -6618,7 +6622,7 @@ function resolveGithubToken() {
6618
6622
  }
6619
6623
 
6620
6624
  // src/commands/dev.ts
6621
- import { dirname as dirname6, resolve as resolve9 } from "path";
6625
+ import { dirname as dirname6, resolve as resolve10 } from "path";
6622
6626
  import { fileURLToPath as fileURLToPath3 } from "url";
6623
6627
  import { Command as Command10 } from "commander";
6624
6628
 
@@ -7138,15 +7142,15 @@ async function startLocalAwsSink(parameters = /* @__PURE__ */ new Map()) {
7138
7142
  }
7139
7143
  });
7140
7144
  });
7141
- await new Promise((resolve24) => server.listen(0, "127.0.0.1", resolve24));
7145
+ await new Promise((resolve25) => server.listen(0, "127.0.0.1", resolve25));
7142
7146
  const { port } = server.address();
7143
7147
  return {
7144
7148
  url: `http://127.0.0.1:${port}`,
7145
7149
  events,
7146
7150
  unexpected,
7147
7151
  parameters,
7148
- close: () => new Promise((resolve24) => {
7149
- server.close(() => resolve24());
7152
+ close: () => new Promise((resolve25) => {
7153
+ server.close(() => resolve25());
7150
7154
  server.closeAllConnections();
7151
7155
  })
7152
7156
  };
@@ -7516,14 +7520,14 @@ function spawnManaged(name, cmd, args, opts, sink = (l) => process.stdout.write(
7516
7520
  pipe(child.stdout);
7517
7521
  pipe(child.stderr);
7518
7522
  let done = false;
7519
- const exited = new Promise((resolve24) => {
7523
+ const exited = new Promise((resolve25) => {
7520
7524
  child.on("exit", (code) => {
7521
7525
  done = true;
7522
- resolve24(code);
7526
+ resolve25(code);
7523
7527
  });
7524
7528
  child.on("error", () => {
7525
7529
  done = true;
7526
- resolve24(null);
7530
+ resolve25(null);
7527
7531
  });
7528
7532
  });
7529
7533
  return {
@@ -7549,13 +7553,13 @@ function spawnManaged(name, cmd, args, opts, sink = (l) => process.stdout.write(
7549
7553
  };
7550
7554
  }
7551
7555
  function realFreePort() {
7552
- return new Promise((resolve24, reject) => {
7556
+ return new Promise((resolve25, reject) => {
7553
7557
  const srv = createServer2();
7554
7558
  srv.once("error", reject);
7555
7559
  srv.listen(0, "127.0.0.1", () => {
7556
7560
  const address = srv.address();
7557
7561
  const port = typeof address === "object" && address ? address.port : 0;
7558
- srv.close(() => resolve24(port));
7562
+ srv.close(() => resolve25(port));
7559
7563
  });
7560
7564
  });
7561
7565
  }
@@ -7583,7 +7587,7 @@ function realComposeDeps(runner, findScript, log2) {
7583
7587
  // src/lib/plugin-compose/core-source.ts
7584
7588
  import { existsSync as existsSync23 } from "fs";
7585
7589
  import { homedir as homedir3 } from "os";
7586
- import { join as join22, resolve as resolve8 } from "path";
7590
+ import { join as join22, resolve as resolve9 } from "path";
7587
7591
  var CORE_MARKER = join22("services", "api", "src", "api", "main.py");
7588
7592
  var CORE_REPO_URL = "https://github.com/keiranholloway/biffo-template.git";
7589
7593
  function isCoreRoot(dir) {
@@ -7592,7 +7596,7 @@ function isCoreRoot(dir) {
7592
7596
  function resolveCoreRoot(input) {
7593
7597
  const supplied = input.explicit ?? input.env.BIFFO_CORE_ROOT;
7594
7598
  if (supplied) {
7595
- const root = resolve8(supplied);
7599
+ const root = resolve9(supplied);
7596
7600
  if (!isCoreRoot(root)) {
7597
7601
  throw new Error(
7598
7602
  `Core root ${root} is not a biffo-template checkout (no ${CORE_MARKER}) \u2014 point --core-root / BIFFO_CORE_ROOT at a checkout of biffo-template.`
@@ -7838,7 +7842,7 @@ var devUpCommand = new Command10("up").description(
7838
7842
  'Local plugin config JSON { "<name>": "<value>" } (default: biffo.dev.json if present)'
7839
7843
  ).option("--no-reload", "Do not hot-reload the plugin host on source changes").option("--check", "Compose, run the route probes (incl. the known-bad control), tear down, exit").action(
7840
7844
  async (options) => {
7841
- const pluginRoot = options.cwd ? resolve9(options.cwd) : process.cwd();
7845
+ const pluginRoot = options.cwd ? resolve10(options.cwd) : process.cwd();
7842
7846
  const here = dirname6(fileURLToPath3(import.meta.url));
7843
7847
  const runner = new RealCommandRunner();
7844
7848
  let coreRoot;
@@ -7860,7 +7864,7 @@ var devUpCommand = new Command10("up").description(
7860
7864
  coreRoot,
7861
7865
  configFile: pickConfigFile(
7862
7866
  pluginRoot,
7863
- options.configFile ? resolve9(options.configFile) : void 0
7867
+ options.configFile ? resolve10(options.configFile) : void 0
7864
7868
  ),
7865
7869
  reload: options.reload,
7866
7870
  check: options.check ?? false,
@@ -7885,7 +7889,7 @@ devCommand.addCommand(devUpCommand);
7885
7889
  // src/commands/destroy.ts
7886
7890
  import { execSync as execSync5 } from "child_process";
7887
7891
  import { readFileSync as readFileSync16 } from "fs";
7888
- import { resolve as resolve10 } from "path";
7892
+ import { resolve as resolve11 } from "path";
7889
7893
  import chalk9 from "chalk";
7890
7894
  import { Command as Command11 } from "commander";
7891
7895
  var destroyCommand = new Command11("destroy").description("Destroy infrastructure for an environment \u2014 run before biffo teardown").argument("<environment>", "Target environment: dev | staging | prod").option("-p, --project <name>", "Project name").option("-c, --config <path>", "Path to biffo.config.json").action(async (environment, options) => {
@@ -7974,7 +7978,7 @@ var destroyCommand = new Command11("destroy").description("Destroy infrastructur
7974
7978
  });
7975
7979
  async function resolveConfig3(options) {
7976
7980
  if (options.config) {
7977
- const raw = JSON.parse(readFileSync16(resolve10(options.config), "utf8"));
7981
+ const raw = JSON.parse(readFileSync16(resolve11(options.config), "utf8"));
7978
7982
  const result = BiffoConfigSchema.safeParse(raw);
7979
7983
  if (!result.success) {
7980
7984
  log.error(`Invalid config at ${options.config}:`);
@@ -7994,7 +7998,7 @@ async function resolveConfig3(options) {
7994
7998
  return cfg;
7995
7999
  }
7996
8000
  try {
7997
- const raw = JSON.parse(readFileSync16(resolve10(process.cwd(), "biffo.config.json"), "utf8"));
8001
+ const raw = JSON.parse(readFileSync16(resolve11(process.cwd(), "biffo.config.json"), "utf8"));
7998
8002
  const result = BiffoConfigSchema.safeParse(raw);
7999
8003
  if (result.success) return result.data;
8000
8004
  } catch {
@@ -8045,7 +8049,7 @@ function resolveGithubToken2() {
8045
8049
 
8046
8050
  // src/commands/init.ts
8047
8051
  import { readFileSync as readFileSync20 } from "fs";
8048
- import { resolve as resolve12 } from "path";
8052
+ import { resolve as resolve13 } from "path";
8049
8053
  import chalk12 from "chalk";
8050
8054
  import { Command as Command13 } from "commander";
8051
8055
  import inquirer5 from "inquirer";
@@ -8489,8 +8493,8 @@ function deleteSiblingSession(projectName) {
8489
8493
 
8490
8494
  // src/commands/sibling-create.ts
8491
8495
  import { cpSync as cpSync2, existsSync as existsSync28, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync5, readFileSync as readFileSync19, writeFileSync as writeFileSync8 } from "fs";
8492
- import { tmpdir as tmpdir4 } from "os";
8493
- import { dirname as dirname8, join as join28, resolve as resolve11 } from "path";
8496
+ import { tmpdir as tmpdir5 } from "os";
8497
+ import { dirname as dirname8, join as join28, resolve as resolve12 } from "path";
8494
8498
  import { fileURLToPath as fileURLToPath5 } from "url";
8495
8499
  import chalk11 from "chalk";
8496
8500
  import { Command as Command12 } from "commander";
@@ -8526,8 +8530,8 @@ var siblingCreateCommand = new Command12("create").description(
8526
8530
  try {
8527
8531
  assertBuildIsFresh();
8528
8532
  await runSiblingCreateCommand(name, {
8529
- configPath: resolve11(options.config),
8530
- templateRoot: options.template ? resolve11(options.template) : defaultSiblingTemplateRoot(),
8533
+ configPath: resolve12(options.config),
8534
+ templateRoot: options.template ? resolve12(options.template) : defaultSiblingTemplateRoot(),
8531
8535
  root: options.root === true,
8532
8536
  dryRun: options.dryRun === true,
8533
8537
  fresh: options.fresh === true
@@ -8794,7 +8798,7 @@ function readSiblingConfig(path, root = false) {
8794
8798
  }
8795
8799
  function resolveCoreConfig(config, configPath) {
8796
8800
  if (config.core.config_path) {
8797
- const corePath = resolve11(dirname8(configPath), config.core.config_path);
8801
+ const corePath = resolve12(dirname8(configPath), config.core.config_path);
8798
8802
  return parseCoreConfig(corePath);
8799
8803
  }
8800
8804
  if (config.core.project_name) {
@@ -8846,7 +8850,7 @@ async function resolveCoreIdentity(coreAws, coreConfig, environments) {
8846
8850
  return coreIdentity;
8847
8851
  }
8848
8852
  async function pushSkeleton(git, skeletonRoot, cloneUrl, config, coreConfig, githubToken, relockFrontendDeps) {
8849
- const workDir = mkdtempSync5(join28(tmpdir4(), `biffo-sibling-${config.project.name}-`));
8853
+ const workDir = mkdtempSync5(join28(tmpdir5(), `biffo-sibling-${config.project.name}-`));
8850
8854
  try {
8851
8855
  writeSiblingTemplate(skeletonRoot, workDir, config, {
8852
8856
  coreProjectName: coreConfig.project.name,
@@ -9170,7 +9174,7 @@ var initCommand = new Command13("init").description("Scaffold a new project from
9170
9174
  let config;
9171
9175
  let githubToken;
9172
9176
  if (options.config) {
9173
- const rawConfig = JSON.parse(readFileSync20(resolve12(options.config), "utf8"));
9177
+ const rawConfig = JSON.parse(readFileSync20(resolve13(options.config), "utf8"));
9174
9178
  config = parseConfig(rawConfig);
9175
9179
  const { account_id: accountId, region } = config.cloud.config;
9176
9180
  session = resolveConfigFileSession(config, accountId, region, options.fresh === true);
@@ -9616,7 +9620,7 @@ import { Command as Command23 } from "commander";
9616
9620
 
9617
9621
  // src/commands/plugin-create.ts
9618
9622
  import { existsSync as existsSync33, readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
9619
- import { dirname as dirname10, join as join34, resolve as resolve13 } from "path";
9623
+ import { dirname as dirname10, join as join34, resolve as resolve14 } from "path";
9620
9624
  import { fileURLToPath as fileURLToPath6 } from "url";
9621
9625
  import chalk13 from "chalk";
9622
9626
  import { Command as Command14 } from "commander";
@@ -9787,6 +9791,30 @@ function findInstalledPlugins(cwd) {
9787
9791
  ].sort((a, b) => a.relDir.localeCompare(b.relDir));
9788
9792
  }
9789
9793
 
9794
+ // src/lib/plugin-import-sort.ts
9795
+ async function sortScaffoldedImports(destDir, pythonFiles) {
9796
+ if (pythonFiles.length === 0) return;
9797
+ const manual = `Run \`uvx ruff check --select I --fix ${destDir}\` before committing.`;
9798
+ try {
9799
+ await execa(
9800
+ "uvx",
9801
+ ["ruff", "check", "--select", "I", "--fix", "--no-cache", "--quiet", ...pythonFiles],
9802
+ {
9803
+ cwd: destDir
9804
+ }
9805
+ );
9806
+ } catch (err) {
9807
+ const cause = err;
9808
+ if (cause.code === "ENOENT") {
9809
+ log.warn(`\`uv\` is not on PATH, so the scaffold's imports were not re-sorted. ${manual}`);
9810
+ return;
9811
+ }
9812
+ throw new Error(
9813
+ `Failed to sort the scaffold's imports (ruff isort pass): ${cause.stderr?.trim() || err.message}. ${manual}`
9814
+ );
9815
+ }
9816
+ }
9817
+
9790
9818
  // src/lib/plugin-workspace-sources.ts
9791
9819
  import { existsSync as existsSync31, readdirSync as readdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
9792
9820
  import { join as join32 } from "path";
@@ -10144,7 +10172,7 @@ var pluginCreateCommand = new Command14("create").description("Scaffold a new pl
10144
10172
  "Path to the plugin skeleton (defaults to _skeletons/plugin-template)"
10145
10173
  ).option("--dry-run", "Print planned changes without modifying the repo").option("--no-commit", "Scaffold the files but leave them uncommitted").option("--cwd <path>", "Project root to scaffold into (defaults to the current directory)").action(
10146
10174
  async (name, options) => {
10147
- const cwd = options.cwd ? resolve13(options.cwd) : process.cwd();
10175
+ const cwd = options.cwd ? resolve14(options.cwd) : process.cwd();
10148
10176
  try {
10149
10177
  try {
10150
10178
  await runPluginCreate(
@@ -10155,7 +10183,7 @@ var pluginCreateCommand = new Command14("create").description("Scaffold a new pl
10155
10183
  ...options.org ? { org: options.org } : {},
10156
10184
  ...options.runnerLabel ? { runnerLabel: options.runnerLabel } : {},
10157
10185
  register: options.register !== false,
10158
- ...options.skeleton ? { skeletonRoot: resolve13(options.skeleton) } : {},
10186
+ ...options.skeleton ? { skeletonRoot: resolve14(options.skeleton) } : {},
10159
10187
  dryRun: options.dryRun ?? false,
10160
10188
  commit: options.commit !== false,
10161
10189
  cwd
@@ -10219,6 +10247,10 @@ async function runPluginCreate(name, options, deps) {
10219
10247
  const { files, skipped } = scaffoldPlugin(skeletonRoot, destDir, names);
10220
10248
  restorePackagedDotfiles(destDir);
10221
10249
  log.success(`Scaffolded ${files.length} file(s) into ${relDir}/`);
10250
+ await sortScaffoldedImports(
10251
+ destDir,
10252
+ files.filter((f) => f.endsWith(".py")).map((f) => join34(destDir, f))
10253
+ );
10222
10254
  for (const { entry, reason } of skipped) {
10223
10255
  log.info(`Skipped ${entry} \u2014 ${reason}`);
10224
10256
  }
@@ -10264,6 +10296,10 @@ async function runStandaloneCreate(names, options, deps) {
10264
10296
  const { files } = scaffoldPlugin(skeletonRoot, destDir, names, { layout: "standalone" });
10265
10297
  restorePackagedDotfiles(destDir);
10266
10298
  log.success(`Scaffolded ${String(files.length)} file(s) into ${names.dist}/`);
10299
+ await sortScaffoldedImports(
10300
+ destDir,
10301
+ files.filter((f) => f.endsWith(".py")).map((f) => join34(destDir, f))
10302
+ );
10267
10303
  const manifest = validateManifest(
10268
10304
  JSON.parse(readFileSync23(join34(destDir, "biffo.plugin.json"), "utf8"))
10269
10305
  );
@@ -10687,7 +10723,7 @@ function printScopeSeamEntitlement(name) {
10687
10723
 
10688
10724
  // src/commands/plugin-install.ts
10689
10725
  import { cpSync as cpSync5, existsSync as existsSync37, mkdirSync as mkdirSync12, readFileSync as readFileSync26, statSync as statSync8, writeFileSync as writeFileSync14 } from "fs";
10690
- import { join as join39, relative as relative4, resolve as resolve14 } from "path";
10726
+ import { join as join39, relative as relative4, resolve as resolve15 } from "path";
10691
10727
  import chalk15 from "chalk";
10692
10728
  import { Command as Command16 } from "commander";
10693
10729
 
@@ -10996,15 +11032,15 @@ var pluginInstallCommand = new Command16("install").description(
10996
11032
  []
10997
11033
  ).action(
10998
11034
  async (target, options) => {
10999
- const cwd = options.cwd ? resolve14(options.cwd) : process.cwd();
11035
+ const cwd = options.cwd ? resolve15(options.cwd) : process.cwd();
11000
11036
  try {
11001
11037
  await runPluginInstall(
11002
11038
  target,
11003
11039
  {
11004
- ...options.local ? { local: resolve14(options.local) } : {},
11040
+ ...options.local ? { local: resolve15(options.local) } : {},
11005
11041
  dryRun: options.dryRun ?? false,
11006
11042
  cwd,
11007
- ...options.frontendCwd ? { frontendCwd: resolve14(options.frontendCwd) } : {},
11043
+ ...options.frontendCwd ? { frontendCwd: resolve15(options.frontendCwd) } : {},
11008
11044
  config: parseConfigOptionValues(options.config)
11009
11045
  },
11010
11046
  {
@@ -11104,7 +11140,7 @@ async function runPluginInstall(target, options, deps) {
11104
11140
  const targetDir = join39(options.cwd, relTargetDir);
11105
11141
  const modulesDir = join39(options.cwd, "modules", "plugins", pluginName);
11106
11142
  const registryCwd = options.frontendCwd ?? options.cwd;
11107
- const inTreeSource = options.local !== void 0 && resolve14(options.local) === resolve14(targetDir);
11143
+ const inTreeSource = options.local !== void 0 && resolve15(options.local) === resolve15(targetDir);
11108
11144
  if (existsSync37(targetDir) && !inTreeSource) {
11109
11145
  throw new Error(
11110
11146
  `Plugin '${pluginName}' is already installed at ${relTargetDir}/. Remove it first, or wait for a future 'biffo plugin upgrade' command.`
@@ -11433,11 +11469,11 @@ function printDryRun4(entry, source, relTargetDir, inTreeSource, suppliedConfig
11433
11469
 
11434
11470
  // src/commands/plugin-list.ts
11435
11471
  import { existsSync as existsSync38, readFileSync as readFileSync27 } from "fs";
11436
- import { join as join40, resolve as resolve15 } from "path";
11472
+ import { join as join40, resolve as resolve16 } from "path";
11437
11473
  import chalk16 from "chalk";
11438
11474
  import { Command as Command17 } from "commander";
11439
11475
  var pluginListCommand = new Command17("list").description("List plugins installed in this project checkout").option("--cwd <path>", "Project root to scan (defaults to the current directory)").action(async (options) => {
11440
- const cwd = options.cwd ? resolve15(options.cwd) : process.cwd();
11476
+ const cwd = options.cwd ? resolve16(options.cwd) : process.cwd();
11441
11477
  try {
11442
11478
  await runPluginList({ cwd });
11443
11479
  } catch (err) {
@@ -11492,7 +11528,7 @@ async function runPluginList(options) {
11492
11528
  }
11493
11529
 
11494
11530
  // src/commands/plugin-staleness.ts
11495
- import { resolve as resolve16 } from "path";
11531
+ import { resolve as resolve17 } from "path";
11496
11532
  import { Command as Command18 } from "commander";
11497
11533
 
11498
11534
  // src/lib/plugin-staleness.ts
@@ -11769,7 +11805,7 @@ function labelFor(status) {
11769
11805
  var pluginStalenessCommand = new Command18("staleness").description(
11770
11806
  "Report how far each services/<name>/ vendored plugin has drifted from its source (#1547). Exits 0 up to date, 1 behind, 2 cannot tell \u2014 2 is never a pass."
11771
11807
  ).option("--cwd <path>", "Project root to check (defaults to the current directory)").action(async (options) => {
11772
- const cwd = options.cwd ? resolve16(options.cwd) : process.cwd();
11808
+ const cwd = options.cwd ? resolve17(options.cwd) : process.cwd();
11773
11809
  const results = await checkPluginStaleness(cwd, {
11774
11810
  registry: new RegistryAdapter(),
11775
11811
  git: new GitAdapter()
@@ -11780,14 +11816,14 @@ var pluginStalenessCommand = new Command18("staleness").description(
11780
11816
 
11781
11817
  // src/commands/plugin-sync-migrations.ts
11782
11818
  import { existsSync as existsSync40 } from "fs";
11783
- import { join as join42, relative as relative6, resolve as resolve17 } from "path";
11819
+ import { join as join42, relative as relative6, resolve as resolve18 } from "path";
11784
11820
  import chalk17 from "chalk";
11785
11821
  import { Command as Command19 } from "commander";
11786
11822
  var pluginSyncMigrationsCommand = new Command19("sync-migrations").description(
11787
11823
  "Generate real, committed migration file(s) for installed-but-not-yet-migrated plugin(s): biffo plugin sync-migrations [name]"
11788
11824
  ).argument("[name]", "Restrict to this installed plugin (default: every plugin under services/)").option("--dry-run", "Generate nothing; just report what would be generated").option("--no-commit", "Generate and stage the file(s) but do not commit").option("--cwd <path>", "Project root (defaults to the current directory)").action(
11789
11825
  async (name, options) => {
11790
- const cwd = options.cwd ? resolve17(options.cwd) : process.cwd();
11826
+ const cwd = options.cwd ? resolve18(options.cwd) : process.cwd();
11791
11827
  try {
11792
11828
  await runPluginSyncMigrations(
11793
11829
  name,
@@ -11841,7 +11877,7 @@ async function runPluginSyncMigrations(name, options, deps) {
11841
11877
 
11842
11878
  // src/commands/plugin-uninstall.ts
11843
11879
  import { existsSync as existsSync41, readFileSync as readFileSync29, rmSync as rmSync10 } from "fs";
11844
- import { join as join43, resolve as resolve18 } from "path";
11880
+ import { join as join43, resolve as resolve19 } from "path";
11845
11881
  import chalk18 from "chalk";
11846
11882
  import { Command as Command20 } from "commander";
11847
11883
  import inquirer6 from "inquirer";
@@ -11849,9 +11885,12 @@ var NAME_PATTERN2 = /^[a-z][a-z0-9-]*$/;
11849
11885
  var pluginUninstallCommand = new Command20("uninstall").description("Remove an installed plugin: biffo plugin uninstall <name>").argument("<name>", "Plugin name").option("--dry-run", "Print planned changes without modifying the repo").option("--force", "Skip the confirmation prompt").option(
11850
11886
  "--keep-data",
11851
11887
  "No-op today (see notes) \u2014 the CLI never drops plugin data regardless of this flag"
11852
- ).option("--cwd <path>", "Project root to uninstall from (defaults to the current directory)").action(
11888
+ ).option("--cwd <path>", "Project root to uninstall from (defaults to the current directory)").option(
11889
+ "--frontend-cwd <path>",
11890
+ "Dashboard sibling checkout to remove the user_frontend dashboard-registry entry from, when the core project and its dashboard are split siblings (biffo-template#2110, the mirror of `biffo plugin install --frontend-cwd`). Every other removal (services/<name>/, Terraform wiring) still resolves against --cwd only, and the dashboard entry is removed and committed in that checkout only AFTER the --cwd removal has committed. Omit it for the common single-repo topology. Ignored for a plugin with no user_frontend block."
11891
+ ).action(
11853
11892
  async (name, options) => {
11854
- const cwd = options.cwd ? resolve18(options.cwd) : process.cwd();
11893
+ const cwd = options.cwd ? resolve19(options.cwd) : process.cwd();
11855
11894
  try {
11856
11895
  await runPluginUninstall(
11857
11896
  name,
@@ -11859,7 +11898,8 @@ var pluginUninstallCommand = new Command20("uninstall").description("Remove an i
11859
11898
  dryRun: options.dryRun ?? false,
11860
11899
  force: options.force ?? false,
11861
11900
  keepData: options.keepData ?? false,
11862
- cwd
11901
+ cwd,
11902
+ ...options.frontendCwd ? { frontendCwd: resolve19(options.frontendCwd) } : {}
11863
11903
  },
11864
11904
  { git: new GitAdapter() }
11865
11905
  );
@@ -11897,11 +11937,19 @@ async function runPluginUninstall(name, options, deps) {
11897
11937
  stagePaths.push(`modules/plugins/${name}`);
11898
11938
  }
11899
11939
  const hasUserFrontend = installedManifest?.user_frontend !== void 0;
11900
- if (hasUserFrontend) {
11940
+ const registryCwd = options.frontendCwd ?? options.cwd;
11941
+ const splitFrontend = hasUserFrontend && options.frontendCwd !== void 0;
11942
+ if (hasUserFrontend && !splitFrontend) {
11901
11943
  stagePaths.push(PLUGIN_REGISTRY_RELATIVE_PATH);
11902
11944
  }
11903
11945
  if (options.dryRun) {
11904
- printDryRun5(name, version, stagePaths, options.keepData);
11946
+ printDryRun5(
11947
+ name,
11948
+ version,
11949
+ stagePaths,
11950
+ options.keepData,
11951
+ splitFrontend ? registryCwd : void 0
11952
+ );
11905
11953
  return;
11906
11954
  }
11907
11955
  if (!options.force) {
@@ -11918,7 +11966,14 @@ async function runPluginUninstall(name, options, deps) {
11918
11966
  );
11919
11967
  }
11920
11968
  if (hasUserFrontend) {
11921
- assertPluginRegistryReady(options.cwd, name);
11969
+ if (splitFrontend) {
11970
+ if (!await deps.git.isGitRepo(registryCwd)) {
11971
+ throw new Error(
11972
+ `${registryCwd} (--frontend-cwd) is not a git repository \u2014 biffo plugin uninstall must remove the dashboard registry entry from a real checkout.`
11973
+ );
11974
+ }
11975
+ }
11976
+ assertPluginRegistryReady(registryCwd, name);
11922
11977
  }
11923
11978
  if (existsSync41(modulesDir)) {
11924
11979
  const refs = findPluginModuleReferences(options.cwd, name).filter(
@@ -11946,7 +12001,7 @@ Remove the reference(s) above first, then re-run uninstall.`
11946
12001
  );
11947
12002
  }
11948
12003
  }
11949
- if (hasUserFrontend) {
12004
+ if (hasUserFrontend && !splitFrontend) {
11950
12005
  removePluginRegistryEntry(options.cwd, name);
11951
12006
  log.success(`Removed ${name} from ${PLUGIN_REGISTRY_RELATIVE_PATH}`);
11952
12007
  }
@@ -11954,12 +12009,40 @@ Remove the reference(s) above first, then re-run uninstall.`
11954
12009
  const commitMessage = `chore(plugins): uninstall ${label}`;
11955
12010
  await commitPluginChange(deps, options.cwd, stagePaths, commitMessage);
11956
12011
  log.success(`Committed: ${commitMessage}`);
12012
+ if (splitFrontend) {
12013
+ const dashboardCommitMessage = `chore(plugins): unregister ${label} from dashboard`;
12014
+ try {
12015
+ removePluginRegistryEntry(registryCwd, name);
12016
+ await commitPluginChange(
12017
+ deps,
12018
+ registryCwd,
12019
+ [PLUGIN_REGISTRY_RELATIVE_PATH],
12020
+ dashboardCommitMessage
12021
+ );
12022
+ } catch (err) {
12023
+ throw new Error(
12024
+ `services/${name}/ was removed and committed in ${options.cwd}, but removing ${name} from the dashboard registry in ${registryCwd} (--frontend-cwd) failed: ${err.message}
12025
+ The two checkouts are now out of step, and re-running uninstall cannot repair it (the plugin is already gone from ${options.cwd}): remove the ${name} entry from ${PLUGIN_REGISTRY_RELATIVE_PATH} in ${registryCwd} by hand.`
12026
+ );
12027
+ }
12028
+ log.success(
12029
+ `Removed ${name} from ${registryCwd}/${PLUGIN_REGISTRY_RELATIVE_PATH} (committed there: "${dashboardCommitMessage}")`
12030
+ );
12031
+ }
11957
12032
  console.log(chalk18.bold("\n Plugin uninstalled!\n"));
11958
12033
  console.log(` services/${name}/ has been removed and committed.`);
12034
+ if (splitFrontend) {
12035
+ console.log(
12036
+ ` Its dashboard registration was removed and committed separately at ${registryCwd}/${PLUGIN_REGISTRY_RELATIVE_PATH}.`
12037
+ );
12038
+ }
11959
12039
  console.log(
11960
12040
  " Push and redeploy so the Core API stops discovering its routes at the next db-init:"
11961
12041
  );
11962
12042
  console.log(chalk18.dim(` git push`));
12043
+ if (splitFrontend) {
12044
+ console.log(chalk18.dim(` (and, in ${registryCwd}) git push`));
12045
+ }
11963
12046
  console.log(chalk18.dim(` biffo deploy <environment> --app-only
11964
12047
  `));
11965
12048
  if (options.keepData) {
@@ -12000,7 +12083,7 @@ async function confirmUninstall(name, version) {
12000
12083
  ]);
12001
12084
  return confirmed;
12002
12085
  }
12003
- function printDryRun5(name, version, stagePaths, keepData) {
12086
+ function printDryRun5(name, version, stagePaths, keepData, frontendCwd) {
12004
12087
  const label = version ? `${name}@${version}` : name;
12005
12088
  console.log(chalk18.bold("\n Dry run \u2014 no changes will be made\n"));
12006
12089
  console.log(` Plugin: ${label}`);
@@ -12009,6 +12092,11 @@ function printDryRun5(name, version, stagePaths, keepData) {
12009
12092
  ` Would unwire: module "plugin_${name}" + its enabled_plugins entry from infra/environments/*/plugins.generated.tf`
12010
12093
  );
12011
12094
  console.log(` Would commit: chore(plugins): uninstall ${label}`);
12095
+ if (frontendCwd) {
12096
+ console.log(
12097
+ ` Would remove: dashboard entry ${PLUGIN_REGISTRY_RELATIVE_PATH} in ${frontendCwd} (separate --frontend-cwd checkout, committed there after the core commit)`
12098
+ );
12099
+ }
12012
12100
  console.log(
12013
12101
  ` --keep-data: ${keepData ? "no-op \u2014 CLI never drops tables either way" : "not set \u2014 no DB action taken either way; see notes"}
12014
12102
  `
@@ -12017,7 +12105,7 @@ function printDryRun5(name, version, stagePaths, keepData) {
12017
12105
 
12018
12106
  // src/commands/plugin-upgrade.ts
12019
12107
  import { cpSync as cpSync6, existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as readFileSync30, rmSync as rmSync11 } from "fs";
12020
- import { join as join44, relative as relative7, resolve as resolve19 } from "path";
12108
+ import { join as join44, relative as relative7, resolve as resolve20 } from "path";
12021
12109
  import chalk19 from "chalk";
12022
12110
  import { Command as Command21 } from "commander";
12023
12111
  import inquirer7 from "inquirer";
@@ -12032,12 +12120,12 @@ var pluginUpgradeCommand = new Command21("upgrade").description(
12032
12120
  "Refresh the installed plugin from a local, unpublished checkout instead of the registry"
12033
12121
  ).option("--dry-run", "Resolve the new version and print planned changes without applying them").option("--force", "Skip the confirmation prompt").option("--cwd <path>", "Project root to upgrade in (defaults to the current directory)").action(
12034
12122
  async (target, options) => {
12035
- const cwd = options.cwd ? resolve19(options.cwd) : process.cwd();
12123
+ const cwd = options.cwd ? resolve20(options.cwd) : process.cwd();
12036
12124
  try {
12037
12125
  await runPluginUpgrade(
12038
12126
  target,
12039
12127
  {
12040
- ...options.local ? { local: resolve19(options.local) } : {},
12128
+ ...options.local ? { local: resolve20(options.local) } : {},
12041
12129
  dryRun: options.dryRun ?? false,
12042
12130
  force: options.force ?? false,
12043
12131
  cwd
@@ -12211,7 +12299,7 @@ async function runLocalPluginRefresh(localPath, options, deps) {
12211
12299
  `Plugin '${source.name}' is not installed at services/${source.name}/. Use 'biffo plugin install --local ${localPath}' instead.`
12212
12300
  );
12213
12301
  }
12214
- const inTreeSource = resolve19(source.sourceDir) === resolve19(targetDir);
12302
+ const inTreeSource = resolve20(source.sourceDir) === resolve20(targetDir);
12215
12303
  const currentVersion = readInstalledVersion(targetDir);
12216
12304
  const modulesDir = join44(options.cwd, "modules", "plugins", source.name);
12217
12305
  if (options.dryRun) {
@@ -12479,7 +12567,7 @@ function printLocalDryRun(source, currentVersion, inTreeSource) {
12479
12567
  }
12480
12568
 
12481
12569
  // src/commands/plugin-verify.ts
12482
- import { dirname as dirname12, resolve as resolve20 } from "path";
12570
+ import { dirname as dirname12, resolve as resolve21 } from "path";
12483
12571
  import { fileURLToPath as fileURLToPath7 } from "url";
12484
12572
  import { Command as Command22 } from "commander";
12485
12573
 
@@ -12587,7 +12675,7 @@ var pluginVerifyCommand = new Command22("verify").description(
12587
12675
  "SKIP the real_core seam (Core + plugin host composition) \u2014 loud, never silent"
12588
12676
  ).action(
12589
12677
  async (options) => {
12590
- const cwd = options.cwd ? resolve20(options.cwd) : process.cwd();
12678
+ const cwd = options.cwd ? resolve21(options.cwd) : process.cwd();
12591
12679
  const here = dirname12(fileURLToPath7(import.meta.url));
12592
12680
  const runner = new RealCommandRunner();
12593
12681
  const findScript = (relativePath) => findPackagedScript(here, relativePath);
@@ -12597,7 +12685,7 @@ var pluginVerifyCommand = new Command22("verify").description(
12597
12685
  cwd,
12598
12686
  listChecks: options.listChecks ?? false,
12599
12687
  realCore: options.realCore,
12600
- ...options.configFile ? { configFile: resolve20(options.configFile) } : {},
12688
+ ...options.configFile ? { configFile: resolve21(options.configFile) } : {},
12601
12689
  signal: interrupt.signal
12602
12690
  },
12603
12691
  {
@@ -12631,7 +12719,7 @@ import { Command as Command25 } from "commander";
12631
12719
 
12632
12720
  // src/commands/sibling-check-identity.ts
12633
12721
  import { existsSync as existsSync43, readFileSync as readFileSync31 } from "fs";
12634
- import { resolve as resolve21 } from "path";
12722
+ import { resolve as resolve22 } from "path";
12635
12723
  import chalk20 from "chalk";
12636
12724
  import { Command as Command24 } from "commander";
12637
12725
 
@@ -12824,7 +12912,7 @@ async function fetchPublishedIdentity(portalUrl) {
12824
12912
  }
12825
12913
  async function resolveConfig4(options) {
12826
12914
  if (options.config) {
12827
- const raw = JSON.parse(readFileSync31(resolve21(options.config), "utf8"));
12915
+ const raw = JSON.parse(readFileSync31(resolve22(options.config), "utf8"));
12828
12916
  const result = BiffoConfigSchema.safeParse(raw);
12829
12917
  if (!result.success) {
12830
12918
  log.error(`Invalid config at ${options.config}:`);
@@ -12843,7 +12931,7 @@ async function resolveConfig4(options) {
12843
12931
  }
12844
12932
  return cfg;
12845
12933
  }
12846
- const localConfigPath = resolve21(process.cwd(), "biffo.config.json");
12934
+ const localConfigPath = resolve22(process.cwd(), "biffo.config.json");
12847
12935
  if (existsSync43(localConfigPath)) {
12848
12936
  const raw = JSON.parse(readFileSync31(localConfigPath, "utf8"));
12849
12937
  const result = BiffoConfigSchema.safeParse(raw);
@@ -15907,7 +15995,7 @@ function assignedString(source, name) {
15907
15995
  const match = new RegExp(`^\\s*${name}\\s*=\\s*"((?:[^"\\\\]|\\\\.)*)"\\s*$`, "m").exec(source);
15908
15996
  return match?.[1];
15909
15997
  }
15910
- function resolve22(expression, bindings) {
15998
+ function resolve23(expression, bindings) {
15911
15999
  let current = expression;
15912
16000
  for (let pass = 0; pass < 10; pass += 1) {
15913
16001
  const next = current.replace(/\$\{([^}]+)\}/g, (whole, ref) => {
@@ -15944,13 +16032,13 @@ function composeExpectedRoleName(repoRoot) {
15944
16032
  "var.project_name": PROJECT,
15945
16033
  "var.environment": ENV,
15946
16034
  "var.plugin_name": PLUGIN,
15947
- "var.function_name": resolve22(pluginFunctionName, {
16035
+ "var.function_name": resolve23(pluginFunctionName, {
15948
16036
  "var.plugin_name": PLUGIN
15949
16037
  })
15950
16038
  };
15951
- bindings["local.name_prefix"] = resolve22(namePrefix, bindings);
15952
- bindings["local.function_name"] = resolve22(functionName, bindings);
15953
- return resolve22(roleName, bindings);
16039
+ bindings["local.name_prefix"] = resolve23(namePrefix, bindings);
16040
+ bindings["local.function_name"] = resolve23(functionName, bindings);
16041
+ return resolve23(roleName, bindings);
15954
16042
  }
15955
16043
  function readAllowlistGlob(repoRoot) {
15956
16044
  const allowlist = read(repoRoot, ALLOWLIST_MAIN_TF);
@@ -15960,7 +16048,7 @@ function readAllowlistGlob(repoRoot) {
15960
16048
  `plugin-allowlist drift guard: could not find the "for name in var.enabled_plugins" glob in ${ALLOWLIST_MAIN_TF}.`
15961
16049
  );
15962
16050
  }
15963
- return resolve22(glob, {
16051
+ return resolve23(glob, {
15964
16052
  "data.aws_caller_identity.current.account_id": ACCOUNT,
15965
16053
  "var.project_name": PROJECT,
15966
16054
  "var.environment": ENV,
@@ -17993,7 +18081,7 @@ function rawArgsAfter(subcommand) {
17993
18081
 
17994
18082
  // src/commands/doctor.ts
17995
18083
  import { existsSync as existsSync62, readFileSync as readFileSync50 } from "fs";
17996
- import { join as join75, resolve as resolve23 } from "path";
18084
+ import { join as join75, resolve as resolve24 } from "path";
17997
18085
  import chalk21 from "chalk";
17998
18086
  import { Command as Command27 } from "commander";
17999
18087
 
@@ -18413,10 +18501,10 @@ var doctorCommand = new Command27("doctor").description(
18413
18501
  ).action(
18414
18502
  async (options) => {
18415
18503
  if (options.scratchClones !== void 0) {
18416
- await runScratchCloneScan(resolve23(options.scratchClones));
18504
+ await runScratchCloneScan(resolve24(options.scratchClones));
18417
18505
  return;
18418
18506
  }
18419
- const cwd = options.cwd ? resolve23(options.cwd) : process.cwd();
18507
+ const cwd = options.cwd ? resolve24(options.cwd) : process.cwd();
18420
18508
  const git = new GitAdapter();
18421
18509
  try {
18422
18510
  const facts = await gatherRepoFacts({ cwd, fetch: options.fetch !== false }, { git });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.324.12",
3
+ "version": "0.324.14",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",