@buildautomaton/cli 0.1.74 → 0.1.76

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
@@ -4208,8 +4208,8 @@ var init_parseUtil = __esm({
4208
4208
  init_errors();
4209
4209
  init_en();
4210
4210
  makeIssue = (params) => {
4211
- const { data, path: path82, errorMaps, issueData } = params;
4212
- const fullPath = [...path82, ...issueData.path || []];
4211
+ const { data, path: path84, errorMaps, issueData } = params;
4212
+ const fullPath = [...path84, ...issueData.path || []];
4213
4213
  const fullIssue = {
4214
4214
  ...issueData,
4215
4215
  path: fullPath
@@ -4517,11 +4517,11 @@ var init_types = __esm({
4517
4517
  init_parseUtil();
4518
4518
  init_util();
4519
4519
  ParseInputLazyPath = class {
4520
- constructor(parent, value, path82, key) {
4520
+ constructor(parent, value, path84, key) {
4521
4521
  this._cachedPath = [];
4522
4522
  this.parent = parent;
4523
4523
  this.data = value;
4524
- this._path = path82;
4524
+ this._path = path84;
4525
4525
  this._key = key;
4526
4526
  }
4527
4527
  get path() {
@@ -8182,15 +8182,15 @@ function assignProp(target, prop, value) {
8182
8182
  configurable: true
8183
8183
  });
8184
8184
  }
8185
- function getElementAtPath(obj, path82) {
8186
- if (!path82)
8185
+ function getElementAtPath(obj, path84) {
8186
+ if (!path84)
8187
8187
  return obj;
8188
- return path82.reduce((acc, key) => acc?.[key], obj);
8188
+ return path84.reduce((acc, key) => acc?.[key], obj);
8189
8189
  }
8190
8190
  function promiseAllObject(promisesObj) {
8191
8191
  const keys = Object.keys(promisesObj);
8192
- const promises12 = keys.map((key) => promisesObj[key]);
8193
- return Promise.all(promises12).then((results) => {
8192
+ const promises13 = keys.map((key) => promisesObj[key]);
8193
+ return Promise.all(promises13).then((results) => {
8194
8194
  const resolvedObj = {};
8195
8195
  for (let i = 0; i < keys.length; i++) {
8196
8196
  resolvedObj[keys[i]] = results[i];
@@ -8434,11 +8434,11 @@ function aborted(x, startIndex = 0) {
8434
8434
  }
8435
8435
  return false;
8436
8436
  }
8437
- function prefixIssues(path82, issues) {
8437
+ function prefixIssues(path84, issues) {
8438
8438
  return issues.map((iss) => {
8439
8439
  var _a2;
8440
8440
  (_a2 = iss).path ?? (_a2.path = []);
8441
- iss.path.unshift(path82);
8441
+ iss.path.unshift(path84);
8442
8442
  return iss;
8443
8443
  });
8444
8444
  }
@@ -8627,7 +8627,7 @@ function treeifyError(error40, _mapper) {
8627
8627
  return issue2.message;
8628
8628
  };
8629
8629
  const result = { errors: [] };
8630
- const processError = (error41, path82 = []) => {
8630
+ const processError = (error41, path84 = []) => {
8631
8631
  var _a2, _b;
8632
8632
  for (const issue2 of error41.issues) {
8633
8633
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -8637,7 +8637,7 @@ function treeifyError(error40, _mapper) {
8637
8637
  } else if (issue2.code === "invalid_element") {
8638
8638
  processError({ issues: issue2.issues }, issue2.path);
8639
8639
  } else {
8640
- const fullpath = [...path82, ...issue2.path];
8640
+ const fullpath = [...path84, ...issue2.path];
8641
8641
  if (fullpath.length === 0) {
8642
8642
  result.errors.push(mapper(issue2));
8643
8643
  continue;
@@ -8667,9 +8667,9 @@ function treeifyError(error40, _mapper) {
8667
8667
  processError(error40);
8668
8668
  return result;
8669
8669
  }
8670
- function toDotPath(path82) {
8670
+ function toDotPath(path84) {
8671
8671
  const segs = [];
8672
- for (const seg of path82) {
8672
+ for (const seg of path84) {
8673
8673
  if (typeof seg === "number")
8674
8674
  segs.push(`[${seg}]`);
8675
8675
  else if (typeof seg === "symbol")
@@ -22376,7 +22376,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
22376
22376
  join2(moduleDir, "..", sub, filename),
22377
22377
  join2(moduleDir, "..", "..", "dist", sub, filename)
22378
22378
  ]);
22379
- const resolved = candidates.find((path82) => existsSync(path82));
22379
+ const resolved = candidates.find((path84) => existsSync(path84));
22380
22380
  if (!resolved) {
22381
22381
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
22382
22382
  }
@@ -23447,7 +23447,7 @@ var require_ignore = __commonJS({
23447
23447
  // path matching.
23448
23448
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
23449
23449
  // @returns {TestResult} true if a file is ignored
23450
- test(path82, checkUnignored, mode) {
23450
+ test(path84, checkUnignored, mode) {
23451
23451
  let ignored = false;
23452
23452
  let unignored = false;
23453
23453
  let matchedRule;
@@ -23456,7 +23456,7 @@ var require_ignore = __commonJS({
23456
23456
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
23457
23457
  return;
23458
23458
  }
23459
- const matched = rule[mode].test(path82);
23459
+ const matched = rule[mode].test(path84);
23460
23460
  if (!matched) {
23461
23461
  return;
23462
23462
  }
@@ -23477,17 +23477,17 @@ var require_ignore = __commonJS({
23477
23477
  var throwError = (message, Ctor) => {
23478
23478
  throw new Ctor(message);
23479
23479
  };
23480
- var checkPath = (path82, originalPath, doThrow) => {
23481
- if (!isString(path82)) {
23480
+ var checkPath = (path84, originalPath, doThrow) => {
23481
+ if (!isString(path84)) {
23482
23482
  return doThrow(
23483
23483
  `path must be a string, but got \`${originalPath}\``,
23484
23484
  TypeError
23485
23485
  );
23486
23486
  }
23487
- if (!path82) {
23487
+ if (!path84) {
23488
23488
  return doThrow(`path must not be empty`, TypeError);
23489
23489
  }
23490
- if (checkPath.isNotRelative(path82)) {
23490
+ if (checkPath.isNotRelative(path84)) {
23491
23491
  const r = "`path.relative()`d";
23492
23492
  return doThrow(
23493
23493
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -23496,7 +23496,7 @@ var require_ignore = __commonJS({
23496
23496
  }
23497
23497
  return true;
23498
23498
  };
23499
- var isNotRelative = (path82) => REGEX_TEST_INVALID_PATH.test(path82);
23499
+ var isNotRelative = (path84) => REGEX_TEST_INVALID_PATH.test(path84);
23500
23500
  checkPath.isNotRelative = isNotRelative;
23501
23501
  checkPath.convert = (p) => p;
23502
23502
  var Ignore = class {
@@ -23526,19 +23526,19 @@ var require_ignore = __commonJS({
23526
23526
  }
23527
23527
  // @returns {TestResult}
23528
23528
  _test(originalPath, cache2, checkUnignored, slices) {
23529
- const path82 = originalPath && checkPath.convert(originalPath);
23529
+ const path84 = originalPath && checkPath.convert(originalPath);
23530
23530
  checkPath(
23531
- path82,
23531
+ path84,
23532
23532
  originalPath,
23533
23533
  this._strictPathCheck ? throwError : RETURN_FALSE
23534
23534
  );
23535
- return this._t(path82, cache2, checkUnignored, slices);
23535
+ return this._t(path84, cache2, checkUnignored, slices);
23536
23536
  }
23537
- checkIgnore(path82) {
23538
- if (!REGEX_TEST_TRAILING_SLASH.test(path82)) {
23539
- return this.test(path82);
23537
+ checkIgnore(path84) {
23538
+ if (!REGEX_TEST_TRAILING_SLASH.test(path84)) {
23539
+ return this.test(path84);
23540
23540
  }
23541
- const slices = path82.split(SLASH).filter(Boolean);
23541
+ const slices = path84.split(SLASH).filter(Boolean);
23542
23542
  slices.pop();
23543
23543
  if (slices.length) {
23544
23544
  const parent = this._t(
@@ -23551,18 +23551,18 @@ var require_ignore = __commonJS({
23551
23551
  return parent;
23552
23552
  }
23553
23553
  }
23554
- return this._rules.test(path82, false, MODE_CHECK_IGNORE);
23554
+ return this._rules.test(path84, false, MODE_CHECK_IGNORE);
23555
23555
  }
23556
- _t(path82, cache2, checkUnignored, slices) {
23557
- if (path82 in cache2) {
23558
- return cache2[path82];
23556
+ _t(path84, cache2, checkUnignored, slices) {
23557
+ if (path84 in cache2) {
23558
+ return cache2[path84];
23559
23559
  }
23560
23560
  if (!slices) {
23561
- slices = path82.split(SLASH).filter(Boolean);
23561
+ slices = path84.split(SLASH).filter(Boolean);
23562
23562
  }
23563
23563
  slices.pop();
23564
23564
  if (!slices.length) {
23565
- return cache2[path82] = this._rules.test(path82, checkUnignored, MODE_IGNORE);
23565
+ return cache2[path84] = this._rules.test(path84, checkUnignored, MODE_IGNORE);
23566
23566
  }
23567
23567
  const parent = this._t(
23568
23568
  slices.join(SLASH) + SLASH,
@@ -23570,29 +23570,29 @@ var require_ignore = __commonJS({
23570
23570
  checkUnignored,
23571
23571
  slices
23572
23572
  );
23573
- return cache2[path82] = parent.ignored ? parent : this._rules.test(path82, checkUnignored, MODE_IGNORE);
23573
+ return cache2[path84] = parent.ignored ? parent : this._rules.test(path84, checkUnignored, MODE_IGNORE);
23574
23574
  }
23575
- ignores(path82) {
23576
- return this._test(path82, this._ignoreCache, false).ignored;
23575
+ ignores(path84) {
23576
+ return this._test(path84, this._ignoreCache, false).ignored;
23577
23577
  }
23578
23578
  createFilter() {
23579
- return (path82) => !this.ignores(path82);
23579
+ return (path84) => !this.ignores(path84);
23580
23580
  }
23581
23581
  filter(paths) {
23582
23582
  return makeArray(paths).filter(this.createFilter());
23583
23583
  }
23584
23584
  // @returns {TestResult}
23585
- test(path82) {
23586
- return this._test(path82, this._testCache, true);
23585
+ test(path84) {
23586
+ return this._test(path84, this._testCache, true);
23587
23587
  }
23588
23588
  };
23589
23589
  var factory = (options) => new Ignore(options);
23590
- var isPathValid = (path82) => checkPath(path82 && checkPath.convert(path82), path82, RETURN_FALSE);
23590
+ var isPathValid = (path84) => checkPath(path84 && checkPath.convert(path84), path84, RETURN_FALSE);
23591
23591
  var setupWindows = () => {
23592
23592
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
23593
23593
  checkPath.convert = makePosix;
23594
23594
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
23595
- checkPath.isNotRelative = (path82) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path82) || isNotRelative(path82);
23595
+ checkPath.isNotRelative = (path84) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path84) || isNotRelative(path84);
23596
23596
  };
23597
23597
  if (
23598
23598
  // Detect `process` so that it can run in browsers.
@@ -27960,10 +27960,10 @@ var require_src2 = __commonJS({
27960
27960
  var fs_1 = __require("fs");
27961
27961
  var debug_1 = __importDefault(require_src());
27962
27962
  var log2 = debug_1.default("@kwsites/file-exists");
27963
- function check2(path82, isFile, isDirectory) {
27964
- log2(`checking %s`, path82);
27963
+ function check2(path84, isFile, isDirectory) {
27964
+ log2(`checking %s`, path84);
27965
27965
  try {
27966
- const stat2 = fs_1.statSync(path82);
27966
+ const stat2 = fs_1.statSync(path84);
27967
27967
  if (stat2.isFile() && isFile) {
27968
27968
  log2(`[OK] path represents a file`);
27969
27969
  return true;
@@ -27983,8 +27983,8 @@ var require_src2 = __commonJS({
27983
27983
  throw e;
27984
27984
  }
27985
27985
  }
27986
- function exists2(path82, type = exports.READABLE) {
27987
- return check2(path82, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
27986
+ function exists2(path84, type = exports.READABLE) {
27987
+ return check2(path84, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
27988
27988
  }
27989
27989
  exports.exists = exists2;
27990
27990
  exports.FILE = 1;
@@ -30370,8 +30370,8 @@ function randomSecret() {
30370
30370
  }
30371
30371
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
30372
30372
  }
30373
- async function requestPreviewApi(port, secret, method, path82, body) {
30374
- const url2 = `http://127.0.0.1:${port}${path82}`;
30373
+ async function requestPreviewApi(port, secret, method, path84, body) {
30374
+ const url2 = `http://127.0.0.1:${port}${path84}`;
30375
30375
  const headers = {
30376
30376
  [PREVIEW_SECRET_HEADER]: secret,
30377
30377
  "Content-Type": "application/json"
@@ -30383,7 +30383,7 @@ async function requestPreviewApi(port, secret, method, path82, body) {
30383
30383
  });
30384
30384
  const data = await res.json().catch(() => ({}));
30385
30385
  if (!res.ok) {
30386
- throw new Error(data?.error ?? `Preview API ${method} ${path82}: ${res.status}`);
30386
+ throw new Error(data?.error ?? `Preview API ${method} ${path84}: ${res.status}`);
30387
30387
  }
30388
30388
  return data;
30389
30389
  }
@@ -30606,7 +30606,7 @@ function installBridgeProcessResilience() {
30606
30606
  }
30607
30607
 
30608
30608
  // src/cli-version.ts
30609
- var CLI_VERSION = "0.1.74".length > 0 ? "0.1.74" : "0.0.0-dev";
30609
+ var CLI_VERSION = "0.1.76".length > 0 ? "0.1.76" : "0.0.0-dev";
30610
30610
 
30611
30611
  // src/connection/heartbeat/constants.ts
30612
30612
  var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
@@ -35084,8 +35084,8 @@ async function execGitFile(args, options) {
35084
35084
  }
35085
35085
 
35086
35086
  // src/git/changes/parse/normalize-git-diff-path.ts
35087
- function normalizeGitDiffPath(path82) {
35088
- return path82.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35087
+ function normalizeGitDiffPath(path84) {
35088
+ return path84.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35089
35089
  }
35090
35090
 
35091
35091
  // src/git/changes/parse/parse-name-status-entries.ts
@@ -35344,6 +35344,7 @@ async function loadPreTurnSnapshot(options) {
35344
35344
  }
35345
35345
  return data;
35346
35346
  } catch (e) {
35347
+ if (e.code === "ENOENT") return null;
35347
35348
  log2(
35348
35349
  `[turn-diff] No pre-turn snapshot for run ${runId.slice(0, 8)}\u2026: ${e instanceof Error ? e.message : String(e)}`
35349
35350
  );
@@ -39314,8 +39315,8 @@ function pathspec(...paths) {
39314
39315
  cache.set(key, paths);
39315
39316
  return key;
39316
39317
  }
39317
- function isPathSpec(path82) {
39318
- return path82 instanceof String && cache.has(path82);
39318
+ function isPathSpec(path84) {
39319
+ return path84 instanceof String && cache.has(path84);
39319
39320
  }
39320
39321
  function toPaths(pathSpec) {
39321
39322
  return cache.get(pathSpec) || [];
@@ -39404,8 +39405,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
39404
39405
  function forEachLineWithContent(input, callback) {
39405
39406
  return toLinesWithContent(input, true).map((line) => callback(line));
39406
39407
  }
39407
- function folderExists(path82) {
39408
- return (0, import_file_exists.exists)(path82, import_file_exists.FOLDER);
39408
+ function folderExists(path84) {
39409
+ return (0, import_file_exists.exists)(path84, import_file_exists.FOLDER);
39409
39410
  }
39410
39411
  function append(target, item) {
39411
39412
  if (Array.isArray(target)) {
@@ -39809,8 +39810,8 @@ function checkIsRepoRootTask() {
39809
39810
  commands,
39810
39811
  format: "utf-8",
39811
39812
  onError,
39812
- parser(path82) {
39813
- return /^\.(git)?$/.test(path82.trim());
39813
+ parser(path84) {
39814
+ return /^\.(git)?$/.test(path84.trim());
39814
39815
  }
39815
39816
  };
39816
39817
  }
@@ -40244,11 +40245,11 @@ function parseGrep(grep) {
40244
40245
  const paths = /* @__PURE__ */ new Set();
40245
40246
  const results = {};
40246
40247
  forEachLineWithContent(grep, (input) => {
40247
- const [path82, line, preview] = input.split(NULL);
40248
- paths.add(path82);
40249
- (results[path82] = results[path82] || []).push({
40248
+ const [path84, line, preview] = input.split(NULL);
40249
+ paths.add(path84);
40250
+ (results[path84] = results[path84] || []).push({
40250
40251
  line: asNumber(line),
40251
- path: path82,
40252
+ path: path84,
40252
40253
  preview
40253
40254
  });
40254
40255
  });
@@ -41013,14 +41014,14 @@ var init_hash_object = __esm2({
41013
41014
  init_task();
41014
41015
  }
41015
41016
  });
41016
- function parseInit(bare, path82, text) {
41017
+ function parseInit(bare, path84, text) {
41017
41018
  const response = String(text).trim();
41018
41019
  let result;
41019
41020
  if (result = initResponseRegex.exec(response)) {
41020
- return new InitSummary(bare, path82, false, result[1]);
41021
+ return new InitSummary(bare, path84, false, result[1]);
41021
41022
  }
41022
41023
  if (result = reInitResponseRegex.exec(response)) {
41023
- return new InitSummary(bare, path82, true, result[1]);
41024
+ return new InitSummary(bare, path84, true, result[1]);
41024
41025
  }
41025
41026
  let gitDir = "";
41026
41027
  const tokens = response.split(" ");
@@ -41031,7 +41032,7 @@ function parseInit(bare, path82, text) {
41031
41032
  break;
41032
41033
  }
41033
41034
  }
41034
- return new InitSummary(bare, path82, /^re/i.test(response), gitDir);
41035
+ return new InitSummary(bare, path84, /^re/i.test(response), gitDir);
41035
41036
  }
41036
41037
  var InitSummary;
41037
41038
  var initResponseRegex;
@@ -41040,9 +41041,9 @@ var init_InitSummary = __esm2({
41040
41041
  "src/lib/responses/InitSummary.ts"() {
41041
41042
  "use strict";
41042
41043
  InitSummary = class {
41043
- constructor(bare, path82, existing, gitDir) {
41044
+ constructor(bare, path84, existing, gitDir) {
41044
41045
  this.bare = bare;
41045
- this.path = path82;
41046
+ this.path = path84;
41046
41047
  this.existing = existing;
41047
41048
  this.gitDir = gitDir;
41048
41049
  }
@@ -41054,7 +41055,7 @@ var init_InitSummary = __esm2({
41054
41055
  function hasBareCommand(command) {
41055
41056
  return command.includes(bareCommand);
41056
41057
  }
41057
- function initTask(bare = false, path82, customArgs) {
41058
+ function initTask(bare = false, path84, customArgs) {
41058
41059
  const commands = ["init", ...customArgs];
41059
41060
  if (bare && !hasBareCommand(commands)) {
41060
41061
  commands.splice(1, 0, bareCommand);
@@ -41063,7 +41064,7 @@ function initTask(bare = false, path82, customArgs) {
41063
41064
  commands,
41064
41065
  format: "utf-8",
41065
41066
  parser(text) {
41066
- return parseInit(commands.includes("--bare"), path82, text);
41067
+ return parseInit(commands.includes("--bare"), path84, text);
41067
41068
  }
41068
41069
  };
41069
41070
  }
@@ -41879,12 +41880,12 @@ var init_FileStatusSummary = __esm2({
41879
41880
  "use strict";
41880
41881
  fromPathRegex = /^(.+)\0(.+)$/;
41881
41882
  FileStatusSummary = class {
41882
- constructor(path82, index, working_dir) {
41883
- this.path = path82;
41883
+ constructor(path84, index, working_dir) {
41884
+ this.path = path84;
41884
41885
  this.index = index;
41885
41886
  this.working_dir = working_dir;
41886
41887
  if (index === "R" || working_dir === "R") {
41887
- const detail = fromPathRegex.exec(path82) || [null, path82, path82];
41888
+ const detail = fromPathRegex.exec(path84) || [null, path84, path84];
41888
41889
  this.from = detail[2] || "";
41889
41890
  this.path = detail[1] || "";
41890
41891
  }
@@ -41915,14 +41916,14 @@ function splitLine(result, lineStr) {
41915
41916
  default:
41916
41917
  return;
41917
41918
  }
41918
- function data(index, workingDir, path82) {
41919
+ function data(index, workingDir, path84) {
41919
41920
  const raw = `${index}${workingDir}`;
41920
41921
  const handler = parsers6.get(raw);
41921
41922
  if (handler) {
41922
- handler(result, path82);
41923
+ handler(result, path84);
41923
41924
  }
41924
41925
  if (raw !== "##" && raw !== "!!") {
41925
- result.files.push(new FileStatusSummary(path82, index, workingDir));
41926
+ result.files.push(new FileStatusSummary(path84, index, workingDir));
41926
41927
  }
41927
41928
  }
41928
41929
  }
@@ -42231,9 +42232,9 @@ var init_simple_git_api = __esm2({
42231
42232
  next
42232
42233
  );
42233
42234
  }
42234
- hashObject(path82, write) {
42235
+ hashObject(path84, write) {
42235
42236
  return this._runTask(
42236
- hashObjectTask(path82, write === true),
42237
+ hashObjectTask(path84, write === true),
42237
42238
  trailingFunctionArgument(arguments)
42238
42239
  );
42239
42240
  }
@@ -42586,8 +42587,8 @@ var init_branch = __esm2({
42586
42587
  }
42587
42588
  });
42588
42589
  function toPath(input) {
42589
- const path82 = input.trim().replace(/^["']|["']$/g, "");
42590
- return path82 && normalize3(path82);
42590
+ const path84 = input.trim().replace(/^["']|["']$/g, "");
42591
+ return path84 && normalize3(path84);
42591
42592
  }
42592
42593
  var parseCheckIgnore;
42593
42594
  var init_CheckIgnore = __esm2({
@@ -42901,8 +42902,8 @@ __export2(sub_module_exports, {
42901
42902
  subModuleTask: () => subModuleTask,
42902
42903
  updateSubModuleTask: () => updateSubModuleTask
42903
42904
  });
42904
- function addSubModuleTask(repo, path82) {
42905
- return subModuleTask(["add", repo, path82]);
42905
+ function addSubModuleTask(repo, path84) {
42906
+ return subModuleTask(["add", repo, path84]);
42906
42907
  }
42907
42908
  function initSubModuleTask(customArgs) {
42908
42909
  return subModuleTask(["init", ...customArgs]);
@@ -43235,8 +43236,8 @@ var require_git = __commonJS2({
43235
43236
  }
43236
43237
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
43237
43238
  };
43238
- Git2.prototype.submoduleAdd = function(repo, path82, then) {
43239
- return this._runTask(addSubModuleTask2(repo, path82), trailingFunctionArgument2(arguments));
43239
+ Git2.prototype.submoduleAdd = function(repo, path84, then) {
43240
+ return this._runTask(addSubModuleTask2(repo, path84), trailingFunctionArgument2(arguments));
43240
43241
  };
43241
43242
  Git2.prototype.submoduleUpdate = function(args, then) {
43242
43243
  return this._runTask(
@@ -43975,8 +43976,8 @@ function parseNumstatEntries(lines) {
43975
43976
  }
43976
43977
  function parseNumstat(lines) {
43977
43978
  const m = /* @__PURE__ */ new Map();
43978
- for (const [path82, entry] of parseNumstatEntries(lines)) {
43979
- m.set(path82, { additions: entry.additions, deletions: entry.deletions });
43979
+ for (const [path84, entry] of parseNumstatEntries(lines)) {
43980
+ m.set(path84, { additions: entry.additions, deletions: entry.deletions });
43980
43981
  }
43981
43982
  return m;
43982
43983
  }
@@ -44259,23 +44260,26 @@ function formatRemoteDisplayLabel(remoteUrl) {
44259
44260
  }
44260
44261
 
44261
44262
  // src/git/changes/repo/get-working-tree-change-repo-details.ts
44262
- import * as path51 from "node:path";
44263
+ import * as path52 from "node:path";
44263
44264
 
44264
44265
  // src/git/changes/repo/build-working-tree-change-repo-detail.ts
44265
- import * as path50 from "node:path";
44266
+ import * as path51 from "node:path";
44266
44267
 
44267
44268
  // src/git/is-git-repo.ts
44269
+ import * as fs32 from "node:fs";
44270
+ import * as path43 from "node:path";
44268
44271
  async function isGitRepoDirectory(dirPath) {
44269
44272
  try {
44270
- return await cliSimpleGit(dirPath).checkIsRepo();
44273
+ await fs32.promises.access(path43.join(dirPath, ".git"));
44274
+ return true;
44271
44275
  } catch {
44272
44276
  return false;
44273
44277
  }
44274
44278
  }
44275
44279
 
44276
44280
  // src/git/changes/listing/apply-untracked-file-stats.ts
44277
- import * as fs32 from "node:fs";
44278
- import * as path43 from "node:path";
44281
+ import * as fs33 from "node:fs";
44282
+ import * as path44 from "node:path";
44279
44283
 
44280
44284
  // src/git/changes/lines/count-lines.ts
44281
44285
  import { createReadStream } from "node:fs";
@@ -44307,7 +44311,7 @@ function createUntrackedStatsApplier(options) {
44307
44311
  if (!options.untrackedSet.has(pathInRepo)) return;
44308
44312
  if (options.nameByPath.has(pathInRepo)) return;
44309
44313
  if (row.change === "moved") return;
44310
- const repoFilePath = path43.join(options.repoGitCwd, pathInRepo);
44314
+ const repoFilePath = path44.join(options.repoGitCwd, pathInRepo);
44311
44315
  const fromGit = await numstatFromGitNoIndex(options.g, pathInRepo);
44312
44316
  if (fromGit) {
44313
44317
  row.additions = fromGit.additions;
@@ -44315,7 +44319,7 @@ function createUntrackedStatsApplier(options) {
44315
44319
  return;
44316
44320
  }
44317
44321
  try {
44318
- const st = await fs32.promises.stat(repoFilePath);
44322
+ const st = await fs33.promises.stat(repoFilePath);
44319
44323
  row.additions = st.isFile() ? await countTextFileLines(repoFilePath) : 0;
44320
44324
  } catch {
44321
44325
  row.additions = 0;
@@ -44392,7 +44396,7 @@ async function buildChangedFileRowsFromPaths(options) {
44392
44396
  }
44393
44397
 
44394
44398
  // src/git/changes/listing/enrich-working-tree-file-rows.ts
44395
- import * as path45 from "node:path";
44399
+ import * as path46 from "node:path";
44396
44400
 
44397
44401
  // src/git/changes/patch/patch-truncate.ts
44398
44402
  function truncatePatch(s) {
@@ -44480,10 +44484,10 @@ async function readGitBlobLines(repoCwd, pathInRepo) {
44480
44484
  }
44481
44485
 
44482
44486
  // src/git/changes/patch/hydrate/read-worktree-file-lines.ts
44483
- import * as fs33 from "node:fs";
44487
+ import * as fs34 from "node:fs";
44484
44488
  async function readWorktreeFileLines(filePath) {
44485
44489
  try {
44486
- const raw = await fs33.promises.readFile(filePath, "utf8");
44490
+ const raw = await fs34.promises.readFile(filePath, "utf8");
44487
44491
  return raw.split(/\r?\n/);
44488
44492
  } catch {
44489
44493
  return null;
@@ -44621,8 +44625,8 @@ async function unifiedDiffForFileInRange(repoCwd, range, pathInRepo, change, mov
44621
44625
  }
44622
44626
 
44623
44627
  // src/git/changes/total-lines/resolve-changed-file-total-lines.ts
44624
- import * as fs34 from "node:fs";
44625
- import * as path44 from "node:path";
44628
+ import * as fs35 from "node:fs";
44629
+ import * as path45 from "node:path";
44626
44630
  var MAX_BYTES = 512e3;
44627
44631
  async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
44628
44632
  const spec = `${ref}:${pathInRepo}`;
@@ -44642,13 +44646,13 @@ async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
44642
44646
  }
44643
44647
  async function resolveWorkingTreeFileTotalLines(options) {
44644
44648
  if (options.isBinary) return null;
44645
- const filePath = path44.join(options.repoGitCwd, options.pathInRepo);
44649
+ const filePath = path45.join(options.repoGitCwd, options.pathInRepo);
44646
44650
  if (options.change === "removed") {
44647
44651
  return countLinesInGitRef(options.repoGitCwd, "HEAD", options.pathInRepo);
44648
44652
  }
44649
44653
  if (options.change === "moved" || options.change === "modified") {
44650
44654
  try {
44651
- const st = await fs34.promises.stat(filePath);
44655
+ const st = await fs35.promises.stat(filePath);
44652
44656
  if (!st.isFile()) return null;
44653
44657
  return await countTextFileLines(filePath);
44654
44658
  } catch {
@@ -44691,7 +44695,7 @@ async function enrichWorkingTreeFileRows(options) {
44691
44695
  row.workspaceRelPath,
44692
44696
  options.repoPathRelativeToWorkspaceRoot
44693
44697
  );
44694
- const filePath = path45.join(options.repoGitCwd, filePathRelativeToRepoRoot);
44698
+ const filePath = path46.join(options.repoGitCwd, filePathRelativeToRepoRoot);
44695
44699
  const hydrateKind = row.change === "moved" ? "modified" : row.change;
44696
44700
  let patch = await unifiedDiffForFile(
44697
44701
  options.repoGitCwd,
@@ -44849,7 +44853,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoPathRelativeToWorkspaceRo
44849
44853
  }
44850
44854
 
44851
44855
  // src/git/changes/listing/list-changed-files-for-commit.ts
44852
- import * as path46 from "node:path";
44856
+ import * as path47 from "node:path";
44853
44857
 
44854
44858
  // src/git/changes/listing/enrich-commit-file-rows.ts
44855
44859
  async function enrichCommitFileRows(options) {
@@ -44894,7 +44898,7 @@ async function parentForCommitDiff(g, sha) {
44894
44898
  var COMMIT_FILES_CACHE_TTL_MS = 5 * 6e4;
44895
44899
  var commitFilesCache = /* @__PURE__ */ new Map();
44896
44900
  function commitFilesCacheKey(repoGitCwd, commitSha) {
44897
- return `${path46.resolve(repoGitCwd)}:${commitSha}`;
44901
+ return `${path47.resolve(repoGitCwd)}:${commitSha}`;
44898
44902
  }
44899
44903
  async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspaceRoot, commitSha, options = {}) {
44900
44904
  const cacheKey = commitFilesCacheKey(repoGitCwd, commitSha);
@@ -44949,7 +44953,7 @@ async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspace
44949
44953
  }
44950
44954
 
44951
44955
  // src/git/commits/list-unpushed-commits.ts
44952
- import * as path47 from "node:path";
44956
+ import * as path48 from "node:path";
44953
44957
 
44954
44958
  // src/git/commits/lib/parse-log-lines.ts
44955
44959
  function parseLogShaDateSubjectLines(raw) {
@@ -44984,7 +44988,7 @@ async function gitLogNotReachableFromBase(g, baseSha, headSha) {
44984
44988
  }
44985
44989
  }
44986
44990
  async function listUnpushedCommits(repoDir) {
44987
- const key = path47.resolve(repoDir);
44991
+ const key = path48.resolve(repoDir);
44988
44992
  const now = Date.now();
44989
44993
  const cached2 = unpushedCache.get(key);
44990
44994
  if (cached2 && cached2.expiresAt > now) return cached2.commits;
@@ -45045,7 +45049,7 @@ async function loadRecentAndUnpushedCommitsForRepoDetail(repoDir, recentCommitsL
45045
45049
  }
45046
45050
 
45047
45051
  // src/git/changes/repo/load-working-tree-change-repo-git-info.ts
45048
- import * as path48 from "node:path";
45052
+ import * as path49 from "node:path";
45049
45053
 
45050
45054
  // src/git/remote-origin-url.ts
45051
45055
  async function getRemoteOriginUrl(gitDir) {
@@ -45060,7 +45064,7 @@ async function getRemoteOriginUrl(gitDir) {
45060
45064
 
45061
45065
  // src/git/changes/repo/load-working-tree-change-repo-git-info.ts
45062
45066
  async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
45063
- const resolvedCheckoutPath = path48.resolve(checkoutPath);
45067
+ const resolvedCheckoutPath = path49.resolve(checkoutPath);
45064
45068
  const git = cliSimpleGit(resolvedCheckoutPath);
45065
45069
  await yieldToEventLoop2();
45066
45070
  const [branch, remoteUrl] = await Promise.all([
@@ -45075,14 +45079,14 @@ async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
45075
45079
  }
45076
45080
 
45077
45081
  // src/git/changes/repo/resolve-repo-path-relative-to-workspace-root.ts
45078
- import * as path49 from "node:path";
45082
+ import * as path50 from "node:path";
45079
45083
  async function resolveRepoPathRelativeToWorkspaceRoot(options) {
45080
- const checkoutPath = path49.resolve(options.checkoutPath);
45084
+ const checkoutPath = path50.resolve(options.checkoutPath);
45081
45085
  const git = cliSimpleGit(checkoutPath);
45082
- const sessionParentPath = options.sessionParentPath ? path49.resolve(options.sessionParentPath) : null;
45086
+ const sessionParentPath = options.sessionParentPath ? path50.resolve(options.sessionParentPath) : null;
45083
45087
  let repoPathRelativeToWorkspaceRoot;
45084
45088
  if (sessionParentPath) {
45085
- const checkoutPathRelativeToSessionParent = path49.relative(sessionParentPath, checkoutPath);
45089
+ const checkoutPathRelativeToSessionParent = path50.relative(sessionParentPath, checkoutPath);
45086
45090
  repoPathRelativeToWorkspaceRoot = checkoutPathRelativeToSessionParent === "" ? "." : checkoutPathRelativeToSessionParent.replace(/\\/g, "/");
45087
45091
  } else {
45088
45092
  let gitTopLevel = checkoutPath;
@@ -45092,8 +45096,8 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
45092
45096
  } catch {
45093
45097
  gitTopLevel = checkoutPath;
45094
45098
  }
45095
- const gitTopLevelRelativeToBridgeRoot = path49.relative(options.bridgeRoot, path49.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
45096
- repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path49.basename(path49.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
45099
+ const gitTopLevelRelativeToBridgeRoot = path50.relative(options.bridgeRoot, path50.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
45100
+ repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path50.basename(path50.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
45097
45101
  }
45098
45102
  return normalizeRepoPathRelativeToWorkspaceRoot(
45099
45103
  repoPathRelativeToWorkspaceRoot === "" ? "." : repoPathRelativeToWorkspaceRoot
@@ -45102,10 +45106,10 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
45102
45106
 
45103
45107
  // src/git/changes/repo/build-working-tree-change-repo-detail.ts
45104
45108
  async function buildWorkingTreeChangeRepoDetail(options) {
45105
- const checkoutPath = path50.resolve(options.targetPath);
45109
+ const checkoutPath = path51.resolve(options.targetPath);
45106
45110
  if (!await isGitRepoDirectory(checkoutPath)) return null;
45107
45111
  const isCommitView = options.basis.kind === "commit";
45108
- const sessionParentPath = options.sessionParentPath ? path50.resolve(options.sessionParentPath) : null;
45112
+ const sessionParentPath = options.sessionParentPath ? path51.resolve(options.sessionParentPath) : null;
45109
45113
  const git = cliSimpleGit(checkoutPath);
45110
45114
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
45111
45115
  checkoutPath,
@@ -45153,8 +45157,8 @@ async function buildWorkingTreeChangeRepoDetail(options) {
45153
45157
 
45154
45158
  // src/git/changes/repo/get-working-tree-change-repo-details.ts
45155
45159
  async function getWorkingTreeChangeRepoDetails(options) {
45156
- const bridgeRoot = path51.resolve(getBridgeRoot());
45157
- const sessionParentPath = options.sessionParentPath ? path51.resolve(options.sessionParentPath) : null;
45160
+ const bridgeRoot = path52.resolve(getBridgeRoot());
45161
+ const sessionParentPath = options.sessionParentPath ? path52.resolve(options.sessionParentPath) : null;
45158
45162
  const out = [];
45159
45163
  const filter = options.repoFilterRelPath != null ? normalizeRepoPathRelativeToWorkspaceRoot(options.repoFilterRelPath) : null;
45160
45164
  const basisInput = options.basis ?? { kind: "working" };
@@ -45185,9 +45189,9 @@ async function getWorkingTreeChangeRepoDetails(options) {
45185
45189
  }
45186
45190
 
45187
45191
  // src/git/changes/repo/get-working-tree-change-file-patch.ts
45188
- import * as path52 from "node:path";
45192
+ import * as path53 from "node:path";
45189
45193
  async function getWorkingTreeChangeFilePatch(options) {
45190
- const repoGitCwd = path52.resolve(options.repoGitCwd);
45194
+ const repoGitCwd = path53.resolve(options.repoGitCwd);
45191
45195
  if (!await isGitRepoDirectory(repoGitCwd)) {
45192
45196
  throw new Error("Not a git repository");
45193
45197
  }
@@ -45226,7 +45230,7 @@ async function getWorkingTreeChangeFilePatch(options) {
45226
45230
  });
45227
45231
  return { patchContent: patchContent2, totalLines: totalLines2 };
45228
45232
  }
45229
- const filePath = path52.join(repoGitCwd, filePathRelativeToRepoRoot);
45233
+ const filePath = path53.join(repoGitCwd, filePathRelativeToRepoRoot);
45230
45234
  const hydrateKind = options.change === "moved" ? "modified" : options.change;
45231
45235
  let patchContent = await unifiedDiffForFile(
45232
45236
  repoGitCwd,
@@ -45272,18 +45276,18 @@ function parseWorkingTreeChangeKind(value) {
45272
45276
  }
45273
45277
 
45274
45278
  // src/worktrees/manager/git/get-session-working-tree-change-file-patch.ts
45275
- import * as path53 from "node:path";
45279
+ import * as path54 from "node:path";
45276
45280
  async function getSessionWorkingTreeChangeFilePatch(cache2, sessionId, discover, opts) {
45277
45281
  const targets = await resolveCommitTargetsAsync(sessionId, cache2, discover);
45278
- const bridgeRoot = path53.resolve(getBridgeRoot());
45279
- const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path53.resolve(cache2.getSessionParentPath(sessionId)) : null;
45282
+ const bridgeRoot = path54.resolve(getBridgeRoot());
45283
+ const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path54.resolve(cache2.getSessionParentPath(sessionId)) : null;
45280
45284
  const repoPathRelativeToWorkspaceRootFilter = normalizeRepoPathRelativeToWorkspaceRoot(
45281
45285
  opts.repoRelPath.trim()
45282
45286
  );
45283
45287
  let result = null;
45284
45288
  await forEachWithGitYield(targets, async (targetPath) => {
45285
45289
  if (result) return;
45286
- const checkoutPath = path53.resolve(targetPath);
45290
+ const checkoutPath = path54.resolve(targetPath);
45287
45291
  if (!await isGitRepoDirectory(checkoutPath)) return;
45288
45292
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
45289
45293
  checkoutPath,
@@ -45316,13 +45320,13 @@ async function pushSessionUpstream(cache2, sessionId, discover) {
45316
45320
  }
45317
45321
 
45318
45322
  // src/worktrees/remove-session-worktrees.ts
45319
- import * as fs37 from "node:fs";
45323
+ import * as fs38 from "node:fs";
45320
45324
 
45321
45325
  // src/git/worktrees/worktree-remove.ts
45322
- import * as fs36 from "node:fs";
45326
+ import * as fs37 from "node:fs";
45323
45327
 
45324
45328
  // src/worktrees/is-removable-session-worktree-checkout-path.ts
45325
- import path54 from "node:path";
45329
+ import path55 from "node:path";
45326
45330
  init_normalize_resolved_path();
45327
45331
  function isBridgeRootCheckoutPath(checkoutPath) {
45328
45332
  return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
@@ -45331,23 +45335,23 @@ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath)
45331
45335
  if (isBridgeRootCheckoutPath(checkoutPath)) return false;
45332
45336
  const normalized = normalizeResolvedPath(checkoutPath);
45333
45337
  const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
45334
- const rel = path54.relative(worktreesRoot, normalized);
45335
- if (rel === "" || rel.startsWith("..") || path54.isAbsolute(rel)) return false;
45338
+ const rel = path55.relative(worktreesRoot, normalized);
45339
+ if (rel === "" || rel.startsWith("..") || path55.isAbsolute(rel)) return false;
45336
45340
  return true;
45337
45341
  }
45338
45342
 
45339
45343
  // src/git/worktrees/resolve-main-repo-from-git-file.ts
45340
- import * as fs35 from "node:fs";
45341
- import * as path55 from "node:path";
45344
+ import * as fs36 from "node:fs";
45345
+ import * as path56 from "node:path";
45342
45346
  function resolveMainRepoFromWorktreeGitFile(wt) {
45343
- const gitDirFile = path55.join(wt, ".git");
45344
- if (!fs35.existsSync(gitDirFile) || !fs35.statSync(gitDirFile).isFile()) return "";
45345
- const first2 = fs35.readFileSync(gitDirFile, "utf8").trim();
45347
+ const gitDirFile = path56.join(wt, ".git");
45348
+ if (!fs36.existsSync(gitDirFile) || !fs36.statSync(gitDirFile).isFile()) return "";
45349
+ const first2 = fs36.readFileSync(gitDirFile, "utf8").trim();
45346
45350
  const m = first2.match(/^gitdir:\s*(.+)$/im);
45347
45351
  if (!m) return "";
45348
- const gitWorktreePath = path55.resolve(wt, m[1].trim());
45349
- const gitDir = path55.dirname(path55.dirname(gitWorktreePath));
45350
- return path55.dirname(gitDir);
45352
+ const gitWorktreePath = path56.resolve(wt, m[1].trim());
45353
+ const gitDir = path56.dirname(path56.dirname(gitWorktreePath));
45354
+ return path56.dirname(gitDir);
45351
45355
  }
45352
45356
 
45353
45357
  // src/git/worktrees/worktree-remove.ts
@@ -45358,7 +45362,7 @@ async function gitWorktreeRemoveForce(worktreePath) {
45358
45362
  return true;
45359
45363
  }
45360
45364
  if (isBridgeRootCheckoutPath(worktreePath)) return false;
45361
- fs36.rmSync(worktreePath, { recursive: true, force: true });
45365
+ fs37.rmSync(worktreePath, { recursive: true, force: true });
45362
45366
  return true;
45363
45367
  }
45364
45368
 
@@ -45380,7 +45384,7 @@ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
45380
45384
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
45381
45385
  if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
45382
45386
  try {
45383
- fs37.rmSync(wt, { recursive: true, force: true });
45387
+ fs38.rmSync(wt, { recursive: true, force: true });
45384
45388
  } catch {
45385
45389
  }
45386
45390
  }
@@ -45405,6 +45409,7 @@ async function gitRenameCurrentBranch(repoDir, newName) {
45405
45409
  async function renameSessionWorktreeBranches(paths, newBranch, log2) {
45406
45410
  const safe = newBranch.replace(/[^a-zA-Z0-9/_-]+/g, "-").slice(0, 80) || "session-branch";
45407
45411
  await forEachWithGitYield(paths, async (wt) => {
45412
+ if (!await isGitRepoDirectory(wt)) return;
45408
45413
  try {
45409
45414
  await gitRenameCurrentBranch(wt, safe);
45410
45415
  log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
@@ -45426,12 +45431,12 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
45426
45431
  // src/worktrees/discovery/discover-session-worktree-on-disk.ts
45427
45432
  init_cli_process_interrupt();
45428
45433
  init_yield_to_event_loop();
45429
- import * as fs41 from "node:fs";
45430
- import * as path60 from "node:path";
45434
+ import * as fs42 from "node:fs";
45435
+ import * as path61 from "node:path";
45431
45436
 
45432
45437
  // src/worktrees/discovery/collect-worktree-paths.ts
45433
- import * as fs39 from "node:fs";
45434
- import * as path57 from "node:path";
45438
+ import * as fs40 from "node:fs";
45439
+ import * as path58 from "node:path";
45435
45440
 
45436
45441
  // src/worktrees/discovery/disk-walk-constants.ts
45437
45442
  var DISK_WALK_YIELD_EVERY = 64;
@@ -45461,8 +45466,8 @@ function shouldSkipDiskWalkEntry(name) {
45461
45466
  // src/worktrees/discovery/disk-walk-utils.ts
45462
45467
  init_cli_process_interrupt();
45463
45468
  init_yield_to_event_loop();
45464
- import * as fs38 from "node:fs";
45465
- import * as path56 from "node:path";
45469
+ import * as fs39 from "node:fs";
45470
+ import * as path57 from "node:path";
45466
45471
  async function yieldDuringDiskWalk(state) {
45467
45472
  state.entries++;
45468
45473
  if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
@@ -45472,7 +45477,7 @@ async function yieldDuringDiskWalk(state) {
45472
45477
  }
45473
45478
  async function isGitDir(dirPath) {
45474
45479
  try {
45475
- await fs38.promises.access(path56.join(dirPath, ".git"));
45480
+ await fs39.promises.access(path57.join(dirPath, ".git"));
45476
45481
  return true;
45477
45482
  } catch {
45478
45483
  return false;
@@ -45486,23 +45491,23 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
45486
45491
  const walk = async (dir) => {
45487
45492
  if (!await yieldDuringDiskWalk(state)) return;
45488
45493
  if (await isGitDir(dir)) {
45489
- out.push(path57.resolve(dir));
45494
+ out.push(path58.resolve(dir));
45490
45495
  return;
45491
45496
  }
45492
45497
  let entries;
45493
45498
  try {
45494
- entries = await fs39.promises.readdir(dir, { withFileTypes: true });
45499
+ entries = await fs40.promises.readdir(dir, { withFileTypes: true });
45495
45500
  } catch {
45496
45501
  return;
45497
45502
  }
45498
45503
  for (const e of entries) {
45499
45504
  if (shouldSkipDiskWalkEntry(e.name)) continue;
45500
- const full = path57.join(dir, e.name);
45505
+ const full = path58.join(dir, e.name);
45501
45506
  if (!e.isDirectory()) continue;
45502
45507
  await walk(full);
45503
45508
  }
45504
45509
  };
45505
- await walk(path57.resolve(rootPath));
45510
+ await walk(path58.resolve(rootPath));
45506
45511
  return { paths: [...new Set(out)], entriesVisited: state.entries };
45507
45512
  }
45508
45513
  async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
@@ -45513,16 +45518,16 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
45513
45518
  if (!await yieldDuringDiskWalk(state)) return;
45514
45519
  let entries;
45515
45520
  try {
45516
- entries = await fs39.promises.readdir(dir, { withFileTypes: true });
45521
+ entries = await fs40.promises.readdir(dir, { withFileTypes: true });
45517
45522
  } catch {
45518
45523
  return;
45519
45524
  }
45520
45525
  for (const e of entries) {
45521
45526
  if (shouldSkipDiskWalkEntry(e.name)) continue;
45522
- const full = path57.join(dir, e.name);
45527
+ const full = path58.join(dir, e.name);
45523
45528
  if (!e.isDirectory()) continue;
45524
45529
  if (e.name === sessionId) {
45525
- if (await isGitDir(full)) out.push(path57.resolve(full));
45530
+ if (await isGitDir(full)) out.push(path58.resolve(full));
45526
45531
  continue;
45527
45532
  }
45528
45533
  if (await isGitDir(full)) continue;
@@ -45534,14 +45539,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
45534
45539
  }
45535
45540
 
45536
45541
  // src/worktrees/discovery/layout-keys-for-bridge-root.ts
45537
- import * as path58 from "node:path";
45542
+ import * as path59 from "node:path";
45538
45543
  function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
45539
- const bridge = path58.resolve(bridgeRoot);
45544
+ const bridge = path59.resolve(bridgeRoot);
45540
45545
  const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
45541
45546
  const relevant = layout.launcherCwds.filter((e) => {
45542
- const entry = path58.resolve(e.absolutePath);
45543
- return bridge === entry || bridge.startsWith(entry + path58.sep) || entry.startsWith(bridge + path58.sep);
45544
- }).sort((a, b) => path58.resolve(b.absolutePath).length - path58.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
45547
+ const entry = path59.resolve(e.absolutePath);
45548
+ return bridge === entry || bridge.startsWith(entry + path59.sep) || entry.startsWith(bridge + path59.sep);
45549
+ }).sort((a, b) => path59.resolve(b.absolutePath).length - path59.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
45545
45550
  const ordered = [];
45546
45551
  const seen = /* @__PURE__ */ new Set();
45547
45552
  const add = (k) => {
@@ -45559,19 +45564,19 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
45559
45564
  }
45560
45565
 
45561
45566
  // src/worktrees/discovery/try-binding-from-isolated-directory.ts
45562
- import * as fs40 from "node:fs";
45563
- import * as path59 from "node:path";
45567
+ import * as fs41 from "node:fs";
45568
+ import * as path60 from "node:path";
45564
45569
  async function tryBindingFromIsolatedDirectory(scopeDir) {
45565
45570
  let st;
45566
45571
  try {
45567
- st = await fs40.promises.stat(scopeDir);
45572
+ st = await fs41.promises.stat(scopeDir);
45568
45573
  } catch {
45569
45574
  return null;
45570
45575
  }
45571
45576
  if (!st.isDirectory()) return null;
45572
45577
  const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(scopeDir);
45573
45578
  if (worktreePaths.length === 0) return null;
45574
- const abs = path59.resolve(scopeDir);
45579
+ const abs = path60.resolve(scopeDir);
45575
45580
  return {
45576
45581
  parentPath: abs,
45577
45582
  repoCheckoutPaths: worktreePaths
@@ -45594,7 +45599,7 @@ async function discoverSessionWorktreeOnDisk(options) {
45594
45599
  const sid = sessionId.trim();
45595
45600
  if (!sid) return null;
45596
45601
  try {
45597
- await fs41.promises.access(worktreesRootPath);
45602
+ await fs42.promises.access(worktreesRootPath);
45598
45603
  } catch {
45599
45604
  return null;
45600
45605
  }
@@ -45603,13 +45608,13 @@ async function discoverSessionWorktreeOnDisk(options) {
45603
45608
  if (preferredKey) keysOnDisk.push(preferredKey);
45604
45609
  const scanState = { entries: 0 };
45605
45610
  try {
45606
- for (const name of await fs41.promises.readdir(worktreesRootPath)) {
45611
+ for (const name of await fs42.promises.readdir(worktreesRootPath)) {
45607
45612
  if (!await yieldDuringDiskWalk(scanState)) break;
45608
45613
  if (name.startsWith(".")) continue;
45609
- const p = path60.join(worktreesRootPath, name);
45614
+ const p = path61.join(worktreesRootPath, name);
45610
45615
  let st;
45611
45616
  try {
45612
- st = await fs41.promises.stat(p);
45617
+ st = await fs42.promises.stat(p);
45613
45618
  } catch {
45614
45619
  continue;
45615
45620
  }
@@ -45623,23 +45628,23 @@ async function discoverSessionWorktreeOnDisk(options) {
45623
45628
  for (const key of keys) {
45624
45629
  if (isCliImmediateShutdownRequested()) return null;
45625
45630
  await yieldToEventLoop();
45626
- const layoutRoot = path60.join(worktreesRootPath, key);
45631
+ const layoutRoot = path61.join(worktreesRootPath, key);
45627
45632
  let layoutSt;
45628
45633
  try {
45629
- layoutSt = await fs41.promises.stat(layoutRoot);
45634
+ layoutSt = await fs42.promises.stat(layoutRoot);
45630
45635
  } catch {
45631
45636
  continue;
45632
45637
  }
45633
45638
  if (!layoutSt.isDirectory()) continue;
45634
- const sessionDir = path60.join(layoutRoot, sid);
45639
+ const sessionDir = path61.join(layoutRoot, sid);
45635
45640
  const nested = await tryBindingFromSessionDirectory(sessionDir);
45636
45641
  if (nested) return nested;
45637
45642
  const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
45638
45643
  if (legacy.paths.length > 0) {
45639
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path60.resolve(legacy.paths[0]);
45644
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path61.resolve(legacy.paths[0]);
45640
45645
  return {
45641
- sessionParentPath: path60.resolve(isolated),
45642
- repoCheckoutPaths: legacy.paths.map((p) => path60.resolve(p))
45646
+ sessionParentPath: path61.resolve(isolated),
45647
+ repoCheckoutPaths: legacy.paths.map((p) => path61.resolve(p))
45643
45648
  };
45644
45649
  }
45645
45650
  }
@@ -45647,31 +45652,31 @@ async function discoverSessionWorktreeOnDisk(options) {
45647
45652
  }
45648
45653
 
45649
45654
  // src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
45650
- import * as fs42 from "node:fs";
45651
- import * as path62 from "node:path";
45655
+ import * as fs43 from "node:fs";
45656
+ import * as path63 from "node:path";
45652
45657
 
45653
45658
  // src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
45654
45659
  init_cli_process_interrupt();
45655
45660
  init_yield_to_event_loop();
45656
- import * as path61 from "node:path";
45661
+ import * as path62 from "node:path";
45657
45662
  async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
45658
45663
  const sid = sessionId.trim();
45659
45664
  if (!sid) return null;
45660
- const hintR = path61.resolve(checkoutPath);
45665
+ const hintR = path62.resolve(checkoutPath);
45661
45666
  let best = null;
45662
- let cur = path61.dirname(hintR);
45667
+ let cur = path62.dirname(hintR);
45663
45668
  for (let i = 0; i < 40; i++) {
45664
45669
  if (isCliImmediateShutdownRequested()) return best;
45665
45670
  await yieldToEventLoop();
45666
45671
  const paths = await collectWorktreeRootsNamed(cur, sid);
45667
- if (paths.paths.some((p) => path61.resolve(p) === hintR)) {
45668
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path61.resolve(paths.paths[0]);
45672
+ if (paths.paths.some((p) => path62.resolve(p) === hintR)) {
45673
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path62.resolve(paths.paths[0]);
45669
45674
  best = {
45670
- sessionParentPath: path61.resolve(isolated),
45671
- repoCheckoutPaths: paths.paths.map((p) => path61.resolve(p))
45675
+ sessionParentPath: path62.resolve(isolated),
45676
+ repoCheckoutPaths: paths.paths.map((p) => path62.resolve(p))
45672
45677
  };
45673
45678
  }
45674
- const next = path61.dirname(cur);
45679
+ const next = path62.dirname(cur);
45675
45680
  if (next === cur) break;
45676
45681
  cur = next;
45677
45682
  }
@@ -45682,12 +45687,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
45682
45687
  async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPathOrHint, sessionId) {
45683
45688
  const sid = sessionId.trim();
45684
45689
  if (!sid) return null;
45685
- const hint = path62.resolve(sessionParentPathOrHint);
45686
- const underHint = await tryBindingFromSessionDirectory(path62.join(hint, sid));
45690
+ const hint = path63.resolve(sessionParentPathOrHint);
45691
+ const underHint = await tryBindingFromSessionDirectory(path63.join(hint, sid));
45687
45692
  if (underHint) return underHint;
45688
45693
  const direct = await tryBindingFromSessionDirectory(hint);
45689
45694
  if (direct) {
45690
- if (path62.basename(hint) === sid && await isGitDir(hint)) {
45695
+ if (path63.basename(hint) === sid && await isGitDir(hint)) {
45691
45696
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
45692
45697
  if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
45693
45698
  return legacyFromCheckout;
@@ -45695,23 +45700,23 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPat
45695
45700
  }
45696
45701
  return direct;
45697
45702
  }
45698
- if (path62.basename(hint) === sid && await isGitDir(hint)) {
45703
+ if (path63.basename(hint) === sid && await isGitDir(hint)) {
45699
45704
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
45700
45705
  if (legacyFromCheckout) return legacyFromCheckout;
45701
45706
  }
45702
45707
  let st;
45703
45708
  try {
45704
- st = await fs42.promises.stat(hint);
45709
+ st = await fs43.promises.stat(hint);
45705
45710
  } catch {
45706
45711
  return null;
45707
45712
  }
45708
45713
  if (!st.isDirectory()) return null;
45709
45714
  const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
45710
45715
  if (legacyPaths.paths.length === 0) return null;
45711
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path62.resolve(legacyPaths.paths[0]);
45716
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path63.resolve(legacyPaths.paths[0]);
45712
45717
  return {
45713
- sessionParentPath: path62.resolve(isolated),
45714
- repoCheckoutPaths: legacyPaths.paths.map((p) => path62.resolve(p))
45718
+ sessionParentPath: path63.resolve(isolated),
45719
+ repoCheckoutPaths: legacyPaths.paths.map((p) => path63.resolve(p))
45715
45720
  };
45716
45721
  }
45717
45722
 
@@ -45772,11 +45777,11 @@ function parseSessionParent(v) {
45772
45777
  }
45773
45778
 
45774
45779
  // src/worktrees/prepare/prepare-new-isolated-worktrees.ts
45775
- import * as fs46 from "node:fs";
45780
+ import * as fs47 from "node:fs";
45776
45781
 
45777
45782
  // src/git/discover-repos.ts
45778
- import * as fs43 from "node:fs";
45779
- import * as path63 from "node:path";
45783
+ import * as fs44 from "node:fs";
45784
+ import * as path64 from "node:path";
45780
45785
  init_yield_to_event_loop();
45781
45786
  var GIT_DISCOVER_YIELD_EVERY = 32;
45782
45787
  async function yieldGitDiscoverWork(entryCount) {
@@ -45786,14 +45791,14 @@ async function yieldGitDiscoverWork(entryCount) {
45786
45791
  }
45787
45792
  async function discoverGitRepos(cwd = getBridgeRoot()) {
45788
45793
  const result = [];
45789
- const cwdResolved = path63.resolve(cwd);
45794
+ const cwdResolved = path64.resolve(cwd);
45790
45795
  if (await isGitRepoDirectory(cwdResolved)) {
45791
45796
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
45792
45797
  result.push({ absolutePath: cwdResolved, remoteUrl });
45793
45798
  }
45794
45799
  let entries;
45795
45800
  try {
45796
- entries = fs43.readdirSync(cwdResolved, { withFileTypes: true });
45801
+ entries = fs44.readdirSync(cwdResolved, { withFileTypes: true });
45797
45802
  } catch {
45798
45803
  return result;
45799
45804
  }
@@ -45801,7 +45806,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
45801
45806
  await yieldGitDiscoverWork(i + 1);
45802
45807
  const ent = entries[i];
45803
45808
  if (!ent.isDirectory()) continue;
45804
- const childPath2 = path63.join(cwdResolved, ent.name);
45809
+ const childPath2 = path64.join(cwdResolved, ent.name);
45805
45810
  if (await isGitRepoDirectory(childPath2)) {
45806
45811
  const remoteUrl = await getRemoteOriginUrl(childPath2);
45807
45812
  result.push({ absolutePath: childPath2, remoteUrl });
@@ -45810,17 +45815,17 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
45810
45815
  return result;
45811
45816
  }
45812
45817
  async function discoverGitReposUnderRoot(rootPath) {
45813
- const root = path63.resolve(rootPath);
45818
+ const root = path64.resolve(rootPath);
45814
45819
  const roots = [];
45815
45820
  let walkEntries = 0;
45816
45821
  async function walk(dir) {
45817
45822
  if (await isGitRepoDirectory(dir)) {
45818
- roots.push(path63.resolve(dir));
45823
+ roots.push(path64.resolve(dir));
45819
45824
  return;
45820
45825
  }
45821
45826
  let entries;
45822
45827
  try {
45823
- entries = fs43.readdirSync(dir, { withFileTypes: true });
45828
+ entries = fs44.readdirSync(dir, { withFileTypes: true });
45824
45829
  } catch {
45825
45830
  return;
45826
45831
  }
@@ -45828,7 +45833,7 @@ async function discoverGitReposUnderRoot(rootPath) {
45828
45833
  await yieldGitDiscoverWork(++walkEntries);
45829
45834
  const ent = entries[i];
45830
45835
  if (!ent.isDirectory() || ent.name === ".git") continue;
45831
- await walk(path63.join(dir, ent.name));
45836
+ await walk(path64.join(dir, ent.name));
45832
45837
  }
45833
45838
  }
45834
45839
  await walk(root);
@@ -45844,8 +45849,8 @@ async function discoverGitReposUnderRoot(rootPath) {
45844
45849
  }
45845
45850
 
45846
45851
  // src/worktrees/prepare/add-isolated-repo-worktree.ts
45847
- import * as fs45 from "node:fs";
45848
- import * as path65 from "node:path";
45852
+ import * as fs46 from "node:fs";
45853
+ import * as path66 from "node:path";
45849
45854
 
45850
45855
  // src/git/worktrees/worktree-add.ts
45851
45856
  async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch, baseRef = "HEAD") {
@@ -45861,8 +45866,8 @@ async function gitWorktreeAddExistingBranch(mainRepoPath, worktreePath, branch)
45861
45866
  }
45862
45867
 
45863
45868
  // src/worktrees/prepare/copy-bridge-files-along-worktree-path.ts
45864
- import * as fs44 from "node:fs";
45865
- import * as path64 from "node:path";
45869
+ import * as fs45 from "node:fs";
45870
+ import * as path65 from "node:path";
45866
45871
  var BRIDGE_FILES_ALONG_WORKTREE_PATH = ["AGENTS.md"];
45867
45872
  function copyBridgeFilesAlongWorktreePath(options) {
45868
45873
  const { bridgeRoot, scopeDir, repoPathRelativeToBridgeRoot, log: log2 } = options;
@@ -45871,19 +45876,19 @@ function copyBridgeFilesAlongWorktreePath(options) {
45871
45876
  const segments = repoPathRelativeToBridgeRoot.split("/").filter(Boolean);
45872
45877
  for (let i = 0; i < segments.length; i++) {
45873
45878
  const prefix = segments.slice(0, i).join("/");
45874
- const bridgeDir = prefix ? path64.join(bridgeRoot, prefix) : bridgeRoot;
45875
- const destDir = prefix ? path64.join(scopeDir, prefix) : scopeDir;
45879
+ const bridgeDir = prefix ? path65.join(bridgeRoot, prefix) : bridgeRoot;
45880
+ const destDir = prefix ? path65.join(scopeDir, prefix) : scopeDir;
45876
45881
  for (const fileName of fileNames) {
45877
45882
  copyFileIfPresent(bridgeDir, destDir, fileName, log2);
45878
45883
  }
45879
45884
  }
45880
45885
  }
45881
45886
  function copyFileIfPresent(srcDir, destDir, fileName, log2) {
45882
- const src = path64.join(srcDir, fileName);
45883
- if (!fs44.existsSync(src)) return;
45884
- const dest = path64.join(destDir, fileName);
45887
+ const src = path65.join(srcDir, fileName);
45888
+ if (!fs45.existsSync(src)) return;
45889
+ const dest = path65.join(destDir, fileName);
45885
45890
  try {
45886
- fs44.copyFileSync(src, dest);
45891
+ fs45.copyFileSync(src, dest);
45887
45892
  log2?.(`[worktrees] Copied ${fileName} to ${dest}`);
45888
45893
  } catch (e) {
45889
45894
  log2?.(
@@ -45915,16 +45920,16 @@ async function addIsolatedRepoWorktree(options) {
45915
45920
  worktreeBaseBranches,
45916
45921
  log: log2
45917
45922
  } = options;
45918
- const repoPathRelativeToBridgeRootRaw = path65.relative(bridgeResolved, repoAbsolutePath);
45919
- if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path65.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
45923
+ const repoPathRelativeToBridgeRootRaw = path66.relative(bridgeResolved, repoAbsolutePath);
45924
+ if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path66.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
45920
45925
  return null;
45921
45926
  }
45922
45927
  const repoPathRelativeToBridgeRoot = normalizeRepoPathRelativeToWorkspaceRoot(
45923
45928
  repoPathRelativeToBridgeRootRaw === "" ? "." : repoPathRelativeToBridgeRootRaw
45924
45929
  );
45925
- const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path65.join(scopeDir, repoPathRelativeToBridgeRoot);
45930
+ const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path66.join(scopeDir, repoPathRelativeToBridgeRoot);
45926
45931
  if (repoPathRelativeToBridgeRoot !== ".") {
45927
- fs45.mkdirSync(path65.dirname(worktreePath), { recursive: true });
45932
+ fs46.mkdirSync(path66.dirname(worktreePath), { recursive: true });
45928
45933
  copyBridgeFilesAlongWorktreePath({
45929
45934
  bridgeRoot: bridgeResolved,
45930
45935
  scopeDir,
@@ -45952,7 +45957,7 @@ async function addIsolatedRepoWorktree(options) {
45952
45957
  }
45953
45958
 
45954
45959
  // src/worktrees/prepare/resolve-isolated-scope-dir.ts
45955
- import * as path66 from "node:path";
45960
+ import * as path67 from "node:path";
45956
45961
 
45957
45962
  // src/worktrees/worktree-layout-kind.ts
45958
45963
  function sanitizeWorktreeBranchSegment(value) {
@@ -45982,10 +45987,10 @@ function previewDeployBranchName(environmentId) {
45982
45987
 
45983
45988
  // src/worktrees/prepare/resolve-isolated-scope-dir.ts
45984
45989
  function resolveIsolatedScopeDir(options) {
45985
- const bridgeResolved = path66.resolve(options.bridgeRoot);
45990
+ const bridgeResolved = path67.resolve(options.bridgeRoot);
45986
45991
  const cwdKey = allocateDirNameForLauncherCwd(options.layout, bridgeResolved);
45987
- const bridgeKeyDir = path66.join(options.worktreesRootPath, cwdKey);
45988
- const scopeDir = path66.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
45992
+ const bridgeKeyDir = path67.join(options.worktreesRootPath, cwdKey);
45993
+ const scopeDir = path67.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
45989
45994
  return { bridgeResolved, scopeDir };
45990
45995
  }
45991
45996
 
@@ -46015,7 +46020,7 @@ async function prepareNewIsolatedWorktrees(options) {
46015
46020
  return null;
46016
46021
  }
46017
46022
  const worktreePaths = [];
46018
- fs46.mkdirSync(scopeDir, { recursive: true });
46023
+ fs47.mkdirSync(scopeDir, { recursive: true });
46019
46024
  await forEachWithGitYield(repos, async (repo) => {
46020
46025
  const worktreePath = await addIsolatedRepoWorktree({
46021
46026
  kind,
@@ -46087,10 +46092,10 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
46087
46092
  }
46088
46093
 
46089
46094
  // src/worktrees/manager/resolve-explicit-session-parent-path.ts
46090
- import * as path67 from "node:path";
46095
+ import * as path68 from "node:path";
46091
46096
  init_yield_to_event_loop();
46092
46097
  async function resolveExplicitSessionParentPath(params) {
46093
- const resolved = path67.resolve(params.parentPathRaw);
46098
+ const resolved = path68.resolve(params.parentPathRaw);
46094
46099
  if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
46095
46100
  return resolved;
46096
46101
  }
@@ -46107,7 +46112,7 @@ async function resolveExplicitSessionParentPath(params) {
46107
46112
  await yieldToEventLoop();
46108
46113
  const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
46109
46114
  if (tryRoot) return rememberAndReturn(tryRoot);
46110
- const next = path67.dirname(cur);
46115
+ const next = path68.dirname(cur);
46111
46116
  if (next === cur) break;
46112
46117
  cur = next;
46113
46118
  }
@@ -46255,15 +46260,15 @@ var SessionWorktreeManager = class {
46255
46260
  };
46256
46261
 
46257
46262
  // src/worktrees/discovery/discover-preview-worktree-on-disk.ts
46258
- import * as fs47 from "node:fs";
46259
- import * as path68 from "node:path";
46263
+ import * as fs48 from "node:fs";
46264
+ import * as path69 from "node:path";
46260
46265
  init_yield_to_event_loop();
46261
46266
  async function discoverPreviewWorktreeOnDisk(options) {
46262
46267
  const { environmentId, worktreesRootPath, layout, bridgeRoot } = options;
46263
46268
  const eid = environmentId.trim();
46264
46269
  if (!eid) return null;
46265
46270
  try {
46266
- await fs47.promises.access(worktreesRootPath);
46271
+ await fs48.promises.access(worktreesRootPath);
46267
46272
  } catch {
46268
46273
  return null;
46269
46274
  }
@@ -46272,13 +46277,13 @@ async function discoverPreviewWorktreeOnDisk(options) {
46272
46277
  if (preferredKey) keysOnDisk.push(preferredKey);
46273
46278
  const scanState = { entries: 0 };
46274
46279
  try {
46275
- for (const name of await fs47.promises.readdir(worktreesRootPath)) {
46280
+ for (const name of await fs48.promises.readdir(worktreesRootPath)) {
46276
46281
  if (!await yieldDuringDiskWalk(scanState)) break;
46277
46282
  if (name.startsWith(".")) continue;
46278
- const p = path68.join(worktreesRootPath, name);
46283
+ const p = path69.join(worktreesRootPath, name);
46279
46284
  let st;
46280
46285
  try {
46281
- st = await fs47.promises.stat(p);
46286
+ st = await fs48.promises.stat(p);
46282
46287
  } catch {
46283
46288
  continue;
46284
46289
  }
@@ -46292,7 +46297,7 @@ async function discoverPreviewWorktreeOnDisk(options) {
46292
46297
  const previewDirRel = layoutDirSegments("preview_environment", eid);
46293
46298
  for (const key of keys) {
46294
46299
  await yieldToEventLoop();
46295
- const previewDir = path68.join(worktreesRootPath, key, ...previewDirRel);
46300
+ const previewDir = path69.join(worktreesRootPath, key, ...previewDirRel);
46296
46301
  const binding = await tryBindingFromIsolatedDirectory(previewDir);
46297
46302
  if (binding) return binding;
46298
46303
  }
@@ -46419,7 +46424,7 @@ var PreviewWorktreeManager = class {
46419
46424
  };
46420
46425
 
46421
46426
  // src/worktrees/deploy/deploy-session-to-preview-environment.ts
46422
- import * as path72 from "node:path";
46427
+ import * as path73 from "node:path";
46423
46428
 
46424
46429
  // src/git/worktrees/reset-worktree-to-branch.ts
46425
46430
  async function gitResetWorktreeToBranch(worktreePath, branch) {
@@ -46430,8 +46435,8 @@ async function gitResetWorktreeToBranch(worktreePath, branch) {
46430
46435
  }
46431
46436
 
46432
46437
  // src/worktrees/deploy/capture-and-apply-wip.ts
46433
- import * as fs48 from "node:fs";
46434
- import * as path69 from "node:path";
46438
+ import * as fs49 from "node:fs";
46439
+ import * as path70 from "node:path";
46435
46440
 
46436
46441
  // src/git/snapshot/git.ts
46437
46442
  async function gitStashCreate(repoRoot, log2) {
@@ -46479,12 +46484,12 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
46479
46484
  if (!ap.ok) return ap;
46480
46485
  }
46481
46486
  await forEachWithGitYield(wip.untrackedPaths, async (rel) => {
46482
- const src = path69.join(sourceRepoPath, rel);
46483
- const dst = path69.join(targetRepoPath, rel);
46487
+ const src = path70.join(sourceRepoPath, rel);
46488
+ const dst = path70.join(targetRepoPath, rel);
46484
46489
  try {
46485
- if (!fs48.existsSync(src)) return;
46486
- fs48.mkdirSync(path69.dirname(dst), { recursive: true });
46487
- fs48.copyFileSync(src, dst);
46490
+ if (!fs49.existsSync(src)) return;
46491
+ fs49.mkdirSync(path70.dirname(dst), { recursive: true });
46492
+ fs49.copyFileSync(src, dst);
46488
46493
  } catch (e) {
46489
46494
  log2(
46490
46495
  `[worktrees] Failed to copy untracked ${rel}: ${e instanceof Error ? e.message : String(e)}`
@@ -46495,14 +46500,14 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
46495
46500
  }
46496
46501
 
46497
46502
  // src/worktrees/deploy/resolve-isolated-checkout-for-repo-path-relative-to-workspace-root.ts
46498
- import * as path70 from "node:path";
46503
+ import * as path71 from "node:path";
46499
46504
  async function resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot(options) {
46500
46505
  const { checkoutPaths, sessionParentPath, bridgeRoot, repoPathRelativeToWorkspaceRoot } = options;
46501
- const resolvedSessionParentPath = sessionParentPath ? path70.resolve(sessionParentPath) : null;
46506
+ const resolvedSessionParentPath = sessionParentPath ? path71.resolve(sessionParentPath) : null;
46502
46507
  let match = null;
46503
46508
  await forEachWithGitYield(checkoutPaths, async (checkoutPath) => {
46504
46509
  if (match) return;
46505
- const resolvedCheckoutPath = path70.resolve(checkoutPath);
46510
+ const resolvedCheckoutPath = path71.resolve(checkoutPath);
46506
46511
  if (!await isGitRepoDirectory(resolvedCheckoutPath)) return;
46507
46512
  const resolvedRepoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
46508
46513
  checkoutPath: resolvedCheckoutPath,
@@ -46556,7 +46561,7 @@ async function applySessionWipToPreviewCheckouts(options) {
46556
46561
  }
46557
46562
 
46558
46563
  // src/worktrees/deploy/collect-session-repo-deploy-states.ts
46559
- import * as path71 from "node:path";
46564
+ import * as path72 from "node:path";
46560
46565
 
46561
46566
  // src/git/branches/create-or-update-branch.ts
46562
46567
  async function gitCreateOrUpdateBranch(repoPath, branch, startRef, options) {
@@ -46593,19 +46598,19 @@ async function collectSessionRepoDeployStates(options) {
46593
46598
  const sessionParentPath = sessionWorktreeManager.getSessionParentPath(sid);
46594
46599
  const states = [];
46595
46600
  await forEachWithGitYield(sessionTargets, async (sessionCheckout) => {
46596
- const checkoutPath = path71.resolve(sessionCheckout);
46601
+ const checkoutPath = path72.resolve(sessionCheckout);
46597
46602
  if (!await isGitRepoDirectory(checkoutPath)) return;
46598
46603
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
46599
46604
  checkoutPath,
46600
46605
  bridgeRoot,
46601
- sessionParentPath: sessionParentPath ? path71.resolve(sessionParentPath) : null
46606
+ sessionParentPath: sessionParentPath ? path72.resolve(sessionParentPath) : null
46602
46607
  });
46603
46608
  if (!repoPathRelativeToWorkspaceRoot) return;
46604
46609
  const mainRepoPath = resolveMainRepoPath(checkoutPath);
46605
46610
  const headSha = (await cliSimpleGit(checkoutPath).revparse(["HEAD"])).trim();
46606
46611
  const previewCheckout = previewCheckoutPaths.length > 0 ? await resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot({
46607
46612
  checkoutPaths: previewCheckoutPaths,
46608
- sessionParentPath: previewParentPath ? path71.resolve(previewParentPath) : null,
46613
+ sessionParentPath: previewParentPath ? path72.resolve(previewParentPath) : null,
46609
46614
  bridgeRoot,
46610
46615
  repoPathRelativeToWorkspaceRoot
46611
46616
  }) : null;
@@ -46625,7 +46630,7 @@ async function deploySessionToPreviewEnvironment(options) {
46625
46630
  const eid = options.environmentId.trim();
46626
46631
  if (!sid || !eid) return { ok: false, error: "sessionId and environmentId are required" };
46627
46632
  const deployBranch = previewDeployBranchName(eid);
46628
- const bridgeRoot = path72.resolve(getBridgeRoot());
46633
+ const bridgeRoot = path73.resolve(getBridgeRoot());
46629
46634
  await previewWorktreeManager.ensureCached(eid);
46630
46635
  const existingPreviewParentPath = previewWorktreeManager.getPreviewParentPath(eid) ?? null;
46631
46636
  const existingPreviewCheckoutPaths = previewWorktreeManager.getRepoCheckoutPaths(eid) ?? [];
@@ -46665,10 +46670,10 @@ async function deploySessionToPreviewEnvironment(options) {
46665
46670
  }
46666
46671
 
46667
46672
  // src/worktrees/manager/default-worktrees-root-path.ts
46668
- import * as path73 from "node:path";
46673
+ import * as path74 from "node:path";
46669
46674
  import os9 from "node:os";
46670
46675
  function defaultWorktreesRootPath() {
46671
- return path73.join(os9.homedir(), ".buildautomaton", "worktrees");
46676
+ return path74.join(os9.homedir(), ".buildautomaton", "worktrees");
46672
46677
  }
46673
46678
 
46674
46679
  // src/connection/create-bridge-worktree-managers.ts
@@ -46798,14 +46803,14 @@ function assertBridgeWorkspace(ctx) {
46798
46803
  }
46799
46804
 
46800
46805
  // src/files/list-dir/index.ts
46801
- import fs50 from "node:fs";
46806
+ import fs51 from "node:fs";
46802
46807
 
46803
46808
  // src/files/ensure-under-cwd.ts
46804
- import path74 from "node:path";
46809
+ import path75 from "node:path";
46805
46810
  function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
46806
- const normalized = path74.normalize(relativePath).replace(/^(\.\/)+/, "");
46807
- const resolved = path74.resolve(cwd, normalized);
46808
- if (!resolved.startsWith(cwd + path74.sep) && resolved !== cwd) {
46811
+ const normalized = path75.normalize(relativePath).replace(/^(\.\/)+/, "");
46812
+ const resolved = path75.resolve(cwd, normalized);
46813
+ if (!resolved.startsWith(cwd + path75.sep) && resolved !== cwd) {
46809
46814
  return null;
46810
46815
  }
46811
46816
  return resolved;
@@ -46818,15 +46823,15 @@ init_yield_to_event_loop();
46818
46823
  var LIST_DIR_YIELD_EVERY = 256;
46819
46824
 
46820
46825
  // src/files/list-dir/map-dir-entry.ts
46821
- import path75 from "node:path";
46822
- import fs49 from "node:fs";
46826
+ import path76 from "node:path";
46827
+ import fs50 from "node:fs";
46823
46828
  async function mapDirEntry(d, relativePath, resolved) {
46824
- const entryPath = path75.join(relativePath || ".", d.name).replace(/\\/g, "/");
46825
- const fullPath = path75.join(resolved, d.name);
46829
+ const entryPath = path76.join(relativePath || ".", d.name).replace(/\\/g, "/");
46830
+ const fullPath = path76.join(resolved, d.name);
46826
46831
  let isDir = d.isDirectory();
46827
46832
  if (d.isSymbolicLink()) {
46828
46833
  try {
46829
- const targetStat = await fs49.promises.stat(fullPath);
46834
+ const targetStat = await fs50.promises.stat(fullPath);
46830
46835
  isDir = targetStat.isDirectory();
46831
46836
  } catch {
46832
46837
  isDir = false;
@@ -46856,7 +46861,7 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
46856
46861
  return { error: "Path is outside working directory" };
46857
46862
  }
46858
46863
  try {
46859
- const names = await fs50.promises.readdir(resolved, { withFileTypes: true });
46864
+ const names = await fs51.promises.readdir(resolved, { withFileTypes: true });
46860
46865
  const entries = [];
46861
46866
  for (let i = 0; i < names.length; i++) {
46862
46867
  if (i > 0 && i % LIST_DIR_YIELD_EVERY === 0) {
@@ -46872,13 +46877,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
46872
46877
  }
46873
46878
 
46874
46879
  // src/git/tree/resolve-repo-abs-path.ts
46875
- import * as path76 from "node:path";
46880
+ import * as path77 from "node:path";
46876
46881
  function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
46877
- const bridgeResolved = path76.resolve(bridgeRoot);
46882
+ const bridgeResolved = path77.resolve(bridgeRoot);
46878
46883
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
46879
- const repoPath = rel === "" ? bridgeResolved : path76.join(bridgeResolved, rel);
46880
- const resolved = path76.resolve(repoPath);
46881
- if (!resolved.startsWith(bridgeResolved + path76.sep) && resolved !== bridgeResolved) {
46884
+ const repoPath = rel === "" ? bridgeResolved : path77.join(bridgeResolved, rel);
46885
+ const resolved = path77.resolve(repoPath);
46886
+ if (!resolved.startsWith(bridgeResolved + path77.sep) && resolved !== bridgeResolved) {
46882
46887
  return null;
46883
46888
  }
46884
46889
  return resolved;
@@ -47359,25 +47364,25 @@ async function GET2(ctx) {
47359
47364
  init_in_flight();
47360
47365
 
47361
47366
  // src/files/read/read-file-async.ts
47362
- import fs56 from "node:fs";
47367
+ import fs57 from "node:fs";
47363
47368
  init_yield_to_event_loop();
47364
47369
 
47365
47370
  // src/files/read/resolve-file-cache.ts
47366
- import fs51 from "node:fs";
47367
- import path77 from "node:path";
47371
+ import fs52 from "node:fs";
47372
+ import path78 from "node:path";
47368
47373
  var RESOLVE_CACHE_MAX = 4096;
47369
47374
  var resolveCache = /* @__PURE__ */ new Map();
47370
47375
  function resolveCacheKey(sessionParentPath, relativePath) {
47371
47376
  return `${sessionParentPath}\0${relativePath}`;
47372
47377
  }
47373
47378
  function pathStaysUnderParent(filePath, sessionParentPath) {
47374
- const parent = path77.resolve(sessionParentPath);
47375
- const resolved = path77.resolve(filePath);
47376
- return resolved === parent || resolved.startsWith(`${parent}${path77.sep}`);
47379
+ const parent = path78.resolve(sessionParentPath);
47380
+ const resolved = path78.resolve(filePath);
47381
+ return resolved === parent || resolved.startsWith(`${parent}${path78.sep}`);
47377
47382
  }
47378
47383
  function statMatchesCacheSync(entry) {
47379
47384
  try {
47380
- const stat2 = fs51.statSync(entry.path);
47385
+ const stat2 = fs52.statSync(entry.path);
47381
47386
  return stat2.isFile() && stat2.mtimeMs === entry.mtimeMs && stat2.size === entry.size;
47382
47387
  } catch {
47383
47388
  return false;
@@ -47410,7 +47415,7 @@ function joinInflightResolve(cacheKey, factory) {
47410
47415
  }
47411
47416
 
47412
47417
  // src/files/read/resolve-file-for-read-core.ts
47413
- import fs52 from "node:fs";
47418
+ import fs53 from "node:fs";
47414
47419
  import { isMainThread as isMainThread4 } from "node:worker_threads";
47415
47420
  function resolveFileForReadImplSync(relativePath, sessionParentPath) {
47416
47421
  const cacheKey = resolveCacheKey(sessionParentPath, relativePath);
@@ -47420,13 +47425,13 @@ function resolveFileForReadImplSync(relativePath, sessionParentPath) {
47420
47425
  let size;
47421
47426
  let mtimeMs;
47422
47427
  try {
47423
- const lstat = fs52.lstatSync(resolved);
47428
+ const lstat = fs53.lstatSync(resolved);
47424
47429
  if (lstat.isSymbolicLink()) {
47425
- real = fs52.realpathSync(resolved);
47430
+ real = fs53.realpathSync(resolved);
47426
47431
  if (!pathStaysUnderParent(real, sessionParentPath)) {
47427
47432
  return { error: "Path is outside working directory" };
47428
47433
  }
47429
- const stat2 = fs52.statSync(real);
47434
+ const stat2 = fs53.statSync(real);
47430
47435
  if (!stat2.isFile()) return { error: "Not a file" };
47431
47436
  size = stat2.size;
47432
47437
  mtimeMs = stat2.mtimeMs;
@@ -47454,13 +47459,13 @@ async function resolveFileForReadImpl(relativePath, sessionParentPath) {
47454
47459
  let size;
47455
47460
  let mtimeMs;
47456
47461
  try {
47457
- const lstat = await fs52.promises.lstat(resolved);
47462
+ const lstat = await fs53.promises.lstat(resolved);
47458
47463
  if (lstat.isSymbolicLink()) {
47459
- real = await fs52.promises.realpath(resolved);
47464
+ real = await fs53.promises.realpath(resolved);
47460
47465
  if (!pathStaysUnderParent(real, sessionParentPath)) {
47461
47466
  return { error: "Path is outside working directory" };
47462
47467
  }
47463
- const stat2 = await fs52.promises.stat(real);
47468
+ const stat2 = await fs53.promises.stat(real);
47464
47469
  if (!stat2.isFile()) return { error: "Not a file" };
47465
47470
  size = stat2.size;
47466
47471
  mtimeMs = stat2.mtimeMs;
@@ -47509,7 +47514,7 @@ async function resolveFilePathAsync(relativePath, sessionParentPath = getBridgeR
47509
47514
 
47510
47515
  // src/files/read/read-file-range-async.ts
47511
47516
  init_yield_to_event_loop();
47512
- import fs53 from "node:fs";
47517
+ import fs54 from "node:fs";
47513
47518
  import { StringDecoder as StringDecoder2 } from "node:string_decoder";
47514
47519
 
47515
47520
  // src/files/read/read-file-range-line-zero.ts
@@ -47623,8 +47628,8 @@ function finishLineZeroTail(state, tail, resultLines, fileSize, lineChunkSize, l
47623
47628
 
47624
47629
  // src/files/read/read-file-range-async.ts
47625
47630
  async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE, fileSizeIn) {
47626
- const fileSize = fileSizeIn ?? (await fs53.promises.stat(filePath)).size;
47627
- const fd = await fs53.promises.open(filePath, "r");
47631
+ const fileSize = fileSizeIn ?? (await fs54.promises.stat(filePath)).size;
47632
+ const fd = await fs54.promises.open(filePath, "r");
47628
47633
  const bufSize = 64 * 1024;
47629
47634
  const buf = Buffer.alloc(bufSize);
47630
47635
  const decoder = new StringDecoder2("utf8");
@@ -47725,7 +47730,7 @@ async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, li
47725
47730
  }
47726
47731
 
47727
47732
  // src/files/read/read-small-file-range-async.ts
47728
- import fs54 from "node:fs";
47733
+ import fs55 from "node:fs";
47729
47734
  import { isMainThread as isMainThread5 } from "node:worker_threads";
47730
47735
  var SMALL_FILE_RANGE_MAX_BYTES = 512 * 1024;
47731
47736
  function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize) {
@@ -47755,7 +47760,7 @@ function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize,
47755
47760
  };
47756
47761
  }
47757
47762
  function readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE) {
47758
- const raw = fs54.readFileSync(filePath, "utf8");
47763
+ const raw = fs55.readFileSync(filePath, "utf8");
47759
47764
  const lines = raw.split(/\r?\n/);
47760
47765
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
47761
47766
  }
@@ -47763,28 +47768,28 @@ async function readSmallFileRangeAsync(filePath, fileSize, startLine, endLine, l
47763
47768
  if (isMainThread5) {
47764
47769
  return readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize);
47765
47770
  }
47766
- const raw = await fs54.promises.readFile(filePath, "utf8");
47771
+ const raw = await fs55.promises.readFile(filePath, "utf8");
47767
47772
  const lines = raw.split(/\r?\n/);
47768
47773
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
47769
47774
  }
47770
47775
 
47771
47776
  // src/files/read/read-file-buffer-full-async.ts
47772
47777
  init_yield_to_event_loop();
47773
- import fs55 from "node:fs";
47778
+ import fs56 from "node:fs";
47774
47779
  import { isMainThread as isMainThread6 } from "node:worker_threads";
47775
47780
  var READ_CHUNK_BYTES = 256 * 1024;
47776
47781
  var MAIN_THREAD_SYNC_READ_MAX_BYTES = 512 * 1024;
47777
47782
  async function readFileBufferFullAsync(filePath, knownSize) {
47778
47783
  if (isMainThread6) {
47779
- const size2 = knownSize ?? fs55.statSync(filePath).size;
47784
+ const size2 = knownSize ?? fs56.statSync(filePath).size;
47780
47785
  if (size2 <= MAIN_THREAD_SYNC_READ_MAX_BYTES) {
47781
47786
  await yieldToEventLoop();
47782
- const buffer = fs55.readFileSync(filePath);
47787
+ const buffer = fs56.readFileSync(filePath);
47783
47788
  return { buffer, size: buffer.length };
47784
47789
  }
47785
47790
  }
47786
- const size = knownSize ?? (await fs55.promises.stat(filePath)).size;
47787
- const fd = await fs55.promises.open(filePath, "r");
47791
+ const size = knownSize ?? (await fs56.promises.stat(filePath)).size;
47792
+ const fd = await fs56.promises.open(filePath, "r");
47788
47793
  const chunks = [];
47789
47794
  let position = 0;
47790
47795
  let bytesSinceYield = 0;
@@ -47887,7 +47892,7 @@ async function readFileAsync(relativePath, startLine, endLine, lineOffset, lineC
47887
47892
  }
47888
47893
  if (hasRange) {
47889
47894
  if (fileSize == null) {
47890
- const stat2 = await fs56.promises.stat(resolvedPath);
47895
+ const stat2 = await fs57.promises.stat(resolvedPath);
47891
47896
  fileSize = stat2.size;
47892
47897
  }
47893
47898
  const read2 = fileSize <= SMALL_FILE_RANGE_MAX_BYTES ? await readSmallFileRangeAsync(
@@ -48185,12 +48190,12 @@ function parseOptionalInt2(raw) {
48185
48190
  return Number.isInteger(parsed) ? parsed : void 0;
48186
48191
  }
48187
48192
  function parseCodeNavParams(url2) {
48188
- const path82 = url2.searchParams.get("path") ?? "";
48193
+ const path84 = url2.searchParams.get("path") ?? "";
48189
48194
  const opRaw = url2.searchParams.get("op")?.trim();
48190
48195
  const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
48191
48196
  const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
48192
48197
  const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
48193
- return { path: path82, op, line, column };
48198
+ return { path: path84, op, line, column };
48194
48199
  }
48195
48200
  function parseCodeNavPath(url2) {
48196
48201
  const raw = url2.searchParams.get("path")?.trim();
@@ -48865,15 +48870,21 @@ function dispatchLocalPrompt(next, deps) {
48865
48870
 
48866
48871
  // src/prompt-turn-queue/runner/run-id-queue-key-map.ts
48867
48872
  var runIdToQueueKey = /* @__PURE__ */ new Map();
48873
+ var locallyDispatchedRunIds = /* @__PURE__ */ new Set();
48868
48874
  function getRunIdQueueKey(runId) {
48869
48875
  return runIdToQueueKey.get(runId);
48870
48876
  }
48871
48877
  function setRunIdQueueKey(runId, queueKey) {
48872
48878
  runIdToQueueKey.set(runId, queueKey);
48879
+ locallyDispatchedRunIds.add(runId);
48880
+ }
48881
+ function isLocallyDispatchedRun(runId) {
48882
+ return locallyDispatchedRunIds.has(runId);
48873
48883
  }
48874
48884
  function deleteRunIdQueueKey(runId) {
48875
48885
  const queueKey = runIdToQueueKey.get(runId);
48876
48886
  runIdToQueueKey.delete(runId);
48887
+ locallyDispatchedRunIds.delete(runId);
48877
48888
  return queueKey;
48878
48889
  }
48879
48890
  function syncRunningTurnQueueKeys(turns, queueKey) {
@@ -48896,39 +48907,11 @@ async function dispatchStartedPromptQueueRuns(entries, started, deps) {
48896
48907
 
48897
48908
  // src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
48898
48909
  init_yield_to_event_loop();
48899
-
48900
- // src/prompt-turn-queue/client-report.ts
48901
- function sendPromptQueueClientReport(ws, queues) {
48902
- if (!ws) return false;
48903
- const wireQueues = {};
48904
- for (const [queueKey, rows] of Object.entries(queues)) {
48905
- wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
48906
- }
48907
- sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
48908
- return true;
48909
- }
48910
-
48911
- // src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
48912
- async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
48913
- if (!runId) return false;
48914
- const queueKey = deleteRunIdQueueKey(runId);
48915
- if (!queueKey) return false;
48916
- const f = await readPersistedQueue(queueKey);
48917
- if (!f) return false;
48918
- const t = f.turns.find((x) => x.turnId === runId);
48919
- if (!t) return false;
48920
- t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
48921
- await writePersistedQueue(f);
48922
- sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
48923
- return true;
48924
- }
48925
-
48926
- // src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
48927
48910
  async function handlePromptQueueCancellations(entries, deps) {
48928
48911
  for (const [queueKey] of entries) {
48929
48912
  const file2 = await readPersistedQueue(queueKey);
48930
48913
  const turn = file2?.turns.find((row) => row.bridgeServerState === "cancel_requested" && row.lastCliState === "running");
48931
- if (!turn) {
48914
+ if (!turn || getRunIdQueueKey(turn.turnId) !== queueKey || !isLocallyDispatchedRun(turn.turnId)) {
48932
48915
  await yieldToEventLoop();
48933
48916
  continue;
48934
48917
  }
@@ -48937,19 +48920,7 @@ async function handlePromptQueueCancellations(entries, deps) {
48937
48920
  await yieldToEventLoop();
48938
48921
  continue;
48939
48922
  }
48940
- deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026 with no local run; marking cancelled.`);
48941
- await finalizePromptTurnOnBridge(deps.getWs, turn.turnId, false, { terminalCliState: "cancelled" });
48942
- const ws = deps.getWs();
48943
- if (ws && turn.sessionId) {
48944
- sendWsMessage(ws, {
48945
- type: "prompt_result",
48946
- sessionId: turn.sessionId,
48947
- runId: turn.turnId,
48948
- success: false,
48949
- error: "Stopped by user",
48950
- stopReason: "cancelled"
48951
- });
48952
- }
48923
+ deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026 but no local ACP run remains.`);
48953
48924
  await yieldToEventLoop();
48954
48925
  }
48955
48926
  }
@@ -48977,6 +48948,17 @@ function promptQueueSnapshotEntries(queues) {
48977
48948
  // src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
48978
48949
  init_yield_to_event_loop();
48979
48950
 
48951
+ // src/prompt-turn-queue/client-report.ts
48952
+ function sendPromptQueueClientReport(ws, queues) {
48953
+ if (!ws) return false;
48954
+ const wireQueues = {};
48955
+ for (const [queueKey, rows] of Object.entries(queues)) {
48956
+ wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
48957
+ }
48958
+ sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
48959
+ return true;
48960
+ }
48961
+
48980
48962
  // src/prompt-turn-queue/runner/queue-selection.ts
48981
48963
  function pickNextRunnableTurn(turns) {
48982
48964
  for (const t of turns) {
@@ -48995,31 +48977,66 @@ function hasRunningTurn(turns) {
48995
48977
  }
48996
48978
 
48997
48979
  // src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
48998
- import fs58 from "node:fs";
48980
+ import fs60 from "node:fs";
48999
48981
 
49000
48982
  // src/git/snapshot/capture.ts
49001
- import * as fs57 from "node:fs";
49002
- import * as path78 from "node:path";
48983
+ import * as fs59 from "node:fs";
48984
+ import * as path80 from "node:path";
48985
+
48986
+ // src/git/snapshot/apply-pre-turn-snapshot.ts
48987
+ import * as fs58 from "node:fs";
48988
+ async function applyPreTurnSnapshot(filePath, log2) {
48989
+ let data;
48990
+ try {
48991
+ data = JSON.parse(fs58.readFileSync(filePath, "utf8"));
48992
+ } catch (error40) {
48993
+ return { ok: false, error: error40 instanceof Error ? error40.message : String(error40) };
48994
+ }
48995
+ if (!Array.isArray(data.repos)) return { ok: false, error: "Invalid snapshot file" };
48996
+ let applyError = null;
48997
+ await forEachWithGitYield(data.repos, async (repo) => {
48998
+ if (applyError || !repo.path) return;
48999
+ const reset = await gitRun(repo.path, ["reset", "--hard", "HEAD"], log2, "reset --hard");
49000
+ if (!reset.ok) {
49001
+ applyError = reset;
49002
+ return;
49003
+ }
49004
+ const clean = await gitRun(repo.path, ["clean", "-fd"], log2, "clean -fd");
49005
+ if (!clean.ok) {
49006
+ applyError = clean;
49007
+ return;
49008
+ }
49009
+ if (repo.stashSha) {
49010
+ const applied = await gitRun(repo.path, ["stash", "apply", repo.stashSha], log2, "stash apply");
49011
+ if (!applied.ok) applyError = applied;
49012
+ }
49013
+ });
49014
+ if (applyError) return applyError;
49015
+ log2(`[snapshot] Restored pre-turn state for ${data.runId.slice(0, 8)}\u2026`);
49016
+ return { ok: true };
49017
+ }
49018
+
49019
+ // src/git/snapshot/resolve-repo-roots.ts
49020
+ import * as path79 from "node:path";
49003
49021
  async function resolveSnapshotRepoRoots(options) {
49004
49022
  const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
49005
49023
  if (worktreePaths?.length) {
49006
- const uniq = [...new Set(worktreePaths.map((p) => path78.resolve(p)))];
49007
- return uniq;
49024
+ const paths = [...new Set(worktreePaths.map((p) => path79.resolve(p)))];
49025
+ return (await Promise.all(paths.map(async (p) => await isGitRepoDirectory(p) ? p : null))).filter((p) => p != null);
49008
49026
  }
49009
49027
  try {
49010
- const repos = await discoverGitReposUnderRoot(fallbackCwd);
49011
- const mapped = repos.map((r) => r.absolutePath);
49028
+ const roots = (await discoverGitReposUnderRoot(fallbackCwd)).map((repo) => repo.absolutePath);
49012
49029
  const sid = sessionId?.trim();
49013
- if (sid) {
49014
- const filtered = mapped.filter((root) => path78.basename(root) === sid);
49015
- if (filtered.length > 0) return filtered;
49016
- }
49017
- return mapped;
49018
- } catch (e) {
49019
- log2(`[snapshot] Discover repositories failed: ${e instanceof Error ? e.message : String(e)}`);
49030
+ if (!sid) return roots;
49031
+ const sessionRoots = roots.filter((root) => path79.basename(root) === sid);
49032
+ return sessionRoots.length > 0 ? sessionRoots : roots;
49033
+ } catch (error40) {
49034
+ log2(`[snapshot] Discover repositories failed: ${error40 instanceof Error ? error40.message : String(error40)}`);
49020
49035
  return [];
49021
49036
  }
49022
49037
  }
49038
+
49039
+ // src/git/snapshot/capture.ts
49023
49040
  async function capturePreTurnSnapshot(options) {
49024
49041
  const { runId, repoRoots, agentCwd, log: log2 } = options;
49025
49042
  if (!runId || !repoRoots.length) {
@@ -49033,7 +49050,7 @@ async function capturePreTurnSnapshot(options) {
49033
49050
  });
49034
49051
  const dir = snapshotsDirForCwd(agentCwd);
49035
49052
  try {
49036
- fs57.mkdirSync(dir, { recursive: true });
49053
+ fs59.mkdirSync(dir, { recursive: true });
49037
49054
  } catch (e) {
49038
49055
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
49039
49056
  }
@@ -49042,9 +49059,9 @@ async function capturePreTurnSnapshot(options) {
49042
49059
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
49043
49060
  repos
49044
49061
  };
49045
- const filePath = path78.join(dir, `${runId}.json`);
49062
+ const filePath = path80.join(dir, `${runId}.json`);
49046
49063
  try {
49047
- fs57.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
49064
+ fs59.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
49048
49065
  } catch (e) {
49049
49066
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
49050
49067
  }
@@ -49054,39 +49071,6 @@ async function capturePreTurnSnapshot(options) {
49054
49071
  );
49055
49072
  return { ok: true, filePath, repos };
49056
49073
  }
49057
- async function applyPreTurnSnapshot(filePath, log2) {
49058
- let data;
49059
- try {
49060
- const raw = fs57.readFileSync(filePath, "utf8");
49061
- data = JSON.parse(raw);
49062
- } catch (e) {
49063
- return { ok: false, error: e instanceof Error ? e.message : String(e) };
49064
- }
49065
- if (!Array.isArray(data.repos)) {
49066
- return { ok: false, error: "Invalid snapshot file" };
49067
- }
49068
- let applyError = null;
49069
- await forEachWithGitYield(data.repos, async (r) => {
49070
- if (applyError || !r.path) return;
49071
- const reset = await gitRun(r.path, ["reset", "--hard", "HEAD"], log2, "reset --hard");
49072
- if (!reset.ok) {
49073
- applyError = reset;
49074
- return;
49075
- }
49076
- const clean = await gitRun(r.path, ["clean", "-fd"], log2, "clean -fd");
49077
- if (!clean.ok) {
49078
- applyError = clean;
49079
- return;
49080
- }
49081
- if (r.stashSha) {
49082
- const ap = await gitRun(r.path, ["stash", "apply", r.stashSha], log2, "stash apply");
49083
- if (!ap.ok) applyError = ap;
49084
- }
49085
- });
49086
- if (applyError) return applyError;
49087
- log2(`[snapshot] Restored pre-turn state for ${data.runId.slice(0, 8)}\u2026`);
49088
- return { ok: true };
49089
- }
49090
49074
 
49091
49075
  // src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
49092
49076
  async function runLocalRevertBeforeQueuedPrompt(next, deps) {
@@ -49097,7 +49081,7 @@ async function runLocalRevertBeforeQueuedPrompt(next, deps) {
49097
49081
  const agentBase = deps.sessionWorktreeManager.getSessionWorktreeRootForSession(sid) ?? getBridgeRoot();
49098
49082
  const file2 = snapshotFilePath(agentBase, tid);
49099
49083
  try {
49100
- await fs58.promises.access(file2, fs58.constants.F_OK);
49084
+ await fs60.promises.access(file2, fs60.constants.F_OK);
49101
49085
  } catch {
49102
49086
  deps.log(
49103
49087
  `[Queue] requeued_with_revert: no pre-turn snapshot for ${tid.slice(0, 8)}\u2026; continuing without revert.`
@@ -49148,6 +49132,21 @@ async function applyPromptQueueStateFromServer(msg, deps) {
49148
49132
  await dispatchStartedPromptQueueRuns(entries, started, deps);
49149
49133
  }
49150
49134
 
49135
+ // src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
49136
+ async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
49137
+ if (!runId) return false;
49138
+ const queueKey = deleteRunIdQueueKey(runId);
49139
+ if (!queueKey) return false;
49140
+ const f = await readPersistedQueue(queueKey);
49141
+ if (!f) return false;
49142
+ const t = f.turns.find((x) => x.turnId === runId);
49143
+ if (!t) return false;
49144
+ t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
49145
+ await writePersistedQueue(f);
49146
+ sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
49147
+ return true;
49148
+ }
49149
+
49151
49150
  // src/agents/acp/from-bridge/bridge-prompt-wiring.ts
49152
49151
  function createBridgePromptSenders(deps, getWs) {
49153
49152
  const sendBridgeMessage = (message, encryptedFields = []) => {
@@ -49246,8 +49245,8 @@ async function runBridgePromptPreamble(params) {
49246
49245
  log: log2
49247
49246
  });
49248
49247
  if (s && sessionId) {
49249
- const cliGitBranch = await readGitBranch(effectiveCwd);
49250
49248
  const usesWt = sessionWorktreeManager.usesWorktreeSession(sessionId);
49249
+ const cliGitBranch = repoRoots.length > 0 ? await readGitBranch(effectiveCwd) : null;
49251
49250
  const isolatedSessionParentPath = sessionWorktreeManager.getIsolatedSessionParentPathForSession(sessionId);
49252
49251
  sendWsMessage(s, {
49253
49252
  type: "session_git_context_report",
@@ -49689,7 +49688,7 @@ var handleSessionDiscardedMessage = (msg, deps) => {
49689
49688
  };
49690
49689
 
49691
49690
  // src/routing/handlers/revert-turn-snapshot.ts
49692
- import * as fs59 from "node:fs";
49691
+ import * as fs61 from "node:fs";
49693
49692
  var handleRevertTurnSnapshotMessage = (msg, deps) => {
49694
49693
  const id = typeof msg.id === "string" ? msg.id : "";
49695
49694
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
@@ -49702,7 +49701,7 @@ var handleRevertTurnSnapshotMessage = (msg, deps) => {
49702
49701
  const agentBase = sessionWorktreeManager.getSessionWorktreeRootForSession(sessionId) ?? getBridgeRoot();
49703
49702
  const file2 = snapshotFilePath(agentBase, turnId);
49704
49703
  try {
49705
- await fs59.promises.access(file2, fs59.constants.F_OK);
49704
+ await fs61.promises.access(file2, fs61.constants.F_OK);
49706
49705
  } catch {
49707
49706
  sendWsMessage(s, {
49708
49707
  type: "revert_turn_snapshot_result",
@@ -49800,8 +49799,8 @@ function isValidRemoteSkillInstallItem(item) {
49800
49799
 
49801
49800
  // src/skills/install/install-remote-skills-async.ts
49802
49801
  init_yield_to_event_loop();
49803
- import fs60 from "node:fs";
49804
- import path79 from "node:path";
49802
+ import fs62 from "node:fs";
49803
+ import path81 from "node:path";
49805
49804
 
49806
49805
  // src/skills/install/constants.ts
49807
49806
  var INSTALL_SKILLS_YIELD_EVERY = 16;
@@ -49812,12 +49811,12 @@ async function writeInstallFileAsync(skillDir, f, filesWritten) {
49812
49811
  if (++filesWritten.count % INSTALL_SKILLS_YIELD_EVERY === 0) {
49813
49812
  await yieldToEventLoop();
49814
49813
  }
49815
- const dest = path79.join(skillDir, f.path);
49816
- await fs60.promises.mkdir(path79.dirname(dest), { recursive: true });
49814
+ const dest = path81.join(skillDir, f.path);
49815
+ await fs62.promises.mkdir(path81.dirname(dest), { recursive: true });
49817
49816
  if (f.text !== void 0) {
49818
- await fs60.promises.writeFile(dest, f.text, "utf8");
49817
+ await fs62.promises.writeFile(dest, f.text, "utf8");
49819
49818
  } else if (f.base64) {
49820
- await fs60.promises.writeFile(dest, Buffer.from(f.base64, "base64"));
49819
+ await fs62.promises.writeFile(dest, Buffer.from(f.base64, "base64"));
49821
49820
  }
49822
49821
  }
49823
49822
  async function installRemoteSkillsAsync(cwd, targetDir, items) {
@@ -49829,7 +49828,7 @@ async function installRemoteSkillsAsync(cwd, targetDir, items) {
49829
49828
  try {
49830
49829
  for (const item of items) {
49831
49830
  if (!isValidRemoteSkillInstallItem(item)) continue;
49832
- const skillDir = path79.join(cwd, targetDir, item.skillName);
49831
+ const skillDir = path81.join(cwd, targetDir, item.skillName);
49833
49832
  for (const f of item.files) {
49834
49833
  await writeInstallFileAsync(skillDir, f, filesWritten);
49835
49834
  }
@@ -50136,13 +50135,13 @@ function handleFileBrowserRequest(msg, socket, e2ee, sessionWorktreeManager) {
50136
50135
 
50137
50136
  // src/files/handle-file-browser-search.ts
50138
50137
  init_yield_to_event_loop();
50139
- import path80 from "node:path";
50138
+ import path82 from "node:path";
50140
50139
  var SEARCH_LIMIT = 100;
50141
50140
  function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
50142
50141
  void (async () => {
50143
50142
  await yieldToEventLoop();
50144
50143
  const q = typeof msg.q === "string" ? msg.q : "";
50145
- const sessionParentPath = path80.resolve(
50144
+ const sessionParentPath = path82.resolve(
50146
50145
  sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
50147
50146
  );
50148
50147
  if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
@@ -50240,7 +50239,7 @@ function handleFileBrowserCodeNavMessage(msg, { getWs, e2ee, sessionWorktreeMana
50240
50239
  }
50241
50240
 
50242
50241
  // src/git/bridge-git-context.ts
50243
- import * as path81 from "node:path";
50242
+ import * as path83 from "node:path";
50244
50243
  init_yield_to_event_loop();
50245
50244
 
50246
50245
  // src/git/branches/get-current-branch.ts
@@ -50291,12 +50290,12 @@ async function listRepoBranchRefs(repoPath) {
50291
50290
  // src/git/bridge-git-context.ts
50292
50291
  function folderNameForRelPath(relPath, bridgeRoot) {
50293
50292
  if (relPath === "." || relPath === "") {
50294
- return path81.basename(path81.resolve(bridgeRoot)) || "repo";
50293
+ return path83.basename(path83.resolve(bridgeRoot)) || "repo";
50295
50294
  }
50296
- return path81.basename(relPath) || relPath;
50295
+ return path83.basename(relPath) || relPath;
50297
50296
  }
50298
50297
  async function discoverGitReposForBridgeContext(bridgeRoot) {
50299
- const root = path81.resolve(bridgeRoot);
50298
+ const root = path83.resolve(bridgeRoot);
50300
50299
  if (await isGitRepoDirectory(root)) {
50301
50300
  const remoteUrl = await getRemoteOriginUrl(root);
50302
50301
  return [{ absolutePath: root, remoteUrl }];
@@ -50304,19 +50303,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
50304
50303
  const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
50305
50304
  const byPath = /* @__PURE__ */ new Map();
50306
50305
  for (const repo of [...deep, ...shallow]) {
50307
- byPath.set(path81.resolve(repo.absolutePath), repo);
50306
+ byPath.set(path83.resolve(repo.absolutePath), repo);
50308
50307
  }
50309
50308
  return [...byPath.values()];
50310
50309
  }
50311
50310
  async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
50312
- const bridgeResolved = path81.resolve(bridgeRoot);
50311
+ const bridgeResolved = path83.resolve(bridgeRoot);
50313
50312
  const repos = await discoverGitReposForBridgeContext(bridgeResolved);
50314
50313
  const rows = [];
50315
50314
  for (let i = 0; i < repos.length; i++) {
50316
50315
  if (i > 0) await yieldToEventLoop();
50317
50316
  const repo = repos[i];
50318
- let rel = path81.relative(bridgeResolved, repo.absolutePath);
50319
- if (rel.startsWith("..") || path81.isAbsolute(rel)) continue;
50317
+ let rel = path83.relative(bridgeResolved, repo.absolutePath);
50318
+ if (rel.startsWith("..") || path83.isAbsolute(rel)) continue;
50320
50319
  const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
50321
50320
  const currentBranch = await getCurrentBranch(repo.absolutePath);
50322
50321
  const remoteUrl = repo.remoteUrl.trim() || null;
@@ -50331,11 +50330,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
50331
50330
  return rows;
50332
50331
  }
50333
50332
  async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
50334
- const bridgeResolved = path81.resolve(bridgeRoot);
50333
+ const bridgeResolved = path83.resolve(bridgeRoot);
50335
50334
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
50336
- const repoPath = rel === "" ? bridgeResolved : path81.join(bridgeResolved, rel);
50337
- const resolved = path81.resolve(repoPath);
50338
- if (!resolved.startsWith(bridgeResolved + path81.sep) && resolved !== bridgeResolved) {
50335
+ const repoPath = rel === "" ? bridgeResolved : path83.join(bridgeResolved, rel);
50336
+ const resolved = path83.resolve(repoPath);
50337
+ if (!resolved.startsWith(bridgeResolved + path83.sep) && resolved !== bridgeResolved) {
50339
50338
  return [];
50340
50339
  }
50341
50340
  return listRepoBranchRefs(resolved);