@bensandee/tooling 0.103.0 → 0.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.mjs CHANGED
@@ -173,7 +173,7 @@ function loadEnvFileForBin(rawArgs, bin, io = processIo) {
173
173
  // src/env-file-preload.ts
174
174
  const envFileLoad = loadEnvFileForBin(process.argv.slice(2), {
175
175
  name: "bst",
176
- version: "0.103.0"
176
+ version: "0.105.0"
177
177
  });
178
178
  // ../cli-kit/src/logger.ts
179
179
  const RANK = {
@@ -1743,7 +1743,8 @@ const AgentConfigSchema = z.strictObject({
1743
1743
  egress: AgentEgressConfigSchema.optional().meta({ description: "Extra egress hosts this repo's agent containers ask to reach -- a request the deployment grants, not an opening of a host. `browseHosts` joins the agent's browse lane (GET and HEAD only) on top of the hosts every run needs; the passthrough lane stays agent-owned. Each entry is a host pattern -- an exact host or a *.host wildcard, never a port. Read from the repo's DEFAULT BRANCH, never off a pull request's own tree, so a run can never widen its own egress: under the default `auto` grant mode the request takes effect on the first container started after a human merges it, and under `approve` it waits for an admin's grant for this repo. A host the product or the deployment known-denies is never opened, whatever the declaration or the verdict says. An entry whose pattern the agent cannot parse refuses the run rather than being dropped. Changing this block holds the pull request from automerge." }),
1744
1744
  findingHolds: FindingHoldsConfigSchema.optional().meta({ description: "Which of a pull request's linked open findings withhold its unattended merge. `rules` is ordered and the first `when` that matches decides; no match falls through to `default`; an absent block is { rules: [], default: true }, so every open linked finding holds by default. Read off the repo's DEFAULT BRANCH, never off the pull request's own tree -- a pull request cannot edit the rule deciding whether it is held. In a `mentions` entry a /.../flags pattern is a regular expression, a literal:<text> pattern is the substring <text> (how to name a path such as /src/utils), and anything else is a case-insensitive substring." }),
1745
1745
  chatIssueRepos: z.array(z.string().regex(REPO_FULL_NAME)).optional().meta({ description: "Repositories with a DIFFERENT owner that a control-panel chat from this repository may file an issue in, each one a full `owner/name`, never a wildcard. A repository with the same owner needs no entry, and an entry grants nothing on its own: the target must have enabled the agent too. Read from the repo's DEFAULT BRANCH at the moment a card is applied, so a pull request cannot widen the reach of its own chat. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." }),
1746
- ciOnlySteps: z.array(z.string().regex(/^[\w:*?.\-[\]{}!,]+$/)).optional().meta({ description: "Step names or globs in `checks:run --skip` syntax that agent runs leave to CI, for example [\"docker:check\"]. Separate from `checks.skip`, which drops a step in CI too: here CI still runs the step and its status still gates the merge. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot widen its own skip list. The agent merges such a pull request only on green CI, because the gate no longer measures these steps. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." })
1746
+ ciOnlySteps: z.array(z.string().regex(/^[\w:*?.\-[\]{}!,]+$/)).optional().meta({ description: "Step names or globs in `checks:run --skip` syntax that agent runs leave to CI, for example [\"docker:check\"]. Separate from `checks.skip`, which drops a step in CI too: here CI still runs the step and its status still gates the merge. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot widen its own skip list. The agent merges such a pull request only on green CI, because the gate no longer measures these steps. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." }),
1747
+ localVerify: z.boolean().optional().meta({ description: "Keep an agent run's check gate in the agent's own sandboxed verify container instead of measuring it on this repo's forge CI. `true` is the local verify; leaving the key out is the other answer, so the agent waits for the CI run of the commit it pushed and reads its `checks:run` job log, falling back to the local verify whenever CI cannot stand in. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot choose the gate that measures it. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." })
1747
1748
  });
1748
1749
  const TolerantAgentConfigSchema = z.object({
1749
1750
  ...AgentConfigSchema.shape,
@@ -4475,7 +4476,7 @@ function createDockerDiscoveryMemo() {
4475
4476
  }
4476
4477
  return { detect };
4477
4478
  }
4478
- // src/generators/docker-reader.ts
4479
+ // src/generators/ci/docker-reader.ts
4479
4480
  const perContextMemos = /* @__PURE__ */ new WeakMap();
4480
4481
  function memoFor(ctx) {
4481
4482
  if (ctx.dockerDiscovery !== void 0) return ctx.dockerDiscovery;
@@ -4778,6 +4779,11 @@ function preservePinnedActions(generated, existing, owned = []) {
4778
4779
  }
4779
4780
  return result;
4780
4781
  }
4782
+ const SHARED_RUNNER_EXPR = "vars.BST_RUNNER || 'ubuntu-latest'";
4783
+ const TRUSTED_RUNNER_EXPR = "vars.BST_TRUSTED_RUNNER || vars.BST_RUNNER || 'ubuntu-latest'";
4784
+ function runnerExpr(expr) {
4785
+ return `\${{ ${expr} }}`;
4786
+ }
4781
4787
  function buildWorkflowYaml(options) {
4782
4788
  const doc = { name: options.name };
4783
4789
  if (options.enableEmailNotifications) doc["enable-email-notifications"] = true;
@@ -4786,7 +4792,7 @@ function buildWorkflowYaml(options) {
4786
4792
  if (options.concurrency) doc["concurrency"] = options.concurrency;
4787
4793
  const jobs = { [options.jobName]: {
4788
4794
  ...options.jobIf && { if: options.jobIf },
4789
- "runs-on": options.runsOn ?? "ubuntu-latest",
4795
+ "runs-on": options.runsOn ?? runnerExpr("vars.BST_RUNNER || 'ubuntu-latest'"),
4790
4796
  ...options.jobEnv && { env: options.jobEnv },
4791
4797
  ...options.jobOutputs && { outputs: options.jobOutputs },
4792
4798
  steps: options.steps.map((s) => s.step)
@@ -4795,7 +4801,7 @@ function buildWorkflowYaml(options) {
4795
4801
  ...def.needs && { needs: def.needs },
4796
4802
  ...def.if && { if: def.if },
4797
4803
  ...def["continue-on-error"] && { "continue-on-error": true },
4798
- "runs-on": def.runsOn ?? "ubuntu-latest",
4804
+ "runs-on": def.runsOn ?? runnerExpr("vars.BST_RUNNER || 'ubuntu-latest'"),
4799
4805
  ...def.env && { env: def.env },
4800
4806
  steps: def.steps.map((s) => s.step)
4801
4807
  };
@@ -4807,12 +4813,12 @@ function buildWorkflowYaml(options) {
4807
4813
  return ensureSchemaComment(WORKFLOW_MANAGED_HEADER + "\n" + readable, options.ci);
4808
4814
  }
4809
4815
  // src/generators/mise-pin.ts
4810
- const MISE_VERSION = "2026.10.19";
4811
- const MISE_LINUX_X64_SHA256 = "3162760f40b6b5f706c60641e4ef5ee7322bc6c54f72fc26a7111b337aa18d9d";
4816
+ const MISE_VERSION = "2026.10.25";
4817
+ const MISE_LINUX_X64_SHA256 = "5d362ecc578dc7c146679b841dda949d6472cbf86ff5635db7afdca1b6b3fd87";
4812
4818
  const SETUP_MISE_ACTION_URL = "https://code.orangebikelabs.com/bensandee/common/actions/setup-mise";
4813
4819
  const SETUP_MISE_ACTION_TAG = "setup-mise@latest";
4814
4820
  const SETUP_MISE_ACTION_SHA = "ebe622ef0d24c7efec4a5f6093ddb18500900e24";
4815
- // src/generators/ci-utils.ts
4821
+ // src/generators/ci/ci-utils.ts
4816
4822
  function actionsExpr(expr) {
4817
4823
  return `\${{ ${expr} }}`;
4818
4824
  }
@@ -4956,7 +4962,7 @@ function retireManagedWorkflow(ctx, workflowPath, reason) {
4956
4962
  description
4957
4963
  };
4958
4964
  }
4959
- // src/generators/publish-ci.ts
4965
+ // src/generators/ci/publish-ci.ts
4960
4966
  const RegistryHostSchema = z.object({ registryHost: z.string().optional() });
4961
4967
  function resolveGenTimeHost(ctx) {
4962
4968
  const toolingRaw = ctx.read(".tooling.json");
@@ -5375,18 +5381,18 @@ function perPackageDevDeps(config) {
5375
5381
  "@types/node": "24.19.2",
5376
5382
  "@vitest/coverage-v8": "5.0.5",
5377
5383
  "commit-and-tag-version": "13.3.0",
5378
- "knip": "6.42.1",
5384
+ "knip": "6.44.0",
5379
5385
  "lefthook": "2.2.2",
5380
- "modern-web-guidance": "0.0.195",
5381
- "oxfmt": "0.74.0",
5382
- "oxlint": "1.89.0",
5386
+ "modern-web-guidance": "0.0.196",
5387
+ "oxfmt": "0.75.0",
5388
+ "oxlint": "1.90.0",
5383
5389
  "oxlint-tsgolint": "7.0.2005",
5384
5390
  "prettier": "3.9.10",
5385
5391
  "release-it": "21.1.1",
5386
- "tsdown": "0.23.1",
5392
+ "tsdown": "0.23.4",
5387
5393
  "typescript": "6.0.3",
5388
5394
  "vitest": "5.0.5",
5389
- "pnpm": "11.28.8"
5395
+ "pnpm": "11.28.9"
5390
5396
  }["typescript"];
5391
5397
  deps["@types/node"] = {
5392
5398
  "@changesets/cli": "3.0.3",
@@ -5394,18 +5400,18 @@ function perPackageDevDeps(config) {
5394
5400
  "@types/node": "24.19.2",
5395
5401
  "@vitest/coverage-v8": "5.0.5",
5396
5402
  "commit-and-tag-version": "13.3.0",
5397
- "knip": "6.42.1",
5403
+ "knip": "6.44.0",
5398
5404
  "lefthook": "2.2.2",
5399
- "modern-web-guidance": "0.0.195",
5400
- "oxfmt": "0.74.0",
5401
- "oxlint": "1.89.0",
5405
+ "modern-web-guidance": "0.0.196",
5406
+ "oxfmt": "0.75.0",
5407
+ "oxlint": "1.90.0",
5402
5408
  "oxlint-tsgolint": "7.0.2005",
5403
5409
  "prettier": "3.9.10",
5404
5410
  "release-it": "21.1.1",
5405
- "tsdown": "0.23.1",
5411
+ "tsdown": "0.23.4",
5406
5412
  "typescript": "6.0.3",
5407
5413
  "vitest": "5.0.5",
5408
- "pnpm": "11.28.8"
5414
+ "pnpm": "11.28.9"
5409
5415
  }["@types/node"];
5410
5416
  }
5411
5417
  if (config.builder === "tsdown") deps["tsdown"] = {
@@ -5414,18 +5420,18 @@ function perPackageDevDeps(config) {
5414
5420
  "@types/node": "24.19.2",
5415
5421
  "@vitest/coverage-v8": "5.0.5",
5416
5422
  "commit-and-tag-version": "13.3.0",
5417
- "knip": "6.42.1",
5423
+ "knip": "6.44.0",
5418
5424
  "lefthook": "2.2.2",
5419
- "modern-web-guidance": "0.0.195",
5420
- "oxfmt": "0.74.0",
5421
- "oxlint": "1.89.0",
5425
+ "modern-web-guidance": "0.0.196",
5426
+ "oxfmt": "0.75.0",
5427
+ "oxlint": "1.90.0",
5422
5428
  "oxlint-tsgolint": "7.0.2005",
5423
5429
  "prettier": "3.9.10",
5424
5430
  "release-it": "21.1.1",
5425
- "tsdown": "0.23.1",
5431
+ "tsdown": "0.23.4",
5426
5432
  "typescript": "6.0.3",
5427
5433
  "vitest": "5.0.5",
5428
- "pnpm": "11.28.8"
5434
+ "pnpm": "11.28.9"
5429
5435
  }["tsdown"];
5430
5436
  return deps;
5431
5437
  }
@@ -5437,18 +5443,18 @@ function vitestDevDeps() {
5437
5443
  "@types/node": "24.19.2",
5438
5444
  "@vitest/coverage-v8": "5.0.5",
5439
5445
  "commit-and-tag-version": "13.3.0",
5440
- "knip": "6.42.1",
5446
+ "knip": "6.44.0",
5441
5447
  "lefthook": "2.2.2",
5442
- "modern-web-guidance": "0.0.195",
5443
- "oxfmt": "0.74.0",
5444
- "oxlint": "1.89.0",
5448
+ "modern-web-guidance": "0.0.196",
5449
+ "oxfmt": "0.75.0",
5450
+ "oxlint": "1.90.0",
5445
5451
  "oxlint-tsgolint": "7.0.2005",
5446
5452
  "prettier": "3.9.10",
5447
5453
  "release-it": "21.1.1",
5448
- "tsdown": "0.23.1",
5454
+ "tsdown": "0.23.4",
5449
5455
  "typescript": "6.0.3",
5450
5456
  "vitest": "5.0.5",
5451
- "pnpm": "11.28.8"
5457
+ "pnpm": "11.28.9"
5452
5458
  }["vitest"],
5453
5459
  "@vitest/coverage-v8": {
5454
5460
  "@changesets/cli": "3.0.3",
@@ -5456,18 +5462,18 @@ function vitestDevDeps() {
5456
5462
  "@types/node": "24.19.2",
5457
5463
  "@vitest/coverage-v8": "5.0.5",
5458
5464
  "commit-and-tag-version": "13.3.0",
5459
- "knip": "6.42.1",
5465
+ "knip": "6.44.0",
5460
5466
  "lefthook": "2.2.2",
5461
- "modern-web-guidance": "0.0.195",
5462
- "oxfmt": "0.74.0",
5463
- "oxlint": "1.89.0",
5467
+ "modern-web-guidance": "0.0.196",
5468
+ "oxfmt": "0.75.0",
5469
+ "oxlint": "1.90.0",
5464
5470
  "oxlint-tsgolint": "7.0.2005",
5465
5471
  "prettier": "3.9.10",
5466
5472
  "release-it": "21.1.1",
5467
- "tsdown": "0.23.1",
5473
+ "tsdown": "0.23.4",
5468
5474
  "typescript": "6.0.3",
5469
5475
  "vitest": "5.0.5",
5470
- "pnpm": "11.28.8"
5476
+ "pnpm": "11.28.9"
5471
5477
  }["@vitest/coverage-v8"]
5472
5478
  };
5473
5479
  }
@@ -5478,18 +5484,18 @@ function rootDevDeps(config) {
5478
5484
  "@types/node": "24.19.2",
5479
5485
  "@vitest/coverage-v8": "5.0.5",
5480
5486
  "commit-and-tag-version": "13.3.0",
5481
- "knip": "6.42.1",
5487
+ "knip": "6.44.0",
5482
5488
  "lefthook": "2.2.2",
5483
- "modern-web-guidance": "0.0.195",
5484
- "oxfmt": "0.74.0",
5485
- "oxlint": "1.89.0",
5489
+ "modern-web-guidance": "0.0.196",
5490
+ "oxfmt": "0.75.0",
5491
+ "oxlint": "1.90.0",
5486
5492
  "oxlint-tsgolint": "7.0.2005",
5487
5493
  "prettier": "3.9.10",
5488
5494
  "release-it": "21.1.1",
5489
- "tsdown": "0.23.1",
5495
+ "tsdown": "0.23.4",
5490
5496
  "typescript": "6.0.3",
5491
5497
  "vitest": "5.0.5",
5492
- "pnpm": "11.28.8"
5498
+ "pnpm": "11.28.9"
5493
5499
  }["lefthook"] };
5494
5500
  if (config.stack !== "none") {
5495
5501
  deps["knip"] = {
@@ -5498,18 +5504,18 @@ function rootDevDeps(config) {
5498
5504
  "@types/node": "24.19.2",
5499
5505
  "@vitest/coverage-v8": "5.0.5",
5500
5506
  "commit-and-tag-version": "13.3.0",
5501
- "knip": "6.42.1",
5507
+ "knip": "6.44.0",
5502
5508
  "lefthook": "2.2.2",
5503
- "modern-web-guidance": "0.0.195",
5504
- "oxfmt": "0.74.0",
5505
- "oxlint": "1.89.0",
5509
+ "modern-web-guidance": "0.0.196",
5510
+ "oxfmt": "0.75.0",
5511
+ "oxlint": "1.90.0",
5506
5512
  "oxlint-tsgolint": "7.0.2005",
5507
5513
  "prettier": "3.9.10",
5508
5514
  "release-it": "21.1.1",
5509
- "tsdown": "0.23.1",
5515
+ "tsdown": "0.23.4",
5510
5516
  "typescript": "6.0.3",
5511
5517
  "vitest": "5.0.5",
5512
- "pnpm": "11.28.8"
5518
+ "pnpm": "11.28.9"
5513
5519
  }["knip"];
5514
5520
  deps["oxlint"] = {
5515
5521
  "@changesets/cli": "3.0.3",
@@ -5517,18 +5523,18 @@ function rootDevDeps(config) {
5517
5523
  "@types/node": "24.19.2",
5518
5524
  "@vitest/coverage-v8": "5.0.5",
5519
5525
  "commit-and-tag-version": "13.3.0",
5520
- "knip": "6.42.1",
5526
+ "knip": "6.44.0",
5521
5527
  "lefthook": "2.2.2",
5522
- "modern-web-guidance": "0.0.195",
5523
- "oxfmt": "0.74.0",
5524
- "oxlint": "1.89.0",
5528
+ "modern-web-guidance": "0.0.196",
5529
+ "oxfmt": "0.75.0",
5530
+ "oxlint": "1.90.0",
5525
5531
  "oxlint-tsgolint": "7.0.2005",
5526
5532
  "prettier": "3.9.10",
5527
5533
  "release-it": "21.1.1",
5528
- "tsdown": "0.23.1",
5534
+ "tsdown": "0.23.4",
5529
5535
  "typescript": "6.0.3",
5530
5536
  "vitest": "5.0.5",
5531
- "pnpm": "11.28.8"
5537
+ "pnpm": "11.28.9"
5532
5538
  }["oxlint"];
5533
5539
  Object.assign(deps, vitestDevDeps());
5534
5540
  }
@@ -5538,18 +5544,18 @@ function rootDevDeps(config) {
5538
5544
  "@types/node": "24.19.2",
5539
5545
  "@vitest/coverage-v8": "5.0.5",
5540
5546
  "commit-and-tag-version": "13.3.0",
5541
- "knip": "6.42.1",
5547
+ "knip": "6.44.0",
5542
5548
  "lefthook": "2.2.2",
5543
- "modern-web-guidance": "0.0.195",
5544
- "oxfmt": "0.74.0",
5545
- "oxlint": "1.89.0",
5549
+ "modern-web-guidance": "0.0.196",
5550
+ "oxfmt": "0.75.0",
5551
+ "oxlint": "1.90.0",
5546
5552
  "oxlint-tsgolint": "7.0.2005",
5547
5553
  "prettier": "3.9.10",
5548
5554
  "release-it": "21.1.1",
5549
- "tsdown": "0.23.1",
5555
+ "tsdown": "0.23.4",
5550
5556
  "typescript": "6.0.3",
5551
5557
  "vitest": "5.0.5",
5552
- "pnpm": "11.28.8"
5558
+ "pnpm": "11.28.9"
5553
5559
  }["oxlint-tsgolint"];
5554
5560
  return deps;
5555
5561
  }
@@ -5562,18 +5568,18 @@ function addReleaseDeps(deps, ctx) {
5562
5568
  "@types/node": "24.19.2",
5563
5569
  "@vitest/coverage-v8": "5.0.5",
5564
5570
  "commit-and-tag-version": "13.3.0",
5565
- "knip": "6.42.1",
5571
+ "knip": "6.44.0",
5566
5572
  "lefthook": "2.2.2",
5567
- "modern-web-guidance": "0.0.195",
5568
- "oxfmt": "0.74.0",
5569
- "oxlint": "1.89.0",
5573
+ "modern-web-guidance": "0.0.196",
5574
+ "oxfmt": "0.75.0",
5575
+ "oxlint": "1.90.0",
5570
5576
  "oxlint-tsgolint": "7.0.2005",
5571
5577
  "prettier": "3.9.10",
5572
5578
  "release-it": "21.1.1",
5573
- "tsdown": "0.23.1",
5579
+ "tsdown": "0.23.4",
5574
5580
  "typescript": "6.0.3",
5575
5581
  "vitest": "5.0.5",
5576
- "pnpm": "11.28.8"
5582
+ "pnpm": "11.28.9"
5577
5583
  }["release-it"];
5578
5584
  if (ctx.config.structure === "monorepo") deps["@release-it/bumper"] = {
5579
5585
  "@changesets/cli": "3.0.3",
@@ -5581,18 +5587,18 @@ function addReleaseDeps(deps, ctx) {
5581
5587
  "@types/node": "24.19.2",
5582
5588
  "@vitest/coverage-v8": "5.0.5",
5583
5589
  "commit-and-tag-version": "13.3.0",
5584
- "knip": "6.42.1",
5590
+ "knip": "6.44.0",
5585
5591
  "lefthook": "2.2.2",
5586
- "modern-web-guidance": "0.0.195",
5587
- "oxfmt": "0.74.0",
5588
- "oxlint": "1.89.0",
5592
+ "modern-web-guidance": "0.0.196",
5593
+ "oxfmt": "0.75.0",
5594
+ "oxlint": "1.90.0",
5589
5595
  "oxlint-tsgolint": "7.0.2005",
5590
5596
  "prettier": "3.9.10",
5591
5597
  "release-it": "21.1.1",
5592
- "tsdown": "0.23.1",
5598
+ "tsdown": "0.23.4",
5593
5599
  "typescript": "6.0.3",
5594
5600
  "vitest": "5.0.5",
5595
- "pnpm": "11.28.8"
5601
+ "pnpm": "11.28.9"
5596
5602
  }["@release-it/bumper"];
5597
5603
  break;
5598
5604
  case "simple":
@@ -5602,18 +5608,18 @@ function addReleaseDeps(deps, ctx) {
5602
5608
  "@types/node": "24.19.2",
5603
5609
  "@vitest/coverage-v8": "5.0.5",
5604
5610
  "commit-and-tag-version": "13.3.0",
5605
- "knip": "6.42.1",
5611
+ "knip": "6.44.0",
5606
5612
  "lefthook": "2.2.2",
5607
- "modern-web-guidance": "0.0.195",
5608
- "oxfmt": "0.74.0",
5609
- "oxlint": "1.89.0",
5613
+ "modern-web-guidance": "0.0.196",
5614
+ "oxfmt": "0.75.0",
5615
+ "oxlint": "1.90.0",
5610
5616
  "oxlint-tsgolint": "7.0.2005",
5611
5617
  "prettier": "3.9.10",
5612
5618
  "release-it": "21.1.1",
5613
- "tsdown": "0.23.1",
5619
+ "tsdown": "0.23.4",
5614
5620
  "typescript": "6.0.3",
5615
5621
  "vitest": "5.0.5",
5616
- "pnpm": "11.28.8"
5622
+ "pnpm": "11.28.9"
5617
5623
  }["commit-and-tag-version"];
5618
5624
  break;
5619
5625
  case "changesets": deps["@changesets/cli"] = {
@@ -5622,18 +5628,18 @@ function addReleaseDeps(deps, ctx) {
5622
5628
  "@types/node": "24.19.2",
5623
5629
  "@vitest/coverage-v8": "5.0.5",
5624
5630
  "commit-and-tag-version": "13.3.0",
5625
- "knip": "6.42.1",
5631
+ "knip": "6.44.0",
5626
5632
  "lefthook": "2.2.2",
5627
- "modern-web-guidance": "0.0.195",
5628
- "oxfmt": "0.74.0",
5629
- "oxlint": "1.89.0",
5633
+ "modern-web-guidance": "0.0.196",
5634
+ "oxfmt": "0.75.0",
5635
+ "oxlint": "1.90.0",
5630
5636
  "oxlint-tsgolint": "7.0.2005",
5631
5637
  "prettier": "3.9.10",
5632
5638
  "release-it": "21.1.1",
5633
- "tsdown": "0.23.1",
5639
+ "tsdown": "0.23.4",
5634
5640
  "typescript": "6.0.3",
5635
5641
  "vitest": "5.0.5",
5636
- "pnpm": "11.28.8"
5642
+ "pnpm": "11.28.9"
5637
5643
  }["@changesets/cli"];
5638
5644
  }
5639
5645
  }
@@ -5750,18 +5756,18 @@ function applyMetadataDefaults(pkg, ctx, changes) {
5750
5756
  "@types/node": "24.19.2",
5751
5757
  "@vitest/coverage-v8": "5.0.5",
5752
5758
  "commit-and-tag-version": "13.3.0",
5753
- "knip": "6.42.1",
5759
+ "knip": "6.44.0",
5754
5760
  "lefthook": "2.2.2",
5755
- "modern-web-guidance": "0.0.195",
5756
- "oxfmt": "0.74.0",
5757
- "oxlint": "1.89.0",
5761
+ "modern-web-guidance": "0.0.196",
5762
+ "oxfmt": "0.75.0",
5763
+ "oxlint": "1.90.0",
5758
5764
  "oxlint-tsgolint": "7.0.2005",
5759
5765
  "prettier": "3.9.10",
5760
5766
  "release-it": "21.1.1",
5761
- "tsdown": "0.23.1",
5767
+ "tsdown": "0.23.4",
5762
5768
  "typescript": "6.0.3",
5763
5769
  "vitest": "5.0.5",
5764
- "pnpm": "11.28.8"
5770
+ "pnpm": "11.28.9"
5765
5771
  }["pnpm"];
5766
5772
  const desiredPm = pinnedPnpm ? `pnpm@${pinnedPnpm}` : void 0;
5767
5773
  if (desiredPm) {
@@ -5800,27 +5806,27 @@ function buildManagedDevDeps(ctx) {
5800
5806
  const devDeps = { ...rootDevDeps(ctx.config) };
5801
5807
  if (!isMonorepo) Object.assign(devDeps, perPackageDevDeps(ctx.config));
5802
5808
  if (ctx.config.stack !== "none") devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.15.1";
5803
- if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.103.0";
5809
+ if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.105.0";
5804
5810
  if (ctx.config.useEslintPlugin && ctx.config.stack !== "none") devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.18.0";
5805
- if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.3.1";
5811
+ if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.3.2";
5806
5812
  if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = {
5807
5813
  "@changesets/cli": "3.0.3",
5808
5814
  "@release-it/bumper": "8.0.1",
5809
5815
  "@types/node": "24.19.2",
5810
5816
  "@vitest/coverage-v8": "5.0.5",
5811
5817
  "commit-and-tag-version": "13.3.0",
5812
- "knip": "6.42.1",
5818
+ "knip": "6.44.0",
5813
5819
  "lefthook": "2.2.2",
5814
- "modern-web-guidance": "0.0.195",
5815
- "oxfmt": "0.74.0",
5816
- "oxlint": "1.89.0",
5820
+ "modern-web-guidance": "0.0.196",
5821
+ "oxfmt": "0.75.0",
5822
+ "oxlint": "1.90.0",
5817
5823
  "oxlint-tsgolint": "7.0.2005",
5818
5824
  "prettier": "3.9.10",
5819
5825
  "release-it": "21.1.1",
5820
- "tsdown": "0.23.1",
5826
+ "tsdown": "0.23.4",
5821
5827
  "typescript": "6.0.3",
5822
5828
  "vitest": "5.0.5",
5823
- "pnpm": "11.28.8"
5829
+ "pnpm": "11.28.9"
5824
5830
  }["oxfmt"];
5825
5831
  if (ctx.config.formatter === "prettier") devDeps["prettier"] = {
5826
5832
  "@changesets/cli": "3.0.3",
@@ -5828,18 +5834,18 @@ function buildManagedDevDeps(ctx) {
5828
5834
  "@types/node": "24.19.2",
5829
5835
  "@vitest/coverage-v8": "5.0.5",
5830
5836
  "commit-and-tag-version": "13.3.0",
5831
- "knip": "6.42.1",
5837
+ "knip": "6.44.0",
5832
5838
  "lefthook": "2.2.2",
5833
- "modern-web-guidance": "0.0.195",
5834
- "oxfmt": "0.74.0",
5835
- "oxlint": "1.89.0",
5839
+ "modern-web-guidance": "0.0.196",
5840
+ "oxfmt": "0.75.0",
5841
+ "oxlint": "1.90.0",
5836
5842
  "oxlint-tsgolint": "7.0.2005",
5837
5843
  "prettier": "3.9.10",
5838
5844
  "release-it": "21.1.1",
5839
- "tsdown": "0.23.1",
5845
+ "tsdown": "0.23.4",
5840
5846
  "typescript": "6.0.3",
5841
5847
  "vitest": "5.0.5",
5842
- "pnpm": "11.28.8"
5848
+ "pnpm": "11.28.9"
5843
5849
  }["prettier"];
5844
5850
  addReleaseDeps(devDeps, ctx);
5845
5851
  return devDeps;
@@ -5899,18 +5905,18 @@ async function generatePackageJson(ctx) {
5899
5905
  "@types/node": "24.19.2",
5900
5906
  "@vitest/coverage-v8": "5.0.5",
5901
5907
  "commit-and-tag-version": "13.3.0",
5902
- "knip": "6.42.1",
5908
+ "knip": "6.44.0",
5903
5909
  "lefthook": "2.2.2",
5904
- "modern-web-guidance": "0.0.195",
5905
- "oxfmt": "0.74.0",
5906
- "oxlint": "1.89.0",
5910
+ "modern-web-guidance": "0.0.196",
5911
+ "oxfmt": "0.75.0",
5912
+ "oxlint": "1.90.0",
5907
5913
  "oxlint-tsgolint": "7.0.2005",
5908
5914
  "prettier": "3.9.10",
5909
5915
  "release-it": "21.1.1",
5910
- "tsdown": "0.23.1",
5916
+ "tsdown": "0.23.4",
5911
5917
  "typescript": "6.0.3",
5912
5918
  "vitest": "5.0.5",
5913
- "pnpm": "11.28.8"
5919
+ "pnpm": "11.28.9"
5914
5920
  }["pnpm"]}`
5915
5921
  };
5916
5922
  ctx.write(filePath, JSON.stringify(pkg, null, 2) + "\n");
@@ -6651,7 +6657,7 @@ async function generateVitest(ctx) {
6651
6657
  warnIfMissingInclude(ctx);
6652
6658
  return results;
6653
6659
  }
6654
- // src/generators/oxlint.ts
6660
+ // src/generators/lint-format/oxlint.ts
6655
6661
  const IGNORE_PATTERNS_SPREAD = "...(recommended.ignorePatterns ?? [])";
6656
6662
  const CONFIG_WITH_LINT_RULES = `import recommended from "@bensandee/config/oxlint/recommended";
6657
6663
  import bensandee from "@bensandee/eslint-plugin/recommended";
@@ -6829,7 +6835,7 @@ async function generateOxlint(ctx) {
6829
6835
  description: "Generated oxlint.config.ts"
6830
6836
  };
6831
6837
  }
6832
- // src/generators/formatter.ts
6838
+ // src/generators/lint-format/formatter.ts
6833
6839
  const BASE_IGNORE_PATTERNS = [
6834
6840
  ".claude",
6835
6841
  ".agent/findings",
@@ -7813,7 +7819,7 @@ function refuseForgeDefaultMismatch(configured, source, command) {
7813
7819
  if (reported === void 0 || reported === configured) return;
7814
7820
  throw new FatalError(`${command}: .tooling.json#defaultBranch is "${configured}", but the forge reports "${reported}" as this repository's default branch. Set .tooling.json#defaultBranch to "${reported}" and run pnpm exec bst repo:sync.`);
7815
7821
  }
7816
- // src/generators/release-ci.ts
7822
+ // src/generators/ci/release-ci.ts
7817
7823
  const DEFAULT_POST_RELEASE_COMMAND = [
7818
7824
  "pnpm exec bst webhook:send",
7819
7825
  " \"$POST_RELEASE_HOOK_URL\"",
@@ -7844,6 +7850,7 @@ function postReleaseHookJob(opts) {
7844
7850
  return {
7845
7851
  needs: opts.needsJob,
7846
7852
  if: onlyOnDefaultBranch(opts.defaultBranch, opts.publishCondition),
7853
+ runsOn: opts.runsOn,
7847
7854
  "continue-on-error": true,
7848
7855
  steps: [...commonSteps(opts.ci), { step: {
7849
7856
  name: "Post-release hook",
@@ -7988,6 +7995,7 @@ async function generateReleaseCi(ctx) {
7988
7995
  const filePath = "release-ci";
7989
7996
  const isGitHub = ctx.config.ci === "github";
7990
7997
  const defaultBranch = configuredDefaultBranch(ctx.read(".tooling.json"));
7998
+ const trustedRunsOn = actionsExpr(TRUSTED_RUNNER_EXPR);
7991
7999
  if (ctx.config.ci === "none" || ctx.config.releaseStrategy === "none") return {
7992
8000
  filePath,
7993
8001
  action: "skipped",
@@ -8044,6 +8052,7 @@ async function generateReleaseCi(ctx) {
8044
8052
  defaultBranch,
8045
8053
  ci: ctx.config.ci,
8046
8054
  needsJob: "release",
8055
+ runsOn: trustedRunsOn,
8047
8056
  publishCondition: "needs.release.outputs.pushed == 'true'",
8048
8057
  releaseTagExpr: actionsExpr("needs.release.outputs.tag"),
8049
8058
  command: getPostReleaseHookCommand(ctx),
@@ -8058,6 +8067,7 @@ async function generateReleaseCi(ctx) {
8058
8067
  ...isGitHub && { permissions: { contents: "write" } },
8059
8068
  jobName: "release",
8060
8069
  jobIf: isDefaultBranch(defaultBranch),
8070
+ runsOn: trustedRunsOn,
8061
8071
  ...jobOutputs && { jobOutputs },
8062
8072
  steps,
8063
8073
  ...extraJobs && { extraJobs }
@@ -8090,7 +8100,7 @@ async function generateReleaseCi(ctx) {
8090
8100
  function versionPrBranch(defaultBranch) {
8091
8101
  return `changeset-release/${defaultBranch}`;
8092
8102
  }
8093
- // src/generators/ci.ts
8103
+ // src/generators/ci/ci.ts
8094
8104
  function coverageHistorySteps() {
8095
8105
  return [
8096
8106
  { step: {
@@ -8164,6 +8174,9 @@ function ciConcurrency(ci, defaultBranch) {
8164
8174
  "cancel-in-progress": actionsExpr(isNotDefaultBranch(defaultBranch))
8165
8175
  };
8166
8176
  }
8177
+ function checkJobRunsOn(defaultBranch) {
8178
+ return actionsExpr(`${isDefaultBranch(defaultBranch)} && (${TRUSTED_RUNNER_EXPR}) || (${SHARED_RUNNER_EXPR})`);
8179
+ }
8167
8180
  function checkSteps(ci, coverageEnabled, emitDockerSweepStep) {
8168
8181
  const checkCommand = coverageEnabled ? "pnpm ci:check" : "pnpm ci:check --no-coverage";
8169
8182
  return [
@@ -8193,6 +8206,7 @@ async function generateCi(ctx) {
8193
8206
  description: "CI workflow not requested"
8194
8207
  };
8195
8208
  const defaultBranch = configuredDefaultBranch(ctx.read(".tooling.json"));
8209
+ const checkRunsOn = checkJobRunsOn(defaultBranch);
8196
8210
  const isGitHub = ctx.config.ci === "github";
8197
8211
  const isForgejo = !isGitHub;
8198
8212
  const isChangesets = ctx.config.releaseStrategy === "changesets";
@@ -8261,6 +8275,7 @@ async function generateCi(ctx) {
8261
8275
  defaultBranch,
8262
8276
  ci: ctx.config.ci,
8263
8277
  needsJob: "check",
8278
+ runsOn: actionsExpr(TRUSTED_RUNNER_EXPR),
8264
8279
  publishCondition: "needs.check.outputs.published == 'true'",
8265
8280
  releaseTagExpr: actionsExpr("needs.check.outputs.tag"),
8266
8281
  command: hookCommand,
@@ -8284,6 +8299,7 @@ async function generateCi(ctx) {
8284
8299
  enableEmailNotifications: isForgejo,
8285
8300
  ...isChangesets && { concurrency: ciConcurrency(ctx.config.ci, defaultBranch) },
8286
8301
  jobName: "check",
8302
+ runsOn: checkRunsOn,
8287
8303
  ...skipOnVersionPr && { jobIf: `github.head_ref != '${versionPrBranch(defaultBranch)}'` },
8288
8304
  ...Object.keys(checkJobEnv).length > 0 && { jobEnv: checkJobEnv },
8289
8305
  ...jobOutputs && { jobOutputs },
@@ -8315,7 +8331,7 @@ async function generateCi(ctx) {
8315
8331
  description: `Generated ${isGitHub ? "GitHub" : "Forgejo"} Actions CI workflow`
8316
8332
  };
8317
8333
  }
8318
- // src/generators/knip.ts
8334
+ // src/generators/lint-format/knip.ts
8319
8335
  const FOREIGN_OWNED = ["composer"];
8320
8336
  function scriptsInvoke(ctx, binary) {
8321
8337
  const invocation = new RegExp(String.raw`(?<![\w.-])${binary}(?![\w.-])`);
@@ -8700,10 +8716,10 @@ async function generatePnpmWorkspace(ctx) {
8700
8716
  description: changes.join(", ")
8701
8717
  };
8702
8718
  }
8703
- // src/generators/claude-hooks-placeholder.ts
8719
+ // src/generators/claude/claude-hooks-placeholder.ts
8704
8720
  const HOOK_NOT_BUILT_PLACEHOLDER = "/* bst-hook not built -- run pnpm build from packages/claude-hooks first */";
8705
8721
  const GUIDE_NOT_BUILT_PLACEHOLDER = "<!-- bst-hook guide not built -->";
8706
- // src/generators/claude-hooks.ts
8722
+ // src/generators/claude/claude-hooks.ts
8707
8723
  const HOOK_PATH = ".claude/hooks/bst-hook.mjs";
8708
8724
  const GUIDE_PATH = ".claude/hooks/bst-hook-guide.md";
8709
8725
  const SETTINGS_PATH$1 = ".claude/hooks/bst-hook.settings.json";
@@ -8770,7 +8786,7 @@ async function generateClaudeHooks(ctx, embedded = {
8770
8786
  if (legacyAllowResult) results.push(legacyAllowResult);
8771
8787
  return results;
8772
8788
  }
8773
- // src/generators/claude-settings.ts
8789
+ // src/generators/claude/claude-settings.ts
8774
8790
  const HookEntrySchema = z.object({
8775
8791
  type: z.string().optional(),
8776
8792
  command: z.string().optional()
@@ -8927,7 +8943,7 @@ async function generateClaudeSettings(ctx) {
8927
8943
  }
8928
8944
  return results;
8929
8945
  }
8930
- // src/generators/release-it.ts
8946
+ // src/generators/release/release-it.ts
8931
8947
  function buildConfig$3(ci, isMonorepo) {
8932
8948
  const config = {
8933
8949
  $schema: "https://unpkg.com/release-it/schema/release-it.json",
@@ -8977,7 +8993,7 @@ async function generateReleaseIt(ctx) {
8977
8993
  description: "Generated .release-it.json"
8978
8994
  };
8979
8995
  }
8980
- // src/generators/changesets.ts
8996
+ // src/generators/release/changesets.ts
8981
8997
  function buildConfig$2(defaultBranch) {
8982
8998
  return {
8983
8999
  $schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
@@ -9012,7 +9028,7 @@ async function generateChangesets(ctx) {
9012
9028
  description: "Generated .changeset/config.json"
9013
9029
  };
9014
9030
  }
9015
- // src/generators/lefthook.ts
9031
+ // src/generators/lint-format/lefthook.ts
9016
9032
  const LINT_COMMAND = "pnpm exec oxlint --no-error-on-unmatched-pattern {staged_files}";
9017
9033
  function formatCommandFor(formatter) {
9018
9034
  return formatter === "prettier" ? "pnpm exec prettier --ignore-unknown --no-error-on-unmatched-pattern --write {staged_files}" : "pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files}";
@@ -9586,7 +9602,7 @@ function matchStatusBlock(content) {
9586
9602
  quoted: statusQuoted
9587
9603
  };
9588
9604
  }
9589
- // src/generators/claude-md.ts
9605
+ // src/generators/claude/claude-md.ts
9590
9606
  const FILE = "CLAUDE.md";
9591
9607
  function codeList(words) {
9592
9608
  return words.map((word) => `\`${word}\``).join(", ");
@@ -9745,7 +9761,7 @@ const PLANNING_GUIDE_BODY = [
9745
9761
  "",
9746
9762
  "## The spec",
9747
9763
  "",
9748
- "Say why and what, not how: the problem, who it is for, the constraints, what done looks like, and the alternatives you rejected, each with its reason. Work with several independent parts gets one spec per part. Save it as `docs/specs/<YYYY-MM-DD>-<topic>-design.md`.",
9764
+ "Say why and what, not how: the problem, who it is for, the constraints, what done looks like, and the alternatives you rejected, each with its reason -- an established tool you chose not to use among them, by name. Work with several independent parts gets one spec per part. Save it as `docs/specs/<YYYY-MM-DD>-<topic>-design.md`.",
9749
9765
  "",
9750
9766
  "## The plan",
9751
9767
  "",
@@ -9827,6 +9843,23 @@ const DEBUGGING_GUIDE_BODY = [
9827
9843
  "- Three failed fixes mean the approach is wrong. Stop, question the design, and say what you do not understand, instead of trying a fourth.",
9828
9844
  "- A fixed bug gets a regression test that you have seen fail against the unfixed code."
9829
9845
  ].join("\n");
9846
+ const TOOLS_GUIDE_BODY = [
9847
+ "# Established tools",
9848
+ "",
9849
+ "**Before you design or write a general-purpose mechanism, look for the tool that already does it, and use it.** That covers a grammar or expression language, a parser, a scheduler or schedule format, and a date, retry, queue or validation helper.",
9850
+ "",
9851
+ "1. The platform or the language's standard library first.",
9852
+ "2. If it does not do the job, an established package.",
9853
+ "3. Your own code only when neither fits.",
9854
+ "",
9855
+ "An established package is maintained and widely used, has a license compatible with this repo's, ideally has few dependencies of its own, and has safety limits where its input is untrusted. Check these facts before you recommend a package -- its registry page, repository and license -- rather than recalling them.",
9856
+ "",
9857
+ "Keep only the domain part as your own code. In a design for scheduled prompts, the catalog of facts a condition reads is ours; the expression language (CEL) and the schedule format (cron) come from libraries.",
9858
+ "",
9859
+ "Adding an established dependency is not a cost to avoid. A homemade copy of what it does is the cost: code you own, test and secure for no gain.",
9860
+ "",
9861
+ "When you decide against an established tool, name it and the reason: in the spec's rejected alternatives, or in the commit body when there is no spec."
9862
+ ].join("\n");
9830
9863
  function webUiGuideBody() {
9831
9864
  const mwg = `pnpm dlx modern-web-guidance@${{
9832
9865
  "@changesets/cli": "3.0.3",
@@ -9834,18 +9867,18 @@ function webUiGuideBody() {
9834
9867
  "@types/node": "24.19.2",
9835
9868
  "@vitest/coverage-v8": "5.0.5",
9836
9869
  "commit-and-tag-version": "13.3.0",
9837
- "knip": "6.42.1",
9870
+ "knip": "6.44.0",
9838
9871
  "lefthook": "2.2.2",
9839
- "modern-web-guidance": "0.0.195",
9840
- "oxfmt": "0.74.0",
9841
- "oxlint": "1.89.0",
9872
+ "modern-web-guidance": "0.0.196",
9873
+ "oxfmt": "0.75.0",
9874
+ "oxlint": "1.90.0",
9842
9875
  "oxlint-tsgolint": "7.0.2005",
9843
9876
  "prettier": "3.9.10",
9844
9877
  "release-it": "21.1.1",
9845
- "tsdown": "0.23.1",
9878
+ "tsdown": "0.23.4",
9846
9879
  "typescript": "6.0.3",
9847
9880
  "vitest": "5.0.5",
9848
- "pnpm": "11.28.8"
9881
+ "pnpm": "11.28.9"
9849
9882
  }["modern-web-guidance"]}`;
9850
9883
  return [
9851
9884
  "# Web UI",
@@ -10042,6 +10075,12 @@ function agentGuides(config, coverageEnabled, healthEnabled, webUiEnabled) {
10042
10075
  body: DEBUGGING_GUIDE_BODY,
10043
10076
  enabled: true
10044
10077
  },
10078
+ {
10079
+ name: "tools.md",
10080
+ trigger: "design or write a general-purpose mechanism -- a grammar or expression language, a parser, a scheduler or schedule format, or a date, retry, queue or validation helper",
10081
+ body: TOOLS_GUIDE_BODY,
10082
+ enabled: true
10083
+ },
10045
10084
  {
10046
10085
  name: "web-ui.md",
10047
10086
  trigger: "build or change a web UI -- markup, styles, components, or client-side behaviour",
@@ -10243,7 +10282,7 @@ async function generateClaudeMd(ctx) {
10243
10282
  syncAgentsMdLink(ctx)
10244
10283
  ];
10245
10284
  }
10246
- // src/generators/versionrc.ts
10285
+ // src/generators/release/versionrc.ts
10247
10286
  function buildConfig() {
10248
10287
  return {
10249
10288
  header: "# Changelog\n\nAll notable changes to this project will be documented in this file.\n",
@@ -10308,7 +10347,7 @@ async function generateVersionrc(ctx) {
10308
10347
  description: "Generated .versionrc.json"
10309
10348
  };
10310
10349
  }
10311
- // src/generators/stale-ci-workflows.ts
10350
+ // src/generators/ci/stale-ci-workflows.ts
10312
10351
  async function generateStaleCiWorkflows(ctx) {
10313
10352
  const ci = ctx.config.ci;
10314
10353
  if (ci === "none") return [];
@@ -10389,7 +10428,7 @@ async function runGenerators(ctx) {
10389
10428
  results.push(saveToolingConfig(ctx, ctx.config));
10390
10429
  return results;
10391
10430
  }
10392
- // src/utils/generator-failures.ts
10431
+ // src/generators/generator-failures.ts
10393
10432
  function failedResults(results) {
10394
10433
  return results.filter((r) => r.action === "failed");
10395
10434
  }
@@ -10402,7 +10441,7 @@ function reportFailures(failed, command) {
10402
10441
  function generateMigratePrompt(results, config, detected) {
10403
10442
  const sections = [];
10404
10443
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
10405
- sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.103.0 repo:sync\` on ${timestamp}_\n`);
10444
+ sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.105.0 repo:sync\` on ${timestamp}_\n`);
10406
10445
  const changed = results.filter((r) => r.action === "created" || r.action === "updated" || r.action === "archived");
10407
10446
  if (changed.length > 0) {
10408
10447
  const items = changed.map((r) => {
@@ -10513,7 +10552,7 @@ function addTestGenerationTasks(tasks, results) {
10513
10552
  A starter test was created at \`test/example.test.ts\`. Review \`src/\` and create additional tests covering exported functions and edge cases.
10514
10553
  `);
10515
10554
  }
10516
- // src/commands/repo-init.ts
10555
+ // src/commands/repo/repo-init.ts
10517
10556
  function logDetectionSummary(ctx) {
10518
10557
  if (ctx.config.publishDocker) {
10519
10558
  const publishablePackages = detectContextDockerPackages(ctx).filter((pkg) => pkg.publish);
@@ -12064,7 +12103,7 @@ function parseListFlag(rawArgs, flag) {
12064
12103
  }
12065
12104
  return values.flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
12066
12105
  }
12067
- // src/commands/repo-run-checks.ts
12106
+ // src/commands/repo/repo-run-checks.ts
12068
12107
  const CHECKS = [
12069
12108
  { name: "build" },
12070
12109
  { name: "typecheck" },
@@ -12451,7 +12490,7 @@ const WORKFLOW_DIR_PREFIXES = [".forgejo/workflows/", ".github/workflows/"];
12451
12490
  function isWorkflowDirPath(filePath) {
12452
12491
  return WORKFLOW_DIR_PREFIXES.some((prefix) => filePath.startsWith(prefix));
12453
12492
  }
12454
- // src/commands/workflow-apt-steps.ts
12493
+ // src/commands/repo/workflow-apt-steps.ts
12455
12494
  const APT_INSTALL = /\bapt(?:-get)?(?:\s+-\S+)*\s+install\b/g;
12456
12495
  const COMMAND_END = /&&|\|\||;|\|/;
12457
12496
  function workflowFiles(targetDir) {
@@ -12534,7 +12573,7 @@ function findWorkflowAptSteps(targetDir) {
12534
12573
  }
12535
12574
  return steps.toSorted((a, b) => a.file.localeCompare(b.file));
12536
12575
  }
12537
- // src/commands/sync-gates.ts
12576
+ // src/commands/repo/sync-gates.ts
12538
12577
  function runReleaseTargetGate(config, targetDir) {
12539
12578
  const file = releaseTargetConflict(config.stack, config.releaseStrategy, targetDir);
12540
12579
  if (!file) return false;
@@ -12761,7 +12800,7 @@ function runToolchainGate(targetDir) {
12761
12800
  if (!declared) return 0;
12762
12801
  return checkDeclaredToolsActive(targetDir, declared);
12763
12802
  }
12764
- // src/commands/repo-sync.ts
12803
+ // src/commands/repo/repo-sync.ts
12765
12804
  const rawLog$1 = (msg) => console.log(msg);
12766
12805
  const syncCommand = defineCommand({
12767
12806
  meta: {
@@ -13214,6 +13253,7 @@ const PrDetailSchema = z.object({
13214
13253
  draft: z.boolean(),
13215
13254
  merged: z.boolean(),
13216
13255
  mergeable: z.boolean().nullish(),
13256
+ merge_commit_sha: z.string().nullish(),
13217
13257
  state: z.string()
13218
13258
  });
13219
13259
  function parsePrDetailOrThrow(data) {
@@ -13221,6 +13261,10 @@ function parsePrDetailOrThrow(data) {
13221
13261
  if (!parsed.success) throw new UnexpectedError(`Unexpected PR detail response: ${parsed.error.message}`);
13222
13262
  return parsed.data;
13223
13263
  }
13264
+ const MERGE_COMMIT_SHA = /^[0-9a-f]{7,64}$/;
13265
+ function isMergeCommitSha(value) {
13266
+ return value !== void 0 && value !== null && MERGE_COMMIT_SHA.test(value);
13267
+ }
13224
13268
  function normalizePrDetail(data) {
13225
13269
  return {
13226
13270
  head: {
@@ -13236,6 +13280,7 @@ function normalizePrDetail(data) {
13236
13280
  draft: data.draft,
13237
13281
  merged: data.merged,
13238
13282
  mergeable: data.mergeable ?? null,
13283
+ mergeCommitSha: isMergeCommitSha(data.merge_commit_sha) ? data.merge_commit_sha : null,
13239
13284
  state: data.state
13240
13285
  };
13241
13286
  }
@@ -13280,6 +13325,21 @@ async function retargetPr(executor, conn, prNumber, base) {
13280
13325
  resource: `#${String(prNumber)}`
13281
13326
  });
13282
13327
  }
13328
+ async function reopenPr(executor, conn, prNumber) {
13329
+ const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/pulls/${String(prNumber)}`;
13330
+ const res = await executor.fetch(url, {
13331
+ method: "PATCH",
13332
+ headers: {
13333
+ Authorization: `token ${conn.token}`,
13334
+ "Content-Type": "application/json"
13335
+ },
13336
+ body: JSON.stringify({ state: "open" })
13337
+ }, { idempotent: true });
13338
+ if (!res.ok) await throwForgejoFailure(res, {
13339
+ verb: "reopen PR",
13340
+ resource: `#${String(prNumber)}`
13341
+ });
13342
+ }
13283
13343
  const PrContentSchema = z.object({
13284
13344
  title: z.string(),
13285
13345
  body: z.string().nullish()
@@ -13969,7 +14029,7 @@ async function configureGitIdentity(executor, platform, cwd, conn, signal = null
13969
14029
  email
13970
14030
  };
13971
14031
  }
13972
- // src/commands/release-changesets.ts
14032
+ // src/commands/release/release-changesets.ts
13973
14033
  const releaseForgejoCommand = defineCommand({
13974
14034
  meta: {
13975
14035
  name: "release:changesets",
@@ -14216,7 +14276,7 @@ function dispatchGitHub(options, executor) {
14216
14276
  inputs: options.inputs
14217
14277
  };
14218
14278
  }
14219
- // src/commands/release-trigger.ts
14279
+ // src/commands/release/release-trigger.ts
14220
14280
  const releaseTriggerCommand = defineCommand({
14221
14281
  meta: {
14222
14282
  name: "release:trigger",
@@ -15461,7 +15521,8 @@ function forgejoPrEditHost(fetcher, conn) {
15461
15521
  readLive: (number) => getPrEditState(fetcher, conn, number),
15462
15522
  branchExists: (name) => branchExists(fetcher, conn, name),
15463
15523
  setBase: (number, base) => retargetPr(fetcher, conn, number, base),
15464
- ready: (number, write) => updatePr(fetcher, conn, number, { title: write.title })
15524
+ ready: (number, write) => updatePr(fetcher, conn, number, { title: write.title }),
15525
+ reopen: (number) => reopenPr(fetcher, conn, number)
15465
15526
  };
15466
15527
  }
15467
15528
  // src/release/github-pr-host.ts
@@ -15713,6 +15774,15 @@ function githubPrEditHost(executor, cwd, repository) {
15713
15774
  ]);
15714
15775
  if (result.exitCode !== 0) throw new FatalError(`Failed to retarget PR #${String(number)}: ${result.stderr || result.stdout}`);
15715
15776
  },
15777
+ async reopen(number) {
15778
+ const result = await runGh$1(executor, cwd, [
15779
+ "pr",
15780
+ "reopen",
15781
+ String(number),
15782
+ ...target
15783
+ ]);
15784
+ if (result.exitCode !== 0) throw new FatalError(`Failed to reopen PR #${String(number)}: ${result.stderr || result.stdout}`);
15785
+ },
15716
15786
  async ready(number, write) {
15717
15787
  if (write.draft) {
15718
15788
  const result = await runGh$1(executor, cwd, [
@@ -20349,7 +20419,7 @@ async function readClosedIssueClaims(executor, options) {
20349
20419
  return null;
20350
20420
  }
20351
20421
  }
20352
- // src/commands/pr-create.ts
20422
+ // src/commands/pr/pr-create.ts
20353
20423
  const prCreateCommand = defineCommand({
20354
20424
  meta: {
20355
20425
  name: "pr:create",
@@ -20441,8 +20511,9 @@ function isOpen(live) {
20441
20511
  return live.state === "open" && live.merged === false;
20442
20512
  }
20443
20513
  function notOpenMessage(prNumber, live) {
20444
- const what = live.merged ? "merged" : live.state;
20445
- return `Pull request #${String(prNumber)} is ${what}, so it has no base or draft state left to change. Reopen it first if this work is still live.`;
20514
+ const number = `#${String(prNumber)}`;
20515
+ if (live.merged) return `Pull request ${number} is merged, so it has no base or draft state left to change.`;
20516
+ return `Pull request ${number} is ${live.state}, so it has no base or draft state left to change. Run \`pr:reopen ${String(prNumber)}\` first if this work is still live.`;
20446
20517
  }
20447
20518
  async function runPrRetarget(host, options) {
20448
20519
  const live = await host.readLive(options.number);
@@ -20538,8 +20609,47 @@ async function runPrReady(host, options) {
20538
20609
  dryRun: false
20539
20610
  };
20540
20611
  }
20612
+ async function runPrReopen(host, options) {
20613
+ const live = await host.readLive(options.number);
20614
+ if (live.merged === true) throw new FatalError(`Pull request #${String(options.number)} was merged, so there is nothing to reopen -- open a new pull request for further work.`);
20615
+ if (live.state === "open") return {
20616
+ action: "already-open",
20617
+ number: options.number,
20618
+ url: live.url,
20619
+ title: live.title,
20620
+ head: live.head,
20621
+ base: live.base,
20622
+ draft: live.draft,
20623
+ dryRun: options.dryRun
20624
+ };
20625
+ if (live.state !== "closed") throw new FatalError(`Pull request #${String(options.number)} reports the state "${live.state}", which this command has no rule for -- it reopens a pull request reported as closed, and guesses at no state it did not expect.`);
20626
+ if (options.dryRun) return {
20627
+ action: "would-reopen",
20628
+ number: options.number,
20629
+ url: live.url,
20630
+ title: live.title,
20631
+ head: live.head,
20632
+ base: live.base,
20633
+ draft: live.draft,
20634
+ dryRun: true
20635
+ };
20636
+ await host.reopen(options.number);
20637
+ const recheck = await host.readLive(options.number);
20638
+ if (!isOpen(recheck)) throw new FatalError(`Pull request #${String(options.number)} still reports \`${recheck.state}\` after the request to reopen it -- reopen it in the forge's web interface.`);
20639
+ return {
20640
+ action: "reopened",
20641
+ number: options.number,
20642
+ url: recheck.url,
20643
+ title: recheck.title,
20644
+ head: recheck.head,
20645
+ base: recheck.base,
20646
+ draft: recheck.draft,
20647
+ dryRun: false
20648
+ };
20649
+ }
20541
20650
  const PR_RETARGET_JSON_HELP = "Emit one JSON document: action (retargeted | unchanged | would-retarget), number, url, previousBase, base, head, mergeable (true | false | null, advice only), dryRun; a refusal is an error, never this document.";
20542
20651
  const PR_READY_JSON_HELP = "Emit one JSON document: action (readied | retitled | already-ready | would-ready | would-retitle), number, url, previousTitle, title, draft, dryRun; a refusal is an error, never this document.";
20652
+ const PR_REOPEN_JSON_HELP = "Emit one JSON document: action (reopened | already-open | would-reopen), number, url, title, head, base, draft, dryRun; a refusal is an error, never this document.";
20543
20653
  function mergeabilityLine(mergeable) {
20544
20654
  if (mergeable === true) return "Mergeability: mergeable.";
20545
20655
  if (mergeable === false) return "Mergeability: not mergeable -- advice, not a verdict.";
@@ -20562,6 +20672,16 @@ function renderPrReady(result) {
20562
20672
  if (result.action === "would-ready") return `Dry run: pull request ${number} would stop being a draft, reading "${result.title}".`;
20563
20673
  return `Dry run: pull request ${number} would read "${result.title}".`;
20564
20674
  }
20675
+ function renderPrReopen(result) {
20676
+ const number = `#${String(result.number)}`;
20677
+ if (result.action === "reopened") {
20678
+ const lines = [`Pull request ${number} is open again (head "${result.head}" -> "${result.base}").`];
20679
+ if (result.draft) lines.push(`It is still a draft -- run pr:ready ${String(result.number)} when it is ready for review.`);
20680
+ return lines.join("\n");
20681
+ }
20682
+ if (result.action === "already-open") return `Pull request ${number} is already open.`;
20683
+ return `Dry run: pull request ${number} would be reopened.`;
20684
+ }
20565
20685
  // ../forgejo/src/pr-number.ts
20566
20686
  function parsePrNumber(raw) {
20567
20687
  const value = Number(raw);
@@ -20569,13 +20689,22 @@ function parsePrNumber(raw) {
20569
20689
  return value;
20570
20690
  }
20571
20691
  // src/release/pr-edit-host.ts
20572
- function resolvePrEditHost(executor, cwd, repo) {
20692
+ function resolvePrEditTarget(executor, cwd, repo) {
20573
20693
  const resolved = resolveIssueTransport(executor, cwd, parseRepoTarget(repo));
20574
- if (resolved.target.hostname === "github.com") return githubPrEditHost(executor, cwd, resolved.target.repository);
20694
+ if (resolved.target.hostname === "github.com") return {
20695
+ host: githubPrEditHost(executor, cwd, resolved.target.repository),
20696
+ issues: resolved.api
20697
+ };
20575
20698
  if (resolved.conn === void 0) throw new UnexpectedError(`Resolved a non-github.com target (${resolved.target.hostname}) with no Forgejo connection.`);
20576
- return forgejoPrEditHost(executor, resolved.conn);
20699
+ return {
20700
+ host: forgejoPrEditHost(executor, resolved.conn),
20701
+ issues: resolved.api
20702
+ };
20703
+ }
20704
+ function resolvePrEditHost(executor, cwd, repo) {
20705
+ return resolvePrEditTarget(executor, cwd, repo).host;
20577
20706
  }
20578
- // src/commands/pr-ready.ts
20707
+ // src/commands/pr/pr-ready.ts
20579
20708
  const prReadyCommand = defineCommand({
20580
20709
  meta: {
20581
20710
  name: "pr:ready",
@@ -20619,7 +20748,49 @@ const prReadyCommand = defineCommand({
20619
20748
  out.text(renderPrReady(result));
20620
20749
  }
20621
20750
  });
20622
- // src/commands/pr-retarget.ts
20751
+ // src/commands/pr/pr-reopen.ts
20752
+ const prReopenCommand = defineCommand({
20753
+ meta: {
20754
+ name: "pr:reopen",
20755
+ description: "Reopen a closed, unmerged pull request and confirm the forge reports it open, on Forgejo or GitHub. An already-open pull request is reported without writing; a merged one, or an issue, is refused"
20756
+ },
20757
+ args: {
20758
+ number: {
20759
+ type: "positional",
20760
+ required: true,
20761
+ description: "Pull request number"
20762
+ },
20763
+ repo: {
20764
+ type: "string",
20765
+ description: "Repository URL (default: this repo)"
20766
+ },
20767
+ "dry-run": {
20768
+ type: "boolean",
20769
+ description: "Run every read and report, but do not write"
20770
+ },
20771
+ json: {
20772
+ type: "boolean",
20773
+ description: PR_REOPEN_JSON_HELP
20774
+ },
20775
+ verbose: {
20776
+ type: "boolean",
20777
+ description: "Emit detailed debug output"
20778
+ }
20779
+ },
20780
+ async run({ args }) {
20781
+ const out = createCliOutput(args.json === true);
20782
+ const { host, issues } = resolvePrEditTarget(createRealExecutor$1(), process.cwd(), args.repo ?? void 0);
20783
+ const number = parsePrNumber(args.number);
20784
+ if (!(await issues.get(number)).isPullRequest) throw new FatalError(`#${String(number)} is an issue, not a pull request -- pr:reopen refuses to write issue state. Use \`pnpm exec bst issue:reopen ${String(number)}\` to reopen it.`);
20785
+ const result = await runPrReopen(host, {
20786
+ number,
20787
+ dryRun: args["dry-run"] === true
20788
+ });
20789
+ out.json(result);
20790
+ out.text(renderPrReopen(result));
20791
+ }
20792
+ });
20793
+ // src/commands/pr/pr-retarget.ts
20623
20794
  const prRetargetCommand = defineCommand({
20624
20795
  meta: {
20625
20796
  name: "pr:retarget",
@@ -20666,7 +20837,7 @@ const prRetargetCommand = defineCommand({
20666
20837
  out.text(renderPrRetarget(result));
20667
20838
  }
20668
20839
  });
20669
- // src/commands/pr-update.ts
20840
+ // src/commands/pr/pr-update.ts
20670
20841
  const prUpdateCommand = defineCommand({
20671
20842
  meta: {
20672
20843
  name: "pr:update",
@@ -20966,7 +21137,7 @@ async function createPlatformRelease(executor, config, tag, version) {
20966
21137
  log$1.info(`Created GitHub release for ${tag}`);
20967
21138
  return true;
20968
21139
  }
20969
- // src/commands/release-simple.ts
21140
+ // src/commands/release/release-simple.ts
20970
21141
  const releaseSimpleCommand = defineCommand({
20971
21142
  meta: {
20972
21143
  name: "release:simple",
@@ -21054,7 +21225,7 @@ const releaseSimpleCommand = defineCommand({
21054
21225
  }
21055
21226
  }
21056
21227
  });
21057
- // src/commands/release-assets.ts
21228
+ // src/commands/release/release-assets.ts
21058
21229
  const releaseAssetsCommand = defineCommand({
21059
21230
  meta: {
21060
21231
  name: "release:assets",
@@ -21369,7 +21540,7 @@ const lintReportCommand = defineCommand({
21369
21540
  process.exitCode = exitCode;
21370
21541
  }
21371
21542
  });
21372
- // src/commands/publish-docker.ts
21543
+ // src/commands/docker/publish-docker.ts
21373
21544
  function requireDockerCredentials(registryHost) {
21374
21545
  const username = process.env["DOCKER_USERNAME"];
21375
21546
  const password = process.env["DOCKER_PASSWORD"];
@@ -21444,7 +21615,7 @@ const publishDockerCommand = defineCommand({
21444
21615
  runDockerPublish(createRealExecutor$1(), config);
21445
21616
  }
21446
21617
  });
21447
- // src/commands/docker-build.ts
21618
+ // src/commands/docker/docker-build.ts
21448
21619
  function detectSubpackage(cwd) {
21449
21620
  const parent = path.dirname(cwd);
21450
21621
  if (path.basename(parent) === "packages" && existsSync(path.join(parent, "..", "package.json"))) return {
@@ -21797,7 +21968,7 @@ function composePs(executor, config) {
21797
21968
  // src/docker-check/health.ts
21798
21969
  const DOCKER_RUN_START_FAILURE_EXIT_CODE = 125;
21799
21970
  const PROBE_TIMEOUT_SECONDS = "5";
21800
- const PROBE_IMAGE = "curlimages/curl:8.23.0@sha256:11e64e28c5f58c8d93ee95fcf22ac055f48b0bc440e0ce7d8013bbb5ad6aa8ac";
21971
+ const PROBE_IMAGE = "curlimages/curl:8.23.0@sha256:3fb7e13e5d179a845c97d78204f3f1064d1907037f26a3ebf91710571151fd93";
21801
21972
  function getContainerHealth(containers, serviceName) {
21802
21973
  return containers.find((c) => c.Service === serviceName)?.Health ?? "unknown";
21803
21974
  }
@@ -22053,7 +22224,7 @@ function deriveProjectName(repoName, env = process.env) {
22053
22224
  function sanitize(name) {
22054
22225
  return name.replace(/^@[^/]+\//, "").toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
22055
22226
  }
22056
- // src/commands/docker-check.ts
22227
+ // src/commands/docker/docker-check.ts
22057
22228
  function toHttpHealthChecks(checks) {
22058
22229
  return checks.map((check) => ({
22059
22230
  name: check.name,
@@ -22178,7 +22349,7 @@ const dockerCheckCommand = defineCommand({
22178
22349
  }
22179
22350
  }
22180
22351
  });
22181
- // src/commands/docker-sweep.ts
22352
+ // src/commands/docker/docker-sweep.ts
22182
22353
  function parseMaxAgeHours(raw) {
22183
22354
  const value = Number(raw);
22184
22355
  if (raw.trim() === "" || !Number.isFinite(value) || value < 0) throw new FatalError(`--max-age must be a non-negative number of hours, got "${raw}"`);
@@ -23285,14 +23456,14 @@ function formatTimestamp(iso) {
23285
23456
  if (Number.isNaN(date.getTime())) return iso;
23286
23457
  return `${String(date.getUTCFullYear())}-${String(date.getUTCMonth() + 1).padStart(2, "0")}-${String(date.getUTCDate()).padStart(2, "0")}`;
23287
23458
  }
23288
- // src/commands/coverage-missing-summary.ts
23459
+ // src/commands/coverage-tracking/coverage-missing-summary.ts
23289
23460
  const COVERAGE_SUMMARY_FILE$3 = "coverage/coverage-summary.json";
23290
23461
  function missingSummaryMessage(targetDir) {
23291
23462
  const base = `${COVERAGE_SUMMARY_FILE$3} not found. Run \`pnpm test:coverage\` first, or add "json-summary" to your vitest reporters.`;
23292
23463
  const hint = diagnoseCheckScriptForwardingAt(targetDir);
23293
23464
  return hint ? `${base}\n\n${hint}` : base;
23294
23465
  }
23295
- // src/commands/coverage-summary.ts
23466
+ // src/commands/coverage-tracking/coverage-summary.ts
23296
23467
  const COVERAGE_SUMMARY_FILE$2 = "coverage/coverage-summary.json";
23297
23468
  function readSummary(targetDir) {
23298
23469
  const summaryPath = path.join(targetDir, COVERAGE_SUMMARY_FILE$2);
@@ -23356,7 +23527,7 @@ const coverageSummaryCommand = defineCommand({
23356
23527
  function serializeBaseline(baseline) {
23357
23528
  return JSON.stringify(baseline, null, 2) + "\n";
23358
23529
  }
23359
- // src/commands/coverage-check.ts
23530
+ // src/commands/coverage-tracking/coverage-check.ts
23360
23531
  const COVERAGE_SUMMARY_FILE$1 = "coverage/coverage-summary.json";
23361
23532
  const BASELINE_FILE$2 = "coverage-baseline.json";
23362
23533
  const MIGRATION_NOTICE = `${BASELINE_FILE$2} predates coverage.include scoping (no scope marker). Totals may have shifted because previously-untested files entered the denominator for the first time -- that is not necessarily a regression. This comparison is advisory only until the baseline is migrated: run \`pnpm test:coverage && pnpm exec bst coverage:check --update-baseline --reset\` once to adopt the honest, marked baseline. Normal gating resumes after that.`;
@@ -23461,7 +23632,7 @@ const coverageCheckCommand = defineCommand({
23461
23632
  if (!result.pass && !isLegacyBaseline) process.exitCode = 1;
23462
23633
  }
23463
23634
  });
23464
- // src/commands/coverage-record.ts
23635
+ // src/commands/coverage-tracking/coverage-record.ts
23465
23636
  const COVERAGE_SUMMARY_FILE = "coverage/coverage-summary.json";
23466
23637
  const coverageRecordCommand = defineCommand({
23467
23638
  meta: {
@@ -23531,7 +23702,7 @@ const coverageRecordCommand = defineCommand({
23531
23702
  });
23532
23703
  }
23533
23704
  });
23534
- // src/commands/coverage-status.ts
23705
+ // src/commands/coverage-tracking/coverage-status.ts
23535
23706
  const coverageStatusCommand = defineCommand({
23536
23707
  meta: {
23537
23708
  name: "coverage:status",
@@ -23577,7 +23748,7 @@ const coverageStatusCommand = defineCommand({
23577
23748
  out.text(formatTrendTable(trailing));
23578
23749
  }
23579
23750
  });
23580
- // src/codebase-health/baseline.ts
23751
+ // src/codebase-health/baseline/baseline.ts
23581
23752
  function serializeHealthBaseline(metrics, ceilings, sizeBudgets) {
23582
23753
  const ordered = {};
23583
23754
  for (const key of METRIC_KEYS) {
@@ -23599,7 +23770,7 @@ function writeHealthBaseline(targetDir, baseline) {
23599
23770
  const format = healthFileFormatter(targetDir);
23600
23771
  writeFileSync(path.join(targetDir, "health-baseline.json"), format("health-baseline.json", serializeHealthBaseline(baseline, baseline.moduleCeilings, baseline.sizeBudgets)));
23601
23772
  }
23602
- // src/codebase-health/exclude.ts
23773
+ // src/codebase-health/collect/exclude.ts
23603
23774
  function normalize(rel) {
23604
23775
  const posix = rel.replace(/\\/g, "/");
23605
23776
  return posix.startsWith("./") ? posix.slice(2) : posix;
@@ -23624,7 +23795,7 @@ function createExcludeMatcher(patterns) {
23624
23795
  return ancestors(normalized).some((dir) => isMatch(dir));
23625
23796
  };
23626
23797
  }
23627
- // src/codebase-health/exempt-match.ts
23798
+ // src/codebase-health/collect/exempt-match.ts
23628
23799
  function exemptKeyMatcher(key) {
23629
23800
  if (!picomatch.scan(key).isGlob) return (path) => path === key;
23630
23801
  const isMatch = picomatch(key, { dot: true });
@@ -23637,7 +23808,7 @@ function createExemptLookup(reasons) {
23637
23808
  }));
23638
23809
  return (path) => reasons[path] ?? globs.find((glob) => glob.matches(path))?.reason;
23639
23810
  }
23640
- // src/codebase-health/depcruise.ts
23811
+ // src/codebase-health/collect/depcruise.ts
23641
23812
  const DependencySchema = z.object({
23642
23813
  module: z.string(),
23643
23814
  resolved: z.string(),
@@ -23897,7 +24068,7 @@ function collectGraphDetails(executor, config, isExcluded = () => false, sourceL
23897
24068
  workspacePackages
23898
24069
  }) };
23899
24070
  }
23900
- // src/codebase-health/workspace-packages.ts
24071
+ // src/codebase-health/collect/workspace-packages.ts
23901
24072
  const PnpmWorkspaceSchema = z.object({ packages: z.array(z.string()).optional() });
23902
24073
  const RootManifestSchema = z.object({ workspaces: z.union([z.array(z.string()), z.object({ packages: z.array(z.string()) })]).optional() });
23903
24074
  const PackageNameSchema = z.object({ name: z.string() });
@@ -23991,7 +24162,7 @@ function listWorkspacePackageNames(executor) {
23991
24162
  }
23992
24163
  return names;
23993
24164
  }
23994
- // src/codebase-health/collect.ts
24165
+ // src/codebase-health/collect/collect.ts
23995
24166
  function buildCollectConfig(config, opts) {
23996
24167
  return {
23997
24168
  src: config.src,
@@ -24390,7 +24561,7 @@ function isFlatOrBetter(baseline, current, currentCeilings = {}, sizes = []) {
24390
24561
  });
24391
24562
  return metricsFlat && ceilingsFlat && sizesFlat;
24392
24563
  }
24393
- // src/codebase-health/raise.ts
24564
+ // src/codebase-health/baseline/raise.ts
24394
24565
  const SIZE_RAISE_FACTOR = 1.01;
24395
24566
  function sizeRaiseValue(measured) {
24396
24567
  return Math.floor(measured * SIZE_RAISE_FACTOR) + 1;
@@ -24779,7 +24950,7 @@ const CARRIED_RAISES_FIRST_LINE = "raises carried by this branch:";
24779
24950
  function formatCarriedRaises(raises) {
24780
24951
  return [CARRIED_RAISES_FIRST_LINE, ...raises.map((r) => ` ${r.leaf}: ${r.reference} -> ${r.current}`)].join("\n");
24781
24952
  }
24782
- // src/codebase-health/tighten.ts
24953
+ // src/codebase-health/baseline/tighten.ts
24783
24954
  const GRAPH_METRIC_KEYS = new Set(METRIC_KEYS.filter((key) => key !== "crowdedDirectories"));
24784
24955
  function isGraphMetric(key) {
24785
24956
  return GRAPH_METRIC_KEYS.has(key);
@@ -24849,7 +25020,7 @@ function slackRecords(input) {
24849
25020
  });
24850
25021
  }
24851
25022
  }
24852
- for (const outlier of [...attribution.baseOutliers, ...attribution.unattributedOutliers]) {
25023
+ for (const outlier of attribution.baseOutliers) {
24853
25024
  if (!graphMeasured && isGraphMetric(outlier.key)) continue;
24854
25025
  records.push({
24855
25026
  kind: "uncapped",
@@ -24953,7 +25124,15 @@ function planHealthTighten(input) {
24953
25124
  caps
24954
25125
  };
24955
25126
  }
24956
- // src/codebase-health/base-checkout.ts
25127
+ function baselineUpdateRefusal(attribution) {
25128
+ if (attribution.newOutliers.length > 0) return "Skipped baseline update: an outlier crossed a limit for the first time this run. Record it with \"health:raise\", which writes the ceiling beside the reason it was earned.";
25129
+ if (attribution.unattributedOutliers.length > 0) {
25130
+ const base = attribution.outlierBase;
25131
+ return `Skipped baseline update: an outlier has no recorded ceiling and no merge-base measurement to clear it.${base.status === "unavailable" ? ` The merge base could not be measured: ${base.reason}.` : ""} Record it with "health:raise", which writes the ceiling beside the reason it was earned.`;
25132
+ }
25133
+ return null;
25134
+ }
25135
+ // src/codebase-health/baseline/base-checkout.ts
24957
25136
  const TEMP_PREFIX = "bst-health-base-";
24958
25137
  function withMergeBaseCheckout(executor, targetDir, mergeBase, use) {
24959
25138
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), TEMP_PREFIX));
@@ -25042,7 +25221,7 @@ function linkRelative(link, target) {
25042
25221
  fs.symlinkSync(link, target);
25043
25222
  } catch (_error) {}
25044
25223
  }
25045
- // src/codebase-health/base-outliers.ts
25224
+ // src/codebase-health/baseline/base-outliers.ts
25046
25225
  function unavailable(reason) {
25047
25226
  return {
25048
25227
  status: "unavailable",
@@ -25071,7 +25250,7 @@ function measureBaseOutliers(opts) {
25071
25250
  return unavailable(describeError$1(error));
25072
25251
  }
25073
25252
  }
25074
- // src/codebase-health/size.ts
25253
+ // src/codebase-health/collect/size.ts
25075
25254
  function byteLength(absolute) {
25076
25255
  try {
25077
25256
  const stats = statSync(absolute);
@@ -25322,7 +25501,7 @@ function findStaleEntries(baseline, details, exempt) {
25322
25501
  }
25323
25502
  return stale;
25324
25503
  }
25325
- // src/commands/health-check.ts
25504
+ // src/commands/health/health-check.ts
25326
25505
  function assessSwitchOff(executor, targetDir, config, out) {
25327
25506
  const read = readTargetReference(executor, targetDir, out);
25328
25507
  if (read.kind === "unavailable") return void 0;
@@ -25421,7 +25600,8 @@ function applyBaselineUpdate(state, existing, reset) {
25421
25600
  });
25422
25601
  out.notice(`Reset ${BASELINE_FILE$1} to the current run.`);
25423
25602
  } else if (isFlatOrBetter(baseline, current, ceilings, sizes)) {
25424
- if (attribution.newOutliers.length > 0) out.notice("Skipped baseline update: an outlier crossed a limit for the first time this run. Record it with \"health:raise\", which writes the ceiling beside the reason it was earned.");
25603
+ const refusal = baselineUpdateRefusal(attribution);
25604
+ if (refusal !== null) out.notice(refusal);
25425
25605
  else {
25426
25606
  const plan = planHealthTighten({
25427
25607
  comparison: result,
@@ -25547,7 +25727,7 @@ const healthCheckCommand = defineCommand({
25547
25727
  if (!verdictPasses || graphUnavailable !== void 0) process.exitCode = 1;
25548
25728
  }
25549
25729
  });
25550
- // src/commands/health-raise.ts
25730
+ // src/commands/health/health-raise.ts
25551
25731
  const JsonValueSchema = z.json();
25552
25732
  const TOOLING_FILE = ".tooling.json";
25553
25733
  function collectExemptPairs(rawArgs) {
@@ -25665,7 +25845,7 @@ function writePlan(targetDir, plan) {
25665
25845
  }
25666
25846
  return wrote;
25667
25847
  }
25668
- // src/commands/health-tighten.ts
25848
+ // src/commands/health/health-tighten.ts
25669
25849
  const BASELINE_FILE = "health-baseline.json";
25670
25850
  function describePlan(plan) {
25671
25851
  const lines = [];
@@ -25829,7 +26009,7 @@ function formatModuleReports(reports) {
25829
26009
  }
25830
26010
  return lines.join("\n");
25831
26011
  }
25832
- // src/commands/health-summary.ts
26012
+ // src/commands/health/health-summary.ts
25833
26013
  function readCoverageNote(targetDir) {
25834
26014
  const file = path.join(targetDir, "coverage-baseline.json");
25835
26015
  if (!existsSync(file)) return void 0;
@@ -25934,7 +26114,7 @@ const healthSummaryCommand = defineCommand({
25934
26114
  if (moduleReports !== void 0) out.text(formatModuleReports(moduleReports));
25935
26115
  }
25936
26116
  });
25937
- // src/codebase-health/history.ts
26117
+ // src/codebase-health/baseline/history.ts
25938
26118
  const HEALTH_HISTORY_FILE = "health-history.jsonl";
25939
26119
  function appendHealthRecord(executor, config, record) {
25940
26120
  return appendRecord(executor, {
@@ -25949,7 +26129,7 @@ function readHealthRecords(executor, config) {
25949
26129
  historyFile: HEALTH_HISTORY_FILE
25950
26130
  }, parseHealthHistoryLine);
25951
26131
  }
25952
- // src/commands/health-record.ts
26132
+ // src/commands/health/health-record.ts
25953
26133
  const healthRecordCommand = defineCommand({
25954
26134
  meta: {
25955
26135
  name: "health:record",
@@ -26024,7 +26204,7 @@ const healthRecordCommand = defineCommand({
26024
26204
  });
26025
26205
  }
26026
26206
  });
26027
- // src/commands/health-status.ts
26207
+ // src/commands/health/health-status.ts
26028
26208
  const healthStatusCommand = defineCommand({
26029
26209
  meta: {
26030
26210
  name: "health:status",
@@ -27383,7 +27563,7 @@ function formatReport(result) {
27383
27563
  lines.push(`[x] docs: ${String(fatal.length)} violation(s).`, "", ...group(fatal), "The plan-lifecycle guide (`.agent/guides/plan-lifecycle.md`) is the spec for all of this.", "Reminder: a doc's DIRECTORY is the source of truth for done-ness -- not its Status line, not its checkboxes.");
27384
27564
  return lines.join("\n");
27385
27565
  }
27386
- // src/commands/docs-check.ts
27566
+ // src/commands/docs/docs-check.ts
27387
27567
  function runDocsCheck(exec, config, opts) {
27388
27568
  const vc = { verbose: opts.verbose ?? false };
27389
27569
  if (!config.enabled) {
@@ -27524,7 +27704,7 @@ function listOpenDocs(exec, config, options = {}) {
27524
27704
  }
27525
27705
  return docs.toSorted(byPath);
27526
27706
  }
27527
- // src/commands/docs-list.ts
27707
+ // src/commands/docs/docs-list.ts
27528
27708
  function dayOf(iso) {
27529
27709
  if (iso === void 0) return "unknown";
27530
27710
  const day = iso.slice(0, 10);
@@ -27771,7 +27951,7 @@ function createRealRelocateExecutor(rootDir) {
27771
27951
  }
27772
27952
  };
27773
27953
  }
27774
- // src/commands/docs-delink.ts
27954
+ // src/commands/docs/docs-delink.ts
27775
27955
  const RETIRED_DIR_NAMES = /* @__PURE__ */ new Set(["retired", "completed"]);
27776
27956
  function assertRetiredDirs(dirs) {
27777
27957
  if (dirs.length === 0) throw new FatalError("docs:delink: at least one retired/ directory is required");
@@ -27967,7 +28147,7 @@ function applyRelocatePlan(exec, plan) {
27967
28147
  for (const move of plan.moves) if (move.status === "pending") exec.move(move.from, move.to);
27968
28148
  for (const rewrite of plan.rewrites) exec.writeFile(rewrite.file, rewrite.content);
27969
28149
  }
27970
- // src/commands/docs-relocate.ts
28150
+ // src/commands/docs/docs-relocate.ts
27971
28151
  function isExistingDirectory(exec, rel) {
27972
28152
  return exec.exists(rel) && exec.readFile(rel) === void 0;
27973
28153
  }
@@ -28066,7 +28246,7 @@ const docsRelocateCommand = defineCommand({
28066
28246
  function localToday(now) {
28067
28247
  return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
28068
28248
  }
28069
- // src/commands/docs-retire.ts
28249
+ // src/commands/docs/docs-retire.ts
28070
28250
  const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
28071
28251
  function validateRetireArgs(exec, src, opts) {
28072
28252
  if (!isRetireVerb(opts.status)) throw new FatalError(`docs:retire: unrecognized --status "${opts.status}" (expected one of: ${RETIRE_VERBS.join(", ")})`);
@@ -28416,7 +28596,7 @@ async function runIssueCreate(executor, options) {
28416
28596
  throw error;
28417
28597
  }
28418
28598
  }
28419
- // src/commands/issue-view.ts
28599
+ // src/commands/issue/issue-view.ts
28420
28600
  const issueViewCommand = defineCommand({
28421
28601
  meta: {
28422
28602
  name: "issue:view",
@@ -28455,7 +28635,7 @@ const issueViewCommand = defineCommand({
28455
28635
  log$1.info(formatIssue(view));
28456
28636
  }
28457
28637
  });
28458
- // src/commands/issue-list.ts
28638
+ // src/commands/issue/issue-list.ts
28459
28639
  const issueListCommand = defineCommand({
28460
28640
  meta: {
28461
28641
  name: "issue:list",
@@ -28508,7 +28688,7 @@ const issueListCommand = defineCommand({
28508
28688
  log$1.info(formatIssueList(result));
28509
28689
  }
28510
28690
  });
28511
- // src/commands/issue-comment.ts
28691
+ // src/commands/issue/issue-comment.ts
28512
28692
  const issueCommentCommand = defineCommand({
28513
28693
  meta: {
28514
28694
  name: "issue:comment",
@@ -28563,7 +28743,7 @@ const issueCommentCommand = defineCommand({
28563
28743
  log$1.info(formatIssueComment(result, args["dry-run"] === true));
28564
28744
  }
28565
28745
  });
28566
- // src/commands/issue-create.ts
28746
+ // src/commands/issue/issue-create.ts
28567
28747
  function collectLabelArgs(rawArgs) {
28568
28748
  return collectFlagValues(rawArgs, "--label");
28569
28749
  }
@@ -28644,7 +28824,7 @@ const issueCreateCommand = defineCommand({
28644
28824
  for (const line of formatIssueCreate(result, args.title, args["dry-run"] === true)) log$1.info(line);
28645
28825
  }
28646
28826
  });
28647
- // src/commands/issue-update.ts
28827
+ // src/commands/issue/issue-update.ts
28648
28828
  const issueUpdateCommand = defineCommand({
28649
28829
  meta: {
28650
28830
  name: "issue:update",
@@ -28827,7 +29007,7 @@ async function runIssueDownload(executor, options) {
28827
29007
  throw error;
28828
29008
  }
28829
29009
  }
28830
- // src/commands/issue-download.ts
29010
+ // src/commands/issue/issue-download.ts
28831
29011
  const issueDownloadCommand = defineCommand({
28832
29012
  meta: {
28833
29013
  name: "issue:download",
@@ -28977,7 +29157,7 @@ async function runIssueLabel(executor, options) {
28977
29157
  throw error;
28978
29158
  }
28979
29159
  }
28980
- // src/commands/issue-label.ts
29160
+ // src/commands/issue/issue-label.ts
28981
29161
  function defineIssueLabelCommand(action) {
28982
29162
  return defineCommand({
28983
29163
  meta: {
@@ -29056,7 +29236,7 @@ async function runIssueSetLabels(executor, options) {
29056
29236
  throw error;
29057
29237
  }
29058
29238
  }
29059
- // src/commands/issue-set-labels.ts
29239
+ // src/commands/issue/issue-set-labels.ts
29060
29240
  const issueSetLabelsCommand = defineCommand({
29061
29241
  meta: {
29062
29242
  name: "issue:set-labels",
@@ -29229,16 +29409,16 @@ async function runIssueState(executor, options) {
29229
29409
  file: "--comment-file"
29230
29410
  }));
29231
29411
  if (error instanceof PullRequestStateError) {
29232
- const ghAlternative = error.action === "close" ? "gh pr close" : "gh pr reopen";
29412
+ const advice = error.action === "close" ? `Run \`pnpm exec bst-fj pr:close ${String(error.number)}\` to close it; that bin installs with \`@bensandee/forgejo-cli\`. On GitHub, \`gh pr close ${String(error.number)}\`.` : `Run \`pnpm exec bst pr:reopen ${String(error.number)}\` to reopen it.`;
29233
29413
  throw new FatalError(describePullRequestState(error, {
29234
29414
  command: `issue:${error.action}`,
29235
- advice: `Use the forge UI, or \`${ghAlternative}\` on GitHub.`
29415
+ advice
29236
29416
  }));
29237
29417
  }
29238
29418
  throw error;
29239
29419
  }
29240
29420
  }
29241
- // src/commands/issue-state.ts
29421
+ // src/commands/issue/issue-state.ts
29242
29422
  function defineIssueStateCommand(action) {
29243
29423
  return defineCommand({
29244
29424
  meta: {
@@ -29301,7 +29481,7 @@ function defineIssueStateCommand(action) {
29301
29481
  }
29302
29482
  const issueCloseCommand = defineIssueStateCommand("close");
29303
29483
  const issueReopenCommand = defineIssueStateCommand("reopen");
29304
- // src/commands/findings-add.ts
29484
+ // src/commands/findings/findings-add.ts
29305
29485
  const SOURCE_RE = /^(pr|issue)#(\d+)$/;
29306
29486
  const ALLOWED_CLASSES = ["nit", "pre-existing"];
29307
29487
  function parseSource(source) {
@@ -29418,7 +29598,7 @@ const findingsAddCommand = defineCommand({
29418
29598
  if (result.createdLedgerDir) out.notice(`Created ${FINDINGS_DIR}/ -- the backlog sweep is now armed for this repo.`);
29419
29599
  }
29420
29600
  });
29421
- // src/commands/findings-list.ts
29601
+ // src/commands/findings/findings-list.ts
29422
29602
  const MS_PER_DAY = 864e5;
29423
29603
  function readFindingSummary(fullPath) {
29424
29604
  let body;
@@ -29501,7 +29681,7 @@ const findingsListCommand = defineCommand({
29501
29681
  out.text(renderText(result));
29502
29682
  }
29503
29683
  });
29504
- // src/commands/findings-resolve.ts
29684
+ // src/commands/findings/findings-resolve.ts
29505
29685
  function resolveFindingPath(rootDir, name) {
29506
29686
  const ledgerDir = path.join(rootDir, FINDINGS_DIR);
29507
29687
  const relative = name.includes("/") ? name : `${FINDINGS_DIR}/${name}`;
@@ -30077,7 +30257,7 @@ async function runCli(config) {
30077
30257
  // src/cli-main.ts
30078
30258
  setLogLevel(resolveLogLevel({}));
30079
30259
  setForgejoLogger(log$1);
30080
- const displayVersion = "0.103.0";
30260
+ const displayVersion = "0.105.0";
30081
30261
  const bstSubCommands = {
30082
30262
  "repo:sync": syncCommand,
30083
30263
  "checks:run": runChecksCommand,
@@ -30089,6 +30269,7 @@ const bstSubCommands = {
30089
30269
  "changesets:merge": releaseMergeCommand,
30090
30270
  "pr:create": prCreateCommand,
30091
30271
  "pr:ready": prReadyCommand,
30272
+ "pr:reopen": prReopenCommand,
30092
30273
  "pr:retarget": prRetargetCommand,
30093
30274
  "pr:update": prUpdateCommand,
30094
30275
  "release:simple": releaseSimpleCommand,