@feigi/fleet-ctl 3.136.13 → 3.136.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.136.13",
3
+ "version": "3.136.15",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,15 +9,22 @@
9
9
  // reclaim-scratch.mjs --siblings --root <abs> [--apply]
10
10
  //
11
11
  // Dry run by default; `--apply` removes. `--root` is required, an absolute
12
- // path to an existing directory: the controller passes the path
13
- // scratch-root.mjs prints.
12
+ // path to an existing directory, and the root sweep and `--siblings` require
13
+ // it to be this workspace's own scratch root (the path scratch-root.mjs
14
+ // prints, computed from the cwd): the controller passes that path. Both
15
+ // refuse any other, dry run included, before reading anything under it;
16
+ // `--pr` mode reads no ledger and asks GitHub nothing, and does not check it.
14
17
  //
15
- // `--siblings` is the sibling pass, its own invocation: `--root` names the live
16
- // key, which must be this workspace's own scratch root (the path
17
- // scratch-root.mjs prints), and the pass judges the other key-shaped
18
- // directories beside it by age alone (judgeSiblings below), judging each again
19
- // just before `--apply` removes it. It reads no ledger and is never combined
20
- // with --pr or --after-rotate.
18
+ // The root sweep reads the ledger, the claim worktrees and GitHub of the
19
+ // repository the cwd is in, so another workspace's key judged there would be
20
+ // judged against this one's numbers.
21
+ //
22
+ // `--siblings` is the sibling pass, its own invocation: `--root` names the
23
+ // live key, and the pass judges the other key-shaped directories beside it by
24
+ // age alone (judgeSiblings below), judging each again just before `--apply`
25
+ // removes it. Any other key passed as `--root` would put the real live key
26
+ // among the judged siblings. It reads no ledger and is never combined with
27
+ // --pr or --after-rotate.
21
28
  //
22
29
  // THE ROOT SWEEP judges every entry directly under `--root`:
23
30
  // pr<M>/, dispositions-fix-pr-<M>[-x].json
@@ -99,8 +106,10 @@
99
106
  // `removed` naming what --apply would remove.
100
107
  // Exit 0 whenever the receipt is printed, failures included; 2 for a refused
101
108
  // invocation — bad arguments, no --root, a root that is not a directory, a
102
- // root sweep with no ledger and no --after-rotate, a ledger that cannot be
103
- // read for any reason other than ENOENT. Nothing is removed before a refusal.
109
+ // root sweep or sibling pass whose --root is not this workspace's own scratch
110
+ // root or whose own scratch root cannot be resolved, a root sweep with no
111
+ // ledger and no --after-rotate, a ledger that cannot be read for any reason
112
+ // other than ENOENT. Nothing is removed before a refusal.
104
113
 
105
114
  import { spawnSync } from "node:child_process";
106
115
  import { lstatSync, readdirSync, realpathSync, statSync } from "node:fs";
@@ -539,15 +548,21 @@ function main() {
539
548
  if (siblings) {
540
549
  if (pr !== null) die("--siblings and --pr are separate passes");
541
550
  if (afterRotate) die("--after-rotate is the root sweep's; --siblings reads no ledger");
542
- // The live key is never judged, so it must be this workspace's own: any other
543
- // key passed here would put the real live key among the judged siblings.
551
+ }
552
+ if (pr === null) {
553
+ // Only this workspace's own scratch root: the header says why, per pass.
554
+ const [judges, why] = siblings
555
+ ? ["--siblings judges the keys beside", "--siblings judges the keys beside the live one"]
556
+ : ["the root sweep judges", "the root sweep judges entries against this workspace's ledger, worktrees and GitHub repository"];
544
557
  let own;
545
558
  try {
546
559
  own = scratchRoot();
547
560
  } catch (e) {
548
- die(`--siblings judges the keys beside this workspace's scratch root, which could not be resolved: ${e.message}`);
561
+ if (!(e instanceof FleetDirUnresolvable)) throw e;
562
+ die(`${judges} this workspace's scratch root, which could not be resolved: ${e.message}`);
549
563
  }
550
- if (root !== own) die(`--siblings judges the keys beside the live one: --root must be this workspace's scratch root ${own}, got ${root}`);
564
+ if (!isAbsolute(own)) die(`${judges} this workspace's scratch root, which could not be resolved: ${own} is not absolute, so HOME is empty or relative`);
565
+ if (root !== own) die(`${why}: --root must be this workspace's scratch root ${own}, got ${root}`);
551
566
  }
552
567
 
553
568
  const now = Date.now();