demoman 0.9.0 → 0.9.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/demoman.mjs CHANGED
@@ -13,8 +13,8 @@ console.debug = toStderr.debug.bind(toStderr);
13
13
  // src/main.ts
14
14
  import { execFile as execFile13 } from "node:child_process";
15
15
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
16
- import { homedir as homedir4, tmpdir as tmpdir7 } from "node:os";
17
- import { join as join53, relative as relative6, resolve as resolve8 } from "node:path";
16
+ import { homedir as homedir4, tmpdir as tmpdir8 } from "node:os";
17
+ import { join as join54, relative as relative6, resolve as resolve8 } from "node:path";
18
18
  import { createInterface } from "node:readline";
19
19
  import { fileURLToPath as fileURLToPath7 } from "node:url";
20
20
  import { parseArgs as parseArgs4 } from "node:util";
@@ -2080,17 +2080,19 @@ var AppSchema = z4.object({
2080
2080
  appVersion: z4.literal(APP_VERSION),
2081
2081
  install: z4.array(z4.string().min(1)),
2082
2082
  start: z4.string().min(1),
2083
+ reset: z4.string().min(1).optional(),
2083
2084
  url: z4.string().min(1).refine((u) => /^https?:\/\/\S+$/.test(u), "must be an http(s) URL"),
2084
2085
  timeoutSeconds: z4.number().int().positive().default(120),
2085
- env: Env,
2086
- secrets: z4.array(z4.string().refine((n) => SECRET_NAME.test(n) && !n.startsWith("GITHUB_"), SECRET_NAME_RULE)),
2087
- services: z4.record(z4.string(), Service)
2086
+ // Defaulted like timeoutSeconds: a hand-written file may leave them out (DEM-48).
2087
+ env: Env.default({}),
2088
+ secrets: z4.array(z4.string().refine((n) => SECRET_NAME.test(n) && !n.startsWith("GITHUB_"), SECRET_NAME_RULE)).default([]),
2089
+ services: z4.record(z4.string(), Service).default({})
2088
2090
  }).strict();
2089
2091
  function parseApp(text2, file) {
2090
- const bad = (field, detail) => ({
2092
+ const bad = (field2, detail) => ({
2091
2093
  ok: false,
2092
2094
  reason: "appInvalid",
2093
- field,
2095
+ field: field2,
2094
2096
  detail: `${file}: ${detail}`
2095
2097
  });
2096
2098
  let raw;
@@ -2110,11 +2112,12 @@ function parseApp(text2, file) {
2110
2112
  if (!issue)
2111
2113
  return bad("", "does not match the app file shape");
2112
2114
  const path = issue.code === "unrecognized_keys" ? issue.keys : issue.path;
2113
- return bad(path.join("."), issue.message);
2115
+ const field = path.join(".");
2116
+ return bad(field, field === "" ? issue.message : `${field}: ${issue.message}`);
2114
2117
  }
2115
2118
  function serializeApp(app) {
2116
- const { appVersion, install, start, url, timeoutSeconds, env, secrets, services } = app;
2117
- return `${JSON.stringify({ appVersion, install, start, url, timeoutSeconds, env, secrets, services }, null, 2)}
2119
+ const { appVersion, install, start, reset, url, timeoutSeconds, env, secrets, services } = app;
2120
+ return `${JSON.stringify({ appVersion, install, start, ...reset === void 0 ? {} : { reset }, url, timeoutSeconds, env, secrets, services }, null, 2)}
2118
2121
  `;
2119
2122
  }
2120
2123
 
@@ -10597,7 +10600,7 @@ function prClause(report, clean) {
10597
10600
  const noted = sessionOnly || report.frames.degradations.length > 0 || report.frames.storageRefused || (report.look?.brandKitError ?? null) !== null || (report.look?.wallpaperError ?? null) !== null;
10598
10601
  return noted ? `${clean}, with notes` : clean;
10599
10602
  }
10600
- var NOT_KEPT = {
10603
+ var DEGRADATION_WORDS = {
10601
10604
  keyframeOnly: "a stretch of motion was kept as stills because memory ran high",
10602
10605
  budgetBreach: "motion frames were skipped to stay inside the frame budget",
10603
10606
  occlusionPause: "capture paused while the replay window was covered",
@@ -10624,7 +10627,7 @@ function lookClause(report) {
10624
10627
  }
10625
10628
  function framesClause(report) {
10626
10629
  const kinds = [...new Set(report.frames.degradations)];
10627
- const said2 = kinds.map((kind) => `${NOT_KEPT[kind]} (${kind})`);
10630
+ const said2 = kinds.map((kind) => `${DEGRADATION_WORDS[kind]} (${kind})`);
10628
10631
  if (report.frames.storageRefused) {
10629
10632
  said2.push("the frame store refused frames during the run (storageRefused)");
10630
10633
  }
@@ -13193,8 +13196,9 @@ var namesPort = (cmd, port) => new RegExp(`(?:--port[ =]|-p |PORT=)${port}(?!\\d
13193
13196
  async function workspaceDirs(root, root_) {
13194
13197
  let globs = null;
13195
13198
  const ws = await readOr(join5(root, "pnpm-workspace.yaml"));
13196
- if (ws !== null)
13197
- globs = parseYaml(ws)?.packages ?? [];
13199
+ const listed3 = ws === null ? void 0 : parseYaml(ws)?.packages;
13200
+ if (Array.isArray(listed3) && listed3.length > 0)
13201
+ globs = listed3;
13198
13202
  else if (Array.isArray(root_.workspaces))
13199
13203
  globs = root_.workspaces;
13200
13204
  else if (Array.isArray(root_.workspaces?.packages))
@@ -13353,6 +13357,17 @@ function shellWords(s) {
13353
13357
  words.push(word);
13354
13358
  return words;
13355
13359
  }
13360
+ function whoListens(port) {
13361
+ return new Promise((resolve9) => {
13362
+ execFile2("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-Fpc"], { timeout: 3e3 }, (error, stdout) => {
13363
+ if (error)
13364
+ return resolve9(null);
13365
+ const pid = /^p(\d+)$/m.exec(stdout)?.[1];
13366
+ const command2 = /^c(.+)$/m.exec(stdout)?.[1];
13367
+ resolve9(pid && command2 ? `${command2} (pid ${pid})` : null);
13368
+ });
13369
+ });
13370
+ }
13356
13371
  async function startApp(app, o, deps = {}) {
13357
13372
  const d = {
13358
13373
  spawn,
@@ -13382,10 +13397,39 @@ async function startApp(app, o, deps = {}) {
13382
13397
  return false;
13383
13398
  }
13384
13399
  };
13400
+ const reset = async () => {
13401
+ if (app.reset === void 0)
13402
+ return { ok: true };
13403
+ o.log(`resetting: \`${app.reset}\``);
13404
+ const r = launch(d.spawn, app.reset, o.root, env, true);
13405
+ const done = await Promise.race([
13406
+ r.exited,
13407
+ delay(app.timeoutSeconds * 1e3).then(() => null)
13408
+ ]);
13409
+ if (done === null) {
13410
+ await endGroup(r.child);
13411
+ return {
13412
+ ok: false,
13413
+ detail: `\`${app.reset}\` did not finish within ${app.timeoutSeconds} s and was stopped; fix the reset command in ${APP_FILE}, or raise timeoutSeconds there`
13414
+ };
13415
+ }
13416
+ const { code: code2, signal } = done;
13417
+ if (code2 === 0)
13418
+ return { ok: true };
13419
+ await Promise.race([r.drained, delay(DRAIN_MS)]);
13420
+ const tail = tailOf(r.output());
13421
+ return {
13422
+ ok: false,
13423
+ detail: `\`${app.reset}\` ${code2 === null ? `was stopped by ${signal}` : `exited with code ${code2}`}; fix the reset command in ${APP_FILE}${tail === "" ? "" : `:
13424
+ ${tail}`}`
13425
+ };
13426
+ };
13385
13427
  if (o.mode === "own" && await listening(app.url)) {
13428
+ const u = new URL(app.url);
13429
+ const who = await whoListens(Number(u.port || (u.protocol === "https:" ? 443 : 80)));
13386
13430
  return {
13387
13431
  reason: "appPortTaken",
13388
- detail: `something already listens at ${app.url} before the app was started; stop it (the check needs that port for the app it starts from ${APP_FILE}), then run again`,
13432
+ detail: `something already listens at ${app.url}${who === null ? "" : ` (held by ${who})`} before the app was started; stop it (the check needs that port for the app it starts from ${APP_FILE}), then run again`,
13389
13433
  tail: ""
13390
13434
  };
13391
13435
  }
@@ -13394,7 +13438,8 @@ async function startApp(app, o, deps = {}) {
13394
13438
  reused: true,
13395
13439
  said: `used the app already answering at ${app.url}`,
13396
13440
  seconds: Math.round((d.now() - t0) / 100) / 10,
13397
- stop: async () => []
13441
+ stop: async () => [],
13442
+ reset
13398
13443
  };
13399
13444
  }
13400
13445
  const containers = [];
@@ -13507,7 +13552,8 @@ async function startApp(app, o, deps = {}) {
13507
13552
  reused: false,
13508
13553
  said: `started the app with \`${app.start}\` from ${APP_FILE}`,
13509
13554
  seconds: Math.round((d.now() - t0) / 100) / 10,
13510
- stop: stop2
13555
+ stop: stop2,
13556
+ reset
13511
13557
  };
13512
13558
  }
13513
13559
  function launch(spawnFn, cmd, cwd, env, detached) {
@@ -13763,7 +13809,7 @@ async function verifySetup(a, deps) {
13763
13809
  library: "throwaway",
13764
13810
  outDir,
13765
13811
  ..."baseUrl" in target ? { baseUrl: target.baseUrl } : {}
13766
- }, env);
13812
+ }, env, app?.reset ?? void 0);
13767
13813
  const result = await orStop(refreshing);
13768
13814
  if (result === STOPPED) {
13769
13815
  deps.log("stopping: waiting for the run in progress to end, then removing the clean checkout");
@@ -15120,8 +15166,12 @@ function secretIn(state, sweep) {
15120
15166
  return n === null ? null : `${n} in its browser storage`;
15121
15167
  }
15122
15168
  var originAndPath = (raw) => {
15123
- const u = new URL(raw);
15124
- return `${u.origin}${u.pathname}`;
15169
+ try {
15170
+ const u = new URL(raw);
15171
+ return `${u.origin}${u.pathname}`;
15172
+ } catch {
15173
+ return raw;
15174
+ }
15125
15175
  };
15126
15176
  async function signInAccount(chosen, deps) {
15127
15177
  const { account, site } = chosen;
@@ -15285,15 +15335,27 @@ async function signInAccount(chosen, deps) {
15285
15335
  };
15286
15336
  try {
15287
15337
  const navUntil = Math.min(deadline, Date.now() + STEP_WAIT_MS);
15288
- while (nav.documents === 0 && Date.now() < navUntil)
15338
+ const pathBefore = originAndPath(page2.url());
15339
+ let signedInPlace = false;
15340
+ let lastLook = 0;
15341
+ while (nav.documents === 0 && Date.now() < navUntil) {
15342
+ if (Date.now() - lastLook >= 250) {
15343
+ lastLook = Date.now();
15344
+ const facts2 = await readLandingFacts(page2, page2.url()).catch(() => null);
15345
+ if (facts2 !== null && !facts2.passwordFieldVisible && originAndPath(facts2.landedUrl) !== pathBefore) {
15346
+ signedInPlace = true;
15347
+ break;
15348
+ }
15349
+ }
15289
15350
  await wait(50);
15351
+ }
15290
15352
  while (nav.documents > 0 && nav.loaded === 0 && nav.failed === 0 && Date.now() < navUntil) {
15291
15353
  await wait(50);
15292
15354
  }
15293
15355
  if (nav.documents > 0 && nav.loaded === 0 && nav.failed === 0) {
15294
15356
  deps.log(deps.sweep.scrub(`signing in as ${name}: the navigation the last step set going had not loaded a page within ${STEP_WAIT_MS / 1e3} s; checking ${account.checkUrl} now`));
15295
15357
  }
15296
- if (nav.documents === 0) {
15358
+ if (nav.documents === 0 && !signedInPlace) {
15297
15359
  deps.log(deps.sweep.scrub(`signing in as ${name}: no page navigation followed the last click, type or goto within ${STEP_WAIT_MS / 1e3} s; checking ${account.checkUrl} now`));
15298
15360
  }
15299
15361
  await bounded(settle(page2), "the page to go quiet after the steps");
@@ -21828,13 +21890,22 @@ async function describeVideo(store, library, video) {
21828
21890
  };
21829
21891
  return { summary, steps: steps3 };
21830
21892
  }
21831
- async function matchesFor(store, library, name, repo) {
21893
+ var originOf2 = (u) => {
21894
+ try {
21895
+ return new URL(u).origin;
21896
+ } catch {
21897
+ return null;
21898
+ }
21899
+ };
21900
+ async function matchesFor(store, library, name, repo, startPage2) {
21832
21901
  const out = [];
21833
21902
  const mine = await store.resolve(repo);
21903
+ const site = originOf2(startPage2);
21904
+ const same = (v) => "key" in mine ? "key" in v.repo ? v.repo.key === mine.key : "unknown" in v.repo && site !== null && originOf2(v.startPage) === site : sharesRepo(v.repo, mine);
21834
21905
  for (const v of await store.list()) {
21835
21906
  if ("unreadable" in v)
21836
21907
  continue;
21837
- if (sharesRepo(v.repo, mine) && similarNames(v.name, name)) {
21908
+ if (same(v) && similarNames(v.name, name)) {
21838
21909
  out.push(await summarise(store, library, v));
21839
21910
  }
21840
21911
  }
@@ -22467,7 +22538,13 @@ function createLocalExecutor(options) {
22467
22538
  const { kept, file } = keptHolder;
22468
22539
  return refusal("nameTaken", `flow "${kept.name}" is in the repo in ${file} \u2014 add a video to it with flow: { id: "${kept.flow}" }, or name the new flow differently`, "video", { holder: { id: kept.flow, name: kept.name } });
22469
22540
  }
22470
- const matches = await matchesFor(videos, library, asked.new, videoRepo);
22541
+ let rawTarget;
22542
+ try {
22543
+ rawTarget = raw?.target;
22544
+ } catch {
22545
+ rawTarget = void 0;
22546
+ }
22547
+ const matches = await matchesFor(videos, library, asked.new, videoRepo, startPage(typeof rawTarget === "string" ? rawTarget : void 0));
22471
22548
  const holder = matches.find((m) => sameName(m.name, asked.new));
22472
22549
  if (holder !== void 0) {
22473
22550
  return refusal("nameTaken", `flow "${holder.name}" (${holder.id}) already has that name in this repo \u2014 add a video to it with flow: { id: "${holder.id}" }, or name the new flow differently`, "video", { holder });
@@ -23092,16 +23169,46 @@ import { access as access3, mkdtemp as mkdtemp4, readFile as readFile17, realpat
23092
23169
  import { tmpdir as tmpdir5 } from "node:os";
23093
23170
  import { basename as basename5, dirname as dirname9, join as join29, relative as relative4, resolve as resolve4 } from "node:path";
23094
23171
  var DEVICE_DISPLAY = { width: 1280, height: 800 };
23095
- function uncleanRun(answer2) {
23172
+ var FORGIVEN = /* @__PURE__ */ new Set([
23173
+ "stillFailed",
23174
+ "scrollUnsettled",
23175
+ "budgetBreach",
23176
+ "keyframeOnly"
23177
+ ]);
23178
+ var STILLS_ONLY = "no motion was recorded: the video is its stills only";
23179
+ function runVerdict(answer2) {
23096
23180
  const r = answer2;
23097
23181
  if (r.outcome === "refusedBeforeRun")
23098
- return `${r.reason}: ${r.detail}`;
23182
+ return { kind: "failed", detail: `${r.reason}: ${r.detail}` };
23099
23183
  if (r.outcome === "threw")
23100
- return `the run threw: ${r.error}`;
23101
- const clean = r.outcome === "complete" && r.stopped === void 0 && r.verdict?.kind === "matches" && r.frames?.degradations.length === 0 && (r.notStored ?? []).length === 0;
23102
- if (clean)
23103
- return null;
23104
- return typeof r.summary === "string" ? r.summary : `the run answered ${JSON.stringify(r.outcome)} with no summary`;
23184
+ return { kind: "failed", detail: `the run threw: ${r.error}` };
23185
+ const kinds = [...new Set(r.frames?.degradations ?? [])];
23186
+ const problems = kinds.map((k) => {
23187
+ const words = DEGRADATION_WORDS[k];
23188
+ return words === void 0 ? k : `${words} (${k})`;
23189
+ });
23190
+ const acting = (r.steps ?? []).filter((s) => s.intent?.do !== "pause");
23191
+ const starved = r.frames?.spans === 0 && acting.length > 0;
23192
+ if (starved)
23193
+ problems.push(STILLS_ONLY);
23194
+ const whole = r.outcome === "complete" && r.stopped === void 0 && r.verdict?.kind === "matches" && r.frames !== void 0 && (r.notStored ?? []).length === 0;
23195
+ if (whole && kinds.every((k) => FORGIVEN.has(k)))
23196
+ return problems.length === 0 ? { kind: "clean" } : { kind: "degraded", problems };
23197
+ const line2 = typeof r.summary === "string" ? r.summary : `the run answered ${JSON.stringify(r.outcome)} with no summary`;
23198
+ return {
23199
+ kind: "failed",
23200
+ detail: problems.length === 0 ? line2 : `${line2} \u2014 ${problems.join("; ")}`
23201
+ };
23202
+ }
23203
+ async function recordWithRetry(run2, name, log2) {
23204
+ const first = await run2();
23205
+ const verdict = runVerdict(first);
23206
+ if (verdict.kind !== "degraded")
23207
+ return { answer: first, verdict };
23208
+ log2(`refresh: "${name}" recorded with ${verdict.problems.join("; ")}; trying it once more`);
23209
+ const answer2 = await run2();
23210
+ const second = runVerdict(answer2);
23211
+ return second.kind === "failed" ? { answer: first, verdict } : { answer: answer2, verdict: second };
23105
23212
  }
23106
23213
  async function refreshKept(args2, deps) {
23107
23214
  const root = resolve4(args2.repoRoot);
@@ -23309,6 +23416,13 @@ async function filmOne(job, root, executor, home, deps) {
23309
23416
  const { kept, script, previous, from, receiptFile } = job;
23310
23417
  const times = stageTimes();
23311
23418
  const run2 = async () => {
23419
+ const reset = await deps.beforeFlow?.() ?? { ok: true };
23420
+ if (!reset.ok)
23421
+ return {
23422
+ outcome: "refusedBeforeRun",
23423
+ reason: "reset failed",
23424
+ detail: reset.detail
23425
+ };
23312
23426
  const out = await executor.request("run", {
23313
23427
  script,
23314
23428
  // The kept flow by its id: the throwaway library adopts it, so what
@@ -23320,11 +23434,12 @@ async function filmOne(job, root, executor, home, deps) {
23320
23434
  });
23321
23435
  return out.ok ? out.value : { outcome: "refusedBeforeRun", reason: out.reason, detail: out.detail };
23322
23436
  };
23323
- const answer2 = await run2();
23437
+ const { answer: answer2, verdict } = await recordWithRetry(run2, kept.name, deps.log);
23324
23438
  times.mark("record");
23325
- const unclean = uncleanRun(answer2);
23326
- if (unclean !== null)
23327
- return { failed: unclean };
23439
+ if (verdict.kind === "failed")
23440
+ return { failed: verdict.detail };
23441
+ if (verdict.kind === "degraded")
23442
+ job.notes.push(`recorded with problems Demoman could not avoid on this machine: ${verdict.problems.join("; ")}`);
23328
23443
  const report = answer2;
23329
23444
  const takeId = report.provenance.takeId;
23330
23445
  if (takeId === null)
@@ -23612,7 +23727,11 @@ var hostPort = (p) => {
23612
23727
  };
23613
23728
  async function withApp(plan, o, run2, deps = {}) {
23614
23729
  if (plan.kind === "none")
23615
- return { ok: true, value: await run2(), lines: [] };
23730
+ return {
23731
+ ok: true,
23732
+ value: await run2(async () => ({ ok: true })),
23733
+ lines: []
23734
+ };
23616
23735
  if (plan.kind === "refused")
23617
23736
  return {
23618
23737
  ok: false,
@@ -23643,7 +23762,7 @@ async function withApp(plan, o, run2, deps = {}) {
23643
23762
  }
23644
23763
  const lines = [started.said];
23645
23764
  try {
23646
- return { ok: true, value: await run2(), lines };
23765
+ return { ok: true, value: await run2(started.reset), lines };
23647
23766
  } finally {
23648
23767
  const left = await started.stop();
23649
23768
  if (left.length > 0)
@@ -23942,7 +24061,7 @@ async function signin(url, deps) {
23942
24061
  await check.close();
23943
24062
  }
23944
24063
  }
23945
- var originOf2 = (site) => {
24064
+ var originOf3 = (site) => {
23946
24065
  try {
23947
24066
  return new URL(site).origin;
23948
24067
  } catch {
@@ -23967,7 +24086,7 @@ async function signinAccount(name, deps) {
23967
24086
  return 2;
23968
24087
  }
23969
24088
  const { file } = found;
23970
- const wanted = deps.site === void 0 ? null : originOf2(deps.site);
24089
+ const wanted = deps.site === void 0 ? null : originOf3(deps.site);
23971
24090
  const holders = [...file.sites.values()].filter((s) => (wanted === null || s.origin === wanted) && s.accounts.has(name));
23972
24091
  if (holders.length === 0) {
23973
24092
  const have = [...file.sites.values()].map((s) => `${s.origin}: ${[...s.accounts.keys()].join(", ")}`).join("; ");
@@ -24709,7 +24828,7 @@ function registerTools(server, bare2, options) {
24709
24828
  });
24710
24829
  server.registerTool("ci", {
24711
24830
  annotations: TOOL_ANNOTATIONS.ci,
24712
- description: `Set up CI to refresh the repo's flows (as \`npx demoman setup --ci\`): checks the refresh from a clean checkout of the repo (minutes), then answers {outcome: "plan", plan, lines, next} and does nothing else. Show the person lines; only on their yes, call again with the same choices and confirmed: true, which applies that plan: sets the repo's GitHub secrets, turns on the Actions setting for pull requests, opens the pull request "Set up Demoman" from demoman/setup, and watches its run: {outcome: "opened", pr, check, secrets, setting, run, lines}. trigger: release, daily, push or {deployment: <environment>}; absent, the plan's default. route: pr or main. app: the .demoman/app.json you propose ({appVersion: 1, install, start, url, ...}), written to the working tree uncommitted. watch: true watches the newest run on demoman/setup after you pushed a fix there; outcome gaveUp after three failed runs: hand back. A secret's value never passes through you: secretMissing or secretTooShort names the secrets and gives command for the person to run in their terminal. Past about 50 s {outcome: "stillRunning", id}, then call report. A refusal carries reason and detail.`,
24831
+ description: `Set up CI to refresh the repo's flows (as \`npx demoman setup --ci\`): checks the refresh from a clean checkout of the repo (minutes), then answers {outcome: "plan", plan, lines, next} and does nothing else. Show the person lines; only on their yes, call again with the same choices and confirmed: true, which applies that plan: turns on the Actions setting for pull requests, sets the repo's GitHub secrets, opens the pull request "Set up Demoman" from demoman/setup, and watches its run: {outcome: "opened", pr, check, secrets, setting, run, lines}. trigger: release, daily, push or {deployment: <environment>}; absent, the plan's default. route: pr or main. app: the .demoman/app.json you propose ({appVersion: 1, install, start, url, ...}), written to the working tree uncommitted. watch: true watches the newest run on demoman/setup after you pushed a fix there; outcome gaveUp after three failed runs: hand back. A secret's value never passes through you: secretMissing or secretTooShort names the secrets and gives command for the person to run in their terminal. Past about 50 s {outcome: "stillRunning", id}, then call report. A refusal carries reason and detail.`,
24713
24832
  inputSchema: {
24714
24833
  trigger: z7.union([
24715
24834
  z7.enum(["release", "daily", "push"]),
@@ -25812,6 +25931,9 @@ async function startStudio(o) {
25812
25931
  let pid;
25813
25932
  try {
25814
25933
  const child = spawn2(o.serve.command, o.serve.args, {
25934
+ // The Demoman home, never the caller's folder, which can be one since
25935
+ // deleted (review of #35): the studio needs no working folder of its own.
25936
+ cwd: o.home,
25815
25937
  detached: true,
25816
25938
  stdio: ["ignore", "ignore", fd]
25817
25939
  });
@@ -29186,17 +29308,38 @@ async function allowActionPullRequests(gh, slug) {
29186
29308
  const path = `repos/${slug}/actions/permissions/workflow`;
29187
29309
  const fail = (what, stderr) => {
29188
29310
  const msg = stderr.trim().split("\n")[0] || "no message";
29189
- if (!/HTTP (403|409)/.test(stderr)) {
29311
+ if (!/HTTP (403|409)|\((Forbidden|Conflict)\)/.test(stderr)) {
29190
29312
  return {
29191
29313
  kind: "unknown",
29192
29314
  detail: `could not ${what} (${msg}); nothing was assumed. Check it at ${url}, or run setup again`,
29193
29315
  url
29194
29316
  };
29195
29317
  }
29196
- const why2 = /organi[sz]ation|enterprise/i.test(msg) ? "it reads as locked by the organisation" : "it reads as missing admin on the repo";
29318
+ if (/SAML|single sign-on|\bSSO\b/i.test(msg)) {
29319
+ return {
29320
+ kind: "refused",
29321
+ detail: `GitHub refused ${what}: ${msg}; the organisation uses single sign-on and gh's token is not authorised for it. Run \`gh auth refresh\` and authorise the organisation, then run setup again`,
29322
+ url
29323
+ };
29324
+ }
29325
+ if (/enterprise/i.test(msg)) {
29326
+ return {
29327
+ kind: "refused",
29328
+ detail: `GitHub refused ${what}: ${msg}; it reads as locked by an enterprise policy. An enterprise owner must allow "Allow GitHub Actions to create and approve pull requests" in the enterprise's Actions policies`,
29329
+ url
29330
+ };
29331
+ }
29332
+ if (/organi[sz]ation/i.test(msg)) {
29333
+ const org = `https://github.com/organizations/${slug.split("/")[0]}/settings/actions`;
29334
+ return {
29335
+ kind: "refused",
29336
+ detail: `GitHub refused ${what}: ${msg}; it reads as locked by the organisation. An organisation owner must allow "Allow GitHub Actions to create and approve pull requests" at ${org}`,
29337
+ url: org
29338
+ };
29339
+ }
29197
29340
  return {
29198
29341
  kind: "refused",
29199
- detail: `GitHub refused ${what}: ${msg}; ${why2}. Allow it at ${url}`,
29342
+ detail: `GitHub refused ${what}: ${msg}; it reads as missing admin on the repo. Allow it at ${url}`,
29200
29343
  url
29201
29344
  };
29202
29345
  };
@@ -29219,16 +29362,51 @@ async function allowActionPullRequests(gh, slug) {
29219
29362
  }
29220
29363
 
29221
29364
  // src/ci-pr.ts
29222
- import { mkdir as mkdir18, mkdtemp as mkdtemp5, rm as rm18, writeFile as writeFile17 } from "node:fs/promises";
29365
+ import { mkdir as mkdir18, mkdtemp as mkdtemp6, readFile as readFile26, rm as rm19, writeFile as writeFile18 } from "node:fs/promises";
29366
+ import { tmpdir as tmpdir7 } from "node:os";
29367
+ import { dirname as dirname12, isAbsolute as isAbsolute10, join as join48, relative as relative5 } from "node:path";
29368
+
29369
+ // src/gitignore-secrets.ts
29370
+ import { mkdtemp as mkdtemp5, rm as rm18, writeFile as writeFile17 } from "node:fs/promises";
29223
29371
  import { tmpdir as tmpdir6 } from "node:os";
29224
- import { dirname as dirname12, isAbsolute as isAbsolute10, join as join47, relative as relative5 } from "node:path";
29372
+ import { join as join47 } from "node:path";
29373
+ var SECRETS_FILE2 = ".demoman/secrets.env";
29374
+ var SECRETS_IGNORE = "# Demoman: demo account passwords\n.demoman/secrets.env\n";
29375
+ var ISOLATED = {
29376
+ ...process.env,
29377
+ GIT_CONFIG_GLOBAL: "/dev/null",
29378
+ GIT_CONFIG_NOSYSTEM: "1"
29379
+ };
29380
+ async function ignoresSecrets(text2) {
29381
+ if (text2.trim() === "") return false;
29382
+ const dir = await mkdtemp5(join47(tmpdir6(), "demoman-ignore-"));
29383
+ try {
29384
+ await execGit(["init", "-q"], dir, ISOLATED);
29385
+ await writeFile17(join47(dir, ".gitignore"), text2);
29386
+ const r = await execGit(
29387
+ ["check-ignore", "--no-index", "-q", "--", SECRETS_FILE2],
29388
+ dir,
29389
+ ISOLATED
29390
+ );
29391
+ return r.code === 0;
29392
+ } finally {
29393
+ await rm18(dir, { recursive: true, force: true });
29394
+ }
29395
+ }
29396
+ function withLines(text2, lines) {
29397
+ if (text2 === "") return lines;
29398
+ return `${text2}${text2.endsWith("\n") ? "" : "\n"}
29399
+ ${lines}`;
29400
+ }
29401
+
29402
+ // src/ci-pr.ts
29225
29403
  var SETUP_BRANCH = "demoman/setup";
29226
29404
  var SETUP_TITLE = "Set up Demoman";
29227
29405
  async function openSetupPr(a, deps) {
29228
29406
  const { git, gh } = deps;
29229
29407
  const branch = a.branch ?? SETUP_BRANCH;
29230
29408
  const title = a.title ?? SETUP_TITLE;
29231
- const tmp = await mkdtemp5(join47(tmpdir6(), "demoman-setup-"));
29409
+ const tmp = await mkdtemp6(join48(tmpdir7(), "demoman-setup-"));
29232
29410
  let added = false;
29233
29411
  const stage = async (what, args2, cwd = tmp) => {
29234
29412
  const r = await git(args2, cwd);
@@ -29250,7 +29428,7 @@ async function openSetupPr(a, deps) {
29250
29428
  added = true;
29251
29429
  try {
29252
29430
  for (const f of a.files) {
29253
- const p = join47(tmp, f.path);
29431
+ const p = join48(tmp, f.path);
29254
29432
  const rel = relative5(tmp, p);
29255
29433
  if (isAbsolute10(f.path) || rel.startsWith("..") || isAbsolute10(rel))
29256
29434
  return {
@@ -29258,7 +29436,18 @@ async function openSetupPr(a, deps) {
29258
29436
  detail: `the file path ${f.path} points outside the repo, so nothing was written; give a path inside the repo and run setup again`
29259
29437
  };
29260
29438
  await mkdir18(dirname12(p), { recursive: true });
29261
- await writeFile17(p, f.text);
29439
+ if (f.appendToBase !== void 0) {
29440
+ const onBase = await readFile26(p, "utf8").catch(
29441
+ (e) => {
29442
+ if (e.code === "ENOENT") return "";
29443
+ throw e;
29444
+ }
29445
+ );
29446
+ if (!await ignoresSecrets(onBase))
29447
+ await writeFile18(p, withLines(onBase, f.appendToBase));
29448
+ continue;
29449
+ }
29450
+ await writeFile18(p, f.text);
29262
29451
  }
29263
29452
  } catch (e) {
29264
29453
  return {
@@ -29308,14 +29497,14 @@ async function openSetupPr(a, deps) {
29308
29497
  return { opened: { number, url, branch, sha } };
29309
29498
  } finally {
29310
29499
  if (added) await git(["worktree", "remove", "--force", tmp], a.root);
29311
- await rm18(tmp, { recursive: true, force: true });
29500
+ await rm19(tmp, { recursive: true, force: true });
29312
29501
  await git(["worktree", "prune"], a.root);
29313
29502
  }
29314
29503
  }
29315
29504
 
29316
29505
  // src/ci-secrets.ts
29317
- import { readFile as readFile26 } from "node:fs/promises";
29318
- import { join as join48 } from "node:path";
29506
+ import { readFile as readFile27 } from "node:fs/promises";
29507
+ import { join as join49 } from "node:path";
29319
29508
  import { parseEnv } from "node:util";
29320
29509
  async function neededSecrets(root, app) {
29321
29510
  const needed = /* @__PURE__ */ new Map();
@@ -29359,7 +29548,7 @@ async function localValues(root, needed, env) {
29359
29548
  if (absent.length > 0) {
29360
29549
  let file = null;
29361
29550
  try {
29362
- file = await readSecretsFile(join48(root, ".demoman"));
29551
+ file = await readSecretsFile(join49(root, ".demoman"));
29363
29552
  } catch (error) {
29364
29553
  if (!(error instanceof SecretError)) throw error;
29365
29554
  unread = error.message;
@@ -29381,11 +29570,11 @@ async function localValues(root, needed, env) {
29381
29570
  };
29382
29571
  }
29383
29572
  async function envFileNames(path, needed) {
29384
- const names = Object.keys(parseEnv(await readFile26(path, "utf8")));
29573
+ const names = Object.keys(parseEnv(await readFile27(path, "utf8")));
29385
29574
  return names.filter((n) => needed.some((s) => s.name === n));
29386
29575
  }
29387
29576
  async function envFileValues(path, chosen) {
29388
- const all = parseEnv(await readFile26(path, "utf8"));
29577
+ const all = parseEnv(await readFile27(path, "utf8"));
29389
29578
  const values = /* @__PURE__ */ new Map();
29390
29579
  for (const n of chosen) {
29391
29580
  const v = all[n];
@@ -29434,15 +29623,15 @@ async function setSecrets(gh, slug, values, replace, existing) {
29434
29623
  }
29435
29624
 
29436
29625
  // src/ci-tool.ts
29437
- import { mkdir as mkdir20, writeFile as writeFile19 } from "node:fs/promises";
29438
- import { join as join51 } from "node:path";
29626
+ import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
29627
+ import { join as join52 } from "node:path";
29439
29628
 
29440
29629
  // src/ci-setup.ts
29441
- import { access as access4, mkdir as mkdir19, readdir as readdir10, readFile as readFile27, writeFile as writeFile18 } from "node:fs/promises";
29442
- import { join as join50 } from "node:path";
29630
+ import { access as access4, mkdir as mkdir19, readdir as readdir10, readFile as readFile28, writeFile as writeFile19 } from "node:fs/promises";
29631
+ import { join as join51 } from "node:path";
29443
29632
 
29444
29633
  // src/ci-workflow.ts
29445
- import { join as join49 } from "node:path";
29634
+ import { join as join50 } from "node:path";
29446
29635
  import { parseArgs } from "node:util";
29447
29636
 
29448
29637
  // src/deliver.ts
@@ -29669,6 +29858,7 @@ function secretNames(o) {
29669
29858
  ...o.secrets.app
29670
29859
  ];
29671
29860
  }
29861
+ var runsByHand = (trigger) => trigger === "push" || trigger === "daily";
29672
29862
  function shapeOf(o) {
29673
29863
  const deployment = typeof o.trigger === "string" ? null : o.trigger.deployment;
29674
29864
  const kind = typeof o.trigger === "string" ? o.trigger : "deployment";
@@ -29729,14 +29919,15 @@ function ciWorkflow(o) {
29729
29919
  throw new Error(DEPLOYMENT_MAIN);
29730
29920
  }
29731
29921
  if (kind === "release" && o.route === "main") throw new Error(RELEASE_MAIN);
29732
- const on = {
29922
+ const on = `${{
29733
29923
  push: ` push:
29734
29924
  branches: [${branch}]`,
29735
29925
  release: " release:\n types: [published]",
29736
29926
  daily: ' schedule:\n - cron: "17 6 * * *"',
29737
29927
  deployment: " deployment_status:"
29738
- }[kind];
29739
- const guard = kind === "push" ? "!contains(github.event.head_commit.message, '[skip demoman]') && github.actor != 'github-actions[bot]'" : kind === "deployment" ? `github.event.deployment_status.state == 'success' && github.event.deployment.environment == '${deployment}'` : null;
29928
+ }[kind]}${runsByHand(o.trigger) ? "\n workflow_dispatch:" : ""}`;
29929
+ const byHand = `(github.event_name != 'workflow_dispatch' || github.ref_name == '${branch}')`;
29930
+ const guard = kind === "push" ? `!contains(github.event.head_commit.message, '[skip demoman]') && github.actor != 'github-actions[bot]' && ${byHand}` : kind === "deployment" ? `github.event.deployment_status.state == 'success' && github.event.deployment.environment == '${deployment}'` : kind === "daily" ? byHand : null;
29740
29931
  const refreshIf = expr(
29741
29932
  `github.event_name != 'pull_request'${guard === null ? "" : ` && (${guard})`}`
29742
29933
  );
@@ -29820,11 +30011,12 @@ ${DEPLOYED_SCRIPT.split("\n").map((l) => ` ${l}`).join("\n")}
29820
30011
  run: |
29821
30012
  wf=\${GITHUB_WORKFLOW_REF%%@*}
29822
30013
  export WF=\${wf#"$GITHUB_REPOSITORY"/}
29823
- # Only this workflow's own runs on its own event (and branch), from this
29824
- # repository, newest first: never a fork's or another workflow's artifact.
30014
+ # Only this workflow's own runs on its own event or run by hand (and
30015
+ # branch), from this repository, newest first: never a fork's or
30016
+ # another workflow's artifact.
29825
30017
  id=""
29826
30018
  said=""
29827
- if ! runs=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/\${WF##*/}/runs?event=$EVENT&status=completed&per_page=50\${BRANCH:+&branch=$BRANCH}" --jq '[.workflow_runs[] | select(((.path // "") | startswith($ENV.WF)) and .event == $ENV.EVENT and (($ENV.BRANCH // "") == "" or .head_branch == $ENV.BRANCH) and .head_repository.id == .repository.id)] | sort_by(.created_at) | reverse | .[] | "\\(.id) \\(.head_sha)"'); then
30019
+ if ! runs=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/\${WF##*/}/runs?status=completed&per_page=100\${BRANCH:+&branch=$BRANCH}" --jq '[.workflow_runs[] | select(((.path // "") | startswith($ENV.WF)) and (.event == $ENV.EVENT or .event == "workflow_dispatch") and (($ENV.BRANCH // "") == "" or .head_branch == $ENV.BRANCH) and .head_repository.id == .repository.id)] | sort_by(.created_at) | reverse | .[] | "\\(.id) \\(.head_sha)"'); then
29828
30020
  said="::warning::This workflow's earlier runs could not be listed"
29829
30021
  else
29830
30022
  while read -r r sha <&3; do
@@ -29862,15 +30054,16 @@ ${DEPLOYED_SCRIPT.split("\n").map((l) => ` ${l}`).join("\n")}
29862
30054
  ` : "";
29863
30055
  const freshStep = ` - name: Anything new since the last refresh?
29864
30056
  id: fresh
30057
+ if: ${expr("github.event_name != 'workflow_dispatch'")}
29865
30058
  env:
29866
30059
  GH_TOKEN: ${expr("github.token")}
29867
30060
  run: |
29868
30061
  wf=\${GITHUB_WORKFLOW_REF%%@*}
29869
30062
  export WF=\${wf#"$GITHUB_REPOSITORY"/}
29870
- # The commit this workflow's last successful scheduled run refreshed
29871
- # at: it recorded or confirmed every flow there.
30063
+ # The commit this workflow's last successful scheduled or manual run
30064
+ # refreshed at: it recorded or confirmed every flow there.
29872
30065
  since=""
29873
- if s=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/\${WF##*/}/runs?event=schedule&status=success&per_page=20" --jq '[.workflow_runs[] | select(((.path // "") | startswith($ENV.WF)) and .head_repository.id == .repository.id)] | .[0].head_sha // ""'); then
30066
+ if s=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/\${WF##*/}/runs?status=success&per_page=100" --jq '[.workflow_runs[] | select(((.path // "") | startswith($ENV.WF)) and (.event == "schedule" or .event == "workflow_dispatch") and .head_repository.id == .repository.id)] | .[0].head_sha // ""'); then
29874
30067
  if [ -n "$s" ] && git merge-base --is-ancestor "$s" HEAD 2>/dev/null; then
29875
30068
  since="--since $s"
29876
30069
  fi
@@ -29907,7 +30100,8 @@ ${/\bbunx?\b/.test([...started.install, started.start].join("\n")) ? ` - us
29907
30100
  # A committed video in LFS is compared, not replaced as a pointer.
29908
30101
  lfs: true${ref}
29909
30102
  ${guarded ? ` - name: Skip Demoman's own commits
29910
- id: guard
30103
+ id: guard${runsByHand(o.trigger) ? `
30104
+ if: ${expr("github.event_name != 'workflow_dispatch'")}` : ""}
29911
30105
  env:
29912
30106
  SHA: ${sha}
29913
30107
  run: |
@@ -30073,7 +30267,7 @@ async function ciSetup(args2, io) {
30073
30267
  choices.appBy = "person";
30074
30268
  } else if (plan.reason === "secretMissing" && plan.secrets !== void 0) {
30075
30269
  let missing = plan.secrets;
30076
- const path = flags["env-file"] ?? (ask !== null && io.exists(".env") ? join49(root, ".env") : void 0);
30270
+ const path = flags["env-file"] ?? (ask !== null && io.exists(".env") ? join50(root, ".env") : void 0);
30077
30271
  let chosen = [];
30078
30272
  if (path !== void 0) {
30079
30273
  let names;
@@ -30255,13 +30449,13 @@ var orMissing = (p) => p.catch((e) => {
30255
30449
  if (e.code === "ENOENT") return null;
30256
30450
  throw e;
30257
30451
  });
30258
- var readOrNull = (path) => orMissing(readFile27(path));
30452
+ var readOrNull = (path) => orMissing(readFile28(path));
30259
30453
  async function draftLeft(root, step, app) {
30260
30454
  if (step !== "app" || app === null || app.source.kind === "file") return "";
30261
- const path = join50(root, APP_FILE);
30455
+ const path = join51(root, APP_FILE);
30262
30456
  try {
30263
- await mkdir19(join50(root, ".demoman"), { recursive: true });
30264
- await writeFile18(path, app.text, { flag: "wx" });
30457
+ await mkdir19(join51(root, ".demoman"), { recursive: true });
30458
+ await writeFile19(path, app.text, { flag: "wx" });
30265
30459
  } catch (error) {
30266
30460
  if (error.code === "EEXIST") return "";
30267
30461
  return `; ${APP_FILE} could not be written (${messageOf9(error)}): write it yourself with the command fixed`;
@@ -30269,6 +30463,7 @@ async function draftLeft(root, step, app) {
30269
30463
  const from = "file" in app.source ? ` from ${app.source.file}` : "";
30270
30464
  return `; the check used a drafted ${APP_FILE}${from}, now written to the working tree uncommitted`;
30271
30465
  }
30466
+ var ACCOUNTS_FILE = ".demoman/accounts.json";
30272
30467
  async function shown(git, root, ref, path) {
30273
30468
  const r = await git(["show", `${ref}:${path}`], root);
30274
30469
  return r.code === 0 ? r.stdout : null;
@@ -30279,7 +30474,7 @@ async function flowFiles(root, file, kept) {
30279
30474
  );
30280
30475
  if (kept.deliver !== "commit") return { paths: script, scriptOnly: null };
30281
30476
  const receiptFile = `${RECEIPT_DIR}/${file.split("/").pop()}`;
30282
- const text2 = await readOrNull(join50(root, receiptFile));
30477
+ const text2 = await readOrNull(join51(root, receiptFile));
30283
30478
  if (text2 === null)
30284
30479
  return { paths: script, scriptOnly: `${receiptFile} is missing` };
30285
30480
  const parsed2 = parseReceipt(text2.toString("utf8"), receiptFile);
@@ -30295,7 +30490,7 @@ async function flowFiles(root, file, kept) {
30295
30490
  const screens = [];
30296
30491
  if (receipt.screensDir !== null) {
30297
30492
  const dir = `${RECEIPT_DIR}/${receipt.screensDir}`;
30298
- const names = await orMissing(readdir10(join50(root, dir)));
30493
+ const names = await orMissing(readdir10(join51(root, dir)));
30299
30494
  if (names === null)
30300
30495
  return { paths: script, scriptOnly: `${dir} is missing` };
30301
30496
  screens.push(...names.sort().map((n) => `${dir}/${n}`));
@@ -30305,7 +30500,7 @@ async function flowFiles(root, file, kept) {
30305
30500
  ...kept.report === null ? [] : [kept.report]
30306
30501
  ];
30307
30502
  for (const o of outputs) {
30308
- if (await orMissing(access4(join50(root, o))) === null)
30503
+ if (await orMissing(access4(join51(root, o))) === null)
30309
30504
  return { paths: script, scriptOnly: `${o} is missing` };
30310
30505
  }
30311
30506
  return {
@@ -30392,7 +30587,7 @@ async function makePlan(root, choices, deps, values) {
30392
30587
  text: serializeApp(choices.app)
30393
30588
  };
30394
30589
  } else {
30395
- const raw = await readOrNull(join50(root, APP_FILE));
30590
+ const raw = await readOrNull(join51(root, APP_FILE));
30396
30591
  if (raw !== null) {
30397
30592
  const parsed2 = parseApp(raw.toString("utf8"), APP_FILE);
30398
30593
  if (!parsed2.ok)
@@ -30406,7 +30601,7 @@ async function makePlan(root, choices, deps, values) {
30406
30601
  text: raw.toString("utf8")
30407
30602
  };
30408
30603
  } else if (deployment === null) {
30409
- const origin = originOf3(flows[0]?.kept.script.target);
30604
+ const origin = originOf4(flows[0]?.kept.script.target);
30410
30605
  const proposal = await deps.detectApp(root, origin);
30411
30606
  if ("none" in proposal)
30412
30607
  return stop(
@@ -30427,7 +30622,7 @@ async function makePlan(root, choices, deps, values) {
30427
30622
  if (!parsed2.ok)
30428
30623
  return stop(
30429
30624
  "appInvalid",
30430
- `${parsed2.detail} (${parsed2.field}); write ${APP_FILE} with it fixed, then run setup again`
30625
+ `${parsed2.detail}; write ${APP_FILE} with it fixed, then run setup again`
30431
30626
  );
30432
30627
  app = {
30433
30628
  spec: parsed2.app,
@@ -30552,6 +30747,35 @@ async function makePlan(root, choices, deps, values) {
30552
30747
  }
30553
30748
  }
30554
30749
  }
30750
+ const accounts = await readFile28(join51(root, ACCOUNTS_FILE), "utf8").catch(
30751
+ () => null
30752
+ );
30753
+ if (accounts !== null) {
30754
+ for (const ref of ["HEAD", base]) {
30755
+ if (await shown(deps.git, root, ref, ACCOUNTS_FILE) !== accounts) {
30756
+ files.push(ACCOUNTS_FILE);
30757
+ break;
30758
+ }
30759
+ }
30760
+ }
30761
+ let gitignore = null;
30762
+ const ignores = await readFile28(join51(root, ".gitignore"), "utf8").catch(
30763
+ () => null
30764
+ );
30765
+ if (ignores !== null && await ignoresSecrets(ignores)) {
30766
+ const read2 = await deps.git(["show", `${base}:.gitignore`], root);
30767
+ const missing2 = read2.code !== 0 && /does not exist|exists on disk, but not in/.test(read2.stderr);
30768
+ if (read2.code !== 0 && !missing2)
30769
+ return stop(
30770
+ "filesUnreadable",
30771
+ `.gitignore on ${base} could not be read (${read2.stderr.trim() || `git show exited with code ${read2.code}`}), so nothing was assumed; fetch ${base}, then run setup again`
30772
+ );
30773
+ const onBase = read2.code === 0 ? read2.stdout : "";
30774
+ if (!await ignoresSecrets(onBase)) {
30775
+ gitignore = withLines(onBase, SECRETS_IGNORE);
30776
+ files.push(".gitignore");
30777
+ }
30778
+ }
30555
30779
  const scriptOnly = [];
30556
30780
  for (const { file, kept } of flows) {
30557
30781
  if (onDefault.has(file)) continue;
@@ -30560,7 +30784,7 @@ async function makePlan(root, choices, deps, values) {
30560
30784
  if (got.scriptOnly !== null)
30561
30785
  scriptOnly.push({ flow: kept.name, why: got.scriptOnly });
30562
30786
  }
30563
- const texts = await fileTexts(root, files, workflow, app);
30787
+ const texts = await fileTexts(root, files, workflow, app, gitignore);
30564
30788
  if ("failed" in texts) return stop("filesUnreadable", texts.failed);
30565
30789
  deps.log(
30566
30790
  deployment !== null ? `Checking from a clean checkout against the ${deployment.environment} deployment at ${deployment.url}` : `Checking from a clean checkout: ${checkWords(app?.spec)}`
@@ -30609,7 +30833,7 @@ async function makePlan(root, choices, deps, values) {
30609
30833
  enumerable: false
30610
30834
  });
30611
30835
  }
30612
- function originOf3(target) {
30836
+ function originOf4(target) {
30613
30837
  try {
30614
30838
  return new URL(String(target)).origin;
30615
30839
  } catch {
@@ -30624,15 +30848,17 @@ function checkWords(a) {
30624
30848
  ...services.length > 0 ? [`services ${list(services)} through Docker`] : []
30625
30849
  ].join("; ");
30626
30850
  }
30627
- async function fileTexts(root, paths, workflow, app) {
30851
+ async function fileTexts(root, paths, workflow, app, gitignore) {
30628
30852
  const files = [];
30629
30853
  for (const path of paths) {
30630
30854
  if (path === CI_WORKFLOW_PATH) files.push({ path, text: workflow });
30855
+ else if (path === ".gitignore" && gitignore !== null)
30856
+ files.push({ path, text: gitignore, appendToBase: SECRETS_IGNORE });
30631
30857
  else if (path === APP_FILE && app !== null)
30632
30858
  files.push({ path, text: app.text });
30633
30859
  else {
30634
30860
  try {
30635
- files.push({ path, text: await readFile27(join50(root, path)) });
30861
+ files.push({ path, text: await readFile28(join51(root, path)) });
30636
30862
  } catch (e) {
30637
30863
  return {
30638
30864
  failed: `${path} could not be read (${messageOf9(e)}), so nothing was done; check it is there, then run setup again`
@@ -30659,7 +30885,8 @@ function shownFiles(files) {
30659
30885
  }
30660
30886
  return out;
30661
30887
  }
30662
- function planLines(p) {
30888
+ var BY_HAND2 = "Run it any time from the repository's Actions tab (Demoman \u2192 Run workflow).";
30889
+ function planSaid(p) {
30663
30890
  const offer = p.offers.find(
30664
30891
  (o) => JSON.stringify(o.trigger) === JSON.stringify(p.trigger)
30665
30892
  );
@@ -30667,14 +30894,30 @@ function planLines(p) {
30667
30894
  const src = p.app?.source;
30668
30895
  const source = src === void 0 ? null : "file" in src ? src.file : `the ${src.kind}`;
30669
30896
  const c = p.check;
30670
- return [
30671
- `Records the repo flows ${label}.`,
30672
- p.route === "pr" ? "Delivers what changed as a pull request." : `Delivers what changed as a commit on ${p.repo.defaultBranch}.`,
30673
- p.deployment !== null ? `Starts no app: records the newest successful ${p.deployment.environment} deployment (now ${p.deployment.url}).` : p.app === null ? "Starts no app: records the deployed one." : `Starts the app with ${p.app.spec.start} at ${p.app.spec.url} (from ${source}).`,
30674
- "passed" in c ? `Checked from a clean checkout: ${c.flow} recorded in ${c.recordSeconds} s${c.appSeconds > 0 ? ` (the app started in ${c.appSeconds} s)` : ""}.` : `Not checked locally: ${c.skipped}.`,
30675
- ...p.offBase === null ? [] : [
30897
+ return {
30898
+ label,
30899
+ trigger: `Records the repo flows ${label}.`,
30900
+ byHand: runsByHand(p.trigger) ? [BY_HAND2] : [],
30901
+ delivery: p.route === "pr" ? "Delivers what changed as a pull request." : `Delivers what changed as a commit on ${p.repo.defaultBranch}.`,
30902
+ app: p.deployment !== null ? `Starts no app: records the newest successful ${p.deployment.environment} deployment (now ${p.deployment.url}).` : p.app === null ? "Starts no app: records the deployed one." : `Starts the app with ${p.app.spec.start} at ${p.app.spec.url} (from ${source}).`,
30903
+ check: "passed" in c ? `Checked from a clean checkout: ${c.flow} recorded in ${c.recordSeconds} s${c.appSeconds > 0 ? ` (the app started in ${c.appSeconds} s)` : ""}.` : `Not checked locally: ${c.skipped}.`,
30904
+ offBase: p.offBase === null ? [] : [
30676
30905
  `The check ran on HEAD (${p.offBase.head.slice(0, 7)}); the pull request is built on ${p.repo.defaultBranch} (${p.offBase.base.slice(0, 7)}), so its first run checks it there.`
30677
30906
  ],
30907
+ scriptOnly: p.scriptOnly.map(
30908
+ (s) => `${s.flow}: the script alone (${s.why}); the first run delivers it as new.`
30909
+ )
30910
+ };
30911
+ }
30912
+ function planLines(p) {
30913
+ const said2 = planSaid(p);
30914
+ return [
30915
+ said2.trigger,
30916
+ ...said2.byHand,
30917
+ said2.delivery,
30918
+ said2.app,
30919
+ said2.check,
30920
+ ...said2.offBase,
30678
30921
  ...p.pushCost === null ? [] : [`Runner time: ${p.pushCost}.`],
30679
30922
  ...p.secrets.map(
30680
30923
  (s) => `Secret ${s.name}: ${{ set: "set on GitHub", replace: "replaced on GitHub", keep: "left as GitHub has it", missing: "missing" }[s.status]}.`
@@ -30682,11 +30925,42 @@ function planLines(p) {
30682
30925
  p.actionsSetting === "turnOn" ? `Turns on "Allow GitHub Actions to create and approve pull requests" for ${p.repo.slug}, if it is off.` : p.actionsSetting === "alreadyOn" ? "Pull requests from workflows are already allowed." : "Needs no Actions setting changed.",
30683
30926
  `Opens the pull request "${p.title}" from ${p.branch} into ${p.repo.defaultBranch} with:`,
30684
30927
  ...shownFiles(p.files).map((f) => ` ${f}`),
30685
- ...p.scriptOnly.map(
30686
- (s) => `${s.flow}: the script alone (${s.why}); the first run delivers it as new.`
30687
- )
30928
+ ...said2.scriptOnly
30688
30929
  ];
30689
30930
  }
30931
+ function prBody(p) {
30932
+ const said2 = planSaid(p);
30933
+ const delivers = p.route === "pr" ? "opens a pull request" : `commits to ${p.repo.defaultBranch}`;
30934
+ const secretWord = {
30935
+ set: "set on GitHub",
30936
+ replace: "replaced on GitHub",
30937
+ keep: "unchanged on GitHub",
30938
+ missing: "missing"
30939
+ };
30940
+ return [
30941
+ `Merging this sets up Demoman: it records the repo's flows ${said2.label} and ${delivers} when a video changes.`,
30942
+ "",
30943
+ "### What it does",
30944
+ ...[said2.trigger, ...said2.byHand, said2.delivery, said2.app].map(
30945
+ (l) => `- ${l}`
30946
+ ),
30947
+ "",
30948
+ "### Checked",
30949
+ said2.check,
30950
+ ...said2.offBase.map((l) => `
30951
+ ${l}`),
30952
+ "",
30953
+ "### Secrets",
30954
+ ...p.secrets.length === 0 ? ["None."] : p.secrets.map((s) => `- \`${s.name}\`: ${secretWord[s.status]}`),
30955
+ "",
30956
+ "### Files",
30957
+ "```",
30958
+ ...shownFiles(p.files),
30959
+ "```",
30960
+ ...said2.scriptOnly.length === 0 ? [] : ["", ...said2.scriptOnly.map((l) => `- ${l}`)],
30961
+ ""
30962
+ ].join("\n");
30963
+ }
30690
30964
  async function applyCiSetup(plan, deps, values) {
30691
30965
  const refused2 = routeRefusal(plan.trigger, plan.route);
30692
30966
  if (refused2 !== null) return stop("routeRefused", refused2);
@@ -30705,6 +30979,16 @@ async function applyCiSetup(plan, deps, values) {
30705
30979
  "this plan carries no checked files (it was copied or sent as JSON), so nothing was done; plan again, then apply that plan"
30706
30980
  );
30707
30981
  const { slug, defaultBranch } = plan.repo;
30982
+ let setting = null;
30983
+ if (plan.route === "pr") {
30984
+ setting = await deps.allowActionPullRequests(slug);
30985
+ if (setting.kind === "refused" || setting.kind === "unknown")
30986
+ return stop(
30987
+ setting.kind === "refused" ? "actionsRefused" : "actionsUnknown",
30988
+ `${setting.detail}. Secrets: nothing was set; the pull request was not opened`
30989
+ );
30990
+ }
30991
+ const settingSaid = setting === null ? "" : `; the Actions setting is ${setting.kind === "alreadyOn" ? "already on" : "turned on"}`;
30708
30992
  const toSet = /* @__PURE__ */ new Map();
30709
30993
  for (const s of plan.secrets) {
30710
30994
  const v = values.get(s.name);
@@ -30720,30 +31004,18 @@ async function applyCiSetup(plan, deps, values) {
30720
31004
  if (secrets.failed.length > 0)
30721
31005
  return stop(
30722
31006
  "secretRefused",
30723
- `GitHub refused ${secrets.failed.map((f) => `${f.name} (${f.said})`).join("; ")}; ${done}. Nothing else was done; fix it, then run setup again`
31007
+ `GitHub refused ${secrets.failed.map((f) => `${f.name} (${f.said})`).join("; ")}; ${done}${settingSaid}. Nothing else was done; fix it, then run setup again`
30724
31008
  );
30725
- let setting = null;
30726
- if (plan.route === "pr") {
30727
- setting = await deps.allowActionPullRequests(slug);
30728
- if (setting.kind === "refused" || setting.kind === "unknown")
30729
- return stop(
30730
- setting.kind === "refused" ? "actionsRefused" : "actionsUnknown",
30731
- `${setting.detail} (${setting.url}). Secrets ${done}; the pull request was not opened`
30732
- );
30733
- }
30734
31009
  const pr = await deps.openSetupPr({
30735
31010
  root: plan.root,
30736
31011
  slug,
30737
31012
  remote: plan.repo.remote,
30738
31013
  base: defaultBranch,
30739
31014
  files: contents,
30740
- body: ["Demoman's CI setup:", "", ...planLines(plan)].join("\n")
31015
+ body: prBody(plan)
30741
31016
  });
30742
31017
  if ("failed" in pr)
30743
- return stop(
30744
- "prFailed",
30745
- `${pr.detail}. Secrets ${done}${setting === null ? "" : `; the Actions setting is ${setting.kind === "alreadyOn" ? "already on" : "turned on"}`}`
30746
- );
31018
+ return stop("prFailed", `${pr.detail}. Secrets ${done}${settingSaid}`);
30747
31019
  deps.log(`Opened the setup pull request: ${pr.opened.url}`);
30748
31020
  const watched = await deps.watchSetupRun({
30749
31021
  slug,
@@ -30799,8 +31071,8 @@ function createCiTool(io) {
30799
31071
  detail: `${parsed2.detail}; fix app, then call ci again. Nothing was written`
30800
31072
  };
30801
31073
  app = parsed2.app;
30802
- await mkdir20(join51(root, ".demoman"), { recursive: true });
30803
- await writeFile19(join51(root, APP_FILE), serializeApp(app));
31074
+ await mkdir20(join52(root, ".demoman"), { recursive: true });
31075
+ await writeFile20(join52(root, APP_FILE), serializeApp(app));
30804
31076
  appFile = `wrote ${APP_FILE} in the working tree from app, uncommitted`;
30805
31077
  }
30806
31078
  const said2 = (x) => appFile === void 0 ? x : { ...x, appFile };
@@ -32191,7 +32463,7 @@ import {
32191
32463
  writeFileSync
32192
32464
  } from "node:fs";
32193
32465
  import { constants as constants4, homedir as homedir3 } from "node:os";
32194
- import { dirname as dirname13, isAbsolute as isAbsolute11, join as join52 } from "node:path";
32466
+ import { dirname as dirname13, isAbsolute as isAbsolute11, join as join53 } from "node:path";
32195
32467
  import {
32196
32468
  confirm,
32197
32469
  isCancel,
@@ -32298,7 +32570,7 @@ function linkTarget(path) {
32298
32570
  } catch {
32299
32571
  return at2;
32300
32572
  }
32301
- at2 = isAbsolute11(link) ? link : join52(dirname13(at2), link);
32573
+ at2 = isAbsolute11(link) ? link : join53(dirname13(at2), link);
32302
32574
  }
32303
32575
  return at2;
32304
32576
  }
@@ -32306,15 +32578,15 @@ function stableNodeBin(execPath, pathEnv, realpath6) {
32306
32578
  for (const dir of pathEnv.split(":")) {
32307
32579
  if (dir === "" || dir.includes("/fnm_multishells/")) continue;
32308
32580
  try {
32309
- realpath6(join52(dir, "npx"));
32310
- if (realpath6(join52(dir, "node")) === execPath) return dir;
32581
+ realpath6(join53(dir, "npx"));
32582
+ if (realpath6(join53(dir, "node")) === execPath) return dir;
32311
32583
  } catch {
32312
32584
  }
32313
32585
  }
32314
32586
  return dirname13(execPath);
32315
32587
  }
32316
32588
  function readSkill(distDir) {
32317
- const path = join52(distDir, "skills", "record-demo", "SKILL.md");
32589
+ const path = join53(distDir, "skills", "record-demo", "SKILL.md");
32318
32590
  const read2 = readTextFile(path);
32319
32591
  if ("missing" in read2) return { error: `${path} is missing` };
32320
32592
  if ("error" in read2) return read2;
@@ -32327,14 +32599,14 @@ function claudePaths(home, configDir, platform = process.platform) {
32327
32599
  const managed = platform === "linux" ? CLAUDE_MANAGED_SETTINGS_LINUX : CLAUDE_MANAGED_SETTINGS;
32328
32600
  if (configDir === void 0 || configDir === "") {
32329
32601
  return {
32330
- settings: join52(home, ".claude", "settings.json"),
32331
- config: join52(home, ".claude.json"),
32602
+ settings: join53(home, ".claude", "settings.json"),
32603
+ config: join53(home, ".claude.json"),
32332
32604
  managed
32333
32605
  };
32334
32606
  }
32335
32607
  return {
32336
- settings: join52(configDir, "settings.json"),
32337
- config: join52(configDir, ".claude.json"),
32608
+ settings: join53(configDir, "settings.json"),
32609
+ config: join53(configDir, ".claude.json"),
32338
32610
  managed
32339
32611
  };
32340
32612
  }
@@ -32409,7 +32681,7 @@ function realSetupDeps(version, distDir, io = {
32409
32681
  chromiumDeps: chromiumDeps(),
32410
32682
  browserLaunches,
32411
32683
  home,
32412
- codexHome: process.env.CODEX_HOME || join52(home, ".codex"),
32684
+ codexHome: process.env.CODEX_HOME || join53(home, ".codex"),
32413
32685
  env: process.env,
32414
32686
  claude: claudePaths(home, process.env.CLAUDE_CONFIG_DIR),
32415
32687
  nodeBin: stableNodeBin(
@@ -32548,7 +32820,7 @@ function parseStudioArgs(args2) {
32548
32820
 
32549
32821
  // src/studio-ci.ts
32550
32822
  import { randomUUID as randomUUID15 } from "node:crypto";
32551
- import { readFile as readFile28 } from "node:fs/promises";
32823
+ import { readFile as readFile29 } from "node:fs/promises";
32552
32824
  function createStudioCi(io) {
32553
32825
  const plan = io.planCiSetup ?? planCiSetup;
32554
32826
  const apply = io.applyCiSetup ?? applyCiSetup;
@@ -32636,7 +32908,7 @@ function createStudioCi(io) {
32636
32908
  files: await Promise.all(
32637
32909
  a.files.map(async ({ path, real }) => ({
32638
32910
  path,
32639
- text: new Uint8Array(await readFile28(real))
32911
+ text: new Uint8Array(await readFile29(real))
32640
32912
  }))
32641
32913
  ),
32642
32914
  body: a.body,
@@ -32679,14 +32951,25 @@ function stopWire(s, values) {
32679
32951
  }
32680
32952
 
32681
32953
  // src/studio-project.ts
32954
+ function workingFolder(cwd = () => process.cwd()) {
32955
+ try {
32956
+ return { dir: cwd() };
32957
+ } catch (e) {
32958
+ return {
32959
+ none: `this server's working folder no longer exists (${e instanceof Error ? e.message : String(e)})`
32960
+ };
32961
+ }
32962
+ }
32682
32963
  async function callerProject(cwd, git = execGit) {
32683
- const repo = await readRepo(cwd, git);
32964
+ const where2 = typeof cwd === "string" ? { dir: cwd } : workingFolder(cwd);
32965
+ if ("none" in where2) return { why: where2.none };
32966
+ const repo = await readRepo(where2.dir, git);
32684
32967
  if (repo.ok) return { key: repo.repo.key };
32685
32968
  return /not a git repository/i.test(repo.none) ? {} : { why: repo.none };
32686
32969
  }
32687
32970
 
32688
32971
  // src/version.ts
32689
- var VERSION = "0.9.0";
32972
+ var VERSION = "0.9.1";
32690
32973
 
32691
32974
  // src/main.ts
32692
32975
  var log = (line2) => {
@@ -32699,11 +32982,11 @@ var WALLPAPERS_DIR = fileURLToPath7(
32699
32982
  var REINSTALL = `reinstall with \`npx --prefix ~/ ${PACKAGE_NAME}@${VERSION} setup\``;
32700
32983
  function requirePageBundles(pages, say) {
32701
32984
  const missing = PAGE_ENTRIES.filter(
32702
- (n) => !existsSync5(join53(pages, `${n}.js`))
32985
+ (n) => !existsSync5(join54(pages, `${n}.js`))
32703
32986
  );
32704
32987
  if (missing.length > 0) {
32705
32988
  say(
32706
- `this install is missing ${missing.map((n) => join53(pages, `${n}.js`)).join(", ")} \u2014 ${REINSTALL}`
32989
+ `this install is missing ${missing.map((n) => join54(pages, `${n}.js`)).join(", ")} \u2014 ${REINSTALL}`
32707
32990
  );
32708
32991
  process.exit(1);
32709
32992
  }
@@ -32771,13 +33054,13 @@ async function mcp(args2) {
32771
33054
  process.exit(2);
32772
33055
  }
32773
33056
  const here = fileURLToPath7(new URL(".", import.meta.url));
32774
- const pages = join53(here, "page");
33057
+ const pages = join54(here, "page");
32775
33058
  requirePageBundles(pages, (line2) => log(line2));
32776
33059
  let recipe;
32777
33060
  try {
32778
- recipe = readFileSync2(join53(here, "recipe.md"), "utf8");
33061
+ recipe = readFileSync2(join54(here, "recipe.md"), "utf8");
32779
33062
  if (recipe.trim() === "") {
32780
- throw new Error(`${join53(here, "recipe.md")} is empty`);
33063
+ throw new Error(`${join54(here, "recipe.md")} is empty`);
32781
33064
  }
32782
33065
  } catch (error) {
32783
33066
  log(
@@ -32821,7 +33104,7 @@ async function mcp(args2) {
32821
33104
  log
32822
33105
  }),
32823
33106
  studio: async (a) => {
32824
- const { key, why: why2 } = await callerProject(process.cwd());
33107
+ const { key, why: why2 } = await callerProject(() => process.cwd());
32825
33108
  if (why2 !== void 0) log(`the Studio opens without a project: ${why2}`);
32826
33109
  return openStudio({
32827
33110
  home: demomanHome(),
@@ -32864,7 +33147,7 @@ ${USAGE}`);
32864
33147
  process.exit(0);
32865
33148
  }
32866
33149
  if (parsed2.kind === "open") {
32867
- const { key, why: why2 } = await callerProject(process.cwd());
33150
+ const { key, why: why2 } = await callerProject(() => process.cwd());
32868
33151
  const answer2 = await openStudio({
32869
33152
  home,
32870
33153
  ...key === void 0 ? {} : { project: key },
@@ -32885,17 +33168,17 @@ ${USAGE}`);
32885
33168
  process.exit(1);
32886
33169
  }
32887
33170
  const here = fileURLToPath7(new URL(".", import.meta.url));
32888
- requirePageBundles(join53(here, "page"), (line2) => log(line2));
32889
- const pagesDir = join53(here, "studio");
32890
- if (!existsSync5(join53(pagesDir, "library.html"))) {
33171
+ requirePageBundles(join54(here, "page"), (line2) => log(line2));
33172
+ const pagesDir = join54(here, "studio");
33173
+ if (!existsSync5(join54(pagesDir, "library.html"))) {
32891
33174
  log(
32892
- `this install is missing ${join53(pagesDir, "library.html")} \u2014 ${REINSTALL}`
33175
+ `this install is missing ${join54(pagesDir, "library.html")} \u2014 ${REINSTALL}`
32893
33176
  );
32894
33177
  process.exit(1);
32895
33178
  }
32896
33179
  await runServe({
32897
33180
  home,
32898
- outDir: join53(homedir4(), "Downloads"),
33181
+ outDir: join54(homedir4(), "Downloads"),
32899
33182
  pagesDir,
32900
33183
  version: VERSION,
32901
33184
  executablePath: fullChromiumPath(),
@@ -32956,7 +33239,7 @@ ${USAGE}`);
32956
33239
  const root = repo.repo.root;
32957
33240
  const inRoot = (p) => relative6(root, resolve8(p));
32958
33241
  requirePageBundles(
32959
- join53(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33242
+ join54(fileURLToPath7(new URL(".", import.meta.url)), "page"),
32960
33243
  (line2) => fail(line2)
32961
33244
  );
32962
33245
  const answer2 = await keepInRepo(
@@ -33016,7 +33299,7 @@ async function keepInRepo(root, args2, log2) {
33016
33299
  home,
33017
33300
  wallpapersDir: WALLPAPERS_DIR,
33018
33301
  // Each output renders into a temp folder of keep's own.
33019
- outDir: tmpdir7(),
33302
+ outDir: tmpdir8(),
33020
33303
  log: log2
33021
33304
  }
33022
33305
  }
@@ -33032,7 +33315,9 @@ async function keepInRepo(root, args2, log2) {
33032
33315
  }
33033
33316
  function repoDoors() {
33034
33317
  const rootOf = async (project) => {
33035
- const r = await readRepo(project ?? process.cwd(), execGit);
33318
+ const where2 = project === void 0 ? workingFolder() : { dir: project };
33319
+ if ("none" in where2) return { none: where2.none };
33320
+ const r = await readRepo(where2.dir, execGit);
33036
33321
  return r.ok ? { root: r.repo.root } : { none: r.none };
33037
33322
  };
33038
33323
  const logged = (progress) => (l) => {
@@ -33182,7 +33467,7 @@ function ciDeps(root, progress) {
33182
33467
  };
33183
33468
  }
33184
33469
  function checkRefresh(say) {
33185
- return async (args2, env) => {
33470
+ return async (args2, env, beforeFlow) => {
33186
33471
  const session = createBrowserSession({
33187
33472
  headless: true,
33188
33473
  executablePath: fullChromiumPath(),
@@ -33190,7 +33475,10 @@ function checkRefresh(say) {
33190
33475
  log: say
33191
33476
  });
33192
33477
  try {
33193
- return await refreshKept(args2, keptRefreshDeps(session, env, say));
33478
+ return await refreshKept(args2, {
33479
+ ...keptRefreshDeps(session, env, say),
33480
+ ...beforeFlow === void 0 ? {} : { beforeFlow }
33481
+ });
33194
33482
  } finally {
33195
33483
  await session.close().catch(
33196
33484
  (error) => say(`the browser would not close (${String(error)})`)
@@ -33228,7 +33516,7 @@ ${USAGE}`);
33228
33516
  );
33229
33517
  }
33230
33518
  requirePageBundles(
33231
- join53(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33519
+ join54(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33232
33520
  (line2) => fail(line2)
33233
33521
  );
33234
33522
  const session = createBrowserSession({
@@ -33251,7 +33539,7 @@ ${USAGE}`);
33251
33539
  ci: process.env.CI === "true",
33252
33540
  log
33253
33541
  },
33254
- () => refreshKept(
33542
+ (reset) => refreshKept(
33255
33543
  {
33256
33544
  repoRoot: repo.repo.root,
33257
33545
  ...only.length > 0 ? { only } : {},
@@ -33260,7 +33548,7 @@ ${USAGE}`);
33260
33548
  ...previous === void 0 ? {} : { previous },
33261
33549
  library: process.env.CI === "true" ? "throwaway" : "local"
33262
33550
  },
33263
- keptRefreshDeps(session, process.env, log)
33551
+ { ...keptRefreshDeps(session, process.env, log), beforeFlow: reset }
33264
33552
  )
33265
33553
  );
33266
33554
  if (!around.ok) {
@@ -33377,7 +33665,7 @@ switch (command) {
33377
33665
  case "setup": {
33378
33666
  if (rest.includes("--ci")) {
33379
33667
  requirePageBundles(
33380
- join53(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33668
+ join54(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33381
33669
  (line2) => log(line2)
33382
33670
  );
33383
33671
  const say = (l) => void process.stdout.write(`${l}
@@ -33393,7 +33681,7 @@ switch (command) {
33393
33681
  return r.ok ? { root: r.repo.root } : { none: r.none };
33394
33682
  },
33395
33683
  deps: (root) => ciDeps(root, say),
33396
- exists: (p) => existsSync5(join53(ciRoot, p)),
33684
+ exists: (p) => existsSync5(join54(ciRoot, p)),
33397
33685
  onInterrupt: (stop2) => {
33398
33686
  process.on("SIGINT", stop2);
33399
33687
  return () => void process.off("SIGINT", stop2);
@@ -33456,7 +33744,7 @@ ${USAGE}`
33456
33744
  process.exit(2);
33457
33745
  }
33458
33746
  requirePageBundles(
33459
- join53(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33747
+ join54(fileURLToPath7(new URL(".", import.meta.url)), "page"),
33460
33748
  (line2) => process.stderr.write(`demoman signin: ${line2}
33461
33749
  `)
33462
33750
  );