@staff0rd/assist 0.1058.3 → 0.1059.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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1058.3",
9
+ version: "0.1059.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -4284,9 +4284,18 @@ async function postItem(req, res) {
4284
4284
  respondJson(res, 201, { id: formatItemId(id), name });
4285
4285
  }
4286
4286
 
4287
- // src/commands/backlog/web/postNoteDraft.ts
4287
+ // src/commands/backlog/web/postNoteSession.ts
4288
4288
  import { z as z9 } from "zod";
4289
4289
 
4290
+ // src/shared/githubAssistModes.ts
4291
+ var githubAssistModes = {
4292
+ draft: ["draft", "--once"],
4293
+ bug: ["bug", "--once"]
4294
+ };
4295
+ function isGithubAssistMode(mode) {
4296
+ return typeof mode === "string" && Object.hasOwn(githubAssistModes, mode);
4297
+ }
4298
+
4290
4299
  // src/commands/sessions/daemon/readSocketLines.ts
4291
4300
  function readSocketLines(socket, onLine) {
4292
4301
  let buffer = "";
@@ -4352,6 +4361,25 @@ function requestAssistSession(assistArgs, cwd, options2) {
4352
4361
  });
4353
4362
  }
4354
4363
 
4364
+ // src/commands/sessions/shared/requestClaudeSession.ts
4365
+ function requestClaudeSession(prompt, cwd, options2) {
4366
+ return requestSession({
4367
+ type: "create",
4368
+ prompt,
4369
+ cwd,
4370
+ inPlace: options2?.inPlace === true,
4371
+ launchedFrom: options2?.launchedFrom ?? process.env.ASSIST_SESSION_ID
4372
+ });
4373
+ }
4374
+
4375
+ // src/commands/sessions/web/fromGithub/launchPlannedSession.ts
4376
+ function launchPlannedSession(plan2) {
4377
+ return plan2.mode ? requestAssistSession(
4378
+ [...githubAssistModes[plan2.mode], plan2.prompt],
4379
+ plan2.cwd
4380
+ ) : requestClaudeSession(plan2.prompt, plan2.cwd);
4381
+ }
4382
+
4355
4383
  // src/commands/sessions/web/getCwdParam.ts
4356
4384
  function getCwdParam(req, res) {
4357
4385
  const url = new URL(req.url ?? "/", "http://localhost");
@@ -4363,23 +4391,30 @@ function getCwdParam(req, res) {
4363
4391
  return cwd;
4364
4392
  }
4365
4393
 
4366
- // src/commands/backlog/web/postNoteDraft.ts
4367
- var postNoteDraftSchema = z9.object({ text: z9.string().trim().min(1) });
4368
- async function postNoteDraft(req, res) {
4394
+ // src/commands/backlog/web/postNoteSession.ts
4395
+ var postNoteSessionSchema = z9.object({
4396
+ text: z9.string().trim().min(1),
4397
+ mode: z9.enum(["draft", "bug", "prompt"])
4398
+ });
4399
+ async function postNoteSession(req, res) {
4369
4400
  const cwd = getCwdParam(req, res);
4370
4401
  if (!cwd) return;
4371
- const parsed = postNoteDraftSchema.safeParse(
4402
+ const parsed = postNoteSessionSchema.safeParse(
4372
4403
  await readJsonBody(req).catch(() => void 0)
4373
4404
  );
4374
4405
  if (!parsed.success) {
4375
- respondJson(res, 400, { error: "Body must be { text: string }" });
4406
+ respondJson(res, 400, {
4407
+ error: 'Body must be { text: string, mode: "draft" | "bug" | "prompt" }'
4408
+ });
4376
4409
  return;
4377
4410
  }
4411
+ const { text: text20, mode } = parsed.data;
4378
4412
  try {
4379
- const sessionId2 = await requestAssistSession(
4380
- ["draft", "--once", parsed.data.text],
4381
- cwd
4382
- );
4413
+ const sessionId2 = await launchPlannedSession({
4414
+ cwd,
4415
+ prompt: text20,
4416
+ mode: mode === "prompt" ? void 0 : mode
4417
+ });
4383
4418
  respondJson(res, 201, { sessionId: sessionId2 });
4384
4419
  } catch (error) {
4385
4420
  respondJson(res, 500, {
@@ -5665,34 +5700,6 @@ function reviewFromGithub(req, res) {
5665
5700
  );
5666
5701
  }
5667
5702
 
5668
- // src/shared/githubAssistModes.ts
5669
- var githubAssistModes = {
5670
- draft: ["draft", "--once"],
5671
- bug: ["bug", "--once"]
5672
- };
5673
- function isGithubAssistMode(mode) {
5674
- return typeof mode === "string" && Object.hasOwn(githubAssistModes, mode);
5675
- }
5676
-
5677
- // src/commands/sessions/shared/requestClaudeSession.ts
5678
- function requestClaudeSession(prompt, cwd, options2) {
5679
- return requestSession({
5680
- type: "create",
5681
- prompt,
5682
- cwd,
5683
- inPlace: options2?.inPlace === true,
5684
- launchedFrom: options2?.launchedFrom ?? process.env.ASSIST_SESSION_ID
5685
- });
5686
- }
5687
-
5688
- // src/commands/sessions/web/fromGithub/launchPlannedSession.ts
5689
- function launchPlannedSession(plan2) {
5690
- return plan2.mode ? requestAssistSession(
5691
- [...githubAssistModes[plan2.mode], plan2.prompt],
5692
- plan2.cwd
5693
- ) : requestClaudeSession(plan2.prompt, plan2.cwd);
5694
- }
5695
-
5696
5703
  // src/commands/sessions/web/fromGithub/linkPrompt.ts
5697
5704
  function linkPrompt(url, instructions) {
5698
5705
  const extra = typeof instructions === "string" ? instructions.trim() : "";
@@ -12972,6 +12979,12 @@ function unsetConfig(req, res) {
12972
12979
  });
12973
12980
  }
12974
12981
 
12982
+ // src/commands/watch/isBuildPending.ts
12983
+ import { existsSync as existsSync24 } from "fs";
12984
+
12985
+ // src/commands/watch/gitMarkerPath.ts
12986
+ import { resolve as resolve11 } from "path";
12987
+
12975
12988
  // src/commands/watch/resolveUpstream.ts
12976
12989
  import { execFileSync as execFileSync4 } from "child_process";
12977
12990
  function runGit3(args, cwd) {
@@ -13013,9 +13026,26 @@ function resolveUpstream(cwd) {
13013
13026
  }
13014
13027
  }
13015
13028
 
13016
- // src/commands/watch/changedPaths.ts
13017
- function changedPaths(from, cwd) {
13018
- return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
13029
+ // src/commands/watch/gitMarkerPath.ts
13030
+ function gitMarkerPath(name, cwd) {
13031
+ return resolve11(
13032
+ cwd ?? process.cwd(),
13033
+ runGit3(["rev-parse", "--git-path", name], cwd)
13034
+ );
13035
+ }
13036
+
13037
+ // src/commands/watch/buildPendingPath.ts
13038
+ function buildPendingPath(cwd) {
13039
+ return gitMarkerPath("assist-watch-build-pending", cwd);
13040
+ }
13041
+
13042
+ // src/commands/watch/isBuildPending.ts
13043
+ function isBuildPending(cwd) {
13044
+ try {
13045
+ return existsSync24(buildPendingPath(cwd));
13046
+ } catch {
13047
+ return false;
13048
+ }
13019
13049
  }
13020
13050
 
13021
13051
  // src/commands/watch/readBuiltVersion.ts
@@ -13095,13 +13125,13 @@ import { readFile as readFile2 } from "fs/promises";
13095
13125
  import { join as join30 } from "path";
13096
13126
 
13097
13127
  // src/commands/extension/extensionDir.ts
13098
- import { existsSync as existsSync25 } from "fs";
13128
+ import { existsSync as existsSync26 } from "fs";
13099
13129
  import { dirname as dirname14, join as join29 } from "path";
13100
13130
  import { fileURLToPath as fileURLToPath2 } from "url";
13101
13131
  var moduleDir = dirname14(fileURLToPath2(import.meta.url));
13102
13132
  function extensionDir() {
13103
13133
  const bundled = join29(moduleDir, "commands", "extension", "extension");
13104
- if (existsSync25(bundled)) return bundled;
13134
+ if (existsSync26(bundled)) return bundled;
13105
13135
  return join29(moduleDir, "..", "..", "..", "extension");
13106
13136
  }
13107
13137
 
@@ -13166,6 +13196,7 @@ function targetsSince(commit2, target, changedSince2) {
13166
13196
  return commit2 !== void 0 && restartTargets(changedSince2(commit2)).includes(target);
13167
13197
  }
13168
13198
  function pendingRestarts(input) {
13199
+ if (input.buildPending) return [];
13169
13200
  const { daemonVersion, built, changedSince: changedSince2 } = input;
13170
13201
  const daemon = daemonVersion !== void 0 && (built !== "unknown" && daemonVersion !== built || targetsSince(input.daemonStartCommit, "daemon", changedSince2));
13171
13202
  const web3 = targetsSince(input.webStartCommit, "webserver", changedSince2);
@@ -13191,12 +13222,12 @@ import { basename as basename10, join as join31 } from "path";
13191
13222
 
13192
13223
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
13193
13224
  import { realpathSync } from "fs";
13194
- import { resolve as resolve11 } from "path";
13225
+ import { resolve as resolve12 } from "path";
13195
13226
  function canonicalTreePath(path109) {
13196
13227
  try {
13197
13228
  return realpathSync(path109);
13198
13229
  } catch {
13199
- return resolve11(path109);
13230
+ return resolve12(path109);
13200
13231
  }
13201
13232
  }
13202
13233
 
@@ -13232,7 +13263,12 @@ var webStartCommit = {
13232
13263
  value: () => captured
13233
13264
  };
13234
13265
 
13235
- // src/commands/sessions/web/updates/updates.ts
13266
+ // src/commands/watch/changedPaths.ts
13267
+ function changedPaths(from, cwd) {
13268
+ return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
13269
+ }
13270
+
13271
+ // src/commands/sessions/web/updates/changedSince.ts
13236
13272
  function changedSince(installDir) {
13237
13273
  return (commit2) => {
13238
13274
  try {
@@ -13242,6 +13278,8 @@ function changedSince(installDir) {
13242
13278
  }
13243
13279
  };
13244
13280
  }
13281
+
13282
+ // src/commands/sessions/web/updates/updates.ts
13245
13283
  async function updates(_req, res) {
13246
13284
  const installDir = getInstallDir();
13247
13285
  const reply2 = await requestDaemonReply(
@@ -13249,16 +13287,19 @@ async function updates(_req, res) {
13249
13287
  "auto-update"
13250
13288
  );
13251
13289
  const built = readBuiltVersion(installDir);
13290
+ const buildPending = isBuildPending(installDir);
13252
13291
  const status2 = {
13253
13292
  nodeName: resolveNodeName(),
13254
13293
  installDir,
13255
13294
  running: reply2?.version ?? ASSIST_VERSION,
13256
13295
  built,
13296
+ buildPending,
13257
13297
  restart: pendingRestarts({
13258
13298
  daemonVersion: reply2?.version,
13259
13299
  daemonStartCommit: reply2?.startCommit,
13260
13300
  webStartCommit: webStartCommit.value(),
13261
13301
  built,
13302
+ buildPending,
13262
13303
  changedSince: changedSince(installDir)
13263
13304
  }),
13264
13305
  daemonReachable: reply2 !== void 0,
@@ -13407,7 +13448,7 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
13407
13448
 
13408
13449
  // src/commands/sessions/web/formatWithOxfmt.ts
13409
13450
  import { execFile as execFile9 } from "child_process";
13410
- import { existsSync as existsSync26 } from "fs";
13451
+ import { existsSync as existsSync27 } from "fs";
13411
13452
  import { dirname as dirname15, join as join33 } from "path";
13412
13453
  import { promisify as promisify10 } from "util";
13413
13454
  var execFileAsync9 = promisify10(execFile9);
@@ -13416,7 +13457,7 @@ function findOxfmtScript(root2) {
13416
13457
  let dir = root2;
13417
13458
  for (; ; ) {
13418
13459
  const candidate = join33(dir, "node_modules", "oxfmt", "bin", "oxfmt");
13419
- if (existsSync26(candidate)) return candidate;
13460
+ if (existsSync27(candidate)) return candidate;
13420
13461
  const parent = dirname15(dir);
13421
13462
  if (parent === dir) return void 0;
13422
13463
  dir = parent;
@@ -13588,7 +13629,7 @@ var routes2 = {
13588
13629
  "GET /api/items": listItems,
13589
13630
  "POST /api/items": postItem,
13590
13631
  "GET /api/note-repos": getNoteRepos,
13591
- "POST /api/note-draft": postNoteDraft,
13632
+ "POST /api/note-session": postNoteSession,
13592
13633
  "GET /api/backlog/summary": getBacklogSummary,
13593
13634
  "GET /api/backlog/docs-refresh": getDocsRefresh,
13594
13635
  "POST /api/backlog/docs-refresh": postDocsRefresh,
@@ -13933,9 +13974,9 @@ function originForCwd(cwd) {
13933
13974
  }
13934
13975
 
13935
13976
  // src/commands/sessions/daemon/repoDirExists.ts
13936
- import { existsSync as existsSync27 } from "fs";
13977
+ import { existsSync as existsSync28 } from "fs";
13937
13978
  function repoDirExists(cwd) {
13938
- return existsSync27(cwd);
13979
+ return existsSync28(cwd);
13939
13980
  }
13940
13981
 
13941
13982
  // src/commands/sessions/daemon/worktree/git.ts
@@ -14132,7 +14173,7 @@ async function web(options2) {
14132
14173
 
14133
14174
  // src/commands/new/registerNew/newCli.ts
14134
14175
  import { execSync as execSync12 } from "child_process";
14135
- import { basename as basename11, resolve as resolve14 } from "path";
14176
+ import { basename as basename11, resolve as resolve15 } from "path";
14136
14177
 
14137
14178
  // src/commands/verify/init.ts
14138
14179
  import chalk30 from "chalk";
@@ -14438,11 +14479,11 @@ import * as path16 from "path";
14438
14479
  import chalk21 from "chalk";
14439
14480
 
14440
14481
  // src/commands/verify/addToKnipIgnoreBinaries.ts
14441
- import { existsSync as existsSync28, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
14482
+ import { existsSync as existsSync29, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
14442
14483
  import { join as join35 } from "path";
14443
14484
  import chalk20 from "chalk";
14444
14485
  function loadKnipConfig(knipJsonPath) {
14445
- if (existsSync28(knipJsonPath)) {
14486
+ if (existsSync29(knipJsonPath)) {
14446
14487
  return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
14447
14488
  }
14448
14489
  return { $schema: "https://unpkg.com/knip@5/schema.json" };
@@ -14495,7 +14536,7 @@ import * as path18 from "path";
14495
14536
  import chalk26 from "chalk";
14496
14537
 
14497
14538
  // src/commands/format/init.ts
14498
- import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
14539
+ import { existsSync as existsSync30, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
14499
14540
  import chalk24 from "chalk";
14500
14541
 
14501
14542
  // src/shared/promptConfirm.ts
@@ -14557,7 +14598,7 @@ async function init() {
14557
14598
  const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
14558
14599
  `;
14559
14600
  const configPath = ".oxfmtrc.json";
14560
- const oldContent = existsSync29(configPath) ? readFileSync13(configPath, "utf8") : "";
14601
+ const oldContent = existsSync30(configPath) ? readFileSync13(configPath, "utf8") : "";
14561
14602
  if (oldContent === newContent) {
14562
14603
  console.log(".oxfmtrc.json already has the baseline formatter config");
14563
14604
  return;
@@ -14580,15 +14621,15 @@ async function init() {
14580
14621
  }
14581
14622
 
14582
14623
  // src/commands/lint/init.ts
14583
- import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
14624
+ import { existsSync as existsSync33, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
14584
14625
  import chalk25 from "chalk";
14585
14626
 
14586
14627
  // src/shared/removeEslint.ts
14587
14628
  import { execSync as execSync7 } from "child_process";
14588
- import { existsSync as existsSync31, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
14629
+ import { existsSync as existsSync32, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
14589
14630
 
14590
14631
  // src/shared/removeEslint/removeEslintConfigFiles.ts
14591
- import { existsSync as existsSync30, unlinkSync as unlinkSync2 } from "fs";
14632
+ import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
14592
14633
  var ESLINT_CONFIG_FILES = [
14593
14634
  "eslint.config.js",
14594
14635
  "eslint.config.mjs",
@@ -14604,7 +14645,7 @@ var ESLINT_CONFIG_FILES = [
14604
14645
  function removeEslintConfigFiles() {
14605
14646
  let removed = false;
14606
14647
  for (const configFile of ESLINT_CONFIG_FILES) {
14607
- if (existsSync30(configFile)) {
14648
+ if (existsSync31(configFile)) {
14608
14649
  unlinkSync2(configFile);
14609
14650
  console.log(`Removed ${configFile}`);
14610
14651
  removed = true;
@@ -14626,7 +14667,7 @@ function removeEslint(options2 = {}) {
14626
14667
  }
14627
14668
  function removeEslintFromPackageJson(options2) {
14628
14669
  const packageJsonPath = "package.json";
14629
- if (!existsSync31(packageJsonPath)) {
14670
+ if (!existsSync32(packageJsonPath)) {
14630
14671
  return false;
14631
14672
  }
14632
14673
  const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
@@ -14693,7 +14734,7 @@ async function writeOxlintConfig() {
14693
14734
  const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
14694
14735
  `;
14695
14736
  const configPath = ".oxlintrc.json";
14696
- const oldContent = existsSync32(configPath) ? readFileSync15(configPath, "utf8") : "";
14737
+ const oldContent = existsSync33(configPath) ? readFileSync15(configPath, "utf8") : "";
14697
14738
  if (oldContent === newContent) {
14698
14739
  console.log(".oxlintrc.json already has the baseline linter config");
14699
14740
  return;
@@ -15459,7 +15500,7 @@ program.parse();
15459
15500
 
15460
15501
  // src/commands/new/registerNew/newCli.ts
15461
15502
  async function newCli() {
15462
- const name = basename11(resolve14("."));
15503
+ const name = basename11(resolve15("."));
15463
15504
  initGit();
15464
15505
  initPackageJson(name);
15465
15506
  console.log("Installing dependencies...");
@@ -15474,7 +15515,7 @@ async function newCli() {
15474
15515
 
15475
15516
  // src/commands/new/registerNew/newProject.ts
15476
15517
  import { execSync as execSync14 } from "child_process";
15477
- import { existsSync as existsSync37, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
15518
+ import { existsSync as existsSync38, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
15478
15519
 
15479
15520
  // src/commands/deploy/init.ts
15480
15521
  import { execSync as execSync13 } from "child_process";
@@ -15482,14 +15523,14 @@ import chalk36 from "chalk";
15482
15523
  import enquirer3 from "enquirer";
15483
15524
 
15484
15525
  // src/commands/deploy/init/updateWorkflow.ts
15485
- import { existsSync as existsSync36, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
15526
+ import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
15486
15527
  import { dirname as dirname24, join as join42 } from "path";
15487
15528
  import { fileURLToPath as fileURLToPath4 } from "url";
15488
15529
  import chalk35 from "chalk";
15489
15530
  var WORKFLOW_PATH = ".github/workflows/build.yml";
15490
15531
  var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
15491
15532
  function getExistingSiteId() {
15492
- if (!existsSync36(WORKFLOW_PATH)) {
15533
+ if (!existsSync37(WORKFLOW_PATH)) {
15493
15534
  return null;
15494
15535
  }
15495
15536
  const content = readFileSync18(WORKFLOW_PATH, "utf8");
@@ -15504,10 +15545,10 @@ function getTemplateContent(siteId) {
15504
15545
  async function updateWorkflow(siteId) {
15505
15546
  const newContent = getTemplateContent(siteId);
15506
15547
  const workflowDir = ".github/workflows";
15507
- if (!existsSync36(workflowDir)) {
15548
+ if (!existsSync37(workflowDir)) {
15508
15549
  mkdirSync9(workflowDir, { recursive: true });
15509
15550
  }
15510
- if (existsSync36(WORKFLOW_PATH)) {
15551
+ if (existsSync37(WORKFLOW_PATH)) {
15511
15552
  const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
15512
15553
  if (oldContent === newContent) {
15513
15554
  console.log(chalk35.green("build.yml is already up to date"));
@@ -15602,7 +15643,7 @@ async function newProject() {
15602
15643
  }
15603
15644
  function addViteBaseConfig() {
15604
15645
  const viteConfigPath = "vite.config.ts";
15605
- if (!existsSync37(viteConfigPath)) {
15646
+ if (!existsSync38(viteConfigPath)) {
15606
15647
  console.log("No vite.config.ts found, skipping base config");
15607
15648
  return;
15608
15649
  }
@@ -15808,14 +15849,14 @@ import { readdirSync as readdirSync7, readFileSync as readFileSync20 } from "fs"
15808
15849
  import { basename as basename12, join as join44 } from "path";
15809
15850
 
15810
15851
  // src/commands/advise/adviceDir.ts
15811
- import { existsSync as existsSync38 } from "fs";
15852
+ import { existsSync as existsSync39 } from "fs";
15812
15853
  import { dirname as dirname25, join as join43 } from "path";
15813
15854
  import { fileURLToPath as fileURLToPath5 } from "url";
15814
15855
  function adviceDir() {
15815
15856
  let current = dirname25(fileURLToPath5(import.meta.url));
15816
15857
  while (current !== dirname25(current)) {
15817
15858
  const candidate = join43(current, "claude", "advice");
15818
- if (existsSync38(candidate)) return candidate;
15859
+ if (existsSync39(candidate)) return candidate;
15819
15860
  current = dirname25(current);
15820
15861
  }
15821
15862
  throw new Error("Could not locate the shipped claude/advice directory");
@@ -15881,13 +15922,13 @@ function renderAdviceBody(fragment, context) {
15881
15922
  }
15882
15923
 
15883
15924
  // src/commands/advise/adviceConditions.ts
15884
- import { existsSync as existsSync39 } from "fs";
15925
+ import { existsSync as existsSync40 } from "fs";
15885
15926
  import { join as join45 } from "path";
15886
15927
  function repoFile(file, label) {
15887
15928
  return {
15888
15929
  whenMet: `the repo has ${label}`,
15889
15930
  whenUnmet: `the repo has no ${label}`,
15890
- matches: ({ rootDir }) => existsSync39(join45(rootDir, file))
15931
+ matches: ({ rootDir }) => existsSync40(join45(rootDir, file))
15891
15932
  };
15892
15933
  }
15893
15934
  var adviceConditions = {
@@ -16797,7 +16838,7 @@ function registerAskQuestion(program) {
16797
16838
 
16798
16839
  // src/commands/registerBackup.ts
16799
16840
  import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
16800
- import { join as join47, resolve as resolve15 } from "path";
16841
+ import { join as join47, resolve as resolve16 } from "path";
16801
16842
  import chalk41 from "chalk";
16802
16843
 
16803
16844
  // src/shared/db/recordBackup.ts
@@ -17132,7 +17173,7 @@ async function backup({ out }) {
17132
17173
  await mkdir3(dir, { recursive: true });
17133
17174
  const start2 = Date.now();
17134
17175
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
17135
- const filePath = resolve15(join47(dir, `backup-${timestamp9}.dump`));
17176
+ const filePath = resolve16(join47(dir, `backup-${timestamp9}.dump`));
17136
17177
  await exportBacklog(filePath);
17137
17178
  const { size } = await stat4(filePath);
17138
17179
  const durationMs = Date.now() - start2;
@@ -17643,7 +17684,7 @@ function registerAssociateJiraCommand(cmd) {
17643
17684
 
17644
17685
  // src/commands/backlog/cloneRepo.ts
17645
17686
  import { spawnSync as spawnSync4 } from "child_process";
17646
- import { existsSync as existsSync41 } from "fs";
17687
+ import { existsSync as existsSync42 } from "fs";
17647
17688
  import { mkdir as mkdir4 } from "fs/promises";
17648
17689
  import chalk48 from "chalk";
17649
17690
 
@@ -17679,7 +17720,7 @@ async function cloneRepo(originRaw) {
17679
17720
  if (!target) {
17680
17721
  return fail3(`Could not derive a repository name from "${origin}".`);
17681
17722
  }
17682
- if (existsSync41(target)) {
17723
+ if (existsSync42(target)) {
17683
17724
  return fail3(`Clone target already exists: ${target}`);
17684
17725
  }
17685
17726
  await mkdir4(baseDir, { recursive: true });
@@ -18907,8 +18948,8 @@ import chalk69 from "chalk";
18907
18948
 
18908
18949
  // src/shared/waitForIndexUnlocked.ts
18909
18950
  import { execSync as execSync18 } from "child_process";
18910
- import { existsSync as existsSync42 } from "fs";
18911
- import { resolve as resolve16 } from "path";
18951
+ import { existsSync as existsSync43 } from "fs";
18952
+ import { resolve as resolve17 } from "path";
18912
18953
  var POLL_MS2 = 200;
18913
18954
  function indexLockPath() {
18914
18955
  try {
@@ -18916,7 +18957,7 @@ function indexLockPath() {
18916
18957
  encoding: "utf8",
18917
18958
  stdio: ["ignore", "pipe", "ignore"]
18918
18959
  }).trim();
18919
- return rel ? resolve16(rel) : void 0;
18960
+ return rel ? resolve17(rel) : void 0;
18920
18961
  } catch {
18921
18962
  return void 0;
18922
18963
  }
@@ -18928,7 +18969,7 @@ function waitForIndexUnlocked(timeoutMs) {
18928
18969
  const lock2 = indexLockPath();
18929
18970
  if (!lock2) return true;
18930
18971
  const deadline = Date.now() + timeoutMs;
18931
- while (existsSync42(lock2)) {
18972
+ while (existsSync43(lock2)) {
18932
18973
  if (Date.now() >= deadline) return false;
18933
18974
  sleepSync(POLL_MS2);
18934
18975
  }
@@ -19044,7 +19085,7 @@ function hasLocalChanges() {
19044
19085
 
19045
19086
  // src/commands/backlog/acquireLock.ts
19046
19087
  import {
19047
- existsSync as existsSync43,
19088
+ existsSync as existsSync44,
19048
19089
  mkdirSync as mkdirSync11,
19049
19090
  readFileSync as readFileSync25,
19050
19091
  unlinkSync as unlinkSync4,
@@ -19102,7 +19143,7 @@ function isProcessAlive(pid) {
19102
19143
  }
19103
19144
  function foreignLockHolder(itemId2) {
19104
19145
  const lockPath = getLockPath(itemId2);
19105
- if (!existsSync43(lockPath)) return null;
19146
+ if (!existsSync44(lockPath)) return null;
19106
19147
  try {
19107
19148
  const lock2 = JSON.parse(readFileSync25(lockPath, "utf8"));
19108
19149
  if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
@@ -19587,7 +19628,7 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
19587
19628
  }
19588
19629
 
19589
19630
  // src/commands/backlog/consumePause.ts
19590
- import { existsSync as existsSync44, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
19631
+ import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
19591
19632
  import { homedir as homedir16 } from "os";
19592
19633
  import { join as join52 } from "path";
19593
19634
  function getControlsDir() {
@@ -19604,7 +19645,7 @@ function requestPause(itemId2) {
19604
19645
  );
19605
19646
  }
19606
19647
  function isPausePending(itemId2) {
19607
- return existsSync44(getPausePath(itemId2));
19648
+ return existsSync45(getPausePath(itemId2));
19608
19649
  }
19609
19650
  function clearPause(itemId2) {
19610
19651
  try {
@@ -19614,7 +19655,7 @@ function clearPause(itemId2) {
19614
19655
  }
19615
19656
  function consumePause(itemId2) {
19616
19657
  const pausePath = getPausePath(itemId2);
19617
- if (!existsSync44(pausePath)) return false;
19658
+ if (!existsSync45(pausePath)) return false;
19618
19659
  try {
19619
19660
  unlinkSync5(pausePath);
19620
19661
  } catch {
@@ -19866,13 +19907,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
19866
19907
  }
19867
19908
 
19868
19909
  // src/commands/backlog/watchForMarker.ts
19869
- import { existsSync as existsSync46, unwatchFile, watchFile } from "fs";
19910
+ import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
19870
19911
 
19871
19912
  // src/commands/backlog/readSignal.ts
19872
- import { existsSync as existsSync45, readFileSync as readFileSync26 } from "fs";
19913
+ import { existsSync as existsSync46, readFileSync as readFileSync26 } from "fs";
19873
19914
  function readSignal() {
19874
19915
  const path109 = getSignalPath();
19875
- if (!path109 || !existsSync45(path109)) return void 0;
19916
+ if (!path109 || !existsSync46(path109)) return void 0;
19876
19917
  try {
19877
19918
  return JSON.parse(readFileSync26(path109, "utf8"));
19878
19919
  } catch {
@@ -19886,7 +19927,7 @@ function watchForMarker(child, options2) {
19886
19927
  const statusPath = getSignalPath();
19887
19928
  if (!statusPath) return { killedOnMarker: () => killed };
19888
19929
  watchFile(statusPath, { interval: 1e3 }, () => {
19889
- if (!existsSync46(statusPath)) return;
19930
+ if (!existsSync47(statusPath)) return;
19890
19931
  const signal = readSignal();
19891
19932
  if (!signal) return;
19892
19933
  if (signal.event === "done" && !options2?.actOnDone) return;
@@ -19938,7 +19979,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
19938
19979
  }
19939
19980
 
19940
19981
  // src/commands/backlog/resolvePhaseResult.ts
19941
- import { existsSync as existsSync47, unlinkSync as unlinkSync6 } from "fs";
19982
+ import { existsSync as existsSync48, unlinkSync as unlinkSync6 } from "fs";
19942
19983
  import chalk77 from "chalk";
19943
19984
 
19944
19985
  // src/commands/backlog/handleIncompletePhase.ts
@@ -19960,7 +20001,7 @@ async function handleIncompletePhase() {
19960
20001
  // src/commands/backlog/resolvePhaseResult.ts
19961
20002
  function cleanupSignal() {
19962
20003
  const statusPath = getSignalPath();
19963
- if (statusPath && existsSync47(statusPath)) {
20004
+ if (statusPath && existsSync48(statusPath)) {
19964
20005
  unlinkSync6(statusPath);
19965
20006
  }
19966
20007
  }
@@ -19971,7 +20012,7 @@ async function isTerminalStatus(itemId2) {
19971
20012
  }
19972
20013
  async function resolvePhaseResult(phaseIndex, itemId2) {
19973
20014
  const signalPath = getSignalPath();
19974
- if (!signalPath || !existsSync47(signalPath)) {
20015
+ if (!signalPath || !existsSync48(signalPath)) {
19975
20016
  if (await isTerminalStatus(itemId2)) return { kind: "abort" };
19976
20017
  const action = await handleIncompletePhase();
19977
20018
  if (action === "abort") return { kind: "abort" };
@@ -22601,7 +22642,7 @@ function findTruncatedReadDenyRaw(rawCommand) {
22601
22642
  }
22602
22643
 
22603
22644
  // src/shared/isApprovedRead.ts
22604
- import { resolve as resolve18, sep as sep2 } from "path";
22645
+ import { resolve as resolve19, sep as sep2 } from "path";
22605
22646
 
22606
22647
  // src/shared/appliesFixStructure.ts
22607
22648
  var APPLY_RE = /^assist\s+github\s+issue\s+fix-structure\b.*\s--apply\b/;
@@ -22697,8 +22738,8 @@ function extractGraphqlQuery(args) {
22697
22738
  }
22698
22739
 
22699
22740
  // src/shared/loadCliReads.ts
22700
- import { existsSync as existsSync48, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
22701
- import { dirname as dirname29, resolve as resolve17 } from "path";
22741
+ import { existsSync as existsSync49, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
22742
+ import { dirname as dirname29, resolve as resolve18 } from "path";
22702
22743
  import { fileURLToPath as fileURLToPath6 } from "url";
22703
22744
  var __filename3 = fileURLToPath6(import.meta.url);
22704
22745
  var __dirname4 = dirname29(__filename3);
@@ -22706,20 +22747,20 @@ function packageRoot() {
22706
22747
  return __dirname4;
22707
22748
  }
22708
22749
  function readLines(path109) {
22709
- if (!existsSync48(path109)) return [];
22750
+ if (!existsSync49(path109)) return [];
22710
22751
  return readFileSync29(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
22711
22752
  }
22712
22753
  var cachedReads;
22713
22754
  var cachedWrites;
22714
22755
  function getCliReadsLines() {
22715
22756
  if (!cachedReads) {
22716
- cachedReads = readLines(resolve17(packageRoot(), "allowed.cli-reads"));
22757
+ cachedReads = readLines(resolve18(packageRoot(), "allowed.cli-reads"));
22717
22758
  }
22718
22759
  return cachedReads;
22719
22760
  }
22720
22761
  function getCliWritesLines() {
22721
22762
  if (!cachedWrites) {
22722
- cachedWrites = readLines(resolve17(packageRoot(), "allowed.cli-writes"));
22763
+ cachedWrites = readLines(resolve18(packageRoot(), "allowed.cli-writes"));
22723
22764
  }
22724
22765
  return cachedWrites;
22725
22766
  }
@@ -22728,7 +22769,7 @@ function loadCliReads() {
22728
22769
  }
22729
22770
  function saveCliReads(commands) {
22730
22771
  writeFileSync24(
22731
- resolve17(packageRoot(), "allowed.cli-reads"),
22772
+ resolve18(packageRoot(), "allowed.cli-reads"),
22732
22773
  `${commands.join("\n")}
22733
22774
  `
22734
22775
  );
@@ -22753,7 +22794,7 @@ function findCliWrite(command) {
22753
22794
  }
22754
22795
 
22755
22796
  // src/shared/readSettingsPerms.ts
22756
- import { existsSync as existsSync49, readFileSync as readFileSync30 } from "fs";
22797
+ import { existsSync as existsSync50, readFileSync as readFileSync30 } from "fs";
22757
22798
  import { homedir as homedir18 } from "os";
22758
22799
  import { join as join54 } from "path";
22759
22800
  function readSettingsPerms(key) {
@@ -22769,7 +22810,7 @@ function readSettingsPerms(key) {
22769
22810
  return entries;
22770
22811
  }
22771
22812
  function readPermissionArray(filePath, key) {
22772
- if (!existsSync49(filePath)) return [];
22813
+ if (!existsSync50(filePath)) return [];
22773
22814
  try {
22774
22815
  const data = JSON.parse(readFileSync30(filePath, "utf8"));
22775
22816
  const arr = data?.permissions?.[key];
@@ -22866,19 +22907,19 @@ function isCdToCwd(command) {
22866
22907
  const parts = command.split(/\s+/);
22867
22908
  if (parts[0] !== "cd" || parts.length > 2) return false;
22868
22909
  if (parts.length === 1) return false;
22869
- const resolved = resolve18(normalizeMsysPath(parts[1]));
22870
- return resolved === resolve18(process.cwd());
22910
+ const resolved = resolve19(normalizeMsysPath(parts[1]));
22911
+ return resolved === resolve19(process.cwd());
22871
22912
  }
22872
22913
  function isCdToReadAllowedDir(command) {
22873
22914
  const parts = command.split(/\s+/);
22874
22915
  if (parts[0] !== "cd" || parts.length !== 2) return void 0;
22875
- const target = resolve18(normalizeMsysPath(parts[1]));
22916
+ const target = resolve19(normalizeMsysPath(parts[1]));
22876
22917
  for (const entry of readSettingsPerms("allow")) {
22877
22918
  const m = entry.match(READ_RE);
22878
22919
  if (!m) continue;
22879
22920
  const base = globBaseDir(m[1]);
22880
22921
  if (!base) continue;
22881
- const resolved = resolve18(normalizeMsysPath(base));
22922
+ const resolved = resolve19(normalizeMsysPath(base));
22882
22923
  if (target === resolved || target.startsWith(resolved + sep2)) {
22883
22924
  return `cd to Read-allowed directory: ${entry}`;
22884
22925
  }
@@ -23002,7 +23043,7 @@ ${questionsJson}`
23002
23043
  }
23003
23044
 
23004
23045
  // src/commands/backlog/isDocsPath.ts
23005
- import { relative as relative6, resolve as resolve19 } from "path";
23046
+ import { relative as relative6, resolve as resolve20 } from "path";
23006
23047
  var LOCKED_DOCS_DIRS = ["docs/src/content/docs/", "docs/public/screenshots/"];
23007
23048
  var DOCS_LOCK_REASON = `Docs pages and screenshots (${LOCKED_DOCS_DIRS.join(", ")}) are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave them untouched and carry on with the phase. If this phase genuinely needs to change docs (e.g. the item is about the docs site itself), first confirm that with the user, then run \`assist docs unlock\` and wait for the user to confirm the PIN with \`assist docs confirm <pin>\` before retrying. The unlock applies to the current phase only.`;
23008
23049
  var SEP = String.raw`[/\\]`;
@@ -23018,7 +23059,7 @@ function isLockedDocsRelativePath(rel) {
23018
23059
  return LOCKED_DOCS_DIRS.some((dir) => normalized.startsWith(dir));
23019
23060
  }
23020
23061
  function isDocsPath(filePath, root2 = getProjectRoot()) {
23021
- return isLockedDocsRelativePath(relative6(root2, resolve19(root2, filePath)));
23062
+ return isLockedDocsRelativePath(relative6(root2, resolve20(root2, filePath)));
23022
23063
  }
23023
23064
  function mentionsDocsPath(command, root2 = getProjectRoot()) {
23024
23065
  if (RELATIVE_DOCS.test(command)) return true;
@@ -23042,7 +23083,7 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
23042
23083
 
23043
23084
  // src/commands/schema/isSchemaPath.ts
23044
23085
  import { readFileSync as readFileSync31 } from "fs";
23045
- import { relative as relative7, resolve as resolve20 } from "path";
23086
+ import { relative as relative7, resolve as resolve21 } from "path";
23046
23087
  var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase; otherwise it lasts for this Claude session.";
23047
23088
  var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
23048
23089
  var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
@@ -23057,13 +23098,13 @@ function isSchemaRelativePath(rel, root2, incomingContents2 = []) {
23057
23098
  const normalized = rel.replace(/\\/g, "/");
23058
23099
  if (FIXED_SCHEMA_PATH.test(normalized)) return true;
23059
23100
  if (!DB_MODULE.test(normalized)) return false;
23060
- return [...incomingContents2, readOrEmpty2(resolve20(root2, normalized))].some(
23101
+ return [...incomingContents2, readOrEmpty2(resolve21(root2, normalized))].some(
23061
23102
  (text20) => text20.includes("pgTable")
23062
23103
  );
23063
23104
  }
23064
23105
  function isSchemaPath(filePath, incomingContents2 = [], root2 = getProjectRoot()) {
23065
23106
  return isSchemaRelativePath(
23066
- relative7(root2, resolve20(root2, filePath)),
23107
+ relative7(root2, resolve21(root2, filePath)),
23067
23108
  root2,
23068
23109
  incomingContents2
23069
23110
  );
@@ -23204,7 +23245,7 @@ function tryParseInput(raw) {
23204
23245
  }
23205
23246
 
23206
23247
  // src/commands/schema/isSchemaLocked.ts
23207
- import { existsSync as existsSync50 } from "fs";
23248
+ import { existsSync as existsSync51 } from "fs";
23208
23249
 
23209
23250
  // src/commands/schema/getSchemaSessionApprovalPath.ts
23210
23251
  import { join as join57 } from "path";
@@ -23234,7 +23275,7 @@ function hasSessionApproval() {
23234
23275
  const claudeSessionId = process.env.CLAUDE_CODE_SESSION_ID;
23235
23276
  if (!claudeSessionId) return false;
23236
23277
  const path109 = getSchemaSessionApprovalPath(claudeSessionId);
23237
- return path109 !== void 0 && existsSync50(path109);
23278
+ return path109 !== void 0 && existsSync51(path109);
23238
23279
  }
23239
23280
  async function isSchemaLocked() {
23240
23281
  if (!process.env.CLAUDECODE) return false;
@@ -23323,7 +23364,7 @@ ${reasons.join("\n")}`);
23323
23364
  }
23324
23365
 
23325
23366
  // src/commands/permitCliReads.ts
23326
- import { existsSync as existsSync51, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync25 } from "fs";
23367
+ import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync25 } from "fs";
23327
23368
  import { homedir as homedir21 } from "os";
23328
23369
  import { join as join58 } from "path";
23329
23370
 
@@ -23592,7 +23633,7 @@ function logPath(cli) {
23592
23633
  }
23593
23634
  function readCache(cli) {
23594
23635
  const path109 = logPath(cli);
23595
- if (!existsSync51(path109)) return void 0;
23636
+ if (!existsSync52(path109)) return void 0;
23596
23637
  return readFileSync32(path109, "utf8");
23597
23638
  }
23598
23639
  function writeCache(cli, output) {
@@ -23728,7 +23769,7 @@ function registerCliHook(program) {
23728
23769
  }
23729
23770
 
23730
23771
  // src/commands/codeComment/codeCommentConfirm.ts
23731
- import { existsSync as existsSync53, readFileSync as readFileSync34, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
23772
+ import { existsSync as existsSync54, readFileSync as readFileSync34, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
23732
23773
  import chalk120 from "chalk";
23733
23774
 
23734
23775
  // src/shared/isHashCommentFile.ts
@@ -23783,10 +23824,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
23783
23824
  }
23784
23825
 
23785
23826
  // src/commands/codeComment/readPinState.ts
23786
- import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
23827
+ import { existsSync as existsSync53, readFileSync as readFileSync33 } from "fs";
23787
23828
  function readPinState(pin2) {
23788
23829
  const path109 = getPinStatePath(pin2);
23789
- if (!existsSync52(path109)) return void 0;
23830
+ if (!existsSync53(path109)) return void 0;
23790
23831
  try {
23791
23832
  const state = JSON.parse(readFileSync33(path109, "utf8"));
23792
23833
  if (state.pin !== pin2) return void 0;
@@ -23805,7 +23846,7 @@ function codeCommentConfirm(pin2) {
23805
23846
  process.exitCode = 1;
23806
23847
  return;
23807
23848
  }
23808
- if (!existsSync53(state.file)) {
23849
+ if (!existsSync54(state.file)) {
23809
23850
  console.error(chalk120.red(`Target file no longer exists: ${state.file}`));
23810
23851
  process.exitCode = 1;
23811
23852
  return;
@@ -26266,11 +26307,11 @@ async function copySignedXpi(xpi, dir) {
26266
26307
  }
26267
26308
 
26268
26309
  // src/commands/extension/findSignedXpi.ts
26269
- import { existsSync as existsSync54 } from "fs";
26310
+ import { existsSync as existsSync55 } from "fs";
26270
26311
  import { readdir } from "fs/promises";
26271
26312
  import { join as join62 } from "path";
26272
26313
  async function findSignedXpi(dir) {
26273
- if (!existsSync54(dir)) return null;
26314
+ if (!existsSync55(dir)) return null;
26274
26315
  const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
26275
26316
  return name ? join62(dir, name) : null;
26276
26317
  }
@@ -26294,11 +26335,11 @@ async function signedAddonInstallPath(xpi) {
26294
26335
  }
26295
26336
 
26296
26337
  // src/commands/extension/signPreflightProblem.ts
26297
- import { existsSync as existsSync55 } from "fs";
26338
+ import { existsSync as existsSync56 } from "fs";
26298
26339
  import { join as join63 } from "path";
26299
26340
  var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
26300
26341
  function signPreflightProblem(source) {
26301
- if (!existsSync55(join63(source, "content.js")))
26342
+ if (!existsSync56(join63(source, "content.js")))
26302
26343
  return {
26303
26344
  message: `no content.js in ${source}`,
26304
26345
  hint: "run npm run build to bundle the content script"
@@ -26559,7 +26600,7 @@ function registerDb(program) {
26559
26600
  }
26560
26601
 
26561
26602
  // src/commands/deploy/redirect.ts
26562
- import { existsSync as existsSync56, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
26603
+ import { existsSync as existsSync57, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
26563
26604
  import chalk157 from "chalk";
26564
26605
  var TRAILING_SLASH_SCRIPT = ` <script>
26565
26606
  if (!window.location.pathname.endsWith('/')) {
@@ -26568,7 +26609,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
26568
26609
  </script>`;
26569
26610
  function redirect() {
26570
26611
  const indexPath = "index.html";
26571
- if (!existsSync56(indexPath)) {
26612
+ if (!existsSync57(indexPath)) {
26572
26613
  console.log(chalk157.yellow("No index.html found"));
26573
26614
  return;
26574
26615
  }
@@ -26774,7 +26815,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
26774
26815
  import chalk160 from "chalk";
26775
26816
 
26776
26817
  // src/shared/getRepoName.ts
26777
- import { existsSync as existsSync57, readFileSync as readFileSync38 } from "fs";
26818
+ import { existsSync as existsSync58, readFileSync as readFileSync38 } from "fs";
26778
26819
  import { basename as basename17, join as join68 } from "path";
26779
26820
  function getRepoName() {
26780
26821
  const config = loadConfig();
@@ -26782,7 +26823,7 @@ function getRepoName() {
26782
26823
  return config.devlog.name;
26783
26824
  }
26784
26825
  const packageJsonPath = join68(process.cwd(), "package.json");
26785
- if (existsSync57(packageJsonPath)) {
26826
+ if (existsSync58(packageJsonPath)) {
26786
26827
  try {
26787
26828
  const content = readFileSync38(packageJsonPath, "utf8");
26788
26829
  const pkg = JSON.parse(content);
@@ -27316,13 +27357,13 @@ function getDocsUnlockPinPath(pin2) {
27316
27357
  }
27317
27358
 
27318
27359
  // src/commands/docs/readDocsUnlockPinState.ts
27319
- import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
27360
+ import { existsSync as existsSync59, readFileSync as readFileSync39 } from "fs";
27320
27361
  function isPositiveInteger(value) {
27321
27362
  return Number.isInteger(value) && value > 0;
27322
27363
  }
27323
27364
  function readDocsUnlockPinState(pin2) {
27324
27365
  const path109 = getDocsUnlockPinPath(pin2);
27325
- if (!existsSync58(path109)) return void 0;
27366
+ if (!existsSync59(path109)) return void 0;
27326
27367
  try {
27327
27368
  const state = JSON.parse(readFileSync39(path109, "utf8"));
27328
27369
  if (state.pin !== pin2) return void 0;
@@ -27466,7 +27507,7 @@ function getSchemaUnlockPinPath(pin2) {
27466
27507
  }
27467
27508
 
27468
27509
  // src/commands/schema/readSchemaUnlockPinState.ts
27469
- import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
27510
+ import { existsSync as existsSync60, readFileSync as readFileSync40 } from "fs";
27470
27511
  function isPositiveInteger2(value) {
27471
27512
  return Number.isInteger(value) && value > 0;
27472
27513
  }
@@ -27480,7 +27521,7 @@ function toState(raw) {
27480
27521
  }
27481
27522
  function readSchemaUnlockPinState(pin2) {
27482
27523
  const path109 = getSchemaUnlockPinPath(pin2);
27483
- if (!existsSync59(path109)) return void 0;
27524
+ if (!existsSync60(path109)) return void 0;
27484
27525
  try {
27485
27526
  const raw = JSON.parse(readFileSync40(path109, "utf8"));
27486
27527
  if (raw.pin !== pin2) return void 0;
@@ -27809,12 +27850,12 @@ function printJson(tree, totalCount, solutions) {
27809
27850
  }
27810
27851
 
27811
27852
  // src/commands/dotnet/resolveCsproj.ts
27812
- import { existsSync as existsSync60 } from "fs";
27853
+ import { existsSync as existsSync61 } from "fs";
27813
27854
  import path38 from "path";
27814
27855
  import chalk174 from "chalk";
27815
27856
  function resolveCsproj(csprojPath) {
27816
27857
  const resolved = path38.resolve(csprojPath);
27817
- if (!existsSync60(resolved)) {
27858
+ if (!existsSync61(resolved)) {
27818
27859
  console.error(chalk174.red(`File not found: ${resolved}`));
27819
27860
  process.exit(1);
27820
27861
  }
@@ -27982,7 +28023,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
27982
28023
  }
27983
28024
 
27984
28025
  // src/commands/dotnet/resolveSolution.ts
27985
- import { existsSync as existsSync61 } from "fs";
28026
+ import { existsSync as existsSync62 } from "fs";
27986
28027
  import path39 from "path";
27987
28028
  import chalk178 from "chalk";
27988
28029
 
@@ -28023,7 +28064,7 @@ function findSolution() {
28023
28064
  function resolveSolution(sln) {
28024
28065
  if (sln) {
28025
28066
  const resolved = path39.resolve(sln);
28026
- if (!existsSync61(resolved)) {
28067
+ if (!existsSync62(resolved)) {
28027
28068
  console.error(chalk178.red(`Solution file not found: ${resolved}`));
28028
28069
  process.exit(1);
28029
28070
  }
@@ -28063,7 +28104,7 @@ function parseInspectReport(json) {
28063
28104
 
28064
28105
  // src/commands/dotnet/runInspectCode.ts
28065
28106
  import { execSync as execSync40 } from "child_process";
28066
- import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync12 } from "fs";
28107
+ import { existsSync as existsSync63, readFileSync as readFileSync43, unlinkSync as unlinkSync12 } from "fs";
28067
28108
  import { tmpdir as tmpdir4 } from "os";
28068
28109
  import path40 from "path";
28069
28110
  import chalk179 from "chalk";
@@ -28094,7 +28135,7 @@ function runInspectCode(slnPath, include, swea) {
28094
28135
  console.error(chalk179.red("jb inspectcode failed"));
28095
28136
  process.exit(1);
28096
28137
  }
28097
- if (!existsSync62(reportPath)) {
28138
+ if (!existsSync63(reportPath)) {
28098
28139
  console.error(chalk179.red("Report file not generated"));
28099
28140
  process.exit(1);
28100
28141
  }
@@ -30483,10 +30524,10 @@ function fetchIssueToWorkingFile(number, repo) {
30483
30524
  }
30484
30525
 
30485
30526
  // src/commands/github/issue/resumeIssueBody.ts
30486
- import { existsSync as existsSync63, readFileSync as readFileSync44 } from "fs";
30527
+ import { existsSync as existsSync64, readFileSync as readFileSync44 } from "fs";
30487
30528
  function resumeIssueBody(slug2, number, updatedAt) {
30488
30529
  const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
30489
- if (!existsSync63(bodyPath) || !existsSync63(metaPath)) return void 0;
30530
+ if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
30490
30531
  try {
30491
30532
  const meta = JSON.parse(readFileSync44(metaPath, "utf8"));
30492
30533
  if (meta.updatedAt !== updatedAt) return void 0;
@@ -31353,7 +31394,7 @@ function recentDaemonLogLines(includeRelayed = true) {
31353
31394
  }
31354
31395
 
31355
31396
  // src/commands/sessions/daemon/worktree/createWorktree.ts
31356
- import { existsSync as existsSync64 } from "fs";
31397
+ import { existsSync as existsSync65 } from "fs";
31357
31398
  import { basename as basename20, dirname as dirname34 } from "path";
31358
31399
 
31359
31400
  // src/commands/sessions/daemon/worktree/nextWorktreePath.ts
@@ -31385,7 +31426,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
31385
31426
  const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
31386
31427
  const registered = new Set(listWorktreePaths(clone));
31387
31428
  const branches = new Set(listLocalBranches(clone));
31388
- const isTaken = (candidate) => registered.has(candidate) || existsSync64(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
31429
+ const isTaken = (candidate) => registered.has(candidate) || existsSync65(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
31389
31430
  const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
31390
31431
  const ready = addWorktree(clone, path109, strategy.trunk);
31391
31432
  ready.catch(() => {
@@ -31623,21 +31664,21 @@ function persistedTreeRoots() {
31623
31664
  }
31624
31665
 
31625
31666
  // src/commands/sessions/daemon/worktree/seedWorktree.ts
31626
- import { copyFileSync, existsSync as existsSync66, mkdirSync as mkdirSync23 } from "fs";
31667
+ import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
31627
31668
  import { dirname as dirname35, join as join79 } from "path";
31628
31669
 
31629
31670
  // src/commands/sessions/daemon/worktree/runInstall.ts
31630
- import { resolve as resolve21 } from "path";
31671
+ import { resolve as resolve22 } from "path";
31631
31672
 
31632
31673
  // src/commands/sessions/daemon/worktree/detectInstallCommand.ts
31633
- import { existsSync as existsSync65 } from "fs";
31674
+ import { existsSync as existsSync66 } from "fs";
31634
31675
  import { join as join78 } from "path";
31635
31676
  function detectInstallCommand(dir) {
31636
- if (!existsSync65(join78(dir, "package.json"))) return null;
31637
- if (existsSync65(join78(dir, "pnpm-lock.yaml"))) return "pnpm install";
31638
- if (existsSync65(join78(dir, "yarn.lock"))) return "yarn install";
31639
- if (existsSync65(join78(dir, "bun.lockb"))) return "bun install";
31640
- if (existsSync65(join78(dir, "package-lock.json"))) return "npm ci";
31677
+ if (!existsSync66(join78(dir, "package.json"))) return null;
31678
+ if (existsSync66(join78(dir, "pnpm-lock.yaml"))) return "pnpm install";
31679
+ if (existsSync66(join78(dir, "yarn.lock"))) return "yarn install";
31680
+ if (existsSync66(join78(dir, "bun.lockb"))) return "bun install";
31681
+ if (existsSync66(join78(dir, "package-lock.json"))) return "npm ci";
31641
31682
  return "npm install";
31642
31683
  }
31643
31684
 
@@ -31768,7 +31809,7 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
31768
31809
  onSeeded();
31769
31810
  return;
31770
31811
  }
31771
- const dir = resolve21(worktreePath, rel);
31812
+ const dir = resolve22(worktreePath, rel);
31772
31813
  const command = detectInstallCommand(dir);
31773
31814
  if (!command) {
31774
31815
  daemonLog(
@@ -31803,7 +31844,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
31803
31844
  function copyConfigFiles(worktreePath, clone, copy) {
31804
31845
  for (const rel of copy) {
31805
31846
  const src = join79(clone, rel);
31806
- if (!existsSync66(src)) continue;
31847
+ if (!existsSync67(src)) continue;
31807
31848
  const dest = join79(worktreePath, rel);
31808
31849
  try {
31809
31850
  mkdirSync23(dirname35(dest), { recursive: true });
@@ -32274,12 +32315,12 @@ function registerLitellm(program) {
32274
32315
 
32275
32316
  // src/commands/mermaidExport.ts
32276
32317
  import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
32277
- import { resolve as resolve23 } from "path";
32318
+ import { resolve as resolve24 } from "path";
32278
32319
  import chalk196 from "chalk";
32279
32320
 
32280
32321
  // src/commands/mermaid/exportFile.ts
32281
32322
  import { readFileSync as readFileSync45, writeFileSync as writeFileSync35 } from "fs";
32282
- import { basename as basename21, extname as extname4, resolve as resolve22 } from "path";
32323
+ import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
32283
32324
  import chalk195 from "chalk";
32284
32325
 
32285
32326
  // src/commands/mermaid/renderBlock.ts
@@ -32327,7 +32368,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
32327
32368
  for (const [i, source] of blocks.entries()) {
32328
32369
  const idx = i + 1;
32329
32370
  if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
32330
- const outPath = resolve22(outDir, `${stem}-${idx}.svg`);
32371
+ const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
32331
32372
  const svg = await renderBlock(krokiUrl, source);
32332
32373
  writeFileSync35(outPath, svg, "utf8");
32333
32374
  console.log(chalk195.green(` \u2192 ${outPath}`));
@@ -32341,7 +32382,7 @@ function extractMermaidBlocks(markdown) {
32341
32382
  // src/commands/mermaidExport.ts
32342
32383
  async function mermaidExport(file, options2 = {}) {
32343
32384
  const { mermaid } = loadConfig();
32344
- const outDir = resolve23(process.cwd(), options2.out ?? ".");
32385
+ const outDir = resolve24(process.cwd(), options2.out ?? ".");
32345
32386
  mkdirSync24(outDir, { recursive: true });
32346
32387
  if (options2.index !== void 0) {
32347
32388
  if (!Number.isInteger(options2.index) || options2.index < 1) {
@@ -32469,17 +32510,17 @@ function emitExtract(out, header, texts) {
32469
32510
  }
32470
32511
 
32471
32512
  // src/commands/miro/resolveExtractPath.ts
32472
- import { isAbsolute as isAbsolute4, relative as relative8, resolve as resolve24 } from "path";
32513
+ import { isAbsolute as isAbsolute4, relative as relative8, resolve as resolve25 } from "path";
32473
32514
  function extractRoot(cwd) {
32474
32515
  return findConfigUp(cwd)?.rootDir ?? cwd;
32475
32516
  }
32476
32517
  function resolveExtractPath(value, cwd) {
32477
32518
  if (value === void 0) return void 0;
32478
- return isAbsolute4(value) ? value : resolve24(extractRoot(cwd), value);
32519
+ return isAbsolute4(value) ? value : resolve25(extractRoot(cwd), value);
32479
32520
  }
32480
32521
  function storedExtractPath(value, cwd) {
32481
32522
  if (value === void 0) return void 0;
32482
- const absolute2 = resolve24(cwd, value);
32523
+ const absolute2 = resolve25(cwd, value);
32483
32524
  const within2 = relative8(extractRoot(cwd), absolute2);
32484
32525
  return within2.startsWith("..") ? absolute2 : within2;
32485
32526
  }
@@ -32516,10 +32557,10 @@ function applyIgnore(texts, ignore3) {
32516
32557
  }
32517
32558
 
32518
32559
  // src/commands/miro/readIgnoreList.ts
32519
- import { existsSync as existsSync67, readFileSync as readFileSync46 } from "fs";
32560
+ import { existsSync as existsSync68, readFileSync as readFileSync46 } from "fs";
32520
32561
  import { parse as parse2 } from "yaml";
32521
32562
  function readIgnoreList(file) {
32522
- if (!existsSync67(file))
32563
+ if (!existsSync68(file))
32523
32564
  throw new MiroExtractError(
32524
32565
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
32525
32566
  );
@@ -33067,7 +33108,7 @@ async function prepareExtensionForLoad(port, filter = "") {
33067
33108
  }
33068
33109
 
33069
33110
  // src/commands/netcap/resolveNetcapOutPath.ts
33070
- import { isAbsolute as isAbsolute5, join as join83, resolve as resolve25 } from "path";
33111
+ import { isAbsolute as isAbsolute5, join as join83, resolve as resolve26 } from "path";
33071
33112
 
33072
33113
  // src/commands/netcap/defaultCapturePath.ts
33073
33114
  import { homedir as homedir24 } from "os";
@@ -33079,7 +33120,7 @@ function defaultCapturePath() {
33079
33120
  // src/commands/netcap/resolveNetcapOutPath.ts
33080
33121
  function resolveNetcapOutPath(out) {
33081
33122
  if (!out) return defaultCapturePath();
33082
- const dir = isAbsolute5(out) ? out : resolve25(process.cwd(), out);
33123
+ const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
33083
33124
  return join83(dir, "capture.jsonl");
33084
33125
  }
33085
33126
 
@@ -33986,11 +34027,11 @@ import { dirname as dirname39 } from "path";
33986
34027
  import { stringify as stringify3 } from "yaml";
33987
34028
 
33988
34029
  // src/commands/prs/loadCommentsCache.ts
33989
- import { existsSync as existsSync68, readFileSync as readFileSync49, unlinkSync as unlinkSync14 } from "fs";
34030
+ import { existsSync as existsSync69, readFileSync as readFileSync49, unlinkSync as unlinkSync14 } from "fs";
33990
34031
  import { parse as parse3 } from "yaml";
33991
34032
  function loadCommentsCache(org, repo, prNumber) {
33992
34033
  const cachePath = commentsCachePath(org, repo, prNumber);
33993
- if (!existsSync68(cachePath)) {
34034
+ if (!existsSync69(cachePath)) {
33994
34035
  return null;
33995
34036
  }
33996
34037
  const content = readFileSync49(cachePath, "utf8");
@@ -33998,7 +34039,7 @@ function loadCommentsCache(org, repo, prNumber) {
33998
34039
  }
33999
34040
  function deleteCommentsCache(org, repo, prNumber) {
34000
34041
  const cachePath = commentsCachePath(org, repo, prNumber);
34001
- if (existsSync68(cachePath)) {
34042
+ if (existsSync69(cachePath)) {
34002
34043
  unlinkSync14(cachePath);
34003
34044
  console.log("No more unresolved line comments. Cache dropped.");
34004
34045
  }
@@ -34918,7 +34959,7 @@ ${resolves}` : baseWhy);
34918
34959
 
34919
34960
  // src/commands/prs/parseScreenshotSpec.ts
34920
34961
  import { statSync as statSync10 } from "fs";
34921
- import { basename as basename22, extname as extname5, resolve as resolve26 } from "path";
34962
+ import { basename as basename22, extname as extname5, resolve as resolve27 } from "path";
34922
34963
  function splitOnce(value, separator) {
34923
34964
  const index3 = value.indexOf(separator);
34924
34965
  if (index3 === -1) return null;
@@ -34934,7 +34975,7 @@ function isFile2(path109) {
34934
34975
  function parseScreenshotSpec(spec) {
34935
34976
  const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
34936
34977
  const [group, caption] = splitOnce(label, "/") ?? ["", label];
34937
- const path109 = resolve26(rawPath.trim());
34978
+ const path109 = resolve27(rawPath.trim());
34938
34979
  const ext = extname5(path109).replace(/^\./, "").toLowerCase();
34939
34980
  if (!isFile2(path109))
34940
34981
  throw new Error(`--screenshot '${spec}': file not found: ${path109}`);
@@ -37299,9 +37340,9 @@ async function notify() {
37299
37340
 
37300
37341
  // src/commands/screenshot.ts
37301
37342
  import { execSync as execSync54 } from "child_process";
37302
- import { existsSync as existsSync69, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
37343
+ import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
37303
37344
  import { tmpdir as tmpdir7 } from "os";
37304
- import { join as join88, resolve as resolve27 } from "path";
37345
+ import { join as join88, resolve as resolve28 } from "path";
37305
37346
  import chalk228 from "chalk";
37306
37347
 
37307
37348
  // src/commands/screenshot/captureWindowPs1.ts
@@ -37431,11 +37472,11 @@ Write-Output $OutputPath
37431
37472
 
37432
37473
  // src/commands/screenshot.ts
37433
37474
  function buildOutputPath(outputDir, processName) {
37434
- if (!existsSync69(outputDir)) {
37475
+ if (!existsSync70(outputDir)) {
37435
37476
  mkdirSync27(outputDir, { recursive: true });
37436
37477
  }
37437
37478
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
37438
- return resolve27(outputDir, `${processName}-${timestamp9}.png`);
37479
+ return resolve28(outputDir, `${processName}-${timestamp9}.png`);
37439
37480
  }
37440
37481
  function runPowerShellScript(processName, outputPath) {
37441
37482
  const scriptPath = join88(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
@@ -37451,7 +37492,7 @@ function runPowerShellScript(processName, outputPath) {
37451
37492
  }
37452
37493
  function screenshot(processName) {
37453
37494
  const config = loadConfig();
37454
- const outputDir = resolve27(config.screenshot.outputDir);
37495
+ const outputDir = resolve28(config.screenshot.outputDir);
37455
37496
  const outputPath = buildOutputPath(outputDir, processName);
37456
37497
  console.log(chalk228.gray(`Capturing window for process "${processName}" ...`));
37457
37498
  try {
@@ -37540,7 +37581,7 @@ function buildLimitsSegment(rateLimits) {
37540
37581
 
37541
37582
  // src/commands/readGitBranch.ts
37542
37583
  import { readFileSync as readFileSync52, statSync as statSync11 } from "fs";
37543
- import { isAbsolute as isAbsolute6, join as join89, resolve as resolve28 } from "path";
37584
+ import { isAbsolute as isAbsolute6, join as join89, resolve as resolve29 } from "path";
37544
37585
  function resolveGitDir(cwd) {
37545
37586
  const dotGit = join89(cwd, ".git");
37546
37587
  let stat5;
@@ -37563,7 +37604,7 @@ function resolveGitDir(cwd) {
37563
37604
  return null;
37564
37605
  }
37565
37606
  const gitDir = match[1].trim();
37566
- return isAbsolute6(gitDir) ? gitDir : resolve28(cwd, gitDir);
37607
+ return isAbsolute6(gitDir) ? gitDir : resolve29(cwd, gitDir);
37567
37608
  }
37568
37609
  function readGitBranch(cwd) {
37569
37610
  const gitDir = resolveGitDir(cwd);
@@ -40809,9 +40850,9 @@ function listHighLevelHunks(files) {
40809
40850
  }
40810
40851
 
40811
40852
  // src/commands/review/highLevel/readJsonFile.ts
40812
- import { existsSync as existsSync70, readFileSync as readFileSync53 } from "fs";
40853
+ import { existsSync as existsSync71, readFileSync as readFileSync53 } from "fs";
40813
40854
  function readJsonFile(path109) {
40814
- if (!existsSync70(path109)) return void 0;
40855
+ if (!existsSync71(path109)) return void 0;
40815
40856
  try {
40816
40857
  return JSON.parse(readFileSync53(path109, "utf8"));
40817
40858
  } catch {
@@ -42988,7 +43029,7 @@ async function runClaudeReviewer(spec) {
42988
43029
  }
42989
43030
 
42990
43031
  // src/commands/review/runCodexReviewer.ts
42991
- import { existsSync as existsSync71, unlinkSync as unlinkSync17 } from "fs";
43032
+ import { existsSync as existsSync72, unlinkSync as unlinkSync17 } from "fs";
42992
43033
 
42993
43034
  // src/commands/review/parseCodexUsage.ts
42994
43035
  function parseCodexUsage(usage) {
@@ -43077,7 +43118,7 @@ async function runCodexReviewer(spec) {
43077
43118
  ...override.args.length > 0 ? { env: override.env } : {},
43078
43119
  onLine
43079
43120
  });
43080
- if (result.exitCode !== 0 && existsSync71(spec.outputPath)) {
43121
+ if (result.exitCode !== 0 && existsSync72(spec.outputPath)) {
43081
43122
  unlinkSync17(spec.outputPath);
43082
43123
  }
43083
43124
  const finalised = finaliseReviewerRun(
@@ -43171,7 +43212,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
43171
43212
  }
43172
43213
 
43173
43214
  // src/commands/review/synthesiseAfterReviewers.ts
43174
- import { existsSync as existsSync72, unlinkSync as unlinkSync18 } from "fs";
43215
+ import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
43175
43216
 
43176
43217
  // src/commands/review/synthesise.ts
43177
43218
  import { readFileSync as readFileSync56 } from "fs";
@@ -43278,7 +43319,7 @@ async function synthesise(paths, options2) {
43278
43319
  // src/commands/review/synthesiseAfterReviewers.ts
43279
43320
  async function synthesiseAfterReviewers(input) {
43280
43321
  const { paths, failures } = input;
43281
- if (input.anyFresh && existsSync72(paths.synthesisPath)) {
43322
+ if (input.anyFresh && existsSync73(paths.synthesisPath)) {
43282
43323
  unlinkSync18(paths.synthesisPath);
43283
43324
  }
43284
43325
  const synthesisResult = await synthesise(paths, {
@@ -43562,10 +43603,10 @@ function fetchExistingComments() {
43562
43603
  }
43563
43604
 
43564
43605
  // src/commands/review/prepareReviewDir.ts
43565
- import { existsSync as existsSync73, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
43606
+ import { existsSync as existsSync74, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
43566
43607
  function clearReviewFiles(paths) {
43567
43608
  for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
43568
- if (existsSync73(path109)) unlinkSync19(path109);
43609
+ if (existsSync74(path109)) unlinkSync19(path109);
43569
43610
  }
43570
43611
  }
43571
43612
  function prepareReviewDir(paths, requestBody, force) {
@@ -44234,7 +44275,7 @@ import path88 from "path";
44234
44275
  import chalk263 from "chalk";
44235
44276
 
44236
44277
  // src/commands/rules/updateScopedRulesIndex.ts
44237
- import { existsSync as existsSync74, readFileSync as readFileSync59, writeFileSync as writeFileSync44 } from "fs";
44278
+ import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync44 } from "fs";
44238
44279
  import path87 from "path";
44239
44280
 
44240
44281
  // src/commands/rules/scopedRuleDirectories.ts
@@ -44304,7 +44345,7 @@ function upsertScopedRulesPointer(content, directories) {
44304
44345
  function updateScopedRulesIndex(root2) {
44305
44346
  const directories = scopedRuleDirectories(root2);
44306
44347
  const rootFile = path87.join(root2, "CLAUDE.md");
44307
- const before = existsSync74(rootFile) ? readFileSync59(rootFile, "utf8") : "";
44348
+ const before = existsSync75(rootFile) ? readFileSync59(rootFile, "utf8") : "";
44308
44349
  const after = upsertScopedRulesPointer(before, directories);
44309
44350
  if (after !== before) writeFileSync44(rootFile, after);
44310
44351
  return directories;
@@ -44357,7 +44398,7 @@ function listRules(target, options2 = {}) {
44357
44398
  }
44358
44399
 
44359
44400
  // src/commands/rules/addRule.ts
44360
- import { existsSync as existsSync76, readFileSync as readFileSync61, writeFileSync as writeFileSync45 } from "fs";
44401
+ import { existsSync as existsSync77, readFileSync as readFileSync61, writeFileSync as writeFileSync45 } from "fs";
44361
44402
  import path91 from "path";
44362
44403
  import chalk265 from "chalk";
44363
44404
 
@@ -44394,7 +44435,7 @@ function nextRuleCode(root2) {
44394
44435
  }
44395
44436
 
44396
44437
  // src/commands/rules/resolveRuleScope.ts
44397
- import { existsSync as existsSync75 } from "fs";
44438
+ import { existsSync as existsSync76 } from "fs";
44398
44439
  import path90 from "path";
44399
44440
  function resolveRuleScope(target) {
44400
44441
  const resolved = path90.resolve(target);
@@ -44404,7 +44445,7 @@ function resolveRuleScope(target) {
44404
44445
  let current = startDir;
44405
44446
  while (true) {
44406
44447
  const candidate = path90.join(current, "CLAUDE.md");
44407
- if (existsSync75(candidate)) return candidate;
44448
+ if (existsSync76(candidate)) return candidate;
44408
44449
  if (current === root2 || current === path90.dirname(current)) break;
44409
44450
  current = path90.dirname(current);
44410
44451
  }
@@ -44413,7 +44454,7 @@ function resolveRuleScope(target) {
44413
44454
 
44414
44455
  // src/commands/rules/addRule.ts
44415
44456
  function read2(file) {
44416
- return existsSync76(file) ? readFileSync61(file, "utf8") : "";
44457
+ return existsSync77(file) ? readFileSync61(file, "utf8") : "";
44417
44458
  }
44418
44459
  function addRule(text20, options2) {
44419
44460
  const rule = text20.trim();
@@ -45952,7 +45993,7 @@ function registerSync(program) {
45952
45993
  }
45953
45994
 
45954
45995
  // src/commands/transcript/clean.ts
45955
- import { existsSync as existsSync81 } from "fs";
45996
+ import { existsSync as existsSync82 } from "fs";
45956
45997
 
45957
45998
  // src/commands/transcript/convert/formatTimestamp.ts
45958
45999
  function pad2(value, width2) {
@@ -46230,7 +46271,7 @@ function clean(file, options2 = {}) {
46230
46271
  );
46231
46272
  process.exit(1);
46232
46273
  }
46233
- if (!existsSync81(file)) {
46274
+ if (!existsSync82(file)) {
46234
46275
  console.error(`Error: VTT file not found: ${file}`);
46235
46276
  process.exit(1);
46236
46277
  }
@@ -46313,11 +46354,11 @@ async function configure() {
46313
46354
  }
46314
46355
 
46315
46356
  // src/commands/transcript/list.ts
46316
- import { existsSync as existsSync82, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
46357
+ import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
46317
46358
  import { join as join105 } from "path";
46318
46359
  function list5() {
46319
46360
  const { vttDir } = getTranscriptConfig();
46320
- if (!existsSync82(vttDir)) return;
46361
+ if (!existsSync83(vttDir)) return;
46321
46362
  for (const entry of readdirSync24(vttDir)) {
46322
46363
  if (!entry.endsWith(".vtt")) continue;
46323
46364
  if (statSync13(join105(vttDir, entry)).isDirectory()) continue;
@@ -46326,7 +46367,7 @@ function list5() {
46326
46367
  }
46327
46368
 
46328
46369
  // src/commands/transcript/move.ts
46329
- import { existsSync as existsSync83, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
46370
+ import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
46330
46371
  import { basename as basename29, join as join106 } from "path";
46331
46372
 
46332
46373
  // src/commands/transcript/convertVttToMarkdown.ts
@@ -46350,7 +46391,7 @@ function move(file, options2) {
46350
46391
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
46351
46392
  const filename = basename29(file);
46352
46393
  const sourcePath = join106(vttDir, filename);
46353
- if (!existsSync83(sourcePath)) {
46394
+ if (!existsSync84(sourcePath)) {
46354
46395
  console.error(`Error: VTT file not found: ${sourcePath}`);
46355
46396
  process.exit(1);
46356
46397
  }
@@ -46367,7 +46408,7 @@ function move(file, options2) {
46367
46408
  }
46368
46409
 
46369
46410
  // src/commands/transcript/merge.ts
46370
- import { existsSync as existsSync84, writeFileSync as writeFileSync53 } from "fs";
46411
+ import { existsSync as existsSync85, writeFileSync as writeFileSync53 } from "fs";
46371
46412
  import { basename as basename30 } from "path";
46372
46413
 
46373
46414
  // src/commands/transcript/failTranscript.ts
@@ -46511,7 +46552,7 @@ function widenAudience(passages) {
46511
46552
 
46512
46553
  // src/commands/transcript/merge.ts
46513
46554
  function readSource3(file) {
46514
- if (!existsSync84(file)) failTranscript(`VTT file not found: ${file}`);
46555
+ if (!existsSync85(file)) failTranscript(`VTT file not found: ${file}`);
46515
46556
  const cues = readCleanedCues(file);
46516
46557
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
46517
46558
  return { path: file, name: basename30(file), cues };
@@ -46984,7 +47025,7 @@ function configKeys2() {
46984
47025
  }
46985
47026
 
46986
47027
  // src/commands/verify/forbiddenStrings.ts
46987
- import { existsSync as existsSync85, readFileSync as readFileSync69 } from "fs";
47028
+ import { existsSync as existsSync86, readFileSync as readFileSync69 } from "fs";
46988
47029
 
46989
47030
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
46990
47031
  import { minimatch as minimatch10 } from "minimatch";
@@ -47025,7 +47066,7 @@ function forbiddenStrings() {
47025
47066
  const cache7 = /* @__PURE__ */ new Map();
47026
47067
  const readJson = (file) => {
47027
47068
  if (cache7.has(file)) return cache7.get(file);
47028
- if (!existsSync85(file)) {
47069
+ if (!existsSync86(file)) {
47029
47070
  console.log(`Forbidden-strings file not found: ${file}`);
47030
47071
  process.exit(1);
47031
47072
  }
@@ -47441,6 +47482,231 @@ function emitWatchState(watchState) {
47441
47482
  emitActivity({ kind: "command", name: "watch", watchState });
47442
47483
  }
47443
47484
 
47485
+ // src/commands/watch/clearBuildPending.ts
47486
+ import { rmSync as rmSync11 } from "fs";
47487
+ function clearBuildPending() {
47488
+ try {
47489
+ rmSync11(buildPendingPath(), { force: true });
47490
+ } catch {
47491
+ }
47492
+ }
47493
+
47494
+ // src/commands/watch/isSyncPending.ts
47495
+ import { existsSync as existsSync87 } from "fs";
47496
+
47497
+ // src/commands/watch/syncPendingPath.ts
47498
+ function syncPendingPath(cwd) {
47499
+ return gitMarkerPath("assist-watch-sync-pending", cwd);
47500
+ }
47501
+
47502
+ // src/commands/watch/isSyncPending.ts
47503
+ function isSyncPending() {
47504
+ try {
47505
+ return existsSync87(syncPendingPath());
47506
+ } catch {
47507
+ return false;
47508
+ }
47509
+ }
47510
+
47511
+ // src/commands/watch/reportSyncOrExit.ts
47512
+ import { rmSync as rmSync12 } from "fs";
47513
+
47514
+ // src/commands/watch/toBuildOutcome.ts
47515
+ function toBuildOutcome(result) {
47516
+ if (result.kind === "failed")
47517
+ return { kind: "failed", exitCode: 1, output: result.message };
47518
+ if (result.exitCode !== 0)
47519
+ return { kind: "failed", exitCode: result.exitCode, output: result.output };
47520
+ return { kind: "built" };
47521
+ }
47522
+
47523
+ // src/commands/watch/runPostBuildSync.ts
47524
+ async function runPostBuildSync() {
47525
+ return toBuildOutcome(
47526
+ await runCommandToCompletion(
47527
+ process.execPath,
47528
+ [process.argv[1], "sync", "--yes"],
47529
+ void 0,
47530
+ void 0,
47531
+ true
47532
+ )
47533
+ );
47534
+ }
47535
+
47536
+ // src/commands/watch/reportSyncOrExit.ts
47537
+ function clearPendingMarker() {
47538
+ try {
47539
+ rmSync12(syncPendingPath(), { force: true });
47540
+ } catch {
47541
+ }
47542
+ }
47543
+ async function reportSyncOrExit() {
47544
+ const outcome = await runPostBuildSync();
47545
+ if (outcome.kind === "built") {
47546
+ clearPendingMarker();
47547
+ console.log("synced ~/.claude");
47548
+ return;
47549
+ }
47550
+ if (outcome.output.length > 0)
47551
+ process.stdout.write(
47552
+ outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
47553
+ `
47554
+ );
47555
+ console.error(
47556
+ `sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
47557
+ );
47558
+ process.exit(4);
47559
+ }
47560
+
47561
+ // src/commands/run/findRunConfig.ts
47562
+ function exitNoRunConfigs() {
47563
+ console.error("No run configurations found in assist.yml");
47564
+ process.exit(1);
47565
+ }
47566
+ function exitWithConfigNotFound(name, configs) {
47567
+ console.error(`No run configuration found with name: ${name}`);
47568
+ console.error("Available configurations:");
47569
+ for (const r of configs) {
47570
+ console.error(` - ${r.name}`);
47571
+ }
47572
+ process.exit(1);
47573
+ }
47574
+ function exitWithAmbiguousConfig(name, matches) {
47575
+ console.error(`Ambiguous run configuration: ${name}`);
47576
+ console.error("Did you mean:");
47577
+ for (const r of matches) {
47578
+ console.error(` - ${r.name}`);
47579
+ }
47580
+ process.exit(1);
47581
+ }
47582
+ function requireRunConfigs() {
47583
+ const { run: run4 } = loadConfig();
47584
+ const configs = resolveRunConfigs(run4, runConfigBaseDir());
47585
+ if (configs.length === 0) return exitNoRunConfigs();
47586
+ return configs;
47587
+ }
47588
+ function lookupRunConfig(name) {
47589
+ const configs = requireRunConfigs();
47590
+ const exact = configs.find((r) => r.name === name);
47591
+ if (exact) return { kind: "match", config: exact };
47592
+ const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
47593
+ if (suffixMatches.length === 1)
47594
+ return { kind: "match", config: suffixMatches[0] };
47595
+ if (suffixMatches.length > 1)
47596
+ return { kind: "ambiguous", matches: suffixMatches };
47597
+ return { kind: "not-found" };
47598
+ }
47599
+ function findRunConfig(name) {
47600
+ const result = lookupRunConfig(name);
47601
+ if (result.kind === "match") return result.config;
47602
+ if (result.kind === "ambiguous")
47603
+ return exitWithAmbiguousConfig(name, result.matches);
47604
+ return exitWithConfigNotFound(name, requireRunConfigs());
47605
+ }
47606
+
47607
+ // src/commands/run/resolveParams.ts
47608
+ function resolveParams(params, cliArgs) {
47609
+ if (!params || params.length === 0) return cliArgs;
47610
+ const resolved = [];
47611
+ const missing = [];
47612
+ for (let i = 0; i < params.length; i++) {
47613
+ const param = params[i];
47614
+ const value = cliArgs[i] ?? param.default;
47615
+ if (value !== void 0) {
47616
+ resolved.push(value);
47617
+ } else if (param.required) {
47618
+ missing.push(param.name);
47619
+ }
47620
+ }
47621
+ if (missing.length > 0) {
47622
+ const s = missing.length > 1 ? "s" : "";
47623
+ const names = missing.map((n) => `"${n}"`).join(", ");
47624
+ console.error(`Missing required param${s}: ${names}`);
47625
+ process.exit(1);
47626
+ }
47627
+ resolved.push(...cliArgs.slice(params.length));
47628
+ return resolved;
47629
+ }
47630
+
47631
+ // src/commands/run/resolveRunCwd.ts
47632
+ import { existsSync as existsSync88 } from "fs";
47633
+ import { resolve as resolve31 } from "path";
47634
+ var MissingRunCwdError = class extends Error {
47635
+ constructor(runName, cwd) {
47636
+ super(`run config "${runName}": cwd ${cwd} does not exist`);
47637
+ this.runName = runName;
47638
+ this.cwd = cwd;
47639
+ this.name = "MissingRunCwdError";
47640
+ }
47641
+ };
47642
+ function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
47643
+ if (!config.cwd) return void 0;
47644
+ const cwd = resolve31(baseDir, config.cwd);
47645
+ if (!existsSync88(cwd)) throw new MissingRunCwdError(config.name, cwd);
47646
+ return cwd;
47647
+ }
47648
+
47649
+ // src/commands/run/runPreCommands.ts
47650
+ import { execSync as execSync66 } from "child_process";
47651
+ function writeCapturedOutput(error) {
47652
+ for (const stream of ["stdout", "stderr"]) {
47653
+ const output = error[stream];
47654
+ if (output) process.stdout.write(output);
47655
+ }
47656
+ }
47657
+ function runPreCommands(pre, cwd, quiet) {
47658
+ for (const cmd of pre) {
47659
+ try {
47660
+ execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
47661
+ } catch (error) {
47662
+ if (quiet && error && typeof error === "object")
47663
+ writeCapturedOutput(error);
47664
+ const code = error && typeof error === "object" && "status" in error ? error.status : 1;
47665
+ process.exit(code);
47666
+ }
47667
+ }
47668
+ }
47669
+
47670
+ // src/commands/watch/runWatchBuild.ts
47671
+ async function runWatchBuild(entry) {
47672
+ const config = findRunConfig(entry);
47673
+ let cwd;
47674
+ try {
47675
+ cwd = resolveRunCwd(config);
47676
+ } catch (error) {
47677
+ if (!(error instanceof MissingRunCwdError)) throw error;
47678
+ return { kind: "failed", exitCode: 1, output: error.message };
47679
+ }
47680
+ if (config.pre) runPreCommands(config.pre, cwd, true);
47681
+ return toBuildOutcome(
47682
+ await runCommandToCompletion(
47683
+ config.command,
47684
+ [...config.args ?? [], ...resolveParams(config.params, [])],
47685
+ config.env,
47686
+ cwd,
47687
+ true
47688
+ )
47689
+ );
47690
+ }
47691
+
47692
+ // src/commands/watch/finishPendingBuild.ts
47693
+ async function finishPendingBuild(entry) {
47694
+ if (!isBuildPending()) return;
47695
+ console.log("an earlier lap pulled but did not finish building; rebuilding");
47696
+ emitWatchState("updating");
47697
+ const outcome = await runWatchBuild(entry);
47698
+ if (outcome.kind !== "built") {
47699
+ if (outcome.output.length > 0) process.stdout.write(outcome.output);
47700
+ console.error(
47701
+ `build "${entry}" failed with exit code ${outcome.exitCode}; the next pull retries it`
47702
+ );
47703
+ return;
47704
+ }
47705
+ clearBuildPending();
47706
+ console.log(`built with "${entry}"`);
47707
+ if (isSyncPending()) await reportSyncOrExit();
47708
+ }
47709
+
47444
47710
  // src/commands/watch/parseWatchDurations.ts
47445
47711
  function parseOrExit(value) {
47446
47712
  try {
@@ -47571,39 +47837,25 @@ ${result.reason}`
47571
47837
  };
47572
47838
  }
47573
47839
 
47574
- // src/commands/watch/markSyncPending.ts
47575
- import { existsSync as existsSync86, writeFileSync as writeFileSync54 } from "fs";
47576
-
47577
- // src/commands/watch/gitMarkerPath.ts
47578
- import { resolve as resolve30 } from "path";
47579
- function gitMarkerPath(name, cwd) {
47580
- return resolve30(
47581
- cwd ?? process.cwd(),
47582
- runGit3(["rev-parse", "--git-path", name], cwd)
47583
- );
47584
- }
47585
-
47586
- // src/commands/watch/syncPendingPath.ts
47587
- function syncPendingPath(cwd) {
47588
- return gitMarkerPath("assist-watch-sync-pending", cwd);
47589
- }
47590
-
47591
- // src/commands/watch/markSyncPending.ts
47592
- function pendingFromEarlierLap() {
47840
+ // src/commands/watch/markBuildPending.ts
47841
+ import { writeFileSync as writeFileSync54 } from "fs";
47842
+ function markBuildPending() {
47593
47843
  try {
47594
- return existsSync86(syncPendingPath());
47844
+ writeFileSync54(buildPendingPath(), "");
47595
47845
  } catch {
47596
- return false;
47597
47846
  }
47598
47847
  }
47848
+
47849
+ // src/commands/watch/markSyncPending.ts
47850
+ import { writeFileSync as writeFileSync55 } from "fs";
47599
47851
  function writePendingMarker() {
47600
47852
  try {
47601
- writeFileSync54(syncPendingPath(), "");
47853
+ writeFileSync55(syncPendingPath(), "");
47602
47854
  } catch {
47603
47855
  }
47604
47856
  }
47605
47857
  function markSyncPending(from) {
47606
- const owed = pendingFromEarlierLap();
47858
+ const owed = isSyncPending();
47607
47859
  if (syncAdvice(changedPaths(from)).length > 0) {
47608
47860
  writePendingMarker();
47609
47861
  return true;
@@ -47683,146 +47935,6 @@ function pullFastForward(cwd) {
47683
47935
  return mergeBehindBranch(cwd);
47684
47936
  }
47685
47937
 
47686
- // src/commands/run/findRunConfig.ts
47687
- function exitNoRunConfigs() {
47688
- console.error("No run configurations found in assist.yml");
47689
- process.exit(1);
47690
- }
47691
- function exitWithConfigNotFound(name, configs) {
47692
- console.error(`No run configuration found with name: ${name}`);
47693
- console.error("Available configurations:");
47694
- for (const r of configs) {
47695
- console.error(` - ${r.name}`);
47696
- }
47697
- process.exit(1);
47698
- }
47699
- function exitWithAmbiguousConfig(name, matches) {
47700
- console.error(`Ambiguous run configuration: ${name}`);
47701
- console.error("Did you mean:");
47702
- for (const r of matches) {
47703
- console.error(` - ${r.name}`);
47704
- }
47705
- process.exit(1);
47706
- }
47707
- function requireRunConfigs() {
47708
- const { run: run4 } = loadConfig();
47709
- const configs = resolveRunConfigs(run4, runConfigBaseDir());
47710
- if (configs.length === 0) return exitNoRunConfigs();
47711
- return configs;
47712
- }
47713
- function lookupRunConfig(name) {
47714
- const configs = requireRunConfigs();
47715
- const exact = configs.find((r) => r.name === name);
47716
- if (exact) return { kind: "match", config: exact };
47717
- const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
47718
- if (suffixMatches.length === 1)
47719
- return { kind: "match", config: suffixMatches[0] };
47720
- if (suffixMatches.length > 1)
47721
- return { kind: "ambiguous", matches: suffixMatches };
47722
- return { kind: "not-found" };
47723
- }
47724
- function findRunConfig(name) {
47725
- const result = lookupRunConfig(name);
47726
- if (result.kind === "match") return result.config;
47727
- if (result.kind === "ambiguous")
47728
- return exitWithAmbiguousConfig(name, result.matches);
47729
- return exitWithConfigNotFound(name, requireRunConfigs());
47730
- }
47731
-
47732
- // src/commands/run/resolveParams.ts
47733
- function resolveParams(params, cliArgs) {
47734
- if (!params || params.length === 0) return cliArgs;
47735
- const resolved = [];
47736
- const missing = [];
47737
- for (let i = 0; i < params.length; i++) {
47738
- const param = params[i];
47739
- const value = cliArgs[i] ?? param.default;
47740
- if (value !== void 0) {
47741
- resolved.push(value);
47742
- } else if (param.required) {
47743
- missing.push(param.name);
47744
- }
47745
- }
47746
- if (missing.length > 0) {
47747
- const s = missing.length > 1 ? "s" : "";
47748
- const names = missing.map((n) => `"${n}"`).join(", ");
47749
- console.error(`Missing required param${s}: ${names}`);
47750
- process.exit(1);
47751
- }
47752
- resolved.push(...cliArgs.slice(params.length));
47753
- return resolved;
47754
- }
47755
-
47756
- // src/commands/run/resolveRunCwd.ts
47757
- import { existsSync as existsSync87 } from "fs";
47758
- import { resolve as resolve31 } from "path";
47759
- var MissingRunCwdError = class extends Error {
47760
- constructor(runName, cwd) {
47761
- super(`run config "${runName}": cwd ${cwd} does not exist`);
47762
- this.runName = runName;
47763
- this.cwd = cwd;
47764
- this.name = "MissingRunCwdError";
47765
- }
47766
- };
47767
- function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
47768
- if (!config.cwd) return void 0;
47769
- const cwd = resolve31(baseDir, config.cwd);
47770
- if (!existsSync87(cwd)) throw new MissingRunCwdError(config.name, cwd);
47771
- return cwd;
47772
- }
47773
-
47774
- // src/commands/run/runPreCommands.ts
47775
- import { execSync as execSync66 } from "child_process";
47776
- function writeCapturedOutput(error) {
47777
- for (const stream of ["stdout", "stderr"]) {
47778
- const output = error[stream];
47779
- if (output) process.stdout.write(output);
47780
- }
47781
- }
47782
- function runPreCommands(pre, cwd, quiet) {
47783
- for (const cmd of pre) {
47784
- try {
47785
- execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
47786
- } catch (error) {
47787
- if (quiet && error && typeof error === "object")
47788
- writeCapturedOutput(error);
47789
- const code = error && typeof error === "object" && "status" in error ? error.status : 1;
47790
- process.exit(code);
47791
- }
47792
- }
47793
- }
47794
-
47795
- // src/commands/watch/toBuildOutcome.ts
47796
- function toBuildOutcome(result) {
47797
- if (result.kind === "failed")
47798
- return { kind: "failed", exitCode: 1, output: result.message };
47799
- if (result.exitCode !== 0)
47800
- return { kind: "failed", exitCode: result.exitCode, output: result.output };
47801
- return { kind: "built" };
47802
- }
47803
-
47804
- // src/commands/watch/runWatchBuild.ts
47805
- async function runWatchBuild(entry) {
47806
- const config = findRunConfig(entry);
47807
- let cwd;
47808
- try {
47809
- cwd = resolveRunCwd(config);
47810
- } catch (error) {
47811
- if (!(error instanceof MissingRunCwdError)) throw error;
47812
- return { kind: "failed", exitCode: 1, output: error.message };
47813
- }
47814
- if (config.pre) runPreCommands(config.pre, cwd, true);
47815
- return toBuildOutcome(
47816
- await runCommandToCompletion(
47817
- config.command,
47818
- [...config.args ?? [], ...resolveParams(config.params, [])],
47819
- config.env,
47820
- cwd,
47821
- true
47822
- )
47823
- );
47824
- }
47825
-
47826
47938
  // src/commands/watch/reportBuildOrExit.ts
47827
47939
  async function reportBuildOrExit(entry) {
47828
47940
  const outcome = await runWatchBuild(entry);
@@ -47841,49 +47953,13 @@ function reportOutcome({ exitCode, message: message3 }) {
47841
47953
  else console.error(message3);
47842
47954
  }
47843
47955
 
47844
- // src/commands/watch/reportSyncOrExit.ts
47845
- import { rmSync as rmSync11 } from "fs";
47846
-
47847
- // src/commands/watch/runPostBuildSync.ts
47848
- async function runPostBuildSync() {
47849
- return toBuildOutcome(
47850
- await runCommandToCompletion(
47851
- process.execPath,
47852
- [process.argv[1], "sync", "--yes"],
47853
- void 0,
47854
- void 0,
47855
- true
47856
- )
47857
- );
47858
- }
47859
-
47860
- // src/commands/watch/reportSyncOrExit.ts
47861
- function clearPendingMarker() {
47862
- try {
47863
- rmSync11(syncPendingPath(), { force: true });
47864
- } catch {
47865
- }
47866
- }
47867
- async function reportSyncOrExit() {
47868
- const outcome = await runPostBuildSync();
47869
- if (outcome.kind === "built") {
47870
- clearPendingMarker();
47871
- console.log("synced ~/.claude");
47872
- return;
47873
- }
47874
- if (outcome.output.length > 0)
47875
- process.stdout.write(
47876
- outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
47877
- `
47878
- );
47879
- console.error(
47880
- `sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
47881
- );
47882
- process.exit(4);
47956
+ // src/commands/watch/watchBuildEntry.ts
47957
+ var DEFAULT_BUILD_ENTRY = "auto-build";
47958
+ function watchBuildEntry(build2) {
47959
+ return typeof build2 === "string" ? build2 : DEFAULT_BUILD_ENTRY;
47883
47960
  }
47884
47961
 
47885
47962
  // src/commands/watch/pullAndBuild.ts
47886
- var DEFAULT_BUILD_ENTRY = "auto-build";
47887
47963
  async function pullAndBuild(from, build2) {
47888
47964
  emitWatchState("updating");
47889
47965
  const pullResult = pullFastForward();
@@ -47891,24 +47967,24 @@ async function pullAndBuild(from, build2) {
47891
47967
  reportOutcome(pullReport);
47892
47968
  if (pullResult.kind !== "fast-forwarded")
47893
47969
  return process.exit(pullReport.exitCode);
47970
+ if (build2) markBuildPending();
47894
47971
  console.log(`
47895
47972
  ${buildWatchReport(from)}`);
47896
47973
  if (build2) {
47897
47974
  const syncNeeded = markSyncPending(from);
47898
- await reportBuildOrExit(
47899
- typeof build2 === "string" ? build2 : DEFAULT_BUILD_ENTRY
47900
- );
47975
+ await reportBuildOrExit(watchBuildEntry(build2));
47976
+ clearBuildPending();
47901
47977
  if (syncNeeded) await reportSyncOrExit();
47902
47978
  }
47903
47979
  process.exit(0);
47904
47980
  }
47905
47981
 
47906
47982
  // src/commands/watch/consumeMarker.ts
47907
- import { existsSync as existsSync88, rmSync as rmSync12 } from "fs";
47983
+ import { existsSync as existsSync89, rmSync as rmSync13 } from "fs";
47908
47984
  function consumeMarker(path109) {
47909
47985
  try {
47910
- if (!existsSync88(path109)) return false;
47911
- rmSync12(path109);
47986
+ if (!existsSync89(path109)) return false;
47987
+ rmSync13(path109);
47912
47988
  return true;
47913
47989
  } catch {
47914
47990
  return false;
@@ -48049,6 +48125,8 @@ async function watchWait(options2) {
48049
48125
  options2.interval,
48050
48126
  options2.timeout
48051
48127
  );
48128
+ if (options2.pull && options2.build)
48129
+ await finishPendingBuild(watchBuildEntry(options2.build));
48052
48130
  const outcome = await waitForUpstream({
48053
48131
  intervalMs,
48054
48132
  timeoutMs,
@@ -48092,10 +48170,10 @@ function registerWatchWait(watchCommand) {
48092
48170
  }
48093
48171
 
48094
48172
  // src/commands/watch/simulateDivergence.ts
48095
- import { writeFileSync as writeFileSync55 } from "fs";
48173
+ import { writeFileSync as writeFileSync56 } from "fs";
48096
48174
  function simulateDivergence() {
48097
48175
  try {
48098
- writeFileSync55(simulatedDivergencePath(), "");
48176
+ writeFileSync56(simulatedDivergencePath(), "");
48099
48177
  console.log(
48100
48178
  `the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
48101
48179
  );
@@ -48399,7 +48477,7 @@ function link2() {
48399
48477
  }
48400
48478
 
48401
48479
  // src/commands/run/add.ts
48402
- import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync56 } from "fs";
48480
+ import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync57 } from "fs";
48403
48481
  import { dirname as dirname46 } from "path";
48404
48482
 
48405
48483
  // src/commands/run/editRepoRunList.ts
@@ -48587,7 +48665,7 @@ description: Run ${name}
48587
48665
 
48588
48666
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
48589
48667
  `;
48590
- writeFileSync56(filePath, content);
48668
+ writeFileSync57(filePath, content);
48591
48669
  console.log(`Created command file: ${filePath}`);
48592
48670
  }
48593
48671
  async function add4() {
@@ -48691,7 +48769,7 @@ function registerRunAdd(runCommand) {
48691
48769
  }
48692
48770
 
48693
48771
  // src/commands/run/remove.ts
48694
- import { existsSync as existsSync89, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
48772
+ import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
48695
48773
  import { dirname as dirname47, join as join109 } from "path";
48696
48774
 
48697
48775
  // src/commands/run/removeRepoRunConfig.ts
@@ -48712,7 +48790,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
48712
48790
  function removeEmptyNamespaceDirs(filePath) {
48713
48791
  const root2 = join109(".claude", "commands");
48714
48792
  for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
48715
- if (!existsSync89(dir) || readdirSync27(dir).length > 0) return;
48793
+ if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
48716
48794
  rmdirSync(dir);
48717
48795
  }
48718
48796
  }
@@ -48720,7 +48798,7 @@ function deleteCommandFile(name) {
48720
48798
  const filePath = runCommandFilePath(name);
48721
48799
  const legacyPath = join109(".claude", "commands", `${name}.md`);
48722
48800
  for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
48723
- if (existsSync89(path109)) {
48801
+ if (existsSync90(path109)) {
48724
48802
  unlinkSync20(path109);
48725
48803
  console.log(`Deleted command file: ${path109}`);
48726
48804
  }
@@ -49443,12 +49521,12 @@ function toSessionViewInfo({
49443
49521
  }
49444
49522
 
49445
49523
  // src/commands/sessions/daemon/worktree/joinRefusal.ts
49446
- import { existsSync as existsSync90 } from "fs";
49524
+ import { existsSync as existsSync91 } from "fs";
49447
49525
  function joinRefusal(session) {
49448
49526
  if (session.commandType === "run") return "a server run has no agent stream";
49449
49527
  if (session.closing === true) return "the session is closing";
49450
49528
  if (!session.cwd) return "the session has no working directory";
49451
- if (!existsSync90(session.cwd))
49529
+ if (!existsSync91(session.cwd))
49452
49530
  return "the session's workspace no longer exists";
49453
49531
  return void 0;
49454
49532
  }
@@ -49524,7 +49602,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
49524
49602
  }
49525
49603
 
49526
49604
  // src/commands/sessions/daemon/findServerParents.ts
49527
- import { existsSync as existsSync91 } from "fs";
49605
+ import { existsSync as existsSync92 } from "fs";
49528
49606
  import { join as join110, resolve as resolve32 } from "path";
49529
49607
  function isLive(session) {
49530
49608
  return !!session.pty && session.status !== "done" && session.status !== "error";
@@ -49534,7 +49612,7 @@ function isLiveAgent(session) {
49534
49612
  }
49535
49613
  function serverRunDirs(sessions, file) {
49536
49614
  return new Set(
49537
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync91(join110(dir, file)))
49615
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join110(dir, file)))
49538
49616
  );
49539
49617
  }
49540
49618
  function findServerParents(sessions, file) {
@@ -49688,7 +49766,7 @@ function sendResizeSnapshot(s, send) {
49688
49766
  }
49689
49767
 
49690
49768
  // src/commands/sessions/daemon/viewerSize.ts
49691
- import { readFileSync as readFileSync73, writeFileSync as writeFileSync57 } from "fs";
49769
+ import { readFileSync as readFileSync73, writeFileSync as writeFileSync58 } from "fs";
49692
49770
  var DEFAULT_SIZE = { cols: 120, rows: 30 };
49693
49771
  var remembered;
49694
49772
  function rememberViewerSize(cols, rows) {
@@ -49696,7 +49774,7 @@ function rememberViewerSize(cols, rows) {
49696
49774
  if (remembered?.cols === cols && remembered.rows === rows) return;
49697
49775
  remembered = { cols, rows };
49698
49776
  try {
49699
- writeFileSync57(daemonPaths.viewerSize, JSON.stringify(remembered));
49777
+ writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
49700
49778
  } catch (error) {
49701
49779
  daemonLog(
49702
49780
  `viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
@@ -50203,11 +50281,11 @@ function sessionBase(id, status2) {
50203
50281
  }
50204
50282
 
50205
50283
  // src/commands/sessions/daemon/spawnPty.ts
50206
- import { existsSync as existsSync93 } from "fs";
50284
+ import { existsSync as existsSync94 } from "fs";
50207
50285
  import * as pty from "node-pty";
50208
50286
 
50209
50287
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
50210
- import { chmodSync, existsSync as existsSync92, statSync as statSync15 } from "fs";
50288
+ import { chmodSync, existsSync as existsSync93, statSync as statSync15 } from "fs";
50211
50289
  import { createRequire as createRequire3 } from "module";
50212
50290
  import path106 from "path";
50213
50291
  var require4 = createRequire3(import.meta.url);
@@ -50222,7 +50300,7 @@ function ensureSpawnHelperExecutable() {
50222
50300
  `${process.platform}-${process.arch}`,
50223
50301
  "spawn-helper"
50224
50302
  );
50225
- if (!existsSync92(helper)) return;
50303
+ if (!existsSync93(helper)) return;
50226
50304
  const mode = statSync15(helper).mode;
50227
50305
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
50228
50306
  }
@@ -50278,7 +50356,7 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
50278
50356
  });
50279
50357
  }
50280
50358
  function refuseMissingCwd(cwd, sessionId2) {
50281
- if (!cwd || existsSync93(cwd)) return;
50359
+ if (!cwd || existsSync94(cwd)) return;
50282
50360
  daemonLog(
50283
50361
  `${sessionId2 ? `session ${sessionId2}` : "pty"} not spawned: working directory ${cwd} no longer exists`
50284
50362
  );
@@ -50448,20 +50526,20 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
50448
50526
  }
50449
50527
 
50450
50528
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
50451
- import { existsSync as existsSync94, rmSync as rmSync13, writeFileSync as writeFileSync58 } from "fs";
50529
+ import { existsSync as existsSync95, rmSync as rmSync14, writeFileSync as writeFileSync59 } from "fs";
50452
50530
  var paused;
50453
50531
  var wake;
50454
50532
  var holdReleased = false;
50455
50533
  function persist2(value) {
50456
50534
  try {
50457
- if (value) writeFileSync58(daemonPaths.autoUpdatePaused, "");
50458
- else rmSync13(daemonPaths.autoUpdatePaused, { force: true });
50535
+ if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
50536
+ else rmSync14(daemonPaths.autoUpdatePaused, { force: true });
50459
50537
  } catch {
50460
50538
  }
50461
50539
  }
50462
50540
  var autoUpdateControl = {
50463
50541
  paused: () => {
50464
- paused ??= existsSync94(daemonPaths.autoUpdatePaused);
50542
+ paused ??= existsSync95(daemonPaths.autoUpdatePaused);
50465
50543
  return paused;
50466
50544
  },
50467
50545
  setPaused: (value) => {
@@ -50595,7 +50673,7 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
50595
50673
  }
50596
50674
 
50597
50675
  // src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
50598
- import { readFileSync as readFileSync75, writeFileSync as writeFileSync59 } from "fs";
50676
+ import { readFileSync as readFileSync75, writeFileSync as writeFileSync60 } from "fs";
50599
50677
  var KEEP_TAIL = 256 * 1024;
50600
50678
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
50601
50679
  function trimWatcherLog(cwd) {
@@ -50607,7 +50685,7 @@ function trimWatcherLog(cwd) {
50607
50685
  return;
50608
50686
  }
50609
50687
  if (log2.length <= MAX_LOG_SIZE) return;
50610
- writeFileSync59(path109, log2.slice(-KEEP_TAIL));
50688
+ writeFileSync60(path109, log2.slice(-KEEP_TAIL));
50611
50689
  daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
50612
50690
  }
50613
50691
 
@@ -50690,7 +50768,7 @@ function bindResumedWorktree(session, cwd, notify2) {
50690
50768
  }
50691
50769
 
50692
50770
  // src/commands/sessions/daemon/worktree/treeDurability.ts
50693
- import { existsSync as existsSync95 } from "fs";
50771
+ import { existsSync as existsSync96 } from "fs";
50694
50772
  var treeIsGone = { durable: true, gone: true };
50695
50773
  function treeDurability(state) {
50696
50774
  if (state.dirty) return { durable: false, reason: "uncommitted changes" };
@@ -50721,14 +50799,14 @@ function* durabilityProbes() {
50721
50799
  });
50722
50800
  }
50723
50801
  async function checkDurability(cwd) {
50724
- if (!existsSync95(cwd)) return treeIsGone;
50802
+ if (!existsSync96(cwd)) return treeIsGone;
50725
50803
  const probes = durabilityProbes();
50726
50804
  let step3 = probes.next();
50727
50805
  while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
50728
50806
  return step3.value;
50729
50807
  }
50730
50808
  function checkDurabilitySync(cwd) {
50731
- if (!existsSync95(cwd)) return treeIsGone;
50809
+ if (!existsSync96(cwd)) return treeIsGone;
50732
50810
  const probes = durabilityProbes();
50733
50811
  let step3 = probes.next();
50734
50812
  while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
@@ -50877,12 +50955,12 @@ function noteAutoUpdate(installDir, text20) {
50877
50955
 
50878
50956
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
50879
50957
  import { spawn as spawn12 } from "child_process";
50880
- import { rmSync as rmSync14 } from "fs";
50958
+ import { rmSync as rmSync15 } from "fs";
50881
50959
  function clearLapSignals(cwd) {
50882
50960
  const control = watchControlPaths(cwd);
50883
50961
  if (!control) return;
50884
50962
  for (const path109 of [control.check, control.stop])
50885
- rmSync14(path109, { force: true });
50963
+ rmSync15(path109, { force: true });
50886
50964
  }
50887
50965
  function runUpdateLap(cwd, onOutput) {
50888
50966
  clearLapSignals(cwd);
@@ -51012,11 +51090,11 @@ function setStatus2(session, newStatus) {
51012
51090
  }
51013
51091
 
51014
51092
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
51015
- import { existsSync as existsSync97 } from "fs";
51093
+ import { existsSync as existsSync98 } from "fs";
51016
51094
  import { basename as basename32 } from "path";
51017
51095
 
51018
51096
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
51019
- import { existsSync as existsSync96 } from "fs";
51097
+ import { existsSync as existsSync97 } from "fs";
51020
51098
  import { join as join113 } from "path";
51021
51099
 
51022
51100
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
@@ -51086,7 +51164,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
51086
51164
  );
51087
51165
  }
51088
51166
  function strandedReason(worktreePath, cause) {
51089
- if (!existsSync96(join113(worktreePath, ".git")))
51167
+ if (!existsSync97(join113(worktreePath, ".git")))
51090
51168
  return "its .git link is already gone";
51091
51169
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
51092
51170
  return "git no longer recognises it as a working tree";
@@ -51138,7 +51216,7 @@ function reason3(error) {
51138
51216
 
51139
51217
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
51140
51218
  async function reapWorktree(worktreePath, force = false) {
51141
- if (!existsSync97(worktreePath)) {
51219
+ if (!existsSync98(worktreePath)) {
51142
51220
  forgetWorktree(worktreePath);
51143
51221
  daemonLog(
51144
51222
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -51163,7 +51241,7 @@ async function reapWorktree(worktreePath, force = false) {
51163
51241
  }
51164
51242
  function owningClone(worktreePath) {
51165
51243
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
51166
- if (recorded && existsSync97(recorded)) return recorded;
51244
+ if (recorded && existsSync98(recorded)) return recorded;
51167
51245
  const detected = mainWorktree(worktreePath);
51168
51246
  if (detected) return detected;
51169
51247
  daemonLog(
@@ -51450,12 +51528,12 @@ async function closeBlockReason(sessionId2, tree) {
51450
51528
  }
51451
51529
 
51452
51530
  // src/commands/sessions/daemon/worktree/watchGitState.ts
51453
- import { existsSync as existsSync98, watch } from "fs";
51531
+ import { existsSync as existsSync99, watch } from "fs";
51454
51532
  var DEBOUNCE_MS = 500;
51455
51533
  var POLL_MS5 = 3e4;
51456
51534
  function watchGitState(cwd, onChange) {
51457
51535
  const common = gitCommonDir(cwd);
51458
- if (!common || !existsSync98(common)) return void 0;
51536
+ if (!common || !existsSync99(common)) return void 0;
51459
51537
  const watchers = [
51460
51538
  watchGitDir(common, onChange),
51461
51539
  pollGitState(cwd, onChange)
@@ -52178,10 +52256,10 @@ function emitSessionOutput(session, clients, data) {
52178
52256
  }
52179
52257
 
52180
52258
  // src/commands/sessions/daemon/exitReason.ts
52181
- import { existsSync as existsSync99 } from "fs";
52259
+ import { existsSync as existsSync100 } from "fs";
52182
52260
  import { resolve as resolve33 } from "path";
52183
52261
  function exitDetail(session) {
52184
- if (session.cwd && !existsSync99(session.cwd))
52262
+ if (session.cwd && !existsSync100(session.cwd))
52185
52263
  return `working directory ${session.cwd} no longer exists`;
52186
52264
  return missingRunConfigCwd(session);
52187
52265
  }
@@ -52195,7 +52273,7 @@ function missingRunConfigCwd(session) {
52195
52273
  const config = resolveRunConfig(session.runName, dir);
52196
52274
  if (!config?.cwd) return void 0;
52197
52275
  const configured = resolve33(runConfigBaseDirFrom(dir), config.cwd);
52198
- if (existsSync99(configured)) return void 0;
52276
+ if (existsSync100(configured)) return void 0;
52199
52277
  return `run config "${config.name}": cwd ${configured} does not exist`;
52200
52278
  }
52201
52279
 
@@ -52243,7 +52321,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
52243
52321
  }
52244
52322
 
52245
52323
  // src/commands/sessions/daemon/watchActivity.ts
52246
- import { existsSync as existsSync100, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
52324
+ import { existsSync as existsSync101, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
52247
52325
  import { dirname as dirname50 } from "path";
52248
52326
 
52249
52327
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -52328,7 +52406,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
52328
52406
  if (timer) clearTimeout(timer);
52329
52407
  timer = setTimeout(read3, DEBOUNCE_MS2);
52330
52408
  });
52331
- if (existsSync100(path109)) read3();
52409
+ if (existsSync101(path109)) read3();
52332
52410
  }
52333
52411
  function refreshActivity(session) {
52334
52412
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -54606,7 +54684,7 @@ function rearmStoppedSessions(sessions, notify2) {
54606
54684
  }
54607
54685
 
54608
54686
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
54609
- import { existsSync as existsSync102 } from "fs";
54687
+ import { existsSync as existsSync103 } from "fs";
54610
54688
  import { basename as basename35 } from "path";
54611
54689
 
54612
54690
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
@@ -54627,9 +54705,9 @@ function accountedTrees(sessions) {
54627
54705
  }
54628
54706
 
54629
54707
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
54630
- import { existsSync as existsSync101 } from "fs";
54708
+ import { existsSync as existsSync102 } from "fs";
54631
54709
  async function reclaimVanishedWorktrees(clone, paths) {
54632
- if (!existsSync101(clone)) {
54710
+ if (!existsSync102(clone)) {
54633
54711
  for (const { path: path109 } of paths) forgetWorktree(path109);
54634
54712
  daemonLog(
54635
54713
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
@@ -54795,7 +54873,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
54795
54873
  );
54796
54874
  continue;
54797
54875
  }
54798
- if (!existsSync102(path109)) {
54876
+ if (!existsSync103(path109)) {
54799
54877
  logVanishedTree(sessions, path109);
54800
54878
  vanished.set(clone, [
54801
54879
  ...vanished.get(clone) ?? [],
@@ -55995,7 +56073,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
55995
56073
  }
55996
56074
 
55997
56075
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
55998
- import { existsSync as existsSync105 } from "fs";
56076
+ import { existsSync as existsSync106 } from "fs";
55999
56077
 
56000
56078
  // src/commands/sessions/daemon/resumeSession.ts
56001
56079
  function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
@@ -56026,10 +56104,10 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
56026
56104
  }
56027
56105
 
56028
56106
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
56029
- import { existsSync as existsSync104 } from "fs";
56107
+ import { existsSync as existsSync105 } from "fs";
56030
56108
 
56031
56109
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
56032
- import { copyFileSync as copyFileSync4, existsSync as existsSync103, mkdirSync as mkdirSync43 } from "fs";
56110
+ import { copyFileSync as copyFileSync4, existsSync as existsSync104, mkdirSync as mkdirSync43 } from "fs";
56033
56111
  import { join as join114 } from "path";
56034
56112
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56035
56113
  const dir = projectDirForCwd(toCwd);
@@ -56040,7 +56118,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56040
56118
  return;
56041
56119
  }
56042
56120
  const dest = join114(dir, `${claudeSessionId}.jsonl`);
56043
- if (existsSync103(dest)) {
56121
+ if (existsSync104(dest)) {
56044
56122
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
56045
56123
  return;
56046
56124
  }
@@ -56091,7 +56169,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
56091
56169
  }
56092
56170
  function cloneForReapedTree(missingCwd) {
56093
56171
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
56094
- if (!clone || !existsSync104(clone))
56172
+ if (!clone || !existsSync105(clone))
56095
56173
  throw new Error(
56096
56174
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
56097
56175
  );
@@ -56100,7 +56178,7 @@ function cloneForReapedTree(missingCwd) {
56100
56178
 
56101
56179
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
56102
56180
  function resumeInTree(ctx, sessionId2, cwd, name, harness) {
56103
- if (!existsSync105(cwd))
56181
+ if (!existsSync106(cwd))
56104
56182
  return resumeInReplacementTree(ctx, sessionId2, cwd, name, harness);
56105
56183
  const id = ctx.spawnWith(
56106
56184
  (sid) => resumeSession(sid, sessionId2, cwd, name, void 0, harness)
@@ -56357,10 +56435,10 @@ function autoUpdateReply() {
56357
56435
  }
56358
56436
 
56359
56437
  // src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
56360
- import { rmSync as rmSync15, writeFileSync as writeFileSync60 } from "fs";
56438
+ import { rmSync as rmSync16, writeFileSync as writeFileSync61 } from "fs";
56361
56439
  function signalLap(installDir, marker2) {
56362
56440
  const control = watchControlPaths(installDir);
56363
- if (control) writeFileSync60(control[marker2], "");
56441
+ if (control) writeFileSync61(control[marker2], "");
56364
56442
  }
56365
56443
  function applyAutoUpdateAction(action) {
56366
56444
  const installDir = getInstallDir();
@@ -56368,7 +56446,7 @@ function applyAutoUpdateAction(action) {
56368
56446
  if (action === "resume") {
56369
56447
  if (!autoUpdateControl.paused()) return void 0;
56370
56448
  const control = watchControlPaths(installDir);
56371
- if (control) rmSync15(control.stop, { force: true });
56449
+ if (control) rmSync16(control.stop, { force: true });
56372
56450
  autoUpdateControl.setPaused(false);
56373
56451
  noteAutoUpdate(installDir, "resumed from Updates");
56374
56452
  return void 0;
@@ -57369,7 +57447,7 @@ function isPrCheckoutArgs(args) {
57369
57447
 
57370
57448
  // src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
57371
57449
  import { execFile as execFile14 } from "child_process";
57372
- import { existsSync as existsSync106 } from "fs";
57450
+ import { existsSync as existsSync107 } from "fs";
57373
57451
  function prHeadBranch2(number, cwd) {
57374
57452
  const { headBranch } = prCliCommands(number, cwd);
57375
57453
  return new Promise((resolve34) => {
@@ -57383,12 +57461,12 @@ function prHeadBranch2(number, cwd) {
57383
57461
  }
57384
57462
  async function prCheckoutHolder(assistArgs, cwd) {
57385
57463
  const number = prCheckoutNumber(assistArgs);
57386
- if (!number || !cwd || !existsSync106(cwd)) return void 0;
57464
+ if (!number || !cwd || !existsSync107(cwd)) return void 0;
57387
57465
  const headRef = await prHeadBranch2(number, cwd);
57388
57466
  if (!headRef) return void 0;
57389
57467
  const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
57390
57468
  const holder = listing ? worktreeWithBranch(listing, headRef) : null;
57391
- if (!holder || !existsSync106(holder)) return void 0;
57469
+ if (!holder || !existsSync107(holder)) return void 0;
57392
57470
  daemonLog(
57393
57471
  `pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
57394
57472
  );
@@ -57605,7 +57683,7 @@ function handleConnection(socket, manager) {
57605
57683
  }
57606
57684
 
57607
57685
  // src/commands/sessions/daemon/onListening.ts
57608
- import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync61 } from "fs";
57686
+ import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
57609
57687
 
57610
57688
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
57611
57689
  import { readFileSync as readFileSync77 } from "fs";
@@ -57627,7 +57705,7 @@ function ownsPidFile() {
57627
57705
 
57628
57706
  // src/commands/sessions/daemon/onListening.ts
57629
57707
  function onListening(manager, checkAutoExit) {
57630
- writeFileSync61(daemonPaths.pid, String(process.pid));
57708
+ writeFileSync62(daemonPaths.pid, String(process.pid));
57631
57709
  startPidFileWatchdog(() => {
57632
57710
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
57633
57711
  void manager.flushActiveMs().finally(() => {