@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/index.js CHANGED
@@ -4175,8 +4175,8 @@ var init_parseUtil = __esm({
4175
4175
  init_errors();
4176
4176
  init_en();
4177
4177
  makeIssue = (params) => {
4178
- const { data, path: path73, errorMaps, issueData } = params;
4179
- const fullPath = [...path73, ...issueData.path || []];
4178
+ const { data, path: path74, errorMaps, issueData } = params;
4179
+ const fullPath = [...path74, ...issueData.path || []];
4180
4180
  const fullIssue = {
4181
4181
  ...issueData,
4182
4182
  path: fullPath
@@ -4484,11 +4484,11 @@ var init_types = __esm({
4484
4484
  init_parseUtil();
4485
4485
  init_util();
4486
4486
  ParseInputLazyPath = class {
4487
- constructor(parent, value, path73, key) {
4487
+ constructor(parent, value, path74, key) {
4488
4488
  this._cachedPath = [];
4489
4489
  this.parent = parent;
4490
4490
  this.data = value;
4491
- this._path = path73;
4491
+ this._path = path74;
4492
4492
  this._key = key;
4493
4493
  }
4494
4494
  get path() {
@@ -8103,10 +8103,10 @@ function assignProp(target, prop, value) {
8103
8103
  configurable: true
8104
8104
  });
8105
8105
  }
8106
- function getElementAtPath(obj, path73) {
8107
- if (!path73)
8106
+ function getElementAtPath(obj, path74) {
8107
+ if (!path74)
8108
8108
  return obj;
8109
- return path73.reduce((acc, key) => acc?.[key], obj);
8109
+ return path74.reduce((acc, key) => acc?.[key], obj);
8110
8110
  }
8111
8111
  function promiseAllObject(promisesObj) {
8112
8112
  const keys = Object.keys(promisesObj);
@@ -8355,11 +8355,11 @@ function aborted(x, startIndex = 0) {
8355
8355
  }
8356
8356
  return false;
8357
8357
  }
8358
- function prefixIssues(path73, issues) {
8358
+ function prefixIssues(path74, issues) {
8359
8359
  return issues.map((iss) => {
8360
8360
  var _a2;
8361
8361
  (_a2 = iss).path ?? (_a2.path = []);
8362
- iss.path.unshift(path73);
8362
+ iss.path.unshift(path74);
8363
8363
  return iss;
8364
8364
  });
8365
8365
  }
@@ -8548,7 +8548,7 @@ function treeifyError(error40, _mapper) {
8548
8548
  return issue2.message;
8549
8549
  };
8550
8550
  const result = { errors: [] };
8551
- const processError = (error41, path73 = []) => {
8551
+ const processError = (error41, path74 = []) => {
8552
8552
  var _a2, _b;
8553
8553
  for (const issue2 of error41.issues) {
8554
8554
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -8558,7 +8558,7 @@ function treeifyError(error40, _mapper) {
8558
8558
  } else if (issue2.code === "invalid_element") {
8559
8559
  processError({ issues: issue2.issues }, issue2.path);
8560
8560
  } else {
8561
- const fullpath = [...path73, ...issue2.path];
8561
+ const fullpath = [...path74, ...issue2.path];
8562
8562
  if (fullpath.length === 0) {
8563
8563
  result.errors.push(mapper(issue2));
8564
8564
  continue;
@@ -8588,9 +8588,9 @@ function treeifyError(error40, _mapper) {
8588
8588
  processError(error40);
8589
8589
  return result;
8590
8590
  }
8591
- function toDotPath(path73) {
8591
+ function toDotPath(path74) {
8592
8592
  const segs = [];
8593
- for (const seg of path73) {
8593
+ for (const seg of path74) {
8594
8594
  if (typeof seg === "number")
8595
8595
  segs.push(`[${seg}]`);
8596
8596
  else if (typeof seg === "symbol")
@@ -21596,7 +21596,7 @@ var require_ignore = __commonJS({
21596
21596
  // path matching.
21597
21597
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
21598
21598
  // @returns {TestResult} true if a file is ignored
21599
- test(path73, checkUnignored, mode) {
21599
+ test(path74, checkUnignored, mode) {
21600
21600
  let ignored = false;
21601
21601
  let unignored = false;
21602
21602
  let matchedRule;
@@ -21605,7 +21605,7 @@ var require_ignore = __commonJS({
21605
21605
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
21606
21606
  return;
21607
21607
  }
21608
- const matched = rule[mode].test(path73);
21608
+ const matched = rule[mode].test(path74);
21609
21609
  if (!matched) {
21610
21610
  return;
21611
21611
  }
@@ -21626,17 +21626,17 @@ var require_ignore = __commonJS({
21626
21626
  var throwError = (message, Ctor) => {
21627
21627
  throw new Ctor(message);
21628
21628
  };
21629
- var checkPath = (path73, originalPath, doThrow) => {
21630
- if (!isString(path73)) {
21629
+ var checkPath = (path74, originalPath, doThrow) => {
21630
+ if (!isString(path74)) {
21631
21631
  return doThrow(
21632
21632
  `path must be a string, but got \`${originalPath}\``,
21633
21633
  TypeError
21634
21634
  );
21635
21635
  }
21636
- if (!path73) {
21636
+ if (!path74) {
21637
21637
  return doThrow(`path must not be empty`, TypeError);
21638
21638
  }
21639
- if (checkPath.isNotRelative(path73)) {
21639
+ if (checkPath.isNotRelative(path74)) {
21640
21640
  const r = "`path.relative()`d";
21641
21641
  return doThrow(
21642
21642
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -21645,7 +21645,7 @@ var require_ignore = __commonJS({
21645
21645
  }
21646
21646
  return true;
21647
21647
  };
21648
- var isNotRelative = (path73) => REGEX_TEST_INVALID_PATH.test(path73);
21648
+ var isNotRelative = (path74) => REGEX_TEST_INVALID_PATH.test(path74);
21649
21649
  checkPath.isNotRelative = isNotRelative;
21650
21650
  checkPath.convert = (p) => p;
21651
21651
  var Ignore = class {
@@ -21675,19 +21675,19 @@ var require_ignore = __commonJS({
21675
21675
  }
21676
21676
  // @returns {TestResult}
21677
21677
  _test(originalPath, cache2, checkUnignored, slices) {
21678
- const path73 = originalPath && checkPath.convert(originalPath);
21678
+ const path74 = originalPath && checkPath.convert(originalPath);
21679
21679
  checkPath(
21680
- path73,
21680
+ path74,
21681
21681
  originalPath,
21682
21682
  this._strictPathCheck ? throwError : RETURN_FALSE
21683
21683
  );
21684
- return this._t(path73, cache2, checkUnignored, slices);
21684
+ return this._t(path74, cache2, checkUnignored, slices);
21685
21685
  }
21686
- checkIgnore(path73) {
21687
- if (!REGEX_TEST_TRAILING_SLASH.test(path73)) {
21688
- return this.test(path73);
21686
+ checkIgnore(path74) {
21687
+ if (!REGEX_TEST_TRAILING_SLASH.test(path74)) {
21688
+ return this.test(path74);
21689
21689
  }
21690
- const slices = path73.split(SLASH).filter(Boolean);
21690
+ const slices = path74.split(SLASH).filter(Boolean);
21691
21691
  slices.pop();
21692
21692
  if (slices.length) {
21693
21693
  const parent = this._t(
@@ -21700,18 +21700,18 @@ var require_ignore = __commonJS({
21700
21700
  return parent;
21701
21701
  }
21702
21702
  }
21703
- return this._rules.test(path73, false, MODE_CHECK_IGNORE);
21703
+ return this._rules.test(path74, false, MODE_CHECK_IGNORE);
21704
21704
  }
21705
- _t(path73, cache2, checkUnignored, slices) {
21706
- if (path73 in cache2) {
21707
- return cache2[path73];
21705
+ _t(path74, cache2, checkUnignored, slices) {
21706
+ if (path74 in cache2) {
21707
+ return cache2[path74];
21708
21708
  }
21709
21709
  if (!slices) {
21710
- slices = path73.split(SLASH).filter(Boolean);
21710
+ slices = path74.split(SLASH).filter(Boolean);
21711
21711
  }
21712
21712
  slices.pop();
21713
21713
  if (!slices.length) {
21714
- return cache2[path73] = this._rules.test(path73, checkUnignored, MODE_IGNORE);
21714
+ return cache2[path74] = this._rules.test(path74, checkUnignored, MODE_IGNORE);
21715
21715
  }
21716
21716
  const parent = this._t(
21717
21717
  slices.join(SLASH) + SLASH,
@@ -21719,29 +21719,29 @@ var require_ignore = __commonJS({
21719
21719
  checkUnignored,
21720
21720
  slices
21721
21721
  );
21722
- return cache2[path73] = parent.ignored ? parent : this._rules.test(path73, checkUnignored, MODE_IGNORE);
21722
+ return cache2[path74] = parent.ignored ? parent : this._rules.test(path74, checkUnignored, MODE_IGNORE);
21723
21723
  }
21724
- ignores(path73) {
21725
- return this._test(path73, this._ignoreCache, false).ignored;
21724
+ ignores(path74) {
21725
+ return this._test(path74, this._ignoreCache, false).ignored;
21726
21726
  }
21727
21727
  createFilter() {
21728
- return (path73) => !this.ignores(path73);
21728
+ return (path74) => !this.ignores(path74);
21729
21729
  }
21730
21730
  filter(paths) {
21731
21731
  return makeArray(paths).filter(this.createFilter());
21732
21732
  }
21733
21733
  // @returns {TestResult}
21734
- test(path73) {
21735
- return this._test(path73, this._testCache, true);
21734
+ test(path74) {
21735
+ return this._test(path74, this._testCache, true);
21736
21736
  }
21737
21737
  };
21738
21738
  var factory = (options) => new Ignore(options);
21739
- var isPathValid = (path73) => checkPath(path73 && checkPath.convert(path73), path73, RETURN_FALSE);
21739
+ var isPathValid = (path74) => checkPath(path74 && checkPath.convert(path74), path74, RETURN_FALSE);
21740
21740
  var setupWindows = () => {
21741
21741
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
21742
21742
  checkPath.convert = makePosix;
21743
21743
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
21744
- checkPath.isNotRelative = (path73) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path73) || isNotRelative(path73);
21744
+ checkPath.isNotRelative = (path74) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path74) || isNotRelative(path74);
21745
21745
  };
21746
21746
  if (
21747
21747
  // Detect `process` so that it can run in browsers.
@@ -22530,10 +22530,10 @@ var require_src2 = __commonJS({
22530
22530
  var fs_1 = __require("fs");
22531
22531
  var debug_1 = __importDefault(require_src());
22532
22532
  var log2 = debug_1.default("@kwsites/file-exists");
22533
- function check2(path73, isFile, isDirectory) {
22534
- log2(`checking %s`, path73);
22533
+ function check2(path74, isFile, isDirectory) {
22534
+ log2(`checking %s`, path74);
22535
22535
  try {
22536
- const stat2 = fs_1.statSync(path73);
22536
+ const stat2 = fs_1.statSync(path74);
22537
22537
  if (stat2.isFile() && isFile) {
22538
22538
  log2(`[OK] path represents a file`);
22539
22539
  return true;
@@ -22553,8 +22553,8 @@ var require_src2 = __commonJS({
22553
22553
  throw e;
22554
22554
  }
22555
22555
  }
22556
- function exists2(path73, type = exports.READABLE) {
22557
- return check2(path73, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
22556
+ function exists2(path74, type = exports.READABLE) {
22557
+ return check2(path74, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
22558
22558
  }
22559
22559
  exports.exists = exists2;
22560
22560
  exports.FILE = 1;
@@ -23715,9 +23715,9 @@ function parseChangeSummaryJson(raw, allowedPaths, options) {
23715
23715
  const rawPath = typeof o.path === "string" ? o.path.trim() : "";
23716
23716
  const summary = typeof o.summary === "string" ? o.summary.trim() : "";
23717
23717
  if (!rawPath || !summary) continue;
23718
- const path73 = skip ? normalizeRepoRelativePath(rawPath) || rawPath : resolveChangeSummaryPathAgainstAllowed(rawPath, allowedPaths);
23719
- if (!path73) continue;
23720
- rows.push({ path: path73, summary: clampSummaryToAtMostTwoLines(summary) });
23718
+ const path74 = skip ? normalizeRepoRelativePath(rawPath) || rawPath : resolveChangeSummaryPathAgainstAllowed(rawPath, allowedPaths);
23719
+ if (!path74) continue;
23720
+ rows.push({ path: path74, summary: clampSummaryToAtMostTwoLines(summary) });
23721
23721
  }
23722
23722
  return rows;
23723
23723
  }
@@ -25044,8 +25044,8 @@ function randomSecret() {
25044
25044
  }
25045
25045
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
25046
25046
  }
25047
- async function requestPreviewApi(port, secret, method, path73, body) {
25048
- const url2 = `http://127.0.0.1:${port}${path73}`;
25047
+ async function requestPreviewApi(port, secret, method, path74, body) {
25048
+ const url2 = `http://127.0.0.1:${port}${path74}`;
25049
25049
  const headers = {
25050
25050
  [PREVIEW_SECRET_HEADER]: secret,
25051
25051
  "Content-Type": "application/json"
@@ -25057,7 +25057,7 @@ async function requestPreviewApi(port, secret, method, path73, body) {
25057
25057
  });
25058
25058
  const data = await res.json().catch(() => ({}));
25059
25059
  if (!res.ok) {
25060
- throw new Error(data?.error ?? `Preview API ${method} ${path73}: ${res.status}`);
25060
+ throw new Error(data?.error ?? `Preview API ${method} ${path74}: ${res.status}`);
25061
25061
  }
25062
25062
  return data;
25063
25063
  }
@@ -25272,7 +25272,7 @@ function installBridgeProcessResilience() {
25272
25272
  }
25273
25273
 
25274
25274
  // src/cli-version.ts
25275
- var CLI_VERSION = "0.1.58".length > 0 ? "0.1.58" : "0.0.0-dev";
25275
+ var CLI_VERSION = "0.1.59".length > 0 ? "0.1.59" : "0.0.0-dev";
25276
25276
 
25277
25277
  // src/connection/heartbeat/constants.ts
25278
25278
  var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
@@ -26807,7 +26807,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
26807
26807
  join(moduleDir, "..", sub, filename),
26808
26808
  join(moduleDir, "..", "..", "dist", sub, filename)
26809
26809
  ]);
26810
- const resolved = candidates.find((path73) => existsSync(path73));
26810
+ const resolved = candidates.find((path74) => existsSync(path74));
26811
26811
  if (!resolved) {
26812
26812
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
26813
26813
  }
@@ -32194,8 +32194,8 @@ async function execGitFile(args, options) {
32194
32194
  }
32195
32195
 
32196
32196
  // src/git/changes/parse/normalize-git-diff-path.ts
32197
- function normalizeGitDiffPath(path73) {
32198
- return path73.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
32197
+ function normalizeGitDiffPath(path74) {
32198
+ return path74.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
32199
32199
  }
32200
32200
 
32201
32201
  // src/git/changes/parse/parse-name-status-entries.ts
@@ -32482,9 +32482,9 @@ async function collectTurnGitDiffFromPreTurnSnapshot(options) {
32482
32482
  // src/agents/acp/put-summarize-change-summaries.ts
32483
32483
  async function putEncryptedChangeSummaryRows(params) {
32484
32484
  const base = params.apiBaseUrl.replace(/\/+$/, "");
32485
- const entries = params.rows.map(({ path: path73, summary }) => {
32485
+ const entries = params.rows.map(({ path: path74, summary }) => {
32486
32486
  const enc = params.e2ee.encryptFields({ summary }, ["summary"]);
32487
- return { path: path73, summary: JSON.stringify(enc) };
32487
+ return { path: path74, summary: JSON.stringify(enc) };
32488
32488
  });
32489
32489
  const res = await fetch(
32490
32490
  `${base}/internal/sessions/${encodeURIComponent(params.sessionId)}/follow-ups/summarize-changes`,
@@ -33609,8 +33609,8 @@ function pathspec(...paths) {
33609
33609
  cache.set(key, paths);
33610
33610
  return key;
33611
33611
  }
33612
- function isPathSpec(path73) {
33613
- return path73 instanceof String && cache.has(path73);
33612
+ function isPathSpec(path74) {
33613
+ return path74 instanceof String && cache.has(path74);
33614
33614
  }
33615
33615
  function toPaths(pathSpec) {
33616
33616
  return cache.get(pathSpec) || [];
@@ -33699,8 +33699,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
33699
33699
  function forEachLineWithContent(input, callback) {
33700
33700
  return toLinesWithContent(input, true).map((line) => callback(line));
33701
33701
  }
33702
- function folderExists(path73) {
33703
- return (0, import_file_exists.exists)(path73, import_file_exists.FOLDER);
33702
+ function folderExists(path74) {
33703
+ return (0, import_file_exists.exists)(path74, import_file_exists.FOLDER);
33704
33704
  }
33705
33705
  function append(target, item) {
33706
33706
  if (Array.isArray(target)) {
@@ -34104,8 +34104,8 @@ function checkIsRepoRootTask() {
34104
34104
  commands,
34105
34105
  format: "utf-8",
34106
34106
  onError,
34107
- parser(path73) {
34108
- return /^\.(git)?$/.test(path73.trim());
34107
+ parser(path74) {
34108
+ return /^\.(git)?$/.test(path74.trim());
34109
34109
  }
34110
34110
  };
34111
34111
  }
@@ -34539,11 +34539,11 @@ function parseGrep(grep) {
34539
34539
  const paths = /* @__PURE__ */ new Set();
34540
34540
  const results = {};
34541
34541
  forEachLineWithContent(grep, (input) => {
34542
- const [path73, line, preview] = input.split(NULL);
34543
- paths.add(path73);
34544
- (results[path73] = results[path73] || []).push({
34542
+ const [path74, line, preview] = input.split(NULL);
34543
+ paths.add(path74);
34544
+ (results[path74] = results[path74] || []).push({
34545
34545
  line: asNumber(line),
34546
- path: path73,
34546
+ path: path74,
34547
34547
  preview
34548
34548
  });
34549
34549
  });
@@ -35308,14 +35308,14 @@ var init_hash_object = __esm2({
35308
35308
  init_task();
35309
35309
  }
35310
35310
  });
35311
- function parseInit(bare, path73, text) {
35311
+ function parseInit(bare, path74, text) {
35312
35312
  const response = String(text).trim();
35313
35313
  let result;
35314
35314
  if (result = initResponseRegex.exec(response)) {
35315
- return new InitSummary(bare, path73, false, result[1]);
35315
+ return new InitSummary(bare, path74, false, result[1]);
35316
35316
  }
35317
35317
  if (result = reInitResponseRegex.exec(response)) {
35318
- return new InitSummary(bare, path73, true, result[1]);
35318
+ return new InitSummary(bare, path74, true, result[1]);
35319
35319
  }
35320
35320
  let gitDir = "";
35321
35321
  const tokens = response.split(" ");
@@ -35326,7 +35326,7 @@ function parseInit(bare, path73, text) {
35326
35326
  break;
35327
35327
  }
35328
35328
  }
35329
- return new InitSummary(bare, path73, /^re/i.test(response), gitDir);
35329
+ return new InitSummary(bare, path74, /^re/i.test(response), gitDir);
35330
35330
  }
35331
35331
  var InitSummary;
35332
35332
  var initResponseRegex;
@@ -35335,9 +35335,9 @@ var init_InitSummary = __esm2({
35335
35335
  "src/lib/responses/InitSummary.ts"() {
35336
35336
  "use strict";
35337
35337
  InitSummary = class {
35338
- constructor(bare, path73, existing, gitDir) {
35338
+ constructor(bare, path74, existing, gitDir) {
35339
35339
  this.bare = bare;
35340
- this.path = path73;
35340
+ this.path = path74;
35341
35341
  this.existing = existing;
35342
35342
  this.gitDir = gitDir;
35343
35343
  }
@@ -35349,7 +35349,7 @@ var init_InitSummary = __esm2({
35349
35349
  function hasBareCommand(command) {
35350
35350
  return command.includes(bareCommand);
35351
35351
  }
35352
- function initTask(bare = false, path73, customArgs) {
35352
+ function initTask(bare = false, path74, customArgs) {
35353
35353
  const commands = ["init", ...customArgs];
35354
35354
  if (bare && !hasBareCommand(commands)) {
35355
35355
  commands.splice(1, 0, bareCommand);
@@ -35358,7 +35358,7 @@ function initTask(bare = false, path73, customArgs) {
35358
35358
  commands,
35359
35359
  format: "utf-8",
35360
35360
  parser(text) {
35361
- return parseInit(commands.includes("--bare"), path73, text);
35361
+ return parseInit(commands.includes("--bare"), path74, text);
35362
35362
  }
35363
35363
  };
35364
35364
  }
@@ -36174,12 +36174,12 @@ var init_FileStatusSummary = __esm2({
36174
36174
  "use strict";
36175
36175
  fromPathRegex = /^(.+)\0(.+)$/;
36176
36176
  FileStatusSummary = class {
36177
- constructor(path73, index, working_dir) {
36178
- this.path = path73;
36177
+ constructor(path74, index, working_dir) {
36178
+ this.path = path74;
36179
36179
  this.index = index;
36180
36180
  this.working_dir = working_dir;
36181
36181
  if (index === "R" || working_dir === "R") {
36182
- const detail = fromPathRegex.exec(path73) || [null, path73, path73];
36182
+ const detail = fromPathRegex.exec(path74) || [null, path74, path74];
36183
36183
  this.from = detail[2] || "";
36184
36184
  this.path = detail[1] || "";
36185
36185
  }
@@ -36210,14 +36210,14 @@ function splitLine(result, lineStr) {
36210
36210
  default:
36211
36211
  return;
36212
36212
  }
36213
- function data(index, workingDir, path73) {
36213
+ function data(index, workingDir, path74) {
36214
36214
  const raw = `${index}${workingDir}`;
36215
36215
  const handler = parsers6.get(raw);
36216
36216
  if (handler) {
36217
- handler(result, path73);
36217
+ handler(result, path74);
36218
36218
  }
36219
36219
  if (raw !== "##" && raw !== "!!") {
36220
- result.files.push(new FileStatusSummary(path73, index, workingDir));
36220
+ result.files.push(new FileStatusSummary(path74, index, workingDir));
36221
36221
  }
36222
36222
  }
36223
36223
  }
@@ -36526,9 +36526,9 @@ var init_simple_git_api = __esm2({
36526
36526
  next
36527
36527
  );
36528
36528
  }
36529
- hashObject(path73, write) {
36529
+ hashObject(path74, write) {
36530
36530
  return this._runTask(
36531
- hashObjectTask(path73, write === true),
36531
+ hashObjectTask(path74, write === true),
36532
36532
  trailingFunctionArgument(arguments)
36533
36533
  );
36534
36534
  }
@@ -36881,8 +36881,8 @@ var init_branch = __esm2({
36881
36881
  }
36882
36882
  });
36883
36883
  function toPath(input) {
36884
- const path73 = input.trim().replace(/^["']|["']$/g, "");
36885
- return path73 && normalize3(path73);
36884
+ const path74 = input.trim().replace(/^["']|["']$/g, "");
36885
+ return path74 && normalize3(path74);
36886
36886
  }
36887
36887
  var parseCheckIgnore;
36888
36888
  var init_CheckIgnore = __esm2({
@@ -37196,8 +37196,8 @@ __export2(sub_module_exports, {
37196
37196
  subModuleTask: () => subModuleTask,
37197
37197
  updateSubModuleTask: () => updateSubModuleTask
37198
37198
  });
37199
- function addSubModuleTask(repo, path73) {
37200
- return subModuleTask(["add", repo, path73]);
37199
+ function addSubModuleTask(repo, path74) {
37200
+ return subModuleTask(["add", repo, path74]);
37201
37201
  }
37202
37202
  function initSubModuleTask(customArgs) {
37203
37203
  return subModuleTask(["init", ...customArgs]);
@@ -37530,8 +37530,8 @@ var require_git = __commonJS2({
37530
37530
  }
37531
37531
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
37532
37532
  };
37533
- Git2.prototype.submoduleAdd = function(repo, path73, then) {
37534
- return this._runTask(addSubModuleTask2(repo, path73), trailingFunctionArgument2(arguments));
37533
+ Git2.prototype.submoduleAdd = function(repo, path74, then) {
37534
+ return this._runTask(addSubModuleTask2(repo, path74), trailingFunctionArgument2(arguments));
37535
37535
  };
37536
37536
  Git2.prototype.submoduleUpdate = function(args, then) {
37537
37537
  return this._runTask(
@@ -38267,8 +38267,8 @@ function parseNumstatEntries(lines) {
38267
38267
  }
38268
38268
  function parseNumstat(lines) {
38269
38269
  const m = /* @__PURE__ */ new Map();
38270
- for (const [path73, entry] of parseNumstatEntries(lines)) {
38271
- m.set(path73, { additions: entry.additions, deletions: entry.deletions });
38270
+ for (const [path74, entry] of parseNumstatEntries(lines)) {
38271
+ m.set(path74, { additions: entry.additions, deletions: entry.deletions });
38272
38272
  }
38273
38273
  return m;
38274
38274
  }
@@ -39575,18 +39575,32 @@ import * as fs27 from "node:fs";
39575
39575
  // src/git/worktrees/worktree-remove.ts
39576
39576
  import * as fs26 from "node:fs";
39577
39577
 
39578
+ // src/worktrees/is-removable-session-worktree-checkout-path.ts
39579
+ import path42 from "node:path";
39580
+ function isBridgeRootCheckoutPath(checkoutPath) {
39581
+ return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
39582
+ }
39583
+ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath) {
39584
+ if (isBridgeRootCheckoutPath(checkoutPath)) return false;
39585
+ const normalized = normalizeResolvedPath(checkoutPath);
39586
+ const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
39587
+ const rel = path42.relative(worktreesRoot, normalized);
39588
+ if (rel === "" || rel.startsWith("..") || path42.isAbsolute(rel)) return false;
39589
+ return true;
39590
+ }
39591
+
39578
39592
  // src/git/worktrees/resolve-main-repo-from-git-file.ts
39579
39593
  import * as fs25 from "node:fs";
39580
- import * as path42 from "node:path";
39594
+ import * as path43 from "node:path";
39581
39595
  function resolveMainRepoFromWorktreeGitFile(wt) {
39582
- const gitDirFile = path42.join(wt, ".git");
39596
+ const gitDirFile = path43.join(wt, ".git");
39583
39597
  if (!fs25.existsSync(gitDirFile) || !fs25.statSync(gitDirFile).isFile()) return "";
39584
39598
  const first2 = fs25.readFileSync(gitDirFile, "utf8").trim();
39585
39599
  const m = first2.match(/^gitdir:\s*(.+)$/im);
39586
39600
  if (!m) return "";
39587
- const gitWorktreePath = path42.resolve(wt, m[1].trim());
39588
- const gitDir = path42.dirname(path42.dirname(gitWorktreePath));
39589
- return path42.dirname(gitDir);
39601
+ const gitWorktreePath = path43.resolve(wt, m[1].trim());
39602
+ const gitDir = path43.dirname(path43.dirname(gitWorktreePath));
39603
+ return path43.dirname(gitDir);
39590
39604
  }
39591
39605
 
39592
39606
  // src/git/worktrees/worktree-remove.ts
@@ -39594,32 +39608,44 @@ async function gitWorktreeRemoveForce(worktreePath) {
39594
39608
  const mainRepo = resolveMainRepoFromWorktreeGitFile(worktreePath);
39595
39609
  if (mainRepo) {
39596
39610
  await cliSimpleGit(mainRepo).raw(["worktree", "remove", "--force", worktreePath]);
39597
- } else {
39598
- fs26.rmSync(worktreePath, { recursive: true, force: true });
39611
+ return true;
39599
39612
  }
39613
+ if (isBridgeRootCheckoutPath(worktreePath)) return false;
39614
+ fs26.rmSync(worktreePath, { recursive: true, force: true });
39615
+ return true;
39600
39616
  }
39601
39617
 
39602
39618
  // src/worktrees/remove-session-worktrees.ts
39603
- async function removeSessionWorktrees(paths, log2) {
39619
+ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
39604
39620
  for (const wt of paths) {
39621
+ if (!isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
39622
+ log2(`[worktrees] Skipping removal of ${wt} (bridge root or outside worktrees root).`);
39623
+ continue;
39624
+ }
39605
39625
  try {
39606
- await gitWorktreeRemoveForce(wt);
39607
- log2(`[worktrees] Removed worktree ${wt}`);
39626
+ const removed = await gitWorktreeRemoveForce(wt);
39627
+ if (removed) {
39628
+ log2(`[worktrees] Removed worktree ${wt}`);
39629
+ } else {
39630
+ log2(`[worktrees] Skipping removal of ${wt} (bridge root).`);
39631
+ }
39608
39632
  } catch (e) {
39609
39633
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
39610
- try {
39611
- fs27.rmSync(wt, { recursive: true, force: true });
39612
- } catch {
39634
+ if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
39635
+ try {
39636
+ fs27.rmSync(wt, { recursive: true, force: true });
39637
+ } catch {
39638
+ }
39613
39639
  }
39614
39640
  }
39615
39641
  }
39616
39642
  }
39617
39643
 
39618
39644
  // src/worktrees/manager/git/remove-session-worktree-checkouts.ts
39619
- async function removeSessionWorktreeCheckouts(cache2, sessionId, log2) {
39645
+ async function removeSessionWorktreeCheckouts(cache2, sessionId, worktreesRootPath, log2) {
39620
39646
  const paths = cache2.clearSession(sessionId);
39621
39647
  if (!paths?.length) return;
39622
- await removeSessionWorktrees(paths, log2);
39648
+ await removeSessionWorktrees(paths, worktreesRootPath, log2);
39623
39649
  }
39624
39650
 
39625
39651
  // src/git/branches/rename-branch.ts
@@ -39652,11 +39678,11 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
39652
39678
 
39653
39679
  // src/worktrees/discovery/discover-session-worktree-on-disk.ts
39654
39680
  import * as fs31 from "node:fs";
39655
- import * as path47 from "node:path";
39681
+ import * as path48 from "node:path";
39656
39682
 
39657
39683
  // src/worktrees/discovery/collect-worktree-paths.ts
39658
39684
  import * as fs29 from "node:fs";
39659
- import * as path44 from "node:path";
39685
+ import * as path45 from "node:path";
39660
39686
 
39661
39687
  // src/worktrees/discovery/disk-walk-constants.ts
39662
39688
  var DISK_WALK_YIELD_EVERY = 64;
@@ -39685,7 +39711,7 @@ function shouldSkipDiskWalkEntry(name) {
39685
39711
 
39686
39712
  // src/worktrees/discovery/disk-walk-utils.ts
39687
39713
  import * as fs28 from "node:fs";
39688
- import * as path43 from "node:path";
39714
+ import * as path44 from "node:path";
39689
39715
  async function yieldDuringDiskWalk(state) {
39690
39716
  state.entries++;
39691
39717
  if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
@@ -39695,7 +39721,7 @@ async function yieldDuringDiskWalk(state) {
39695
39721
  }
39696
39722
  async function isGitDir(dirPath) {
39697
39723
  try {
39698
- await fs28.promises.access(path43.join(dirPath, ".git"));
39724
+ await fs28.promises.access(path44.join(dirPath, ".git"));
39699
39725
  return true;
39700
39726
  } catch {
39701
39727
  return false;
@@ -39709,7 +39735,7 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
39709
39735
  const walk = async (dir) => {
39710
39736
  if (!await yieldDuringDiskWalk(state)) return;
39711
39737
  if (await isGitDir(dir)) {
39712
- out.push(path44.resolve(dir));
39738
+ out.push(path45.resolve(dir));
39713
39739
  return;
39714
39740
  }
39715
39741
  let entries;
@@ -39720,12 +39746,12 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
39720
39746
  }
39721
39747
  for (const e of entries) {
39722
39748
  if (shouldSkipDiskWalkEntry(e.name)) continue;
39723
- const full = path44.join(dir, e.name);
39749
+ const full = path45.join(dir, e.name);
39724
39750
  if (!e.isDirectory()) continue;
39725
39751
  await walk(full);
39726
39752
  }
39727
39753
  };
39728
- await walk(path44.resolve(rootPath));
39754
+ await walk(path45.resolve(rootPath));
39729
39755
  return { paths: [...new Set(out)], entriesVisited: state.entries };
39730
39756
  }
39731
39757
  async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
@@ -39742,10 +39768,10 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
39742
39768
  }
39743
39769
  for (const e of entries) {
39744
39770
  if (shouldSkipDiskWalkEntry(e.name)) continue;
39745
- const full = path44.join(dir, e.name);
39771
+ const full = path45.join(dir, e.name);
39746
39772
  if (!e.isDirectory()) continue;
39747
39773
  if (e.name === sessionId) {
39748
- if (await isGitDir(full)) out.push(path44.resolve(full));
39774
+ if (await isGitDir(full)) out.push(path45.resolve(full));
39749
39775
  continue;
39750
39776
  }
39751
39777
  if (await isGitDir(full)) continue;
@@ -39757,14 +39783,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
39757
39783
  }
39758
39784
 
39759
39785
  // src/worktrees/discovery/layout-keys-for-bridge-root.ts
39760
- import * as path45 from "node:path";
39786
+ import * as path46 from "node:path";
39761
39787
  function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
39762
- const bridge = path45.resolve(bridgeRoot);
39788
+ const bridge = path46.resolve(bridgeRoot);
39763
39789
  const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
39764
39790
  const relevant = layout.launcherCwds.filter((e) => {
39765
- const entry = path45.resolve(e.absolutePath);
39766
- return bridge === entry || bridge.startsWith(entry + path45.sep) || entry.startsWith(bridge + path45.sep);
39767
- }).sort((a, b) => path45.resolve(b.absolutePath).length - path45.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
39791
+ const entry = path46.resolve(e.absolutePath);
39792
+ return bridge === entry || bridge.startsWith(entry + path46.sep) || entry.startsWith(bridge + path46.sep);
39793
+ }).sort((a, b) => path46.resolve(b.absolutePath).length - path46.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
39768
39794
  const ordered = [];
39769
39795
  const seen = /* @__PURE__ */ new Set();
39770
39796
  const add = (k) => {
@@ -39783,7 +39809,7 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
39783
39809
 
39784
39810
  // src/worktrees/discovery/try-binding-from-session-directory.ts
39785
39811
  import * as fs30 from "node:fs";
39786
- import * as path46 from "node:path";
39812
+ import * as path47 from "node:path";
39787
39813
  async function tryBindingFromSessionDirectory(sessionDir) {
39788
39814
  let st;
39789
39815
  try {
@@ -39794,7 +39820,7 @@ async function tryBindingFromSessionDirectory(sessionDir) {
39794
39820
  if (!st.isDirectory()) return null;
39795
39821
  const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(sessionDir);
39796
39822
  if (worktreePaths.length === 0) return null;
39797
- const abs = path46.resolve(sessionDir);
39823
+ const abs = path47.resolve(sessionDir);
39798
39824
  return {
39799
39825
  sessionParentPath: abs,
39800
39826
  workingTreeRelRoot: abs,
@@ -39818,7 +39844,7 @@ async function discoverSessionWorktreeOnDisk(options) {
39818
39844
  try {
39819
39845
  for (const name of await fs31.promises.readdir(worktreesRootPath)) {
39820
39846
  if (name.startsWith(".")) continue;
39821
- const p = path47.join(worktreesRootPath, name);
39847
+ const p = path48.join(worktreesRootPath, name);
39822
39848
  let st;
39823
39849
  try {
39824
39850
  st = await fs31.promises.stat(p);
@@ -39835,7 +39861,7 @@ async function discoverSessionWorktreeOnDisk(options) {
39835
39861
  for (const key of keys) {
39836
39862
  if (isCliImmediateShutdownRequested()) return null;
39837
39863
  await yieldToEventLoop();
39838
- const layoutRoot = path47.join(worktreesRootPath, key);
39864
+ const layoutRoot = path48.join(worktreesRootPath, key);
39839
39865
  let layoutSt;
39840
39866
  try {
39841
39867
  layoutSt = await fs31.promises.stat(layoutRoot);
@@ -39843,16 +39869,16 @@ async function discoverSessionWorktreeOnDisk(options) {
39843
39869
  continue;
39844
39870
  }
39845
39871
  if (!layoutSt.isDirectory()) continue;
39846
- const sessionDir = path47.join(layoutRoot, sid);
39872
+ const sessionDir = path48.join(layoutRoot, sid);
39847
39873
  const nested = await tryBindingFromSessionDirectory(sessionDir);
39848
39874
  if (nested) return nested;
39849
39875
  const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
39850
39876
  if (legacy.paths.length > 0) {
39851
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path47.resolve(legacy.paths[0]);
39877
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path48.resolve(legacy.paths[0]);
39852
39878
  return {
39853
- sessionParentPath: path47.resolve(isolated),
39854
- workingTreeRelRoot: path47.resolve(layoutRoot),
39855
- repoCheckoutPaths: legacy.paths.map((p) => path47.resolve(p))
39879
+ sessionParentPath: path48.resolve(isolated),
39880
+ workingTreeRelRoot: path48.resolve(layoutRoot),
39881
+ repoCheckoutPaths: legacy.paths.map((p) => path48.resolve(p))
39856
39882
  };
39857
39883
  }
39858
39884
  }
@@ -39861,29 +39887,29 @@ async function discoverSessionWorktreeOnDisk(options) {
39861
39887
 
39862
39888
  // src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
39863
39889
  import * as fs32 from "node:fs";
39864
- import * as path49 from "node:path";
39890
+ import * as path50 from "node:path";
39865
39891
 
39866
39892
  // src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
39867
- import * as path48 from "node:path";
39893
+ import * as path49 from "node:path";
39868
39894
  async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
39869
39895
  const sid = sessionId.trim();
39870
39896
  if (!sid) return null;
39871
- const hintR = path48.resolve(checkoutPath);
39897
+ const hintR = path49.resolve(checkoutPath);
39872
39898
  let best = null;
39873
- let cur = path48.dirname(hintR);
39899
+ let cur = path49.dirname(hintR);
39874
39900
  for (let i = 0; i < 40; i++) {
39875
39901
  if (isCliImmediateShutdownRequested()) return best;
39876
39902
  await yieldToEventLoop();
39877
39903
  const paths = await collectWorktreeRootsNamed(cur, sid);
39878
- if (paths.paths.some((p) => path48.resolve(p) === hintR)) {
39879
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path48.resolve(paths.paths[0]);
39904
+ if (paths.paths.some((p) => path49.resolve(p) === hintR)) {
39905
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path49.resolve(paths.paths[0]);
39880
39906
  best = {
39881
- sessionParentPath: path48.resolve(isolated),
39882
- workingTreeRelRoot: path48.resolve(cur),
39883
- repoCheckoutPaths: paths.paths.map((p) => path48.resolve(p))
39907
+ sessionParentPath: path49.resolve(isolated),
39908
+ workingTreeRelRoot: path49.resolve(cur),
39909
+ repoCheckoutPaths: paths.paths.map((p) => path49.resolve(p))
39884
39910
  };
39885
39911
  }
39886
- const next = path48.dirname(cur);
39912
+ const next = path49.dirname(cur);
39887
39913
  if (next === cur) break;
39888
39914
  cur = next;
39889
39915
  }
@@ -39894,12 +39920,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
39894
39920
  async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeRootPathOrHint, sessionId) {
39895
39921
  const sid = sessionId.trim();
39896
39922
  if (!sid) return null;
39897
- const hint = path49.resolve(sessionWorktreeRootPathOrHint);
39898
- const underHint = await tryBindingFromSessionDirectory(path49.join(hint, sid));
39923
+ const hint = path50.resolve(sessionWorktreeRootPathOrHint);
39924
+ const underHint = await tryBindingFromSessionDirectory(path50.join(hint, sid));
39899
39925
  if (underHint) return underHint;
39900
39926
  const direct = await tryBindingFromSessionDirectory(hint);
39901
39927
  if (direct) {
39902
- if (path49.basename(hint) === sid && await isGitDir(hint)) {
39928
+ if (path50.basename(hint) === sid && await isGitDir(hint)) {
39903
39929
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
39904
39930
  if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
39905
39931
  return legacyFromCheckout;
@@ -39907,7 +39933,7 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeR
39907
39933
  }
39908
39934
  return direct;
39909
39935
  }
39910
- if (path49.basename(hint) === sid && await isGitDir(hint)) {
39936
+ if (path50.basename(hint) === sid && await isGitDir(hint)) {
39911
39937
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
39912
39938
  if (legacyFromCheckout) return legacyFromCheckout;
39913
39939
  }
@@ -39920,11 +39946,11 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionWorktreeR
39920
39946
  if (!st.isDirectory()) return null;
39921
39947
  const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
39922
39948
  if (legacyPaths.paths.length === 0) return null;
39923
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path49.resolve(legacyPaths.paths[0]);
39949
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path50.resolve(legacyPaths.paths[0]);
39924
39950
  return {
39925
- sessionParentPath: path49.resolve(isolated),
39951
+ sessionParentPath: path50.resolve(isolated),
39926
39952
  workingTreeRelRoot: hint,
39927
- repoCheckoutPaths: legacyPaths.paths.map((p) => path49.resolve(p))
39953
+ repoCheckoutPaths: legacyPaths.paths.map((p) => path50.resolve(p))
39928
39954
  };
39929
39955
  }
39930
39956
 
@@ -39986,11 +40012,11 @@ function parseSessionParent(v) {
39986
40012
 
39987
40013
  // src/worktrees/prepare-new-session-worktrees.ts
39988
40014
  import * as fs34 from "node:fs";
39989
- import * as path51 from "node:path";
40015
+ import * as path52 from "node:path";
39990
40016
 
39991
40017
  // src/git/discover-repos.ts
39992
40018
  import * as fs33 from "node:fs";
39993
- import * as path50 from "node:path";
40019
+ import * as path51 from "node:path";
39994
40020
  var GIT_DISCOVER_YIELD_EVERY = 32;
39995
40021
  async function yieldGitDiscoverWork(entryCount) {
39996
40022
  if (entryCount > 0 && entryCount % GIT_DISCOVER_YIELD_EVERY === 0) {
@@ -39999,7 +40025,7 @@ async function yieldGitDiscoverWork(entryCount) {
39999
40025
  }
40000
40026
  async function discoverGitRepos(cwd = getBridgeRoot()) {
40001
40027
  const result = [];
40002
- const cwdResolved = path50.resolve(cwd);
40028
+ const cwdResolved = path51.resolve(cwd);
40003
40029
  if (await isGitRepoDirectory(cwdResolved)) {
40004
40030
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
40005
40031
  result.push({ absolutePath: cwdResolved, remoteUrl });
@@ -40014,7 +40040,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
40014
40040
  await yieldGitDiscoverWork(i + 1);
40015
40041
  const ent = entries[i];
40016
40042
  if (!ent.isDirectory()) continue;
40017
- const childPath2 = path50.join(cwdResolved, ent.name);
40043
+ const childPath2 = path51.join(cwdResolved, ent.name);
40018
40044
  if (await isGitRepoDirectory(childPath2)) {
40019
40045
  const remoteUrl = await getRemoteOriginUrl(childPath2);
40020
40046
  result.push({ absolutePath: childPath2, remoteUrl });
@@ -40023,12 +40049,12 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
40023
40049
  return result;
40024
40050
  }
40025
40051
  async function discoverGitReposUnderRoot(rootPath) {
40026
- const root = path50.resolve(rootPath);
40052
+ const root = path51.resolve(rootPath);
40027
40053
  const roots = [];
40028
40054
  let walkEntries = 0;
40029
40055
  async function walk(dir) {
40030
40056
  if (await isGitRepoDirectory(dir)) {
40031
- roots.push(path50.resolve(dir));
40057
+ roots.push(path51.resolve(dir));
40032
40058
  return;
40033
40059
  }
40034
40060
  let entries;
@@ -40041,7 +40067,7 @@ async function discoverGitReposUnderRoot(rootPath) {
40041
40067
  await yieldGitDiscoverWork(++walkEntries);
40042
40068
  const ent = entries[i];
40043
40069
  if (!ent.isDirectory() || ent.name === ".git") continue;
40044
- await walk(path50.join(dir, ent.name));
40070
+ await walk(path51.join(dir, ent.name));
40045
40071
  }
40046
40072
  }
40047
40073
  await walk(root);
@@ -40076,10 +40102,10 @@ function resolveBaseRefForRepo(relNorm, baseBranches) {
40076
40102
  }
40077
40103
  async function prepareNewSessionWorktrees(options) {
40078
40104
  const { worktreesRootPath, bridgeRoot, sessionId, layout, log: log2, worktreeBaseBranches } = options;
40079
- const bridgeResolved = path51.resolve(bridgeRoot);
40105
+ const bridgeResolved = path52.resolve(bridgeRoot);
40080
40106
  const cwdKey = allocateDirNameForLauncherCwd(layout, bridgeResolved);
40081
- const bridgeKeyDir = path51.join(worktreesRootPath, cwdKey);
40082
- const sessionDir = path51.join(bridgeKeyDir, sessionId);
40107
+ const bridgeKeyDir = path52.join(worktreesRootPath, cwdKey);
40108
+ const sessionDir = path52.join(bridgeKeyDir, sessionId);
40083
40109
  const repos = await discoverGitReposUnderRoot(bridgeResolved);
40084
40110
  if (repos.length === 0) {
40085
40111
  log2("[worktrees] No Git repositories under bridge root; skipping worktree creation.");
@@ -40089,12 +40115,12 @@ async function prepareNewSessionWorktrees(options) {
40089
40115
  const worktreePaths = [];
40090
40116
  fs34.mkdirSync(sessionDir, { recursive: true });
40091
40117
  for (const repo of repos) {
40092
- let rel = path51.relative(bridgeResolved, repo.absolutePath);
40093
- if (rel.startsWith("..") || path51.isAbsolute(rel)) continue;
40118
+ let rel = path52.relative(bridgeResolved, repo.absolutePath);
40119
+ if (rel.startsWith("..") || path52.isAbsolute(rel)) continue;
40094
40120
  const relNorm = normalizeRepoRelPath2(rel === "" ? "." : rel);
40095
- const wtPath = relNorm === "." ? sessionDir : path51.join(sessionDir, relNorm);
40121
+ const wtPath = relNorm === "." ? sessionDir : path52.join(sessionDir, relNorm);
40096
40122
  if (relNorm !== ".") {
40097
- fs34.mkdirSync(path51.dirname(wtPath), { recursive: true });
40123
+ fs34.mkdirSync(path52.dirname(wtPath), { recursive: true });
40098
40124
  }
40099
40125
  const baseRef = resolveBaseRefForRepo(relNorm, worktreeBaseBranches);
40100
40126
  try {
@@ -40147,9 +40173,9 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
40147
40173
  }
40148
40174
 
40149
40175
  // src/worktrees/manager/resolve-explicit-session-parent-path.ts
40150
- import * as path52 from "node:path";
40176
+ import * as path53 from "node:path";
40151
40177
  async function resolveExplicitSessionParentPath(params) {
40152
- const resolved = path52.resolve(params.parentPathRaw);
40178
+ const resolved = path53.resolve(params.parentPathRaw);
40153
40179
  if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
40154
40180
  return resolved;
40155
40181
  }
@@ -40166,7 +40192,7 @@ async function resolveExplicitSessionParentPath(params) {
40166
40192
  await yieldToEventLoop();
40167
40193
  const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
40168
40194
  if (tryRoot) return rememberAndReturn(tryRoot);
40169
- const next = path52.dirname(cur);
40195
+ const next = path53.dirname(cur);
40170
40196
  if (next === cur) break;
40171
40197
  cur = next;
40172
40198
  }
@@ -40276,7 +40302,7 @@ function createSessionWorktreeGitApi(ctx) {
40276
40302
  await renameSessionWorktreeBranch(ctx.cache, sessionId, newBranch, ctx.log);
40277
40303
  },
40278
40304
  async removeSessionWorktrees(sessionId) {
40279
- await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.log);
40305
+ await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.worktreesRootPath, ctx.log);
40280
40306
  },
40281
40307
  async commitSession(params) {
40282
40308
  return commitSessionWorktree(ctx.cache, params);
@@ -40305,17 +40331,17 @@ var SessionWorktreeManager = class {
40305
40331
  };
40306
40332
 
40307
40333
  // src/worktrees/manager/default-worktrees-root-path.ts
40308
- import * as path53 from "node:path";
40334
+ import * as path54 from "node:path";
40309
40335
  import os9 from "node:os";
40310
40336
  function defaultWorktreesRootPath() {
40311
- return path53.join(os9.homedir(), ".buildautomaton", "worktrees");
40337
+ return path54.join(os9.homedir(), ".buildautomaton", "worktrees");
40312
40338
  }
40313
40339
 
40314
40340
  // src/files/watch-file-index.ts
40315
- import path58 from "node:path";
40341
+ import path59 from "node:path";
40316
40342
 
40317
40343
  // src/files/index/build-file-index.ts
40318
- import path54 from "node:path";
40344
+ import path55 from "node:path";
40319
40345
 
40320
40346
  // src/files/index/file-index-sqlite-lock.ts
40321
40347
  var fileIndexChain = Promise.resolve();
@@ -40406,7 +40432,7 @@ function assertNotShutdown2() {
40406
40432
  if (isCliImmediateShutdownRequested()) throw new CliSqliteInterrupted();
40407
40433
  }
40408
40434
  async function buildFileIndexAsync(cwd) {
40409
- const resolved = path54.resolve(cwd);
40435
+ const resolved = path55.resolve(cwd);
40410
40436
  await yieldToEventLoop();
40411
40437
  assertNotShutdown2();
40412
40438
  const paths = await collectWorkspacePathsAsync(resolved);
@@ -40419,7 +40445,7 @@ async function buildFileIndexAsync(cwd) {
40419
40445
  }
40420
40446
 
40421
40447
  // src/files/index/ensure-file-index.ts
40422
- import path55 from "node:path";
40448
+ import path56 from "node:path";
40423
40449
 
40424
40450
  // src/files/index/search-file-index.ts
40425
40451
  function escapeLikePattern(fragment) {
@@ -40471,7 +40497,7 @@ async function searchBridgeFilePathsAsync(resolvedCwd, query, limit = 100) {
40471
40497
 
40472
40498
  // src/files/index/ensure-file-index.ts
40473
40499
  async function ensureFileIndexAsync(cwd) {
40474
- const resolved = path55.resolve(cwd);
40500
+ const resolved = path56.resolve(cwd);
40475
40501
  if (await bridgeFileIndexIsPopulated(resolved)) {
40476
40502
  return { fromCache: true, pathCount: await bridgeFileIndexPathCount(resolved) };
40477
40503
  }
@@ -40520,10 +40546,10 @@ function createFileIndexFsWatcher(resolved, schedule) {
40520
40546
 
40521
40547
  // src/files/index/file-index-incremental-symbol-updates.ts
40522
40548
  import fs35 from "node:fs";
40523
- import path56 from "node:path";
40549
+ import path57 from "node:path";
40524
40550
  async function applyIncrementalSymbolIndexUpdates(resolved, relPaths) {
40525
40551
  for (const rel of relPaths) {
40526
- const absPath = path56.join(resolved, rel);
40552
+ const absPath = path57.join(resolved, rel);
40527
40553
  try {
40528
40554
  const stat2 = await fs35.promises.stat(absPath);
40529
40555
  if (stat2.isFile()) {
@@ -40543,9 +40569,9 @@ async function applyIncrementalSymbolIndexUpdates(resolved, relPaths) {
40543
40569
  }
40544
40570
 
40545
40571
  // src/files/index/file-index-initial-builds.ts
40546
- import path57 from "node:path";
40572
+ import path58 from "node:path";
40547
40573
  async function runInitialIndexBuilds(cwd = getBridgeRoot()) {
40548
- const resolved = path57.resolve(cwd);
40574
+ const resolved = path58.resolve(cwd);
40549
40575
  try {
40550
40576
  await buildFileIndexAsync(resolved);
40551
40577
  await buildSymbolIndexAsync(resolved);
@@ -40563,7 +40589,7 @@ function scheduleInitialIndexBuilds(cwd = getBridgeRoot()) {
40563
40589
  // src/files/watch-file-index.ts
40564
40590
  var MAX_INCREMENTAL_SYMBOL_UPDATES = 512;
40565
40591
  function startFileIndexWatcher(cwd = getBridgeRoot()) {
40566
- const resolved = path58.resolve(cwd);
40592
+ const resolved = path59.resolve(cwd);
40567
40593
  let timer = null;
40568
40594
  const pendingSymbolUpdates = /* @__PURE__ */ new Set();
40569
40595
  let needsFullSymbolRebuild = false;
@@ -40625,7 +40651,7 @@ function startFileIndexWatcher(cwd = getBridgeRoot()) {
40625
40651
  }
40626
40652
 
40627
40653
  // src/connection/create-bridge-connection.ts
40628
- import * as path72 from "node:path";
40654
+ import * as path73 from "node:path";
40629
40655
 
40630
40656
  // src/dev-servers/manager/dev-server-manager.ts
40631
40657
  import { rm as rm2 } from "node:fs/promises";
@@ -40935,10 +40961,10 @@ function trySpawnShellTruePiped(command, env, cwd, devNullFd, signal) {
40935
40961
  import { spawn as spawn8 } from "node:child_process";
40936
40962
  import fs38 from "node:fs";
40937
40963
  import { tmpdir } from "node:os";
40938
- import path59 from "node:path";
40964
+ import path60 from "node:path";
40939
40965
  function trySpawnMergedLogFile(command, env, cwd, signal) {
40940
- const tmpRoot = fs38.mkdtempSync(path59.join(tmpdir(), "ba-devsrv-log-"));
40941
- const logPath = path59.join(tmpRoot, "combined.log");
40966
+ const tmpRoot = fs38.mkdtempSync(path60.join(tmpdir(), "ba-devsrv-log-"));
40967
+ const logPath = path60.join(tmpRoot, "combined.log");
40942
40968
  let logFd;
40943
40969
  try {
40944
40970
  logFd = fs38.openSync(logPath, "a");
@@ -40982,15 +41008,15 @@ function trySpawnMergedLogFile(command, env, cwd, signal) {
40982
41008
  import { spawn as spawn9 } from "node:child_process";
40983
41009
  import fs39 from "node:fs";
40984
41010
  import { tmpdir as tmpdir2 } from "node:os";
40985
- import path60 from "node:path";
41011
+ import path61 from "node:path";
40986
41012
  function shSingleQuote(s) {
40987
41013
  return `'${s.replace(/'/g, `'\\''`)}'`;
40988
41014
  }
40989
41015
  function trySpawnShellScriptLogRedirectUnix(command, env, cwd, signal) {
40990
- const tmpRoot = fs39.mkdtempSync(path60.join(tmpdir2(), "ba-devsrv-sh-"));
40991
- const logPath = path60.join(tmpRoot, "combined.log");
40992
- const innerPath = path60.join(tmpRoot, "_cmd.sh");
40993
- const runnerPath = path60.join(tmpRoot, "_run.sh");
41016
+ const tmpRoot = fs39.mkdtempSync(path61.join(tmpdir2(), "ba-devsrv-sh-"));
41017
+ const logPath = path61.join(tmpRoot, "combined.log");
41018
+ const innerPath = path61.join(tmpRoot, "_cmd.sh");
41019
+ const runnerPath = path61.join(tmpRoot, "_run.sh");
40994
41020
  try {
40995
41021
  fs39.writeFileSync(innerPath, `#!/bin/sh
40996
41022
  ${command}
@@ -41021,9 +41047,9 @@ cd ${shSingleQuote(cwd)}
41021
41047
  }
41022
41048
  }
41023
41049
  function trySpawnShellScriptLogRedirectWin(command, env, cwd, signal) {
41024
- const tmpRoot = fs39.mkdtempSync(path60.join(tmpdir2(), "ba-devsrv-sh-"));
41025
- const logPath = path60.join(tmpRoot, "combined.log");
41026
- const runnerPath = path60.join(tmpRoot, "_run.bat");
41050
+ const tmpRoot = fs39.mkdtempSync(path61.join(tmpdir2(), "ba-devsrv-sh-"));
41051
+ const logPath = path61.join(tmpRoot, "combined.log");
41052
+ const runnerPath = path61.join(tmpRoot, "_run.bat");
41027
41053
  const q = (p) => `"${p.replace(/"/g, '""')}"`;
41028
41054
  const com = process.env.ComSpec || "cmd.exe";
41029
41055
  try {
@@ -41805,15 +41831,15 @@ async function yieldSkillDiscoveryWork(entryCount) {
41805
41831
 
41806
41832
  // src/skills/discovery/discover-local-skills.ts
41807
41833
  import fs40 from "node:fs";
41808
- import path61 from "node:path";
41834
+ import path62 from "node:path";
41809
41835
  function collectSkillFromDir(rel, base, name, seenKeys, out) {
41810
- const dir = path61.join(base, name);
41836
+ const dir = path62.join(base, name);
41811
41837
  try {
41812
41838
  if (!fs40.statSync(dir).isDirectory()) return;
41813
41839
  } catch {
41814
41840
  return;
41815
41841
  }
41816
- const skillMd = path61.join(dir, "SKILL.md");
41842
+ const skillMd = path62.join(dir, "SKILL.md");
41817
41843
  if (!fs40.existsSync(skillMd)) return;
41818
41844
  const key = `${rel}/${name}`;
41819
41845
  if (seenKeys.has(key)) return;
@@ -41826,7 +41852,7 @@ async function discoverLocalSkillsAsync(cwd) {
41826
41852
  let work = 0;
41827
41853
  for (const rel of SKILL_DISCOVERY_ROOTS) {
41828
41854
  await yieldSkillDiscoveryWork(++work);
41829
- const base = path61.join(cwd, rel);
41855
+ const base = path62.join(cwd, rel);
41830
41856
  if (!fs40.existsSync(base) || !fs40.statSync(base).isDirectory()) continue;
41831
41857
  let entries = [];
41832
41858
  try {
@@ -41844,15 +41870,15 @@ async function discoverLocalSkillsAsync(cwd) {
41844
41870
 
41845
41871
  // src/skills/discovery/discover-skill-layout-roots.ts
41846
41872
  import fs41 from "node:fs";
41847
- import path62 from "node:path";
41873
+ import path63 from "node:path";
41848
41874
  function collectLayoutSkill(rel, base, name, skills2) {
41849
- const dir = path62.join(base, name);
41875
+ const dir = path63.join(base, name);
41850
41876
  try {
41851
41877
  if (!fs41.statSync(dir).isDirectory()) return;
41852
41878
  } catch {
41853
41879
  return;
41854
41880
  }
41855
- if (!fs41.existsSync(path62.join(dir, "SKILL.md"))) return;
41881
+ if (!fs41.existsSync(path63.join(dir, "SKILL.md"))) return;
41856
41882
  const relPath = `${rel}/${name}`.replace(/\\/g, "/");
41857
41883
  skills2.push({ name, relPath });
41858
41884
  }
@@ -41861,7 +41887,7 @@ async function discoverSkillLayoutRootsAsync(cwd) {
41861
41887
  let work = 0;
41862
41888
  for (const rel of SKILL_DISCOVERY_ROOTS) {
41863
41889
  await yieldSkillDiscoveryWork(++work);
41864
- const base = path62.join(cwd, rel);
41890
+ const base = path63.join(cwd, rel);
41865
41891
  if (!fs41.existsSync(base) || !fs41.statSync(base).isDirectory()) continue;
41866
41892
  let entries = [];
41867
41893
  try {
@@ -42213,7 +42239,7 @@ import fs43 from "node:fs";
42213
42239
 
42214
42240
  // src/git/snapshot/capture.ts
42215
42241
  import * as fs42 from "node:fs";
42216
- import * as path63 from "node:path";
42242
+ import * as path64 from "node:path";
42217
42243
 
42218
42244
  // src/git/snapshot/git.ts
42219
42245
  async function gitStashCreate(repoRoot, log2) {
@@ -42253,7 +42279,7 @@ async function gitRun(repoRoot, args, log2, label) {
42253
42279
  async function resolveSnapshotRepoRoots(options) {
42254
42280
  const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
42255
42281
  if (worktreePaths?.length) {
42256
- const uniq = [...new Set(worktreePaths.map((p) => path63.resolve(p)))];
42282
+ const uniq = [...new Set(worktreePaths.map((p) => path64.resolve(p)))];
42257
42283
  return uniq;
42258
42284
  }
42259
42285
  try {
@@ -42261,7 +42287,7 @@ async function resolveSnapshotRepoRoots(options) {
42261
42287
  const mapped = repos.map((r) => r.absolutePath);
42262
42288
  const sid = sessionId?.trim();
42263
42289
  if (sid) {
42264
- const filtered = mapped.filter((root) => path63.basename(root) === sid);
42290
+ const filtered = mapped.filter((root) => path64.basename(root) === sid);
42265
42291
  if (filtered.length > 0) return filtered;
42266
42292
  }
42267
42293
  return mapped;
@@ -42292,7 +42318,7 @@ async function capturePreTurnSnapshot(options) {
42292
42318
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
42293
42319
  repos
42294
42320
  };
42295
- const filePath = path63.join(dir, `${runId}.json`);
42321
+ const filePath = path64.join(dir, `${runId}.json`);
42296
42322
  try {
42297
42323
  fs42.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
42298
42324
  } catch (e) {
@@ -42635,9 +42661,9 @@ function parseChangeSummarySnapshots(raw) {
42635
42661
  for (const item of raw) {
42636
42662
  if (!item || typeof item !== "object") continue;
42637
42663
  const o = item;
42638
- const path73 = typeof o.path === "string" && o.path.trim() !== "" ? o.path.trim() : "";
42639
- if (!path73) continue;
42640
- const row = { path: path73 };
42664
+ const path74 = typeof o.path === "string" && o.path.trim() !== "" ? o.path.trim() : "";
42665
+ if (!path74) continue;
42666
+ const row = { path: path74 };
42641
42667
  if (typeof o.patchContent === "string") row.patchContent = o.patchContent;
42642
42668
  if (typeof o.oldText === "string") row.oldText = o.oldText;
42643
42669
  if (typeof o.newText === "string") row.newText = o.newText;
@@ -42866,11 +42892,11 @@ async function resolveFileBrowserSessionParent(sessionWorktreeManager, sessionId
42866
42892
  import fs45 from "node:fs";
42867
42893
 
42868
42894
  // src/files/ensure-under-cwd.ts
42869
- import path64 from "node:path";
42895
+ import path65 from "node:path";
42870
42896
  function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
42871
- const normalized = path64.normalize(relativePath).replace(/^(\.\/)+/, "");
42872
- const resolved = path64.resolve(cwd, normalized);
42873
- if (!resolved.startsWith(cwd + path64.sep) && resolved !== cwd) {
42897
+ const normalized = path65.normalize(relativePath).replace(/^(\.\/)+/, "");
42898
+ const resolved = path65.resolve(cwd, normalized);
42899
+ if (!resolved.startsWith(cwd + path65.sep) && resolved !== cwd) {
42874
42900
  return null;
42875
42901
  }
42876
42902
  return resolved;
@@ -42880,11 +42906,11 @@ function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
42880
42906
  var LIST_DIR_YIELD_EVERY = 256;
42881
42907
 
42882
42908
  // src/files/list-dir/map-dir-entry.ts
42883
- import path65 from "node:path";
42909
+ import path66 from "node:path";
42884
42910
  import fs44 from "node:fs";
42885
42911
  async function mapDirEntry(d, relativePath, resolved) {
42886
- const entryPath = path65.join(relativePath || ".", d.name).replace(/\\/g, "/");
42887
- const fullPath = path65.join(resolved, d.name);
42912
+ const entryPath = path66.join(relativePath || ".", d.name).replace(/\\/g, "/");
42913
+ const fullPath = path66.join(resolved, d.name);
42888
42914
  let isDir = d.isDirectory();
42889
42915
  if (d.isSymbolicLink()) {
42890
42916
  try {
@@ -42934,13 +42960,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
42934
42960
  }
42935
42961
 
42936
42962
  // src/files/handle-file-browser-search.ts
42937
- import path66 from "node:path";
42963
+ import path67 from "node:path";
42938
42964
  var SEARCH_LIMIT = 100;
42939
42965
  function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
42940
42966
  void (async () => {
42941
42967
  await yieldToEventLoop();
42942
42968
  const q = typeof msg.q === "string" ? msg.q : "";
42943
- const sessionParentPath = path66.resolve(
42969
+ const sessionParentPath = path67.resolve(
42944
42970
  sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
42945
42971
  );
42946
42972
  if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
@@ -43150,13 +43176,13 @@ function triggerSymbolIndexBuild(parentPath) {
43150
43176
  }
43151
43177
 
43152
43178
  // src/git/tree/resolve-repo-abs-path.ts
43153
- import * as path67 from "node:path";
43179
+ import * as path68 from "node:path";
43154
43180
  function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
43155
- const bridgeResolved = path67.resolve(bridgeRoot);
43181
+ const bridgeResolved = path68.resolve(bridgeRoot);
43156
43182
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
43157
- const repoPath = rel === "" ? bridgeResolved : path67.join(bridgeResolved, rel);
43158
- const resolved = path67.resolve(repoPath);
43159
- if (!resolved.startsWith(bridgeResolved + path67.sep) && resolved !== bridgeResolved) {
43183
+ const repoPath = rel === "" ? bridgeResolved : path68.join(bridgeResolved, rel);
43184
+ const resolved = path68.resolve(repoPath);
43185
+ if (!resolved.startsWith(bridgeResolved + path68.sep) && resolved !== bridgeResolved) {
43160
43186
  return null;
43161
43187
  }
43162
43188
  return resolved;
@@ -43939,7 +43965,7 @@ function isValidRemoteSkillInstallItem(item) {
43939
43965
 
43940
43966
  // src/skills/install/install-remote-skills-async.ts
43941
43967
  import fs49 from "node:fs";
43942
- import path68 from "node:path";
43968
+ import path69 from "node:path";
43943
43969
 
43944
43970
  // src/skills/install/constants.ts
43945
43971
  var INSTALL_SKILLS_YIELD_EVERY = 16;
@@ -43950,8 +43976,8 @@ async function writeInstallFileAsync(skillDir, f, filesWritten) {
43950
43976
  if (++filesWritten.count % INSTALL_SKILLS_YIELD_EVERY === 0) {
43951
43977
  await yieldToEventLoop();
43952
43978
  }
43953
- const dest = path68.join(skillDir, f.path);
43954
- await fs49.promises.mkdir(path68.dirname(dest), { recursive: true });
43979
+ const dest = path69.join(skillDir, f.path);
43980
+ await fs49.promises.mkdir(path69.dirname(dest), { recursive: true });
43955
43981
  if (f.text !== void 0) {
43956
43982
  await fs49.promises.writeFile(dest, f.text, "utf8");
43957
43983
  } else if (f.base64) {
@@ -43967,7 +43993,7 @@ async function installRemoteSkillsAsync(cwd, targetDir, items) {
43967
43993
  try {
43968
43994
  for (const item of items) {
43969
43995
  if (!isValidRemoteSkillInstallItem(item)) continue;
43970
- const skillDir = path68.join(cwd, targetDir, item.skillName);
43996
+ const skillDir = path69.join(cwd, targetDir, item.skillName);
43971
43997
  for (const f of item.files) {
43972
43998
  await writeInstallFileAsync(skillDir, f, filesWritten);
43973
43999
  }
@@ -44306,7 +44332,7 @@ var handleDevServersConfig = (msg, deps) => {
44306
44332
  };
44307
44333
 
44308
44334
  // src/git/bridge-git-context.ts
44309
- import * as path69 from "node:path";
44335
+ import * as path70 from "node:path";
44310
44336
 
44311
44337
  // src/git/branches/get-current-branch.ts
44312
44338
  async function getCurrentBranch(repoPath) {
@@ -44356,12 +44382,12 @@ async function listRepoBranchRefs(repoPath) {
44356
44382
  // src/git/bridge-git-context.ts
44357
44383
  function folderNameForRelPath(relPath, bridgeRoot) {
44358
44384
  if (relPath === "." || relPath === "") {
44359
- return path69.basename(path69.resolve(bridgeRoot)) || "repo";
44385
+ return path70.basename(path70.resolve(bridgeRoot)) || "repo";
44360
44386
  }
44361
- return path69.basename(relPath) || relPath;
44387
+ return path70.basename(relPath) || relPath;
44362
44388
  }
44363
44389
  async function discoverGitReposForBridgeContext(bridgeRoot) {
44364
- const root = path69.resolve(bridgeRoot);
44390
+ const root = path70.resolve(bridgeRoot);
44365
44391
  if (await isGitRepoDirectory(root)) {
44366
44392
  const remoteUrl = await getRemoteOriginUrl(root);
44367
44393
  return [{ absolutePath: root, remoteUrl }];
@@ -44369,19 +44395,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
44369
44395
  const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
44370
44396
  const byPath = /* @__PURE__ */ new Map();
44371
44397
  for (const repo of [...deep, ...shallow]) {
44372
- byPath.set(path69.resolve(repo.absolutePath), repo);
44398
+ byPath.set(path70.resolve(repo.absolutePath), repo);
44373
44399
  }
44374
44400
  return [...byPath.values()];
44375
44401
  }
44376
44402
  async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
44377
- const bridgeResolved = path69.resolve(bridgeRoot);
44403
+ const bridgeResolved = path70.resolve(bridgeRoot);
44378
44404
  const repos = await discoverGitReposForBridgeContext(bridgeResolved);
44379
44405
  const rows = [];
44380
44406
  for (let i = 0; i < repos.length; i++) {
44381
44407
  if (i > 0) await yieldToEventLoop();
44382
44408
  const repo = repos[i];
44383
- let rel = path69.relative(bridgeResolved, repo.absolutePath);
44384
- if (rel.startsWith("..") || path69.isAbsolute(rel)) continue;
44409
+ let rel = path70.relative(bridgeResolved, repo.absolutePath);
44410
+ if (rel.startsWith("..") || path70.isAbsolute(rel)) continue;
44385
44411
  const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
44386
44412
  const currentBranch = await getCurrentBranch(repo.absolutePath);
44387
44413
  const remoteUrl = repo.remoteUrl.trim() || null;
@@ -44396,11 +44422,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
44396
44422
  return rows;
44397
44423
  }
44398
44424
  async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
44399
- const bridgeResolved = path69.resolve(bridgeRoot);
44425
+ const bridgeResolved = path70.resolve(bridgeRoot);
44400
44426
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
44401
- const repoPath = rel === "" ? bridgeResolved : path69.join(bridgeResolved, rel);
44402
- const resolved = path69.resolve(repoPath);
44403
- if (!resolved.startsWith(bridgeResolved + path69.sep) && resolved !== bridgeResolved) {
44427
+ const repoPath = rel === "" ? bridgeResolved : path70.join(bridgeResolved, rel);
44428
+ const resolved = path70.resolve(repoPath);
44429
+ if (!resolved.startsWith(bridgeResolved + path70.sep) && resolved !== bridgeResolved) {
44404
44430
  return [];
44405
44431
  }
44406
44432
  return listRepoBranchRefs(resolved);
@@ -45356,7 +45382,7 @@ async function createBridgeAccessState(options = {}) {
45356
45382
  }
45357
45383
 
45358
45384
  // src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
45359
- import * as path71 from "node:path";
45385
+ import * as path72 from "node:path";
45360
45386
 
45361
45387
  // src/sqlite/hash-json-sha256.ts
45362
45388
  import { createHash } from "node:crypto";
@@ -45423,7 +45449,7 @@ function listCliAgentCapabilityCacheForWorkspace(db, workspaceId) {
45423
45449
  }
45424
45450
 
45425
45451
  // src/agents/capabilities/probe-one-agent-type-for-capabilities.ts
45426
- import * as path70 from "node:path";
45452
+ import * as path71 from "node:path";
45427
45453
  async function probeOneAgentTypeForCapabilities(params) {
45428
45454
  const { agentType, cwd, workspaceId, log: log2, reportAgentCapabilities, bridgeReport = true, shouldContinue } = params;
45429
45455
  const canContinue = () => shouldContinue?.() !== false;
@@ -45461,7 +45487,7 @@ async function probeOneAgentTypeForCapabilities(params) {
45461
45487
  if (!canContinue()) return false;
45462
45488
  handle = await resolved.createClient({
45463
45489
  command: resolved.command,
45464
- cwd: path70.resolve(cwd),
45490
+ cwd: path71.resolve(cwd),
45465
45491
  backendAgentType: agentType,
45466
45492
  sessionMode: "agent",
45467
45493
  persistedAcpSessionId: null,
@@ -45539,7 +45565,7 @@ async function warmupAgentCapabilitiesOnConnect(params) {
45539
45565
  const { workspaceId, log: log2, getWs } = params;
45540
45566
  const isCurrent = beginAgentCapabilityWarmupRun();
45541
45567
  if (!isCurrent()) return;
45542
- const cwd = path71.resolve(getBridgeRoot());
45568
+ const cwd = path72.resolve(getBridgeRoot());
45543
45569
  async function sendBatchFromCache() {
45544
45570
  if (!isCurrent()) return;
45545
45571
  const socket = getWs();
@@ -45774,8 +45800,8 @@ async function createBridgeConnection(options) {
45774
45800
  getCloudAccessToken: () => tokens.accessToken
45775
45801
  });
45776
45802
  const identifyReportedPaths = {
45777
- bridgeRootPath: path72.resolve(getBridgeRoot()),
45778
- worktreesRootPath: path72.resolve(worktreesRootPath)
45803
+ bridgeRootPath: path73.resolve(getBridgeRoot()),
45804
+ worktreesRootPath: path73.resolve(worktreesRootPath)
45779
45805
  };
45780
45806
  const { connect } = createMainBridgeWebSocketLifecycle({
45781
45807
  state,