@moberg_hr/work-tree 1.11.0 → 1.15.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/wd-bin.js CHANGED
@@ -1395,20 +1395,44 @@ function resolveFromCwd(config, cwd) {
1395
1395
 
1396
1396
  // src/core/worktree.ts
1397
1397
  import fs13 from "fs";
1398
- import path12 from "path";
1398
+ import path13 from "path";
1399
1399
  import chalk5 from "chalk";
1400
1400
 
1401
1401
  // src/core/history.ts
1402
1402
  import fs11 from "fs";
1403
- import path10 from "path";
1403
+ import path11 from "path";
1404
1404
 
1405
1405
  // src/core/fs-safe.ts
1406
1406
  import fs8 from "fs";
1407
+ import path9 from "path";
1407
1408
  import lockfile from "proper-lockfile";
1409
+ function resolveLinkTarget(filePath) {
1410
+ let current = filePath;
1411
+ const seen = /* @__PURE__ */ new Set([current]);
1412
+ for (let i = 0; i < 32; i++) {
1413
+ let stat;
1414
+ try {
1415
+ stat = fs8.lstatSync(current);
1416
+ } catch {
1417
+ return current;
1418
+ }
1419
+ if (!stat.isSymbolicLink()) return current;
1420
+ const next = path9.resolve(path9.dirname(current), fs8.readlinkSync(current));
1421
+ if (seen.has(next)) return filePath;
1422
+ seen.add(next);
1423
+ current = next;
1424
+ }
1425
+ return filePath;
1426
+ }
1408
1427
  function atomicWriteFile(filePath, content) {
1409
- const tmpPath = `${filePath}.tmp-${process.pid}`;
1428
+ const target = resolveLinkTarget(filePath);
1429
+ const tmpPath = `${target}.tmp-${process.pid}`;
1410
1430
  fs8.writeFileSync(tmpPath, content, "utf-8");
1411
- fs8.renameSync(tmpPath, filePath);
1431
+ try {
1432
+ fs8.chmodSync(tmpPath, fs8.statSync(target).mode & 511);
1433
+ } catch {
1434
+ }
1435
+ fs8.renameSync(tmpPath, target);
1412
1436
  }
1413
1437
  function ensureFile(filePath, initialContent) {
1414
1438
  if (!fs8.existsSync(filePath)) {
@@ -1453,9 +1477,9 @@ function sleepSync(ms) {
1453
1477
  // src/core/claude-activity.ts
1454
1478
  import fs9 from "fs";
1455
1479
  import os4 from "os";
1456
- import path9 from "path";
1480
+ import path10 from "path";
1457
1481
  function encodeProjectDir(p) {
1458
- return path9.resolve(p).replace(/[^A-Za-z0-9]/g, "-");
1482
+ return path10.resolve(p).replace(/[^A-Za-z0-9]/g, "-");
1459
1483
  }
1460
1484
  function latestJsonlMtimeMs(projectDir) {
1461
1485
  let entries;
@@ -1468,7 +1492,7 @@ function latestJsonlMtimeMs(projectDir) {
1468
1492
  for (const name of entries) {
1469
1493
  if (!name.endsWith(".jsonl")) continue;
1470
1494
  try {
1471
- const stat = fs9.statSync(path9.join(projectDir, name));
1495
+ const stat = fs9.statSync(path10.join(projectDir, name));
1472
1496
  if (stat.mtimeMs > latest) latest = stat.mtimeMs;
1473
1497
  } catch {
1474
1498
  }
@@ -1479,7 +1503,7 @@ function claudeActiveWithin(activityMs, nowMs, windowMs) {
1479
1503
  return activityMs > 0 && nowMs - activityMs < windowMs;
1480
1504
  }
1481
1505
  function getClaudeActivityMs(launchPath) {
1482
- const dir = path9.join(
1506
+ const dir = path10.join(
1483
1507
  os4.homedir(),
1484
1508
  ".claude",
1485
1509
  "projects",
@@ -1487,10 +1511,13 @@ function getClaudeActivityMs(launchPath) {
1487
1511
  );
1488
1512
  return latestJsonlMtimeMs(dir);
1489
1513
  }
1514
+ function hasClaudeConversation(dir) {
1515
+ return getClaudeActivityMs(dir) > 0;
1516
+ }
1490
1517
  function getLaunchPaths(session) {
1491
1518
  if (!session.isGroup) return [...session.paths];
1492
1519
  const parents = /* @__PURE__ */ new Set();
1493
- for (const p of session.paths) parents.add(path9.dirname(p));
1520
+ for (const p of session.paths) parents.add(path10.dirname(p));
1494
1521
  return [...parents];
1495
1522
  }
1496
1523
  function effectiveLastAccessedAt(session) {
@@ -1505,10 +1532,10 @@ function effectiveLastAccessedAt(session) {
1505
1532
  function resolveResumeLaunch(session) {
1506
1533
  const existing = session.paths.filter((p) => fs9.existsSync(p));
1507
1534
  const first = existing[0] ?? session.paths[0];
1508
- const defaultPath = session.isGroup ? path9.dirname(first) : first;
1535
+ const defaultPath = session.isGroup ? path10.dirname(first) : first;
1509
1536
  const candidates = /* @__PURE__ */ new Set();
1510
1537
  if (session.isGroup) {
1511
- for (const p of existing) candidates.add(path9.dirname(p));
1538
+ for (const p of existing) candidates.add(path10.dirname(p));
1512
1539
  for (const p of existing) candidates.add(p);
1513
1540
  } else {
1514
1541
  for (const p of existing) candidates.add(p);
@@ -1538,7 +1565,7 @@ function readSessionActivity(session) {
1538
1565
  return { lastActivity: latest, state };
1539
1566
  }
1540
1567
  function claudeProjectsRoot() {
1541
- return path9.join(os4.homedir(), ".claude", "projects");
1568
+ return path10.join(os4.homedir(), ".claude", "projects");
1542
1569
  }
1543
1570
 
1544
1571
  // src/core/port-allocator.ts
@@ -1612,7 +1639,7 @@ async function allocateFreePort(seedKey, config, sessions, probe = isPortFree) {
1612
1639
 
1613
1640
  // src/core/history.ts
1614
1641
  function getHistoryPath() {
1615
- return path10.join(getConfigDir(), "history.json");
1642
+ return path11.join(getConfigDir(), "history.json");
1616
1643
  }
1617
1644
  function backupCorruptFile(historyPath, reason) {
1618
1645
  try {
@@ -1805,7 +1832,7 @@ async function mergeHydratedSessions(incoming) {
1805
1832
 
1806
1833
  // src/core/copy-files.ts
1807
1834
  import fs12 from "fs";
1808
- import path11 from "path";
1835
+ import path12 from "path";
1809
1836
  import { globSync } from "glob";
1810
1837
  var EXCLUDED_DIRS = ["bin", "obj", "node_modules", ".git"];
1811
1838
  function copyConfigFiles(repoPath, worktreePath, patterns) {
@@ -1813,10 +1840,10 @@ function copyConfigFiles(repoPath, worktreePath, patterns) {
1813
1840
  const normalized = pattern.replace(/\\/g, "/");
1814
1841
  if (normalized.startsWith(".claude/")) {
1815
1842
  const relativePath = normalized;
1816
- const sourcePath = path11.join(repoPath, relativePath);
1843
+ const sourcePath = path12.join(repoPath, relativePath);
1817
1844
  if (fs12.existsSync(sourcePath)) {
1818
- const destPath = path11.join(worktreePath, relativePath);
1819
- const destDir = path11.dirname(destPath);
1845
+ const destPath = path12.join(worktreePath, relativePath);
1846
+ const destDir = path12.dirname(destPath);
1820
1847
  fs12.mkdirSync(destDir, { recursive: true });
1821
1848
  fs12.copyFileSync(sourcePath, destPath);
1822
1849
  console.log(` Copied: ${relativePath}`);
@@ -1834,9 +1861,9 @@ function copyConfigFiles(repoPath, worktreePath, patterns) {
1834
1861
  if (parts.some((p) => EXCLUDED_DIRS.includes(p))) {
1835
1862
  continue;
1836
1863
  }
1837
- const sourcePath = path11.join(repoPath, match);
1838
- const destPath = path11.join(worktreePath, match);
1839
- const destDir = path11.dirname(destPath);
1864
+ const sourcePath = path12.join(repoPath, match);
1865
+ const destPath = path12.join(worktreePath, match);
1866
+ const destDir = path12.dirname(destPath);
1840
1867
  fs12.mkdirSync(destDir, { recursive: true });
1841
1868
  fs12.copyFileSync(sourcePath, destPath);
1842
1869
  console.log(` Copied: ${match}`);
@@ -1901,7 +1928,7 @@ function toBaseSpec(base) {
1901
1928
  }
1902
1929
 
1903
1930
  // src/core/worktree.ts
1904
- function pullExistingWorktree(worktreePath, branchName) {
1931
+ function pullLatestForBranch(worktreePath, branchName) {
1905
1932
  const upstream = git(
1906
1933
  ["rev-parse", "--abbrev-ref", `${branchName}@{upstream}`],
1907
1934
  worktreePath
@@ -1920,7 +1947,7 @@ function pullExistingWorktree(worktreePath, branchName) {
1920
1947
  if (firstErrLine) console.log(chalk5.gray(` ${firstErrLine}`));
1921
1948
  }
1922
1949
  }
1923
- function createSingleWorktree(repoPath, worktreePath, branchName, config, baseBranch) {
1950
+ function createSingleWorktree(repoPath, worktreePath, branchName, config, baseBranch, pull = true) {
1924
1951
  debug("createSingleWorktree", { repoPath, worktreePath, branchName, baseBranch });
1925
1952
  if (fs13.existsSync(worktreePath)) {
1926
1953
  if (isGitRepo(worktreePath)) {
@@ -1929,7 +1956,7 @@ function createSingleWorktree(repoPath, worktreePath, branchName, config, baseBr
1929
1956
  console.log(
1930
1957
  chalk5.yellow(` Worktree already exists at: ${worktreePath}`)
1931
1958
  );
1932
- pullExistingWorktree(worktreePath, branchName);
1959
+ if (pull) pullLatestForBranch(worktreePath, branchName);
1933
1960
  return true;
1934
1961
  }
1935
1962
  }
@@ -1949,7 +1976,7 @@ function createSingleWorktree(repoPath, worktreePath, branchName, config, baseBr
1949
1976
  );
1950
1977
  return false;
1951
1978
  }
1952
- const parentDir = path12.dirname(worktreePath);
1979
+ const parentDir = path13.dirname(worktreePath);
1953
1980
  fs13.mkdirSync(parentDir, { recursive: true });
1954
1981
  git(["fetch", "--quiet"], repoPath);
1955
1982
  const baseRepoBranch = getCurrentBranch(repoPath);
@@ -2125,9 +2152,9 @@ function removeSingleWorktree(repoPath, worktreePath, branchName, force) {
2125
2152
  return false;
2126
2153
  }
2127
2154
  }
2128
- async function setupWorktree(targetName, branchName, config, base, jiraKey) {
2155
+ async function setupWorktree(targetName, branchName, config, base, jiraKey, opts = {}) {
2129
2156
  const spec = toBaseSpec(base);
2130
- debug("setupWorktree", { targetName, branchName, spec, jiraKey });
2157
+ debug("setupWorktree", { targetName, branchName, spec, jiraKey, opts });
2131
2158
  const target = resolveProjectTarget(targetName, config);
2132
2159
  if (!target) {
2133
2160
  debug("setupWorktree: target not found", targetName);
@@ -2135,13 +2162,13 @@ async function setupWorktree(targetName, branchName, config, base, jiraKey) {
2135
2162
  }
2136
2163
  const workTreeDirName = branchName.replace(/\//g, "-");
2137
2164
  if (target.isGroup) {
2138
- return setupGroupWorktree(target.name, target.repoAliases, branchName, workTreeDirName, config, spec, jiraKey);
2165
+ return setupGroupWorktree(target.name, target.repoAliases, branchName, workTreeDirName, config, spec, jiraKey, opts);
2139
2166
  } else {
2140
- return setupSingleWorktree(targetName, branchName, workTreeDirName, config, spec, jiraKey);
2167
+ return setupSingleWorktree(targetName, branchName, workTreeDirName, config, spec, jiraKey, opts);
2141
2168
  }
2142
2169
  }
2143
- async function setupGroupWorktree(groupName, repoAliases, branchName, workTreeDirName, config, spec, jiraKey) {
2144
- const groupWorktreePath = path12.join(config.worktreesRoot, groupName, workTreeDirName);
2170
+ async function setupGroupWorktree(groupName, repoAliases, branchName, workTreeDirName, config, spec, jiraKey, opts = {}) {
2171
+ const groupWorktreePath = path13.join(config.worktreesRoot, groupName, workTreeDirName);
2145
2172
  if (!isEmptyBaseSpec(spec)) {
2146
2173
  const unknownAliases = baseSpecOverrideAliases(spec).filter(
2147
2174
  (a) => !repoAliases.includes(a)
@@ -2182,11 +2209,11 @@ async function setupGroupWorktree(groupName, repoAliases, branchName, workTreeDi
2182
2209
  const baseBranches = {};
2183
2210
  for (const alias of repoAliases) {
2184
2211
  const repoPath = config.repos[alias];
2185
- const repoName = path12.basename(repoPath);
2186
- const subWorktreePath = path12.join(groupWorktreePath, repoName);
2212
+ const repoName = path13.basename(repoPath);
2213
+ const subWorktreePath = path13.join(groupWorktreePath, repoName);
2187
2214
  const repoBase = baseForAlias(spec, alias);
2188
2215
  console.log(chalk5.cyan(`[${alias}] (${repoName}):`));
2189
- const success = createSingleWorktree(repoPath, subWorktreePath, branchName, config, repoBase);
2216
+ const success = createSingleWorktree(repoPath, subWorktreePath, branchName, config, repoBase, opts.pull !== false);
2190
2217
  if (success) {
2191
2218
  createdWorktrees.push({ repoPath, worktreePath: subWorktreePath });
2192
2219
  if (repoBase) baseBranches[subWorktreePath] = repoBase;
@@ -2207,8 +2234,8 @@ async function setupGroupWorktree(groupName, repoAliases, branchName, workTreeDi
2207
2234
  }
2208
2235
  }
2209
2236
  const configDir = getConfigDir();
2210
- const claudeMdSrc = path12.join(configDir, `${groupName}.claude.md`);
2211
- const claudeMdDest = path12.join(groupWorktreePath, "CLAUDE.md");
2237
+ const claudeMdSrc = path13.join(configDir, `${groupName}.claude.md`);
2238
+ const claudeMdDest = path13.join(groupWorktreePath, "CLAUDE.md");
2212
2239
  if (fs13.existsSync(claudeMdSrc)) {
2213
2240
  fs13.copyFileSync(claudeMdSrc, claudeMdDest);
2214
2241
  console.log("");
@@ -2236,10 +2263,10 @@ async function setupGroupWorktree(groupName, repoAliases, branchName, workTreeDi
2236
2263
  if (port !== void 0) console.log(chalk5.gray(`Dev-server port: ${port}`));
2237
2264
  return { launchDir: groupWorktreePath, paths: allPaths, isGroup: true, port };
2238
2265
  }
2239
- async function setupSingleWorktree(targetName, branchName, workTreeDirName, config, spec, jiraKey) {
2266
+ async function setupSingleWorktree(targetName, branchName, workTreeDirName, config, spec, jiraKey, opts = {}) {
2240
2267
  const repoPath = config.repos[targetName];
2241
- const repoName = path12.basename(repoPath);
2242
- let workTreePath = path12.join(config.worktreesRoot, repoName, workTreeDirName);
2268
+ const repoName = path13.basename(repoPath);
2269
+ let workTreePath = path13.join(config.worktreesRoot, repoName, workTreeDirName);
2243
2270
  const unknownAliases = baseSpecOverrideAliases(spec).filter((a) => a !== targetName);
2244
2271
  if (unknownAliases.length > 0) {
2245
2272
  console.error(
@@ -2254,7 +2281,7 @@ async function setupSingleWorktree(targetName, branchName, workTreeDirName, conf
2254
2281
  }
2255
2282
  const worktrees = parseWorktreeList(repoPath);
2256
2283
  const existing = worktrees.find(
2257
- (wt) => wt.branch === branchName && path12.resolve(wt.path) !== path12.resolve(repoPath)
2284
+ (wt) => wt.branch === branchName && path13.resolve(wt.path) !== path13.resolve(repoPath)
2258
2285
  );
2259
2286
  if (existing) {
2260
2287
  if (baseBranch) {
@@ -2263,9 +2290,9 @@ async function setupSingleWorktree(targetName, branchName, workTreeDirName, conf
2263
2290
  }
2264
2291
  console.log(`Worktree already exists at: ${existing.path}`);
2265
2292
  workTreePath = existing.path;
2266
- pullExistingWorktree(workTreePath, branchName);
2293
+ if (opts.pull !== false) pullLatestForBranch(workTreePath, branchName);
2267
2294
  } else {
2268
- const success = createSingleWorktree(repoPath, workTreePath, branchName, config, baseBranch);
2295
+ const success = createSingleWorktree(repoPath, workTreePath, branchName, config, baseBranch, opts.pull !== false);
2269
2296
  if (!success) return null;
2270
2297
  }
2271
2298
  const { port } = await upsertSessionWithPort(
@@ -2286,19 +2313,19 @@ function teardownWorktree(target, isGroup, branch, config, force = true) {
2286
2313
  const workTreeDirName = branch.replace(/\//g, "-");
2287
2314
  if (isGroup && config.groups[target]) {
2288
2315
  const aliases = config.groups[target];
2289
- const groupWorktreePath = path12.join(config.worktreesRoot, target, workTreeDirName);
2316
+ const groupWorktreePath = path13.join(config.worktreesRoot, target, workTreeDirName);
2290
2317
  let allRemoved = true;
2291
2318
  for (const alias of aliases) {
2292
2319
  const repoPath = config.repos[alias];
2293
2320
  if (!repoPath) continue;
2294
- const repoName = path12.basename(repoPath);
2295
- const subWorktreePath = path12.join(groupWorktreePath, repoName);
2321
+ const repoName = path13.basename(repoPath);
2322
+ const subWorktreePath = path13.join(groupWorktreePath, repoName);
2296
2323
  console.log(chalk5.cyan(`[${alias}] (${repoName}):`));
2297
2324
  if (!removeSingleWorktree(repoPath, subWorktreePath, branch, force)) {
2298
2325
  allRemoved = false;
2299
2326
  }
2300
2327
  }
2301
- const claudeMd = path12.join(groupWorktreePath, "CLAUDE.md");
2328
+ const claudeMd = path13.join(groupWorktreePath, "CLAUDE.md");
2302
2329
  try {
2303
2330
  if (fs13.existsSync(claudeMd)) fs13.unlinkSync(claudeMd);
2304
2331
  } catch {
@@ -2347,6 +2374,14 @@ var treeCommand = {
2347
2374
  describe: "Launch the AI tool with its skip-permissions flag (default: --dangerously-skip-permissions)",
2348
2375
  type: "boolean",
2349
2376
  default: false
2377
+ }).option("pull", {
2378
+ describe: "Pull latest changes when switching into an existing worktree or the base repo. Use --no-pull to skip.",
2379
+ type: "boolean",
2380
+ default: true
2381
+ }).option("fresh", {
2382
+ describe: "Start a new AI conversation instead of continuing the previous one for this directory",
2383
+ type: "boolean",
2384
+ default: false
2350
2385
  }).option("base", {
2351
2386
  describe: "Base branch to fork from instead of HEAD. Repeatable. Use a bare branch (--base dev) for all repos, or alias=branch (--base backend=dev --base frontend=feat/x) for per-repo bases in a group.",
2352
2387
  type: "string"
@@ -2372,6 +2407,8 @@ var treeCommand = {
2372
2407
  const here = argv.here;
2373
2408
  const open = argv.open;
2374
2409
  const unsafe = argv.unsafe;
2410
+ const pull = argv.pull;
2411
+ const fresh = argv.fresh;
2375
2412
  const setupOnly = argv["setup-only"];
2376
2413
  let baseSpec;
2377
2414
  try {
@@ -2395,6 +2432,19 @@ var treeCommand = {
2395
2432
  }
2396
2433
  }
2397
2434
  const config = ensureConfig();
2435
+ const launchTool = (dir, port) => {
2436
+ const tool = getAiTool(config);
2437
+ const resume = !fresh && hasClaudeConversation(dir);
2438
+ if (resume) {
2439
+ console.log(
2440
+ chalk6.gray(
2441
+ `Continuing the previous ${tool.cmd} conversation (--fresh starts a new one).`
2442
+ )
2443
+ );
2444
+ }
2445
+ console.log(`Starting ${tool.cmd}...`);
2446
+ launchAi(dir, tool, { unsafe, initialPrompt, resume }, port);
2447
+ };
2398
2448
  if (here) {
2399
2449
  if (targetName) {
2400
2450
  console.error("Cannot combine --here with an explicit target.");
@@ -2463,16 +2513,15 @@ var treeCommand = {
2463
2513
  console.log(chalk6.cyan(`Working on base repo: ${targetName}`));
2464
2514
  console.log(`Repo path: ${repoPath}`);
2465
2515
  const currentBranch = getCurrentBranch(repoPath) ?? "(detached)";
2516
+ if (pull && currentBranch && currentBranch !== "(detached)") {
2517
+ pullLatestForBranch(repoPath, currentBranch);
2518
+ }
2466
2519
  await upsertSession(targetName, false, currentBranch, [repoPath], jiraKey);
2467
2520
  if (open) openVSCode(repoPath);
2468
- if (!setupOnly) {
2469
- const tool = getAiTool(config);
2470
- console.log(`Starting ${tool.cmd}...`);
2471
- launchAi(repoPath, tool, { unsafe, initialPrompt });
2472
- }
2521
+ if (!setupOnly) launchTool(repoPath);
2473
2522
  return;
2474
2523
  }
2475
- const result = await setupWorktree(targetName, branchName, config, baseSpec, jiraKey);
2524
+ const result = await setupWorktree(targetName, branchName, config, baseSpec, jiraKey, { pull });
2476
2525
  if (!result) {
2477
2526
  process.exitCode = 1;
2478
2527
  return;
@@ -2483,11 +2532,7 @@ var treeCommand = {
2483
2532
  }
2484
2533
  }
2485
2534
  console.log(`Worktree path: ${result.launchDir}`);
2486
- if (!setupOnly) {
2487
- const tool = getAiTool(config);
2488
- console.log(`Starting ${tool.cmd}...`);
2489
- launchAi(result.launchDir, tool, { unsafe, initialPrompt }, result.port);
2490
- }
2535
+ if (!setupOnly) launchTool(result.launchDir, result.port);
2491
2536
  }
2492
2537
  };
2493
2538
 
@@ -2546,7 +2591,7 @@ var removeCommand = {
2546
2591
 
2547
2592
  // src/commands/list.ts
2548
2593
  import fs15 from "fs";
2549
- import path13 from "path";
2594
+ import path14 from "path";
2550
2595
  import chalk8 from "chalk";
2551
2596
  var listCommand = {
2552
2597
  command: "list [target]",
@@ -2614,7 +2659,7 @@ var listCommand = {
2614
2659
  }
2615
2660
  }
2616
2661
  for (const groupName of showGroups) {
2617
- const groupDir = path13.join(worktreesRoot, groupName);
2662
+ const groupDir = path14.join(worktreesRoot, groupName);
2618
2663
  if (!fs15.existsSync(groupDir)) continue;
2619
2664
  let branchDirs;
2620
2665
  try {
@@ -2632,12 +2677,12 @@ var listCommand = {
2632
2677
  );
2633
2678
  const repoAliases = config.groups[groupName] ?? [];
2634
2679
  for (const bdName of branchDirs) {
2635
- const bdPath = path13.join(groupDir, bdName);
2680
+ const bdPath = path14.join(groupDir, bdName);
2636
2681
  let actualBranch = null;
2637
2682
  for (const alias of repoAliases) {
2638
2683
  const repoPath = config.repos[alias];
2639
2684
  if (!repoPath) continue;
2640
- const rdPath = path13.join(bdPath, path13.basename(repoPath));
2685
+ const rdPath = path14.join(bdPath, path14.basename(repoPath));
2641
2686
  if (fs15.existsSync(rdPath)) {
2642
2687
  const branch = getCurrentBranch(rdPath);
2643
2688
  if (branch) {
@@ -2964,7 +3009,7 @@ import { checkbox } from "@inquirer/prompts";
2964
3009
 
2965
3010
  // src/core/prunable-scan.ts
2966
3011
  import fs19 from "fs";
2967
- import path14 from "path";
3012
+ import path15 from "path";
2968
3013
  import chalk12 from "chalk";
2969
3014
  function collectPrunable(config, options = {}) {
2970
3015
  const { fetch: fetch2 = true, print = true, includeSquash = false } = options;
@@ -2981,7 +3026,7 @@ function collectPrunable(config, options = {}) {
2981
3026
  }
2982
3027
  const groupCoveredKeys = /* @__PURE__ */ new Set();
2983
3028
  for (const [groupName, aliases] of Object.entries(config.groups)) {
2984
- const groupDir = path14.join(config.worktreesRoot, groupName);
3029
+ const groupDir = path15.join(config.worktreesRoot, groupName);
2985
3030
  if (!fs19.existsSync(groupDir)) continue;
2986
3031
  let branchDirs;
2987
3032
  try {
@@ -2990,7 +3035,7 @@ function collectPrunable(config, options = {}) {
2990
3035
  continue;
2991
3036
  }
2992
3037
  for (const branchDir of branchDirs) {
2993
- const branchDirPath = path14.join(groupDir, branchDir);
3038
+ const branchDirPath = path15.join(groupDir, branchDir);
2994
3039
  let branch;
2995
3040
  let allMerged = true;
2996
3041
  let groupHasChanges = false;
@@ -3004,8 +3049,8 @@ function collectPrunable(config, options = {}) {
3004
3049
  skipped = true;
3005
3050
  continue;
3006
3051
  }
3007
- const repoName = path14.basename(repoPath);
3008
- const subWorktreePath = path14.join(branchDirPath, repoName);
3052
+ const repoName = path15.basename(repoPath);
3053
+ const subWorktreePath = path15.join(branchDirPath, repoName);
3009
3054
  if (!fs19.existsSync(subWorktreePath)) {
3010
3055
  continue;
3011
3056
  }
@@ -3122,7 +3167,7 @@ async function removeSingleEntry(entry, force = true) {
3122
3167
  }
3123
3168
  async function removeGroupEntry(entry, config, force = true) {
3124
3169
  const workTreeDirName = entry.branch.replace(/\//g, "-");
3125
- const groupWorktreePath = path14.join(
3170
+ const groupWorktreePath = path15.join(
3126
3171
  config.worktreesRoot,
3127
3172
  entry.target,
3128
3173
  workTreeDirName
@@ -3132,7 +3177,7 @@ async function removeGroupEntry(entry, config, force = true) {
3132
3177
  );
3133
3178
  let allRemoved = true;
3134
3179
  for (const { alias, repoPath, worktreePath } of entry.repos) {
3135
- const repoName = path14.basename(repoPath);
3180
+ const repoName = path15.basename(repoPath);
3136
3181
  console.log(chalk12.cyan(` [${alias}] (${repoName}):`));
3137
3182
  const removed = removeSingleWorktree(repoPath, worktreePath, entry.branch, force);
3138
3183
  if (!removed) {
@@ -3142,7 +3187,7 @@ async function removeGroupEntry(entry, config, force = true) {
3142
3187
  if (allRemoved) {
3143
3188
  await removeSession(entry.target, entry.branch);
3144
3189
  }
3145
- const claudeMdInWorktree = path14.join(groupWorktreePath, "CLAUDE.md");
3190
+ const claudeMdInWorktree = path15.join(groupWorktreePath, "CLAUDE.md");
3146
3191
  if (fs19.existsSync(claudeMdInWorktree)) {
3147
3192
  fs19.unlinkSync(claudeMdInWorktree);
3148
3193
  }
@@ -3368,7 +3413,7 @@ var syncCommand = {
3368
3413
 
3369
3414
  // src/tui-ink/index.tsx
3370
3415
  import fs24 from "fs";
3371
- import path19 from "path";
3416
+ import path20 from "path";
3372
3417
  import { render } from "ink";
3373
3418
 
3374
3419
  // src/tui-ink/App.tsx
@@ -3376,7 +3421,7 @@ import { useState, useEffect, useRef, useCallback, useMemo } from "react";
3376
3421
  import { Box as Box5 } from "ink";
3377
3422
  import fs23 from "fs";
3378
3423
  import os6 from "os";
3379
- import path18 from "path";
3424
+ import path19 from "path";
3380
3425
  import { execFile as execFile4 } from "child_process";
3381
3426
  import spawn7 from "cross-spawn";
3382
3427
 
@@ -3590,10 +3635,10 @@ async function fetchJiraPane() {
3590
3635
 
3591
3636
  // src/core/tasks.ts
3592
3637
  import fs21 from "fs";
3593
- import path15 from "path";
3638
+ import path16 from "path";
3594
3639
  var EMPTY_STORE = { nextId: 1, tasks: [] };
3595
3640
  function getTasksPath() {
3596
- return path15.join(getConfigDir(), "tasks.json");
3641
+ return path16.join(getConfigDir(), "tasks.json");
3597
3642
  }
3598
3643
  function loadStore() {
3599
3644
  const p = getTasksPath();
@@ -3842,30 +3887,33 @@ var PtySession = class {
3842
3887
 
3843
3888
  // src/core/hook-server.ts
3844
3889
  import http from "http";
3845
- import path17 from "path";
3890
+ import path18 from "path";
3846
3891
 
3847
3892
  // src/core/settings-editor.ts
3848
3893
  import fs22 from "fs";
3849
- import path16 from "path";
3894
+ import path17 from "path";
3850
3895
  import os5 from "os";
3851
- var SETTINGS_PATH = path16.join(os5.homedir(), ".claude", "settings.json");
3896
+ function settingsPath() {
3897
+ return path17.join(os5.homedir(), ".claude", "settings.json");
3898
+ }
3852
3899
  var OWNER_TAG = "_workHookOwner";
3853
3900
  var PID_TAG = "_workHookPid";
3854
3901
  var LEGACY_TAGS = ["_workDash", "_work2Dash"];
3855
3902
  function readSettings() {
3856
3903
  try {
3857
- if (!fs22.existsSync(SETTINGS_PATH)) return {};
3858
- return JSON.parse(fs22.readFileSync(SETTINGS_PATH, "utf8"));
3904
+ const p = settingsPath();
3905
+ if (!fs22.existsSync(p)) return {};
3906
+ return JSON.parse(fs22.readFileSync(p, "utf8"));
3859
3907
  } catch {
3860
3908
  return {};
3861
3909
  }
3862
3910
  }
3863
3911
  function writeAtomic(s) {
3864
3912
  try {
3865
- fs22.mkdirSync(path16.dirname(SETTINGS_PATH), { recursive: true });
3866
- const tmp = `${SETTINGS_PATH}.tmp-${process.pid}-${Date.now()}`;
3867
- fs22.writeFileSync(tmp, JSON.stringify(s, null, 2), "utf-8");
3868
- fs22.renameSync(tmp, SETTINGS_PATH);
3913
+ const target = resolveLinkTarget(settingsPath());
3914
+ fs22.mkdirSync(path17.dirname(target), { recursive: true });
3915
+ atomicWriteFile(target, `${JSON.stringify(s, null, 2)}
3916
+ `);
3869
3917
  } catch {
3870
3918
  }
3871
3919
  }
@@ -4037,7 +4085,7 @@ function removeHttpHooksSync(owner) {
4037
4085
  editSettingsSync(mutateRemove(owner));
4038
4086
  }
4039
4087
  function normalizePath(p) {
4040
- return path17.resolve(p).toLowerCase();
4088
+ return path18.resolve(p).toLowerCase();
4041
4089
  }
4042
4090
 
4043
4091
  // src/core/notifier.ts
@@ -5114,20 +5162,8 @@ var DETACH_KEY = "";
5114
5162
  var TAB_KEY = " ";
5115
5163
  var RENDER_INTERVAL_MS = 50;
5116
5164
  var MOUSE_SGR_RE = /\x1b\[<(\d+);(\d+);(\d+)[Mm]/;
5117
- function hasClaudeConversation(dir) {
5118
- try {
5119
- const resolved = path18.resolve(dir);
5120
- const projectDir = resolved.replace(/[^a-zA-Z0-9-]/g, "-");
5121
- const claudeProjectPath = path18.join(os6.homedir(), ".claude", "projects", projectDir);
5122
- if (!fs23.existsSync(claudeProjectPath)) return false;
5123
- const files = fs23.readdirSync(claudeProjectPath);
5124
- return files.some((f) => f.endsWith(".jsonl"));
5125
- } catch {
5126
- return false;
5127
- }
5128
- }
5129
5165
  function ptyDedupKey(pty2) {
5130
- return path18.resolve(pty2.cwd).toLowerCase();
5166
+ return path19.resolve(pty2.cwd).toLowerCase();
5131
5167
  }
5132
5168
  function loadSessions() {
5133
5169
  const all = loadHistory();
@@ -5427,10 +5463,10 @@ function App({ unsafe, onExit }) {
5427
5463
  }
5428
5464
  }, [setScrollBack, renderTermAtScroll]);
5429
5465
  const findPtyByCwd = useCallback((cwd) => {
5430
- const normalized = path18.resolve(cwd).toLowerCase();
5466
+ const normalized = path19.resolve(cwd).toLowerCase();
5431
5467
  for (const pty2 of ptySessions.current.values()) {
5432
5468
  if (pty2.exited) continue;
5433
- if (normalized.startsWith(path18.resolve(pty2.cwd).toLowerCase())) return pty2;
5469
+ if (normalized.startsWith(path19.resolve(pty2.cwd).toLowerCase())) return pty2;
5434
5470
  }
5435
5471
  return void 0;
5436
5472
  }, []);
@@ -5506,13 +5542,13 @@ function App({ unsafe, onExit }) {
5506
5542
  notifiedSessionsRef.current
5507
5543
  );
5508
5544
  if (kind) {
5509
- notifyDesktop(path18.basename(pty2.cwd), kind, {
5545
+ notifyDesktop(path19.basename(pty2.cwd), kind, {
5510
5546
  enabled: config?.notifications === true
5511
5547
  });
5512
5548
  runStatusHooks(
5513
5549
  kind,
5514
5550
  pty2.cwd,
5515
- path18.basename(pty2.cwd),
5551
+ path19.basename(pty2.cwd),
5516
5552
  config?.statusHooks
5517
5553
  );
5518
5554
  }
@@ -5645,7 +5681,7 @@ function App({ unsafe, onExit }) {
5645
5681
  refreshSessions();
5646
5682
  return;
5647
5683
  }
5648
- const dir = s.isGroup ? path18.dirname(existing) : existing;
5684
+ const dir = s.isGroup ? path19.dirname(existing) : existing;
5649
5685
  const resume = hasClaudeConversation(dir);
5650
5686
  const tool = getAiTool(config ?? {});
5651
5687
  const pty2 = new PtySession(dir, termInner, contentHeight - 2, void 0, { tool, unsafe, resume, port: s.port });
@@ -5743,7 +5779,7 @@ function App({ unsafe, onExit }) {
5743
5779
  "",
5744
5780
  " - Ask if I want to proceed with the recommended approach, choose a different one, get more details, or make adjustments."
5745
5781
  ].join("\n");
5746
- promptFile = path18.join(os6.tmpdir(), `work-prompt-${Date.now()}.txt`);
5782
+ promptFile = path19.join(os6.tmpdir(), `work-prompt-${Date.now()}.txt`);
5747
5783
  fs23.writeFileSync(promptFile, prompt, "utf-8");
5748
5784
  }
5749
5785
  const setupArgs = ["tree", projectName, branchName, "--setup-only"];
@@ -5783,7 +5819,7 @@ function App({ unsafe, onExit }) {
5783
5819
  setStatusVersion((v) => v + 1);
5784
5820
  return;
5785
5821
  }
5786
- const launchDir = session.isGroup ? path18.dirname(existing) : existing;
5822
+ const launchDir = session.isGroup ? path19.dirname(existing) : existing;
5787
5823
  const tool = getAiTool(config);
5788
5824
  const aiPty = new PtySession(
5789
5825
  launchDir,
@@ -6358,7 +6394,7 @@ function App({ unsafe, onExit }) {
6358
6394
  setMessage("Session path no longer exists");
6359
6395
  return;
6360
6396
  }
6361
- const dir = s.isGroup ? path18.dirname(existing) : existing;
6397
+ const dir = s.isGroup ? path19.dirname(existing) : existing;
6362
6398
  const editor = config?.editor ?? "code";
6363
6399
  spawn7(editor, [dir], { detached: true, stdio: "ignore" }).unref();
6364
6400
  setMessage(`Opened in ${editor}: ${s.branch}`);
@@ -6543,7 +6579,7 @@ function crashLog(label2, err) {
6543
6579
  const msg = err instanceof Error ? err.stack || err.message : String(err);
6544
6580
  const line = `${(/* @__PURE__ */ new Date()).toISOString()} [CRASH] ${label2}: ${msg}
6545
6581
  `;
6546
- fs24.appendFileSync(path19.join(getConfigDir(), "debug.log"), line);
6582
+ fs24.appendFileSync(path20.join(getConfigDir(), "debug.log"), line);
6547
6583
  } catch {
6548
6584
  }
6549
6585
  }
@@ -6867,22 +6903,22 @@ import chalk17 from "chalk";
6867
6903
 
6868
6904
  // src/core/hydrate.ts
6869
6905
  import fs25 from "fs";
6870
- import path20 from "path";
6906
+ import path21 from "path";
6871
6907
  async function hydrateHistoryFromDisk(config) {
6872
- const worktreesRoot = path20.resolve(config.worktreesRoot);
6908
+ const worktreesRoot = path21.resolve(config.worktreesRoot);
6873
6909
  const folderNameToAlias = /* @__PURE__ */ new Map();
6874
6910
  for (const [alias, repoPath] of Object.entries(config.repos)) {
6875
- folderNameToAlias.set(path20.basename(repoPath), alias);
6911
+ folderNameToAlias.set(path21.basename(repoPath), alias);
6876
6912
  }
6877
6913
  const discovered = /* @__PURE__ */ new Map();
6878
6914
  for (const [alias, repoPath] of Object.entries(config.repos)) {
6879
6915
  if (!fs25.existsSync(repoPath)) continue;
6880
6916
  for (const entry of parseWorktreeList(repoPath)) {
6881
6917
  if (!entry.branch) continue;
6882
- if (path20.resolve(entry.path) === path20.resolve(repoPath)) continue;
6883
- const rel = path20.relative(worktreesRoot, entry.path);
6884
- if (!rel || rel.startsWith("..") || path20.isAbsolute(rel)) continue;
6885
- const parts = rel.split(path20.sep).filter(Boolean);
6918
+ if (path21.resolve(entry.path) === path21.resolve(repoPath)) continue;
6919
+ const rel = path21.relative(worktreesRoot, entry.path);
6920
+ if (!rel || rel.startsWith("..") || path21.isAbsolute(rel)) continue;
6921
+ const parts = rel.split(path21.sep).filter(Boolean);
6886
6922
  if (parts.length < 2) continue;
6887
6923
  const [first, second] = parts;
6888
6924
  const isGroup = Object.prototype.hasOwnProperty.call(config.groups, first);
@@ -6967,13 +7003,13 @@ var hydrateCommand = {
6967
7003
  // src/commands/diff.ts
6968
7004
  import fs36 from "fs";
6969
7005
  import os9 from "os";
6970
- import path31 from "path";
7006
+ import path32 from "path";
6971
7007
  import { spawn as childSpawn } from "child_process";
6972
7008
  import chalk21 from "chalk";
6973
7009
 
6974
7010
  // src/core/diff-pipeline.ts
6975
7011
  import fs28 from "fs";
6976
- import path23 from "path";
7012
+ import path24 from "path";
6977
7013
  import spawn9 from "cross-spawn";
6978
7014
 
6979
7015
  // src/core/diff-parse.ts
@@ -7122,7 +7158,7 @@ function stripPathPrefix(p) {
7122
7158
 
7123
7159
  // src/core/lcov.ts
7124
7160
  import fs26 from "fs";
7125
- import path21 from "path";
7161
+ import path22 from "path";
7126
7162
  function parseLcov(content) {
7127
7163
  const result = /* @__PURE__ */ new Map();
7128
7164
  let sf = null;
@@ -7181,8 +7217,8 @@ function parseLcov(content) {
7181
7217
  }
7182
7218
  function findLcov(root) {
7183
7219
  const candidates = [
7184
- path21.join(root, "coverage", "lcov.info"),
7185
- path21.join(root, "lcov.info")
7220
+ path22.join(root, "coverage", "lcov.info"),
7221
+ path22.join(root, "lcov.info")
7186
7222
  ];
7187
7223
  for (const c of candidates) {
7188
7224
  try {
@@ -7217,33 +7253,33 @@ function readParsedLcov(lcovPath) {
7217
7253
  return { parsed, mtimeMs };
7218
7254
  }
7219
7255
  function normRel(p) {
7220
- return path21.normalize(p).replace(/\\/g, "/").replace(/^\.\//, "");
7256
+ return path22.normalize(p).replace(/\\/g, "/").replace(/^\.\//, "");
7221
7257
  }
7222
7258
  function realRoot(root) {
7223
7259
  try {
7224
- return fs26.realpathSync(path21.resolve(root));
7260
+ return fs26.realpathSync(path22.resolve(root));
7225
7261
  } catch {
7226
- return path21.resolve(root);
7262
+ return path22.resolve(root);
7227
7263
  }
7228
7264
  }
7229
7265
  function canonicalize(absPath) {
7230
- const resolved = path21.resolve(absPath);
7266
+ const resolved = path22.resolve(absPath);
7231
7267
  let dir = resolved;
7232
7268
  const tail = [];
7233
7269
  for (; ; ) {
7234
7270
  try {
7235
7271
  const realDir = fs26.realpathSync(dir);
7236
- return tail.length ? path21.join(realDir, ...tail.reverse()) : realDir;
7272
+ return tail.length ? path22.join(realDir, ...tail.reverse()) : realDir;
7237
7273
  } catch {
7238
- const parent = path21.dirname(dir);
7274
+ const parent = path22.dirname(dir);
7239
7275
  if (parent === dir) return resolved;
7240
- tail.push(path21.basename(dir));
7276
+ tail.push(path22.basename(dir));
7241
7277
  dir = parent;
7242
7278
  }
7243
7279
  }
7244
7280
  }
7245
7281
  function relForAbsSf(absSf, canonRoot) {
7246
- return path21.relative(canonRoot, canonicalize(absSf));
7282
+ return path22.relative(canonRoot, canonicalize(absSf));
7247
7283
  }
7248
7284
  function coverageLookup(root, relPaths) {
7249
7285
  const out = /* @__PURE__ */ new Map();
@@ -7256,7 +7292,7 @@ function coverageLookup(root, relPaths) {
7256
7292
  const canonRoot = realRoot(root);
7257
7293
  const byRel = /* @__PURE__ */ new Map();
7258
7294
  for (const [sf, pct] of read.parsed) {
7259
- const rel = path21.isAbsolute(sf) ? relForAbsSf(sf, canonRoot) : sf;
7295
+ const rel = path22.isAbsolute(sf) ? relForAbsSf(sf, canonRoot) : sf;
7260
7296
  byRel.set(normRel(rel), pct);
7261
7297
  }
7262
7298
  for (const rp of relPaths) {
@@ -7269,12 +7305,12 @@ function coverageLookup(root, relPaths) {
7269
7305
  // src/core/git-tree-snapshot.ts
7270
7306
  import fs27 from "fs";
7271
7307
  import os7 from "os";
7272
- import path22 from "path";
7308
+ import path23 from "path";
7273
7309
  import crypto from "crypto";
7274
7310
  import spawn8 from "cross-spawn";
7275
7311
  function writeTempTree(repoRoot, opts = {}) {
7276
7312
  const includeWorkingTree = opts.includeWorkingTree ?? true;
7277
- const tmpIndex = path22.join(
7313
+ const tmpIndex = path23.join(
7278
7314
  os7.tmpdir(),
7279
7315
  `wd-tree-${process.pid}-${crypto.randomBytes(6).toString("hex")}.idx`
7280
7316
  );
@@ -7319,12 +7355,12 @@ function isMarkdownPath(p) {
7319
7355
  return p !== "/dev/null" && MARKDOWN_EXT_RE.test(p);
7320
7356
  }
7321
7357
  function isInsideRoot(root, rel) {
7322
- const resolvedRoot = path23.resolve(root);
7323
- const resolvedTarget = path23.resolve(resolvedRoot, rel);
7324
- const r = path23.relative(resolvedRoot, resolvedTarget);
7358
+ const resolvedRoot = path24.resolve(root);
7359
+ const resolvedTarget = path24.resolve(resolvedRoot, rel);
7360
+ const r = path24.relative(resolvedRoot, resolvedTarget);
7325
7361
  if (r === "") return true;
7326
7362
  if (r.startsWith("..")) return false;
7327
- if (path23.isAbsolute(r)) return false;
7363
+ if (path24.isAbsolute(r)) return false;
7328
7364
  return true;
7329
7365
  }
7330
7366
  function readMarkdownContent(root, file, fromRef, toRef) {
@@ -7349,10 +7385,10 @@ function readMarkdownContent(root, file, fromRef, toRef) {
7349
7385
  if (file.status !== "deleted" && isMarkdownPath(file.newPath) && isInsideRoot(root, file.newPath)) {
7350
7386
  if (toRef === "working") {
7351
7387
  try {
7352
- const absPath = path23.join(root, file.newPath);
7353
- const realRoot2 = fs28.realpathSync(path23.resolve(root));
7388
+ const absPath = path24.join(root, file.newPath);
7389
+ const realRoot2 = fs28.realpathSync(path24.resolve(root));
7354
7390
  const realPath = fs28.realpathSync(absPath);
7355
- const sep = path23.sep;
7391
+ const sep = path24.sep;
7356
7392
  if (realPath === realRoot2 || realPath.startsWith(realRoot2 + sep)) {
7357
7393
  result.after = fs28.readFileSync(absPath, "utf-8");
7358
7394
  }
@@ -7382,7 +7418,7 @@ function isBinaryContent(buffer) {
7382
7418
  return false;
7383
7419
  }
7384
7420
  function synthesizeUntrackedDiff(root, relPath) {
7385
- const absPath = path23.join(root, relPath);
7421
+ const absPath = path24.join(root, relPath);
7386
7422
  let buffer;
7387
7423
  try {
7388
7424
  buffer = fs28.readFileSync(absPath);
@@ -7473,7 +7509,7 @@ function attachCoverage(root, files) {
7473
7509
  f.coverageMtimeMs = lcovMtimeMs;
7474
7510
  let srcMtimeMs = null;
7475
7511
  try {
7476
- srcMtimeMs = fs28.statSync(path23.join(root, f.path)).mtimeMs;
7512
+ srcMtimeMs = fs28.statSync(path24.join(root, f.path)).mtimeMs;
7477
7513
  } catch {
7478
7514
  srcMtimeMs = null;
7479
7515
  }
@@ -7541,7 +7577,7 @@ function computeRangeDiff(opts) {
7541
7577
 
7542
7578
  // src/core/repo-spec.ts
7543
7579
  import fs29 from "fs";
7544
- import path24 from "path";
7580
+ import path25 from "path";
7545
7581
  import os8 from "os";
7546
7582
  import crypto2 from "crypto";
7547
7583
  function scopeHashFor(keyPaths) {
@@ -7549,17 +7585,17 @@ function scopeHashFor(keyPaths) {
7549
7585
  return crypto2.createHash("sha1").update(key).digest("hex").slice(0, 12);
7550
7586
  }
7551
7587
  function stableDiffPath(keyPaths) {
7552
- const dir = path24.join(os8.homedir(), ".work", "diffs");
7588
+ const dir = path25.join(os8.homedir(), ".work", "diffs");
7553
7589
  fs29.mkdirSync(dir, { recursive: true });
7554
- return path24.join(dir, scopeHashFor(keyPaths));
7590
+ return path25.join(dir, scopeHashFor(keyPaths));
7555
7591
  }
7556
7592
 
7557
7593
  // src/core/diff-scope.ts
7558
7594
  import fs30 from "fs";
7559
- import path25 from "path";
7595
+ import path26 from "path";
7560
7596
  import chalk18 from "chalk";
7561
7597
  function normPath(p) {
7562
- return path25.resolve(p).replace(/\\/g, "/").toLowerCase();
7598
+ return path26.resolve(p).replace(/\\/g, "/").toLowerCase();
7563
7599
  }
7564
7600
  function realNorm(p) {
7565
7601
  try {
@@ -7583,29 +7619,29 @@ function resolveScope(cwd) {
7583
7619
  return {
7584
7620
  isGroup: true,
7585
7621
  session: s,
7586
- repos: s.paths.map((rp) => ({ name: path25.basename(rp), root: rp })),
7587
- activeRepoName: path25.basename(p)
7622
+ repos: s.paths.map((rp) => ({ name: path26.basename(rp), root: rp })),
7623
+ activeRepoName: path26.basename(p)
7588
7624
  };
7589
7625
  }
7590
7626
  return {
7591
7627
  isGroup: false,
7592
7628
  session: s,
7593
- repos: [{ name: path25.basename(p), root: p }],
7594
- activeRepoName: path25.basename(p)
7629
+ repos: [{ name: path26.basename(p), root: p }],
7630
+ activeRepoName: path26.basename(p)
7595
7631
  };
7596
7632
  }
7597
7633
  }
7598
7634
  }
7599
7635
  for (const s of sessions) {
7600
7636
  if (!s.isGroup || s.paths.length === 0) continue;
7601
- const parents = s.paths.map((p) => normPath(path25.dirname(p)));
7637
+ const parents = s.paths.map((p) => normPath(path26.dirname(p)));
7602
7638
  const groupRoot = parents[0];
7603
7639
  if (!parents.every((par) => par === groupRoot)) continue;
7604
7640
  if (normCwd === groupRoot || normCwd.startsWith(groupRoot + "/")) {
7605
7641
  return {
7606
7642
  isGroup: true,
7607
7643
  session: s,
7608
- repos: s.paths.map((rp) => ({ name: path25.basename(rp), root: rp })),
7644
+ repos: s.paths.map((rp) => ({ name: path26.basename(rp), root: rp })),
7609
7645
  activeRepoName: null
7610
7646
  };
7611
7647
  }
@@ -7614,8 +7650,8 @@ function resolveScope(cwd) {
7614
7650
  return {
7615
7651
  isGroup: false,
7616
7652
  session: null,
7617
- repos: [{ name: path25.basename(toplevel), root: toplevel }],
7618
- activeRepoName: path25.basename(toplevel)
7653
+ repos: [{ name: path26.basename(toplevel), root: toplevel }],
7654
+ activeRepoName: path26.basename(toplevel)
7619
7655
  };
7620
7656
  }
7621
7657
  function findAnyParentBranch(cwd) {
@@ -7799,7 +7835,7 @@ import { streamSSE } from "hono/streaming";
7799
7835
 
7800
7836
  // src/core/file-context.ts
7801
7837
  import fs31 from "fs";
7802
- import path26 from "path";
7838
+ import path27 from "path";
7803
7839
  import spawn10 from "cross-spawn";
7804
7840
  function readContextLines(opts) {
7805
7841
  const { root, relPath, ref } = opts;
@@ -7821,10 +7857,10 @@ function readContextLines(opts) {
7821
7857
  }
7822
7858
  function readWorkingTree(root, relPath) {
7823
7859
  try {
7824
- const absPath = path26.join(root, relPath);
7825
- const realRoot2 = fs31.realpathSync(path26.resolve(root));
7860
+ const absPath = path27.join(root, relPath);
7861
+ const realRoot2 = fs31.realpathSync(path27.resolve(root));
7826
7862
  const realPath = fs31.realpathSync(absPath);
7827
- const sep = path26.sep;
7863
+ const sep = path27.sep;
7828
7864
  if (realPath !== realRoot2 && !realPath.startsWith(realRoot2 + sep)) {
7829
7865
  return null;
7830
7866
  }
@@ -7846,7 +7882,7 @@ function readAtRef(root, ref, relPath) {
7846
7882
 
7847
7883
  // src/core/fs-watcher.ts
7848
7884
  import fs32 from "fs";
7849
- import path27 from "path";
7885
+ import path28 from "path";
7850
7886
  import chalk19 from "chalk";
7851
7887
  import chokidar from "chokidar";
7852
7888
  var IGNORED_DIRS = /* @__PURE__ */ new Set([
@@ -7872,7 +7908,7 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
7872
7908
  ]);
7873
7909
  function isIgnoredWatchPath(roots, filePath) {
7874
7910
  for (const root of roots) {
7875
- const rel = path27.relative(root, filePath).replace(/\\/g, "/");
7911
+ const rel = path28.relative(root, filePath).replace(/\\/g, "/");
7876
7912
  if (rel === "" || rel.startsWith("../")) continue;
7877
7913
  if (rel.split("/").some((seg) => IGNORED_DIRS.has(seg))) return true;
7878
7914
  }
@@ -7897,7 +7933,7 @@ function createFsWatcher(opts) {
7897
7933
  if (SUPPORTS_RECURSIVE_WATCH) {
7898
7934
  const watchers = opts.roots.map((root) => {
7899
7935
  const w = fs32.watch(root, { recursive: true }, (_event, filename) => {
7900
- if (filename && isIgnoredWatchPath([root], path27.join(root, filename.toString()))) {
7936
+ if (filename && isIgnoredWatchPath([root], path28.join(root, filename.toString()))) {
7901
7937
  return;
7902
7938
  }
7903
7939
  fire();
@@ -7936,29 +7972,29 @@ function createFsWatcher(opts) {
7936
7972
 
7937
7973
  // src/core/web-static.ts
7938
7974
  import fs33 from "fs";
7939
- import path28 from "path";
7975
+ import path29 from "path";
7940
7976
  import { fileURLToPath } from "url";
7941
7977
  function resolveWebRoot() {
7942
- const entryDir = path28.dirname(process.argv[1] ?? "");
7943
- const moduleDir = path28.dirname(fileURLToPath(import.meta.url));
7978
+ const entryDir = path29.dirname(process.argv[1] ?? "");
7979
+ const moduleDir = path29.dirname(fileURLToPath(import.meta.url));
7944
7980
  const candidates = [
7945
- path28.join(entryDir, "web"),
7981
+ path29.join(entryDir, "web"),
7946
7982
  // bundled: this module is inlined into dist/<bin>.js, so dist/web is a
7947
7983
  // sibling of the bundle. Works even when argv[1] is an npm bin symlink
7948
7984
  // (which is not realpath'd, so the entryDir candidate above misses).
7949
- path28.join(moduleDir, "web"),
7985
+ path29.join(moduleDir, "web"),
7950
7986
  // dev/tsx fallback: walk up from src/core to repo root then into dist/web.
7951
- path28.resolve(moduleDir, "../../dist/web")
7987
+ path29.resolve(moduleDir, "../../dist/web")
7952
7988
  ];
7953
7989
  for (const c of candidates) {
7954
- if (fs33.existsSync(path28.join(c, "index.html"))) return c;
7990
+ if (fs33.existsSync(path29.join(c, "index.html"))) return c;
7955
7991
  }
7956
7992
  return null;
7957
7993
  }
7958
7994
 
7959
7995
  // src/core/spa-handler.ts
7960
7996
  import fs34 from "fs";
7961
- import path29 from "path";
7997
+ import path30 from "path";
7962
7998
  var MIME = {
7963
7999
  ".html": "text/html; charset=utf-8",
7964
8000
  ".js": "application/javascript; charset=utf-8",
@@ -7972,9 +8008,9 @@ var MIME = {
7972
8008
  function readFile(root, relPath) {
7973
8009
  const clean = relPath.split("?")[0];
7974
8010
  const requested = clean === "/" ? "/index.html" : clean;
7975
- const filePath = path29.join(root, requested);
7976
- const norm = path29.normalize(filePath);
7977
- if (!norm.startsWith(path29.normalize(root))) return null;
8011
+ const filePath = path30.join(root, requested);
8012
+ const norm = path30.normalize(filePath);
8013
+ if (!norm.startsWith(path30.normalize(root))) return null;
7978
8014
  let stat;
7979
8015
  try {
7980
8016
  stat = fs34.statSync(norm);
@@ -7982,7 +8018,7 @@ function readFile(root, relPath) {
7982
8018
  return null;
7983
8019
  }
7984
8020
  if (!stat.isFile()) return null;
7985
- const ext = path29.extname(norm).toLowerCase();
8021
+ const ext = path30.extname(norm).toLowerCase();
7986
8022
  return { body: fs34.readFileSync(norm), ext };
7987
8023
  }
7988
8024
  function serveSpa(c, webRoot) {
@@ -8292,7 +8328,7 @@ function diffReviewSnapshot(snapshot, seen) {
8292
8328
 
8293
8329
  // src/core/static-renderer.ts
8294
8330
  import fs35 from "fs";
8295
- import path30 from "path";
8331
+ import path31 from "path";
8296
8332
  function buildDiff(specs, resolvedBase) {
8297
8333
  return {
8298
8334
  repos: specs.map((r) => ({
@@ -8308,7 +8344,7 @@ function renderStatic(opts) {
8308
8344
  if (!webRoot) {
8309
8345
  throw new Error("Could not find dist/web/. Run `npm run build` first.");
8310
8346
  }
8311
- const shellPath = path30.join(webRoot, "index.html");
8347
+ const shellPath = path31.join(webRoot, "index.html");
8312
8348
  let shell = fs35.readFileSync(shellPath, "utf-8");
8313
8349
  const uncommitted = buildDiff(opts.uncommitted, "HEAD");
8314
8350
  const branch = opts.branch ? buildDiff(opts.branch.specs, opts.branch.resolvedBase) : void 0;
@@ -8358,8 +8394,8 @@ function escapeForScriptTag(json) {
8358
8394
  }
8359
8395
  function readAsset(webRoot, urlPath) {
8360
8396
  const clean = urlPath.split("?")[0].replace(/^\//, "");
8361
- const full = path30.join(webRoot, clean);
8362
- if (!path30.normalize(full).startsWith(path30.normalize(webRoot))) return null;
8397
+ const full = path31.join(webRoot, clean);
8398
+ if (!path31.normalize(full).startsWith(path31.normalize(webRoot))) return null;
8363
8399
  try {
8364
8400
  return fs35.readFileSync(full, "utf-8");
8365
8401
  } catch {
@@ -8402,7 +8438,7 @@ async function runStop(repoSpecs) {
8402
8438
  }
8403
8439
  }
8404
8440
  function webUrlFilePath() {
8405
- return path31.join(os9.homedir(), ".work", "web.url");
8441
+ return path32.join(os9.homedir(), ".work", "web.url");
8406
8442
  }
8407
8443
  function resolveWorkBinPath(selfArgv1) {
8408
8444
  let real = selfArgv1;
@@ -8411,7 +8447,7 @@ function resolveWorkBinPath(selfArgv1) {
8411
8447
  } catch {
8412
8448
  }
8413
8449
  if (real.endsWith("wd-bin.js")) {
8414
- return path31.join(path31.dirname(real), "bin.js");
8450
+ return path32.join(path32.dirname(real), "bin.js");
8415
8451
  }
8416
8452
  return real;
8417
8453
  }
@@ -8448,7 +8484,7 @@ async function ensureWorkWebRunning() {
8448
8484
  }
8449
8485
  const workBin = resolveWorkBinPath(process.argv[1]);
8450
8486
  const out = fs36.openSync(
8451
- path31.join(os9.homedir(), ".work", "web-autostart.log"),
8487
+ path32.join(os9.homedir(), ".work", "web-autostart.log"),
8452
8488
  "a"
8453
8489
  );
8454
8490
  const child = childSpawn(
@@ -8790,19 +8826,19 @@ var diffCommand = {
8790
8826
  // src/commands/web.ts
8791
8827
  import fs41 from "fs";
8792
8828
  import os13 from "os";
8793
- import path41 from "path";
8829
+ import path42 from "path";
8794
8830
  import chalk23 from "chalk";
8795
8831
 
8796
8832
  // src/core/web-server.ts
8797
8833
  import fs40 from "fs";
8798
8834
  import os12 from "os";
8799
- import path40 from "path";
8835
+ import path41 from "path";
8800
8836
  import chalk22 from "chalk";
8801
8837
  import { Hono as Hono3 } from "hono";
8802
8838
  import { streamSSE as streamSSE3 } from "hono/streaming";
8803
8839
 
8804
8840
  // src/core/web-state.ts
8805
- import path32 from "path";
8841
+ import path33 from "path";
8806
8842
  import crypto4 from "crypto";
8807
8843
  import chokidar2 from "chokidar";
8808
8844
  function sessionIdFor(s) {
@@ -8823,7 +8859,7 @@ function subscribeSession(sessionId, onChange) {
8823
8859
  const watcher = chokidar2.watch(roots, {
8824
8860
  ignored: (filePath) => {
8825
8861
  for (const r of roots) {
8826
- const rel = path32.relative(r, filePath).replace(/\\/g, "/");
8862
+ const rel = path33.relative(r, filePath).replace(/\\/g, "/");
8827
8863
  if (rel === ".git" || rel.startsWith(".git/")) return true;
8828
8864
  }
8829
8865
  return false;
@@ -8938,16 +8974,16 @@ function disposeAllPtys() {
8938
8974
 
8939
8975
  // src/core/comment-file-store.ts
8940
8976
  import fs37 from "fs";
8941
- import path33 from "path";
8977
+ import path34 from "path";
8942
8978
  import os10 from "os";
8943
8979
  function commentsDir() {
8944
- return path33.join(os10.homedir(), ".work", "comments");
8980
+ return path34.join(os10.homedir(), ".work", "comments");
8945
8981
  }
8946
8982
  function ensureDir() {
8947
8983
  fs37.mkdirSync(commentsDir(), { recursive: true });
8948
8984
  }
8949
8985
  function commentsFileFor(sessionId) {
8950
- return path33.join(commentsDir(), `${sessionId}.json`);
8986
+ return path34.join(commentsDir(), `${sessionId}.json`);
8951
8987
  }
8952
8988
  function pathFor(sessionId) {
8953
8989
  return commentsFileFor(sessionId);
@@ -9041,11 +9077,11 @@ function clearCommentStoreCache() {
9041
9077
 
9042
9078
  // src/core/pending-delivery.ts
9043
9079
  import fs38 from "fs";
9044
- import path34 from "path";
9080
+ import path35 from "path";
9045
9081
  function pathFor2(sessionId) {
9046
9082
  return {
9047
9083
  comments: commentsFileFor(sessionId),
9048
- delivered: path34.join(commentsDir(), `${sessionId}.delivered.json`)
9084
+ delivered: path35.join(commentsDir(), `${sessionId}.delivered.json`)
9049
9085
  };
9050
9086
  }
9051
9087
  function readJson(filePath, fallback) {
@@ -9056,13 +9092,11 @@ function readJson(filePath, fallback) {
9056
9092
  }
9057
9093
  }
9058
9094
  function writeAtomic2(filePath, content) {
9059
- fs38.mkdirSync(path34.dirname(filePath), { recursive: true });
9060
- const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
9061
- fs38.writeFileSync(tmp, content, "utf-8");
9062
- fs38.renameSync(tmp, filePath);
9095
+ fs38.mkdirSync(path35.dirname(filePath), { recursive: true });
9096
+ atomicWriteFile(filePath, content);
9063
9097
  }
9064
9098
  function normalize(p) {
9065
- return path34.resolve(p).replace(/\\/g, "/").toLowerCase();
9099
+ return path35.resolve(p).replace(/\\/g, "/").toLowerCase();
9066
9100
  }
9067
9101
  function findSessionForCwd(cwd) {
9068
9102
  const norm = normalize(cwd);
@@ -9093,7 +9127,7 @@ function readPendingForSession(sessionId) {
9093
9127
  return comments.filter(isPendingFor(delivered));
9094
9128
  }
9095
9129
  function scopeStoreIdsForPaths(paths) {
9096
- const resolved = paths.map((p) => path34.resolve(p));
9130
+ const resolved = paths.map((p) => path35.resolve(p));
9097
9131
  const ids = /* @__PURE__ */ new Set();
9098
9132
  ids.add(`scope-${scopeHashFor(resolved)}`);
9099
9133
  for (const p of resolved) ids.add(`scope-${scopeHashFor([p])}`);
@@ -9431,7 +9465,7 @@ function mountPanesRoutes(app, opts) {
9431
9465
  }
9432
9466
 
9433
9467
  // src/core/worktree-routes.ts
9434
- import path35 from "path";
9468
+ import path36 from "path";
9435
9469
  import { spawn as spawn11 } from "child_process";
9436
9470
  import { zValidator as zValidator4 } from "@hono/zod-validator";
9437
9471
  import { z as z3 } from "zod";
@@ -9555,7 +9589,7 @@ function mountWorktreeRoutes(app, opts) {
9555
9589
  const id = c.req.param("id");
9556
9590
  const session = findSession2(id);
9557
9591
  if (!session) return c.json({ error: "unknown session" }, 404);
9558
- const target = session.isGroup ? path35.dirname(session.paths[0]) : session.paths[0];
9592
+ const target = session.isGroup ? path36.dirname(session.paths[0]) : session.paths[0];
9559
9593
  try {
9560
9594
  const cmd = process.platform === "win32" ? "code.cmd" : "code";
9561
9595
  const child = spawn11(cmd, [target], {
@@ -9575,18 +9609,18 @@ function mountWorktreeRoutes(app, opts) {
9575
9609
  import { zValidator as zValidator5 } from "@hono/zod-validator";
9576
9610
  import { z as z4 } from "zod";
9577
9611
  import { EventEmitter } from "events";
9578
- import path39 from "path";
9612
+ import path40 from "path";
9579
9613
  import spawn14 from "cross-spawn";
9580
9614
 
9581
9615
  // src/core/checkpoint.ts
9582
9616
  import fs39 from "fs";
9583
9617
  import os11 from "os";
9584
- import path36 from "path";
9618
+ import path37 from "path";
9585
9619
  import spawn12 from "cross-spawn";
9586
9620
  function manifestPath(scopeHash) {
9587
- const dir = path36.join(os11.homedir(), ".work", "diffs");
9621
+ const dir = path37.join(os11.homedir(), ".work", "diffs");
9588
9622
  fs39.mkdirSync(dir, { recursive: true });
9589
- return path36.join(dir, `${scopeHash}.checkpoints.json`);
9623
+ return path37.join(dir, `${scopeHash}.checkpoints.json`);
9590
9624
  }
9591
9625
  function emptyManifest(scopeHash) {
9592
9626
  return { version: 1, scopeHash, entries: [] };
@@ -9862,7 +9896,7 @@ function clearCheckpoints(scopeHash, repoRoots) {
9862
9896
 
9863
9897
  // src/core/checkpoint-summary.ts
9864
9898
  import spawn13 from "cross-spawn";
9865
- import path37 from "path";
9899
+ import path38 from "path";
9866
9900
  var MAX_DIFF_CHARS = 6e3;
9867
9901
  var MAX_LABEL_CHARS = 80;
9868
9902
  function buildDelta(scopeHash, repos, id) {
@@ -9915,7 +9949,7 @@ function buildDelta(scopeHash, repos, id) {
9915
9949
  function heuristicLabel(files, added, deleted) {
9916
9950
  if (files.length === 0) return "no changes";
9917
9951
  if (files.length === 1) {
9918
- return `${path37.basename(files[0].path)} +${added} \u2212${deleted}`;
9952
+ return `${path38.basename(files[0].path)} +${added} \u2212${deleted}`;
9919
9953
  }
9920
9954
  return `${files.length} files \xB7 +${added} \u2212${deleted}`;
9921
9955
  }
@@ -9986,7 +10020,7 @@ async function summarizeCheckpoint(scopeHash, repos, id) {
9986
10020
  }
9987
10021
 
9988
10022
  // src/core/scope-manager.ts
9989
- import path38 from "path";
10023
+ import path39 from "path";
9990
10024
  import crypto5 from "crypto";
9991
10025
  var scopes = /* @__PURE__ */ new Map();
9992
10026
  function hashFor(paths) {
@@ -10003,7 +10037,7 @@ var ScopePathRejectedError = class extends Error {
10003
10037
  }
10004
10038
  };
10005
10039
  function normaliseForCompare(p) {
10006
- return path38.resolve(p).replace(/\\/g, "/").toLowerCase();
10040
+ return path39.resolve(p).replace(/\\/g, "/").toLowerCase();
10007
10041
  }
10008
10042
  function rejectedPaths(normalised) {
10009
10043
  const config = loadConfig();
@@ -10021,7 +10055,7 @@ function rejectedPaths(normalised) {
10021
10055
  });
10022
10056
  }
10023
10057
  function registerScope(paths, label2) {
10024
- const normalised = paths.map((p) => path38.resolve(p));
10058
+ const normalised = paths.map((p) => path39.resolve(p));
10025
10059
  const rejected = rejectedPaths(normalised);
10026
10060
  if (rejected.length > 0) throw new ScopePathRejectedError(rejected);
10027
10061
  const hash = hashFor(normalised);
@@ -10035,7 +10069,7 @@ function registerScope(paths, label2) {
10035
10069
  const scope = {
10036
10070
  hash,
10037
10071
  paths: normalised,
10038
- label: label2 ?? path38.basename(normalised[0]),
10072
+ label: label2 ?? path39.basename(normalised[0]),
10039
10073
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
10040
10074
  ended: false
10041
10075
  };
@@ -10385,7 +10419,7 @@ function mountScopeRoutes(app, opts) {
10385
10419
  const fromSha = fromEntry.repos[p] ?? "HEAD";
10386
10420
  const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
10387
10421
  return {
10388
- name: path39.basename(p),
10422
+ name: path40.basename(p),
10389
10423
  root: p,
10390
10424
  files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
10391
10425
  };
@@ -10404,7 +10438,7 @@ function mountScopeRoutes(app, opts) {
10404
10438
  (p) => resolveRepoDiff(p, base, sessionBaseForPath(p))
10405
10439
  );
10406
10440
  const repos = scope.paths.map((p, i) => ({
10407
- name: path39.basename(p),
10441
+ name: path40.basename(p),
10408
10442
  root: p,
10409
10443
  resolvedBase: resolved[i].resolvedBase,
10410
10444
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -10435,7 +10469,7 @@ function mountScopeRoutes(app, opts) {
10435
10469
  if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
10436
10470
  return c.json({ error: "bad path/start/end" }, 400);
10437
10471
  }
10438
- const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path39.basename(p) === repoName);
10472
+ const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path40.basename(p) === repoName);
10439
10473
  if (!root) return c.json({ error: "unknown repo" }, 404);
10440
10474
  const result = readContextLines({ root, relPath, start, end, ref });
10441
10475
  if (!result) return c.json({ error: "cannot read file" }, 400);
@@ -10731,7 +10765,7 @@ function computeSessionDiff(s, base) {
10731
10765
  (p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch)
10732
10766
  );
10733
10767
  const repos = s.paths.map((p, i) => ({
10734
- name: path40.basename(p),
10768
+ name: path41.basename(p),
10735
10769
  root: p,
10736
10770
  resolvedBase: resolved[i].resolvedBase,
10737
10771
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -10751,10 +10785,10 @@ async function startWebServer(opts = {}) {
10751
10785
  for (const cb of sseListeners) cb({ event, data });
10752
10786
  };
10753
10787
  const home = os12.homedir();
10754
- const historyPath = path40.join(home, ".work", "history.json");
10788
+ const historyPath = path41.join(home, ".work", "history.json");
10755
10789
  const onHistoryChange = () => broadcast("sessions-changed", { ts: Date.now() });
10756
10790
  fs40.watchFile(historyPath, { interval: 1e3 }, onHistoryChange);
10757
- const tasksPath = path40.join(home, ".work", "tasks.json");
10791
+ const tasksPath = path41.join(home, ".work", "tasks.json");
10758
10792
  const onTasksChange = () => broadcast("tasks-changed", { ts: Date.now() });
10759
10793
  fs40.watchFile(tasksPath, { interval: 1e3 }, onTasksChange);
10760
10794
  const projectsRoot = claudeProjectsRoot();
@@ -10899,10 +10933,10 @@ function info2(message) {
10899
10933
  process.stderr.write(message + "\n");
10900
10934
  }
10901
10935
  function urlFilePath() {
10902
- return path41.join(os13.homedir(), ".work", "web.url");
10936
+ return path42.join(os13.homedir(), ".work", "web.url");
10903
10937
  }
10904
10938
  function pidFilePath() {
10905
- return path41.join(os13.homedir(), ".work", "web.pid");
10939
+ return path42.join(os13.homedir(), ".work", "web.pid");
10906
10940
  }
10907
10941
  function isPidAlive(pid) {
10908
10942
  try {
@@ -11027,7 +11061,7 @@ var webCommand = {
11027
11061
  const lean = !!argv.lean || process.env.WORK_WEB_LEAN === "1";
11028
11062
  const handle = await startWebServer({ lean });
11029
11063
  try {
11030
- fs41.mkdirSync(path41.dirname(urlFilePath()), { recursive: true });
11064
+ fs41.mkdirSync(path42.dirname(urlFilePath()), { recursive: true });
11031
11065
  fs41.writeFileSync(urlFilePath(), handle.url);
11032
11066
  fs41.writeFileSync(pidFilePath(), String(process.pid));
11033
11067
  } catch {
@@ -11121,11 +11155,11 @@ var webCommand = {
11121
11155
  // src/commands/hook.ts
11122
11156
  import fs42 from "fs";
11123
11157
  import os14 from "os";
11124
- import path42 from "path";
11158
+ import path43 from "path";
11125
11159
  async function postToWeb(route, cwd) {
11126
11160
  let base;
11127
11161
  try {
11128
- base = fs42.readFileSync(path42.join(os14.homedir(), ".work", "web.url"), "utf-8").trim();
11162
+ base = fs42.readFileSync(path43.join(os14.homedir(), ".work", "web.url"), "utf-8").trim();
11129
11163
  } catch {
11130
11164
  return;
11131
11165
  }
@@ -11621,7 +11655,7 @@ var broadcastCommand = {
11621
11655
 
11622
11656
  // src/completions/index.ts
11623
11657
  import fs45 from "fs";
11624
- import path43 from "path";
11658
+ import path44 from "path";
11625
11659
  function completionHandler(current, argv, done) {
11626
11660
  const rawArgs = argv._;
11627
11661
  const args = rawArgs.slice(1, -1);
@@ -11734,18 +11768,18 @@ function completeRepoBranches(alias, current, config, done) {
11734
11768
  done(branches);
11735
11769
  }
11736
11770
  function completeGroupBranches(groupName, repoAliases, current, config, done) {
11737
- const groupDir = path43.join(config.worktreesRoot, groupName);
11771
+ const groupDir = path44.join(config.worktreesRoot, groupName);
11738
11772
  if (!fs45.existsSync(groupDir)) {
11739
11773
  done([]);
11740
11774
  return;
11741
11775
  }
11742
11776
  try {
11743
11777
  const branchDirs = fs45.readdirSync(groupDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => {
11744
- const bdPath = path43.join(groupDir, d.name);
11778
+ const bdPath = path44.join(groupDir, d.name);
11745
11779
  for (const alias of repoAliases) {
11746
11780
  const repoPath = config.repos[alias];
11747
11781
  if (!repoPath) continue;
11748
- const subPath = path43.join(bdPath, path43.basename(repoPath));
11782
+ const subPath = path44.join(bdPath, path44.basename(repoPath));
11749
11783
  if (fs45.existsSync(subPath)) {
11750
11784
  const branch = getCurrentBranch(subPath);
11751
11785
  if (branch) return branch;
@@ -11760,7 +11794,7 @@ function completeGroupBranches(groupName, repoAliases, current, config, done) {
11760
11794
  }
11761
11795
 
11762
11796
  // src/version.ts
11763
- var VERSION = true ? "1.11.0" : "dev";
11797
+ var VERSION = true ? "1.15.0" : "dev";
11764
11798
 
11765
11799
  // src/cli.ts
11766
11800
  function showHelp() {