@staff0rd/assist 0.302.2 → 0.304.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.302.2",
9
+ version: "0.304.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -425,7 +425,7 @@ function stageAndCommit(files, message) {
425
425
  function execCommit(files, message, config) {
426
426
  try {
427
427
  if (config.commit?.pull) {
428
- execSync("git pull", { stdio: "inherit" });
428
+ execSync("git pull --autostash", { stdio: "inherit" });
429
429
  }
430
430
  const sha = files.length > 0 ? stageAndCommit(files, message) : commitStaged(message);
431
431
  console.log(`Committed: ${sha}`);
@@ -1138,9 +1138,9 @@ function getSetupHandlers(hasVite, hasTypescript, hasOpenColor) {
1138
1138
  }
1139
1139
 
1140
1140
  // src/commands/verify/init/index.ts
1141
- async function runSelectedSetups(selected, packageJsonPath, writer, handlers2) {
1141
+ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
1142
1142
  for (const choice of selected) {
1143
- await handlers2[choice]?.(packageJsonPath, writer);
1143
+ await handlers[choice]?.(packageJsonPath, writer);
1144
1144
  }
1145
1145
  console.log(chalk16.green(`
1146
1146
  Added ${selected.length} verify script(s):`));
@@ -1171,12 +1171,12 @@ async function init2(options2 = {}) {
1171
1171
  const selected = await promptForScripts(getAvailableOptions(setup2));
1172
1172
  if (!selected) return;
1173
1173
  const writer = options2.packageJson ? (name, cmd, opts) => setupVerifyScript(packageJsonPath, name, cmd, opts) : setupVerifyRunEntry;
1174
- const handlers2 = getSetupHandlers(
1174
+ const handlers = getSetupHandlers(
1175
1175
  setup2.hasVite,
1176
1176
  setup2.hasTypescript,
1177
1177
  setup2.hasOpenColor
1178
1178
  );
1179
- await runSelectedSetups(selected, packageJsonPath, writer, handlers2);
1179
+ await runSelectedSetups(selected, packageJsonPath, writer, handlers);
1180
1180
  }
1181
1181
 
1182
1182
  // src/commands/vscode/init/index.ts
@@ -1339,14 +1339,14 @@ function applySelections(selected, setup2) {
1339
1339
  removeVscodeFromGitignore();
1340
1340
  ensureVscodeFolder();
1341
1341
  const launchType = setup2.hasVite ? "vite" : "tsup";
1342
- const handlers2 = {
1342
+ const handlers = {
1343
1343
  launch: () => createLaunchJson(launchType),
1344
1344
  settings: () => {
1345
1345
  createSettingsJson();
1346
1346
  createExtensionsJson();
1347
1347
  }
1348
1348
  };
1349
- for (const choice of selected) handlers2[choice]?.();
1349
+ for (const choice of selected) handlers[choice]?.();
1350
1350
  }
1351
1351
  async function promptForOptions(options2) {
1352
1352
  console.log(chalk20.bold("Available VS Code configurations to add:\n"));
@@ -1738,7 +1738,8 @@ var MACHINE_DIRECTIVES = [
1738
1738
  "prettier-ignore",
1739
1739
  "istanbul ignore",
1740
1740
  "v8 ignore",
1741
- "c8 ignore"
1741
+ "c8 ignore",
1742
+ "@vitest-environment"
1742
1743
  ];
1743
1744
  function isCommentExempt(text5, markers) {
1744
1745
  const lower = text5.toLowerCase();
@@ -2878,13 +2879,57 @@ import chalk37 from "chalk";
2878
2879
 
2879
2880
  // src/shared/spawnClaude.ts
2880
2881
  import { spawn as spawn3 } from "child_process";
2882
+
2883
+ // src/commands/sessions/daemon/ensureHooksSettings.ts
2884
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync14 } from "fs";
2885
+ import { dirname as dirname12 } from "path";
2886
+
2887
+ // src/commands/sessions/daemon/daemonPaths.ts
2888
+ import { homedir as homedir4 } from "os";
2889
+ import { join as join11 } from "path";
2890
+ var DAEMON_DIR = join11(homedir4(), ".assist", "daemon");
2891
+ var daemonPaths = {
2892
+ dir: DAEMON_DIR,
2893
+ socket: process.platform === "win32" ? String.raw`\\.\pipe\assist-sessions-daemon` : join11(DAEMON_DIR, "daemon.sock"),
2894
+ log: join11(DAEMON_DIR, "daemon.log"),
2895
+ pid: join11(DAEMON_DIR, "daemon.pid"),
2896
+ spawnLock: join11(DAEMON_DIR, "spawn.lock"),
2897
+ hooksSettings: join11(DAEMON_DIR, "hooks-settings.json")
2898
+ };
2899
+
2900
+ // src/commands/sessions/daemon/ensureHooksSettings.ts
2901
+ var RUNNING = "assist sessions set-status running";
2902
+ var WAITING = "assist sessions set-status waiting";
2903
+ function on(command) {
2904
+ return [{ hooks: [{ type: "command", command }] }];
2905
+ }
2906
+ var hooksSettings = {
2907
+ hooks: {
2908
+ UserPromptSubmit: on(RUNNING),
2909
+ PreToolUse: on(RUNNING),
2910
+ Stop: on(WAITING),
2911
+ Notification: on(WAITING)
2912
+ }
2913
+ };
2914
+ function ensureHooksSettings() {
2915
+ const path58 = daemonPaths.hooksSettings;
2916
+ mkdirSync5(dirname12(path58), { recursive: true });
2917
+ writeFileSync14(path58, JSON.stringify(hooksSettings, null, 2));
2918
+ return path58;
2919
+ }
2920
+
2921
+ // src/shared/spawnClaude.ts
2881
2922
  function withoutResumeSession(options2) {
2882
2923
  if (!options2?.resumeSessionId) return options2;
2883
2924
  const { resumeSessionId: _resumeSessionId, ...rest } = options2;
2884
2925
  return rest;
2885
2926
  }
2886
2927
  function spawnClaude(prompt, options2 = {}) {
2887
- const args = buildArgs(prompt, options2);
2928
+ const args = [
2929
+ "--settings",
2930
+ ensureHooksSettings(),
2931
+ ...buildArgs(prompt, options2)
2932
+ ];
2888
2933
  const permissionMode = options2.permissionMode ?? (options2.allowEdits ? "auto" : void 0);
2889
2934
  if (permissionMode) {
2890
2935
  args.push("--permission-mode", permissionMode);
@@ -2919,17 +2964,17 @@ import chalk32 from "chalk";
2919
2964
 
2920
2965
  // src/commands/backlog/migrateLocalBacklog.ts
2921
2966
  import { existsSync as existsSync16 } from "fs";
2922
- import { join as join12 } from "path";
2967
+ import { join as join13 } from "path";
2923
2968
  import chalk30 from "chalk";
2924
2969
 
2925
2970
  // src/commands/backlog/backupLocalBacklogFiles.ts
2926
2971
  import { existsSync as existsSync15, renameSync } from "fs";
2927
- import { join as join11 } from "path";
2972
+ import { join as join12 } from "path";
2928
2973
  var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
2929
2974
  function backupLocalBacklogFiles(dir) {
2930
2975
  const moved = [];
2931
2976
  for (const name of LOCAL_FILES) {
2932
- const path58 = join11(dir, ".assist", name);
2977
+ const path58 = join12(dir, ".assist", name);
2933
2978
  if (existsSync15(path58)) {
2934
2979
  renameSync(path58, `${path58}.bak`);
2935
2980
  moved.push(`${name} \u2192 ${name}.bak`);
@@ -3356,7 +3401,7 @@ function parseBacklogJsonl(path58) {
3356
3401
 
3357
3402
  // src/commands/backlog/migrateLocalBacklog.ts
3358
3403
  function jsonlPath(dir) {
3359
- return join12(dir, ".assist", "backlog.jsonl");
3404
+ return join13(dir, ".assist", "backlog.jsonl");
3360
3405
  }
3361
3406
  async function verifyImport(orm, origin, items2, imported) {
3362
3407
  const reloaded = await loadAllItems(orm, origin);
@@ -3610,19 +3655,19 @@ async function deleteItem(orm, id2) {
3610
3655
 
3611
3656
  // src/commands/backlog/findBacklogUp.ts
3612
3657
  import { existsSync as existsSync17 } from "fs";
3613
- import { dirname as dirname12, join as join13 } from "path";
3658
+ import { dirname as dirname13, join as join14 } from "path";
3614
3659
  var BACKLOG_MARKERS = [
3615
- join13(".assist", "backlog.db"),
3616
- join13(".assist", "backlog.jsonl"),
3660
+ join14(".assist", "backlog.db"),
3661
+ join14(".assist", "backlog.jsonl"),
3617
3662
  "assist.backlog.yml"
3618
3663
  ];
3619
3664
  function findBacklogUp(startDir) {
3620
3665
  let current = startDir;
3621
- while (current !== dirname12(current)) {
3622
- if (BACKLOG_MARKERS.some((marker) => existsSync17(join13(current, marker)))) {
3666
+ while (current !== dirname13(current)) {
3667
+ if (BACKLOG_MARKERS.some((marker) => existsSync17(join14(current, marker)))) {
3623
3668
  return current;
3624
3669
  }
3625
- current = dirname12(current);
3670
+ current = dirname13(current);
3626
3671
  }
3627
3672
  return null;
3628
3673
  }
@@ -3840,18 +3885,18 @@ async function prepareRun(id2) {
3840
3885
  }
3841
3886
 
3842
3887
  // src/commands/backlog/consumePause.ts
3843
- import { existsSync as existsSync18, mkdirSync as mkdirSync5, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "fs";
3844
- import { homedir as homedir4 } from "os";
3845
- import { join as join14 } from "path";
3888
+ import { existsSync as existsSync18, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync15 } from "fs";
3889
+ import { homedir as homedir5 } from "os";
3890
+ import { join as join15 } from "path";
3846
3891
  function getControlsDir() {
3847
- return join14(homedir4(), ".assist", "controls");
3892
+ return join15(homedir5(), ".assist", "controls");
3848
3893
  }
3849
3894
  function getPausePath(itemId) {
3850
- return join14(getControlsDir(), `pause-${itemId}.json`);
3895
+ return join15(getControlsDir(), `pause-${itemId}.json`);
3851
3896
  }
3852
3897
  function requestPause(itemId) {
3853
- mkdirSync5(getControlsDir(), { recursive: true });
3854
- writeFileSync14(
3898
+ mkdirSync6(getControlsDir(), { recursive: true });
3899
+ writeFileSync15(
3855
3900
  getPausePath(itemId),
3856
3901
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
3857
3902
  );
@@ -3893,9 +3938,9 @@ Failed to launch Claude for ${context}: ${message}`)
3893
3938
  }
3894
3939
 
3895
3940
  // src/shared/emitActivity.ts
3896
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync15 } from "fs";
3897
- import { homedir as homedir5 } from "os";
3898
- import { dirname as dirname13, join as join15 } from "path";
3941
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync16 } from "fs";
3942
+ import { homedir as homedir6 } from "os";
3943
+ import { dirname as dirname14, join as join16 } from "path";
3899
3944
  import { z as z4 } from "zod";
3900
3945
  var activitySchema = z4.object({
3901
3946
  kind: z4.enum(["command", "backlog"]),
@@ -3908,14 +3953,14 @@ var activitySchema = z4.object({
3908
3953
  startedAt: z4.number()
3909
3954
  });
3910
3955
  function activityPath(sessionId) {
3911
- return join15(homedir5(), ".assist", "activity", `activity-${sessionId}.json`);
3956
+ return join16(homedir6(), ".assist", "activity", `activity-${sessionId}.json`);
3912
3957
  }
3913
3958
  function emitActivity(activity2) {
3914
3959
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
3915
3960
  if (!sessionId) return;
3916
3961
  const path58 = activityPath(sessionId);
3917
- mkdirSync6(dirname13(path58), { recursive: true });
3918
- writeFileSync15(path58, JSON.stringify({ ...activity2, startedAt: Date.now() }));
3962
+ mkdirSync7(dirname14(path58), { recursive: true });
3963
+ writeFileSync16(path58, JSON.stringify({ ...activity2, startedAt: Date.now() }));
3919
3964
  }
3920
3965
  function readActivity(path58) {
3921
3966
  try {
@@ -3924,6 +3969,15 @@ function readActivity(path58) {
3924
3969
  return void 0;
3925
3970
  }
3926
3971
  }
3972
+ function reconcileActivity(sessionId, activity2) {
3973
+ if (!activity2) {
3974
+ removeActivity(sessionId);
3975
+ return;
3976
+ }
3977
+ const path58 = activityPath(sessionId);
3978
+ mkdirSync7(dirname14(path58), { recursive: true });
3979
+ writeFileSync16(path58, JSON.stringify(activity2));
3980
+ }
3927
3981
  function removeActivity(sessionId) {
3928
3982
  try {
3929
3983
  rmSync2(activityPath(sessionId));
@@ -4064,17 +4118,17 @@ async function handleIncompletePhase() {
4064
4118
  import { existsSync as existsSync19, readFileSync as readFileSync14 } from "fs";
4065
4119
 
4066
4120
  // src/commands/backlog/writeSignal.ts
4067
- import { writeFileSync as writeFileSync16 } from "fs";
4068
- import { join as join16 } from "path";
4121
+ import { writeFileSync as writeFileSync17 } from "fs";
4122
+ import { join as join17 } from "path";
4069
4123
  function getSignalPath() {
4070
4124
  const sessionId = process.env.ASSIST_SESSION_ID;
4071
4125
  const filename = sessionId ? `.assist-signal-${sessionId}.json` : ".assist-signal.json";
4072
- return join16(getBacklogDir(), filename);
4126
+ return join17(getBacklogDir(), filename);
4073
4127
  }
4074
4128
  function writeSignal(event, data) {
4075
4129
  const sessionId = process.env.ASSIST_SESSION_ID;
4076
4130
  const signal = { event, ...sessionId && { sessionId }, ...data };
4077
- writeFileSync16(getSignalPath(), JSON.stringify(signal));
4131
+ writeFileSync17(getSignalPath(), JSON.stringify(signal));
4078
4132
  }
4079
4133
 
4080
4134
  // src/commands/backlog/readSignal.ts
@@ -4542,10 +4596,10 @@ import { WebSocketServer } from "ws";
4542
4596
 
4543
4597
  // src/shared/getInstallDir.ts
4544
4598
  import { execSync as execSync18 } from "child_process";
4545
- import { dirname as dirname14, resolve as resolve6 } from "path";
4599
+ import { dirname as dirname15, resolve as resolve6 } from "path";
4546
4600
  import { fileURLToPath as fileURLToPath2 } from "url";
4547
4601
  var __filename2 = fileURLToPath2(import.meta.url);
4548
- var __dirname3 = dirname14(__filename2);
4602
+ var __dirname3 = dirname15(__filename2);
4549
4603
  function getInstallDir() {
4550
4604
  return resolve6(__dirname3, "..");
4551
4605
  }
@@ -4688,7 +4742,7 @@ function startWebServer(label2, port, handler, initialPath, open = true) {
4688
4742
  import { spawn as spawn4 } from "child_process";
4689
4743
  import {
4690
4744
  closeSync,
4691
- mkdirSync as mkdirSync7,
4745
+ mkdirSync as mkdirSync8,
4692
4746
  openSync,
4693
4747
  statSync,
4694
4748
  unlinkSync as unlinkSync5,
@@ -4697,20 +4751,6 @@ import {
4697
4751
 
4698
4752
  // src/commands/sessions/daemon/connectToDaemon.ts
4699
4753
  import * as net from "net";
4700
-
4701
- // src/commands/sessions/daemon/daemonPaths.ts
4702
- import { homedir as homedir6 } from "os";
4703
- import { join as join17 } from "path";
4704
- var DAEMON_DIR = join17(homedir6(), ".assist", "daemon");
4705
- var daemonPaths = {
4706
- dir: DAEMON_DIR,
4707
- socket: process.platform === "win32" ? String.raw`\\.\pipe\assist-sessions-daemon` : join17(DAEMON_DIR, "daemon.sock"),
4708
- log: join17(DAEMON_DIR, "daemon.log"),
4709
- pid: join17(DAEMON_DIR, "daemon.pid"),
4710
- spawnLock: join17(DAEMON_DIR, "spawn.lock")
4711
- };
4712
-
4713
- // src/commands/sessions/daemon/connectToDaemon.ts
4714
4754
  function connectToDaemon() {
4715
4755
  return new Promise((resolve16, reject) => {
4716
4756
  const socket = net.connect(daemonPaths.socket);
@@ -4733,7 +4773,7 @@ var RETRY_DELAY_MS = 200;
4733
4773
  var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
4734
4774
  async function ensureDaemonRunning(reason = "unspecified") {
4735
4775
  if (await isDaemonRunning()) return;
4736
- mkdirSync7(daemonPaths.dir, { recursive: true });
4776
+ mkdirSync8(daemonPaths.dir, { recursive: true });
4737
4777
  const holdsLock = acquireSpawnLock();
4738
4778
  if (holdsLock) spawnDaemon(reason);
4739
4779
  try {
@@ -4805,10 +4845,10 @@ import { createRequire as createRequire2 } from "module";
4805
4845
  // src/shared/createBundleHandler.ts
4806
4846
  import { createHash } from "crypto";
4807
4847
  import { readFileSync as readFileSync15 } from "fs";
4808
- import { dirname as dirname15, join as join18 } from "path";
4848
+ import { dirname as dirname16, join as join18 } from "path";
4809
4849
  import { fileURLToPath as fileURLToPath3 } from "url";
4810
4850
  function createBundleHandler(importMetaUrl, bundlePath) {
4811
- const dir = dirname15(fileURLToPath3(importMetaUrl));
4851
+ const dir = dirname16(fileURLToPath3(importMetaUrl));
4812
4852
  let cache;
4813
4853
  return (req, res) => {
4814
4854
  if (!cache) {
@@ -6352,7 +6392,7 @@ import chalk56 from "chalk";
6352
6392
 
6353
6393
  // src/commands/backlog/add/shared.ts
6354
6394
  import { spawnSync as spawnSync2 } from "child_process";
6355
- import { mkdtempSync, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync17 } from "fs";
6395
+ import { mkdtempSync, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
6356
6396
  import { tmpdir } from "os";
6357
6397
  import { join as join19 } from "path";
6358
6398
  import enquirer6 from "enquirer";
@@ -6396,7 +6436,7 @@ function openEditor() {
6396
6436
  const editor = process.env.EDITOR || process.env.VISUAL || "vi";
6397
6437
  const dir = mkdtempSync(join19(tmpdir(), "assist-"));
6398
6438
  const filePath = join19(dir, "description.md");
6399
- writeFileSync17(filePath, "");
6439
+ writeFileSync18(filePath, "");
6400
6440
  const result = spawnSync2(editor, [filePath], { stdio: "inherit" });
6401
6441
  if (result.status !== 0) {
6402
6442
  unlinkSync6(filePath);
@@ -7741,7 +7781,7 @@ function findBuiltinDenyRaw(rawCommand) {
7741
7781
  }
7742
7782
 
7743
7783
  // src/commands/cliHook/logDeniedToolCall.ts
7744
- import { mkdirSync as mkdirSync8 } from "fs";
7784
+ import { mkdirSync as mkdirSync9 } from "fs";
7745
7785
  import { homedir as homedir7 } from "os";
7746
7786
  import { join as join20 } from "path";
7747
7787
  import Database from "better-sqlite3";
@@ -7765,7 +7805,7 @@ function initSchema(db) {
7765
7805
  function openPromptsDb(dir) {
7766
7806
  if (_db) return _db;
7767
7807
  const dbDir = dir ?? getDbDir();
7768
- mkdirSync8(dbDir, { recursive: true });
7808
+ mkdirSync9(dbDir, { recursive: true });
7769
7809
  const db = new Database(join20(dbDir, "assist.db"));
7770
7810
  db.pragma("journal_mode = WAL");
7771
7811
  initSchema(db);
@@ -7868,11 +7908,11 @@ function extractGraphqlQuery(args) {
7868
7908
  }
7869
7909
 
7870
7910
  // src/shared/loadCliReads.ts
7871
- import { existsSync as existsSync22, readFileSync as readFileSync18, writeFileSync as writeFileSync18 } from "fs";
7872
- import { dirname as dirname16, resolve as resolve7 } from "path";
7911
+ import { existsSync as existsSync22, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "fs";
7912
+ import { dirname as dirname17, resolve as resolve7 } from "path";
7873
7913
  import { fileURLToPath as fileURLToPath4 } from "url";
7874
7914
  var __filename3 = fileURLToPath4(import.meta.url);
7875
- var __dirname4 = dirname16(__filename3);
7915
+ var __dirname4 = dirname17(__filename3);
7876
7916
  function packageRoot() {
7877
7917
  return __dirname4;
7878
7918
  }
@@ -7898,7 +7938,7 @@ function loadCliReads() {
7898
7938
  return getCliReadsLines();
7899
7939
  }
7900
7940
  function saveCliReads(commands) {
7901
- writeFileSync18(
7941
+ writeFileSync19(
7902
7942
  resolve7(packageRoot(), "allowed.cli-reads"),
7903
7943
  `${commands.join("\n")}
7904
7944
  `
@@ -8204,7 +8244,7 @@ ${reasons.join("\n")}`);
8204
8244
  }
8205
8245
 
8206
8246
  // src/commands/permitCliReads/index.ts
8207
- import { existsSync as existsSync24, mkdirSync as mkdirSync9, readFileSync as readFileSync20, writeFileSync as writeFileSync19 } from "fs";
8247
+ import { existsSync as existsSync24, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync20 } from "fs";
8208
8248
  import { homedir as homedir9 } from "os";
8209
8249
  import { join as join22 } from "path";
8210
8250
 
@@ -8504,8 +8544,8 @@ function readCache(cli) {
8504
8544
  }
8505
8545
  function writeCache(cli, output) {
8506
8546
  const dir = join22(homedir9(), ".assist");
8507
- mkdirSync9(dir, { recursive: true });
8508
- writeFileSync19(logPath(cli), output);
8547
+ mkdirSync10(dir, { recursive: true });
8548
+ writeFileSync20(logPath(cli), output);
8509
8549
  }
8510
8550
  async function permitCliReads(cli, options2 = { noCache: false }) {
8511
8551
  if (!cli) {
@@ -9312,7 +9352,7 @@ function registerConfig(program2) {
9312
9352
  }
9313
9353
 
9314
9354
  // src/commands/deploy/redirect.ts
9315
- import { existsSync as existsSync25, readFileSync as readFileSync21, writeFileSync as writeFileSync20 } from "fs";
9355
+ import { existsSync as existsSync25, readFileSync as readFileSync21, writeFileSync as writeFileSync21 } from "fs";
9316
9356
  import chalk96 from "chalk";
9317
9357
  var TRAILING_SLASH_SCRIPT = ` <script>
9318
9358
  if (!window.location.pathname.endsWith('/')) {
@@ -9337,7 +9377,7 @@ function redirect() {
9337
9377
  }
9338
9378
  const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
9339
9379
  ${content.slice(headCloseIndex)}`;
9340
- writeFileSync20(indexPath, newContent);
9380
+ writeFileSync21(indexPath, newContent);
9341
9381
  console.log(chalk96.green("Added trailing slash redirect to index.html"));
9342
9382
  }
9343
9383
 
@@ -9807,7 +9847,7 @@ function repos(options2) {
9807
9847
  }
9808
9848
 
9809
9849
  // src/commands/devlog/skip.ts
9810
- import { writeFileSync as writeFileSync21 } from "fs";
9850
+ import { writeFileSync as writeFileSync22 } from "fs";
9811
9851
  import { join as join26 } from "path";
9812
9852
  import chalk102 from "chalk";
9813
9853
  import { stringify as stringifyYaml3 } from "yaml";
@@ -9836,7 +9876,7 @@ function skip(date) {
9836
9876
  skip2[repoName] = skipDays;
9837
9877
  devlog.skip = skip2;
9838
9878
  config.devlog = devlog;
9839
- writeFileSync21(configPath, stringifyYaml3(config, { lineWidth: 0 }));
9879
+ writeFileSync22(configPath, stringifyYaml3(config, { lineWidth: 0 }));
9840
9880
  console.log(chalk102.green(`Added ${date} to skip list for ${repoName}`));
9841
9881
  }
9842
9882
 
@@ -10272,7 +10312,7 @@ import chalk110 from "chalk";
10272
10312
 
10273
10313
  // src/commands/dotnet/findSolution.ts
10274
10314
  import { readdirSync as readdirSync4 } from "fs";
10275
- import { dirname as dirname17, join as join28 } from "path";
10315
+ import { dirname as dirname18, join as join28 } from "path";
10276
10316
  import chalk109 from "chalk";
10277
10317
  function findSlnInDir(dir) {
10278
10318
  try {
@@ -10297,7 +10337,7 @@ function findSolution() {
10297
10337
  process.exit(1);
10298
10338
  }
10299
10339
  if (current === ceiling) break;
10300
- current = dirname17(current);
10340
+ current = dirname18(current);
10301
10341
  }
10302
10342
  console.error(chalk109.red("No .sln file found between cwd and repo root"));
10303
10343
  process.exit(1);
@@ -10509,7 +10549,7 @@ function aggregateCommitters(authorLists) {
10509
10549
 
10510
10550
  // src/shared/runGhGraphql.ts
10511
10551
  import { spawnSync as spawnSync3 } from "child_process";
10512
- import { unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
10552
+ import { unlinkSync as unlinkSync8, writeFileSync as writeFileSync23 } from "fs";
10513
10553
  import { tmpdir as tmpdir4 } from "os";
10514
10554
  import { join as join29 } from "path";
10515
10555
  function buildArgs2(queryFile, vars) {
@@ -10537,7 +10577,7 @@ function throwOnGraphqlErrors(stdout) {
10537
10577
  }
10538
10578
  function runGhGraphql(mutation, vars) {
10539
10579
  const queryFile = join29(tmpdir4(), `gh-query-${Date.now()}.graphql`);
10540
- writeFileSync22(queryFile, mutation);
10580
+ writeFileSync23(queryFile, mutation);
10541
10581
  try {
10542
10582
  const result = spawnSync3("gh", buildArgs2(queryFile, vars), {
10543
10583
  encoding: "utf8"
@@ -11050,7 +11090,7 @@ function acceptanceCriteria(issueKey) {
11050
11090
  import { execSync as execSync29 } from "child_process";
11051
11091
 
11052
11092
  // src/shared/loadJson.ts
11053
- import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
11093
+ import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync28, writeFileSync as writeFileSync24 } from "fs";
11054
11094
  import { homedir as homedir11 } from "os";
11055
11095
  import { join as join33 } from "path";
11056
11096
  function getStoreDir() {
@@ -11073,9 +11113,9 @@ function loadJson(filename) {
11073
11113
  function saveJson(filename, data) {
11074
11114
  const dir = getStoreDir();
11075
11115
  if (!existsSync32(dir)) {
11076
- mkdirSync10(dir, { recursive: true });
11116
+ mkdirSync11(dir, { recursive: true });
11077
11117
  }
11078
- writeFileSync23(getStorePath(filename), JSON.stringify(data, null, 2));
11118
+ writeFileSync24(getStorePath(filename), JSON.stringify(data, null, 2));
11079
11119
  }
11080
11120
 
11081
11121
  // src/shared/promptInput.ts
@@ -11210,12 +11250,12 @@ function registerList(program2) {
11210
11250
  }
11211
11251
 
11212
11252
  // src/commands/mermaid/index.ts
11213
- import { mkdirSync as mkdirSync11, readdirSync as readdirSync6 } from "fs";
11253
+ import { mkdirSync as mkdirSync12, readdirSync as readdirSync6 } from "fs";
11214
11254
  import { resolve as resolve10 } from "path";
11215
11255
  import chalk122 from "chalk";
11216
11256
 
11217
11257
  // src/commands/mermaid/exportFile.ts
11218
- import { readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
11258
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
11219
11259
  import { basename as basename6, extname, resolve as resolve9 } from "path";
11220
11260
  import chalk121 from "chalk";
11221
11261
 
@@ -11266,7 +11306,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
11266
11306
  if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
11267
11307
  const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
11268
11308
  const svg = await renderBlock(krokiUrl, source);
11269
- writeFileSync24(outPath, svg, "utf8");
11309
+ writeFileSync25(outPath, svg, "utf8");
11270
11310
  console.log(chalk121.green(` \u2192 ${outPath}`));
11271
11311
  }
11272
11312
  }
@@ -11279,7 +11319,7 @@ function extractMermaidBlocks(markdown) {
11279
11319
  async function mermaidExport(file, options2 = {}) {
11280
11320
  const { mermaid } = loadConfig();
11281
11321
  const outDir = resolve10(process.cwd(), options2.out ?? ".");
11282
- mkdirSync11(outDir, { recursive: true });
11322
+ mkdirSync12(outDir, { recursive: true });
11283
11323
  if (options2.index !== void 0) {
11284
11324
  if (!Number.isInteger(options2.index) || options2.index < 1) {
11285
11325
  console.error(
@@ -11725,7 +11765,7 @@ import { execSync as execSync33 } from "child_process";
11725
11765
 
11726
11766
  // src/commands/prs/resolveCommentWithReply.ts
11727
11767
  import { execSync as execSync32 } from "child_process";
11728
- import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync25 } from "fs";
11768
+ import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync26 } from "fs";
11729
11769
  import { tmpdir as tmpdir5 } from "os";
11730
11770
  import { join as join35 } from "path";
11731
11771
 
@@ -11762,7 +11802,7 @@ function replyToComment(org, repo, prNumber, commentId, message) {
11762
11802
  function resolveThread(threadId) {
11763
11803
  const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
11764
11804
  const queryFile = join35(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
11765
- writeFileSync25(queryFile, mutation);
11805
+ writeFileSync26(queryFile, mutation);
11766
11806
  try {
11767
11807
  execSync32(
11768
11808
  `gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
@@ -11843,19 +11883,19 @@ function fixed(commentId, sha) {
11843
11883
  }
11844
11884
 
11845
11885
  // src/commands/prs/listComments/index.ts
11846
- import { existsSync as existsSync34, mkdirSync as mkdirSync12, writeFileSync as writeFileSync27 } from "fs";
11886
+ import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
11847
11887
  import { join as join37 } from "path";
11848
11888
  import { stringify } from "yaml";
11849
11889
 
11850
11890
  // src/commands/prs/fetchThreadIds.ts
11851
11891
  import { execSync as execSync34 } from "child_process";
11852
- import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync26 } from "fs";
11892
+ import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync27 } from "fs";
11853
11893
  import { tmpdir as tmpdir6 } from "os";
11854
11894
  import { join as join36 } from "path";
11855
11895
  var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
11856
11896
  function fetchThreadIds(org, repo, prNumber) {
11857
11897
  const queryFile = join36(tmpdir6(), `gh-query-${Date.now()}.graphql`);
11858
- writeFileSync26(queryFile, THREAD_QUERY);
11898
+ writeFileSync27(queryFile, THREAD_QUERY);
11859
11899
  try {
11860
11900
  const result = execSync34(
11861
11901
  `gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
@@ -11970,7 +12010,7 @@ function printComments2(result) {
11970
12010
  function writeCommentsCache(prNumber, comments3) {
11971
12011
  const assistDir = join37(process.cwd(), ".assist");
11972
12012
  if (!existsSync34(assistDir)) {
11973
- mkdirSync12(assistDir, { recursive: true });
12013
+ mkdirSync13(assistDir, { recursive: true });
11974
12014
  }
11975
12015
  const cacheData = {
11976
12016
  prNumber,
@@ -11978,7 +12018,7 @@ function writeCommentsCache(prNumber, comments3) {
11978
12018
  comments: comments3
11979
12019
  };
11980
12020
  const cachePath = join37(assistDir, `pr-${prNumber}-comments.yaml`);
11981
- writeFileSync27(cachePath, stringify(cacheData));
12021
+ writeFileSync28(cachePath, stringify(cacheData));
11982
12022
  }
11983
12023
  function handleKnownErrors(error) {
11984
12024
  if (isGhNotInstalled(error)) {
@@ -15037,16 +15077,16 @@ async function handlePostSynthesis(synthesisPath, options2) {
15037
15077
  }
15038
15078
 
15039
15079
  // src/commands/review/prepareReviewDir.ts
15040
- import { existsSync as existsSync35, mkdirSync as mkdirSync13, unlinkSync as unlinkSync12, writeFileSync as writeFileSync28 } from "fs";
15080
+ import { existsSync as existsSync35, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
15041
15081
  function clearReviewFiles(paths) {
15042
15082
  for (const path58 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
15043
15083
  if (existsSync35(path58)) unlinkSync12(path58);
15044
15084
  }
15045
15085
  }
15046
15086
  function prepareReviewDir(paths, requestBody, force) {
15047
- mkdirSync13(paths.reviewDir, { recursive: true });
15087
+ mkdirSync14(paths.reviewDir, { recursive: true });
15048
15088
  if (force) clearReviewFiles(paths);
15049
- writeFileSync28(paths.requestPath, requestBody);
15089
+ writeFileSync29(paths.requestPath, requestBody);
15050
15090
  }
15051
15091
 
15052
15092
  // src/commands/review/runApplySession.ts
@@ -15391,7 +15431,7 @@ The review request is at: ${requestPath}
15391
15431
  }
15392
15432
 
15393
15433
  // src/commands/review/runClaudeReviewer.ts
15394
- import { writeFileSync as writeFileSync29 } from "fs";
15434
+ import { writeFileSync as writeFileSync30 } from "fs";
15395
15435
 
15396
15436
  // src/commands/review/finaliseReviewerSpinner.ts
15397
15437
  var SUMMARY_MAX_LEN = 80;
@@ -15727,7 +15767,7 @@ async function runClaudeReviewer(spec) {
15727
15767
  }
15728
15768
  });
15729
15769
  if (result.exitCode === 0 && finalText)
15730
- writeFileSync29(spec.outputPath, finalText);
15770
+ writeFileSync30(spec.outputPath, finalText);
15731
15771
  return finaliseReviewerRun({ ...spec, command }, spinner, result);
15732
15772
  }
15733
15773
 
@@ -16838,7 +16878,7 @@ async function configure() {
16838
16878
  import { existsSync as existsSync40 } from "fs";
16839
16879
 
16840
16880
  // src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
16841
- import { dirname as dirname19, join as join41 } from "path";
16881
+ import { dirname as dirname20, join as join41 } from "path";
16842
16882
 
16843
16883
  // src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
16844
16884
  import { renameSync as renameSync2 } from "fs";
@@ -16888,11 +16928,11 @@ async function fixInvalidDatePrefixes(vttFiles) {
16888
16928
  for (let i = 0; i < vttFiles.length; i++) {
16889
16929
  const vttFile = vttFiles[i];
16890
16930
  if (!isValidDatePrefix(vttFile.filename)) {
16891
- const vttFileDir = dirname19(vttFile.absolutePath);
16931
+ const vttFileDir = dirname20(vttFile.absolutePath);
16892
16932
  const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
16893
16933
  if (newFilename) {
16894
16934
  const newRelativePath = join41(
16895
- dirname19(vttFile.relativePath),
16935
+ dirname20(vttFile.relativePath),
16896
16936
  newFilename
16897
16937
  );
16898
16938
  vttFiles[i] = {
@@ -16909,8 +16949,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
16909
16949
  }
16910
16950
 
16911
16951
  // src/commands/transcript/format/processVttFile/index.ts
16912
- import { existsSync as existsSync39, mkdirSync as mkdirSync14, readFileSync as readFileSync33, writeFileSync as writeFileSync30 } from "fs";
16913
- import { basename as basename9, dirname as dirname20, join as join42 } from "path";
16952
+ import { existsSync as existsSync39, mkdirSync as mkdirSync15, readFileSync as readFileSync33, writeFileSync as writeFileSync31 } from "fs";
16953
+ import { basename as basename9, dirname as dirname21, join as join42 } from "path";
16914
16954
 
16915
16955
  // src/commands/transcript/cleanText.ts
16916
16956
  function cleanText(text5) {
@@ -17124,7 +17164,7 @@ function resolveOutputDir(relativeDir, transcriptsDir) {
17124
17164
  }
17125
17165
  function buildOutputPaths(vttFile, transcriptsDir) {
17126
17166
  const mdFile = toMdFilename(vttFile.filename);
17127
- const relativeDir = dirname20(vttFile.relativePath);
17167
+ const relativeDir = dirname21(vttFile.relativePath);
17128
17168
  const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
17129
17169
  const outputPath = join42(outputDir, mdFile);
17130
17170
  return { outputDir, outputPath, mdFile, relativeDir };
@@ -17135,7 +17175,7 @@ function logSkipped(relativeDir, mdFile) {
17135
17175
  }
17136
17176
  function ensureDirectory(dir, label2) {
17137
17177
  if (!existsSync39(dir)) {
17138
- mkdirSync14(dir, { recursive: true });
17178
+ mkdirSync15(dir, { recursive: true });
17139
17179
  console.log(`Created ${label2}: ${dir}`);
17140
17180
  }
17141
17181
  }
@@ -17160,7 +17200,7 @@ function readAndParseCues(inputPath) {
17160
17200
  return processCues(readFileSync33(inputPath, "utf8"));
17161
17201
  }
17162
17202
  function writeFormatted(outputPath, content) {
17163
- writeFileSync30(outputPath, content, "utf8");
17203
+ writeFileSync31(outputPath, content, "utf8");
17164
17204
  console.log(`Written: ${outputPath}`);
17165
17205
  }
17166
17206
  function convertVttToMarkdown(inputPath, outputPath) {
@@ -17229,17 +17269,17 @@ async function format() {
17229
17269
 
17230
17270
  // src/commands/transcript/summarise/index.ts
17231
17271
  import { existsSync as existsSync42 } from "fs";
17232
- import { basename as basename10, dirname as dirname22, join as join44, relative as relative3 } from "path";
17272
+ import { basename as basename10, dirname as dirname23, join as join44, relative as relative3 } from "path";
17233
17273
 
17234
17274
  // src/commands/transcript/summarise/processStagedFile/index.ts
17235
17275
  import {
17236
17276
  existsSync as existsSync41,
17237
- mkdirSync as mkdirSync15,
17277
+ mkdirSync as mkdirSync16,
17238
17278
  readFileSync as readFileSync34,
17239
17279
  renameSync as renameSync3,
17240
17280
  rmSync as rmSync4
17241
17281
  } from "fs";
17242
- import { dirname as dirname21, join as join43 } from "path";
17282
+ import { dirname as dirname22, join as join43 } from "path";
17243
17283
 
17244
17284
  // src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
17245
17285
  import chalk165 from "chalk";
@@ -17293,9 +17333,9 @@ function processStagedFile() {
17293
17333
  process.exit(1);
17294
17334
  }
17295
17335
  const destPath = join43(summaryDir, matchingTranscript.relativePath);
17296
- const destDir = dirname21(destPath);
17336
+ const destDir = dirname22(destPath);
17297
17337
  if (!existsSync41(destDir)) {
17298
- mkdirSync15(destDir, { recursive: true });
17338
+ mkdirSync16(destDir, { recursive: true });
17299
17339
  }
17300
17340
  renameSync3(stagedFile.absolutePath, destPath);
17301
17341
  const remaining = findMdFilesRecursive(STAGING_DIR);
@@ -17307,7 +17347,7 @@ function processStagedFile() {
17307
17347
 
17308
17348
  // src/commands/transcript/summarise/index.ts
17309
17349
  function buildRelativeKey(relativePath, baseName) {
17310
- const relDir = dirname22(relativePath);
17350
+ const relDir = dirname23(relativePath);
17311
17351
  return relDir === "." ? baseName : join44(relDir, baseName);
17312
17352
  }
17313
17353
  function buildSummaryIndex(summaryDir) {
@@ -17343,7 +17383,7 @@ function summarise2() {
17343
17383
  const next3 = missing[0];
17344
17384
  const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
17345
17385
  const outputPath = join44(STAGING_DIR, outputFilename);
17346
- const summaryFileDir = join44(summaryDir, dirname22(next3.relativePath));
17386
+ const summaryFileDir = join44(summaryDir, dirname23(next3.relativePath));
17347
17387
  const relativeTranscriptPath = encodeURI(
17348
17388
  relative3(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
17349
17389
  );
@@ -17397,9 +17437,9 @@ import { join as join46 } from "path";
17397
17437
 
17398
17438
  // src/commands/voice/shared.ts
17399
17439
  import { homedir as homedir13 } from "os";
17400
- import { dirname as dirname23, join as join45 } from "path";
17440
+ import { dirname as dirname24, join as join45 } from "path";
17401
17441
  import { fileURLToPath as fileURLToPath5 } from "url";
17402
- var __dirname5 = dirname23(fileURLToPath5(import.meta.url));
17442
+ var __dirname5 = dirname24(fileURLToPath5(import.meta.url));
17403
17443
  var VOICE_DIR = join45(homedir13(), ".assist", "voice");
17404
17444
  var voicePaths = {
17405
17445
  dir: VOICE_DIR,
@@ -17458,12 +17498,12 @@ function logs(options2) {
17458
17498
 
17459
17499
  // src/commands/voice/setup.ts
17460
17500
  import { spawnSync as spawnSync6 } from "child_process";
17461
- import { mkdirSync as mkdirSync17 } from "fs";
17501
+ import { mkdirSync as mkdirSync18 } from "fs";
17462
17502
  import { join as join48 } from "path";
17463
17503
 
17464
17504
  // src/commands/voice/checkLockFile.ts
17465
17505
  import { execSync as execSync46 } from "child_process";
17466
- import { existsSync as existsSync44, mkdirSync as mkdirSync16, readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
17506
+ import { existsSync as existsSync44, mkdirSync as mkdirSync17, readFileSync as readFileSync36, writeFileSync as writeFileSync32 } from "fs";
17467
17507
  import { join as join47 } from "path";
17468
17508
  function isProcessAlive2(pid) {
17469
17509
  try {
@@ -17501,8 +17541,8 @@ function bootstrapVenv() {
17501
17541
  }
17502
17542
  function writeLockFile(pid) {
17503
17543
  const lockFile = getLockFile();
17504
- mkdirSync16(join47(lockFile, ".."), { recursive: true });
17505
- writeFileSync31(
17544
+ mkdirSync17(join47(lockFile, ".."), { recursive: true });
17545
+ writeFileSync32(
17506
17546
  lockFile,
17507
17547
  JSON.stringify({
17508
17548
  pid,
@@ -17514,7 +17554,7 @@ function writeLockFile(pid) {
17514
17554
 
17515
17555
  // src/commands/voice/setup.ts
17516
17556
  function setup() {
17517
- mkdirSync17(voicePaths.dir, { recursive: true });
17557
+ mkdirSync18(voicePaths.dir, { recursive: true });
17518
17558
  bootstrapVenv();
17519
17559
  console.log("\nDownloading models...\n");
17520
17560
  const script = join48(getPythonDir(), "setup_models.py");
@@ -17530,7 +17570,7 @@ function setup() {
17530
17570
 
17531
17571
  // src/commands/voice/start.ts
17532
17572
  import { spawn as spawn7 } from "child_process";
17533
- import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync32 } from "fs";
17573
+ import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
17534
17574
  import { join as join49 } from "path";
17535
17575
 
17536
17576
  // src/commands/voice/buildDaemonEnv.ts
@@ -17559,12 +17599,12 @@ function spawnBackground(python, script, env) {
17559
17599
  console.error("Failed to start voice daemon");
17560
17600
  process.exit(1);
17561
17601
  }
17562
- writeFileSync32(voicePaths.pid, String(pid));
17602
+ writeFileSync33(voicePaths.pid, String(pid));
17563
17603
  writeLockFile(pid);
17564
17604
  console.log(`Voice daemon started (PID ${pid})`);
17565
17605
  }
17566
17606
  function start2(options2) {
17567
- mkdirSync18(voicePaths.dir, { recursive: true });
17607
+ mkdirSync19(voicePaths.dir, { recursive: true });
17568
17608
  checkLockFile();
17569
17609
  bootstrapVenv();
17570
17610
  const debug = options2.debug || options2.foreground || process.platform === "win32";
@@ -17983,12 +18023,12 @@ function runPreCommands(pre, cwd) {
17983
18023
  // src/commands/run/spawnRunCommand.ts
17984
18024
  import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
17985
18025
  import { existsSync as existsSync47 } from "fs";
17986
- import { dirname as dirname24, join as join51, resolve as resolve11 } from "path";
18026
+ import { dirname as dirname25, join as join51, resolve as resolve11 } from "path";
17987
18027
  function resolveCommand2(command) {
17988
18028
  if (process.platform !== "win32" || command !== "bash") return command;
17989
18029
  try {
17990
18030
  const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
17991
- const gitRoot = resolve11(dirname24(gitPath), "..");
18031
+ const gitRoot = resolve11(dirname25(gitPath), "..");
17992
18032
  const gitBash = join51(gitRoot, "bin", "bash.exe");
17993
18033
  if (existsSync47(gitBash)) return gitBash;
17994
18034
  } catch {
@@ -18075,7 +18115,7 @@ async function run3(name, args) {
18075
18115
  }
18076
18116
 
18077
18117
  // src/commands/run/add.ts
18078
- import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
18118
+ import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync34 } from "fs";
18079
18119
  import { join as join52 } from "path";
18080
18120
 
18081
18121
  // src/commands/run/extractOption.ts
@@ -18138,7 +18178,7 @@ function saveNewRunConfig(name, command, args, cwd) {
18138
18178
  }
18139
18179
  function createCommandFile(name) {
18140
18180
  const dir = join52(".claude", "commands");
18141
- mkdirSync19(dir, { recursive: true });
18181
+ mkdirSync20(dir, { recursive: true });
18142
18182
  const content = `---
18143
18183
  description: Run ${name}
18144
18184
  ---
@@ -18146,7 +18186,7 @@ description: Run ${name}
18146
18186
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
18147
18187
  `;
18148
18188
  const filePath = join52(dir, `${name}.md`);
18149
- writeFileSync33(filePath, content);
18189
+ writeFileSync34(filePath, content);
18150
18190
  console.log(`Created command file: ${filePath}`);
18151
18191
  }
18152
18192
  function add3() {
@@ -18257,7 +18297,7 @@ function registerRun(program2) {
18257
18297
 
18258
18298
  // src/commands/screenshot/index.ts
18259
18299
  import { execSync as execSync48 } from "child_process";
18260
- import { existsSync as existsSync49, mkdirSync as mkdirSync20, unlinkSync as unlinkSync17, writeFileSync as writeFileSync34 } from "fs";
18300
+ import { existsSync as existsSync49, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync35 } from "fs";
18261
18301
  import { tmpdir as tmpdir7 } from "os";
18262
18302
  import { join as join54, resolve as resolve13 } from "path";
18263
18303
  import chalk167 from "chalk";
@@ -18390,14 +18430,14 @@ Write-Output $OutputPath
18390
18430
  // src/commands/screenshot/index.ts
18391
18431
  function buildOutputPath(outputDir, processName) {
18392
18432
  if (!existsSync49(outputDir)) {
18393
- mkdirSync20(outputDir, { recursive: true });
18433
+ mkdirSync21(outputDir, { recursive: true });
18394
18434
  }
18395
18435
  const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
18396
18436
  return resolve13(outputDir, `${processName}-${timestamp2}.png`);
18397
18437
  }
18398
18438
  function runPowerShellScript(processName, outputPath) {
18399
18439
  const scriptPath = join54(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
18400
- writeFileSync34(scriptPath, captureWindowPs1, "utf8");
18440
+ writeFileSync35(scriptPath, captureWindowPs1, "utf8");
18401
18441
  try {
18402
18442
  execSync48(
18403
18443
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
@@ -18526,7 +18566,7 @@ function reportStrays(pids) {
18526
18566
  }
18527
18567
 
18528
18568
  // src/commands/sessions/daemon/runDaemon.ts
18529
- import { mkdirSync as mkdirSync22 } from "fs";
18569
+ import { mkdirSync as mkdirSync23 } from "fs";
18530
18570
 
18531
18571
  // src/commands/sessions/daemon/createAutoExit.ts
18532
18572
  var DEFAULT_GRACE_MS = 6e4;
@@ -18796,8 +18836,6 @@ function createAssistSession(id2, assistArgs, cwd) {
18796
18836
  startedAt: Date.now(),
18797
18837
  pty: spawnPty(["assist", ...assistArgs], cwd, id2),
18798
18838
  scrollback: "",
18799
- idleTimer: null,
18800
- lastResizeAt: 0,
18801
18839
  assistArgs,
18802
18840
  cwd
18803
18841
  };
@@ -18805,12 +18843,15 @@ function createAssistSession(id2, assistArgs, cwd) {
18805
18843
 
18806
18844
  // src/commands/sessions/daemon/spawnClaude.ts
18807
18845
  function spawnClaude2(opts = {}) {
18808
- return spawnPty(buildArgs3(opts), opts.cwd);
18846
+ return spawnPty(buildArgs3(opts), opts.cwd, opts.sessionId);
18809
18847
  }
18810
18848
  function buildArgs3(opts) {
18811
- if (opts.resumeSessionId) return ["claude", "--resume", opts.resumeSessionId];
18812
- if (opts.prompt) return ["claude", opts.prompt];
18813
- return ["claude"];
18849
+ const base = ["claude", "--settings", ensureHooksSettings()];
18850
+ if (opts.resumeSessionId) {
18851
+ return opts.prompt ? [...base, "--resume", opts.resumeSessionId, opts.prompt] : [...base, "--resume", opts.resumeSessionId];
18852
+ }
18853
+ if (opts.prompt) return [...base, opts.prompt];
18854
+ return base;
18814
18855
  }
18815
18856
 
18816
18857
  // src/commands/sessions/daemon/spawnRun.ts
@@ -18826,10 +18867,8 @@ function createSession(id2, prompt, cwd) {
18826
18867
  commandType: "claude",
18827
18868
  status: "running",
18828
18869
  startedAt: Date.now(),
18829
- pty: spawnClaude2({ prompt, cwd }),
18870
+ pty: spawnClaude2({ prompt, cwd, sessionId: id2 }),
18830
18871
  scrollback: "",
18831
- idleTimer: null,
18832
- lastResizeAt: 0,
18833
18872
  cwd
18834
18873
  };
18835
18874
  }
@@ -18842,8 +18881,6 @@ function createRunSession(id2, runName, runArgs, cwd) {
18842
18881
  startedAt: Date.now(),
18843
18882
  pty: spawnRun({ name: runName, args: runArgs, cwd }),
18844
18883
  scrollback: "",
18845
- idleTimer: null,
18846
- lastResizeAt: 0,
18847
18884
  runName,
18848
18885
  runArgs,
18849
18886
  cwd
@@ -18868,7 +18905,11 @@ function greetClient(client, sessions, windowsProxy) {
18868
18905
  // src/commands/sessions/daemon/shouldAutoDismiss.ts
18869
18906
  function shouldAutoDismiss(session, exitCode) {
18870
18907
  const args = session.assistArgs;
18871
- return session.status === "done" && exitCode === 0 && args !== void 0 && args.includes("--once") && args[0] !== "next";
18908
+ if (session.status !== "done" || exitCode !== 0 || args === void 0) {
18909
+ return false;
18910
+ }
18911
+ if (args[0] === "update") return true;
18912
+ return args.includes("--once") && args[0] !== "next";
18872
18913
  }
18873
18914
 
18874
18915
  // src/commands/sessions/daemon/shouldAutoRun.ts
@@ -18883,6 +18924,8 @@ function shouldAutoRun(session, exitCode) {
18883
18924
 
18884
18925
  // src/commands/sessions/daemon/applyStatusChange.ts
18885
18926
  function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseForRun) {
18927
+ if (session.status === status2) return;
18928
+ daemonLog(`session ${session.id} status: ${session.status} -> ${status2}`);
18886
18929
  session.status = status2;
18887
18930
  if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null) {
18888
18931
  reuseForRun(session, session.activity.itemId);
@@ -18905,8 +18948,6 @@ function restoreBase(id2, persisted) {
18905
18948
  name: persisted.name,
18906
18949
  commandType: persisted.commandType,
18907
18950
  scrollback: "",
18908
- idleTimer: null,
18909
- lastResizeAt: 0,
18910
18951
  cwd: persisted.cwd,
18911
18952
  assistArgs: persisted.assistArgs
18912
18953
  };
@@ -18955,7 +18996,9 @@ function restoreSession(id2, persisted) {
18955
18996
  if (persisted.commandType !== "run" && persisted.claudeSessionId) {
18956
18997
  const pty2 = spawnClaude2({
18957
18998
  resumeSessionId: persisted.claudeSessionId,
18958
- cwd: persisted.cwd
18999
+ prompt: buildResumePrompt(),
19000
+ cwd: persisted.cwd,
19001
+ sessionId: id2
18959
19002
  });
18960
19003
  return runningSession(base, persisted, pty2);
18961
19004
  }
@@ -19002,6 +19045,14 @@ function logRestoreError(name, error) {
19002
19045
  return reason;
19003
19046
  }
19004
19047
 
19048
+ // src/commands/sessions/daemon/restoreAll.ts
19049
+ function restoreAll(spawn12, sessions) {
19050
+ return loadPersistedSessions().map((persisted) => {
19051
+ restoreOne(persisted, spawn12, sessions);
19052
+ return persisted.name;
19053
+ });
19054
+ }
19055
+
19005
19056
  // src/commands/sessions/daemon/resumeSession.ts
19006
19057
  function resumeSession(id2, sessionId, cwd, name) {
19007
19058
  return {
@@ -19010,40 +19061,26 @@ function resumeSession(id2, sessionId, cwd, name) {
19010
19061
  commandType: "claude",
19011
19062
  status: "running",
19012
19063
  startedAt: Date.now(),
19013
- pty: spawnClaude2({ resumeSessionId: sessionId, cwd }),
19064
+ pty: spawnClaude2({ resumeSessionId: sessionId, cwd, sessionId: id2 }),
19014
19065
  scrollback: "",
19015
- idleTimer: null,
19016
- lastResizeAt: 0,
19017
19066
  cwd
19018
19067
  };
19019
19068
  }
19020
19069
 
19021
- // src/commands/sessions/daemon/scheduleIdle.ts
19022
- var IDLE_MS = 3e3;
19023
- function scheduleIdle(session, onIdle) {
19024
- if (session.idleTimer) clearTimeout(session.idleTimer);
19025
- if (session.status === "done") return;
19026
- session.idleTimer = setTimeout(() => {
19027
- if (session.status === "running") onIdle();
19028
- }, IDLE_MS);
19029
- }
19030
- function clearIdle(session) {
19031
- if (session.idleTimer) clearTimeout(session.idleTimer);
19032
- }
19033
-
19034
19070
  // src/commands/sessions/daemon/watchActivity.ts
19035
- import { existsSync as existsSync51, mkdirSync as mkdirSync21, watch } from "fs";
19036
- import { dirname as dirname25 } from "path";
19071
+ import { existsSync as existsSync51, mkdirSync as mkdirSync22, watch } from "fs";
19072
+ import { dirname as dirname26 } from "path";
19037
19073
  var DEBOUNCE_MS = 50;
19038
19074
  function watchActivity(session, notify2) {
19039
19075
  if (session.commandType !== "assist" || !session.cwd) return;
19040
19076
  const path58 = activityPath(session.id);
19041
- const dir = dirname25(path58);
19077
+ const dir = dirname26(path58);
19042
19078
  try {
19043
- mkdirSync21(dir, { recursive: true });
19079
+ mkdirSync22(dir, { recursive: true });
19044
19080
  } catch {
19045
19081
  return;
19046
19082
  }
19083
+ if (session.restored) reconcileActivity(session.id, session.activity);
19047
19084
  let timer = null;
19048
19085
  const read = () => {
19049
19086
  timer = null;
@@ -19072,7 +19109,6 @@ function refreshActivity(session) {
19072
19109
 
19073
19110
  // src/commands/sessions/daemon/wirePtyEvents.ts
19074
19111
  var MAX_SCROLLBACK = 256 * 1024;
19075
- var RESIZE_GRACE_MS = 500;
19076
19112
  function appendScrollback(session, data) {
19077
19113
  session.scrollback += data;
19078
19114
  if (session.scrollback.length > MAX_SCROLLBACK) {
@@ -19083,15 +19119,9 @@ function wirePtyEvents(session, clients, onStatusChange) {
19083
19119
  if (!session.pty) return;
19084
19120
  session.pty.onData((data) => {
19085
19121
  appendScrollback(session, data);
19086
- const isRedraw = Date.now() - session.lastResizeAt < RESIZE_GRACE_MS;
19087
- if (!isRedraw && session.status !== "running")
19088
- onStatusChange(session, "running");
19089
- if (!isRedraw)
19090
- scheduleIdle(session, () => onStatusChange(session, "waiting"));
19091
19122
  broadcast(clients, { type: "output", sessionId: session.id, data });
19092
19123
  });
19093
19124
  session.pty.onExit(({ exitCode }) => {
19094
- clearIdle(session);
19095
19125
  refreshActivity(session);
19096
19126
  const failedResume = session.restored === true && exitCode !== 0 && session.scrollback.length === 0;
19097
19127
  if (failedResume) {
@@ -19102,7 +19132,6 @@ function wirePtyEvents(session, clients, onStatusChange) {
19102
19132
  }
19103
19133
  onStatusChange(session, failedResume ? "error" : "done", exitCode);
19104
19134
  });
19105
- scheduleIdle(session, () => onStatusChange(session, "waiting"));
19106
19135
  }
19107
19136
 
19108
19137
  // src/commands/sessions/daemon/retrySession.ts
@@ -19110,7 +19139,6 @@ function retrySession(session, clients, onStatusChange) {
19110
19139
  const respawn = respawnThunk(session);
19111
19140
  if (!respawn) return false;
19112
19141
  if (session.status !== "done") session.pty?.kill();
19113
- clearIdle(session);
19114
19142
  session.scrollback = "";
19115
19143
  session.status = "running";
19116
19144
  session.startedAt = Date.now();
@@ -19133,7 +19161,6 @@ function respawnThunk(session) {
19133
19161
  function reuseSessionForRun(session, itemId, clients, onStatusChange) {
19134
19162
  const assistArgs = ["backlog", "run", String(itemId)];
19135
19163
  if (session.status !== "done") session.pty?.kill();
19136
- clearIdle(session);
19137
19164
  session.assistArgs = assistArgs;
19138
19165
  session.name = `assist ${assistArgs.join(" ")}`;
19139
19166
  session.commandType = "assist";
@@ -19147,7 +19174,6 @@ function reuseSessionForRun(session, itemId, clients, onStatusChange) {
19147
19174
  // src/commands/sessions/daemon/shutdownSessions.ts
19148
19175
  function shutdownSessions(sessions) {
19149
19176
  for (const session of sessions.values()) {
19150
- clearIdle(session);
19151
19177
  if (session.status !== "done") session.pty?.kill();
19152
19178
  }
19153
19179
  }
@@ -19941,10 +19967,7 @@ function writeToSession(sessions, id2, data) {
19941
19967
  }
19942
19968
  function resizeSession(sessions, id2, cols, rows) {
19943
19969
  const s = sessions.get(id2);
19944
- if (s && s.status !== "done") {
19945
- s.lastResizeAt = Date.now();
19946
- s.pty?.resize(cols, rows);
19947
- }
19970
+ if (s && s.status !== "done") s.pty?.resize(cols, rows);
19948
19971
  }
19949
19972
  function setAutoRun(sessions, id2, enabled) {
19950
19973
  const s = sessions.get(id2);
@@ -19967,7 +19990,6 @@ function dismissSession(sessions, id2) {
19967
19990
  const s = sessions.get(id2);
19968
19991
  if (!s) return false;
19969
19992
  if (s.status !== "done") s.pty?.kill();
19970
- clearIdle(s);
19971
19993
  s.activityWatcher?.close();
19972
19994
  removeActivity(s.id);
19973
19995
  if (s.activity?.itemId != null) releaseLock(s.activity.itemId);
@@ -20003,10 +20025,7 @@ var SessionManager = class {
20003
20025
  shutdownSessions(this.sessions);
20004
20026
  }
20005
20027
  restore() {
20006
- return loadPersistedSessions().map((persisted) => {
20007
- restoreOne(persisted, this.spawnWith, this.sessions);
20008
- return persisted.name;
20009
- });
20028
+ return restoreAll(this.spawnWith, this.sessions);
20010
20029
  }
20011
20030
  add(session) {
20012
20031
  this.wire(session);
@@ -20056,6 +20075,10 @@ var SessionManager = class {
20056
20075
  setAutoAdvance(id2, enabled) {
20057
20076
  if (setAutoAdvance(this.sessions, id2, enabled)) this.notify();
20058
20077
  }
20078
+ setStatus(id2, status2) {
20079
+ const session = this.sessions.get(id2);
20080
+ if (session) this.onStatusChange(session, status2);
20081
+ }
20059
20082
  listSessions = () => {
20060
20083
  const local = [...this.sessions.values()].map(toSessionInfo);
20061
20084
  return local.concat(this.windowsProxy.sessions());
@@ -20166,7 +20189,7 @@ function safeParse2(line) {
20166
20189
  }
20167
20190
  }
20168
20191
 
20169
- // src/commands/sessions/daemon/dispatchMessage.ts
20192
+ // src/commands/sessions/daemon/messageHandlers.ts
20170
20193
  function creator(isNew, spawn12) {
20171
20194
  return (client, m, d) => {
20172
20195
  if (m.windowsProxy.route(client, d)) return;
@@ -20194,7 +20217,7 @@ function routed(local) {
20194
20217
  if (!m.windowsProxy.route(client, d)) local(client, m, d);
20195
20218
  };
20196
20219
  }
20197
- var handlers = {
20220
+ var messageHandlers = {
20198
20221
  ping: (client) => sendTo(client, { type: "pong", pid: process.pid }),
20199
20222
  hello: (client) => sendTo(client, buildHello()),
20200
20223
  create: creator(
@@ -20242,10 +20265,15 @@ var handlers = {
20242
20265
  "set-autoadvance": routed(
20243
20266
  (_client, m, d) => m.setAutoAdvance(d.sessionId, d.enabled)
20244
20267
  ),
20245
- "set-active": (_client, m, d) => m.active.set(d.cwd, d.sessionId)
20268
+ "set-active": (_client, m, d) => m.active.set(d.cwd, d.sessionId),
20269
+ "set-status": routed(
20270
+ (_client, m, d) => m.setStatus(d.sessionId, d.status)
20271
+ )
20246
20272
  };
20273
+
20274
+ // src/commands/sessions/daemon/dispatchMessage.ts
20247
20275
  function dispatchMessage(client, manager, data) {
20248
- handlers[data.type]?.(client, manager, data);
20276
+ messageHandlers[data.type]?.(client, manager, data);
20249
20277
  }
20250
20278
 
20251
20279
  // src/commands/sessions/daemon/handleConnection.ts
@@ -20283,7 +20311,7 @@ function handleConnection(socket, manager) {
20283
20311
  }
20284
20312
 
20285
20313
  // src/commands/sessions/daemon/onListening.ts
20286
- import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync35 } from "fs";
20314
+ import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync36 } from "fs";
20287
20315
 
20288
20316
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
20289
20317
  import { readFileSync as readFileSync41 } from "fs";
@@ -20305,7 +20333,7 @@ function ownsPidFile() {
20305
20333
 
20306
20334
  // src/commands/sessions/daemon/onListening.ts
20307
20335
  function onListening(manager, checkAutoExit) {
20308
- writeFileSync35(daemonPaths.pid, String(process.pid));
20336
+ writeFileSync36(daemonPaths.pid, String(process.pid));
20309
20337
  startPidFileWatchdog(() => {
20310
20338
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
20311
20339
  manager.shutdown();
@@ -20380,7 +20408,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
20380
20408
 
20381
20409
  // src/commands/sessions/daemon/runDaemon.ts
20382
20410
  async function runDaemon() {
20383
- mkdirSync22(daemonPaths.dir, { recursive: true });
20411
+ mkdirSync23(daemonPaths.dir, { recursive: true });
20384
20412
  daemonLog(
20385
20413
  `starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
20386
20414
  );
@@ -20413,6 +20441,29 @@ function registerDaemon(program2) {
20413
20441
  ).action(restartDaemon);
20414
20442
  }
20415
20443
 
20444
+ // src/commands/sessions/daemon/sendToDaemon.ts
20445
+ async function sendToDaemon(message) {
20446
+ const socket = await connectToDaemon();
20447
+ const timer = setTimeout(() => socket.destroy(), 500);
20448
+ socket.on("error", () => {
20449
+ });
20450
+ socket.write(`${JSON.stringify(message)}
20451
+ `, () => {
20452
+ clearTimeout(timer);
20453
+ socket.end();
20454
+ });
20455
+ }
20456
+
20457
+ // src/commands/sessions/setSessionStatus.ts
20458
+ async function setSessionStatus(status2) {
20459
+ const sessionId = process.env.ASSIST_SESSION_ID;
20460
+ if (!sessionId) return;
20461
+ try {
20462
+ await sendToDaemon({ type: "set-status", sessionId, status: status2 });
20463
+ } catch {
20464
+ }
20465
+ }
20466
+
20416
20467
  // src/commands/sessions/summarise/index.ts
20417
20468
  import * as fs35 from "fs";
20418
20469
  import chalk168 from "chalk";
@@ -20625,6 +20676,9 @@ function registerSessions(program2) {
20625
20676
  const cmd = program2.command("sessions").description("Web dashboard for Claude Code sessions").option("--no-open", "Do not open a browser on startup").action((options2) => web({ port: "3100", open: options2.open }));
20626
20677
  cmd.command("web").description("Start the sessions web dashboard").option("-p, --port <number>", "Port to listen on", "3100").option("--no-open", "Do not open a browser on startup").action(web);
20627
20678
  cmd.command("summarise").description("Generate one-line summaries for Claude sessions").option("-f, --force", "Re-generate all summaries, even existing ones").option("-n, --limit <count>", "Maximum number of sessions to summarise").action(summarise3);
20679
+ cmd.command("set-status <status>").description(
20680
+ "Report the current session's status to the sessions daemon (used by Claude Code hooks)"
20681
+ ).action(setSessionStatus);
20628
20682
  }
20629
20683
 
20630
20684
  // src/commands/statusLine.ts
@@ -20698,15 +20752,7 @@ function buildLimitsSegment(rateLimits) {
20698
20752
  async function relayRateLimits(rateLimits) {
20699
20753
  if (!rateLimits) return;
20700
20754
  try {
20701
- const socket = await connectToDaemon();
20702
- const timer = setTimeout(() => socket.destroy(), 500);
20703
- socket.on("error", () => {
20704
- });
20705
- socket.write(`${JSON.stringify({ type: "limits", rateLimits })}
20706
- `, () => {
20707
- clearTimeout(timer);
20708
- socket.end();
20709
- });
20755
+ await sendToDaemon({ type: "limits", rateLimits });
20710
20756
  } catch {
20711
20757
  }
20712
20758
  }