@biffo/cli 0.324.5 → 0.324.6

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 +363 -352
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9615,12 +9615,83 @@ async function promptForConfig(awsAccountId, awsRegion, awsProfile) {
9615
9615
  import { Command as Command23 } from "commander";
9616
9616
 
9617
9617
  // src/commands/plugin-create.ts
9618
- import { existsSync as existsSync32, readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
9619
- import { dirname as dirname10, join as join32, resolve as resolve13 } from "path";
9618
+ 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";
9620
9620
  import { fileURLToPath as fileURLToPath6 } from "url";
9621
9621
  import chalk13 from "chalk";
9622
9622
  import { Command as Command14 } from "commander";
9623
9623
 
9624
+ // src/lib/plugin-commit.ts
9625
+ import { existsSync as existsSync29 } from "fs";
9626
+ import { join as join30 } from "path";
9627
+
9628
+ // src/adapters/plugin-migrations/index.ts
9629
+ import { join as join29 } from "path";
9630
+ var PluginMigrationsAdapter = class {
9631
+ /**
9632
+ * Generates migration file(s) for `pluginNames` (every discovered
9633
+ * installed plugin if omitted), returning the absolute path of each newly
9634
+ * generated file — empty if every named plugin already had a migration,
9635
+ * or declared no tables.
9636
+ */
9637
+ async generate(cwd, pluginNames) {
9638
+ const scriptPath = join29(cwd, "services", "api", "scripts", "generate_plugin_migrations.py");
9639
+ const args = [
9640
+ "run",
9641
+ "python",
9642
+ scriptPath,
9643
+ "--services-root",
9644
+ join29(cwd, "services"),
9645
+ "--versions-dir",
9646
+ join29(cwd, "services", "api", "migrations", "versions")
9647
+ ];
9648
+ for (const name of pluginNames ?? []) {
9649
+ args.push("--plugin", name);
9650
+ }
9651
+ const result = await runUv(args, join29(cwd, "services", "api"), {
9652
+ missing: "biffo plugin install/upgrade/sync-migrations needs `uv` (Python) on PATH to generate a real migration file \u2014 see https://docs.astral.sh/uv/ to install it. Once installed, re-run this command (or `biffo plugin sync-migrations <name>` if services/<name>/ is already copied in).",
9653
+ failed: "Failed to generate plugin migration"
9654
+ });
9655
+ return result.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
9656
+ }
9657
+ /**
9658
+ * Brings the instance's root `uv.lock` in step with its workspace (`uv lock`).
9659
+ *
9660
+ * `plugin install` adds a member to the uv workspace, so the committed lock is stale the moment the plugin lands — whether or
9661
+ * not the plugin has tables (only a table-bearing plugin runs `uv run` for a migration, which is a side effect that happens to
9662
+ * re-lock). Locking explicitly, then staging the result, is what makes `uv lock --check` pass on the install commit
9663
+ * (biffo-template#2106); leaving it to whichever `uv run` came last is how the no-tables install shipped a stale lock.
9664
+ */
9665
+ async refreshLock(cwd) {
9666
+ await runUv(["lock"], cwd, {
9667
+ missing: "biffo plugin install needs `uv` (Python) on PATH to refresh uv.lock for the workspace member it adds \u2014 see https://docs.astral.sh/uv/ to install it, then run `uv lock` and commit uv.lock yourself.",
9668
+ failed: "Failed to refresh uv.lock (`uv lock`)"
9669
+ });
9670
+ }
9671
+ };
9672
+ async function runUv(args, cwd, messages) {
9673
+ try {
9674
+ return await execa("uv", args, { cwd });
9675
+ } catch (err) {
9676
+ const cause = err;
9677
+ if (cause.code === "ENOENT") throw new Error(messages.missing);
9678
+ throw new Error(`${messages.failed}: ${cause.stderr?.trim() || err.message}`);
9679
+ }
9680
+ }
9681
+
9682
+ // src/lib/plugin-commit.ts
9683
+ async function withRefreshedLock(deps, cwd, stagePaths) {
9684
+ if (!existsSync29(join30(cwd, "uv.lock"))) return stagePaths;
9685
+ await (deps.migrations ?? new PluginMigrationsAdapter()).refreshLock(cwd);
9686
+ return stagePaths.includes("uv.lock") ? stagePaths : [...stagePaths, "uv.lock"];
9687
+ }
9688
+ async function commitPluginChange(deps, cwd, stagePaths, message) {
9689
+ const paths = await withRefreshedLock(deps, cwd, stagePaths);
9690
+ await deps.git.add(cwd, paths);
9691
+ await deps.git.commit(cwd, message, paths);
9692
+ return paths;
9693
+ }
9694
+
9624
9695
  // src/lib/registry-sources.ts
9625
9696
  function manifestUrlFor(repoUrl, branch = "dev") {
9626
9697
  const slug = repoUrl.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
@@ -9680,21 +9751,21 @@ function workflowCheckContexts(workflow) {
9680
9751
  }
9681
9752
 
9682
9753
  // src/lib/plugin-locations.ts
9683
- import { existsSync as existsSync29, readdirSync as readdirSync10 } from "fs";
9684
- import { join as join29 } from "path";
9754
+ import { existsSync as existsSync30, readdirSync as readdirSync10 } from "fs";
9755
+ import { join as join31 } from "path";
9685
9756
  var FIRST_PARTY_PLUGINS_DIR = "_plugins";
9686
9757
  var PLUGIN_MANIFEST_FILE = "biffo.plugin.json";
9687
9758
  function pluginDir(name, channel) {
9688
9759
  return channel === "first-party" ? `services/${FIRST_PARTY_PLUGINS_DIR}/${name}` : `services/${name}`;
9689
9760
  }
9690
9761
  function scanDir(absDir, relDir, channel) {
9691
- if (!existsSync29(absDir)) return [];
9762
+ if (!existsSync30(absDir)) return [];
9692
9763
  const found = [];
9693
9764
  for (const entry of readdirSync10(absDir, { withFileTypes: true })) {
9694
9765
  if (!entry.isDirectory()) continue;
9695
9766
  if (channel === "third-party" && entry.name === FIRST_PARTY_PLUGINS_DIR) continue;
9696
- const manifestPath = join29(absDir, entry.name, PLUGIN_MANIFEST_FILE);
9697
- if (!existsSync29(manifestPath)) continue;
9767
+ const manifestPath = join31(absDir, entry.name, PLUGIN_MANIFEST_FILE);
9768
+ if (!existsSync30(manifestPath)) continue;
9698
9769
  found.push({
9699
9770
  dirName: entry.name,
9700
9771
  relDir: `${relDir}/${entry.name}`,
@@ -9705,11 +9776,11 @@ function scanDir(absDir, relDir, channel) {
9705
9776
  return found;
9706
9777
  }
9707
9778
  function findInstalledPlugins(cwd) {
9708
- const servicesDir = join29(cwd, "services");
9779
+ const servicesDir = join31(cwd, "services");
9709
9780
  return [
9710
9781
  ...scanDir(servicesDir, "services", "third-party"),
9711
9782
  ...scanDir(
9712
- join29(servicesDir, FIRST_PARTY_PLUGINS_DIR),
9783
+ join31(servicesDir, FIRST_PARTY_PLUGINS_DIR),
9713
9784
  `services/${FIRST_PARTY_PLUGINS_DIR}`,
9714
9785
  "first-party"
9715
9786
  )
@@ -9717,8 +9788,8 @@ function findInstalledPlugins(cwd) {
9717
9788
  }
9718
9789
 
9719
9790
  // src/lib/plugin-workspace-sources.ts
9720
- import { existsSync as existsSync30, readdirSync as readdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
9721
- import { join as join30 } from "path";
9791
+ import { existsSync as existsSync31, readdirSync as readdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
9792
+ import { join as join32 } from "path";
9722
9793
  import { parse as parseToml } from "smol-toml";
9723
9794
  function readTomlStringArray(text, key) {
9724
9795
  const open = new RegExp(`^${key}\\s*=\\s*\\[`, "m").exec(text);
@@ -9852,8 +9923,8 @@ function isSourcesHeader(header) {
9852
9923
  return isTable(node) && Object.keys(node).length === 0;
9853
9924
  }
9854
9925
  function workspaceMemberNames(instanceRoot) {
9855
- const rootPyproject = join30(instanceRoot, "pyproject.toml");
9856
- if (!existsSync30(rootPyproject)) return /* @__PURE__ */ new Set();
9926
+ const rootPyproject = join32(instanceRoot, "pyproject.toml");
9927
+ if (!existsSync31(rootPyproject)) return /* @__PURE__ */ new Set();
9857
9928
  const doc = parsePyproject(readFileSync21(rootPyproject, "utf8"), rootPyproject);
9858
9929
  const tool = isTable(doc.tool) ? doc.tool : {};
9859
9930
  const uv = isTable(tool.uv) ? tool.uv : {};
@@ -9866,7 +9937,7 @@ function workspaceMemberNames(instanceRoot) {
9866
9937
  const base = member.slice(0, -2);
9867
9938
  let entries;
9868
9939
  try {
9869
- entries = readdirSync11(join30(instanceRoot, base), { withFileTypes: true });
9940
+ entries = readdirSync11(join32(instanceRoot, base), { withFileTypes: true });
9870
9941
  } catch {
9871
9942
  continue;
9872
9943
  }
@@ -9880,15 +9951,15 @@ function workspaceMemberNames(instanceRoot) {
9880
9951
  }
9881
9952
  const names = /* @__PURE__ */ new Set();
9882
9953
  for (const dir of dirs) {
9883
- const pp = join30(instanceRoot, dir, "pyproject.toml");
9884
- if (!existsSync30(pp)) continue;
9954
+ const pp = join32(instanceRoot, dir, "pyproject.toml");
9955
+ if (!existsSync31(pp)) continue;
9885
9956
  const name = readProjectName(readFileSync21(pp, "utf8"));
9886
9957
  if (name) names.add(normaliseName(name));
9887
9958
  }
9888
9959
  return names;
9889
9960
  }
9890
9961
  function ensureWorkspaceSources(pluginPyprojectPath, memberNames) {
9891
- if (!existsSync30(pluginPyprojectPath) || memberNames.size === 0) return [];
9962
+ if (!existsSync31(pluginPyprojectPath) || memberNames.size === 0) return [];
9892
9963
  const text = readFileSync21(pluginPyprojectPath, "utf8");
9893
9964
  const doc = parsePyproject(text, pluginPyprojectPath);
9894
9965
  const members = new Set([...memberNames].map(normaliseName));
@@ -9944,8 +10015,8 @@ function parsePyproject(text, path) {
9944
10015
  }
9945
10016
  }
9946
10017
  function applyWorkspaceSources(targetDir, cwd, relTargetDir) {
9947
- const pluginPyproject = join30(targetDir, "pyproject.toml");
9948
- if (!existsSync30(pluginPyproject)) return [];
10018
+ const pluginPyproject = join32(targetDir, "pyproject.toml");
10019
+ if (!existsSync31(pluginPyproject)) return [];
9949
10020
  const sourced = ensureWorkspaceSources(pluginPyproject, workspaceMemberNames(cwd));
9950
10021
  if (sourced.length > 0) {
9951
10022
  log.info(
@@ -9959,14 +10030,14 @@ function applyWorkspaceSources(targetDir, cwd, relTargetDir) {
9959
10030
  import {
9960
10031
  chmodSync as chmodSync2,
9961
10032
  copyFileSync,
9962
- existsSync as existsSync31,
10033
+ existsSync as existsSync32,
9963
10034
  mkdirSync as mkdirSync9,
9964
10035
  readFileSync as readFileSync22,
9965
10036
  readdirSync as readdirSync12,
9966
10037
  statSync as statSync7,
9967
10038
  writeFileSync as writeFileSync10
9968
10039
  } from "fs";
9969
- import { dirname as dirname9, join as join31 } from "path";
10040
+ import { dirname as dirname9, join as join33 } from "path";
9970
10041
  var STANDALONE_ONLY_ENTRIES = {
9971
10042
  ".github": "standalone-repo CI/release workflows \u2014 the host monorepo already runs lint/type/test/security over services/",
9972
10043
  "registry-schema.json": "the plugin-registry publishing schema, used when submitting a *published* plugin to the registry repo, not by an in-tree plugin",
@@ -10020,10 +10091,10 @@ function applySubstitutions(text, names) {
10020
10091
  var BINARY_EXTENSIONS = /\.(png|jpe?g|gif|ico|woff2?|ttf|zip|gz)$/i;
10021
10092
  function scaffoldPlugin(skeletonRoot, destDir, names, options = {}) {
10022
10093
  const layout = options.layout ?? "in-tree";
10023
- if (!existsSync31(skeletonRoot)) {
10094
+ if (!existsSync32(skeletonRoot)) {
10024
10095
  throw new Error(`Plugin skeleton not found at ${skeletonRoot}`);
10025
10096
  }
10026
- if (!existsSync31(join31(skeletonRoot, "terraform"))) {
10097
+ if (!existsSync32(join33(skeletonRoot, "terraform"))) {
10027
10098
  throw new Error(
10028
10099
  `Plugin skeleton at ${skeletonRoot} has no terraform/ directory. Refusing to scaffold a plugin that cannot receive events (issue #194) \u2014 the skeleton is broken.`
10029
10100
  );
@@ -10031,7 +10102,7 @@ function scaffoldPlugin(skeletonRoot, destDir, names, options = {}) {
10031
10102
  const skipped = [];
10032
10103
  const files = [];
10033
10104
  const walk2 = (relDir) => {
10034
- const absDir = join31(skeletonRoot, relDir);
10105
+ const absDir = join33(skeletonRoot, relDir);
10035
10106
  for (const entry of readdirSync12(absDir, { withFileTypes: true }).sort(
10036
10107
  (a, b) => a.name.localeCompare(b.name)
10037
10108
  )) {
@@ -10046,9 +10117,9 @@ function scaffoldPlugin(skeletonRoot, destDir, names, options = {}) {
10046
10117
  continue;
10047
10118
  }
10048
10119
  const destRel = applySubstitutions(relPath, names);
10049
- const destPath = join31(destDir, destRel);
10120
+ const destPath = join33(destDir, destRel);
10050
10121
  mkdirSync9(dirname9(destPath), { recursive: true });
10051
- const srcPath = join31(skeletonRoot, relPath);
10122
+ const srcPath = join33(skeletonRoot, relPath);
10052
10123
  if (BINARY_EXTENSIONS.test(entry.name)) {
10053
10124
  copyFileSync(srcPath, destPath);
10054
10125
  } else {
@@ -10069,8 +10140,8 @@ function scaffoldPlugin(skeletonRoot, destDir, names, options = {}) {
10069
10140
  function findSkeletonRoot(startDir, skeleton) {
10070
10141
  let dir = startDir;
10071
10142
  for (; ; ) {
10072
- const candidate = join31(dir, "_skeletons", skeleton);
10073
- if (existsSync31(candidate)) return candidate;
10143
+ const candidate = join33(dir, "_skeletons", skeleton);
10144
+ if (existsSync32(candidate)) return candidate;
10074
10145
  const parent = dirname9(dir);
10075
10146
  if (parent === dir) return null;
10076
10147
  dir = parent;
@@ -10138,7 +10209,7 @@ async function runPluginCreate(name, options, deps) {
10138
10209
  reportBranchProtectionSummary();
10139
10210
  return;
10140
10211
  }
10141
- const isInstance = existsSync32(join32(options.cwd, INSTANCE_CORE_FILE));
10212
+ const isInstance = existsSync33(join34(options.cwd, INSTANCE_CORE_FILE));
10142
10213
  if (options.firstParty && isInstance) {
10143
10214
  throw new Error(
10144
10215
  `--first-party scaffolds into services/_plugins/, which is template-owned: \`biffo core upgrade\` three-way-merges it against the template on every upgrade, and the template has no '${names.slug}'. This checkout is a Biffo instance (${INSTANCE_CORE_FILE} is present), so your plugin belongs in the user-owned ${pluginDir(names.slug, "third-party")}/ \u2014 re-run without --first-party.`
@@ -10146,19 +10217,19 @@ async function runPluginCreate(name, options, deps) {
10146
10217
  }
10147
10218
  const channel = options.firstParty ? "first-party" : "third-party";
10148
10219
  const relDir = pluginDir(names.slug, channel);
10149
- const destDir = join32(options.cwd, relDir);
10150
- const servicesDir = join32(options.cwd, "services");
10151
- if (!existsSync32(servicesDir)) {
10220
+ const destDir = join34(options.cwd, relDir);
10221
+ const servicesDir = join34(options.cwd, "services");
10222
+ if (!existsSync33(servicesDir)) {
10152
10223
  throw new Error(
10153
10224
  `${servicesDir} does not exist \u2014 is ${options.cwd} the root of a Biffo project checkout?`
10154
10225
  );
10155
10226
  }
10156
- if (existsSync32(destDir)) {
10227
+ if (existsSync33(destDir)) {
10157
10228
  throw new Error(`${relDir}/ already exists. Choose a different name, or remove it first.`);
10158
10229
  }
10159
10230
  const here = dirname10(fileURLToPath6(import.meta.url));
10160
- const skeletonRoot = options.skeletonRoot ?? findSkeletonRoot(here, "plugin-template") ?? join32(options.cwd, "_skeletons", "plugin-template");
10161
- if (!existsSync32(skeletonRoot)) {
10231
+ const skeletonRoot = options.skeletonRoot ?? findSkeletonRoot(here, "plugin-template") ?? join34(options.cwd, "_skeletons", "plugin-template");
10232
+ if (!existsSync33(skeletonRoot)) {
10162
10233
  throw new Error(
10163
10234
  `Could not find the plugin skeleton (_skeletons/plugin-template/). Pass --skeleton <path> to point at it explicitly.`
10164
10235
  );
@@ -10173,7 +10244,7 @@ async function runPluginCreate(name, options, deps) {
10173
10244
  for (const { entry, reason } of skipped) {
10174
10245
  log.info(`Skipped ${entry} \u2014 ${reason}`);
10175
10246
  }
10176
- const manifestPath = join32(destDir, "biffo.plugin.json");
10247
+ const manifestPath = join34(destDir, "biffo.plugin.json");
10177
10248
  const manifest = validateManifest(JSON.parse(readFileSync23(manifestPath, "utf8")));
10178
10249
  if (manifest.name !== names.slug) {
10179
10250
  throw new Error(
@@ -10191,15 +10262,14 @@ async function runPluginCreate(name, options, deps) {
10191
10262
  );
10192
10263
  }
10193
10264
  const commitMessage = `feat(plugins): scaffold ${names.slug} plugin`;
10194
- await deps.git.add(options.cwd, [relDir]);
10195
- await deps.git.commit(options.cwd, commitMessage, [relDir]);
10265
+ await commitPluginChange(deps, options.cwd, [relDir], commitMessage);
10196
10266
  log.success(`Committed: ${commitMessage}`);
10197
10267
  }
10198
10268
  printNextSteps(names, relDir, channel);
10199
10269
  }
10200
10270
  async function runStandaloneCreate(names, options, deps) {
10201
- const destDir = join32(options.cwd, names.dist);
10202
- if (existsSync32(destDir)) {
10271
+ const destDir = join34(options.cwd, names.dist);
10272
+ if (existsSync33(destDir)) {
10203
10273
  throw new Error(`${names.dist}/ already exists. Choose a different name, or remove it first.`);
10204
10274
  }
10205
10275
  const skeletonRoot = resolveSkeletonRoot(options);
@@ -10217,7 +10287,7 @@ async function runStandaloneCreate(names, options, deps) {
10217
10287
  restorePackagedDotfiles(destDir);
10218
10288
  log.success(`Scaffolded ${String(files.length)} file(s) into ${names.dist}/`);
10219
10289
  const manifest = validateManifest(
10220
- JSON.parse(readFileSync23(join32(destDir, "biffo.plugin.json"), "utf8"))
10290
+ JSON.parse(readFileSync23(join34(destDir, "biffo.plugin.json"), "utf8"))
10221
10291
  );
10222
10292
  if (manifest.name !== names.slug) {
10223
10293
  throw new Error(
@@ -10228,12 +10298,12 @@ async function runStandaloneCreate(names, options, deps) {
10228
10298
  `Manifest valid \u2014 ${String(manifest.tables.length)} table(s), ${String(manifest.api_routes.length)} route(s)`
10229
10299
  );
10230
10300
  writeFileSync11(
10231
- join32(destDir, ".biffo-shared-version"),
10301
+ join34(destDir, ".biffo-shared-version"),
10232
10302
  `core-v${getLatestCoreVersion().replace(/^core-v/, "")}
10233
10303
  `
10234
10304
  );
10235
10305
  if (options.commit) {
10236
- if (!existsSync32(join32(destDir, "uv.lock"))) {
10306
+ if (!existsSync33(join34(destDir, "uv.lock"))) {
10237
10307
  throw new Error(
10238
10308
  `Scaffolded plugin at ${destDir} has no uv.lock. The standalone layout must carry a substituted uv.lock (see plugin-scaffold.ts STANDALONE_ONLY_ENTRIES) so the first commit's CI run can satisfy 'uv sync --locked'. Refusing to commit a repo that would ship red on its very first push (issue #1769) \u2014 run 'uv lock' in ${destDir} first.`
10239
10309
  );
@@ -10266,8 +10336,8 @@ async function createAndPushStandaloneRepo(org, names, destDir, options, deps) {
10266
10336
  await deps.git.push(destDir, "dev", { token });
10267
10337
  log.success(`Pushed dev to ${org}/${names.dist}`);
10268
10338
  await github.setDefaultBranch(org, names.dist, "dev");
10269
- const ciPath = join32(destDir, ".github", "workflows", "ci.yml");
10270
- const contexts = existsSync32(ciPath) ? workflowCheckContexts(readFileSync23(ciPath, "utf8")) : [];
10339
+ const ciPath = join34(destDir, ".github", "workflows", "ci.yml");
10340
+ const contexts = existsSync33(ciPath) ? workflowCheckContexts(readFileSync23(ciPath, "utf8")) : [];
10271
10341
  if (contexts.length === 0) {
10272
10342
  log.warn(
10273
10343
  `Could not determine required status checks from ${ciPath} \u2014 skipping branch protection. Configure it manually on dev once you know the CI job names.`
@@ -10296,7 +10366,7 @@ async function registerInRegistrySources(names, cloneUrl, token, deps) {
10296
10366
  let dir;
10297
10367
  try {
10298
10368
  dir = await deps.git.cloneForEditing(REGISTRY_REPO, "biffo-registry", token);
10299
- const path = join32(dir, "sources.json");
10369
+ const path = join34(dir, "sources.json");
10300
10370
  const file = JSON.parse(readFileSync23(path, "utf8"));
10301
10371
  const next = addSource(file, {
10302
10372
  name: names.slug,
@@ -10407,8 +10477,8 @@ function printStandaloneNextSteps(names, minor) {
10407
10477
  }
10408
10478
  function resolveSkeletonRoot(options) {
10409
10479
  const here = dirname10(fileURLToPath6(import.meta.url));
10410
- const skeletonRoot = options.skeletonRoot ?? findSkeletonRoot(here, "plugin-template") ?? join32(options.cwd, "_skeletons", "plugin-template");
10411
- if (!existsSync32(skeletonRoot)) {
10480
+ const skeletonRoot = options.skeletonRoot ?? findSkeletonRoot(here, "plugin-template") ?? join34(options.cwd, "_skeletons", "plugin-template");
10481
+ if (!existsSync33(skeletonRoot)) {
10412
10482
  throw new Error(
10413
10483
  `Could not find the plugin skeleton (_skeletons/plugin-template/). Pass --skeleton <path> to point at it explicitly.`
10414
10484
  );
@@ -10638,68 +10708,14 @@ function printScopeSeamEntitlement(name) {
10638
10708
  }
10639
10709
 
10640
10710
  // src/commands/plugin-install.ts
10641
- import { cpSync as cpSync5, existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync26, statSync as statSync8, writeFileSync as writeFileSync14 } from "fs";
10642
- import { join as join38, relative as relative4, resolve as resolve14 } from "path";
10711
+ import { cpSync as cpSync5, existsSync as existsSync37, mkdirSync as mkdirSync12, readFileSync as readFileSync26, statSync as statSync8, writeFileSync as writeFileSync14 } from "fs";
10712
+ import { join as join39, relative as relative4, resolve as resolve14 } from "path";
10643
10713
  import chalk15 from "chalk";
10644
10714
  import { Command as Command16 } from "commander";
10645
10715
 
10646
- // src/adapters/plugin-migrations/index.ts
10647
- import { join as join33 } from "path";
10648
- var PluginMigrationsAdapter = class {
10649
- /**
10650
- * Generates migration file(s) for `pluginNames` (every discovered
10651
- * installed plugin if omitted), returning the absolute path of each newly
10652
- * generated file — empty if every named plugin already had a migration,
10653
- * or declared no tables.
10654
- */
10655
- async generate(cwd, pluginNames) {
10656
- const scriptPath = join33(cwd, "services", "api", "scripts", "generate_plugin_migrations.py");
10657
- const args = [
10658
- "run",
10659
- "python",
10660
- scriptPath,
10661
- "--services-root",
10662
- join33(cwd, "services"),
10663
- "--versions-dir",
10664
- join33(cwd, "services", "api", "migrations", "versions")
10665
- ];
10666
- for (const name of pluginNames ?? []) {
10667
- args.push("--plugin", name);
10668
- }
10669
- const result = await runUv(args, join33(cwd, "services", "api"), {
10670
- missing: "biffo plugin install/upgrade/sync-migrations needs `uv` (Python) on PATH to generate a real migration file \u2014 see https://docs.astral.sh/uv/ to install it. Once installed, re-run this command (or `biffo plugin sync-migrations <name>` if services/<name>/ is already copied in).",
10671
- failed: "Failed to generate plugin migration"
10672
- });
10673
- return result.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
10674
- }
10675
- /**
10676
- * Brings the instance's root `uv.lock` in step with its workspace (`uv lock`).
10677
- *
10678
- * `plugin install` adds a member to the uv workspace, so the committed lock is stale the moment the plugin lands — whether or
10679
- * not the plugin has tables (only a table-bearing plugin runs `uv run` for a migration, which is a side effect that happens to
10680
- * re-lock). Locking explicitly, then staging the result, is what makes `uv lock --check` pass on the install commit
10681
- * (biffo-template#2106); leaving it to whichever `uv run` came last is how the no-tables install shipped a stale lock.
10682
- */
10683
- async refreshLock(cwd) {
10684
- await runUv(["lock"], cwd, {
10685
- missing: "biffo plugin install needs `uv` (Python) on PATH to refresh uv.lock for the workspace member it adds \u2014 see https://docs.astral.sh/uv/ to install it, then run `uv lock` and commit uv.lock yourself.",
10686
- failed: "Failed to refresh uv.lock (`uv lock`)"
10687
- });
10688
- }
10689
- };
10690
- async function runUv(args, cwd, messages) {
10691
- try {
10692
- return await execa("uv", args, { cwd });
10693
- } catch (err) {
10694
- const cause = err;
10695
- if (cause.code === "ENOENT") throw new Error(messages.missing);
10696
- throw new Error(`${messages.failed}: ${cause.stderr?.trim() || err.message}`);
10697
- }
10698
- }
10699
-
10700
10716
  // src/lib/plugin-frontend-registry.ts
10701
- import { existsSync as existsSync33, readFileSync as readFileSync24, writeFileSync as writeFileSync12 } from "fs";
10702
- import { join as join34 } from "path";
10717
+ import { existsSync as existsSync34, readFileSync as readFileSync24, writeFileSync as writeFileSync12 } from "fs";
10718
+ import { join as join35 } from "path";
10703
10719
  var PLUGIN_REGISTRY_RELATIVE_PATH = "apps/frontend/src/lib/plugins.ts";
10704
10720
  var REGISTRY_START_MARKER = "// BIFFO-PLUGIN-REGISTRY:START \u2014 managed by `biffo plugin install`/`uninstall`. Do not hand-edit.";
10705
10721
  var REGISTRY_END_MARKER = "// BIFFO-PLUGIN-REGISTRY:END";
@@ -10710,7 +10726,7 @@ function frontendUrlForSlug(slug) {
10710
10726
  return `/api/v1/plugins/${slug}/ui`;
10711
10727
  }
10712
10728
  function registryPath2(cwd) {
10713
- return join34(cwd, PLUGIN_REGISTRY_RELATIVE_PATH);
10729
+ return join35(cwd, PLUGIN_REGISTRY_RELATIVE_PATH);
10714
10730
  }
10715
10731
  function missingRegistryError(cwd, pluginSlug) {
10716
10732
  return new Error(
@@ -10787,7 +10803,7 @@ function assertPluginRegistryReady(cwd, pluginSlug) {
10787
10803
  }
10788
10804
  function readManagedEntries(cwd, pluginSlug) {
10789
10805
  const path = registryPath2(cwd);
10790
- if (!existsSync33(path)) throw missingRegistryError(cwd, pluginSlug);
10806
+ if (!existsSync34(path)) throw missingRegistryError(cwd, pluginSlug);
10791
10807
  const source = readFileSync24(path, "utf8");
10792
10808
  const found = findManagedRegion(source);
10793
10809
  if (!found) throw malformedRegistryError(cwd, pluginSlug);
@@ -10811,8 +10827,8 @@ function removePluginRegistryEntry(cwd, pluginSlug) {
10811
10827
  }
10812
10828
 
10813
10829
  // src/lib/plugin-provenance.ts
10814
- import { existsSync as existsSync34, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "fs";
10815
- import { join as join35 } from "path";
10830
+ import { existsSync as existsSync35, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "fs";
10831
+ import { join as join36 } from "path";
10816
10832
  var PLUGIN_PROVENANCE_FILENAME = ".biffo-plugin-provenance.json";
10817
10833
  function isPluginProvenance(value) {
10818
10834
  if (typeof value !== "object" || value === null) return false;
@@ -10820,8 +10836,8 @@ function isPluginProvenance(value) {
10820
10836
  return typeof v["origin"] === "string" && (typeof v["ref"] === "string" || v["ref"] === null) && (typeof v["sha"] === "string" || v["sha"] === null) && typeof v["recordedAt"] === "string" && typeof v["inTree"] === "boolean";
10821
10837
  }
10822
10838
  function readProvenance(pluginDir2) {
10823
- const path = join35(pluginDir2, PLUGIN_PROVENANCE_FILENAME);
10824
- if (!existsSync34(path)) return { status: "absent" };
10839
+ const path = join36(pluginDir2, PLUGIN_PROVENANCE_FILENAME);
10840
+ if (!existsSync35(path)) return { status: "absent" };
10825
10841
  let parsed;
10826
10842
  try {
10827
10843
  parsed = JSON.parse(readFileSync25(path, "utf8"));
@@ -10840,7 +10856,7 @@ function readProvenance(pluginDir2) {
10840
10856
  return { status: "present", record: parsed };
10841
10857
  }
10842
10858
  function writePluginProvenance(pluginDir2, record) {
10843
- writeFileSync13(join35(pluginDir2, PLUGIN_PROVENANCE_FILENAME), `${JSON.stringify(record, null, 2)}
10859
+ writeFileSync13(join36(pluginDir2, PLUGIN_PROVENANCE_FILENAME), `${JSON.stringify(record, null, 2)}
10844
10860
  `);
10845
10861
  }
10846
10862
  function reconcileProvenance(previous, next) {
@@ -10890,8 +10906,8 @@ async function tryGit(cwd, args) {
10890
10906
  }
10891
10907
 
10892
10908
  // src/lib/plugin-seed-vendor.ts
10893
- import { cpSync as cpSync3, existsSync as existsSync35, mkdirSync as mkdirSync10, readdirSync as readdirSync13, rmSync as rmSync9 } from "fs";
10894
- import { join as join36 } from "path";
10909
+ import { cpSync as cpSync3, existsSync as existsSync36, mkdirSync as mkdirSync10, readdirSync as readdirSync13, rmSync as rmSync9 } from "fs";
10910
+ import { join as join37 } from "path";
10895
10911
  var VENDOR_PREFIX = "_plugin-";
10896
10912
  function pluginSeedImportDir(pluginName) {
10897
10913
  return `db/imports/${VENDOR_PREFIX}${pluginName}`;
@@ -10900,8 +10916,8 @@ function vendorPluginSeed(pluginSourceDir, manifest, cwd) {
10900
10916
  if (!manifest.seed) {
10901
10917
  return { vendored: false };
10902
10918
  }
10903
- const sourceSeedDir = join36(pluginSourceDir, manifest.seed.dir);
10904
- if (!existsSync35(sourceSeedDir)) {
10919
+ const sourceSeedDir = join37(pluginSourceDir, manifest.seed.dir);
10920
+ if (!existsSync36(sourceSeedDir)) {
10905
10921
  throw new Error(
10906
10922
  `${manifest.name}'s manifest declares seed.dir '${manifest.seed.dir}', but ${sourceSeedDir} does not exist in the plugin's source.`
10907
10923
  );
@@ -10913,11 +10929,11 @@ function vendorPluginSeed(pluginSourceDir, manifest, cwd) {
10913
10929
  );
10914
10930
  }
10915
10931
  const relTargetDir = pluginSeedImportDir(manifest.name);
10916
- const targetDir = join36(cwd, relTargetDir);
10932
+ const targetDir = join37(cwd, relTargetDir);
10917
10933
  rmSync9(targetDir, { recursive: true, force: true });
10918
10934
  mkdirSync10(targetDir, { recursive: true });
10919
10935
  for (const file of sqlFiles) {
10920
- cpSync3(join36(sourceSeedDir, file), join36(targetDir, file));
10936
+ cpSync3(join37(sourceSeedDir, file), join37(targetDir, file));
10921
10937
  }
10922
10938
  log.success(
10923
10939
  `Vendored ${sqlFiles.length} seed file(s) to ${relTargetDir}/ (baseline_tables: ${manifest.seed.baseline_tables.join(", ") || "none declared"})`
@@ -10930,7 +10946,7 @@ function vendorPluginSeed(pluginSourceDir, manifest, cwd) {
10930
10946
 
10931
10947
  // src/lib/plugin-source-copy.ts
10932
10948
  import { copyFileSync as copyFileSync2, cpSync as cpSync4, mkdirSync as mkdirSync11 } from "fs";
10933
- import { basename as basename2, dirname as dirname11, join as join37 } from "path";
10949
+ import { basename as basename2, dirname as dirname11, join as join38 } from "path";
10934
10950
  var LOCAL_COPY_EXCLUDES = /* @__PURE__ */ new Set([
10935
10951
  ".git",
10936
10952
  ".venv",
@@ -10946,9 +10962,9 @@ async function copyPluginSource(sourceDir, targetDir) {
10946
10962
  if (await isGitWorkingTree2(sourceDir)) {
10947
10963
  const files = await listGitFiles(sourceDir);
10948
10964
  for (const relPath of files) {
10949
- const destPath = join37(targetDir, relPath);
10965
+ const destPath = join38(targetDir, relPath);
10950
10966
  mkdirSync11(dirname11(destPath), { recursive: true });
10951
- copyFileSync2(join37(sourceDir, relPath), destPath);
10967
+ copyFileSync2(join38(sourceDir, relPath), destPath);
10952
10968
  }
10953
10969
  return { usedGitIgnoreRules: true };
10954
10970
  }
@@ -11020,14 +11036,14 @@ var pluginInstallCommand = new Command16("install").description(
11020
11036
  }
11021
11037
  );
11022
11038
  function resolveLocalPlugin(localPath) {
11023
- if (!existsSync36(localPath)) {
11039
+ if (!existsSync37(localPath)) {
11024
11040
  throw new Error(`--local path does not exist: ${localPath}`);
11025
11041
  }
11026
11042
  if (!statSync8(localPath).isDirectory()) {
11027
11043
  throw new Error(`--local path is not a directory: ${localPath}`);
11028
11044
  }
11029
- const manifestPath = join38(localPath, "biffo.plugin.json");
11030
- if (!existsSync36(manifestPath)) {
11045
+ const manifestPath = join39(localPath, "biffo.plugin.json");
11046
+ if (!existsSync37(manifestPath)) {
11031
11047
  throw new Error(
11032
11048
  `${localPath} does not contain a biffo.plugin.json manifest at its root \u2014 is it a plugin directory? (Scaffold one with \`biffo plugin create <name>\`.)`
11033
11049
  );
@@ -11053,8 +11069,8 @@ function parsePluginTarget(target) {
11053
11069
  async function cloneAndValidatePlugin(entry, git) {
11054
11070
  const tmpDir = await git.cloneToTemp(entry.repo, `biffo-plugin-${entry.name}`);
11055
11071
  try {
11056
- const manifestPath = join38(tmpDir, "biffo.plugin.json");
11057
- if (!existsSync36(manifestPath)) {
11072
+ const manifestPath = join39(tmpDir, "biffo.plugin.json");
11073
+ if (!existsSync37(manifestPath)) {
11058
11074
  throw new Error(
11059
11075
  `Plugin repo ${entry.repo} does not contain a biffo.plugin.json manifest at its root.`
11060
11076
  );
@@ -11082,8 +11098,8 @@ async function runPluginInstall(target, options, deps) {
11082
11098
  `Nothing to install. Pass a registry target (e.g. \`biffo plugin install acme-crm@1.0\`) or a local plugin directory (\`biffo plugin install --local services/acme-crm\`).`
11083
11099
  );
11084
11100
  }
11085
- const servicesDir = join38(options.cwd, "services");
11086
- if (!existsSync36(servicesDir)) {
11101
+ const servicesDir = join39(options.cwd, "services");
11102
+ if (!existsSync37(servicesDir)) {
11087
11103
  throw new Error(
11088
11104
  `${servicesDir} does not exist \u2014 is ${options.cwd} the root of a Biffo project checkout?`
11089
11105
  );
@@ -11101,11 +11117,11 @@ async function runPluginInstall(target, options, deps) {
11101
11117
  }
11102
11118
  const pluginName = entry ? entry.name : source.name;
11103
11119
  const relTargetDir = pluginDir(pluginName, "third-party");
11104
- const targetDir = join38(options.cwd, relTargetDir);
11105
- const modulesDir = join38(options.cwd, "modules", "plugins", pluginName);
11120
+ const targetDir = join39(options.cwd, relTargetDir);
11121
+ const modulesDir = join39(options.cwd, "modules", "plugins", pluginName);
11106
11122
  const registryCwd = options.frontendCwd ?? options.cwd;
11107
11123
  const inTreeSource = options.local !== void 0 && resolve14(options.local) === resolve14(targetDir);
11108
- if (existsSync36(targetDir) && !inTreeSource) {
11124
+ if (existsSync37(targetDir) && !inTreeSource) {
11109
11125
  throw new Error(
11110
11126
  `Plugin '${pluginName}' is already installed at ${relTargetDir}/. Remove it first, or wait for a future 'biffo plugin upgrade' command.`
11111
11127
  );
@@ -11145,7 +11161,7 @@ async function runPluginInstall(target, options, deps) {
11145
11161
  log.success(
11146
11162
  `Manifest valid \u2014 ${manifest.tables.length} table(s), ${manifest.api_routes.length} route(s)`
11147
11163
  );
11148
- const retiredShapeReasons = findRetiredFrontendShape(join38(source.sourceDir, "terraform"));
11164
+ const retiredShapeReasons = findRetiredFrontendShape(join39(source.sourceDir, "terraform"));
11149
11165
  if (retiredShapeReasons.length > 0) {
11150
11166
  throw new Error(retiredFrontendShapeError(pluginName, retiredShapeReasons));
11151
11167
  }
@@ -11182,13 +11198,13 @@ async function runPluginInstall(target, options, deps) {
11182
11198
  writePluginProvenance(targetDir, reconcileProvenance(previousProvenance, nextProvenance));
11183
11199
  const sourced = applyWorkspaceSources(targetDir, options.cwd, relTargetDir);
11184
11200
  if (inTreeSource && sourced.length > 0) left.core.written.push(`${relTargetDir}/pyproject.toml`);
11185
- const stagePaths = [relTargetDir];
11201
+ let stagePaths = [relTargetDir];
11186
11202
  const track = (...paths) => {
11187
11203
  stagePaths.push(...paths);
11188
11204
  left.core.written.push(...paths);
11189
11205
  };
11190
- const tfSourceDir = join38(targetDir, "terraform");
11191
- if (existsSync36(tfSourceDir)) {
11206
+ const tfSourceDir = join39(targetDir, "terraform");
11207
+ if (existsSync37(tfSourceDir)) {
11192
11208
  mkdirSync12(modulesDir, { recursive: true });
11193
11209
  cpSync5(tfSourceDir, modulesDir, { recursive: true });
11194
11210
  track(`modules/plugins/${pluginName}`);
@@ -11236,7 +11252,7 @@ async function runPluginInstall(target, options, deps) {
11236
11252
  track(seedResult.stagedPath);
11237
11253
  }
11238
11254
  if (manifest.config.length > 0) {
11239
- const configFilePath = join38(targetDir, "biffo.plugin-config.json");
11255
+ const configFilePath = join39(targetDir, "biffo.plugin-config.json");
11240
11256
  writeFileSync14(
11241
11257
  configFilePath,
11242
11258
  JSON.stringify(
@@ -11260,10 +11276,7 @@ async function runPluginInstall(target, options, deps) {
11260
11276
  `Recorded ${configSupply.resolved.length}/${manifest.config.length} declared config value(s) at ${relative4(options.cwd, configFilePath)}`
11261
11277
  );
11262
11278
  }
11263
- if (existsSync36(join38(options.cwd, "uv.lock"))) {
11264
- await deps.migrations.refreshLock(options.cwd);
11265
- stagePaths.push("uv.lock");
11266
- }
11279
+ stagePaths = await withRefreshedLock(deps, options.cwd, stagePaths);
11267
11280
  if (manifest.user_frontend) {
11268
11281
  upsertPluginRegistryEntry(registryCwd, {
11269
11282
  slug: pluginName,
@@ -11435,8 +11448,8 @@ function printDryRun4(entry, source, relTargetDir, inTreeSource, suppliedConfig
11435
11448
  }
11436
11449
 
11437
11450
  // src/commands/plugin-list.ts
11438
- import { existsSync as existsSync37, readFileSync as readFileSync27 } from "fs";
11439
- import { join as join39, resolve as resolve15 } from "path";
11451
+ import { existsSync as existsSync38, readFileSync as readFileSync27 } from "fs";
11452
+ import { join as join40, resolve as resolve15 } from "path";
11440
11453
  import chalk16 from "chalk";
11441
11454
  import { Command as Command17 } from "commander";
11442
11455
  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) => {
@@ -11449,8 +11462,8 @@ var pluginListCommand = new Command17("list").description("List plugins installe
11449
11462
  }
11450
11463
  });
11451
11464
  async function runPluginList(options) {
11452
- const servicesDir = join39(options.cwd, "services");
11453
- if (!existsSync37(servicesDir)) {
11465
+ const servicesDir = join40(options.cwd, "services");
11466
+ if (!existsSync38(servicesDir)) {
11454
11467
  throw new Error(
11455
11468
  `${servicesDir} does not exist \u2014 is ${options.cwd} the root of a Biffo project checkout?`
11456
11469
  );
@@ -11499,14 +11512,14 @@ import { resolve as resolve16 } from "path";
11499
11512
  import { Command as Command18 } from "commander";
11500
11513
 
11501
11514
  // src/lib/plugin-staleness.ts
11502
- import { existsSync as existsSync38, readFileSync as readFileSync28, readdirSync as readdirSync14, statSync as statSync9 } from "fs";
11503
- import { join as join40, relative as relative5 } from "path";
11515
+ import { existsSync as existsSync39, readFileSync as readFileSync28, readdirSync as readdirSync14, statSync as statSync9 } from "fs";
11516
+ import { join as join41, relative as relative5 } from "path";
11504
11517
  function discoverVendoredPlugins(servicesDir) {
11505
- if (!existsSync38(servicesDir)) return [];
11506
- return readdirSync14(servicesDir, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith("_") && e.name !== "api").map((e) => e.name).filter((name) => existsSync38(join40(servicesDir, name, "biffo.plugin.json"))).sort();
11518
+ if (!existsSync39(servicesDir)) return [];
11519
+ return readdirSync14(servicesDir, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith("_") && e.name !== "api").map((e) => e.name).filter((name) => existsSync39(join41(servicesDir, name, "biffo.plugin.json"))).sort();
11507
11520
  }
11508
11521
  async function checkPluginStaleness(cwd, deps) {
11509
- const servicesDir = join40(cwd, "services");
11522
+ const servicesDir = join41(cwd, "services");
11510
11523
  const names = discoverVendoredPlugins(servicesDir);
11511
11524
  let registryRepoByName = null;
11512
11525
  let registryFetchFailure = null;
@@ -11527,7 +11540,7 @@ async function checkPluginStaleness(cwd, deps) {
11527
11540
  };
11528
11541
  const results = [];
11529
11542
  for (const name of names) {
11530
- results.push(await checkOnePlugin(join40(servicesDir, name), name, resolveRegistryRepo, deps.git));
11543
+ results.push(await checkOnePlugin(join41(servicesDir, name), name, resolveRegistryRepo, deps.git));
11531
11544
  }
11532
11545
  return results;
11533
11546
  }
@@ -11553,7 +11566,7 @@ async function checkOnePlugin(pluginDir2, name, resolveRegistryRepo, git) {
11553
11566
  if (record?.sha && isFetchableUrl(record.origin)) {
11554
11567
  return checkViaProvenance(name, record, record.origin, git);
11555
11568
  }
11556
- const localOrigin = record && !isFetchableUrl(record.origin) && existsSync38(record.origin) ? record.origin : null;
11569
+ const localOrigin = record && !isFetchableUrl(record.origin) && existsSync39(record.origin) ? record.origin : null;
11557
11570
  if (localOrigin) {
11558
11571
  return checkViaContentDiff(name, pluginDir2, localOrigin, { isLocalDir: true }, git);
11559
11572
  }
@@ -11705,8 +11718,8 @@ async function countDifferingFiles(sourceDir, pluginDir2) {
11705
11718
  differing++;
11706
11719
  continue;
11707
11720
  }
11708
- const a = readFileSync28(join40(sourceDir, relPath));
11709
- const b = readFileSync28(join40(pluginDir2, relPath));
11721
+ const a = readFileSync28(join41(sourceDir, relPath));
11722
+ const b = readFileSync28(join41(pluginDir2, relPath));
11710
11723
  if (!a.equals(b)) differing++;
11711
11724
  }
11712
11725
  return differing;
@@ -11721,11 +11734,11 @@ function vendorFileList(dir) {
11721
11734
  return new Set(walkExcluding(dir, dir, LOCAL_COPY_EXCLUDES));
11722
11735
  }
11723
11736
  function walkExcluding(root, dir, excludes) {
11724
- if (!existsSync38(dir)) return [];
11737
+ if (!existsSync39(dir)) return [];
11725
11738
  const out = [];
11726
11739
  for (const entry of readdirSync14(dir)) {
11727
11740
  if (excludes.has(entry) || entry === ".git") continue;
11728
- const full = join40(dir, entry);
11741
+ const full = join41(dir, entry);
11729
11742
  let stat;
11730
11743
  try {
11731
11744
  stat = statSync9(full);
@@ -11782,8 +11795,8 @@ var pluginStalenessCommand = new Command18("staleness").description(
11782
11795
  });
11783
11796
 
11784
11797
  // src/commands/plugin-sync-migrations.ts
11785
- import { existsSync as existsSync39 } from "fs";
11786
- import { join as join41, relative as relative6, resolve as resolve17 } from "path";
11798
+ import { existsSync as existsSync40 } from "fs";
11799
+ import { join as join42, relative as relative6, resolve as resolve17 } from "path";
11787
11800
  import chalk17 from "chalk";
11788
11801
  import { Command as Command19 } from "commander";
11789
11802
  var pluginSyncMigrationsCommand = new Command19("sync-migrations").description(
@@ -11804,11 +11817,11 @@ var pluginSyncMigrationsCommand = new Command19("sync-migrations").description(
11804
11817
  }
11805
11818
  );
11806
11819
  async function runPluginSyncMigrations(name, options, deps) {
11807
- const servicesDir = join41(options.cwd, "services");
11808
- if (!existsSync39(servicesDir)) {
11820
+ const servicesDir = join42(options.cwd, "services");
11821
+ if (!existsSync40(servicesDir)) {
11809
11822
  throw new Error(`${servicesDir} does not exist \u2014 is ${options.cwd} a Biffo project checkout?`);
11810
11823
  }
11811
- if (name && !existsSync39(join41(servicesDir, name, "biffo.plugin.json"))) {
11824
+ if (name && !existsSync40(join42(servicesDir, name, "biffo.plugin.json"))) {
11812
11825
  throw new Error(`Plugin '${name}' is not installed at services/${name}/.`);
11813
11826
  }
11814
11827
  if (options.dryRun) {
@@ -11833,10 +11846,9 @@ async function runPluginSyncMigrations(name, options, deps) {
11833
11846
  if (!isRepo) {
11834
11847
  throw new Error(`${options.cwd} is not a git repository \u2014 cannot commit.`);
11835
11848
  }
11836
- await deps.git.add(options.cwd, relativePaths);
11837
11849
  const label = name ?? `${String(generated.length)} plugin(s)`;
11838
11850
  const commitMessage = `chore(plugins): sync migration(s) for ${label}`;
11839
- await deps.git.commit(options.cwd, commitMessage, relativePaths);
11851
+ await commitPluginChange(deps, options.cwd, relativePaths, commitMessage);
11840
11852
  log.success(`Committed: ${commitMessage}`);
11841
11853
  } else {
11842
11854
  log.warn("--no-commit: generated file(s) are on disk but not staged/committed.");
@@ -11844,8 +11856,8 @@ async function runPluginSyncMigrations(name, options, deps) {
11844
11856
  }
11845
11857
 
11846
11858
  // src/commands/plugin-uninstall.ts
11847
- import { existsSync as existsSync40, readFileSync as readFileSync29, rmSync as rmSync10 } from "fs";
11848
- import { join as join42, resolve as resolve18 } from "path";
11859
+ import { existsSync as existsSync41, readFileSync as readFileSync29, rmSync as rmSync10 } from "fs";
11860
+ import { join as join43, resolve as resolve18 } from "path";
11849
11861
  import chalk18 from "chalk";
11850
11862
  import { Command as Command20 } from "commander";
11851
11863
  import inquirer6 from "inquirer";
@@ -11877,16 +11889,16 @@ async function runPluginUninstall(name, options, deps) {
11877
11889
  if (!NAME_PATTERN2.test(name)) {
11878
11890
  throw new Error(`Invalid plugin name '${name}'. Expected a lowercase kebab-case slug.`);
11879
11891
  }
11880
- const servicesDir = join42(options.cwd, "services");
11881
- if (!existsSync40(servicesDir)) {
11892
+ const servicesDir = join43(options.cwd, "services");
11893
+ if (!existsSync41(servicesDir)) {
11882
11894
  throw new Error(
11883
11895
  `${servicesDir} does not exist \u2014 is ${options.cwd} the root of a Biffo project checkout?`
11884
11896
  );
11885
11897
  }
11886
- const targetDir = join42(servicesDir, name);
11887
- if (!existsSync40(targetDir)) {
11888
- const firstParty = join42(servicesDir, FIRST_PARTY_PLUGINS_DIR, name);
11889
- if (existsSync40(firstParty)) {
11898
+ const targetDir = join43(servicesDir, name);
11899
+ if (!existsSync41(targetDir)) {
11900
+ const firstParty = join43(servicesDir, FIRST_PARTY_PLUGINS_DIR, name);
11901
+ if (existsSync41(firstParty)) {
11890
11902
  throw new Error(
11891
11903
  `Plugin '${name}' is a first-party plugin at ${pluginDir(name, "first-party")}/, which is template-owned \u2014 \`biffo core upgrade\` would restore it on the next upgrade. Disable it instead by removing '${name}' from \`enabled_plugins\` in infra/environments/<env>/main.tf and re-applying.`
11892
11904
  );
@@ -11895,9 +11907,9 @@ async function runPluginUninstall(name, options, deps) {
11895
11907
  }
11896
11908
  const installedManifest = readInstalledManifest(targetDir);
11897
11909
  const version = installedManifest?.version;
11898
- const modulesDir = join42(options.cwd, "modules", "plugins", name);
11910
+ const modulesDir = join43(options.cwd, "modules", "plugins", name);
11899
11911
  const stagePaths = [`services/${name}`];
11900
- if (existsSync40(modulesDir)) {
11912
+ if (existsSync41(modulesDir)) {
11901
11913
  stagePaths.push(`modules/plugins/${name}`);
11902
11914
  }
11903
11915
  const hasUserFrontend = installedManifest?.user_frontend !== void 0;
@@ -11924,7 +11936,7 @@ async function runPluginUninstall(name, options, deps) {
11924
11936
  if (hasUserFrontend) {
11925
11937
  assertPluginRegistryReady(options.cwd, name);
11926
11938
  }
11927
- if (existsSync40(modulesDir)) {
11939
+ if (existsSync41(modulesDir)) {
11928
11940
  const refs = findPluginModuleReferences(options.cwd, name).filter(
11929
11941
  (r) => !r.file.endsWith(`/${GENERATED_TF_FILE}`) && r.file !== GENERATED_TF_FILE
11930
11942
  );
@@ -11939,7 +11951,7 @@ Remove the reference(s) above first, then re-run uninstall.`
11939
11951
  }
11940
11952
  rmSync10(targetDir, { recursive: true, force: true });
11941
11953
  log.success(`Removed services/${name}/`);
11942
- if (existsSync40(modulesDir)) {
11954
+ if (existsSync41(modulesDir)) {
11943
11955
  rmSync10(modulesDir, { recursive: true, force: true });
11944
11956
  log.success(`Removed modules/plugins/${name}/`);
11945
11957
  const wiring = syncPluginTerraform(options.cwd);
@@ -11956,8 +11968,7 @@ Remove the reference(s) above first, then re-run uninstall.`
11956
11968
  }
11957
11969
  const label = version ? `${name}@${version}` : name;
11958
11970
  const commitMessage = `chore(plugins): uninstall ${label}`;
11959
- await deps.git.add(options.cwd, stagePaths);
11960
- await deps.git.commit(options.cwd, commitMessage, stagePaths);
11971
+ await commitPluginChange(deps, options.cwd, stagePaths, commitMessage);
11961
11972
  log.success(`Committed: ${commitMessage}`);
11962
11973
  console.log(chalk18.bold("\n Plugin uninstalled!\n"));
11963
11974
  console.log(` services/${name}/ has been removed and committed.`);
@@ -11978,15 +11989,15 @@ Remove the reference(s) above first, then re-run uninstall.`
11978
11989
  "Any tables this plugin created remain in the database, and its migration file at services/api/migrations/versions/ is NOT removed (it is a permanent historical record \u2014 see notes). Dropping tables, if desired, requires a manual Alembic migration written against the Core API."
11979
11990
  );
11980
11991
  }
11981
- if (existsSync40(join42(options.cwd, pluginSeedImportDir(name)))) {
11992
+ if (existsSync41(join43(options.cwd, pluginSeedImportDir(name)))) {
11982
11993
  log.warn(
11983
11994
  `${pluginSeedImportDir(name)}/ (this plugin's vendored baseline-row seed, biffo-template#1554) was NOT removed either, for the same reason \u2014 see notes. Delete it by hand if you are certain the rows it applied should go too, but note nothing drops rows already applied to the database; that still needs a manual migration.`
11984
11995
  );
11985
11996
  }
11986
11997
  }
11987
11998
  function readInstalledManifest(targetDir) {
11988
- const manifestPath = join42(targetDir, "biffo.plugin.json");
11989
- if (!existsSync40(manifestPath)) return void 0;
11999
+ const manifestPath = join43(targetDir, "biffo.plugin.json");
12000
+ if (!existsSync41(manifestPath)) return void 0;
11990
12001
  try {
11991
12002
  return validateManifest(JSON.parse(readFileSync29(manifestPath, "utf8")));
11992
12003
  } catch {
@@ -12021,8 +12032,8 @@ function printDryRun5(name, version, stagePaths, keepData) {
12021
12032
  }
12022
12033
 
12023
12034
  // src/commands/plugin-upgrade.ts
12024
- import { cpSync as cpSync6, existsSync as existsSync41, mkdirSync as mkdirSync13, readFileSync as readFileSync30, rmSync as rmSync11 } from "fs";
12025
- import { join as join43, relative as relative7, resolve as resolve19 } from "path";
12035
+ import { cpSync as cpSync6, existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as readFileSync30, rmSync as rmSync11 } from "fs";
12036
+ import { join as join44, relative as relative7, resolve as resolve19 } from "path";
12026
12037
  import chalk19 from "chalk";
12027
12038
  import { Command as Command21 } from "commander";
12028
12039
  import inquirer7 from "inquirer";
@@ -12069,8 +12080,8 @@ async function runPluginUpgrade(target, options, deps) {
12069
12080
  `Nothing to upgrade. Pass a registry target (e.g. \`biffo plugin upgrade acme-crm@1.1\`) or a local checkout to refresh from (\`biffo plugin upgrade --local ../acme-crm\`).`
12070
12081
  );
12071
12082
  }
12072
- const servicesDir = join43(options.cwd, "services");
12073
- if (!existsSync41(servicesDir)) {
12083
+ const servicesDir = join44(options.cwd, "services");
12084
+ if (!existsSync42(servicesDir)) {
12074
12085
  throw new Error(
12075
12086
  `${servicesDir} does not exist \u2014 is ${options.cwd} the root of a Biffo project checkout?`
12076
12087
  );
@@ -12079,8 +12090,8 @@ async function runPluginUpgrade(target, options, deps) {
12079
12090
  return runLocalPluginRefresh(options.local, options, deps);
12080
12091
  }
12081
12092
  const { name, minor } = parsePluginTarget(target);
12082
- const targetDir = join43(servicesDir, name);
12083
- if (!existsSync41(targetDir)) {
12093
+ const targetDir = join44(servicesDir, name);
12094
+ if (!existsSync42(targetDir)) {
12084
12095
  throw new Error(
12085
12096
  `Plugin '${name}' is not installed at services/${name}/. Use 'biffo plugin install ${name}@${minor}' instead.`
12086
12097
  );
@@ -12094,7 +12105,7 @@ async function runPluginUpgrade(target, options, deps) {
12094
12105
  `Plugin declares required_core_version '${entry.required_core_version}'. The CLI cannot verify this against your deployment \u2014 the Core API exposes no version endpoint and services/api/pyproject.toml's version is a static placeholder, not a real release marker. Confirm compatibility yourself before deploying.`
12095
12106
  );
12096
12107
  }
12097
- const modulesDir = join43(options.cwd, "modules", "plugins", entry.name);
12108
+ const modulesDir = join44(options.cwd, "modules", "plugins", entry.name);
12098
12109
  if (options.dryRun) {
12099
12110
  printDryRun6(entry, currentVersion);
12100
12111
  return;
@@ -12122,11 +12133,11 @@ async function runPluginUpgrade(target, options, deps) {
12122
12133
  log.success(
12123
12134
  `Manifest valid \u2014 ${manifest.tables.length} table(s), ${manifest.api_routes.length} route(s)`
12124
12135
  );
12125
- const retiredShapeReasons = findRetiredFrontendShape(join43(tmpDir, "terraform"));
12136
+ const retiredShapeReasons = findRetiredFrontendShape(join44(tmpDir, "terraform"));
12126
12137
  if (retiredShapeReasons.length > 0) {
12127
12138
  throw new Error(retiredFrontendShapeError(entry.name, retiredShapeReasons));
12128
12139
  }
12129
- if (!existsSync41(join43(tmpDir, "terraform"))) {
12140
+ if (!existsSync42(join44(tmpDir, "terraform"))) {
12130
12141
  refuseIfModuleStillReferenced(options.cwd, modulesDir, entry.name);
12131
12142
  }
12132
12143
  const previousProvenance = readProvenance(targetDir);
@@ -12143,11 +12154,11 @@ async function runPluginUpgrade(target, options, deps) {
12143
12154
  applyWorkspaceSources(targetDir, options.cwd, `services/${entry.name}`);
12144
12155
  const newPyproject = readPyprojectIfPresent(targetDir);
12145
12156
  const stagePaths = [`services/${entry.name}`];
12146
- if (existsSync41(modulesDir)) {
12157
+ if (existsSync42(modulesDir)) {
12147
12158
  rmSync11(modulesDir, { recursive: true, force: true });
12148
12159
  }
12149
- const tfSourceDir = join43(targetDir, "terraform");
12150
- if (existsSync41(tfSourceDir)) {
12160
+ const tfSourceDir = join44(targetDir, "terraform");
12161
+ if (existsSync42(tfSourceDir)) {
12151
12162
  mkdirSync13(modulesDir, { recursive: true });
12152
12163
  cpSync6(tfSourceDir, modulesDir, { recursive: true });
12153
12164
  stagePaths.push(`modules/plugins/${entry.name}`);
@@ -12208,16 +12219,16 @@ async function runPluginUpgrade(target, options, deps) {
12208
12219
  async function runLocalPluginRefresh(localPath, options, deps) {
12209
12220
  const source = resolveLocalPlugin(localPath);
12210
12221
  log.success(`Resolved ${source.name}@${source.version} from ${source.origin}`);
12211
- const servicesDir = join43(options.cwd, "services");
12212
- const targetDir = join43(servicesDir, source.name);
12213
- if (!existsSync41(targetDir)) {
12222
+ const servicesDir = join44(options.cwd, "services");
12223
+ const targetDir = join44(servicesDir, source.name);
12224
+ if (!existsSync42(targetDir)) {
12214
12225
  throw new Error(
12215
12226
  `Plugin '${source.name}' is not installed at services/${source.name}/. Use 'biffo plugin install --local ${localPath}' instead.`
12216
12227
  );
12217
12228
  }
12218
12229
  const inTreeSource = resolve19(source.sourceDir) === resolve19(targetDir);
12219
12230
  const currentVersion = readInstalledVersion(targetDir);
12220
- const modulesDir = join43(options.cwd, "modules", "plugins", source.name);
12231
+ const modulesDir = join44(options.cwd, "modules", "plugins", source.name);
12221
12232
  if (options.dryRun) {
12222
12233
  printLocalDryRun(source, currentVersion, inTreeSource);
12223
12234
  return;
@@ -12240,11 +12251,11 @@ async function runLocalPluginRefresh(localPath, options, deps) {
12240
12251
  log.success(
12241
12252
  `Manifest valid \u2014 ${manifest.tables.length} table(s), ${manifest.api_routes.length} route(s)`
12242
12253
  );
12243
- const retiredShapeReasons = findRetiredFrontendShape(join43(source.sourceDir, "terraform"));
12254
+ const retiredShapeReasons = findRetiredFrontendShape(join44(source.sourceDir, "terraform"));
12244
12255
  if (retiredShapeReasons.length > 0) {
12245
12256
  throw new Error(retiredFrontendShapeError(source.name, retiredShapeReasons));
12246
12257
  }
12247
- if (!existsSync41(join43(source.sourceDir, "terraform"))) {
12258
+ if (!existsSync42(join44(source.sourceDir, "terraform"))) {
12248
12259
  refuseIfModuleStillReferenced(options.cwd, modulesDir, source.name);
12249
12260
  }
12250
12261
  const previousProvenance = readProvenance(targetDir);
@@ -12264,11 +12275,11 @@ async function runLocalPluginRefresh(localPath, options, deps) {
12264
12275
  applyWorkspaceSources(targetDir, options.cwd, `services/${source.name}`);
12265
12276
  const newPyproject = readPyprojectIfPresent(targetDir);
12266
12277
  const stagePaths = [`services/${source.name}`];
12267
- if (existsSync41(modulesDir)) {
12278
+ if (existsSync42(modulesDir)) {
12268
12279
  rmSync11(modulesDir, { recursive: true, force: true });
12269
12280
  }
12270
- const tfSourceDir = join43(targetDir, "terraform");
12271
- if (existsSync41(tfSourceDir)) {
12281
+ const tfSourceDir = join44(targetDir, "terraform");
12282
+ if (existsSync42(tfSourceDir)) {
12272
12283
  mkdirSync13(modulesDir, { recursive: true });
12273
12284
  cpSync6(tfSourceDir, modulesDir, { recursive: true });
12274
12285
  stagePaths.push(`modules/plugins/${source.name}`);
@@ -12332,7 +12343,7 @@ async function runLocalPluginRefresh(localPath, options, deps) {
12332
12343
  }
12333
12344
  }
12334
12345
  function refuseIfModuleStillReferenced(cwd, modulesDir, name) {
12335
- if (!existsSync41(modulesDir)) return;
12346
+ if (!existsSync42(modulesDir)) return;
12336
12347
  const refs = findPluginModuleReferences(cwd, name);
12337
12348
  if (refs.length === 0) return;
12338
12349
  const refList = refs.map((r) => ` ${r.file}:${r.line} ${r.text}`).join("\n");
@@ -12393,8 +12404,8 @@ var defaultRunCommand2 = async (command, cwd) => {
12393
12404
  }
12394
12405
  };
12395
12406
  function readPyprojectIfPresent(targetDir) {
12396
- const path = join43(targetDir, "pyproject.toml");
12397
- return existsSync41(path) ? readFileSync30(path, "utf8") : null;
12407
+ const path = join44(targetDir, "pyproject.toml");
12408
+ return existsSync42(path) ? readFileSync30(path, "utf8") : null;
12398
12409
  }
12399
12410
  function dependenciesChanged(before, after) {
12400
12411
  if (before === after) return false;
@@ -12422,8 +12433,8 @@ function tomlTableBody(text, header) {
12422
12433
  return nextHeader ? rest.slice(0, nextHeader.index) : rest;
12423
12434
  }
12424
12435
  function readInstalledVersion(targetDir) {
12425
- const manifestPath = join43(targetDir, "biffo.plugin.json");
12426
- if (!existsSync41(manifestPath)) return void 0;
12436
+ const manifestPath = join44(targetDir, "biffo.plugin.json");
12437
+ if (!existsSync42(manifestPath)) return void 0;
12427
12438
  try {
12428
12439
  return validateManifest(JSON.parse(readFileSync30(manifestPath, "utf8"))).version;
12429
12440
  } catch {
@@ -12645,7 +12656,7 @@ pluginCommand.addCommand(pluginVerifyCommand);
12645
12656
  import { Command as Command25 } from "commander";
12646
12657
 
12647
12658
  // src/commands/sibling-check-identity.ts
12648
- import { existsSync as existsSync42, readFileSync as readFileSync31 } from "fs";
12659
+ import { existsSync as existsSync43, readFileSync as readFileSync31 } from "fs";
12649
12660
  import { resolve as resolve21 } from "path";
12650
12661
  import chalk20 from "chalk";
12651
12662
  import { Command as Command24 } from "commander";
@@ -12859,7 +12870,7 @@ async function resolveConfig4(options) {
12859
12870
  return cfg;
12860
12871
  }
12861
12872
  const localConfigPath = resolve21(process.cwd(), "biffo.config.json");
12862
- if (existsSync42(localConfigPath)) {
12873
+ if (existsSync43(localConfigPath)) {
12863
12874
  const raw = JSON.parse(readFileSync31(localConfigPath, "utf8"));
12864
12875
  const result = BiffoConfigSchema.safeParse(raw);
12865
12876
  if (result.success) return result.data;
@@ -12906,18 +12917,18 @@ siblingCommand.addCommand(siblingCheckIdentityCommand);
12906
12917
  import { Command as Command26 } from "commander";
12907
12918
 
12908
12919
  // src/scripts/check-adr-numbering.ts
12909
- import { existsSync as existsSync44 } from "fs";
12910
- import { join as join45 } from "path";
12920
+ import { existsSync as existsSync45 } from "fs";
12921
+ import { join as join46 } from "path";
12911
12922
 
12912
12923
  // src/lib/adr-numbering-guard.ts
12913
- import { existsSync as existsSync43, readdirSync as readdirSync15, readFileSync as readFileSync32 } from "fs";
12914
- import { join as join44 } from "path";
12924
+ import { existsSync as existsSync44, readdirSync as readdirSync15, readFileSync as readFileSync32 } from "fs";
12925
+ import { join as join45 } from "path";
12915
12926
  var ADR_FILENAME = /^(\d{4})-.+\.md$/;
12916
12927
  var ALLOWLIST_FILENAME = ".numbering-allowlist";
12917
12928
  var TEMPLATE_ADR_RESERVED_UPTO = "0099";
12918
12929
  function readAdrNumberingAllowlist(adrDir) {
12919
- const path = join44(adrDir, ALLOWLIST_FILENAME);
12920
- if (!existsSync43(path)) return /* @__PURE__ */ new Set();
12930
+ const path = join45(adrDir, ALLOWLIST_FILENAME);
12931
+ if (!existsSync44(path)) return /* @__PURE__ */ new Set();
12921
12932
  const numbers = /* @__PURE__ */ new Set();
12922
12933
  for (const rawLine of readFileSync32(path, "utf8").split("\n")) {
12923
12934
  const line = rawLine.split("#")[0].trim();
@@ -12927,7 +12938,7 @@ function readAdrNumberingAllowlist(adrDir) {
12927
12938
  }
12928
12939
  function adrNumbersIn(adrDir) {
12929
12940
  const claims = /* @__PURE__ */ new Map();
12930
- if (!existsSync43(adrDir)) return claims;
12941
+ if (!existsSync44(adrDir)) return claims;
12931
12942
  for (const entry of readdirSync15(adrDir).sort()) {
12932
12943
  const match = ADR_FILENAME.exec(entry);
12933
12944
  if (!match) continue;
@@ -12982,8 +12993,8 @@ function formatAdrReservedRangeViolations(violations, reservedUpTo = TEMPLATE_AD
12982
12993
  // src/scripts/check-adr-numbering.ts
12983
12994
  async function runAdrNumberingCheck() {
12984
12995
  const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
12985
- const adrDir = join45(root, "docs", "ADR");
12986
- if (!existsSync44(adrDir)) {
12996
+ const adrDir = join46(root, "docs", "ADR");
12997
+ if (!existsSync45(adrDir)) {
12987
12998
  console.log("\u2713 ADR numbering guard: no docs/ADR/ directory \u2014 nothing to compare");
12988
12999
  return;
12989
13000
  }
@@ -13022,7 +13033,7 @@ Already accepted? List it in docs/ADR/${ALLOWLIST_FILENAME} instead of leaving t
13022
13033
 
13023
13034
  // src/lib/api-gateway-integration-guard.ts
13024
13035
  import { readFileSync as readFileSync33, readdirSync as readdirSync16, statSync as statSync10 } from "fs";
13025
- import { join as join46 } from "path";
13036
+ import { join as join47 } from "path";
13026
13037
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", ".terraform", ".worktrees", "dist"]);
13027
13038
  var MODULE_TYPE = "module";
13028
13039
  var INTEGRATION_TYPE = "aws_apigatewayv2_integration";
@@ -13104,7 +13115,7 @@ function walkTerraformFiles(root) {
13104
13115
  return;
13105
13116
  }
13106
13117
  for (const entry of entries) {
13107
- const p = join46(dir, entry);
13118
+ const p = join47(dir, entry);
13108
13119
  let st;
13109
13120
  try {
13110
13121
  st = statSync10(p);
@@ -13520,17 +13531,17 @@ async function runBranchProtectionCheck(explicitRepo, options = {}) {
13520
13531
  }
13521
13532
 
13522
13533
  // src/lib/claim-invocation-parity.ts
13523
- import { existsSync as existsSync45, readFileSync as readFileSync34, readdirSync as readdirSync17 } from "fs";
13524
- import { join as join47 } from "path";
13534
+ import { existsSync as existsSync46, readFileSync as readFileSync34, readdirSync as readdirSync17 } from "fs";
13535
+ import { join as join48 } from "path";
13525
13536
  function distributedAgentsDocs(root) {
13526
13537
  const docs = [];
13527
- const own = join47(root, "AGENTS.md");
13528
- if (existsSync45(own)) docs.push({ path: "AGENTS.md", text: readFileSync34(own, "utf8") });
13529
- const skeletons = join47(root, "_skeletons");
13530
- if (existsSync45(skeletons)) {
13538
+ const own = join48(root, "AGENTS.md");
13539
+ if (existsSync46(own)) docs.push({ path: "AGENTS.md", text: readFileSync34(own, "utf8") });
13540
+ const skeletons = join48(root, "_skeletons");
13541
+ if (existsSync46(skeletons)) {
13531
13542
  for (const name of readdirSync17(skeletons).sort()) {
13532
- const abs = join47(skeletons, name, "AGENTS.md");
13533
- if (!existsSync45(abs)) continue;
13543
+ const abs = join48(skeletons, name, "AGENTS.md");
13544
+ if (!existsSync46(abs)) continue;
13534
13545
  docs.push({ path: `_skeletons/${name}/AGENTS.md`, text: readFileSync34(abs, "utf8") });
13535
13546
  }
13536
13547
  }
@@ -13663,12 +13674,12 @@ async function runClaimInvocationCheck() {
13663
13674
  }
13664
13675
 
13665
13676
  // src/scripts/check-codeql-suppression.ts
13666
- import { existsSync as existsSync46 } from "fs";
13667
- import { join as join49, relative as relative8 } from "path";
13677
+ import { existsSync as existsSync47 } from "fs";
13678
+ import { join as join50, relative as relative8 } from "path";
13668
13679
 
13669
13680
  // src/lib/codeql-suppression-guard.ts
13670
13681
  import { readdirSync as readdirSync18, readFileSync as readFileSync35, statSync as statSync11 } from "fs";
13671
- import { join as join48 } from "path";
13682
+ import { join as join49 } from "path";
13672
13683
  var SKIP_DIRS2 = /* @__PURE__ */ new Set([
13673
13684
  ".git",
13674
13685
  ".worktrees",
@@ -13699,7 +13710,7 @@ function walkSourceFiles(root) {
13699
13710
  return;
13700
13711
  }
13701
13712
  for (const entry of entries) {
13702
- const p = join48(dir, entry);
13713
+ const p = join49(dir, entry);
13703
13714
  let st;
13704
13715
  try {
13705
13716
  st = statSync11(p);
@@ -13736,8 +13747,8 @@ function sweepCodeqlSuppressionComments(root) {
13736
13747
  // src/scripts/check-codeql-suppression.ts
13737
13748
  async function runCodeqlSuppressionCheck() {
13738
13749
  const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
13739
- const scanRoot = join49(root, "cli", "src");
13740
- if (!existsSync46(scanRoot)) {
13750
+ const scanRoot = join50(root, "cli", "src");
13751
+ if (!existsSync47(scanRoot)) {
13741
13752
  console.log(
13742
13753
  "\u2014 codeql-suppression guard: skipped \u2014 no cli/src in this repo, so there is no CLI source to scan."
13743
13754
  );
@@ -13761,12 +13772,12 @@ async function runCodeqlSuppressionCheck() {
13761
13772
  }
13762
13773
 
13763
13774
  // src/scripts/check-cognito-invite-template.ts
13764
- import { existsSync as existsSync47 } from "fs";
13765
- import { join as join51 } from "path";
13775
+ import { existsSync as existsSync48 } from "fs";
13776
+ import { join as join52 } from "path";
13766
13777
 
13767
13778
  // src/lib/cognito-invite-template-guard.ts
13768
13779
  import { readdirSync as readdirSync19, readFileSync as readFileSync36, statSync as statSync12 } from "fs";
13769
- import { join as join50 } from "path";
13780
+ import { join as join51 } from "path";
13770
13781
  var REQUIRED_INVITE_MEMBERS = ["email_subject", "email_message", "sms_message"];
13771
13782
  var REQUIRED_INVITE_PLACEHOLDERS = ["{username}", "{####}"];
13772
13783
  var PLACEHOLDER_MEMBERS = ["email_message", "sms_message"];
@@ -13850,7 +13861,7 @@ function findModuleTerraformFiles(repoRoot) {
13850
13861
  for (const entry of entries) {
13851
13862
  if (entry === "node_modules" || entry === ".git" || entry === ".worktrees" || entry === ".venv")
13852
13863
  continue;
13853
- const full = join50(dir, entry);
13864
+ const full = join51(dir, entry);
13854
13865
  const rel = `${relative11}/${entry}`;
13855
13866
  let isDir;
13856
13867
  try {
@@ -13865,12 +13876,12 @@ function findModuleTerraformFiles(repoRoot) {
13865
13876
  }
13866
13877
  }
13867
13878
  };
13868
- walk2(join50(repoRoot, "modules"), "modules");
13879
+ walk2(join51(repoRoot, "modules"), "modules");
13869
13880
  return found.sort();
13870
13881
  }
13871
13882
  function checkCognitoInviteTemplates(repoRoot) {
13872
13883
  return findModuleTerraformFiles(repoRoot).flatMap(
13873
- (file) => checkInviteTemplateSource(file, readFileSync36(join50(repoRoot, file), "utf8"))
13884
+ (file) => checkInviteTemplateSource(file, readFileSync36(join51(repoRoot, file), "utf8"))
13874
13885
  );
13875
13886
  }
13876
13887
 
@@ -13880,7 +13891,7 @@ async function runCognitoInviteTemplateCheck() {
13880
13891
  const files = findModuleTerraformFiles(root);
13881
13892
  console.log(`audited ${files.length} .tf file(s) under modules/ under ${root}`);
13882
13893
  if (files.length === 0) {
13883
- if (!existsSync47(join51(root, "modules"))) {
13894
+ if (!existsSync48(join52(root, "modules"))) {
13884
13895
  console.log(
13885
13896
  `\xB7 Cognito invite template guard: not applicable \u2014 no modules/ directory under ${root} \u2014 this is not a template/instance tree (a satellite repo never carries the template-owned Terraform modules). Skipping.`
13886
13897
  );
@@ -13904,11 +13915,11 @@ async function runCognitoInviteTemplateCheck() {
13904
13915
  }
13905
13916
 
13906
13917
  // src/scripts/check-core-direct-paths.ts
13907
- import { join as join53 } from "path";
13918
+ import { join as join54 } from "path";
13908
13919
 
13909
13920
  // src/lib/core-direct-paths-audit.ts
13910
- import { existsSync as existsSync48, readFileSync as readFileSync37, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
13911
- import { join as join52 } from "path";
13921
+ import { existsSync as existsSync49, readFileSync as readFileSync37, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
13922
+ import { join as join53 } from "path";
13912
13923
  var EXTERNAL_BASE_IDENTIFIERS = ["CORE_API_URL"];
13913
13924
  var API_ROUTE_PREFIX = "/api/v1";
13914
13925
  var TEST_FILE_SUFFIXES = [".test.ts", ".test.tsx", ".spec.ts", ".spec.tsx"];
@@ -14072,7 +14083,7 @@ function walkFiles(root, accept, skipDir) {
14072
14083
  return;
14073
14084
  }
14074
14085
  for (const entry of entries) {
14075
- const p = join52(dir, entry);
14086
+ const p = join53(dir, entry);
14076
14087
  let st;
14077
14088
  try {
14078
14089
  st = statSync13(p);
@@ -14167,7 +14178,7 @@ function pathMatchesAnyCorePrefix(normalized, corePrefixes, apiRoutePrefix = API
14167
14178
  }
14168
14179
  function resolveSiblingCoreSrc(params) {
14169
14180
  const { estateDir, sibling } = params;
14170
- const configPath = join52(estateDir, sibling, "biffo.sibling.json");
14181
+ const configPath = join53(estateDir, sibling, "biffo.sibling.json");
14171
14182
  let raw;
14172
14183
  try {
14173
14184
  raw = readFileSync37(configPath, "utf8");
@@ -14190,8 +14201,8 @@ function resolveSiblingCoreSrc(params) {
14190
14201
  `cannot resolve ${sibling}'s core: ${configPath} has no non-empty "core_project" field.`
14191
14202
  );
14192
14203
  }
14193
- const coreApiSrcDir = join52(estateDir, coreProject, "services", "api", "src");
14194
- if (!existsSync48(coreApiSrcDir)) {
14204
+ const coreApiSrcDir = join53(estateDir, coreProject, "services", "api", "src");
14205
+ if (!existsSync49(coreApiSrcDir)) {
14195
14206
  throw new Error(
14196
14207
  `cannot resolve ${sibling}'s core: biffo.sibling.json names core_project "${coreProject}", but ${coreApiSrcDir} does not exist -- the instance is missing from this estate checkout, not merely unmatched. Refusing to silently skip ${sibling} and shrink the audit's denominator.`
14197
14208
  );
@@ -14244,7 +14255,7 @@ async function runCoreDirectPathsCheck(opts = {}) {
14244
14255
  }
14245
14256
  }
14246
14257
  const sibling = opts.sibling ?? "sibling-template (self-check)";
14247
- const frontendSrcDir = opts.frontendSrc ?? join53(root, "_skeletons", "sibling-template", "apps", "frontend", "src");
14258
+ const frontendSrcDir = opts.frontendSrc ?? join54(root, "_skeletons", "sibling-template", "apps", "frontend", "src");
14248
14259
  let coreApiSrcDir;
14249
14260
  let coreProject = null;
14250
14261
  if (opts.coreSrc) {
@@ -14260,7 +14271,7 @@ async function runCoreDirectPathsCheck(opts = {}) {
14260
14271
  coreApiSrcDir = resolution.coreApiSrcDir;
14261
14272
  coreProject = resolution.coreProject;
14262
14273
  } else {
14263
- coreApiSrcDir = join53(root, "services", "api", "src");
14274
+ coreApiSrcDir = join54(root, "services", "api", "src");
14264
14275
  }
14265
14276
  const report = auditSiblingCoreDirectPaths({ sibling, frontendSrcDir, coreApiSrcDir });
14266
14277
  console.log(
@@ -14387,8 +14398,8 @@ async function runOwnershipCheck(argv) {
14387
14398
  const { stdout } = await execa("git", ["diff", "--cached", "--name-status"], { cwd: root });
14388
14399
  ({ changed: changedFiles, deleted: deletedFiles } = parseNameStatus(stdout));
14389
14400
  if (messageFile) {
14390
- const { readFileSync: readFileSync51, existsSync: existsSync62 } = await import("fs");
14391
- if (existsSync62(messageFile)) commitMessage = readFileSync51(messageFile, "utf8");
14401
+ const { readFileSync: readFileSync51, existsSync: existsSync63 } = await import("fs");
14402
+ if (existsSync63(messageFile)) commitMessage = readFileSync51(messageFile, "utf8");
14392
14403
  }
14393
14404
  } else {
14394
14405
  const base = process.env["GITHUB_BASE_REF"] ?? args[0];
@@ -14511,16 +14522,16 @@ ${BOLD}If the divergence is deliberate${OFF}
14511
14522
  }
14512
14523
 
14513
14524
  // src/scripts/check-distribution-inventory.ts
14514
- import { existsSync as existsSync50 } from "fs";
14515
- import { join as join55 } from "path";
14525
+ import { existsSync as existsSync51 } from "fs";
14526
+ import { join as join56 } from "path";
14516
14527
 
14517
14528
  // src/lib/distribution-inventory.ts
14518
- import { existsSync as existsSync49, readFileSync as readFileSync38 } from "fs";
14519
- import { join as join54 } from "path";
14529
+ import { existsSync as existsSync50, readFileSync as readFileSync38 } from "fs";
14530
+ import { join as join55 } from "path";
14520
14531
  var INVENTORY_FILENAME = "distribution-inventory.json";
14521
14532
  function loadDistributionInventory(root) {
14522
- const path = join54(root, INVENTORY_FILENAME);
14523
- if (!existsSync49(path)) {
14533
+ const path = join55(root, INVENTORY_FILENAME);
14534
+ if (!existsSync50(path)) {
14524
14535
  throw new Error(
14525
14536
  `${INVENTORY_FILENAME} not found at ${root} -- expected it beside core-manifest.json`
14526
14537
  );
@@ -14685,7 +14696,7 @@ async function runDistributionInventoryCheck(root) {
14685
14696
  );
14686
14697
  return;
14687
14698
  }
14688
- if (!existsSync50(join55(repoRoot, INVENTORY_FILENAME))) {
14699
+ if (!existsSync51(join56(repoRoot, INVENTORY_FILENAME))) {
14689
14700
  console.log(
14690
14701
  `\u2713 distribution-inventory: skipped \u2014 no ${INVENTORY_FILENAME} at ${repoRoot}. This is a template-only registry; a checkout that legitimately has none has nothing for this guard to check.`
14691
14702
  );
@@ -14711,7 +14722,7 @@ async function runDistributionInventoryCheck(root) {
14711
14722
  }
14712
14723
 
14713
14724
  // src/scripts/check-distribution-remote-state.ts
14714
- import { join as join56 } from "path";
14725
+ import { join as join57 } from "path";
14715
14726
  async function ghExecCommand(file, args) {
14716
14727
  const result = await execa(file, args, { reject: false });
14717
14728
  return { stdout: String(result.stdout ?? ""), exitCode: result.exitCode ?? null };
@@ -14726,7 +14737,7 @@ async function runDistributionRemoteStateCheck(root) {
14726
14737
  }
14727
14738
  }
14728
14739
  console.log(
14729
- `distribution-remote-state: examined ${assertions.length} remote content assertion(s) declared across ${inventory.entries.length} inventory entries (${join56(repoRoot, "distribution-inventory.json")})`
14740
+ `distribution-remote-state: examined ${assertions.length} remote content assertion(s) declared across ${inventory.entries.length} inventory entries (${join57(repoRoot, "distribution-inventory.json")})`
14730
14741
  );
14731
14742
  if (assertions.length === 0) {
14732
14743
  console.log("\u2713 distribution-remote-state: nothing declared to check");
@@ -14772,7 +14783,7 @@ ${assertion.ref}`;
14772
14783
 
14773
14784
  // src/lib/eventbridge-log-permission-guard.ts
14774
14785
  import { readFileSync as readFileSync39, readdirSync as readdirSync21, statSync as statSync14 } from "fs";
14775
- import { join as join57 } from "path";
14786
+ import { join as join58 } from "path";
14776
14787
  var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", ".git", ".terraform", ".worktrees", "dist"]);
14777
14788
  var EVENT_TARGET_TYPE = "aws_cloudwatch_event_target";
14778
14789
  var LOG_RESOURCE_POLICY_TYPE = "aws_cloudwatch_log_resource_policy";
@@ -14849,7 +14860,7 @@ function walkTerraformFiles2(root) {
14849
14860
  return;
14850
14861
  }
14851
14862
  for (const entry of entries) {
14852
- const p = join57(dir, entry);
14863
+ const p = join58(dir, entry);
14853
14864
  let st;
14854
14865
  try {
14855
14866
  st = statSync14(p);
@@ -14989,8 +15000,8 @@ async function runEventBridgeLogPermissionCheck() {
14989
15000
  }
14990
15001
 
14991
15002
  // src/scripts/check-instance-adoption.ts
14992
- import { existsSync as existsSync51 } from "fs";
14993
- import { join as join58 } from "path";
15003
+ import { existsSync as existsSync52 } from "fs";
15004
+ import { join as join59 } from "path";
14994
15005
  async function runInstanceAdoptionCheck(opts = {}) {
14995
15006
  if (!opts.instanceDir) {
14996
15007
  console.error(
@@ -14998,7 +15009,7 @@ async function runInstanceAdoptionCheck(opts = {}) {
14998
15009
  );
14999
15010
  process.exit(2);
15000
15011
  }
15001
- if (!existsSync51(opts.instanceDir)) {
15012
+ if (!existsSync52(opts.instanceDir)) {
15002
15013
  console.error(
15003
15014
  `\u2717 instance-adoption guard: --instance-dir ${opts.instanceDir} does not exist \u2014 cannot tell whether it is adopted, and that is not the same as a clean pass.`
15004
15015
  );
@@ -15006,7 +15017,7 @@ async function runInstanceAdoptionCheck(opts = {}) {
15006
15017
  }
15007
15018
  const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
15008
15019
  const theirsDir = opts.theirsDir ?? root;
15009
- const instanceLabel = opts.instance ?? join58(opts.instanceDir).split("/").filter(Boolean).pop();
15020
+ const instanceLabel = opts.instance ?? join59(opts.instanceDir).split("/").filter(Boolean).pop();
15010
15021
  const report = checkInstanceAdoption(theirsDir, opts.instanceDir);
15011
15022
  console.log(
15012
15023
  `examined ${report.examinedInstances} instance (${instanceLabel}) against ${report.registeredPairs} registered pair(s), ${report.applicablePairs} applicable to this instance, against template tree ${theirsDir}`
@@ -15029,11 +15040,11 @@ async function runInstanceAdoptionCheck(opts = {}) {
15029
15040
 
15030
15041
  // src/lib/lambda-output-guard.ts
15031
15042
  import { readFileSync as readFileSync41 } from "fs";
15032
- import { join as join60 } from "path";
15043
+ import { join as join61 } from "path";
15033
15044
 
15034
15045
  // src/lib/terraform-input-guard.ts
15035
- import { existsSync as existsSync52, readdirSync as readdirSync22, readFileSync as readFileSync40, statSync as statSync15 } from "fs";
15036
- import { join as join59 } from "path";
15046
+ import { existsSync as existsSync53, readdirSync as readdirSync22, readFileSync as readFileSync40, statSync as statSync15 } from "fs";
15047
+ import { join as join60 } from "path";
15037
15048
  var GUARDED_SUBCOMMANDS = [
15038
15049
  "init",
15039
15050
  "plan",
@@ -15047,7 +15058,7 @@ function stripComments2(source) {
15047
15058
  return source.split("\n").map((line) => line.replace(/(^|\s)#.*$/, "$1")).join("\n");
15048
15059
  }
15049
15060
  function vendoredPluginServiceDirs(repoRoot) {
15050
- const servicesDir = join59(repoRoot, "services");
15061
+ const servicesDir = join60(repoRoot, "services");
15051
15062
  const result = /* @__PURE__ */ new Set();
15052
15063
  let entries;
15053
15064
  try {
@@ -15056,9 +15067,9 @@ function vendoredPluginServiceDirs(repoRoot) {
15056
15067
  return result;
15057
15068
  }
15058
15069
  for (const entry of entries) {
15059
- const full = join59(servicesDir, entry);
15060
- if (!existsSync52(full) || !statSync15(full).isDirectory()) continue;
15061
- if (existsSync52(join59(full, "biffo.plugin.json"))) {
15070
+ const full = join60(servicesDir, entry);
15071
+ if (!existsSync53(full) || !statSync15(full).isDirectory()) continue;
15072
+ if (existsSync53(join60(full, "biffo.plugin.json"))) {
15062
15073
  result.add(entry);
15063
15074
  }
15064
15075
  }
@@ -15080,7 +15091,7 @@ function findWorkflowFiles(repoRoot) {
15080
15091
  if (entry === ".github" && relative11.startsWith("services/") && vendoredPluginDirs.has(relative11.slice("services/".length))) {
15081
15092
  continue;
15082
15093
  }
15083
- const full = join59(dir, entry);
15094
+ const full = join60(dir, entry);
15084
15095
  const rel = relative11 ? `${relative11}/${entry}` : entry;
15085
15096
  let isDir;
15086
15097
  try {
@@ -15130,7 +15141,7 @@ function checkWorkflowSource(file, rawSource) {
15130
15141
  }
15131
15142
  function checkTerraformInput(repoRoot) {
15132
15143
  return findWorkflowFiles(repoRoot).flatMap(
15133
- (file) => checkWorkflowSource(file, readFileSync40(join59(repoRoot, file), "utf8"))
15144
+ (file) => checkWorkflowSource(file, readFileSync40(join60(repoRoot, file), "utf8"))
15134
15145
  );
15135
15146
  }
15136
15147
 
@@ -15188,7 +15199,7 @@ function checkWorkflowSource2(file, rawSource) {
15188
15199
  }
15189
15200
  function checkLambdaOutput(repoRoot) {
15190
15201
  return findWorkflowFiles(repoRoot).flatMap(
15191
- (file) => checkWorkflowSource2(file, readFileSync41(join60(repoRoot, file), "utf8"))
15202
+ (file) => checkWorkflowSource2(file, readFileSync41(join61(repoRoot, file), "utf8"))
15192
15203
  );
15193
15204
  }
15194
15205
 
@@ -15216,8 +15227,8 @@ async function runLambdaOutputCheck() {
15216
15227
  }
15217
15228
 
15218
15229
  // src/scripts/check-migration-body-change.ts
15219
- import { existsSync as existsSync53 } from "fs";
15220
- import { join as join61 } from "path";
15230
+ import { existsSync as existsSync54 } from "fs";
15231
+ import { join as join62 } from "path";
15221
15232
 
15222
15233
  // src/lib/migration-body-change-guard.ts
15223
15234
  function checkMigrationBodyChangeMarkers(diffs) {
@@ -15299,7 +15310,7 @@ async function runMigrationBodyChangeCheck(argv) {
15299
15310
  );
15300
15311
  return;
15301
15312
  }
15302
- if (!existsSync53(join61(root, MIGRATIONS_VERSIONS_DIR))) {
15313
+ if (!existsSync54(join62(root, MIGRATIONS_VERSIONS_DIR))) {
15303
15314
  console.log(`\u2713 migration body-change guard: no ${MIGRATIONS_VERSIONS_DIR} in this repo.`);
15304
15315
  return;
15305
15316
  }
@@ -15405,8 +15416,8 @@ ${BOLD2}What to do${OFF2}
15405
15416
  }
15406
15417
 
15407
15418
  // src/scripts/check-orphan-ratchet.ts
15408
- import { existsSync as existsSync54 } from "fs";
15409
- import { basename as basename3, join as join62 } from "path";
15419
+ import { existsSync as existsSync55 } from "fs";
15420
+ import { basename as basename3, join as join63 } from "path";
15410
15421
  function reportOrphan(entry, manifest) {
15411
15422
  console.error(` ${entry.path}`);
15412
15423
  const { templateOwnedMatch, nearestUserOwnedEntries } = explainOwnership(entry.path, manifest);
@@ -15428,7 +15439,7 @@ function reportOrphan(entry, manifest) {
15428
15439
  }
15429
15440
  }
15430
15441
  async function runOrphanRatchetCheck(opts = {}) {
15431
- if (opts.instanceDir !== void 0 && !existsSync54(opts.instanceDir)) {
15442
+ if (opts.instanceDir !== void 0 && !existsSync55(opts.instanceDir)) {
15432
15443
  console.error(
15433
15444
  `\u2717 orphan-ratchet guard: --instance-dir ${opts.instanceDir} does not exist \u2014 cannot tell whether it carries unsanctioned files, and that is not the same as a clean pass.`
15434
15445
  );
@@ -15445,7 +15456,7 @@ async function runOrphanRatchetCheck(opts = {}) {
15445
15456
  "self-check mode: --instance-dir was not given, so it defaulted to --theirs-dir (this repo's own root) alongside --base-dir \u2014 all three trees are the same, so this run can only ever find zero orphans by construction. See this script's doc comment. Pass a real instance tree with --instance-dir for a check that can actually find something. biffo-template#1714."
15446
15457
  );
15447
15458
  }
15448
- if (!existsSync54(join62(theirsDir, CORE_MANIFEST_FILE))) {
15459
+ if (!existsSync55(join63(theirsDir, CORE_MANIFEST_FILE))) {
15449
15460
  console.log(
15450
15461
  `orphan-ratchet guard (${label}): no ${CORE_MANIFEST_FILE} in ${theirsDir} \u2014 this is not a Biffo template/instance tree (a satellite repo never carries one), so there is no ownership manifest to classify paths against. Not applicable; skipping.`
15451
15462
  );
@@ -15477,7 +15488,7 @@ baseline was ${String(ratchet.baseline)}, now ${String(ratchet.count)}. See biff
15477
15488
 
15478
15489
  // src/lib/ownership-header-claim-guard.ts
15479
15490
  import { readFileSync as readFileSync42 } from "fs";
15480
- import { join as join63 } from "path";
15491
+ import { join as join64 } from "path";
15481
15492
  var OWNERSHIP_HEADER_SWEEP_DIRS = [
15482
15493
  "scripts",
15483
15494
  ".githooks",
@@ -15686,7 +15697,7 @@ function sweepOwnershipHeaderClaims(root, options = {}) {
15686
15697
  for (const rel of files) {
15687
15698
  let content;
15688
15699
  try {
15689
- content = readFileSync42(join63(root, rel), "utf8");
15700
+ content = readFileSync42(join64(root, rel), "utf8");
15690
15701
  } catch {
15691
15702
  continue;
15692
15703
  }
@@ -15762,7 +15773,7 @@ async function runOwnershipHeaderClaimCheck() {
15762
15773
 
15763
15774
  // src/scripts/check-pipe-trap.ts
15764
15775
  import { readFileSync as readFileSync43, readdirSync as readdirSync23 } from "fs";
15765
- import { join as join64, relative as relative9 } from "path";
15776
+ import { join as join65, relative as relative9 } from "path";
15766
15777
 
15767
15778
  // src/lib/pipe-trap-guard.ts
15768
15779
  var STATUS_BEARING = [
@@ -15858,7 +15869,7 @@ function findPipeTraps(source) {
15858
15869
  function shellFiles(root) {
15859
15870
  const out = [];
15860
15871
  for (const dir of ["scripts", ".githooks"]) {
15861
- const full = join64(root, dir);
15872
+ const full = join65(root, dir);
15862
15873
  let entries;
15863
15874
  try {
15864
15875
  entries = readdirSync23(full, { withFileTypes: true });
@@ -15868,7 +15879,7 @@ function shellFiles(root) {
15868
15879
  for (const entry of entries) {
15869
15880
  if (!entry.isFile()) continue;
15870
15881
  if (dir === "scripts" && !entry.name.endsWith(".sh")) continue;
15871
- out.push(join64(full, entry.name));
15882
+ out.push(join65(full, entry.name));
15872
15883
  }
15873
15884
  }
15874
15885
  return out;
@@ -15902,7 +15913,7 @@ async function runPipeTrapCheck() {
15902
15913
 
15903
15914
  // src/lib/plugin-allowlist-convention.ts
15904
15915
  import { readFileSync as readFileSync44 } from "fs";
15905
- import { join as join65 } from "path";
15916
+ import { join as join66 } from "path";
15906
15917
  var COMPUTE_MAIN_TF = "modules/cloud/aws/compute/main.tf";
15907
15918
  var PLUGIN_TEMPLATE_MAIN_TF = "modules/plugins/_template/main.tf";
15908
15919
  var ALLOWLIST_MAIN_TF = "modules/cloud/aws/plugin-allowlist/main.tf";
@@ -15913,7 +15924,7 @@ var PLUGIN = "<plugin>";
15913
15924
  var ACCOUNT = "<account>";
15914
15925
  function read(repoRoot, relative11) {
15915
15926
  try {
15916
- return readFileSync44(join65(repoRoot, relative11), "utf8");
15927
+ return readFileSync44(join66(repoRoot, relative11), "utf8");
15917
15928
  } catch {
15918
15929
  throw new Error(`plugin-allowlist drift guard: cannot read ${relative11}`);
15919
15930
  }
@@ -16041,32 +16052,32 @@ async function runPluginAllowlistConventionCheck() {
16041
16052
  }
16042
16053
 
16043
16054
  // src/scripts/check-plugin-collisions.ts
16044
- import { existsSync as existsSync56 } from "fs";
16045
- import { join as join67 } from "path";
16055
+ import { existsSync as existsSync57 } from "fs";
16056
+ import { join as join68 } from "path";
16046
16057
 
16047
16058
  // src/lib/plugin-collision-guard.ts
16048
- import { existsSync as existsSync55, readdirSync as readdirSync24, statSync as statSync16 } from "fs";
16049
- import { join as join66 } from "path";
16059
+ import { existsSync as existsSync56, readdirSync as readdirSync24, statSync as statSync16 } from "fs";
16060
+ import { join as join67 } from "path";
16050
16061
  var PYTEST_SPECIAL = /* @__PURE__ */ new Set(["conftest.py"]);
16051
16062
  var IGNORED_DIRS = /* @__PURE__ */ new Set([".venv", "node_modules", "__pycache__", ".git", "dist", "build"]);
16052
16063
  function subdirectories(dir) {
16053
- if (!existsSync55(dir)) return [];
16064
+ if (!existsSync56(dir)) return [];
16054
16065
  return readdirSync24(dir).filter((entry) => {
16055
16066
  if (IGNORED_DIRS.has(entry) || entry.startsWith(".")) return false;
16056
16067
  try {
16057
- return statSync16(join66(dir, entry)).isDirectory();
16068
+ return statSync16(join67(dir, entry)).isDirectory();
16058
16069
  } catch {
16059
16070
  return false;
16060
16071
  }
16061
16072
  });
16062
16073
  }
16063
16074
  function regularPackagesOf(pluginDir2) {
16064
- return subdirectories(pluginDir2).filter((name) => existsSync55(join66(pluginDir2, name, "__init__.py"))).sort();
16075
+ return subdirectories(pluginDir2).filter((name) => existsSync56(join67(pluginDir2, name, "__init__.py"))).sort();
16065
16076
  }
16066
16077
  function bareTestModulesOf(pluginDir2) {
16067
- const testsDir = join66(pluginDir2, "tests");
16068
- if (!existsSync55(testsDir)) return [];
16069
- if (existsSync55(join66(testsDir, "__init__.py"))) return [];
16078
+ const testsDir = join67(pluginDir2, "tests");
16079
+ if (!existsSync56(testsDir)) return [];
16080
+ if (existsSync56(join67(testsDir, "__init__.py"))) return [];
16070
16081
  return readdirSync24(testsDir).filter((f) => f.endsWith(".py") && !PYTEST_SPECIAL.has(f)).sort();
16071
16082
  }
16072
16083
  function findCollisions(servicesDir, pluginDirs) {
@@ -16075,7 +16086,7 @@ function findCollisions(servicesDir, pluginDirs) {
16075
16086
  const gather = (kind, namesOf) => {
16076
16087
  const claims = /* @__PURE__ */ new Map();
16077
16088
  for (const plugin of plugins) {
16078
- for (const name of namesOf(join66(servicesDir, plugin))) {
16089
+ for (const name of namesOf(join67(servicesDir, plugin))) {
16079
16090
  claims.set(name, [...claims.get(name) ?? [], plugin]);
16080
16091
  }
16081
16092
  }
@@ -16113,8 +16124,8 @@ function formatCollisions(collisions) {
16113
16124
  // src/scripts/check-plugin-collisions.ts
16114
16125
  async function runPluginCollisionCheck() {
16115
16126
  const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
16116
- const servicesDir = join67(root, "services");
16117
- if (!existsSync56(servicesDir)) {
16127
+ const servicesDir = join68(root, "services");
16128
+ if (!existsSync57(servicesDir)) {
16118
16129
  console.log("\u2713 plugin collision guard: no services/ directory \u2014 nothing to compare");
16119
16130
  return;
16120
16131
  }
@@ -16131,8 +16142,8 @@ async function runPluginCollisionCheck() {
16131
16142
  }
16132
16143
 
16133
16144
  // src/lib/plugin-terraform-guard.ts
16134
- import { existsSync as existsSync57, readFileSync as readFileSync45, readdirSync as readdirSync25 } from "fs";
16135
- import { dirname as dirname13, join as join68, relative as relative10, sep as sep4 } from "path";
16145
+ import { existsSync as existsSync58, readFileSync as readFileSync45, readdirSync as readdirSync25 } from "fs";
16146
+ import { dirname as dirname13, join as join69, relative as relative10, sep as sep4 } from "path";
16136
16147
  var SKIP_DIRS4 = /* @__PURE__ */ new Set(["node_modules", ".git", ".worktrees", "dist", ".venv", "__pycache__"]);
16137
16148
  var PLUGIN_MANIFEST_FILE2 = "biffo.plugin.json";
16138
16149
  function findPluginManifests(root) {
@@ -16147,9 +16158,9 @@ function findPluginManifests(root) {
16147
16158
  for (const entry of entries) {
16148
16159
  if (entry.isDirectory()) {
16149
16160
  if (SKIP_DIRS4.has(entry.name)) continue;
16150
- walk2(join68(dir, entry.name));
16161
+ walk2(join69(dir, entry.name));
16151
16162
  } else if (entry.isFile() && entry.name === PLUGIN_MANIFEST_FILE2) {
16152
- found.push(relative10(root, join68(dir, entry.name)).split(sep4).join("/"));
16163
+ found.push(relative10(root, join69(dir, entry.name)).split(sep4).join("/"));
16153
16164
  }
16154
16165
  }
16155
16166
  };
@@ -16174,14 +16185,14 @@ function readSubscriptions(absManifestPath) {
16174
16185
  }
16175
16186
  function checkPluginTerraform(root) {
16176
16187
  const violations = [];
16177
- const coreManifest = existsSync57(join68(root, CORE_MANIFEST_FILE)) ? readCoreManifest(root) : null;
16188
+ const coreManifest = existsSync58(join69(root, CORE_MANIFEST_FILE)) ? readCoreManifest(root) : null;
16178
16189
  for (const manifest of findPluginManifests(root)) {
16179
16190
  if (coreManifest && !isTemplateOwned(manifest, coreManifest)) continue;
16180
- const absManifest = join68(root, manifest);
16191
+ const absManifest = join69(root, manifest);
16181
16192
  const subscriptions = readSubscriptions(absManifest);
16182
16193
  if (subscriptions === null) continue;
16183
16194
  const pluginDir2 = dirname13(absManifest);
16184
- if (existsSync57(join68(pluginDir2, "terraform"))) continue;
16195
+ if (existsSync58(join69(pluginDir2, "terraform"))) continue;
16185
16196
  const relPluginDir = relative10(root, pluginDir2).split(sep4).join("/");
16186
16197
  violations.push({
16187
16198
  manifest,
@@ -16212,12 +16223,12 @@ async function runPluginTerraformCheck() {
16212
16223
  }
16213
16224
 
16214
16225
  // src/scripts/check-plugin-tool-supply.ts
16215
- import { existsSync as existsSync59 } from "fs";
16216
- import { join as join70 } from "path";
16226
+ import { existsSync as existsSync60 } from "fs";
16227
+ import { join as join71 } from "path";
16217
16228
 
16218
16229
  // src/lib/plugin-tool-supply-audit.ts
16219
- import { existsSync as existsSync58, readFileSync as readFileSync46, readdirSync as readdirSync26, statSync as statSync17 } from "fs";
16220
- import { join as join69 } from "path";
16230
+ import { existsSync as existsSync59, readFileSync as readFileSync46, readdirSync as readdirSync26, statSync as statSync17 } from "fs";
16231
+ import { join as join70 } from "path";
16221
16232
 
16222
16233
  // src/lib/openrouter-model-snapshot.ts
16223
16234
  var OPENROUTER_MODEL_SNAPSHOT_FETCHED_AT = "2026-09-25T20:12:57Z";
@@ -16692,7 +16703,7 @@ function listDirs(root) {
16692
16703
  }
16693
16704
  return entries.filter((e) => {
16694
16705
  try {
16695
- return statSync17(join69(root, e)).isDirectory();
16706
+ return statSync17(join70(root, e)).isDirectory();
16696
16707
  } catch {
16697
16708
  return false;
16698
16709
  }
@@ -16708,7 +16719,7 @@ function walkFiles2(root, accept, skipDir) {
16708
16719
  return;
16709
16720
  }
16710
16721
  for (const entry of entries) {
16711
- const p = join69(dir, entry);
16722
+ const p = join70(dir, entry);
16712
16723
  let st;
16713
16724
  try {
16714
16725
  st = statSync17(p);
@@ -16734,14 +16745,14 @@ function pluginPythonFiles(pluginDir2) {
16734
16745
  );
16735
16746
  }
16736
16747
  function pluginTerraformFiles(pluginDir2) {
16737
- const tfDir = join69(pluginDir2, "terraform");
16748
+ const tfDir = join70(pluginDir2, "terraform");
16738
16749
  let entries;
16739
16750
  try {
16740
16751
  entries = readdirSync26(tfDir);
16741
16752
  } catch {
16742
16753
  return [];
16743
16754
  }
16744
- return entries.filter((e) => e.endsWith(".tf")).map((e) => join69(tfDir, e)).sort();
16755
+ return entries.filter((e) => e.endsWith(".tf")).map((e) => join70(tfDir, e)).sort();
16745
16756
  }
16746
16757
  function extractManifestTools(manifestText) {
16747
16758
  let parsed;
@@ -16993,8 +17004,8 @@ function isSnapshotStale(fetchedAt, now) {
16993
17004
  function normalizeModelId(id) {
16994
17005
  return id.endsWith(":online") ? id.slice(0, -":online".length) : id;
16995
17006
  }
16996
- var CONFIG_PY_PATH = join69("services", "api", "src", "api", "config.py");
16997
- var ORCHESTRATION_SCHEMA_PATH = join69(
17007
+ var CONFIG_PY_PATH = join70("services", "api", "src", "api", "config.py");
17008
+ var ORCHESTRATION_SCHEMA_PATH = join70(
16998
17009
  "services",
16999
17010
  "api",
17000
17011
  "src",
@@ -17007,10 +17018,10 @@ function auditDeclaredModelIds(repoRoot, options = {}) {
17007
17018
  const snapshotFetchedAt = options.snapshotFetchedAt ?? OPENROUTER_MODEL_SNAPSHOT_FETCHED_AT;
17008
17019
  const now = options.now ?? /* @__PURE__ */ new Date();
17009
17020
  const snapshotAgeEnforced = options.enforceSnapshotAge ?? true;
17010
- const configPath = join69(repoRoot, CONFIG_PY_PATH);
17011
- const orchestrationPath = join69(repoRoot, ORCHESTRATION_SCHEMA_PATH);
17012
- const configMissing = !existsSync58(configPath);
17013
- const orchestrationSchemaMissing = !existsSync58(orchestrationPath);
17021
+ const configPath = join70(repoRoot, CONFIG_PY_PATH);
17022
+ const orchestrationPath = join70(repoRoot, ORCHESTRATION_SCHEMA_PATH);
17023
+ const configMissing = !existsSync59(configPath);
17024
+ const orchestrationSchemaMissing = !existsSync59(orchestrationPath);
17014
17025
  const knownSet = new Set(knownModelIds);
17015
17026
  const snapshotEmpty = knownModelIds.length === 0;
17016
17027
  const snapshotStale = isSnapshotStale(snapshotFetchedAt, now);
@@ -17082,7 +17093,7 @@ function auditDeclaredModelIds(repoRoot, options = {}) {
17082
17093
  function discoverPluginDirs(pluginsRoot) {
17083
17094
  return listDirs(pluginsRoot).filter((name) => {
17084
17095
  try {
17085
- return statSync17(join69(pluginsRoot, name, "biffo.plugin.json")).isFile();
17096
+ return statSync17(join70(pluginsRoot, name, "biffo.plugin.json")).isFile();
17086
17097
  } catch {
17087
17098
  return false;
17088
17099
  }
@@ -17095,8 +17106,8 @@ function auditPluginToolSupply(pluginsRoot) {
17095
17106
  let terraformBlind = false;
17096
17107
  let totalDeclaredTools = 0;
17097
17108
  for (const name of pluginNames) {
17098
- const pluginDir2 = join69(pluginsRoot, name);
17099
- const manifestText = readFileSync46(join69(pluginDir2, "biffo.plugin.json"), "utf8");
17109
+ const pluginDir2 = join70(pluginsRoot, name);
17110
+ const manifestText = readFileSync46(join70(pluginDir2, "biffo.plugin.json"), "utf8");
17100
17111
  const manifest = extractManifestTools(manifestText);
17101
17112
  if (manifest.parseError) {
17102
17113
  findings.push({
@@ -17194,7 +17205,7 @@ function auditPluginToolSupply(pluginsRoot) {
17194
17205
  requiredEnvVars: envResult.envVars,
17195
17206
  missingEnvVars: anyWired ? [] : envResult.envVars,
17196
17207
  status: anyWired ? "ok" : "missing-env",
17197
- detail: anyWired ? `${entry.predicate}() is satisfiable: at least one of ${JSON.stringify(envResult.envVars)} is wired in Terraform` : `${entry.predicate}() reads ${JSON.stringify(envResult.envVars)} \u2014 NONE of these are wired by any environment_variables block under ${join69(pluginDir2, "terraform")}, so this deployment can never supply it`
17208
+ detail: anyWired ? `${entry.predicate}() is satisfiable: at least one of ${JSON.stringify(envResult.envVars)} is wired in Terraform` : `${entry.predicate}() reads ${JSON.stringify(envResult.envVars)} \u2014 NONE of these are wired by any environment_variables block under ${join70(pluginDir2, "terraform")}, so this deployment can never supply it`
17198
17209
  });
17199
17210
  }
17200
17211
  }
@@ -17234,8 +17245,8 @@ async function runPluginToolSupplyCheck() {
17234
17245
  return;
17235
17246
  }
17236
17247
  let allOk = true;
17237
- const pluginsRoot = join70(root, "services", "_plugins");
17238
- if (!existsSync59(pluginsRoot)) {
17248
+ const pluginsRoot = join71(root, "services", "_plugins");
17249
+ if (!existsSync60(pluginsRoot)) {
17239
17250
  console.log("\u2713 plugin tool-supply guard: no services/_plugins/ \u2014 nothing to audit");
17240
17251
  } else {
17241
17252
  const report = auditPluginToolSupply(pluginsRoot);
@@ -17265,8 +17276,8 @@ async function runPluginToolSupplyCheck() {
17265
17276
  console.log(`\u2713 plugin tool-supply guard: ${report.summary}`);
17266
17277
  }
17267
17278
  }
17268
- const servicesApiRoot = join70(root, "services", "api");
17269
- if (!existsSync59(servicesApiRoot)) {
17279
+ const servicesApiRoot = join71(root, "services", "api");
17280
+ if (!existsSync60(servicesApiRoot)) {
17270
17281
  console.log("\u2713 plugin model-id guard: no services/api/ \u2014 nothing to audit");
17271
17282
  } else {
17272
17283
  const modelReport = auditDeclaredModelIds(root, {
@@ -17650,12 +17661,12 @@ async function runSharedFileReductionCheck(args) {
17650
17661
  }
17651
17662
 
17652
17663
  // src/scripts/check-skeleton-drift.ts
17653
- import { existsSync as existsSync60, readdirSync as readdirSync28 } from "fs";
17654
- import { join as join72 } from "path";
17664
+ import { existsSync as existsSync61, readdirSync as readdirSync28 } from "fs";
17665
+ import { join as join73 } from "path";
17655
17666
 
17656
17667
  // src/lib/skeleton-drift-guard.ts
17657
17668
  import { readFileSync as readFileSync49, readdirSync as readdirSync27, statSync as statSync18 } from "fs";
17658
- import { join as join71 } from "path";
17669
+ import { join as join72 } from "path";
17659
17670
  var isWorkflow = (rel) => rel.startsWith(".github/workflows/") && (rel.endsWith(".yml") || rel.endsWith(".yaml"));
17660
17671
  var isRootLayout = (rel) => rel.endsWith("src/app/layout.tsx");
17661
17672
  var uncommented = (contents) => contents.split("\n").filter((line) => !/^\s*(\/\/|\/\*|\*)/.test(line)).join("\n");
@@ -17719,7 +17730,7 @@ function walk(dir, base = dir) {
17719
17730
  }
17720
17731
  for (const entry of entries) {
17721
17732
  if (entry === ".venv" || entry === "node_modules" || entry === ".git") continue;
17722
- const abs = join71(dir, entry);
17733
+ const abs = join72(dir, entry);
17723
17734
  let isDir;
17724
17735
  try {
17725
17736
  isDir = statSync18(abs).isDirectory();
@@ -17741,7 +17752,7 @@ function auditSkeleton(skeletonRoot, name, rules = SKELETON_RULES) {
17741
17752
  if (!rule.appliesTo(rel)) continue;
17742
17753
  let contents;
17743
17754
  try {
17744
- contents = readFileSync49(join71(skeletonRoot, rel), "utf8");
17755
+ contents = readFileSync49(join72(skeletonRoot, rel), "utf8");
17745
17756
  } catch {
17746
17757
  continue;
17747
17758
  }
@@ -17770,23 +17781,23 @@ function formatViolations2(violations) {
17770
17781
 
17771
17782
  // src/scripts/check-skeleton-drift.ts
17772
17783
  function discoverSkeletons(root) {
17773
- const skeletonsDir = join72(root, "_skeletons");
17784
+ const skeletonsDir = join73(root, "_skeletons");
17774
17785
  let entries;
17775
17786
  try {
17776
17787
  entries = readdirSync28(skeletonsDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
17777
17788
  } catch {
17778
17789
  return [];
17779
17790
  }
17780
- return entries.filter((name) => existsSync60(join72(skeletonsDir, name, ".github", "workflows", "ci.yml"))).sort();
17791
+ return entries.filter((name) => existsSync61(join73(skeletonsDir, name, ".github", "workflows", "ci.yml"))).sort();
17781
17792
  }
17782
17793
  async function runSkeletonDriftCheck() {
17783
17794
  const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
17784
17795
  const skeletons = discoverSkeletons(root);
17785
17796
  let filesConsidered = 0;
17786
17797
  for (const name of skeletons) {
17787
- const skeletonRoot = join72(root, "_skeletons", name);
17798
+ const skeletonRoot = join73(root, "_skeletons", name);
17788
17799
  filesConsidered += findWorkflowFiles(skeletonRoot).length;
17789
- if (existsSync60(join72(skeletonRoot, "apps", "frontend", "src", "app", "layout.tsx"))) {
17800
+ if (existsSync61(join73(skeletonRoot, "apps", "frontend", "src", "app", "layout.tsx"))) {
17790
17801
  filesConsidered += 1;
17791
17802
  }
17792
17803
  }
@@ -17794,7 +17805,7 @@ async function runSkeletonDriftCheck() {
17794
17805
  `audited ${skeletons.length} skeleton(s) (${skeletons.join(", ") || "none"}), ${filesConsidered} file(s) considered, under ${root}/_skeletons`
17795
17806
  );
17796
17807
  if (skeletons.length === 0) {
17797
- if (!existsSync60(join72(root, "_skeletons"))) {
17808
+ if (!existsSync61(join73(root, "_skeletons"))) {
17798
17809
  console.log(
17799
17810
  `\xB7 Skeleton-drift guard: no _skeletons/ directory under ${root} \u2014 this is not a repo that ships scaffolding (a satellite repo never carries one). Not applicable; skipping.`
17800
17811
  );
@@ -17806,7 +17817,7 @@ async function runSkeletonDriftCheck() {
17806
17817
  process.exit(1);
17807
17818
  }
17808
17819
  const violations = skeletons.flatMap(
17809
- (name) => auditSkeleton(join72(root, "_skeletons", name), name)
17820
+ (name) => auditSkeleton(join73(root, "_skeletons", name), name)
17810
17821
  );
17811
17822
  if (violations.length > 0) {
17812
17823
  console.error("\u2717 Skeleton-drift guard: drift found between this repo and its scaffolding\n");
@@ -18007,8 +18018,8 @@ function rawArgsAfter(subcommand) {
18007
18018
  }
18008
18019
 
18009
18020
  // src/commands/doctor.ts
18010
- import { existsSync as existsSync61, readFileSync as readFileSync50 } from "fs";
18011
- import { join as join74, resolve as resolve23 } from "path";
18021
+ import { existsSync as existsSync62, readFileSync as readFileSync50 } from "fs";
18022
+ import { join as join75, resolve as resolve23 } from "path";
18012
18023
  import chalk21 from "chalk";
18013
18024
  import { Command as Command27 } from "commander";
18014
18025
 
@@ -18349,11 +18360,11 @@ async function reapAllBareBranches(cwd, branches, worktrees, currentBranch, deps
18349
18360
 
18350
18361
  // src/lib/scratch-clone-scan.ts
18351
18362
  import { readdirSync as readdirSync29, statSync as statSync19 } from "fs";
18352
- import { join as join73 } from "path";
18363
+ import { join as join74 } from "path";
18353
18364
  var INTEGRATION_BRANCH = "dev";
18354
18365
  function isPlainCloneDir(path) {
18355
18366
  try {
18356
- return statSync19(join73(path, ".git")).isDirectory();
18367
+ return statSync19(join74(path, ".git")).isDirectory();
18357
18368
  } catch {
18358
18369
  return false;
18359
18370
  }
@@ -18368,7 +18379,7 @@ async function findScratchCloneCandidates(estateRoot, deps) {
18368
18379
  const names = readdirSync29(estateRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
18369
18380
  const candidates = [];
18370
18381
  for (const name of names) {
18371
- const path = join73(estateRoot, name);
18382
+ const path = join74(estateRoot, name);
18372
18383
  if (!isPlainCloneDir(path)) continue;
18373
18384
  let branch;
18374
18385
  try {
@@ -18548,8 +18559,8 @@ function printScratchCloneReports(estateRoot, reports) {
18548
18559
  );
18549
18560
  }
18550
18561
  function readLocalCoreVersion(cwd) {
18551
- const path = join74(cwd, INSTANCE_CORE_FILE);
18552
- if (!existsSync61(path)) return null;
18562
+ const path = join75(cwd, INSTANCE_CORE_FILE);
18563
+ if (!existsSync62(path)) return null;
18553
18564
  try {
18554
18565
  return extractVersionField(readFileSync50(path, "utf8"));
18555
18566
  } catch {
@@ -18571,8 +18582,8 @@ function extractVersionField(contents) {
18571
18582
  return match?.[1] ?? null;
18572
18583
  }
18573
18584
  function readFossil(cwd) {
18574
- const path = join74(cwd, CORE_VERSION_FILE);
18575
- if (!existsSync61(path)) return null;
18585
+ const path = join75(cwd, CORE_VERSION_FILE);
18586
+ if (!existsSync62(path)) return null;
18576
18587
  try {
18577
18588
  const value = readFileSync50(path, "utf8").trim();
18578
18589
  return value === "" ? null : value;