pi-straw-boss 0.77.2 → 0.79.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.
Files changed (53) hide show
  1. package/NOTICE.md +33 -0
  2. package/README.md +2 -0
  3. package/README.zh-TW.md +2 -1
  4. package/dist/server/{chunk-ENYILM47.mjs → chunk-YPEYIVLF.mjs} +39 -10
  5. package/dist/server/cli.mjs +27 -9
  6. package/dist/server/main.mjs +2977 -2408
  7. package/package.json +4 -2
  8. package/prompts/head-run.md +2 -0
  9. package/prompts/integrator.md +1 -1
  10. package/prompts/main.md +1 -1
  11. package/prompts/tower-run.md +1 -1
  12. package/roles/adversarial-reviewer.md +154 -0
  13. package/roles/planner.md +88 -0
  14. package/roles/reviewer.md +132 -0
  15. package/roles/scout.md +80 -0
  16. package/roles/visual-tester.md +54 -0
  17. package/roles/worker.md +38 -0
  18. package/src/auto.ts +2 -2
  19. package/src/board.ts +4 -3
  20. package/src/boardread.ts +1 -1
  21. package/src/boardview.ts +2 -1
  22. package/src/boss.ts +5 -2
  23. package/src/bridge.ts +4 -4
  24. package/src/childkind.ts +19 -0
  25. package/src/herdr.ts +20 -1
  26. package/src/index.ts +3 -2
  27. package/src/netdata.ts +111 -19
  28. package/src/opener.ts +12 -3
  29. package/src/owners.ts +10 -5
  30. package/src/reach.ts +10 -3
  31. package/src/rolepack.ts +16 -0
  32. package/src/roles.ts +9 -2
  33. package/src/rolescheck.ts +69 -0
  34. package/src/server/automode.ts +14 -5
  35. package/src/server/autotower.ts +6 -2
  36. package/src/server/autowatch.ts +534 -0
  37. package/src/server/carbook.ts +18 -4
  38. package/src/server/headside.ts +2 -1
  39. package/src/server/main.ts +6 -1
  40. package/src/server/runs.ts +57 -6
  41. package/src/server/runtools.ts +1 -1
  42. package/src/server/stallwatch.ts +2 -2
  43. package/src/server/towerbrief.ts +1 -1
  44. package/src/server/towerstore.ts +14 -2
  45. package/src/server/traincmds.ts +21 -8
  46. package/src/server/watchops.ts +90 -0
  47. package/src/session.ts +13 -4
  48. package/src/tools.ts +6 -2
  49. package/src/train/accept.ts +20 -4
  50. package/src/train/appsconfig.ts +11 -1
  51. package/src/train/cars.ts +5 -5
  52. package/src/traincar.ts +4 -5
  53. package/src/trainrole.ts +1 -1
package/NOTICE.md CHANGED
@@ -112,3 +112,36 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
112
112
  OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
113
113
  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
114
114
  THIS SOFTWARE.
115
+
116
+ ## Role definitions (`roles/`)
117
+
118
+ The role pack in `roles/` (docs/specs/2026-11-09-agent-kinds.md §9) is derived from two sources.
119
+
120
+ - `roles/worker.md`, `roles/scout.md`, `roles/reviewer.md`, `roles/visual-tester.md`, and `roles/adversarial-reviewer.md` start from the role overrides of [weihung-basic-agent](https://github.com/wayne930242/weihung-basic-agent) (`agents/`), MIT License, Copyright (c) 2026 wayne930242. Those overrides in turn derive from the pi-herdr-roles definitions below.
121
+ - `roles/planner.md` derives from [pi-herdr-roles](https://www.npmjs.com/package/pi-herdr-roles) 0.1.0 `roles/planner.md` alone.
122
+
123
+ pi-herdr-roles' role definitions were moved from [giuseppecrj/pi-herdr-agents](https://github.com/giuseppecrj/pi-herdr-agents) at commit `c2177dff835da44937e614e8a03d0405d442e848`, whose MIT notice is retained from its upstream lineage, [HazAT/pi-interactive-subagents](https://github.com/HazAT/pi-interactive-subagents) and [0xRichardH/pi-herdr-subagents](https://github.com/0xRichardH/pi-herdr-subagents). pi-herdr-roles 0.1.0 carries this notice:
124
+
125
+ ```text
126
+ MIT License
127
+
128
+ Copyright (c) 2026 HazAT
129
+
130
+ Permission is hereby granted, free of charge, to any person obtaining a copy
131
+ of this software and associated documentation files (the "Software"), to deal
132
+ in the Software without restriction, including without limitation the rights
133
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
134
+ copies of the Software, and to permit persons to whom the Software is
135
+ furnished to do so, subject to the following conditions:
136
+
137
+ The above copyright notice and this permission notice shall be included in all
138
+ copies or substantial portions of the Software.
139
+
140
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
141
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
142
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
143
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
145
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
146
+ SOFTWARE.
147
+ ```
package/README.md CHANGED
@@ -32,6 +32,7 @@ pi install npm:pi-straw-boss
32
32
  It needs pi inside [Herdr](https://herdr.dev) 0.9.4 or newer, Herdr's pi integration (`herdr integration install pi`), and [pi-intercom](https://www.npmjs.com/package/pi-intercom) 0.18.1 or newer.
33
33
  The merge train also needs `integrating` and `deploying` skills that declare the [merge-train contract](https://wayne930242.github.io/pi-straw-boss/docs/guide/merge-train/#the-merge-train-contract).
34
34
  Windows support is experimental.
35
+ sb ships the pi-herdr-agents roles its agents run as (`worker`, `scout`, `planner`, `reviewer`, `visual-tester`, `adversarial-reviewer`); uninstall pi-herdr-roles, whose same-named roles would collide.
35
36
  See [Install](https://wayne930242.github.io/pi-straw-boss/docs/guide/install/) for the optional packages it works with.
36
37
 
37
38
  ## Quick start
@@ -54,6 +55,7 @@ See [Install](https://wayne930242.github.io/pi-straw-boss/docs/guide/install/) f
54
55
  | `/boss auto on`, `/boss auto off` | Auto mode, for when you are away. |
55
56
  | `/boss stash`, `/boss pop` | Put a whole workspace (its tower, mains, and members) away and open it again later. |
56
57
  | `/boss server` | The sb server: one background process per computer that runs the towers and serves the page. |
58
+ | `/boss roles-check [folder]` | Check each role's `tools:` names against this session's tools. |
57
59
 
58
60
  Every tool and command: [Commands](https://wayne930242.github.io/pi-straw-boss/docs/reference/commands/).
59
61
 
package/README.zh-TW.md CHANGED
@@ -29,7 +29,7 @@ pi-straw-boss 讓它們能找到彼此、互相協調,不需要排程器,也
29
29
  pi install npm:pi-straw-boss
30
30
  ```
31
31
 
32
- 需要在 [Herdr](https://herdr.dev) 0.9.4 以上的版本裡執行 pi、安裝 Herdr 的 pi 整合(`herdr integration install pi`),以及 [pi-intercom](https://www.npmjs.com/package/pi-intercom) 0.18.1 以上。合併火車另外需要宣告了[合併火車契約](https://wayne930242.github.io/pi-straw-boss/docs/zh-tw/guide/merge-train/#合併火車契約)的 `integrating` 與 `deploying` skill。Windows 支援仍屬實驗性質。可搭配的選用套件見[安裝](https://wayne930242.github.io/pi-straw-boss/docs/zh-tw/guide/install/)。
32
+ 需要在 [Herdr](https://herdr.dev) 0.9.4 以上的版本裡執行 pi、安裝 Herdr 的 pi 整合(`herdr integration install pi`),以及 [pi-intercom](https://www.npmjs.com/package/pi-intercom) 0.18.1 以上。合併火車另外需要宣告了[合併火車契約](https://wayne930242.github.io/pi-straw-boss/docs/zh-tw/guide/merge-train/#合併火車契約)的 `integrating` 與 `deploying` skill。Windows 支援仍屬實驗性質。sb 隨附它的智慧體所用的 pi-herdr-agents 角色(`worker`、`scout`、`planner`、`reviewer`、`visual-tester`、`adversarial-reviewer`);請解除安裝 pi-herdr-roles,它的同名角色會互相衝突。可搭配的選用套件見[安裝](https://wayne930242.github.io/pi-straw-boss/docs/zh-tw/guide/install/)。
33
33
 
34
34
  ## 快速開始
35
35
 
@@ -51,6 +51,7 @@ pi install npm:pi-straw-boss
51
51
  | `/boss auto on`、`/boss auto off` | 自動模式,你不在時用。 |
52
52
  | `/boss stash`、`/boss pop` | 把整個工作區(塔台、主智慧體和成員)收起來,之後再接回。 |
53
53
  | `/boss server` | sb server:每台電腦一個的背景程序,負責執行塔台和提供網頁。 |
54
+ | `/boss roles-check [資料夾]` | 把每個角色 `tools:` 列的工具名稱,和這個 session 的工具比對。 |
54
55
 
55
56
  所有工具和指令見[指令](https://wayne930242.github.io/pi-straw-boss/docs/zh-tw/reference/commands/)。
56
57
 
@@ -218,7 +218,22 @@ var tabs = async (run4, workspace) => (await result(run4, ["tab", "list", "--wor
218
218
  async function panes(run4, workspace) {
219
219
  return (await result(run4, ["pane", "list", ...workspace ? ["--workspace", workspace] : []])).panes;
220
220
  }
221
- var herdrCall = (socketPath = herdrSocket()) => (method, params, timeoutMs = 5e3) => new Promise((resolve4, reject) => {
221
+ var READS = /* @__PURE__ */ new Set(["workspace.list", "pane.list", "tab.list", "pane.current", "pane.get", "pane.read", "pane.process_info", "pane.layout", "session.snapshot"]);
222
+ var RETRY_MS = 250;
223
+ var RETRIED = /* @__PURE__ */ new Set(["timeout", "closed"]);
224
+ var herdrCall = (socketPath = herdrSocket()) => {
225
+ const once = callOnce(socketPath);
226
+ return async (method, params, timeoutMs) => {
227
+ try {
228
+ return await once(method, params, timeoutMs);
229
+ } catch (error) {
230
+ if (!READS.has(method) || !(error instanceof HerdrError) || !RETRIED.has(error.code)) throw error;
231
+ await new Promise((resolve4) => setTimeout(resolve4, RETRY_MS));
232
+ return once(method, params, timeoutMs);
233
+ }
234
+ };
235
+ };
236
+ var callOnce = (socketPath) => (method, params, timeoutMs = 5e3) => new Promise((resolve4, reject) => {
222
237
  const socket = createConnection(localEndpoint(socketPath)), text4 = new StringDecoder("utf8");
223
238
  let reply = "";
224
239
  const fail = (code, message) => (clearTimeout(timer), socket.destroy(), reject(new HerdrError(code, `herdr ${method} failed: ${code} ${message}`.trim())));
@@ -3833,7 +3848,7 @@ function joinLocal(entries, mains, now, o = {}) {
3833
3848
  main: m.name,
3834
3849
  state: m.state,
3835
3850
  items: e?.items ?? [],
3836
- ...e ? { now: e.now, src: e.src, ...e.count ? { count: e.count } : {}, ...e.who ? { who: e.who } : {}, updatedSecondsAgo: Math.max(0, Math.round((now - e.updated) / 1e3)), ...m.state === "idle" && !m.commanding && now - e.updated > STALE_MS ? { stale: true } : {} } : {},
3851
+ ...e ? { now: e.now, src: e.src, ...e.count ? { count: e.count } : {}, ...e.who ? { who: e.who } : {}, updatedSecondsAgo: Math.max(0, Math.round((now - e.updated) / 1e3)), ...m.state === "idle" && !m.commanding && m.duty !== "standing" && now - e.updated > STALE_MS ? { stale: true } : {} } : {},
3837
3852
  ...m.cwd ? { cwd: m.cwd } : {}
3838
3853
  };
3839
3854
  });
@@ -4142,7 +4157,7 @@ var PENDING = /^(pending|todo|tbd|waiting|open|not[ _-]?run)$/i;
4142
4157
  var ON_FIELDS = ["head"];
4143
4158
  var present2 = (value) => value !== void 0;
4144
4159
  var text = (value, max = 1e3) => typeof value === "string" && value.trim() !== "" && value.length <= max;
4145
- var SLIP_KEYS = ["car", "tickets", "branch", "head", "tested-on", "review", "light", "migrations", "lane", "deploy", "departs", "accept", "uat", "auth", "coordinator"];
4160
+ var SLIP_KEYS = ["car", "app", "tickets", "branch", "head", "tested-on", "review", "light", "migrations", "lane", "deploy", "departs", "accept", "uat", "auth", "coordinator"];
4146
4161
  function segments(line) {
4147
4162
  const parts = [];
4148
4163
  let depth2 = 0, quoted = false, from = 0;
@@ -4178,14 +4193,21 @@ function parseSlip(slip) {
4178
4193
  else fields[key2] = value;
4179
4194
  }
4180
4195
  });
4196
+ if (fields.app !== void 0) {
4197
+ if (fields.car === void 0) fields.car = fields.app;
4198
+ else if (fields.car !== fields.app) problems.push(`sb: slip: app: ${shown(fields.app)} and car: ${shown(fields.car)} name two apps: car: names the car's app (app: is the same field), and its tickets go in tickets:`);
4199
+ }
4181
4200
  const tickets = (fields.tickets ?? "").replace(/\([^)]*\)/g, " ").split(/[\s,]+/).filter(Boolean);
4182
4201
  return { fields, tickets, entries, problems };
4183
4202
  }
4203
+ var SLIP_START = /^\s*(?:car:|app:[^|\n]*\|\s*(?:car|tickets):)/i;
4204
+ var startsSlip = (line) => SLIP_START.test(line);
4205
+ var slipLines = (body) => body.replace(/([^\s|])[ \t]+((?:car|app):[ \t]*[A-Za-z0-9._-]+[ \t]*\|[ \t]*(?:tickets|car):)/gi, "$1\n$2");
4184
4206
  function slipBlocks(text4) {
4185
4207
  const header = [], blocks = [];
4186
4208
  let open2 = false;
4187
4209
  for (const line of text4.split(/\r?\n/)) {
4188
- if (/^\s*car:/i.test(line)) blocks.push([line]), open2 = true;
4210
+ if (startsSlip(line)) blocks.push([line]), open2 = true;
4189
4211
  else if (open2 && line.trim() !== "" && /^\s*[A-Za-z][A-Za-z0-9-]*:/.test(line)) blocks.at(-1).push(line);
4190
4212
  else {
4191
4213
  open2 = false;
@@ -4422,7 +4444,7 @@ function noTrainRefusal(dir, apps) {
4422
4444
  if (!read.ok) return `sb: ${read.refusal.replace(/, so integration\.accept of the app is unknown$/, "")}, so no app here takes the merge train`;
4423
4445
  for (const app of apps) {
4424
4446
  const entry = read.apps.find((a) => a.name === app);
4425
- if (!entry) return `sb: ${read.file} has no app named ${app}, so its car takes no train`;
4447
+ if (!entry) return `sb: ${read.file} has no app named ${app}, so its car takes no train (the slip's car: names the car's app as apps.json names it, not a ticket)`;
4426
4448
  if (!isObject2(entry.integration)) return `sb: ${read.file}: app ${app} has no integration, so it takes no train`;
4427
4449
  }
4428
4450
  return void 0;
@@ -4434,6 +4456,11 @@ function openRefusal(dir, app) {
4434
4456
  const out = named2.flatMap((a) => isObject2(a.integration) ? integrationRefusals(read.file, String(a.name), a.integration) : []);
4435
4457
  return out.length ? `sb: ${out.join("; ")}` : void 0;
4436
4458
  }
4459
+ function projectAppsDir(dir) {
4460
+ if (appsFile(dir).exists) return dir;
4461
+ const main = repoRoot(dir);
4462
+ return appsFile(main).exists ? main : void 0;
4463
+ }
4437
4464
  function repoRoot(dir) {
4438
4465
  const real2 = (path) => {
4439
4466
  try {
@@ -4489,7 +4516,7 @@ function trainFromRequest(request2) {
4489
4516
  if (!isCode(code)) return { refusal: `The manifest's code "${String(code).slice(0, 80)}" is not a train code (YYYY-MM-DD-<one or two lowercase letters>)` };
4490
4517
  return { project, code };
4491
4518
  }
4492
- var appFromRequest = (request2) => /^\s*app:\s*([A-Za-z0-9._-]{1,64})\s*$/m.exec(request2.split(/\r?\n(?=\s*car:)/i)[0] ?? request2)?.[1];
4519
+ var appFromRequest = (request2) => /^\s*app:\s*([A-Za-z0-9._-]{1,64})\s*$/m.exec(request2.split(/\r?\n(?=\s*(?:car:|app:[^|\n]*\|\s*(?:car|tickets):))/i)[0] ?? request2)?.[1];
4493
4520
  function maxTrainsOf(value) {
4494
4521
  if (value === void 0) return DEFAULT_MAX_TRAINS;
4495
4522
  return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= MAX_TRAINS_CAP ? value : { refusal: `apps.json: integration.maxTrains must be a whole number from 1 to ${MAX_TRAINS_CAP}, not ${JSON.stringify(value)?.slice(0, 40)}` };
@@ -4823,7 +4850,7 @@ function factsOf(read, life) {
4823
4850
  // src/train/cars.ts
4824
4851
  var CAR_STATES = ["received", "returned", "dropped", "landed"];
4825
4852
  var TERMINAL_STATES = ["returned", "dropped", "landed"];
4826
- var RETRY_MS = [3e4, 12e4, 3e5];
4853
+ var RETRY_MS2 = [3e4, 12e4, 3e5];
4827
4854
  var MAX_REASON = 600;
4828
4855
  var present4 = (value) => value !== void 0;
4829
4856
  var text3 = (value, max) => typeof value === "string" && value.trim() !== "" && value.length <= max;
@@ -4985,12 +5012,12 @@ function noticeStatus(record, state) {
4985
5012
  var landedWord = (ticket, head, how) => `sb: car ${ticket} (${head.slice(0, 12)}) ${how}, so it takes no train again: a car lands once. Return it with this word (train_car returned), which tells its coordinator`;
4986
5013
  var headsIn = (text4) => [...new Set([...text4.matchAll(/(?:^|[\s|])head:\s*([0-9a-f]{40})(?![0-9a-f])/gim)].map((m) => m[1]))];
4987
5014
  function slipsInText(body) {
4988
- const lines = body.replace(/(\S)[ \t]+(car:[ \t]*[A-Za-z0-9._-]+[ \t]*\|[ \t]*tickets:)/gi, "$1\n$2");
5015
+ const lines = slipLines(body);
4989
5016
  return slipBlocks(lines).blocks.flatMap((block) => {
4990
5017
  const parsed = parseSlip(block), f = parsed.fields;
4991
5018
  if (!f.car || !isName(f.car) || !parsed.tickets.length || !f.branch || !SHA_RE.test(f.head ?? "")) return [];
4992
5019
  const over = ticketBound(parsed.tickets).join("; "), tickets = over ? parsed.tickets.slice(0, MAX_CAR_TICKETS).map((t) => t.slice(0, MAX_TICKET_CHARS)) : parsed.tickets;
4993
- return [{ app: f.car, tickets, ...over ? { over } : {}, branch: f.branch, head: f.head, ...f.coordinator ? { coordinator: f.coordinator } : {} }];
5020
+ return [{ app: f.car, tickets, ...over ? { over } : {}, branch: f.branch, head: f.head, ...f.coordinator ? { coordinator: f.coordinator } : {}, ...parsed.problems.length ? { problems: parsed.problems } : {} }];
4994
5021
  });
4995
5022
  }
4996
5023
  var coordinatorWord = (ticket, coordinator, sender) => `sb: car ${ticket} names coordinator ${coordinator}, but ${sender} sent it; the slip is refused`;
@@ -6699,10 +6726,12 @@ export {
6699
6726
  checkEvidence,
6700
6727
  checkCar,
6701
6728
  parseAppAccept,
6729
+ appsFile,
6702
6730
  readApps,
6703
6731
  readAppIntegration,
6704
6732
  noTrainRefusal,
6705
6733
  openRefusal,
6734
+ projectAppsDir,
6706
6735
  repoRoot,
6707
6736
  checkoutProject,
6708
6737
  TRAIN,
@@ -6786,7 +6815,7 @@ export {
6786
6815
  boardState,
6787
6816
  expired,
6788
6817
  factsOf,
6789
- RETRY_MS,
6818
+ RETRY_MS2 as RETRY_MS,
6790
6819
  validateStateFields,
6791
6820
  endOf,
6792
6821
  emptyCar,
@@ -9,6 +9,7 @@ import {
9
9
  TOWER_LABEL,
10
10
  VERSION,
11
11
  answers,
12
+ appsFile,
12
13
  boardPath,
13
14
  boardState,
14
15
  callControl,
@@ -51,8 +52,8 @@ import {
51
52
  passGate,
52
53
  plain,
53
54
  probe,
55
+ projectAppsDir,
54
56
  readAppIntegration,
55
- readApps,
56
57
  readBoard,
57
58
  readFrom,
58
59
  readGate,
@@ -60,6 +61,7 @@ import {
60
61
  readRecord,
61
62
  readStartError,
62
63
  readTrainboards,
64
+ repoRoot,
63
65
  report,
64
66
  restart,
65
67
  result,
@@ -86,10 +88,10 @@ import {
86
88
  writeBoard,
87
89
  writeJson,
88
90
  writerAlive
89
- } from "./chunk-ENYILM47.mjs";
91
+ } from "./chunk-YPEYIVLF.mjs";
90
92
 
91
93
  // src/server/cli.ts
92
- import { existsSync as existsSync2, realpathSync as realpathSync2 } from "node:fs";
94
+ import { existsSync as existsSync2, realpathSync as realpathSync3 } from "node:fs";
93
95
  import { fileURLToPath } from "node:url";
94
96
 
95
97
  // src/server/desk.ts
@@ -221,7 +223,7 @@ async function runProcs(ctx, flags, { out, err }) {
221
223
  }
222
224
 
223
225
  // src/server/traincmds.ts
224
- import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs";
226
+ import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync as realpathSync2 } from "node:fs";
225
227
  import { availableParallelism, loadavg, userInfo } from "node:os";
226
228
  import { dirname as dirname2, join, resolve as resolve3 } from "node:path";
227
229
  var MAX_INPUT = 256 * 1024;
@@ -284,11 +286,16 @@ function check(flags, io) {
284
286
  if (slip?.refusal) refusals.push(slip.refusal);
285
287
  if (!setting.ok) refusals.push(setting.refusal);
286
288
  let required = setting.ok ? setting.accept : [];
287
- if (!accept.refusal && !slip?.refusal && setting.ok && !readApps(cwd).missing) {
289
+ if (!accept.refusal && !slip?.refusal && setting.ok) {
288
290
  const app = typeof flags.app === "string" ? flags.app : slip ? parseSlip(slip.text).fields.car : evidenceApp(accept.text);
289
- const found = app ? readAppIntegration(cwd, app) : { ok: false, refusal: "sb: the project has an apps.json, so name the app to check against: --app <name>" };
290
- if (found.ok) required = [.../* @__PURE__ */ new Set([...required, ...found.accept])];
291
- else refusals.push(found.refusal);
291
+ const dir = projectAppsDir(cwd);
292
+ if (dir === void 0) {
293
+ if (app) refusals.push(`sb: app ${app} could not be checked: ${noAppsWhere(cwd)}; run train check in the project's checkout`);
294
+ } else {
295
+ const found = app ? readAppIntegration(dir, app) : { ok: false, refusal: "sb: the project has an apps.json, so name the app to check against: --app <name>" };
296
+ if (found.ok) required = [.../* @__PURE__ */ new Set([...required, ...found.accept])];
297
+ else refusals.push(found.refusal);
298
+ }
292
299
  }
293
300
  if (!accept.refusal && !slip?.refusal && setting.ok && !refusals.length) {
294
301
  const exists = io.exists ?? ((path) => existsSync(resolve3(cwd, path)));
@@ -308,6 +315,17 @@ function check(flags, io) {
308
315
  `);
309
316
  return refusals.length ? 2 : 0;
310
317
  }
318
+ function noAppsWhere(cwd) {
319
+ const real2 = (path) => {
320
+ try {
321
+ return realpathSync2(path);
322
+ } catch {
323
+ return path;
324
+ }
325
+ };
326
+ const here = appsFile(real2(cwd)).both, main2 = appsFile(repoRoot(cwd)).both;
327
+ return `no apps.json at ${here}${main2 === here ? "" : `, nor in the main checkout of this repository (${main2})`}`;
328
+ }
311
329
  function evidenceApp(text) {
312
330
  try {
313
331
  const car = JSON.parse(text ?? "null")?.car;
@@ -1747,7 +1765,7 @@ var loadMain = () => main ??= import(new URL(import.meta.url.endsWith(".ts") ? "
1747
1765
  var selfPath = () => fileURLToPath(import.meta.url.split("?")[0]);
1748
1766
  var realpath = (path) => {
1749
1767
  try {
1750
- return realpathSync2(path);
1768
+ return realpathSync3(path);
1751
1769
  } catch {
1752
1770
  return path;
1753
1771
  }