@buildautomaton/cli 0.1.58 → 0.1.59

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/cli.js CHANGED
@@ -973,7 +973,7 @@ var require_command = __commonJS({
973
973
  "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
974
974
  var EventEmitter2 = __require("node:events").EventEmitter;
975
975
  var childProcess2 = __require("node:child_process");
976
- var path75 = __require("node:path");
976
+ var path76 = __require("node:path");
977
977
  var fs53 = __require("node:fs");
978
978
  var process8 = __require("node:process");
979
979
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1906,9 +1906,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1906
1906
  let launchWithNode = false;
1907
1907
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1908
1908
  function findFile(baseDir, baseName) {
1909
- const localBin = path75.resolve(baseDir, baseName);
1909
+ const localBin = path76.resolve(baseDir, baseName);
1910
1910
  if (fs53.existsSync(localBin)) return localBin;
1911
- if (sourceExt.includes(path75.extname(baseName))) return void 0;
1911
+ if (sourceExt.includes(path76.extname(baseName))) return void 0;
1912
1912
  const foundExt = sourceExt.find(
1913
1913
  (ext) => fs53.existsSync(`${localBin}${ext}`)
1914
1914
  );
@@ -1926,17 +1926,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1926
1926
  } catch (err) {
1927
1927
  resolvedScriptPath = this._scriptPath;
1928
1928
  }
1929
- executableDir = path75.resolve(
1930
- path75.dirname(resolvedScriptPath),
1929
+ executableDir = path76.resolve(
1930
+ path76.dirname(resolvedScriptPath),
1931
1931
  executableDir
1932
1932
  );
1933
1933
  }
1934
1934
  if (executableDir) {
1935
1935
  let localFile = findFile(executableDir, executableFile);
1936
1936
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1937
- const legacyName = path75.basename(
1937
+ const legacyName = path76.basename(
1938
1938
  this._scriptPath,
1939
- path75.extname(this._scriptPath)
1939
+ path76.extname(this._scriptPath)
1940
1940
  );
1941
1941
  if (legacyName !== this._name) {
1942
1942
  localFile = findFile(
@@ -1947,7 +1947,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1947
1947
  }
1948
1948
  executableFile = localFile || executableFile;
1949
1949
  }
1950
- launchWithNode = sourceExt.includes(path75.extname(executableFile));
1950
+ launchWithNode = sourceExt.includes(path76.extname(executableFile));
1951
1951
  let proc;
1952
1952
  if (process8.platform !== "win32") {
1953
1953
  if (launchWithNode) {
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2787
2787
  * @return {Command}
2788
2788
  */
2789
2789
  nameFromFilename(filename) {
2790
- this._name = path75.basename(filename, path75.extname(filename));
2790
+ this._name = path76.basename(filename, path76.extname(filename));
2791
2791
  return this;
2792
2792
  }
2793
2793
  /**
@@ -2801,9 +2801,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2801
2801
  * @param {string} [path]
2802
2802
  * @return {(string|null|Command)}
2803
2803
  */
2804
- executableDir(path76) {
2805
- if (path76 === void 0) return this._executableDir;
2806
- this._executableDir = path76;
2804
+ executableDir(path77) {
2805
+ if (path77 === void 0) return this._executableDir;
2806
+ this._executableDir = path77;
2807
2807
  return this;
2808
2808
  }
2809
2809
  /**
@@ -7061,8 +7061,8 @@ var init_parseUtil = __esm({
7061
7061
  init_errors();
7062
7062
  init_en();
7063
7063
  makeIssue = (params) => {
7064
- const { data, path: path75, errorMaps, issueData } = params;
7065
- const fullPath = [...path75, ...issueData.path || []];
7064
+ const { data, path: path76, errorMaps, issueData } = params;
7065
+ const fullPath = [...path76, ...issueData.path || []];
7066
7066
  const fullIssue = {
7067
7067
  ...issueData,
7068
7068
  path: fullPath
@@ -7370,11 +7370,11 @@ var init_types = __esm({
7370
7370
  init_parseUtil();
7371
7371
  init_util();
7372
7372
  ParseInputLazyPath = class {
7373
- constructor(parent, value, path75, key) {
7373
+ constructor(parent, value, path76, key) {
7374
7374
  this._cachedPath = [];
7375
7375
  this.parent = parent;
7376
7376
  this.data = value;
7377
- this._path = path75;
7377
+ this._path = path76;
7378
7378
  this._key = key;
7379
7379
  }
7380
7380
  get path() {
@@ -11099,10 +11099,10 @@ function assignProp(target, prop, value) {
11099
11099
  configurable: true
11100
11100
  });
11101
11101
  }
11102
- function getElementAtPath(obj, path75) {
11103
- if (!path75)
11102
+ function getElementAtPath(obj, path76) {
11103
+ if (!path76)
11104
11104
  return obj;
11105
- return path75.reduce((acc, key) => acc?.[key], obj);
11105
+ return path76.reduce((acc, key) => acc?.[key], obj);
11106
11106
  }
11107
11107
  function promiseAllObject(promisesObj) {
11108
11108
  const keys = Object.keys(promisesObj);
@@ -11351,11 +11351,11 @@ function aborted(x, startIndex = 0) {
11351
11351
  }
11352
11352
  return false;
11353
11353
  }
11354
- function prefixIssues(path75, issues) {
11354
+ function prefixIssues(path76, issues) {
11355
11355
  return issues.map((iss) => {
11356
11356
  var _a2;
11357
11357
  (_a2 = iss).path ?? (_a2.path = []);
11358
- iss.path.unshift(path75);
11358
+ iss.path.unshift(path76);
11359
11359
  return iss;
11360
11360
  });
11361
11361
  }
@@ -11544,7 +11544,7 @@ function treeifyError(error40, _mapper) {
11544
11544
  return issue2.message;
11545
11545
  };
11546
11546
  const result = { errors: [] };
11547
- const processError = (error41, path75 = []) => {
11547
+ const processError = (error41, path76 = []) => {
11548
11548
  var _a2, _b;
11549
11549
  for (const issue2 of error41.issues) {
11550
11550
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -11554,7 +11554,7 @@ function treeifyError(error40, _mapper) {
11554
11554
  } else if (issue2.code === "invalid_element") {
11555
11555
  processError({ issues: issue2.issues }, issue2.path);
11556
11556
  } else {
11557
- const fullpath = [...path75, ...issue2.path];
11557
+ const fullpath = [...path76, ...issue2.path];
11558
11558
  if (fullpath.length === 0) {
11559
11559
  result.errors.push(mapper(issue2));
11560
11560
  continue;
@@ -11584,9 +11584,9 @@ function treeifyError(error40, _mapper) {
11584
11584
  processError(error40);
11585
11585
  return result;
11586
11586
  }
11587
- function toDotPath(path75) {
11587
+ function toDotPath(path76) {
11588
11588
  const segs = [];
11589
- for (const seg of path75) {
11589
+ for (const seg of path76) {
11590
11590
  if (typeof seg === "number")
11591
11591
  segs.push(`[${seg}]`);
11592
11592
  else if (typeof seg === "symbol")
@@ -24592,7 +24592,7 @@ var require_ignore = __commonJS({
24592
24592
  // path matching.
24593
24593
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
24594
24594
  // @returns {TestResult} true if a file is ignored
24595
- test(path75, checkUnignored, mode) {
24595
+ test(path76, checkUnignored, mode) {
24596
24596
  let ignored = false;
24597
24597
  let unignored = false;
24598
24598
  let matchedRule;
@@ -24601,7 +24601,7 @@ var require_ignore = __commonJS({
24601
24601
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
24602
24602
  return;
24603
24603
  }
24604
- const matched = rule[mode].test(path75);
24604
+ const matched = rule[mode].test(path76);
24605
24605
  if (!matched) {
24606
24606
  return;
24607
24607
  }
@@ -24622,17 +24622,17 @@ var require_ignore = __commonJS({
24622
24622
  var throwError = (message, Ctor) => {
24623
24623
  throw new Ctor(message);
24624
24624
  };
24625
- var checkPath = (path75, originalPath, doThrow) => {
24626
- if (!isString(path75)) {
24625
+ var checkPath = (path76, originalPath, doThrow) => {
24626
+ if (!isString(path76)) {
24627
24627
  return doThrow(
24628
24628
  `path must be a string, but got \`${originalPath}\``,
24629
24629
  TypeError
24630
24630
  );
24631
24631
  }
24632
- if (!path75) {
24632
+ if (!path76) {
24633
24633
  return doThrow(`path must not be empty`, TypeError);
24634
24634
  }
24635
- if (checkPath.isNotRelative(path75)) {
24635
+ if (checkPath.isNotRelative(path76)) {
24636
24636
  const r = "`path.relative()`d";
24637
24637
  return doThrow(
24638
24638
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -24641,7 +24641,7 @@ var require_ignore = __commonJS({
24641
24641
  }
24642
24642
  return true;
24643
24643
  };
24644
- var isNotRelative = (path75) => REGEX_TEST_INVALID_PATH.test(path75);
24644
+ var isNotRelative = (path76) => REGEX_TEST_INVALID_PATH.test(path76);
24645
24645
  checkPath.isNotRelative = isNotRelative;
24646
24646
  checkPath.convert = (p) => p;
24647
24647
  var Ignore = class {
@@ -24671,19 +24671,19 @@ var require_ignore = __commonJS({
24671
24671
  }
24672
24672
  // @returns {TestResult}
24673
24673
  _test(originalPath, cache2, checkUnignored, slices) {
24674
- const path75 = originalPath && checkPath.convert(originalPath);
24674
+ const path76 = originalPath && checkPath.convert(originalPath);
24675
24675
  checkPath(
24676
- path75,
24676
+ path76,
24677
24677
  originalPath,
24678
24678
  this._strictPathCheck ? throwError : RETURN_FALSE
24679
24679
  );
24680
- return this._t(path75, cache2, checkUnignored, slices);
24680
+ return this._t(path76, cache2, checkUnignored, slices);
24681
24681
  }
24682
- checkIgnore(path75) {
24683
- if (!REGEX_TEST_TRAILING_SLASH.test(path75)) {
24684
- return this.test(path75);
24682
+ checkIgnore(path76) {
24683
+ if (!REGEX_TEST_TRAILING_SLASH.test(path76)) {
24684
+ return this.test(path76);
24685
24685
  }
24686
- const slices = path75.split(SLASH).filter(Boolean);
24686
+ const slices = path76.split(SLASH).filter(Boolean);
24687
24687
  slices.pop();
24688
24688
  if (slices.length) {
24689
24689
  const parent = this._t(
@@ -24696,18 +24696,18 @@ var require_ignore = __commonJS({
24696
24696
  return parent;
24697
24697
  }
24698
24698
  }
24699
- return this._rules.test(path75, false, MODE_CHECK_IGNORE);
24699
+ return this._rules.test(path76, false, MODE_CHECK_IGNORE);
24700
24700
  }
24701
- _t(path75, cache2, checkUnignored, slices) {
24702
- if (path75 in cache2) {
24703
- return cache2[path75];
24701
+ _t(path76, cache2, checkUnignored, slices) {
24702
+ if (path76 in cache2) {
24703
+ return cache2[path76];
24704
24704
  }
24705
24705
  if (!slices) {
24706
- slices = path75.split(SLASH).filter(Boolean);
24706
+ slices = path76.split(SLASH).filter(Boolean);
24707
24707
  }
24708
24708
  slices.pop();
24709
24709
  if (!slices.length) {
24710
- return cache2[path75] = this._rules.test(path75, checkUnignored, MODE_IGNORE);
24710
+ return cache2[path76] = this._rules.test(path76, checkUnignored, MODE_IGNORE);
24711
24711
  }
24712
24712
  const parent = this._t(
24713
24713
  slices.join(SLASH) + SLASH,
@@ -24715,29 +24715,29 @@ var require_ignore = __commonJS({
24715
24715
  checkUnignored,
24716
24716
  slices
24717
24717
  );
24718
- return cache2[path75] = parent.ignored ? parent : this._rules.test(path75, checkUnignored, MODE_IGNORE);
24718
+ return cache2[path76] = parent.ignored ? parent : this._rules.test(path76, checkUnignored, MODE_IGNORE);
24719
24719
  }
24720
- ignores(path75) {
24721
- return this._test(path75, this._ignoreCache, false).ignored;
24720
+ ignores(path76) {
24721
+ return this._test(path76, this._ignoreCache, false).ignored;
24722
24722
  }
24723
24723
  createFilter() {
24724
- return (path75) => !this.ignores(path75);
24724
+ return (path76) => !this.ignores(path76);
24725
24725
  }
24726
24726
  filter(paths) {
24727
24727
  return makeArray(paths).filter(this.createFilter());
24728
24728
  }
24729
24729
  // @returns {TestResult}
24730
- test(path75) {
24731
- return this._test(path75, this._testCache, true);
24730
+ test(path76) {
24731
+ return this._test(path76, this._testCache, true);
24732
24732
  }
24733
24733
  };
24734
24734
  var factory = (options) => new Ignore(options);
24735
- var isPathValid = (path75) => checkPath(path75 && checkPath.convert(path75), path75, RETURN_FALSE);
24735
+ var isPathValid = (path76) => checkPath(path76 && checkPath.convert(path76), path76, RETURN_FALSE);
24736
24736
  var setupWindows = () => {
24737
24737
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
24738
24738
  checkPath.convert = makePosix;
24739
24739
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
24740
- checkPath.isNotRelative = (path75) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path75) || isNotRelative(path75);
24740
+ checkPath.isNotRelative = (path76) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path76) || isNotRelative(path76);
24741
24741
  };
24742
24742
  if (
24743
24743
  // Detect `process` so that it can run in browsers.
@@ -25526,10 +25526,10 @@ var require_src2 = __commonJS({
25526
25526
  var fs_1 = __require("fs");
25527
25527
  var debug_1 = __importDefault(require_src());
25528
25528
  var log2 = debug_1.default("@kwsites/file-exists");
25529
- function check2(path75, isFile, isDirectory) {
25530
- log2(`checking %s`, path75);
25529
+ function check2(path76, isFile, isDirectory) {
25530
+ log2(`checking %s`, path76);
25531
25531
  try {
25532
- const stat3 = fs_1.statSync(path75);
25532
+ const stat3 = fs_1.statSync(path76);
25533
25533
  if (stat3.isFile() && isFile) {
25534
25534
  log2(`[OK] path represents a file`);
25535
25535
  return true;
@@ -25549,8 +25549,8 @@ var require_src2 = __commonJS({
25549
25549
  throw e;
25550
25550
  }
25551
25551
  }
25552
- function exists2(path75, type = exports.READABLE) {
25553
- return check2(path75, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
25552
+ function exists2(path76, type = exports.READABLE) {
25553
+ return check2(path76, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
25554
25554
  }
25555
25555
  exports.exists = exists2;
25556
25556
  exports.FILE = 1;
@@ -25631,7 +25631,7 @@ var {
25631
25631
  } = import_index.default;
25632
25632
 
25633
25633
  // src/cli-version.ts
25634
- var CLI_VERSION = "0.1.58".length > 0 ? "0.1.58" : "0.0.0-dev";
25634
+ var CLI_VERSION = "0.1.59".length > 0 ? "0.1.59" : "0.0.0-dev";
25635
25635
 
25636
25636
  // src/cli/defaults.ts
25637
25637
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
@@ -25639,7 +25639,7 @@ var DEFAULT_FIREHOSE_URL = "https://buildautomaton-firehose.fly.dev";
25639
25639
 
25640
25640
  // src/cli/run-cli-action.ts
25641
25641
  import * as fs52 from "node:fs";
25642
- import * as path74 from "node:path";
25642
+ import * as path75 from "node:path";
25643
25643
 
25644
25644
  // src/cli-log-level.ts
25645
25645
  var verbosity = "info";
@@ -27859,7 +27859,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
27859
27859
  join2(moduleDir, "..", sub, filename),
27860
27860
  join2(moduleDir, "..", "..", "dist", sub, filename)
27861
27861
  ]);
27862
- const resolved = candidates.find((path75) => existsSync(path75));
27862
+ const resolved = candidates.find((path76) => existsSync(path76));
27863
27863
  if (!resolved) {
27864
27864
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
27865
27865
  }
@@ -28888,9 +28888,9 @@ function parseChangeSummaryJson(raw, allowedPaths, options) {
28888
28888
  const rawPath = typeof o.path === "string" ? o.path.trim() : "";
28889
28889
  const summary = typeof o.summary === "string" ? o.summary.trim() : "";
28890
28890
  if (!rawPath || !summary) continue;
28891
- const path75 = skip ? normalizeRepoRelativePath(rawPath) || rawPath : resolveChangeSummaryPathAgainstAllowed(rawPath, allowedPaths);
28892
- if (!path75) continue;
28893
- rows.push({ path: path75, summary: clampSummaryToAtMostTwoLines(summary) });
28891
+ const path76 = skip ? normalizeRepoRelativePath(rawPath) || rawPath : resolveChangeSummaryPathAgainstAllowed(rawPath, allowedPaths);
28892
+ if (!path76) continue;
28893
+ rows.push({ path: path76, summary: clampSummaryToAtMostTwoLines(summary) });
28894
28894
  }
28895
28895
  return rows;
28896
28896
  }
@@ -35246,8 +35246,8 @@ async function execGitFile(args, options) {
35246
35246
  }
35247
35247
 
35248
35248
  // src/git/changes/parse/normalize-git-diff-path.ts
35249
- function normalizeGitDiffPath(path75) {
35250
- return path75.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35249
+ function normalizeGitDiffPath(path76) {
35250
+ return path76.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35251
35251
  }
35252
35252
 
35253
35253
  // src/git/changes/parse/parse-name-status-entries.ts
@@ -35534,9 +35534,9 @@ async function collectTurnGitDiffFromPreTurnSnapshot(options) {
35534
35534
  // src/agents/acp/put-summarize-change-summaries.ts
35535
35535
  async function putEncryptedChangeSummaryRows(params) {
35536
35536
  const base = params.apiBaseUrl.replace(/\/+$/, "");
35537
- const entries = params.rows.map(({ path: path75, summary }) => {
35537
+ const entries = params.rows.map(({ path: path76, summary }) => {
35538
35538
  const enc = params.e2ee.encryptFields({ summary }, ["summary"]);
35539
- return { path: path75, summary: JSON.stringify(enc) };
35539
+ return { path: path76, summary: JSON.stringify(enc) };
35540
35540
  });
35541
35541
  const res = await fetch(
35542
35542
  `${base}/internal/sessions/${encodeURIComponent(params.sessionId)}/follow-ups/summarize-changes`,
@@ -36569,8 +36569,8 @@ function pathspec(...paths) {
36569
36569
  cache.set(key, paths);
36570
36570
  return key;
36571
36571
  }
36572
- function isPathSpec(path75) {
36573
- return path75 instanceof String && cache.has(path75);
36572
+ function isPathSpec(path76) {
36573
+ return path76 instanceof String && cache.has(path76);
36574
36574
  }
36575
36575
  function toPaths(pathSpec) {
36576
36576
  return cache.get(pathSpec) || [];
@@ -36659,8 +36659,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
36659
36659
  function forEachLineWithContent(input, callback) {
36660
36660
  return toLinesWithContent(input, true).map((line) => callback(line));
36661
36661
  }
36662
- function folderExists(path75) {
36663
- return (0, import_file_exists.exists)(path75, import_file_exists.FOLDER);
36662
+ function folderExists(path76) {
36663
+ return (0, import_file_exists.exists)(path76, import_file_exists.FOLDER);
36664
36664
  }
36665
36665
  function append(target, item) {
36666
36666
  if (Array.isArray(target)) {
@@ -37064,8 +37064,8 @@ function checkIsRepoRootTask() {
37064
37064
  commands,
37065
37065
  format: "utf-8",
37066
37066
  onError,
37067
- parser(path75) {
37068
- return /^\.(git)?$/.test(path75.trim());
37067
+ parser(path76) {
37068
+ return /^\.(git)?$/.test(path76.trim());
37069
37069
  }
37070
37070
  };
37071
37071
  }
@@ -37499,11 +37499,11 @@ function parseGrep(grep) {
37499
37499
  const paths = /* @__PURE__ */ new Set();
37500
37500
  const results = {};
37501
37501
  forEachLineWithContent(grep, (input) => {
37502
- const [path75, line, preview] = input.split(NULL);
37503
- paths.add(path75);
37504
- (results[path75] = results[path75] || []).push({
37502
+ const [path76, line, preview] = input.split(NULL);
37503
+ paths.add(path76);
37504
+ (results[path76] = results[path76] || []).push({
37505
37505
  line: asNumber(line),
37506
- path: path75,
37506
+ path: path76,
37507
37507
  preview
37508
37508
  });
37509
37509
  });
@@ -38268,14 +38268,14 @@ var init_hash_object = __esm2({
38268
38268
  init_task();
38269
38269
  }
38270
38270
  });
38271
- function parseInit(bare, path75, text) {
38271
+ function parseInit(bare, path76, text) {
38272
38272
  const response = String(text).trim();
38273
38273
  let result;
38274
38274
  if (result = initResponseRegex.exec(response)) {
38275
- return new InitSummary(bare, path75, false, result[1]);
38275
+ return new InitSummary(bare, path76, false, result[1]);
38276
38276
  }
38277
38277
  if (result = reInitResponseRegex.exec(response)) {
38278
- return new InitSummary(bare, path75, true, result[1]);
38278
+ return new InitSummary(bare, path76, true, result[1]);
38279
38279
  }
38280
38280
  let gitDir = "";
38281
38281
  const tokens = response.split(" ");
@@ -38286,7 +38286,7 @@ function parseInit(bare, path75, text) {
38286
38286
  break;
38287
38287
  }
38288
38288
  }
38289
- return new InitSummary(bare, path75, /^re/i.test(response), gitDir);
38289
+ return new InitSummary(bare, path76, /^re/i.test(response), gitDir);
38290
38290
  }
38291
38291
  var InitSummary;
38292
38292
  var initResponseRegex;
@@ -38295,9 +38295,9 @@ var init_InitSummary = __esm2({
38295
38295
  "src/lib/responses/InitSummary.ts"() {
38296
38296
  "use strict";
38297
38297
  InitSummary = class {
38298
- constructor(bare, path75, existing, gitDir) {
38298
+ constructor(bare, path76, existing, gitDir) {
38299
38299
  this.bare = bare;
38300
- this.path = path75;
38300
+ this.path = path76;
38301
38301
  this.existing = existing;
38302
38302
  this.gitDir = gitDir;
38303
38303
  }
@@ -38309,7 +38309,7 @@ var init_InitSummary = __esm2({
38309
38309
  function hasBareCommand(command) {
38310
38310
  return command.includes(bareCommand);
38311
38311
  }
38312
- function initTask(bare = false, path75, customArgs) {
38312
+ function initTask(bare = false, path76, customArgs) {
38313
38313
  const commands = ["init", ...customArgs];
38314
38314
  if (bare && !hasBareCommand(commands)) {
38315
38315
  commands.splice(1, 0, bareCommand);
@@ -38318,7 +38318,7 @@ function initTask(bare = false, path75, customArgs) {
38318
38318
  commands,
38319
38319
  format: "utf-8",
38320
38320
  parser(text) {
38321
- return parseInit(commands.includes("--bare"), path75, text);
38321
+ return parseInit(commands.includes("--bare"), path76, text);
38322
38322
  }
38323
38323
  };
38324
38324
  }
@@ -39134,12 +39134,12 @@ var init_FileStatusSummary = __esm2({
39134
39134
  "use strict";
39135
39135
  fromPathRegex = /^(.+)\0(.+)$/;
39136
39136
  FileStatusSummary = class {
39137
- constructor(path75, index, working_dir) {
39138
- this.path = path75;
39137
+ constructor(path76, index, working_dir) {
39138
+ this.path = path76;
39139
39139
  this.index = index;
39140
39140
  this.working_dir = working_dir;
39141
39141
  if (index === "R" || working_dir === "R") {
39142
- const detail = fromPathRegex.exec(path75) || [null, path75, path75];
39142
+ const detail = fromPathRegex.exec(path76) || [null, path76, path76];
39143
39143
  this.from = detail[2] || "";
39144
39144
  this.path = detail[1] || "";
39145
39145
  }
@@ -39170,14 +39170,14 @@ function splitLine(result, lineStr) {
39170
39170
  default:
39171
39171
  return;
39172
39172
  }
39173
- function data(index, workingDir, path75) {
39173
+ function data(index, workingDir, path76) {
39174
39174
  const raw = `${index}${workingDir}`;
39175
39175
  const handler = parsers6.get(raw);
39176
39176
  if (handler) {
39177
- handler(result, path75);
39177
+ handler(result, path76);
39178
39178
  }
39179
39179
  if (raw !== "##" && raw !== "!!") {
39180
- result.files.push(new FileStatusSummary(path75, index, workingDir));
39180
+ result.files.push(new FileStatusSummary(path76, index, workingDir));
39181
39181
  }
39182
39182
  }
39183
39183
  }
@@ -39486,9 +39486,9 @@ var init_simple_git_api = __esm2({
39486
39486
  next
39487
39487
  );
39488
39488
  }
39489
- hashObject(path75, write) {
39489
+ hashObject(path76, write) {
39490
39490
  return this._runTask(
39491
- hashObjectTask(path75, write === true),
39491
+ hashObjectTask(path76, write === true),
39492
39492
  trailingFunctionArgument(arguments)
39493
39493
  );
39494
39494
  }
@@ -39841,8 +39841,8 @@ var init_branch = __esm2({
39841
39841
  }
39842
39842
  });
39843
39843
  function toPath(input) {
39844
- const path75 = input.trim().replace(/^["']|["']$/g, "");
39845
- return path75 && normalize3(path75);
39844
+ const path76 = input.trim().replace(/^["']|["']$/g, "");
39845
+ return path76 && normalize3(path76);
39846
39846
  }
39847
39847
  var parseCheckIgnore;
39848
39848
  var init_CheckIgnore = __esm2({
@@ -40156,8 +40156,8 @@ __export2(sub_module_exports, {
40156
40156
  subModuleTask: () => subModuleTask,
40157
40157
  updateSubModuleTask: () => updateSubModuleTask
40158
40158
  });
40159
- function addSubModuleTask(repo, path75) {
40160
- return subModuleTask(["add", repo, path75]);
40159
+ function addSubModuleTask(repo, path76) {
40160
+ return subModuleTask(["add", repo, path76]);
40161
40161
  }
40162
40162
  function initSubModuleTask(customArgs) {
40163
40163
  return subModuleTask(["init", ...customArgs]);
@@ -40490,8 +40490,8 @@ var require_git = __commonJS2({
40490
40490
  }
40491
40491
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
40492
40492
  };
40493
- Git2.prototype.submoduleAdd = function(repo, path75, then) {
40494
- return this._runTask(addSubModuleTask2(repo, path75), trailingFunctionArgument2(arguments));
40493
+ Git2.prototype.submoduleAdd = function(repo, path76, then) {
40494
+ return this._runTask(addSubModuleTask2(repo, path76), trailingFunctionArgument2(arguments));
40495
40495
  };
40496
40496
  Git2.prototype.submoduleUpdate = function(args, then) {
40497
40497
  return this._runTask(
@@ -41227,8 +41227,8 @@ function parseNumstatEntries(lines) {
41227
41227
  }
41228
41228
  function parseNumstat(lines) {
41229
41229
  const m = /* @__PURE__ */ new Map();
41230
- for (const [path75, entry] of parseNumstatEntries(lines)) {
41231
- m.set(path75, { additions: entry.additions, deletions: entry.deletions });
41230
+ for (const [path76, entry] of parseNumstatEntries(lines)) {
41231
+ m.set(path76, { additions: entry.additions, deletions: entry.deletions });
41232
41232
  }
41233
41233
  return m;
41234
41234
  }
@@ -42535,18 +42535,32 @@ import * as fs28 from "node:fs";
42535
42535
  // src/git/worktrees/worktree-remove.ts
42536
42536
  import * as fs27 from "node:fs";
42537
42537
 
42538
+ // src/worktrees/is-removable-session-worktree-checkout-path.ts
42539
+ import path43 from "node:path";
42540
+ function isBridgeRootCheckoutPath(checkoutPath) {
42541
+ return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
42542
+ }
42543
+ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath) {
42544
+ if (isBridgeRootCheckoutPath(checkoutPath)) return false;
42545
+ const normalized = normalizeResolvedPath(checkoutPath);
42546
+ const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
42547
+ const rel = path43.relative(worktreesRoot, normalized);
42548
+ if (rel === "" || rel.startsWith("..") || path43.isAbsolute(rel)) return false;
42549
+ return true;
42550
+ }
42551
+
42538
42552
  // src/git/worktrees/resolve-main-repo-from-git-file.ts
42539
42553
  import * as fs26 from "node:fs";
42540
- import * as path43 from "node:path";
42554
+ import * as path44 from "node:path";
42541
42555
  function resolveMainRepoFromWorktreeGitFile(wt) {
42542
- const gitDirFile = path43.join(wt, ".git");
42556
+ const gitDirFile = path44.join(wt, ".git");
42543
42557
  if (!fs26.existsSync(gitDirFile) || !fs26.statSync(gitDirFile).isFile()) return "";
42544
42558
  const first2 = fs26.readFileSync(gitDirFile, "utf8").trim();
42545
42559
  const m = first2.match(/^gitdir:\s*(.+)$/im);
42546
42560
  if (!m) return "";
42547
- const gitWorktreePath = path43.resolve(wt, m[1].trim());
42548
- const gitDir = path43.dirname(path43.dirname(gitWorktreePath));
42549
- return path43.dirname(gitDir);
42561
+ const gitWorktreePath = path44.resolve(wt, m[1].trim());
42562
+ const gitDir = path44.dirname(path44.dirname(gitWorktreePath));
42563
+ return path44.dirname(gitDir);
42550
42564
  }
42551
42565
 
42552
42566
  // src/git/worktrees/worktree-remove.ts
@@ -42554,32 +42568,44 @@ async function gitWorktreeRemoveForce(worktreePath) {
42554
42568
  const mainRepo = resolveMainRepoFromWorktreeGitFile(worktreePath);
42555
42569
  if (mainRepo) {
42556
42570
  await cliSimpleGit(mainRepo).raw(["worktree", "remove", "--force", worktreePath]);
42557
- } else {
42558
- fs27.rmSync(worktreePath, { recursive: true, force: true });
42571
+ return true;
42559
42572
  }
42573
+ if (isBridgeRootCheckoutPath(worktreePath)) return false;
42574
+ fs27.rmSync(worktreePath, { recursive: true, force: true });
42575
+ return true;
42560
42576
  }
42561
42577
 
42562
42578
  // src/worktrees/remove-session-worktrees.ts
42563
- async function removeSessionWorktrees(paths, log2) {
42579
+ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
42564
42580
  for (const wt of paths) {
42581
+ if (!isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
42582
+ log2(`[worktrees] Skipping removal of ${wt} (bridge root or outside worktrees root).`);
42583
+ continue;
42584
+ }
42565
42585
  try {
42566
- await gitWorktreeRemoveForce(wt);
42567
- log2(`[worktrees] Removed worktree ${wt}`);
42586
+ const removed = await gitWorktreeRemoveForce(wt);
42587
+ if (removed) {
42588
+ log2(`[worktrees] Removed worktree ${wt}`);
42589
+ } else {
42590
+ log2(`[worktrees] Skipping removal of ${wt} (bridge root).`);
42591
+ }
42568
42592
  } catch (e) {
42569
42593
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
42570
- try {
42571
- fs28.rmSync(wt, { recursive: true, force: true });
42572
- } catch {
42594
+ if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
42595
+ try {
42596
+ fs28.rmSync(wt, { recursive: true, force: true });
42597
+ } catch {
42598
+ }
42573
42599
  }
42574
42600
  }
42575
42601
  }
42576
42602
  }
42577
42603
 
42578
42604
  // src/worktrees/manager/git/remove-session-worktree-checkouts.ts
42579
- async function removeSessionWorktreeCheckouts(cache2, sessionId, log2) {
42605
+ async function removeSessionWorktreeCheckouts(cache2, sessionId, worktreesRootPath, log2) {
42580
42606
  const paths = cache2.clearSession(sessionId);
42581
42607
  if (!paths?.length) return;
42582
- await removeSessionWorktrees(paths, log2);
42608
+ await removeSessionWorktrees(paths, worktreesRootPath, log2);
42583
42609
  }
42584
42610
 
42585
42611
  // src/git/branches/rename-branch.ts
@@ -42612,11 +42638,11 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
42612
42638
 
42613
42639
  // src/worktrees/discovery/discover-session-worktree-on-disk.ts
42614
42640
  import * as fs32 from "node:fs";
42615
- import * as path48 from "node:path";
42641
+ import * as path49 from "node:path";
42616
42642
 
42617
42643
  // src/worktrees/discovery/collect-worktree-paths.ts
42618
42644
  import * as fs30 from "node:fs";
42619
- import * as path45 from "node:path";
42645
+ import * as path46 from "node:path";
42620
42646
 
42621
42647
  // src/worktrees/discovery/disk-walk-constants.ts
42622
42648
  var DISK_WALK_YIELD_EVERY = 64;
@@ -42645,7 +42671,7 @@ function shouldSkipDiskWalkEntry(name) {
42645
42671
 
42646
42672
  // src/worktrees/discovery/disk-walk-utils.ts
42647
42673
  import * as fs29 from "node:fs";
42648
- import * as path44 from "node:path";
42674
+ import * as path45 from "node:path";
42649
42675
  async function yieldDuringDiskWalk(state) {
42650
42676
  state.entries++;
42651
42677
  if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
@@ -42655,7 +42681,7 @@ async function yieldDuringDiskWalk(state) {
42655
42681
  }
42656
42682
  async function isGitDir(dirPath) {
42657
42683
  try {
42658
- await fs29.promises.access(path44.join(dirPath, ".git"));
42684
+ await fs29.promises.access(path45.join(dirPath, ".git"));
42659
42685
  return true;
42660
42686
  } catch {
42661
42687
  return false;
@@ -42669,7 +42695,7 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
42669
42695
  const walk = async (dir) => {
42670
42696
  if (!await yieldDuringDiskWalk(state)) return;
42671
42697
  if (await isGitDir(dir)) {
42672
- out.push(path45.resolve(dir));
42698
+ out.push(path46.resolve(dir));
42673
42699
  return;
42674
42700
  }
42675
42701
  let entries;
@@ -42680,12 +42706,12 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
42680
42706
  }
42681
42707
  for (const e of entries) {
42682
42708
  if (shouldSkipDiskWalkEntry(e.name)) continue;
42683
- const full = path45.join(dir, e.name);
42709
+ const full = path46.join(dir, e.name);
42684
42710
  if (!e.isDirectory()) continue;
42685
42711
  await walk(full);
42686
42712
  }
42687
42713
  };
42688
- await walk(path45.resolve(rootPath));
42714
+ await walk(path46.resolve(rootPath));
42689
42715
  return { paths: [...new Set(out)], entriesVisited: state.entries };
42690
42716
  }
42691
42717
  async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
@@ -42702,10 +42728,10 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
42702
42728
  }
42703
42729
  for (const e of entries) {
42704
42730
  if (shouldSkipDiskWalkEntry(e.name)) continue;
42705
- const full = path45.join(dir, e.name);
42731
+ const full = path46.join(dir, e.name);
42706
42732
  if (!e.isDirectory()) continue;
42707
42733
  if (e.name === sessionId) {
42708
- if (await isGitDir(full)) out.push(path45.resolve(full));
42734
+ if (await isGitDir(full)) out.push(path46.resolve(full));
42709
42735
  continue;
42710
42736
  }
42711
42737
  if (await isGitDir(full)) continue;
@@ -42717,14 +42743,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
42717
42743
  }
42718
42744
 
42719
42745
  // src/worktrees/discovery/layout-keys-for-bridge-root.ts
42720
- import * as path46 from "node:path";
42746
+ import * as path47 from "node:path";
42721
42747
  function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
42722
- const bridge = path46.resolve(bridgeRoot);
42748
+ const bridge = path47.resolve(bridgeRoot);
42723
42749
  const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
42724
42750
  const relevant = layout.launcherCwds.filter((e) => {
42725
- const entry = path46.resolve(e.absolutePath);
42726
- return bridge === entry || bridge.startsWith(entry + path46.sep) || entry.startsWith(bridge + path46.sep);
42727
- }).sort((a, b) => path46.resolve(b.absolutePath).length - path46.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
42751
+ const entry = path47.resolve(e.absolutePath);
42752
+ return bridge === entry || bridge.startsWith(entry + path47.sep) || entry.startsWith(bridge + path47.sep);
42753
+ }).sort((a, b) => path47.resolve(b.absolutePath).length - path47.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
42728
42754
  const ordered = [];
42729
42755
  const seen = /* @__PURE__ */ new Set();
42730
42756
  const add = (k) => {
@@ -42743,7 +42769,7 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
42743
42769
 
42744
42770
  // src/worktrees/discovery/try-binding-from-session-directory.ts
42745
42771
  import * as fs31 from "node:fs";
42746
- import * as path47 from "node:path";
42772
+ import * as path48 from "node:path";
42747
42773
  async function tryBindingFromSessionDirectory(sessionDir) {
42748
42774
  let st;
42749
42775
  try {
@@ -42754,7 +42780,7 @@ async function tryBindingFromSessionDirectory(sessionDir) {
42754
42780
  if (!st.isDirectory()) return null;
42755
42781
  const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(sessionDir);
42756
42782
  if (worktreePaths.length === 0) return null;
42757
- const abs = path47.resolve(sessionDir);
42783
+ const abs = path48.resolve(sessionDir);
42758
42784
  return {
42759
42785
  sessionParentPath: abs,
42760
42786
  workingTreeRelRoot: abs,
@@ -42778,7 +42804,7 @@ async function discoverSessionWorktreeOnDisk(options) {
42778
42804
  try {
42779
42805
  for (const name of await fs32.promises.readdir(worktreesRootPath)) {
42780
42806
  if (name.startsWith(".")) continue;
42781
- const p = path48.join(worktreesRootPath, name);
42807
+ const p = path49.join(worktreesRootPath, name);
42782
42808
  let st;
42783
42809
  try {
42784
42810
  st = await fs32.promises.stat(p);
@@ -42795,7 +42821,7 @@ async function discoverSessionWorktreeOnDisk(options) {
42795
42821
  for (const key of keys) {
42796
42822
  if (isCliImmediateShutdownRequested()) return null;
42797
42823
  await yieldToEventLoop();
42798
- const layoutRoot = path48.join(worktreesRootPath, key);
42824
+ const layoutRoot = path49.join(worktreesRootPath, key);
42799
42825
  let layoutSt;
42800
42826
  try {
42801
42827
  layoutSt = await fs32.promises.stat(layoutRoot);
@@ -42803,16 +42829,16 @@ async function discoverSessionWorktreeOnDisk(options) {
42803
42829
  continue;
42804
42830
  }
42805
42831
  if (!layoutSt.isDirectory()) continue;
42806
- const sessionDir = path48.join(layoutRoot, sid);
42832
+ const sessionDir = path49.join(layoutRoot, sid);
42807
42833
  const nested = await tryBindingFromSessionDirectory(sessionDir);
42808
42834
  if (nested) return nested;
42809
42835
  const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
42810
42836
  if (legacy.paths.length > 0) {
42811
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path48.resolve(legacy.paths[0]);
42837
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path49.resolve(legacy.paths[0]);
42812
42838
  return {
42813
- sessionParentPath: path48.resolve(isolated),
42814
- workingTreeRelRoot: path48.resolve(layoutRoot),
42815
- repoCheckoutPaths: legacy.paths.map((p) => path48.resolve(p))
42839
+ sessionParentPath: path49.resolve(isolated),
42840
+ workingTreeRelRoot: path49.resolve(layoutRoot),
42841
+ repoCheckoutPaths: legacy.paths.map((p) => path49.resolve(p))
42816
42842
  };
42817
42843
  }
42818
42844
  }
@@ -42821,29 +42847,29 @@ async function discoverSessionWorktreeOnDisk(options) {
42821
42847
 
42822
42848
  // src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
42823
42849
  import * as fs33 from "node:fs";
42824
- import * as path50 from "node:path";
42850
+ import * as path51 from "node:path";
42825
42851
 
42826
42852
  // src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
42827
- import * as path49 from "node:path";
42853
+ import * as path50 from "node:path";
42828
42854
  async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
42829
42855
  const sid = sessionId.trim();
42830
42856
  if (!sid) return null;
42831
- const hintR = path49.resolve(checkoutPath);
42857
+ const hintR = path50.resolve(checkoutPath);
42832
42858
  let best = null;
42833
- let cur = path49.dirname(hintR);
42859
+ let cur = path50.dirname(hintR);
42834
42860
  for (let i = 0; i < 40; i++) {
42835
42861
  if (isCliImmediateShutdownRequested()) return best;
42836
42862
  await yieldToEventLoop();
42837
42863
  const paths = await collectWorktreeRootsNamed(cur, sid);
42838
- if (paths.paths.some((p) => path49.resolve(p) === hintR)) {
42839
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path49.resolve(paths.paths[0]);
42864
+ if (paths.paths.some((p) => path50.resolve(p) === hintR)) {
42865
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path50.resolve(paths.paths[0]);
42840
42866
  best = {
42841
- sessionParentPath: path49.resolve(isolated),
42842
- workingTreeRelRoot: path49.resolve(cur),
42843
- repoCheckoutPaths: paths.paths.map((p) => path49.resolve(p))
42867
+ sessionParentPath: path50.resolve(isolated),
42868
+ workingTreeRelRoot: path50.resolve(cur),
42869
+ repoCheckoutPaths: paths.paths.map((p) => path50.resolve(p))
42844
42870
  };
42845
42871
  }
42846
- const next = path49.dirname(cur);
42872
+ const next = path50.dirname(cur);
42847
42873
  if (next === cur) break;
42848
42874
  cur = next;
42849
42875
  }
@@ -42854,12 +42880,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
42854
42880
  async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeRootPathOrHint, sessionId) {
42855
42881
  const sid = sessionId.trim();
42856
42882
  if (!sid) return null;
42857
- const hint = path50.resolve(sessionWorktreeRootPathOrHint);
42858
- const underHint = await tryBindingFromSessionDirectory(path50.join(hint, sid));
42883
+ const hint = path51.resolve(sessionWorktreeRootPathOrHint);
42884
+ const underHint = await tryBindingFromSessionDirectory(path51.join(hint, sid));
42859
42885
  if (underHint) return underHint;
42860
42886
  const direct = await tryBindingFromSessionDirectory(hint);
42861
42887
  if (direct) {
42862
- if (path50.basename(hint) === sid && await isGitDir(hint)) {
42888
+ if (path51.basename(hint) === sid && await isGitDir(hint)) {
42863
42889
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
42864
42890
  if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
42865
42891
  return legacyFromCheckout;
@@ -42867,7 +42893,7 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeR
42867
42893
  }
42868
42894
  return direct;
42869
42895
  }
42870
- if (path50.basename(hint) === sid && await isGitDir(hint)) {
42896
+ if (path51.basename(hint) === sid && await isGitDir(hint)) {
42871
42897
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
42872
42898
  if (legacyFromCheckout) return legacyFromCheckout;
42873
42899
  }
@@ -42880,11 +42906,11 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeR
42880
42906
  if (!st.isDirectory()) return null;
42881
42907
  const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
42882
42908
  if (legacyPaths.paths.length === 0) return null;
42883
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path50.resolve(legacyPaths.paths[0]);
42909
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path51.resolve(legacyPaths.paths[0]);
42884
42910
  return {
42885
- sessionParentPath: path50.resolve(isolated),
42911
+ sessionParentPath: path51.resolve(isolated),
42886
42912
  workingTreeRelRoot: hint,
42887
- repoCheckoutPaths: legacyPaths.paths.map((p) => path50.resolve(p))
42913
+ repoCheckoutPaths: legacyPaths.paths.map((p) => path51.resolve(p))
42888
42914
  };
42889
42915
  }
42890
42916
 
@@ -42946,11 +42972,11 @@ function parseSessionParent(v) {
42946
42972
 
42947
42973
  // src/worktrees/prepare-new-session-worktrees.ts
42948
42974
  import * as fs35 from "node:fs";
42949
- import * as path52 from "node:path";
42975
+ import * as path53 from "node:path";
42950
42976
 
42951
42977
  // src/git/discover-repos.ts
42952
42978
  import * as fs34 from "node:fs";
42953
- import * as path51 from "node:path";
42979
+ import * as path52 from "node:path";
42954
42980
  var GIT_DISCOVER_YIELD_EVERY = 32;
42955
42981
  async function yieldGitDiscoverWork(entryCount) {
42956
42982
  if (entryCount > 0 && entryCount % GIT_DISCOVER_YIELD_EVERY === 0) {
@@ -42959,7 +42985,7 @@ async function yieldGitDiscoverWork(entryCount) {
42959
42985
  }
42960
42986
  async function discoverGitRepos(cwd = getBridgeRoot()) {
42961
42987
  const result = [];
42962
- const cwdResolved = path51.resolve(cwd);
42988
+ const cwdResolved = path52.resolve(cwd);
42963
42989
  if (await isGitRepoDirectory(cwdResolved)) {
42964
42990
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
42965
42991
  result.push({ absolutePath: cwdResolved, remoteUrl });
@@ -42974,7 +43000,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
42974
43000
  await yieldGitDiscoverWork(i + 1);
42975
43001
  const ent = entries[i];
42976
43002
  if (!ent.isDirectory()) continue;
42977
- const childPath2 = path51.join(cwdResolved, ent.name);
43003
+ const childPath2 = path52.join(cwdResolved, ent.name);
42978
43004
  if (await isGitRepoDirectory(childPath2)) {
42979
43005
  const remoteUrl = await getRemoteOriginUrl(childPath2);
42980
43006
  result.push({ absolutePath: childPath2, remoteUrl });
@@ -42983,12 +43009,12 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
42983
43009
  return result;
42984
43010
  }
42985
43011
  async function discoverGitReposUnderRoot(rootPath) {
42986
- const root = path51.resolve(rootPath);
43012
+ const root = path52.resolve(rootPath);
42987
43013
  const roots = [];
42988
43014
  let walkEntries = 0;
42989
43015
  async function walk(dir) {
42990
43016
  if (await isGitRepoDirectory(dir)) {
42991
- roots.push(path51.resolve(dir));
43017
+ roots.push(path52.resolve(dir));
42992
43018
  return;
42993
43019
  }
42994
43020
  let entries;
@@ -43001,7 +43027,7 @@ async function discoverGitReposUnderRoot(rootPath) {
43001
43027
  await yieldGitDiscoverWork(++walkEntries);
43002
43028
  const ent = entries[i];
43003
43029
  if (!ent.isDirectory() || ent.name === ".git") continue;
43004
- await walk(path51.join(dir, ent.name));
43030
+ await walk(path52.join(dir, ent.name));
43005
43031
  }
43006
43032
  }
43007
43033
  await walk(root);
@@ -43036,10 +43062,10 @@ function resolveBaseRefForRepo(relNorm, baseBranches) {
43036
43062
  }
43037
43063
  async function prepareNewSessionWorktrees(options) {
43038
43064
  const { worktreesRootPath, bridgeRoot, sessionId, layout, log: log2, worktreeBaseBranches } = options;
43039
- const bridgeResolved = path52.resolve(bridgeRoot);
43065
+ const bridgeResolved = path53.resolve(bridgeRoot);
43040
43066
  const cwdKey = allocateDirNameForLauncherCwd(layout, bridgeResolved);
43041
- const bridgeKeyDir = path52.join(worktreesRootPath, cwdKey);
43042
- const sessionDir = path52.join(bridgeKeyDir, sessionId);
43067
+ const bridgeKeyDir = path53.join(worktreesRootPath, cwdKey);
43068
+ const sessionDir = path53.join(bridgeKeyDir, sessionId);
43043
43069
  const repos = await discoverGitReposUnderRoot(bridgeResolved);
43044
43070
  if (repos.length === 0) {
43045
43071
  log2("[worktrees] No Git repositories under bridge root; skipping worktree creation.");
@@ -43049,12 +43075,12 @@ async function prepareNewSessionWorktrees(options) {
43049
43075
  const worktreePaths = [];
43050
43076
  fs35.mkdirSync(sessionDir, { recursive: true });
43051
43077
  for (const repo of repos) {
43052
- let rel = path52.relative(bridgeResolved, repo.absolutePath);
43053
- if (rel.startsWith("..") || path52.isAbsolute(rel)) continue;
43078
+ let rel = path53.relative(bridgeResolved, repo.absolutePath);
43079
+ if (rel.startsWith("..") || path53.isAbsolute(rel)) continue;
43054
43080
  const relNorm = normalizeRepoRelPath2(rel === "" ? "." : rel);
43055
- const wtPath = relNorm === "." ? sessionDir : path52.join(sessionDir, relNorm);
43081
+ const wtPath = relNorm === "." ? sessionDir : path53.join(sessionDir, relNorm);
43056
43082
  if (relNorm !== ".") {
43057
- fs35.mkdirSync(path52.dirname(wtPath), { recursive: true });
43083
+ fs35.mkdirSync(path53.dirname(wtPath), { recursive: true });
43058
43084
  }
43059
43085
  const baseRef = resolveBaseRefForRepo(relNorm, worktreeBaseBranches);
43060
43086
  try {
@@ -43107,9 +43133,9 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
43107
43133
  }
43108
43134
 
43109
43135
  // src/worktrees/manager/resolve-explicit-session-parent-path.ts
43110
- import * as path53 from "node:path";
43136
+ import * as path54 from "node:path";
43111
43137
  async function resolveExplicitSessionParentPath(params) {
43112
- const resolved = path53.resolve(params.parentPathRaw);
43138
+ const resolved = path54.resolve(params.parentPathRaw);
43113
43139
  if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
43114
43140
  return resolved;
43115
43141
  }
@@ -43126,7 +43152,7 @@ async function resolveExplicitSessionParentPath(params) {
43126
43152
  await yieldToEventLoop();
43127
43153
  const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
43128
43154
  if (tryRoot) return rememberAndReturn(tryRoot);
43129
- const next = path53.dirname(cur);
43155
+ const next = path54.dirname(cur);
43130
43156
  if (next === cur) break;
43131
43157
  cur = next;
43132
43158
  }
@@ -43236,7 +43262,7 @@ function createSessionWorktreeGitApi(ctx) {
43236
43262
  await renameSessionWorktreeBranch(ctx.cache, sessionId, newBranch, ctx.log);
43237
43263
  },
43238
43264
  async removeSessionWorktrees(sessionId) {
43239
- await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.log);
43265
+ await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.worktreesRootPath, ctx.log);
43240
43266
  },
43241
43267
  async commitSession(params) {
43242
43268
  return commitSessionWorktree(ctx.cache, params);
@@ -43265,17 +43291,17 @@ var SessionWorktreeManager = class {
43265
43291
  };
43266
43292
 
43267
43293
  // src/worktrees/manager/default-worktrees-root-path.ts
43268
- import * as path54 from "node:path";
43294
+ import * as path55 from "node:path";
43269
43295
  import os9 from "node:os";
43270
43296
  function defaultWorktreesRootPath() {
43271
- return path54.join(os9.homedir(), ".buildautomaton", "worktrees");
43297
+ return path55.join(os9.homedir(), ".buildautomaton", "worktrees");
43272
43298
  }
43273
43299
 
43274
43300
  // src/files/watch-file-index.ts
43275
- import path59 from "node:path";
43301
+ import path60 from "node:path";
43276
43302
 
43277
43303
  // src/files/index/build-file-index.ts
43278
- import path55 from "node:path";
43304
+ import path56 from "node:path";
43279
43305
 
43280
43306
  // src/files/index/file-index-sqlite-lock.ts
43281
43307
  var fileIndexChain = Promise.resolve();
@@ -43366,7 +43392,7 @@ function assertNotShutdown2() {
43366
43392
  if (isCliImmediateShutdownRequested()) throw new CliSqliteInterrupted();
43367
43393
  }
43368
43394
  async function buildFileIndexAsync(cwd) {
43369
- const resolved = path55.resolve(cwd);
43395
+ const resolved = path56.resolve(cwd);
43370
43396
  await yieldToEventLoop();
43371
43397
  assertNotShutdown2();
43372
43398
  const paths = await collectWorkspacePathsAsync(resolved);
@@ -43379,7 +43405,7 @@ async function buildFileIndexAsync(cwd) {
43379
43405
  }
43380
43406
 
43381
43407
  // src/files/index/ensure-file-index.ts
43382
- import path56 from "node:path";
43408
+ import path57 from "node:path";
43383
43409
 
43384
43410
  // src/files/index/search-file-index.ts
43385
43411
  function escapeLikePattern(fragment) {
@@ -43431,7 +43457,7 @@ async function searchBridgeFilePathsAsync(resolvedCwd, query, limit = 100) {
43431
43457
 
43432
43458
  // src/files/index/ensure-file-index.ts
43433
43459
  async function ensureFileIndexAsync(cwd) {
43434
- const resolved = path56.resolve(cwd);
43460
+ const resolved = path57.resolve(cwd);
43435
43461
  if (await bridgeFileIndexIsPopulated(resolved)) {
43436
43462
  return { fromCache: true, pathCount: await bridgeFileIndexPathCount(resolved) };
43437
43463
  }
@@ -43480,10 +43506,10 @@ function createFileIndexFsWatcher(resolved, schedule) {
43480
43506
 
43481
43507
  // src/files/index/file-index-incremental-symbol-updates.ts
43482
43508
  import fs36 from "node:fs";
43483
- import path57 from "node:path";
43509
+ import path58 from "node:path";
43484
43510
  async function applyIncrementalSymbolIndexUpdates(resolved, relPaths) {
43485
43511
  for (const rel of relPaths) {
43486
- const absPath = path57.join(resolved, rel);
43512
+ const absPath = path58.join(resolved, rel);
43487
43513
  try {
43488
43514
  const stat3 = await fs36.promises.stat(absPath);
43489
43515
  if (stat3.isFile()) {
@@ -43503,9 +43529,9 @@ async function applyIncrementalSymbolIndexUpdates(resolved, relPaths) {
43503
43529
  }
43504
43530
 
43505
43531
  // src/files/index/file-index-initial-builds.ts
43506
- import path58 from "node:path";
43532
+ import path59 from "node:path";
43507
43533
  async function runInitialIndexBuilds(cwd = getBridgeRoot()) {
43508
- const resolved = path58.resolve(cwd);
43534
+ const resolved = path59.resolve(cwd);
43509
43535
  try {
43510
43536
  await buildFileIndexAsync(resolved);
43511
43537
  await buildSymbolIndexAsync(resolved);
@@ -43523,7 +43549,7 @@ function scheduleInitialIndexBuilds(cwd = getBridgeRoot()) {
43523
43549
  // src/files/watch-file-index.ts
43524
43550
  var MAX_INCREMENTAL_SYMBOL_UPDATES = 512;
43525
43551
  function startFileIndexWatcher(cwd = getBridgeRoot()) {
43526
- const resolved = path59.resolve(cwd);
43552
+ const resolved = path60.resolve(cwd);
43527
43553
  let timer = null;
43528
43554
  const pendingSymbolUpdates = /* @__PURE__ */ new Set();
43529
43555
  let needsFullSymbolRebuild = false;
@@ -43585,7 +43611,7 @@ function startFileIndexWatcher(cwd = getBridgeRoot()) {
43585
43611
  }
43586
43612
 
43587
43613
  // src/connection/create-bridge-connection.ts
43588
- import * as path73 from "node:path";
43614
+ import * as path74 from "node:path";
43589
43615
 
43590
43616
  // src/dev-servers/manager/dev-server-manager.ts
43591
43617
  import { rm as rm2 } from "node:fs/promises";
@@ -43895,10 +43921,10 @@ function trySpawnShellTruePiped(command, env, cwd, devNullFd, signal) {
43895
43921
  import { spawn as spawn7 } from "node:child_process";
43896
43922
  import fs39 from "node:fs";
43897
43923
  import { tmpdir } from "node:os";
43898
- import path60 from "node:path";
43924
+ import path61 from "node:path";
43899
43925
  function trySpawnMergedLogFile(command, env, cwd, signal) {
43900
- const tmpRoot = fs39.mkdtempSync(path60.join(tmpdir(), "ba-devsrv-log-"));
43901
- const logPath = path60.join(tmpRoot, "combined.log");
43926
+ const tmpRoot = fs39.mkdtempSync(path61.join(tmpdir(), "ba-devsrv-log-"));
43927
+ const logPath = path61.join(tmpRoot, "combined.log");
43902
43928
  let logFd;
43903
43929
  try {
43904
43930
  logFd = fs39.openSync(logPath, "a");
@@ -43942,15 +43968,15 @@ function trySpawnMergedLogFile(command, env, cwd, signal) {
43942
43968
  import { spawn as spawn8 } from "node:child_process";
43943
43969
  import fs40 from "node:fs";
43944
43970
  import { tmpdir as tmpdir2 } from "node:os";
43945
- import path61 from "node:path";
43971
+ import path62 from "node:path";
43946
43972
  function shSingleQuote(s) {
43947
43973
  return `'${s.replace(/'/g, `'\\''`)}'`;
43948
43974
  }
43949
43975
  function trySpawnShellScriptLogRedirectUnix(command, env, cwd, signal) {
43950
- const tmpRoot = fs40.mkdtempSync(path61.join(tmpdir2(), "ba-devsrv-sh-"));
43951
- const logPath = path61.join(tmpRoot, "combined.log");
43952
- const innerPath = path61.join(tmpRoot, "_cmd.sh");
43953
- const runnerPath = path61.join(tmpRoot, "_run.sh");
43976
+ const tmpRoot = fs40.mkdtempSync(path62.join(tmpdir2(), "ba-devsrv-sh-"));
43977
+ const logPath = path62.join(tmpRoot, "combined.log");
43978
+ const innerPath = path62.join(tmpRoot, "_cmd.sh");
43979
+ const runnerPath = path62.join(tmpRoot, "_run.sh");
43954
43980
  try {
43955
43981
  fs40.writeFileSync(innerPath, `#!/bin/sh
43956
43982
  ${command}
@@ -43981,9 +44007,9 @@ cd ${shSingleQuote(cwd)}
43981
44007
  }
43982
44008
  }
43983
44009
  function trySpawnShellScriptLogRedirectWin(command, env, cwd, signal) {
43984
- const tmpRoot = fs40.mkdtempSync(path61.join(tmpdir2(), "ba-devsrv-sh-"));
43985
- const logPath = path61.join(tmpRoot, "combined.log");
43986
- const runnerPath = path61.join(tmpRoot, "_run.bat");
44010
+ const tmpRoot = fs40.mkdtempSync(path62.join(tmpdir2(), "ba-devsrv-sh-"));
44011
+ const logPath = path62.join(tmpRoot, "combined.log");
44012
+ const runnerPath = path62.join(tmpRoot, "_run.bat");
43987
44013
  const q = (p) => `"${p.replace(/"/g, '""')}"`;
43988
44014
  const com = process.env.ComSpec || "cmd.exe";
43989
44015
  try {
@@ -44933,15 +44959,15 @@ async function yieldSkillDiscoveryWork(entryCount) {
44933
44959
 
44934
44960
  // src/skills/discovery/discover-local-skills.ts
44935
44961
  import fs41 from "node:fs";
44936
- import path62 from "node:path";
44962
+ import path63 from "node:path";
44937
44963
  function collectSkillFromDir(rel, base, name, seenKeys, out) {
44938
- const dir = path62.join(base, name);
44964
+ const dir = path63.join(base, name);
44939
44965
  try {
44940
44966
  if (!fs41.statSync(dir).isDirectory()) return;
44941
44967
  } catch {
44942
44968
  return;
44943
44969
  }
44944
- const skillMd = path62.join(dir, "SKILL.md");
44970
+ const skillMd = path63.join(dir, "SKILL.md");
44945
44971
  if (!fs41.existsSync(skillMd)) return;
44946
44972
  const key = `${rel}/${name}`;
44947
44973
  if (seenKeys.has(key)) return;
@@ -44954,7 +44980,7 @@ async function discoverLocalSkillsAsync(cwd) {
44954
44980
  let work = 0;
44955
44981
  for (const rel of SKILL_DISCOVERY_ROOTS) {
44956
44982
  await yieldSkillDiscoveryWork(++work);
44957
- const base = path62.join(cwd, rel);
44983
+ const base = path63.join(cwd, rel);
44958
44984
  if (!fs41.existsSync(base) || !fs41.statSync(base).isDirectory()) continue;
44959
44985
  let entries = [];
44960
44986
  try {
@@ -44972,15 +44998,15 @@ async function discoverLocalSkillsAsync(cwd) {
44972
44998
 
44973
44999
  // src/skills/discovery/discover-skill-layout-roots.ts
44974
45000
  import fs42 from "node:fs";
44975
- import path63 from "node:path";
45001
+ import path64 from "node:path";
44976
45002
  function collectLayoutSkill(rel, base, name, skills2) {
44977
- const dir = path63.join(base, name);
45003
+ const dir = path64.join(base, name);
44978
45004
  try {
44979
45005
  if (!fs42.statSync(dir).isDirectory()) return;
44980
45006
  } catch {
44981
45007
  return;
44982
45008
  }
44983
- if (!fs42.existsSync(path63.join(dir, "SKILL.md"))) return;
45009
+ if (!fs42.existsSync(path64.join(dir, "SKILL.md"))) return;
44984
45010
  const relPath = `${rel}/${name}`.replace(/\\/g, "/");
44985
45011
  skills2.push({ name, relPath });
44986
45012
  }
@@ -44989,7 +45015,7 @@ async function discoverSkillLayoutRootsAsync(cwd) {
44989
45015
  let work = 0;
44990
45016
  for (const rel of SKILL_DISCOVERY_ROOTS) {
44991
45017
  await yieldSkillDiscoveryWork(++work);
44992
- const base = path63.join(cwd, rel);
45018
+ const base = path64.join(cwd, rel);
44993
45019
  if (!fs42.existsSync(base) || !fs42.statSync(base).isDirectory()) continue;
44994
45020
  let entries = [];
44995
45021
  try {
@@ -45341,7 +45367,7 @@ import fs44 from "node:fs";
45341
45367
 
45342
45368
  // src/git/snapshot/capture.ts
45343
45369
  import * as fs43 from "node:fs";
45344
- import * as path64 from "node:path";
45370
+ import * as path65 from "node:path";
45345
45371
 
45346
45372
  // src/git/snapshot/git.ts
45347
45373
  async function gitStashCreate(repoRoot, log2) {
@@ -45381,7 +45407,7 @@ async function gitRun(repoRoot, args, log2, label) {
45381
45407
  async function resolveSnapshotRepoRoots(options) {
45382
45408
  const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
45383
45409
  if (worktreePaths?.length) {
45384
- const uniq = [...new Set(worktreePaths.map((p) => path64.resolve(p)))];
45410
+ const uniq = [...new Set(worktreePaths.map((p) => path65.resolve(p)))];
45385
45411
  return uniq;
45386
45412
  }
45387
45413
  try {
@@ -45389,7 +45415,7 @@ async function resolveSnapshotRepoRoots(options) {
45389
45415
  const mapped = repos.map((r) => r.absolutePath);
45390
45416
  const sid = sessionId?.trim();
45391
45417
  if (sid) {
45392
- const filtered = mapped.filter((root) => path64.basename(root) === sid);
45418
+ const filtered = mapped.filter((root) => path65.basename(root) === sid);
45393
45419
  if (filtered.length > 0) return filtered;
45394
45420
  }
45395
45421
  return mapped;
@@ -45420,7 +45446,7 @@ async function capturePreTurnSnapshot(options) {
45420
45446
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
45421
45447
  repos
45422
45448
  };
45423
- const filePath = path64.join(dir, `${runId}.json`);
45449
+ const filePath = path65.join(dir, `${runId}.json`);
45424
45450
  try {
45425
45451
  fs43.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
45426
45452
  } catch (e) {
@@ -45763,9 +45789,9 @@ function parseChangeSummarySnapshots(raw) {
45763
45789
  for (const item of raw) {
45764
45790
  if (!item || typeof item !== "object") continue;
45765
45791
  const o = item;
45766
- const path75 = typeof o.path === "string" && o.path.trim() !== "" ? o.path.trim() : "";
45767
- if (!path75) continue;
45768
- const row = { path: path75 };
45792
+ const path76 = typeof o.path === "string" && o.path.trim() !== "" ? o.path.trim() : "";
45793
+ if (!path76) continue;
45794
+ const row = { path: path76 };
45769
45795
  if (typeof o.patchContent === "string") row.patchContent = o.patchContent;
45770
45796
  if (typeof o.oldText === "string") row.oldText = o.oldText;
45771
45797
  if (typeof o.newText === "string") row.newText = o.newText;
@@ -45976,8 +46002,8 @@ function randomSecret() {
45976
46002
  }
45977
46003
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
45978
46004
  }
45979
- async function requestPreviewApi(port, secret, method, path75, body) {
45980
- const url2 = `http://127.0.0.1:${port}${path75}`;
46005
+ async function requestPreviewApi(port, secret, method, path76, body) {
46006
+ const url2 = `http://127.0.0.1:${port}${path76}`;
45981
46007
  const headers = {
45982
46008
  [PREVIEW_SECRET_HEADER]: secret,
45983
46009
  "Content-Type": "application/json"
@@ -45989,7 +46015,7 @@ async function requestPreviewApi(port, secret, method, path75, body) {
45989
46015
  });
45990
46016
  const data = await res.json().catch(() => ({}));
45991
46017
  if (!res.ok) {
45992
- throw new Error(data?.error ?? `Preview API ${method} ${path75}: ${res.status}`);
46018
+ throw new Error(data?.error ?? `Preview API ${method} ${path76}: ${res.status}`);
45993
46019
  }
45994
46020
  return data;
45995
46021
  }
@@ -46168,11 +46194,11 @@ async function resolveFileBrowserSessionParent(sessionWorktreeManager, sessionId
46168
46194
  import fs46 from "node:fs";
46169
46195
 
46170
46196
  // src/files/ensure-under-cwd.ts
46171
- import path65 from "node:path";
46197
+ import path66 from "node:path";
46172
46198
  function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
46173
- const normalized = path65.normalize(relativePath).replace(/^(\.\/)+/, "");
46174
- const resolved = path65.resolve(cwd, normalized);
46175
- if (!resolved.startsWith(cwd + path65.sep) && resolved !== cwd) {
46199
+ const normalized = path66.normalize(relativePath).replace(/^(\.\/)+/, "");
46200
+ const resolved = path66.resolve(cwd, normalized);
46201
+ if (!resolved.startsWith(cwd + path66.sep) && resolved !== cwd) {
46176
46202
  return null;
46177
46203
  }
46178
46204
  return resolved;
@@ -46182,11 +46208,11 @@ function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
46182
46208
  var LIST_DIR_YIELD_EVERY = 256;
46183
46209
 
46184
46210
  // src/files/list-dir/map-dir-entry.ts
46185
- import path66 from "node:path";
46211
+ import path67 from "node:path";
46186
46212
  import fs45 from "node:fs";
46187
46213
  async function mapDirEntry(d, relativePath, resolved) {
46188
- const entryPath = path66.join(relativePath || ".", d.name).replace(/\\/g, "/");
46189
- const fullPath = path66.join(resolved, d.name);
46214
+ const entryPath = path67.join(relativePath || ".", d.name).replace(/\\/g, "/");
46215
+ const fullPath = path67.join(resolved, d.name);
46190
46216
  let isDir = d.isDirectory();
46191
46217
  if (d.isSymbolicLink()) {
46192
46218
  try {
@@ -46236,13 +46262,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
46236
46262
  }
46237
46263
 
46238
46264
  // src/files/handle-file-browser-search.ts
46239
- import path67 from "node:path";
46265
+ import path68 from "node:path";
46240
46266
  var SEARCH_LIMIT = 100;
46241
46267
  function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
46242
46268
  void (async () => {
46243
46269
  await yieldToEventLoop();
46244
46270
  const q = typeof msg.q === "string" ? msg.q : "";
46245
- const sessionParentPath = path67.resolve(
46271
+ const sessionParentPath = path68.resolve(
46246
46272
  sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
46247
46273
  );
46248
46274
  if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
@@ -46452,13 +46478,13 @@ function triggerSymbolIndexBuild(parentPath) {
46452
46478
  }
46453
46479
 
46454
46480
  // src/git/tree/resolve-repo-abs-path.ts
46455
- import * as path68 from "node:path";
46481
+ import * as path69 from "node:path";
46456
46482
  function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
46457
- const bridgeResolved = path68.resolve(bridgeRoot);
46483
+ const bridgeResolved = path69.resolve(bridgeRoot);
46458
46484
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
46459
- const repoPath = rel === "" ? bridgeResolved : path68.join(bridgeResolved, rel);
46460
- const resolved = path68.resolve(repoPath);
46461
- if (!resolved.startsWith(bridgeResolved + path68.sep) && resolved !== bridgeResolved) {
46485
+ const repoPath = rel === "" ? bridgeResolved : path69.join(bridgeResolved, rel);
46486
+ const resolved = path69.resolve(repoPath);
46487
+ if (!resolved.startsWith(bridgeResolved + path69.sep) && resolved !== bridgeResolved) {
46462
46488
  return null;
46463
46489
  }
46464
46490
  return resolved;
@@ -47241,7 +47267,7 @@ function isValidRemoteSkillInstallItem(item) {
47241
47267
 
47242
47268
  // src/skills/install/install-remote-skills-async.ts
47243
47269
  import fs50 from "node:fs";
47244
- import path69 from "node:path";
47270
+ import path70 from "node:path";
47245
47271
 
47246
47272
  // src/skills/install/constants.ts
47247
47273
  var INSTALL_SKILLS_YIELD_EVERY = 16;
@@ -47252,8 +47278,8 @@ async function writeInstallFileAsync(skillDir, f, filesWritten) {
47252
47278
  if (++filesWritten.count % INSTALL_SKILLS_YIELD_EVERY === 0) {
47253
47279
  await yieldToEventLoop();
47254
47280
  }
47255
- const dest = path69.join(skillDir, f.path);
47256
- await fs50.promises.mkdir(path69.dirname(dest), { recursive: true });
47281
+ const dest = path70.join(skillDir, f.path);
47282
+ await fs50.promises.mkdir(path70.dirname(dest), { recursive: true });
47257
47283
  if (f.text !== void 0) {
47258
47284
  await fs50.promises.writeFile(dest, f.text, "utf8");
47259
47285
  } else if (f.base64) {
@@ -47269,7 +47295,7 @@ async function installRemoteSkillsAsync(cwd, targetDir, items) {
47269
47295
  try {
47270
47296
  for (const item of items) {
47271
47297
  if (!isValidRemoteSkillInstallItem(item)) continue;
47272
- const skillDir = path69.join(cwd, targetDir, item.skillName);
47298
+ const skillDir = path70.join(cwd, targetDir, item.skillName);
47273
47299
  for (const f of item.files) {
47274
47300
  await writeInstallFileAsync(skillDir, f, filesWritten);
47275
47301
  }
@@ -47608,7 +47634,7 @@ var handleDevServersConfig = (msg, deps) => {
47608
47634
  };
47609
47635
 
47610
47636
  // src/git/bridge-git-context.ts
47611
- import * as path70 from "node:path";
47637
+ import * as path71 from "node:path";
47612
47638
 
47613
47639
  // src/git/branches/get-current-branch.ts
47614
47640
  async function getCurrentBranch(repoPath) {
@@ -47658,12 +47684,12 @@ async function listRepoBranchRefs(repoPath) {
47658
47684
  // src/git/bridge-git-context.ts
47659
47685
  function folderNameForRelPath(relPath, bridgeRoot) {
47660
47686
  if (relPath === "." || relPath === "") {
47661
- return path70.basename(path70.resolve(bridgeRoot)) || "repo";
47687
+ return path71.basename(path71.resolve(bridgeRoot)) || "repo";
47662
47688
  }
47663
- return path70.basename(relPath) || relPath;
47689
+ return path71.basename(relPath) || relPath;
47664
47690
  }
47665
47691
  async function discoverGitReposForBridgeContext(bridgeRoot) {
47666
- const root = path70.resolve(bridgeRoot);
47692
+ const root = path71.resolve(bridgeRoot);
47667
47693
  if (await isGitRepoDirectory(root)) {
47668
47694
  const remoteUrl = await getRemoteOriginUrl(root);
47669
47695
  return [{ absolutePath: root, remoteUrl }];
@@ -47671,19 +47697,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
47671
47697
  const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
47672
47698
  const byPath = /* @__PURE__ */ new Map();
47673
47699
  for (const repo of [...deep, ...shallow]) {
47674
- byPath.set(path70.resolve(repo.absolutePath), repo);
47700
+ byPath.set(path71.resolve(repo.absolutePath), repo);
47675
47701
  }
47676
47702
  return [...byPath.values()];
47677
47703
  }
47678
47704
  async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
47679
- const bridgeResolved = path70.resolve(bridgeRoot);
47705
+ const bridgeResolved = path71.resolve(bridgeRoot);
47680
47706
  const repos = await discoverGitReposForBridgeContext(bridgeResolved);
47681
47707
  const rows = [];
47682
47708
  for (let i = 0; i < repos.length; i++) {
47683
47709
  if (i > 0) await yieldToEventLoop();
47684
47710
  const repo = repos[i];
47685
- let rel = path70.relative(bridgeResolved, repo.absolutePath);
47686
- if (rel.startsWith("..") || path70.isAbsolute(rel)) continue;
47711
+ let rel = path71.relative(bridgeResolved, repo.absolutePath);
47712
+ if (rel.startsWith("..") || path71.isAbsolute(rel)) continue;
47687
47713
  const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
47688
47714
  const currentBranch = await getCurrentBranch(repo.absolutePath);
47689
47715
  const remoteUrl = repo.remoteUrl.trim() || null;
@@ -47698,11 +47724,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
47698
47724
  return rows;
47699
47725
  }
47700
47726
  async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
47701
- const bridgeResolved = path70.resolve(bridgeRoot);
47727
+ const bridgeResolved = path71.resolve(bridgeRoot);
47702
47728
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
47703
- const repoPath = rel === "" ? bridgeResolved : path70.join(bridgeResolved, rel);
47704
- const resolved = path70.resolve(repoPath);
47705
- if (!resolved.startsWith(bridgeResolved + path70.sep) && resolved !== bridgeResolved) {
47729
+ const repoPath = rel === "" ? bridgeResolved : path71.join(bridgeResolved, rel);
47730
+ const resolved = path71.resolve(repoPath);
47731
+ if (!resolved.startsWith(bridgeResolved + path71.sep) && resolved !== bridgeResolved) {
47706
47732
  return [];
47707
47733
  }
47708
47734
  return listRepoBranchRefs(resolved);
@@ -48579,7 +48605,7 @@ async function createBridgeAccessState(options = {}) {
48579
48605
  }
48580
48606
 
48581
48607
  // src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
48582
- import * as path72 from "node:path";
48608
+ import * as path73 from "node:path";
48583
48609
 
48584
48610
  // src/sqlite/hash-json-sha256.ts
48585
48611
  import { createHash as createHash2 } from "node:crypto";
@@ -48646,7 +48672,7 @@ function listCliAgentCapabilityCacheForWorkspace(db, workspaceId) {
48646
48672
  }
48647
48673
 
48648
48674
  // src/agents/capabilities/probe-one-agent-type-for-capabilities.ts
48649
- import * as path71 from "node:path";
48675
+ import * as path72 from "node:path";
48650
48676
  async function probeOneAgentTypeForCapabilities(params) {
48651
48677
  const { agentType, cwd, workspaceId, log: log2, reportAgentCapabilities, bridgeReport = true, shouldContinue } = params;
48652
48678
  const canContinue = () => shouldContinue?.() !== false;
@@ -48684,7 +48710,7 @@ async function probeOneAgentTypeForCapabilities(params) {
48684
48710
  if (!canContinue()) return false;
48685
48711
  handle = await resolved.createClient({
48686
48712
  command: resolved.command,
48687
- cwd: path71.resolve(cwd),
48713
+ cwd: path72.resolve(cwd),
48688
48714
  backendAgentType: agentType,
48689
48715
  sessionMode: "agent",
48690
48716
  persistedAcpSessionId: null,
@@ -48762,7 +48788,7 @@ async function warmupAgentCapabilitiesOnConnect(params) {
48762
48788
  const { workspaceId, log: log2, getWs } = params;
48763
48789
  const isCurrent = beginAgentCapabilityWarmupRun();
48764
48790
  if (!isCurrent()) return;
48765
- const cwd = path72.resolve(getBridgeRoot());
48791
+ const cwd = path73.resolve(getBridgeRoot());
48766
48792
  async function sendBatchFromCache() {
48767
48793
  if (!isCurrent()) return;
48768
48794
  const socket = getWs();
@@ -48997,8 +49023,8 @@ async function createBridgeConnection(options) {
48997
49023
  getCloudAccessToken: () => tokens.accessToken
48998
49024
  });
48999
49025
  const identifyReportedPaths = {
49000
- bridgeRootPath: path73.resolve(getBridgeRoot()),
49001
- worktreesRootPath: path73.resolve(worktreesRootPath)
49026
+ bridgeRootPath: path74.resolve(getBridgeRoot()),
49027
+ worktreesRootPath: path74.resolve(worktreesRootPath)
49002
49028
  };
49003
49029
  const { connect } = createMainBridgeWebSocketLifecycle({
49004
49030
  state,
@@ -49255,7 +49281,7 @@ async function runCliAction(program2, opts) {
49255
49281
  const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAUTOMATON_FIREHOSE_URL ?? process.env.BUILDAUTOMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
49256
49282
  const bridgeRootOpt = (opts.bridgeRoot && typeof opts.bridgeRoot === "string" && opts.bridgeRoot.trim() ? opts.bridgeRoot.trim() : null) ?? (opts.cwd && typeof opts.cwd === "string" && opts.cwd.trim() ? opts.cwd.trim() : null);
49257
49283
  if (bridgeRootOpt) {
49258
- const resolvedBridgeRoot = path74.resolve(process.cwd(), bridgeRootOpt);
49284
+ const resolvedBridgeRoot = path75.resolve(process.cwd(), bridgeRootOpt);
49259
49285
  try {
49260
49286
  const st = fs52.statSync(resolvedBridgeRoot);
49261
49287
  if (!st.isDirectory()) {
@@ -49277,7 +49303,7 @@ async function runCliAction(program2, opts) {
49277
49303
  );
49278
49304
  let worktreesRootPath;
49279
49305
  if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
49280
- worktreesRootPath = path74.resolve(opts.worktreesRoot.trim());
49306
+ worktreesRootPath = path75.resolve(opts.worktreesRoot.trim());
49281
49307
  }
49282
49308
  const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
49283
49309
  if (e2eCertificates) {