@bensandee/tooling 0.98.0 → 0.99.1

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
@@ -175,7 +175,7 @@ function loadEnvFileForBin(rawArgs, bin, io = processIo) {
175
175
  //#region src/env-file-preload.ts
176
176
  const envFileLoad = loadEnvFileForBin(process.argv.slice(2), {
177
177
  name: "bst",
178
- version: "0.98.0"
178
+ version: "0.99.1"
179
179
  });
180
180
  //#endregion
181
181
  //#region ../cli-kit/src/logger.ts
@@ -1742,16 +1742,17 @@ const FindingHoldsConfigSchema = z.strictObject({
1742
1742
  const LintSweepConfigSchema = z.strictObject({
1743
1743
  enabled: z.boolean().optional().meta({ description: "Whether the agent's lint-warning sweep may open pull requests in this repo (default: on). false disarms it; the repo is then never cloned or measured by it." }),
1744
1744
  minWarnings: z.number().int().nonnegative().optional().meta({ description: "How many oxlint warnings the default branch must carry before the sweep opens a pull request (default 5). Below the floor the warn marker on checks:run is the whole response." }),
1745
- cooldownDays: z.number().int().nonnegative().optional().meta({ description: "Days after a lint-sweep pull request merged or closed before the sweep may open another (default 7): a merged sweep whose declined warnings survive must not re-file them the next morning." })
1745
+ cooldownDays: z.number().int().nonnegative().optional().meta({ description: "Days after a lint-sweep pull request merged or closed before the sweep may open another (default 7): a merged sweep whose declined warnings survive must not re-file them the next morning." }),
1746
+ compatIssues: z.boolean().optional().meta({ description: "Whether the sweep splits expired @compat warnings out of its plan and files one issue per expired id (default: on). false keeps them in the bulk plan with the other warnings." })
1746
1747
  });
1747
- const AgentEgressConfigSchema = z.strictObject({ browseHosts: z.array(z.string().min(1)).optional().meta({ description: "Host patterns this repo's agent containers may fetch from, on top of the hosts every run needs: an exact host (`fastdl.mongodb.org`) or a wildcard over its leftmost label (`*.example.com`). No ports. These join the browse lane, which serves GET and HEAD only." }) });
1748
+ const AgentEgressConfigSchema = z.strictObject({ browseHosts: z.array(z.string().min(1)).optional().meta({ description: "Host patterns this repo's agent containers ask to fetch from, on top of the hosts every run needs: an exact host (`fastdl.mongodb.org`) or a wildcard over its leftmost label (`*.example.com`). No ports. This list is a request the deployment grants, not an opening: its grant mode decides whether a default branch's requests take effect on their own, an admin can refuse a host for this repo, and a host the product or the deployment known-denies is never opened whatever the declaration or the verdict says. What is granted joins the browse lane, which serves GET and HEAD only." }) });
1748
1749
  const AgentConfigSchema = z.strictObject({
1749
1750
  enabled: z.boolean().optional().meta({ description: "The repo's explicit consent to the agent (default false). Only `true`, read from the repo's **default branch**, lets the agent work the repo: claim units, run sweeps, recover orphans, merge, act on a chat proposal or start a new spec. A missing key, `false`, a missing `.tooling.json` or a read that fails all mean not enabled, and the answer is re-read within about a minute. Every other `agent.*` key below has no effect without this one; `repo:sync` warns when the block sets one of them and this key is not `true`. Where this is `true`, `repo:sync` also installs `@bensandee/agent-cli`. `pnpm exec bst setup:agent` sets it to true and runs the sync. Provisioning the agent's labels is not consent, and is never gated by this key." }),
1750
1751
  autonomy: z.boolean().optional().meta({ description: "Retired and ignored -- it armed neither the advance rung nor the sweeps it once did. Advance is now the unit's own `agent-flags/advance` or `agent-flags/autopilot` label, and the trunk-red detector and world-changed retrigger sweep read `agent.trunkRed`. The key is still accepted so an existing config keeps syncing; the agent warns once per launch for a repo that still sets it." }),
1751
1752
  trunkRed: z.boolean().optional().meta({ description: "Whether this repo's trunk-red detector and world-changed retrigger sweep run (default: on). The detector files a tracking issue when the default branch's combined status settles red and labels it agent/spec, and closes that issue with a comment if the branch recovers on its own before a human acts on it. The retrigger sweep re-queues a pull request labelled agent-flags/autopilot parked at a -stuck or -failed terminal when the fact its park recorded stops being true (the default branch went green, or moved past a conflicted base). A missing key means on; false disarms both." }),
1752
1753
  preRunRebase: z.boolean().optional().meta({ description: "Merge the current default branch into the work branch before the container starts (default true) -- for an implement (execute) run, and for a spec or plan rerun on an existing branch. A clean merge or an already-up-to-date branch runs the container as is; a conflicting merge is aborted, recorded on the run's status comment, and the run proceeds on the un-synced branch -- a conflict, timeout or failed merge never fails the run, for any phase. Only the execute phase keeps the two-strike rule: two consecutive conflicting attempts hand the unit to agent/repair before any container runs, while a docs run just tries again on its next slice. Set false to skip the attempt entirely for this repo, in every phase: no fetch, no merge, no abort, and the branch is worked exactly as cloned." }),
1753
1754
  backlog: z.boolean().optional().meta({ description: "Whether the agent may self-trigger backlog runs consuming this repo's .agent/findings/ ledger (default: on wherever the ledger exists, which only happens in a repo whose own review loop wrote it). A backlog run opens a pull request that fixes or refutes the pending findings; false disarms it, leaving the ledger to accumulate for a human. A run starts only once at least three findings are pending or one is older than seven days." }),
1754
- lintSweep: LintSweepConfigSchema.optional().meta({ description: "The lint-warning sweep: a periodic agent job that measures this repo's oxlint warnings on its default branch in a container and, past minWarnings, opens a pull request carrying a generated plan for an agent/implement run to work off." }),
1755
+ lintSweep: LintSweepConfigSchema.optional().meta({ description: "The lint-warning sweep: a periodic agent job that measures this repo's oxlint warnings on its default branch in a container and, past minWarnings, opens a pull request carrying a generated plan for an agent/implement run to work off. Expired @compat warnings leave that plan and each get their own issue instead (see compatIssues)." }),
1755
1756
  priority: z.record(z.string(), z.enum([
1756
1757
  "critical",
1757
1758
  "high",
@@ -1759,7 +1760,7 @@ const AgentConfigSchema = z.strictObject({
1759
1760
  "low"
1760
1761
  ])).optional().meta({ description: "Map this repo's own issue-label names onto the agent's four priority levels, e.g. {\"P1\": \"critical\", \"P4\": \"low\"}. The map UNIONS with the built-in priority/<level> names rather than replacing them, and the agent does not create aliased labels -- the repo owns names the agent did not choose. Priority affects claim order only: it never changes a run's model, effort, or any budget." }),
1761
1762
  triageAnalysis: z.boolean().optional().meta({ description: "Whether the agent may route its own agent-note/human-triage-needed issues through the agent/analyze stage (default: off). Unlike agent.backlog, which defaults on, this defaults off: a backlog run batches every pending finding into one container, while triage routing spends one container per issue -- arming it is the reversible direction, not disarming it." }),
1762
- egress: AgentEgressConfigSchema.optional().meta({ description: "Extra egress hosts this repo's agent containers may reach. `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: the declaration takes effect on the first container started after a human merges it. An entry whose pattern the agent cannot parse refuses the run rather than being dropped. Changing this block holds the pull request from automerge." }),
1763
+ 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." }),
1763
1764
  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." }),
1764
1765
  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." })
1765
1766
  });
@@ -5700,9 +5701,9 @@ function buildManagedDevDeps(ctx) {
5700
5701
  const devDeps = { ...rootDevDeps(ctx.config) };
5701
5702
  if (!isMonorepo) Object.assign(devDeps, perPackageDevDeps(ctx.config));
5702
5703
  if (ctx.config.stack !== "none") devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.15.0";
5703
- if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.98.0";
5704
+ if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.99.1";
5704
5705
  if (ctx.config.useEslintPlugin && ctx.config.stack !== "none") devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.17.0";
5705
- if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.2.0";
5706
+ if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.3.0";
5706
5707
  if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = {
5707
5708
  "@changesets/cli": "3.0.3",
5708
5709
  "@release-it/bumper": "8.0.1",
@@ -10340,7 +10341,7 @@ function reportFailures(failed, command) {
10340
10341
  function generateMigratePrompt(results, config, detected) {
10341
10342
  const sections = [];
10342
10343
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
10343
- sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.98.0 repo:sync\` on ${timestamp}_\n`);
10344
+ sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.99.1 repo:sync\` on ${timestamp}_\n`);
10344
10345
  const changed = results.filter((r) => r.action === "created" || r.action === "updated" || r.action === "archived");
10345
10346
  if (changed.length > 0) {
10346
10347
  const items = changed.map((r) => {
@@ -13661,200 +13662,6 @@ async function runPublishMode(executor, config) {
13661
13662
  };
13662
13663
  }
13663
13664
  //#endregion
13664
- //#region ../forgejo/src/commit-status.ts
13665
- const CombinedStatusSchema = z.object({
13666
- state: z.string(),
13667
- statuses: z.array(z.unknown())
13668
- });
13669
- const CheckEntrySchema = z.object({
13670
- context: z.string().nullish(),
13671
- status: z.string().nullish(),
13672
- description: z.string().nullish(),
13673
- target_url: z.string().nullish(),
13674
- updated_at: z.string().nullish(),
13675
- id: z.number().nullish()
13676
- });
13677
- function isSettledRed(checks) {
13678
- if (!checks.parsed || checks.green || checks.contexts.length === 0) return false;
13679
- if (checks.contexts.some((context) => context.verdict === "pending")) return false;
13680
- return checks.contexts.some((context) => context.verdict === "red");
13681
- }
13682
- const TRAILING_EVENT = / \([^()]+\)$/;
13683
- function classifyVerdict(state) {
13684
- if (state === "success") return "good";
13685
- if (state === "pending") return "pending";
13686
- if (state === "skipped" || state === "neutral") return "skipped";
13687
- return "red";
13688
- }
13689
- function entryKey(entry, index) {
13690
- if (typeof entry.context === "string" && entry.context.length > 0) return entry.context;
13691
- return `#${String(index)}`;
13692
- }
13693
- function updatedAtMillis(value) {
13694
- if (!value) return 0;
13695
- const parsed = Date.parse(value);
13696
- return Number.isNaN(parsed) ? 0 : parsed;
13697
- }
13698
- function dedupeEntries(entries) {
13699
- const byKey = /* @__PURE__ */ new Map();
13700
- entries.forEach((entry, index) => {
13701
- const key = entryKey(entry, index);
13702
- const existing = byKey.get(key);
13703
- if (!existing) {
13704
- byKey.set(key, {
13705
- entry,
13706
- index
13707
- });
13708
- return;
13709
- }
13710
- const existingUpdated = updatedAtMillis(existing.entry.updated_at);
13711
- const candidateUpdated = updatedAtMillis(entry.updated_at);
13712
- if (candidateUpdated > existingUpdated) {
13713
- byKey.set(key, {
13714
- entry,
13715
- index
13716
- });
13717
- return;
13718
- }
13719
- if (candidateUpdated === existingUpdated) {
13720
- const existingId = existing.entry.id ?? -Infinity;
13721
- if ((entry.id ?? -Infinity) > existingId) byKey.set(key, {
13722
- entry,
13723
- index
13724
- });
13725
- }
13726
- });
13727
- const sorted = [...byKey.values()];
13728
- sorted.sort((a, b) => a.index - b.index);
13729
- return sorted;
13730
- }
13731
- async function readCommitChecks(executor, conn, sha) {
13732
- const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/commits/${sha}/status`;
13733
- const res = await executor.fetch(url, { headers: { Authorization: `token ${conn.token}` } });
13734
- if (!res.ok) await throwForgejoFailure(res, {
13735
- verb: "read commit status",
13736
- resource: sha
13737
- });
13738
- const body = await res.json();
13739
- const parsed = CombinedStatusSchema.safeParse(body);
13740
- if (!parsed.success) return {
13741
- parsed: false,
13742
- state: "",
13743
- green: false,
13744
- contexts: []
13745
- };
13746
- const green = parsed.data.state === "success" && parsed.data.statuses.length > 0;
13747
- const EMPTY_ENTRY = {
13748
- context: null,
13749
- status: null,
13750
- description: null,
13751
- target_url: null,
13752
- updated_at: null,
13753
- id: null
13754
- };
13755
- const contexts = dedupeEntries(parsed.data.statuses.map((raw) => {
13756
- const entryParsed = CheckEntrySchema.safeParse(raw);
13757
- return entryParsed.success ? entryParsed.data : EMPTY_ENTRY;
13758
- })).map(({ entry }) => {
13759
- const context = entry.context ?? "";
13760
- return {
13761
- context,
13762
- name: context.replace(TRAILING_EVENT, ""),
13763
- state: entry.status ?? "",
13764
- verdict: classifyVerdict(entry.status),
13765
- description: entry.description ?? null,
13766
- targetUrl: entry.target_url ?? null,
13767
- updatedAt: entry.updated_at ?? null
13768
- };
13769
- });
13770
- return {
13771
- parsed: true,
13772
- state: parsed.data.state,
13773
- green,
13774
- contexts
13775
- };
13776
- }
13777
- //#endregion
13778
- //#region src/release/publish/unpublished-bump.ts
13779
- async function unpublishedBumpTags(executor, config) {
13780
- const packages = executor.listWorkspacePackages(config.cwd);
13781
- if (packages.length === 0) return [];
13782
- const auth = buildGitAuth(config);
13783
- const listing = executor.exec("git", [
13784
- ...auth.args,
13785
- "ls-remote",
13786
- "--tags",
13787
- auth.url
13788
- ], { cwd: config.cwd });
13789
- if (listing.exitCode !== 0) {
13790
- log$1.warn(`Could not list the remote's tags, so this run does not check for an unpublished version: ${listing.stderr || listing.stdout}`);
13791
- return [];
13792
- }
13793
- const remoteTags = parseRemoteTagTargets(listing.stdout);
13794
- const missing = [];
13795
- const anchors = /* @__PURE__ */ new Set();
13796
- for (const pkg of packages) {
13797
- const family = changesetsTagFamily(pkg.name);
13798
- let newest;
13799
- let below = true;
13800
- for (const [tag, target] of remoteTags) {
13801
- const version = family.versionOfExact(tag);
13802
- if (version === void 0) continue;
13803
- if (compareReleaseVersions(pkg.version, version) !== 1) below = false;
13804
- if (!newest || compareReleaseVersions(version, newest.version) === 1) newest = {
13805
- version,
13806
- commit: target.commit
13807
- };
13808
- }
13809
- if (newest && below) {
13810
- missing.push(family.exact(pkg.version));
13811
- anchors.add(newest.commit);
13812
- }
13813
- }
13814
- if (missing.length === 0) return [];
13815
- debug(config, `Unpublished version guard: remote lacks ${missing.join(", ")}`);
13816
- const commits = mainCommitsSince(executor, config, [...anchors]);
13817
- if (commits.length === 0) return [];
13818
- const conn = {
13819
- serverUrl: config.serverUrl,
13820
- repository: config.repository,
13821
- token: config.token
13822
- };
13823
- for (const sha of commits) try {
13824
- const checks = await readCommitChecks(executor, conn, sha);
13825
- if (!checks.green && !isSettledRed(checks)) {
13826
- debug(config, `Unpublished version guard: ${sha} has not settled (state "${checks.state}") -- its run may still publish`);
13827
- return [];
13828
- }
13829
- } catch (error) {
13830
- log$1.warn(`Could not read the CI status of ${sha}, so this run does not publish ${missing.join(", ")}: ${describeError$1(error)}`);
13831
- return [];
13832
- }
13833
- return missing;
13834
- }
13835
- function mainCommitsSince(executor, config, anchors) {
13836
- const commits = /* @__PURE__ */ new Set();
13837
- for (const anchor of anchors) {
13838
- const range = executor.exec("git", [
13839
- "rev-list",
13840
- "--first-parent",
13841
- "--reverse",
13842
- "HEAD~1",
13843
- `^${anchor}`
13844
- ], { cwd: config.cwd });
13845
- if (range.exitCode !== 0) {
13846
- debug(config, `Unpublished version guard: could not list commits after ${anchor}`);
13847
- return [];
13848
- }
13849
- for (const line of range.stdout.split("\n")) {
13850
- const sha = line.trim();
13851
- if (sha !== "") commits.add(sha);
13852
- }
13853
- }
13854
- if (commits.size === 0) debug(config, "Unpublished version guard: no main commit follows the last release tag");
13855
- return [...commits];
13856
- }
13857
- //#endregion
13858
13665
  //#region ../forgejo/src/user.ts
13859
13666
  const AuthenticatedUserSchema = z.object({
13860
13667
  login: z.string(),
@@ -14053,22 +13860,10 @@ async function runRelease(config, executor, ciEvent) {
14053
13860
  return publishThenVersion(executor, config);
14054
13861
  }
14055
13862
  if (changesetFiles.length > 0) {
14056
- const unpublished = await unpublishedBumpTags(executor, config);
14057
- if (unpublished.length > 0) {
14058
- log$1.info(`Changesets are pending, but ${unpublished.join(", ")} ${unpublished.length === 1 ? "was" : "were"} never tagged and every main run since the last release tag has finished -- publishing now, then versioning the rest.`);
14059
- debug(config, "Entering publish mode for an earlier unpublished bump, then version mode");
14060
- return publishThenVersion(executor, config);
14061
- }
14062
13863
  debug(config, "Entering version mode");
14063
13864
  return runVersionMode(executor, config);
14064
13865
  }
14065
13866
  if (!bumped) {
14066
- const unpublished = await unpublishedBumpTags(executor, config);
14067
- if (unpublished.length > 0) {
14068
- log$1.info(`HEAD bumped no version, but ${unpublished.join(", ")} ${unpublished.length === 1 ? "was" : "were"} never tagged and every main run since the last release tag has finished -- publishing now.`);
14069
- debug(config, "Entering publish mode for an earlier unpublished bump");
14070
- return runPublishMode(executor, config);
14071
- }
14072
13867
  log$1.info("No changesets, and HEAD bumped no package version -- nothing to release. (Publishing runs on the commit that merges a 'version packages' PR.)");
14073
13868
  debug(config, "Publish guard: HEAD is not a version-bump commit -- skipping publish");
14074
13869
  return { mode: "none" };
@@ -18467,49 +18262,79 @@ function planTask(headingText, label) {
18467
18262
  title: unwrapped.slice(unwrapped.indexOf(label) + label.length).replace(AFTER_LABEL, "").trim()
18468
18263
  };
18469
18264
  }
18470
- function groupPlanUnits(text, boxes) {
18265
+ function walkUnits(text, boxes) {
18471
18266
  const lines = text.split("\n");
18472
18267
  const fenced = fencedLines(lines);
18473
18268
  const boxAtLine = /* @__PURE__ */ new Map();
18474
18269
  for (const box of boxes) boxAtLine.set(box.line, box);
18475
18270
  const units = [];
18476
18271
  const open = [];
18272
+ const unitAtLine = lines.map(() => null);
18273
+ let loneBoxUnit = null;
18274
+ const inEffect = () => {
18275
+ const section = open[open.length - 1];
18276
+ if (section !== void 0) return section.index;
18277
+ return loneBoxUnit;
18278
+ };
18477
18279
  for (const [index, rawLine] of lines.entries()) {
18478
- if (fenced[index] === true) continue;
18479
18280
  const line = rawLine ?? "";
18281
+ if (fenced[index] === true) {
18282
+ unitAtLine[index] = inEffect();
18283
+ continue;
18284
+ }
18480
18285
  const heading = HEADING.exec(line);
18481
18286
  if (heading !== null) {
18482
18287
  const level = (heading[1] ?? "").length;
18483
18288
  while (open.length > 0 && (open[open.length - 1]?.level ?? 0) >= level) open.pop();
18289
+ loneBoxUnit = null;
18484
18290
  const headingText = (heading[2] ?? "").trim();
18485
18291
  const label = taskLabelId(headingText);
18486
- if (label === null) continue;
18292
+ if (label === null) {
18293
+ unitAtLine[index] = inEffect();
18294
+ continue;
18295
+ }
18487
18296
  const unit = {
18488
18297
  key: headingText,
18489
18298
  task: planTask(headingText, label),
18490
18299
  boxes: []
18491
18300
  };
18301
+ const unitIndex = units.length;
18492
18302
  units.push(unit);
18493
18303
  open.push({
18494
18304
  level,
18495
- unit
18305
+ unit,
18306
+ index: unitIndex
18496
18307
  });
18308
+ unitAtLine[index] = unitIndex;
18497
18309
  continue;
18498
18310
  }
18499
18311
  const box = boxAtLine.get(index);
18500
- if (box === void 0) continue;
18312
+ if (box === void 0) {
18313
+ unitAtLine[index] = inEffect();
18314
+ continue;
18315
+ }
18501
18316
  const section = open[open.length - 1];
18502
18317
  if (section !== void 0) {
18503
18318
  section.unit.boxes.push(box);
18319
+ unitAtLine[index] = section.index;
18504
18320
  continue;
18505
18321
  }
18322
+ const unitIndex = units.length;
18506
18323
  units.push({
18507
18324
  key: box.title,
18508
18325
  task: null,
18509
18326
  boxes: [box]
18510
18327
  });
18328
+ unitAtLine[index] = unitIndex;
18329
+ loneBoxUnit = unitIndex;
18511
18330
  }
18512
- return units;
18331
+ return {
18332
+ units,
18333
+ unitAtLine
18334
+ };
18335
+ }
18336
+ function groupPlanUnits(text, boxes) {
18337
+ return walkUnits(text, boxes).units;
18513
18338
  }
18514
18339
  //#endregion
18515
18340
  //#region src/plan-workspace/plan-boxes.ts
@@ -18580,7 +18405,7 @@ function deferredLineOf(lines, fenced, start, blockEnd) {
18580
18405
  if (fenced[index] === true) continue;
18581
18406
  const match = DEFERRED_LINE_REGEX.exec(lines[index] ?? "");
18582
18407
  if (match === null) continue;
18583
- return (match[1] ?? "").trim();
18408
+ return boxParagraph(lines, fenced, index, blockEnd, (match[1] ?? "").trim());
18584
18409
  }
18585
18410
  return null;
18586
18411
  }
@@ -18714,7 +18539,7 @@ function parsePlanBoxes(planText) {
18714
18539
  if (fenced[index] === true) continue;
18715
18540
  const noteMatch = NOTE_LINE_REGEX.exec(lines[index] ?? "");
18716
18541
  if (noteMatch === null) continue;
18717
- const text = (noteMatch[2] ?? "").trim();
18542
+ const text = boxParagraph(lines, fenced, index, blockEnd, (noteMatch[2] ?? "").trim());
18718
18543
  if (text !== "") notes.push({
18719
18544
  kind: noteKind(noteMatch[1] ?? ""),
18720
18545
  text
@@ -18725,7 +18550,7 @@ function parsePlanBoxes(planText) {
18725
18550
  if (fenced[index] === true) continue;
18726
18551
  const declinedMatch = DECLINED_LINE_REGEX.exec(lines[index] ?? "");
18727
18552
  if (declinedMatch === null) continue;
18728
- const remainder = (declinedMatch[1] ?? "").trim();
18553
+ const remainder = boxParagraph(lines, fenced, index, blockEnd, (declinedMatch[1] ?? "").trim());
18729
18554
  if (remainder !== "") {
18730
18555
  reason = remainder;
18731
18556
  break;
@@ -24479,6 +24304,30 @@ function formatExplain(details) {
24479
24304
  }
24480
24305
  return lines.join("\n");
24481
24306
  }
24307
+ function outlierAttributionLines(attribution, failedKeys) {
24308
+ const lines = [];
24309
+ let printedAttribution = false;
24310
+ for (const o of attribution.newOutliers) {
24311
+ if (!failedKeys.has(o.key)) continue;
24312
+ lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} -- -> ${o.current} (new)`);
24313
+ printedAttribution = true;
24314
+ }
24315
+ for (const o of attribution.baseOutliers) {
24316
+ if (!failedKeys.has(o.key)) continue;
24317
+ lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} ${o.base} -> ${o.current} (on base)`);
24318
+ printedAttribution = true;
24319
+ }
24320
+ for (const o of attribution.unattributedOutliers) {
24321
+ if (!failedKeys.has(o.key)) continue;
24322
+ lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} -- -> ${o.current} (no ceiling)`);
24323
+ printedAttribution = true;
24324
+ }
24325
+ if (printedAttribution) {
24326
+ if (attribution.outlierBase.status === "measured") lines.push(` outliers attributed against the merge base ${attribution.outlierBase.mergeBase}`);
24327
+ else if (attribution.outlierBase.status === "unavailable") lines.push(` outliers not attributed: the merge base ${attribution.outlierBase.mergeBase} could not be measured (${attribution.outlierBase.reason})`);
24328
+ }
24329
+ return lines;
24330
+ }
24482
24331
  function formatCompareDiff(result, details, attribution) {
24483
24332
  const lines = [];
24484
24333
  for (const m of result.metrics) {
@@ -24506,26 +24355,7 @@ function formatCompareDiff(result, details, attribution) {
24506
24355
  if (s.measurerChanged === true) lines.push(` size: ${s.id} measured by code this branch changed`);
24507
24356
  }
24508
24357
  const failedKeys = new Set(result.metrics.filter((m) => m.pass === false).map((m) => m.key));
24509
- let printedAttribution = false;
24510
- for (const o of attribution.newOutliers) {
24511
- if (!failedKeys.has(o.key)) continue;
24512
- lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} -- -> ${o.current} (new)`);
24513
- printedAttribution = true;
24514
- }
24515
- for (const o of attribution.baseOutliers) {
24516
- if (!failedKeys.has(o.key)) continue;
24517
- lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} ${o.base} -> ${o.current} (on base)`);
24518
- printedAttribution = true;
24519
- }
24520
- for (const o of attribution.unattributedOutliers) {
24521
- if (!failedKeys.has(o.key)) continue;
24522
- lines.push(` ${CEILING_LABELS[o.key]}: ${o.module} -- -> ${o.current} (no ceiling)`);
24523
- printedAttribution = true;
24524
- }
24525
- if (printedAttribution) {
24526
- if (attribution.outlierBase.status === "measured") lines.push(` outliers attributed against the merge base ${attribution.outlierBase.mergeBase}`);
24527
- else if (attribution.outlierBase.status === "unavailable") lines.push(` outliers not attributed: the merge base ${attribution.outlierBase.mergeBase} could not be measured (${attribution.outlierBase.reason})`);
24528
- }
24358
+ lines.push(...outlierAttributionLines(attribution, failedKeys));
24529
24359
  lines.push(result.pass ? "health: PASS" : "health: FAIL");
24530
24360
  return lines.join("\n");
24531
24361
  }
@@ -29549,7 +29379,7 @@ async function runCli(config) {
29549
29379
  //#region src/cli-main.ts
29550
29380
  setLogLevel(resolveLogLevel({}));
29551
29381
  setForgejoLogger(log$1);
29552
- const displayVersion = "0.98.0";
29382
+ const displayVersion = "0.99.1";
29553
29383
  const bstSubCommands = {
29554
29384
  "repo:sync": syncCommand,
29555
29385
  "checks:run": runChecksCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bensandee/tooling",
3
- "version": "0.98.0",
3
+ "version": "0.99.1",
4
4
  "description": "CLI tool to bootstrap and maintain standardized TypeScript project tooling",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -722,7 +722,7 @@
722
722
  "type": "boolean"
723
723
  },
724
724
  "lintSweep": {
725
- "description": "The lint-warning sweep: a periodic agent job that measures this repo's oxlint warnings on its default branch in a container and, past minWarnings, opens a pull request carrying a generated plan for an agent/implement run to work off.",
725
+ "description": "The lint-warning sweep: a periodic agent job that measures this repo's oxlint warnings on its default branch in a container and, past minWarnings, opens a pull request carrying a generated plan for an agent/implement run to work off. Expired @compat warnings leave that plan and each get their own issue instead (see compatIssues).",
726
726
  "type": "object",
727
727
  "properties": {
728
728
  "enabled": {
@@ -740,6 +740,10 @@
740
740
  "type": "integer",
741
741
  "minimum": 0,
742
742
  "maximum": 9007199254740991
743
+ },
744
+ "compatIssues": {
745
+ "description": "Whether the sweep splits expired @compat warnings out of its plan and files one issue per expired id (default: on). false keeps them in the bulk plan with the other warnings.",
746
+ "type": "boolean"
743
747
  }
744
748
  },
745
749
  "additionalProperties": false
@@ -760,11 +764,11 @@
760
764
  "type": "boolean"
761
765
  },
762
766
  "egress": {
763
- "description": "Extra egress hosts this repo's agent containers may reach. `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: the declaration takes effect on the first container started after a human merges it. An entry whose pattern the agent cannot parse refuses the run rather than being dropped. Changing this block holds the pull request from automerge.",
767
+ "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.",
764
768
  "type": "object",
765
769
  "properties": {
766
770
  "browseHosts": {
767
- "description": "Host patterns this repo's agent containers may fetch from, on top of the hosts every run needs: an exact host (`fastdl.mongodb.org`) or a wildcard over its leftmost label (`*.example.com`). No ports. These join the browse lane, which serves GET and HEAD only.",
771
+ "description": "Host patterns this repo's agent containers ask to fetch from, on top of the hosts every run needs: an exact host (`fastdl.mongodb.org`) or a wildcard over its leftmost label (`*.example.com`). No ports. This list is a request the deployment grants, not an opening: its grant mode decides whether a default branch's requests take effect on their own, an admin can refuse a host for this repo, and a host the product or the deployment known-denies is never opened whatever the declaration or the verdict says. What is granted joins the browse lane, which serves GET and HEAD only.",
768
772
  "type": "array",
769
773
  "items": {
770
774
  "type": "string",