@buildautomaton/cli 0.1.80 → 0.1.81

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: path84, errorMaps, issueData } = params;
4212
- const fullPath = [...path84, ...issueData.path || []];
4211
+ const { data, path: path86, errorMaps, issueData } = params;
4212
+ const fullPath = [...path86, ...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, path84, key) {
4520
+ constructor(parent, value, path86, key) {
4521
4521
  this._cachedPath = [];
4522
4522
  this.parent = parent;
4523
4523
  this.data = value;
4524
- this._path = path84;
4524
+ this._path = path86;
4525
4525
  this._key = key;
4526
4526
  }
4527
4527
  get path() {
@@ -8182,10 +8182,10 @@ function assignProp(target, prop, value) {
8182
8182
  configurable: true
8183
8183
  });
8184
8184
  }
8185
- function getElementAtPath(obj, path84) {
8186
- if (!path84)
8185
+ function getElementAtPath(obj, path86) {
8186
+ if (!path86)
8187
8187
  return obj;
8188
- return path84.reduce((acc, key) => acc?.[key], obj);
8188
+ return path86.reduce((acc, key) => acc?.[key], obj);
8189
8189
  }
8190
8190
  function promiseAllObject(promisesObj) {
8191
8191
  const keys = Object.keys(promisesObj);
@@ -8434,11 +8434,11 @@ function aborted(x, startIndex = 0) {
8434
8434
  }
8435
8435
  return false;
8436
8436
  }
8437
- function prefixIssues(path84, issues) {
8437
+ function prefixIssues(path86, issues) {
8438
8438
  return issues.map((iss) => {
8439
8439
  var _a2;
8440
8440
  (_a2 = iss).path ?? (_a2.path = []);
8441
- iss.path.unshift(path84);
8441
+ iss.path.unshift(path86);
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, path84 = []) => {
8630
+ const processError = (error41, path86 = []) => {
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 = [...path84, ...issue2.path];
8640
+ const fullpath = [...path86, ...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(path84) {
8670
+ function toDotPath(path86) {
8671
8671
  const segs = [];
8672
- for (const seg of path84) {
8672
+ for (const seg of path86) {
8673
8673
  if (typeof seg === "number")
8674
8674
  segs.push(`[${seg}]`);
8675
8675
  else if (typeof seg === "symbol")
@@ -21132,8 +21132,8 @@ var init_acp = __esm({
21132
21132
  this.#requestHandler = requestHandler;
21133
21133
  this.#notificationHandler = notificationHandler;
21134
21134
  this.#stream = stream;
21135
- this.#closedPromise = new Promise((resolve35) => {
21136
- this.#abortController.signal.addEventListener("abort", () => resolve35());
21135
+ this.#closedPromise = new Promise((resolve36) => {
21136
+ this.#abortController.signal.addEventListener("abort", () => resolve36());
21137
21137
  });
21138
21138
  this.#receive();
21139
21139
  }
@@ -21282,8 +21282,8 @@ var init_acp = __esm({
21282
21282
  }
21283
21283
  async sendRequest(method, params) {
21284
21284
  const id = this.#nextRequestId++;
21285
- const responsePromise = new Promise((resolve35, reject) => {
21286
- this.#pendingResponses.set(id, { resolve: resolve35, reject });
21285
+ const responsePromise = new Promise((resolve36, reject) => {
21286
+ this.#pendingResponses.set(id, { resolve: resolve36, reject });
21287
21287
  });
21288
21288
  await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
21289
21289
  return responsePromise;
@@ -21651,7 +21651,7 @@ var init_activity_tracker = __esm({
21651
21651
 
21652
21652
  // src/runtime/yield-to-event-loop.ts
21653
21653
  function yieldToEventLoop() {
21654
- return new Promise((resolve35) => setImmediate(resolve35));
21654
+ return new Promise((resolve36) => setImmediate(resolve36));
21655
21655
  }
21656
21656
  var init_yield_to_event_loop = __esm({
21657
21657
  "src/runtime/yield-to-event-loop.ts"() {
@@ -21692,7 +21692,7 @@ async function yieldUntilFileBrowserReadsIdle(pollMs = 5) {
21692
21692
  while (getFileBrowserInFlightReadCount() > 0) {
21693
21693
  await yieldToEventLoop();
21694
21694
  if (getFileBrowserInFlightReadCount() > 0) {
21695
- await new Promise((resolve35) => setTimeout(resolve35, pollMs));
21695
+ await new Promise((resolve36) => setTimeout(resolve36, pollMs));
21696
21696
  }
21697
21697
  }
21698
21698
  }
@@ -21702,7 +21702,7 @@ async function yieldUntilFileBrowserBrowseIdle(pollMs = 5) {
21702
21702
  const browseCooldownDone = lastActivityAt === 0 || Date.now() - lastActivityAt >= BROWSE_INDEX_COOLDOWN_MS;
21703
21703
  if (inFlightRequests2 === 0 && browseCooldownDone) return;
21704
21704
  await yieldToEventLoop();
21705
- await new Promise((resolve35) => setTimeout(resolve35, pollMs));
21705
+ await new Promise((resolve36) => setTimeout(resolve36, pollMs));
21706
21706
  }
21707
21707
  }
21708
21708
  async function yieldUntilFileBrowserIdle(pollMs = 5) {
@@ -21879,8 +21879,8 @@ function createRequestId(prefix) {
21879
21879
  }
21880
21880
  function waitForWorkerReady() {
21881
21881
  if (workerReady) return Promise.resolve();
21882
- return new Promise((resolve35) => {
21883
- workerReadyWaiters.push(resolve35);
21882
+ return new Promise((resolve36) => {
21883
+ workerReadyWaiters.push(resolve36);
21884
21884
  });
21885
21885
  }
21886
21886
  function registerWorkerReadyListener(listener) {
@@ -21892,7 +21892,7 @@ function registerWorkerReadyListener(listener) {
21892
21892
  }
21893
21893
  function markWorkerReady() {
21894
21894
  workerReady = true;
21895
- for (const resolve35 of workerReadyWaiters) resolve35();
21895
+ for (const resolve36 of workerReadyWaiters) resolve36();
21896
21896
  workerReadyWaiters = [];
21897
21897
  workerReadyListener?.();
21898
21898
  }
@@ -22039,7 +22039,7 @@ async function waitForOuterCodeNavCacheAccessAsync() {
22039
22039
  if (isCliImmediateShutdownRequested() || isSymbolIndexWorkerShutdownRequested()) {
22040
22040
  throw new CliSqliteInterrupted();
22041
22041
  }
22042
- await new Promise((resolve35) => setTimeout(resolve35, 5));
22042
+ await new Promise((resolve36) => setTimeout(resolve36, 5));
22043
22043
  await yieldToEventLoop();
22044
22044
  }
22045
22045
  }
@@ -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((path84) => existsSync(path84));
22379
+ const resolved = candidates.find((path86) => existsSync(path86));
22380
22380
  if (!resolved) {
22381
22381
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
22382
22382
  }
@@ -23454,7 +23454,7 @@ var require_ignore = __commonJS({
23454
23454
  // path matching.
23455
23455
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
23456
23456
  // @returns {TestResult} true if a file is ignored
23457
- test(path84, checkUnignored, mode) {
23457
+ test(path86, checkUnignored, mode) {
23458
23458
  let ignored = false;
23459
23459
  let unignored = false;
23460
23460
  let matchedRule;
@@ -23463,7 +23463,7 @@ var require_ignore = __commonJS({
23463
23463
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
23464
23464
  return;
23465
23465
  }
23466
- const matched = rule[mode].test(path84);
23466
+ const matched = rule[mode].test(path86);
23467
23467
  if (!matched) {
23468
23468
  return;
23469
23469
  }
@@ -23484,17 +23484,17 @@ var require_ignore = __commonJS({
23484
23484
  var throwError = (message, Ctor) => {
23485
23485
  throw new Ctor(message);
23486
23486
  };
23487
- var checkPath = (path84, originalPath, doThrow) => {
23488
- if (!isString(path84)) {
23487
+ var checkPath = (path86, originalPath, doThrow) => {
23488
+ if (!isString(path86)) {
23489
23489
  return doThrow(
23490
23490
  `path must be a string, but got \`${originalPath}\``,
23491
23491
  TypeError
23492
23492
  );
23493
23493
  }
23494
- if (!path84) {
23494
+ if (!path86) {
23495
23495
  return doThrow(`path must not be empty`, TypeError);
23496
23496
  }
23497
- if (checkPath.isNotRelative(path84)) {
23497
+ if (checkPath.isNotRelative(path86)) {
23498
23498
  const r = "`path.relative()`d";
23499
23499
  return doThrow(
23500
23500
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -23503,7 +23503,7 @@ var require_ignore = __commonJS({
23503
23503
  }
23504
23504
  return true;
23505
23505
  };
23506
- var isNotRelative = (path84) => REGEX_TEST_INVALID_PATH.test(path84);
23506
+ var isNotRelative = (path86) => REGEX_TEST_INVALID_PATH.test(path86);
23507
23507
  checkPath.isNotRelative = isNotRelative;
23508
23508
  checkPath.convert = (p) => p;
23509
23509
  var Ignore = class {
@@ -23533,19 +23533,19 @@ var require_ignore = __commonJS({
23533
23533
  }
23534
23534
  // @returns {TestResult}
23535
23535
  _test(originalPath, cache2, checkUnignored, slices) {
23536
- const path84 = originalPath && checkPath.convert(originalPath);
23536
+ const path86 = originalPath && checkPath.convert(originalPath);
23537
23537
  checkPath(
23538
- path84,
23538
+ path86,
23539
23539
  originalPath,
23540
23540
  this._strictPathCheck ? throwError : RETURN_FALSE
23541
23541
  );
23542
- return this._t(path84, cache2, checkUnignored, slices);
23542
+ return this._t(path86, cache2, checkUnignored, slices);
23543
23543
  }
23544
- checkIgnore(path84) {
23545
- if (!REGEX_TEST_TRAILING_SLASH.test(path84)) {
23546
- return this.test(path84);
23544
+ checkIgnore(path86) {
23545
+ if (!REGEX_TEST_TRAILING_SLASH.test(path86)) {
23546
+ return this.test(path86);
23547
23547
  }
23548
- const slices = path84.split(SLASH).filter(Boolean);
23548
+ const slices = path86.split(SLASH).filter(Boolean);
23549
23549
  slices.pop();
23550
23550
  if (slices.length) {
23551
23551
  const parent = this._t(
@@ -23558,18 +23558,18 @@ var require_ignore = __commonJS({
23558
23558
  return parent;
23559
23559
  }
23560
23560
  }
23561
- return this._rules.test(path84, false, MODE_CHECK_IGNORE);
23561
+ return this._rules.test(path86, false, MODE_CHECK_IGNORE);
23562
23562
  }
23563
- _t(path84, cache2, checkUnignored, slices) {
23564
- if (path84 in cache2) {
23565
- return cache2[path84];
23563
+ _t(path86, cache2, checkUnignored, slices) {
23564
+ if (path86 in cache2) {
23565
+ return cache2[path86];
23566
23566
  }
23567
23567
  if (!slices) {
23568
- slices = path84.split(SLASH).filter(Boolean);
23568
+ slices = path86.split(SLASH).filter(Boolean);
23569
23569
  }
23570
23570
  slices.pop();
23571
23571
  if (!slices.length) {
23572
- return cache2[path84] = this._rules.test(path84, checkUnignored, MODE_IGNORE);
23572
+ return cache2[path86] = this._rules.test(path86, checkUnignored, MODE_IGNORE);
23573
23573
  }
23574
23574
  const parent = this._t(
23575
23575
  slices.join(SLASH) + SLASH,
@@ -23577,29 +23577,29 @@ var require_ignore = __commonJS({
23577
23577
  checkUnignored,
23578
23578
  slices
23579
23579
  );
23580
- return cache2[path84] = parent.ignored ? parent : this._rules.test(path84, checkUnignored, MODE_IGNORE);
23580
+ return cache2[path86] = parent.ignored ? parent : this._rules.test(path86, checkUnignored, MODE_IGNORE);
23581
23581
  }
23582
- ignores(path84) {
23583
- return this._test(path84, this._ignoreCache, false).ignored;
23582
+ ignores(path86) {
23583
+ return this._test(path86, this._ignoreCache, false).ignored;
23584
23584
  }
23585
23585
  createFilter() {
23586
- return (path84) => !this.ignores(path84);
23586
+ return (path86) => !this.ignores(path86);
23587
23587
  }
23588
23588
  filter(paths) {
23589
23589
  return makeArray(paths).filter(this.createFilter());
23590
23590
  }
23591
23591
  // @returns {TestResult}
23592
- test(path84) {
23593
- return this._test(path84, this._testCache, true);
23592
+ test(path86) {
23593
+ return this._test(path86, this._testCache, true);
23594
23594
  }
23595
23595
  };
23596
23596
  var factory = (options) => new Ignore(options);
23597
- var isPathValid = (path84) => checkPath(path84 && checkPath.convert(path84), path84, RETURN_FALSE);
23597
+ var isPathValid = (path86) => checkPath(path86 && checkPath.convert(path86), path86, RETURN_FALSE);
23598
23598
  var setupWindows = () => {
23599
23599
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
23600
23600
  checkPath.convert = makePosix;
23601
23601
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
23602
- checkPath.isNotRelative = (path84) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path84) || isNotRelative(path84);
23602
+ checkPath.isNotRelative = (path86) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path86) || isNotRelative(path86);
23603
23603
  };
23604
23604
  if (
23605
23605
  // Detect `process` so that it can run in browsers.
@@ -26790,7 +26790,7 @@ var init_setup_handlers = __esm({
26790
26790
  // src/code-nav/symbol-index/worker/handle-message.ts
26791
26791
  async function waitForActiveWorkerHandlersIdle(pollMs = 10) {
26792
26792
  while (activeWorkerHandlers > 0) {
26793
- await new Promise((resolve35) => setTimeout(resolve35, pollMs));
26793
+ await new Promise((resolve36) => setTimeout(resolve36, pollMs));
26794
26794
  }
26795
26795
  }
26796
26796
  async function handleRequestMessage(port, msg) {
@@ -27033,9 +27033,9 @@ async function requestWorker(message) {
27033
27033
  }
27034
27034
  ensureWorkerStarted();
27035
27035
  await ensureWorkerReadyForRequests();
27036
- return new Promise((resolve35, reject) => {
27036
+ return new Promise((resolve36, reject) => {
27037
27037
  pendingRequests.set(message.requestId, {
27038
- resolve: (value) => resolve35(value),
27038
+ resolve: (value) => resolve36(value),
27039
27039
  reject
27040
27040
  });
27041
27041
  postToWorker(message);
@@ -27061,37 +27061,37 @@ async function shutdownWorkerThread() {
27061
27061
  if (activeWorker != null) {
27062
27062
  setWorker(null);
27063
27063
  await Promise.race([
27064
- new Promise((resolve35) => {
27064
+ new Promise((resolve36) => {
27065
27065
  const onMessage = (message) => {
27066
27066
  if (message.type !== "shutdownComplete") return;
27067
27067
  activeWorker.off("message", onMessage);
27068
- resolve35();
27068
+ resolve36();
27069
27069
  };
27070
27070
  activeWorker.on("message", onMessage);
27071
27071
  try {
27072
27072
  activeWorker.postMessage({ type: "shutdown" });
27073
27073
  } catch {
27074
27074
  activeWorker.off("message", onMessage);
27075
- resolve35();
27075
+ resolve36();
27076
27076
  }
27077
27077
  }),
27078
- new Promise((resolve35) => setTimeout(resolve35, WORKER_SHUTDOWN_GRACE_MS))
27078
+ new Promise((resolve36) => setTimeout(resolve36, WORKER_SHUTDOWN_GRACE_MS))
27079
27079
  ]);
27080
27080
  await activeWorker.terminate();
27081
27081
  } else {
27082
27082
  const inProcess = getInProcessBridge();
27083
27083
  if (inProcess != null) {
27084
27084
  await Promise.race([
27085
- new Promise((resolve35) => {
27085
+ new Promise((resolve36) => {
27086
27086
  const onMessage = (message) => {
27087
27087
  if (message.type !== "shutdownComplete") return;
27088
27088
  inProcess.off("message", onMessage);
27089
- resolve35();
27089
+ resolve36();
27090
27090
  };
27091
27091
  inProcess.on("message", onMessage);
27092
27092
  inProcess.postMessage({ type: "shutdown" });
27093
27093
  }),
27094
- new Promise((resolve35) => setTimeout(resolve35, WORKER_SHUTDOWN_GRACE_MS))
27094
+ new Promise((resolve36) => setTimeout(resolve36, WORKER_SHUTDOWN_GRACE_MS))
27095
27095
  ]);
27096
27096
  }
27097
27097
  }
@@ -27977,10 +27977,10 @@ var require_src2 = __commonJS({
27977
27977
  var fs_1 = __require("fs");
27978
27978
  var debug_1 = __importDefault(require_src());
27979
27979
  var log2 = debug_1.default("@kwsites/file-exists");
27980
- function check2(path84, isFile, isDirectory) {
27981
- log2(`checking %s`, path84);
27980
+ function check2(path86, isFile, isDirectory) {
27981
+ log2(`checking %s`, path86);
27982
27982
  try {
27983
- const stat2 = fs_1.statSync(path84);
27983
+ const stat2 = fs_1.statSync(path86);
27984
27984
  if (stat2.isFile() && isFile) {
27985
27985
  log2(`[OK] path represents a file`);
27986
27986
  return true;
@@ -28000,8 +28000,8 @@ var require_src2 = __commonJS({
28000
28000
  throw e;
28001
28001
  }
28002
28002
  }
28003
- function exists2(path84, type = exports.READABLE) {
28004
- return check2(path84, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
28003
+ function exists2(path86, type = exports.READABLE) {
28004
+ return check2(path86, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
28005
28005
  }
28006
28006
  exports.exists = exists2;
28007
28007
  exports.FILE = 1;
@@ -28340,10 +28340,10 @@ async function killChildProcessTreeGracefully(child, graceMs = ACP_PROCESS_TREE_
28340
28340
  }
28341
28341
  await killProcessTree(pid, "SIGTERM");
28342
28342
  if (graceMs <= 0) return;
28343
- const exited = new Promise((resolve35) => {
28344
- child.once("exit", () => resolve35());
28343
+ const exited = new Promise((resolve36) => {
28344
+ child.once("exit", () => resolve36());
28345
28345
  });
28346
- await Promise.race([exited, new Promise((resolve35) => setTimeout(resolve35, graceMs))]);
28346
+ await Promise.race([exited, new Promise((resolve36) => setTimeout(resolve36, graceMs))]);
28347
28347
  if (child.exitCode == null && child.signalCode == null) {
28348
28348
  await killProcessTree(pid, "SIGKILL");
28349
28349
  }
@@ -28360,8 +28360,8 @@ async function gracefulAcpSubprocessDisconnect(params) {
28360
28360
  await transport.closeSession?.(sessionId);
28361
28361
  } catch {
28362
28362
  }
28363
- await new Promise((resolve35) => {
28364
- const timer = setTimeout(resolve35, ACP_GRACEFUL_SESSION_CLOSE_WAIT_MS);
28363
+ await new Promise((resolve36) => {
28364
+ const timer = setTimeout(resolve36, ACP_GRACEFUL_SESSION_CLOSE_WAIT_MS);
28365
28365
  timer.unref?.();
28366
28366
  });
28367
28367
  }
@@ -29511,11 +29511,11 @@ function createSdkStdioExtNotificationHandler(options) {
29511
29511
  // src/agents/acp/clients/sdk/sdk-stdio-permission-request-handshake.ts
29512
29512
  function awaitSdkStdioPermissionRequestHandshake(params) {
29513
29513
  const { requestId, paramsRecord, pending: pending2, onRequest } = params;
29514
- return new Promise((resolve35) => {
29515
- pending2.set(requestId, { resolve: resolve35, params: paramsRecord });
29514
+ return new Promise((resolve36) => {
29515
+ pending2.set(requestId, { resolve: resolve36, params: paramsRecord });
29516
29516
  if (onRequest == null) {
29517
29517
  pending2.delete(requestId);
29518
- resolve35({ outcome: { outcome: "denied" } });
29518
+ resolve36({ outcome: { outcome: "denied" } });
29519
29519
  return;
29520
29520
  }
29521
29521
  try {
@@ -30027,10 +30027,10 @@ function createSdkStdioInitSettle(child) {
30027
30027
  forceAcpSubprocessDisconnect(child);
30028
30028
  reject(err);
30029
30029
  },
30030
- settleResolve(resolve35, handle) {
30030
+ settleResolve(resolve36, handle) {
30031
30031
  if (initSettled) return;
30032
30032
  initSettled = true;
30033
- resolve35(handle);
30033
+ resolve36(handle);
30034
30034
  }
30035
30035
  };
30036
30036
  }
@@ -30119,7 +30119,7 @@ async function createSdkStdioAcpClient(options) {
30119
30119
  onFileChange,
30120
30120
  stderrCapture
30121
30121
  });
30122
- return new Promise((resolve35, reject) => {
30122
+ return new Promise((resolve36, reject) => {
30123
30123
  const init = createSdkStdioInitSettle(child);
30124
30124
  child.on("error", (err) => {
30125
30125
  init.settleReject(reject, new Error(formatSpawnError(err, command[0])));
@@ -30144,7 +30144,7 @@ async function createSdkStdioAcpClient(options) {
30144
30144
  protocolVersion: PROTOCOL_VERSION2
30145
30145
  });
30146
30146
  init.settleResolve(
30147
- resolve35,
30147
+ resolve36,
30148
30148
  createSdkStdioHandle({
30149
30149
  child,
30150
30150
  sessionId: established.sessionId,
@@ -30280,19 +30280,19 @@ function buildLocalHttpRequestOptions(built) {
30280
30280
  }
30281
30281
  function runLocalHttpRequestOnce(mod, built) {
30282
30282
  const opts = buildLocalHttpRequestOptions(built);
30283
- return new Promise((resolve35) => {
30283
+ return new Promise((resolve36) => {
30284
30284
  const req = mod.request(opts, (res) => {
30285
30285
  const chunks = [];
30286
30286
  res.on("data", (chunk) => chunks.push(chunk));
30287
30287
  res.on("end", () => {
30288
- resolve35({
30288
+ resolve36({
30289
30289
  statusCode: res.statusCode ?? 0,
30290
30290
  headers: incomingMessageHeaders(res),
30291
30291
  body: Buffer.concat(chunks)
30292
30292
  });
30293
30293
  });
30294
30294
  res.on("error", (err) => {
30295
- resolve35({
30295
+ resolve36({
30296
30296
  statusCode: 0,
30297
30297
  headers: {},
30298
30298
  body: Buffer.alloc(0),
@@ -30304,7 +30304,7 @@ function runLocalHttpRequestOnce(mod, built) {
30304
30304
  req.destroy(new Error(`Local preview request timed out after ${LOCAL_PROXY_REQUEST_TIMEOUT_MS}ms`));
30305
30305
  });
30306
30306
  req.on("error", (err) => {
30307
- resolve35({
30307
+ resolve36({
30308
30308
  statusCode: 0,
30309
30309
  headers: {},
30310
30310
  body: Buffer.alloc(0),
@@ -30360,14 +30360,14 @@ async function proxyToLocalStreaming(request, callbacks) {
30360
30360
  const isHttps = request.url.startsWith("https:");
30361
30361
  const mod = await loadHttpModule(isHttps);
30362
30362
  const opts = buildLocalHttpRequestOptions(built);
30363
- await new Promise((resolve35) => {
30363
+ await new Promise((resolve36) => {
30364
30364
  const req = mod.request(opts, (res) => {
30365
30365
  try {
30366
30366
  callbacks.onStart(res.statusCode ?? 0, incomingMessageHeaders(res));
30367
30367
  } catch (err) {
30368
30368
  req.destroy();
30369
30369
  callbacks.onError(err instanceof Error ? err.message : String(err));
30370
- resolve35();
30370
+ resolve36();
30371
30371
  return;
30372
30372
  }
30373
30373
  res.on("data", (chunk) => {
@@ -30380,11 +30380,11 @@ async function proxyToLocalStreaming(request, callbacks) {
30380
30380
  });
30381
30381
  res.on("end", () => {
30382
30382
  callbacks.onEnd();
30383
- resolve35();
30383
+ resolve36();
30384
30384
  });
30385
30385
  res.on("error", (err) => {
30386
30386
  callbacks.onError(err.message);
30387
- resolve35();
30387
+ resolve36();
30388
30388
  });
30389
30389
  });
30390
30390
  req.setTimeout(LOCAL_PROXY_REQUEST_TIMEOUT_MS, () => {
@@ -30392,7 +30392,7 @@ async function proxyToLocalStreaming(request, callbacks) {
30392
30392
  });
30393
30393
  req.on("error", (err) => {
30394
30394
  callbacks.onError(err.message);
30395
- resolve35();
30395
+ resolve36();
30396
30396
  });
30397
30397
  if (built.sendingBody && built.body != null) {
30398
30398
  req.write(built.body);
@@ -30422,8 +30422,8 @@ function randomSecret() {
30422
30422
  }
30423
30423
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
30424
30424
  }
30425
- async function requestPreviewApi(port, secret, method, path84, body) {
30426
- const url2 = `http://127.0.0.1:${port}${path84}`;
30425
+ async function requestPreviewApi(port, secret, method, path86, body) {
30426
+ const url2 = `http://127.0.0.1:${port}${path86}`;
30427
30427
  const headers = {
30428
30428
  [PREVIEW_SECRET_HEADER]: secret,
30429
30429
  "Content-Type": "application/json"
@@ -30435,7 +30435,7 @@ async function requestPreviewApi(port, secret, method, path84, body) {
30435
30435
  });
30436
30436
  const data = await res.json().catch(() => ({}));
30437
30437
  if (!res.ok) {
30438
- throw new Error(data?.error ?? `Preview API ${method} ${path84}: ${res.status}`);
30438
+ throw new Error(data?.error ?? `Preview API ${method} ${path86}: ${res.status}`);
30439
30439
  }
30440
30440
  return data;
30441
30441
  }
@@ -31093,14 +31093,14 @@ var baseOpen = async (options) => {
31093
31093
  }
31094
31094
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
31095
31095
  if (options.wait) {
31096
- return new Promise((resolve35, reject) => {
31096
+ return new Promise((resolve36, reject) => {
31097
31097
  subprocess.once("error", reject);
31098
31098
  subprocess.once("close", (exitCode) => {
31099
31099
  if (!options.allowNonzeroExitCode && exitCode > 0) {
31100
31100
  reject(new Error(`Exited with code ${exitCode}`));
31101
31101
  return;
31102
31102
  }
31103
- resolve35(subprocess);
31103
+ resolve36(subprocess);
31104
31104
  });
31105
31105
  });
31106
31106
  }
@@ -31682,8 +31682,8 @@ function createPendingAuthOnClose(params) {
31682
31682
  // src/auth/pending/pending-auth-session.ts
31683
31683
  function createPendingAuthSession() {
31684
31684
  let resolveAuth;
31685
- const authPromise = new Promise((resolve35) => {
31686
- resolveAuth = resolve35;
31685
+ const authPromise = new Promise((resolve36) => {
31686
+ resolveAuth = resolve36;
31687
31687
  });
31688
31688
  return {
31689
31689
  ws: null,
@@ -31737,7 +31737,7 @@ function createPendingAuthOnMessage(params) {
31737
31737
  }
31738
31738
 
31739
31739
  // src/cli-version.ts
31740
- var CLI_VERSION = "0.1.80".length > 0 ? "0.1.80" : "0.0.0-dev";
31740
+ var CLI_VERSION = "0.1.81".length > 0 ? "0.1.81" : "0.0.0-dev";
31741
31741
 
31742
31742
  // src/auth/pending/pending-auth-on-open.ts
31743
31743
  function createPendingAuthOnOpen(params) {
@@ -33775,7 +33775,7 @@ async function createCursorAcpClient(options) {
33775
33775
  onFileChange,
33776
33776
  stderrCapture
33777
33777
  });
33778
- return new Promise((resolve35, reject) => {
33778
+ return new Promise((resolve36, reject) => {
33779
33779
  child.on("error", (err) => {
33780
33780
  killChildProcessTree(child, "SIGKILL");
33781
33781
  reject(new Error(formatSpawnError(err, command[0])));
@@ -33788,7 +33788,7 @@ async function createCursorAcpClient(options) {
33788
33788
  skipBrowserAuthenticate,
33789
33789
  incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
33790
33790
  });
33791
- resolve35(
33791
+ resolve36(
33792
33792
  createCursorAcpHandle({
33793
33793
  child,
33794
33794
  sessionId: established.sessionId,
@@ -35227,8 +35227,8 @@ async function runGitTask(fn) {
35227
35227
  }
35228
35228
  async function yieldToEventLoop2() {
35229
35229
  throwIfGitShutdownRequested();
35230
- await new Promise((resolve35) => {
35231
- setImmediate(resolve35);
35230
+ await new Promise((resolve36) => {
35231
+ setImmediate(resolve36);
35232
35232
  });
35233
35233
  throwIfGitShutdownRequested();
35234
35234
  }
@@ -35265,8 +35265,8 @@ async function execGitFile(args, options) {
35265
35265
  }
35266
35266
 
35267
35267
  // src/git/changes/parse/normalize-git-diff-path.ts
35268
- function normalizeGitDiffPath(path84) {
35269
- return path84.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35268
+ function normalizeGitDiffPath(path86) {
35269
+ return path86.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
35270
35270
  }
35271
35271
 
35272
35272
  // src/git/changes/parse/parse-name-status-entries.ts
@@ -36755,11 +36755,11 @@ function isServerNotRunningError(err) {
36755
36755
  }
36756
36756
  function closeHttpServer(server) {
36757
36757
  if (!server) return Promise.resolve();
36758
- return new Promise((resolve35) => {
36758
+ return new Promise((resolve36) => {
36759
36759
  server.close((err) => {
36760
36760
  if (err && !isServerNotRunningError(err)) {
36761
36761
  }
36762
- resolve35();
36762
+ resolve36();
36763
36763
  });
36764
36764
  });
36765
36765
  }
@@ -36772,7 +36772,7 @@ var RequestBodyTooLargeError = class extends Error {
36772
36772
  }
36773
36773
  };
36774
36774
  function readJsonBody(req) {
36775
- return new Promise((resolve35, reject) => {
36775
+ return new Promise((resolve36, reject) => {
36776
36776
  const chunks = [];
36777
36777
  let total = 0;
36778
36778
  let tooLarge = false;
@@ -36792,11 +36792,11 @@ function readJsonBody(req) {
36792
36792
  try {
36793
36793
  const raw = Buffer.concat(chunks).toString("utf8").trim();
36794
36794
  if (!raw) {
36795
- resolve35({});
36795
+ resolve36({});
36796
36796
  return;
36797
36797
  }
36798
36798
  const parsed = JSON.parse(raw);
36799
- resolve35(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {});
36799
+ resolve36(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {});
36800
36800
  } catch (e) {
36801
36801
  reject(e);
36802
36802
  }
@@ -36854,7 +36854,7 @@ function createBridgeAccessRequestHandler(registry2) {
36854
36854
  // src/mcp/bridge-access/start-server.ts
36855
36855
  function startBridgeAccessServer(registry2) {
36856
36856
  const server = http.createServer(createBridgeAccessRequestHandler(registry2));
36857
- return new Promise((resolve35, reject) => {
36857
+ return new Promise((resolve36, reject) => {
36858
36858
  server.once("error", reject);
36859
36859
  server.listen(0, "127.0.0.1", () => {
36860
36860
  const addr = server.address();
@@ -36862,7 +36862,7 @@ function startBridgeAccessServer(registry2) {
36862
36862
  reject(new Error("Bridge access server did not bind"));
36863
36863
  return;
36864
36864
  }
36865
- resolve35({
36865
+ resolve36({
36866
36866
  port: addr.port,
36867
36867
  close: () => closeHttpServer(server)
36868
36868
  });
@@ -39469,8 +39469,8 @@ function pathspec(...paths) {
39469
39469
  cache.set(key, paths);
39470
39470
  return key;
39471
39471
  }
39472
- function isPathSpec(path84) {
39473
- return path84 instanceof String && cache.has(path84);
39472
+ function isPathSpec(path86) {
39473
+ return path86 instanceof String && cache.has(path86);
39474
39474
  }
39475
39475
  function toPaths(pathSpec) {
39476
39476
  return cache.get(pathSpec) || [];
@@ -39559,8 +39559,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
39559
39559
  function forEachLineWithContent(input, callback) {
39560
39560
  return toLinesWithContent(input, true).map((line) => callback(line));
39561
39561
  }
39562
- function folderExists(path84) {
39563
- return (0, import_file_exists.exists)(path84, import_file_exists.FOLDER);
39562
+ function folderExists(path86) {
39563
+ return (0, import_file_exists.exists)(path86, import_file_exists.FOLDER);
39564
39564
  }
39565
39565
  function append(target, item) {
39566
39566
  if (Array.isArray(target)) {
@@ -39964,8 +39964,8 @@ function checkIsRepoRootTask() {
39964
39964
  commands,
39965
39965
  format: "utf-8",
39966
39966
  onError,
39967
- parser(path84) {
39968
- return /^\.(git)?$/.test(path84.trim());
39967
+ parser(path86) {
39968
+ return /^\.(git)?$/.test(path86.trim());
39969
39969
  }
39970
39970
  };
39971
39971
  }
@@ -40399,11 +40399,11 @@ function parseGrep(grep) {
40399
40399
  const paths = /* @__PURE__ */ new Set();
40400
40400
  const results = {};
40401
40401
  forEachLineWithContent(grep, (input) => {
40402
- const [path84, line, preview] = input.split(NULL);
40403
- paths.add(path84);
40404
- (results[path84] = results[path84] || []).push({
40402
+ const [path86, line, preview] = input.split(NULL);
40403
+ paths.add(path86);
40404
+ (results[path86] = results[path86] || []).push({
40405
40405
  line: asNumber(line),
40406
- path: path84,
40406
+ path: path86,
40407
40407
  preview
40408
40408
  });
40409
40409
  });
@@ -41168,14 +41168,14 @@ var init_hash_object = __esm2({
41168
41168
  init_task();
41169
41169
  }
41170
41170
  });
41171
- function parseInit(bare, path84, text) {
41171
+ function parseInit(bare, path86, text) {
41172
41172
  const response = String(text).trim();
41173
41173
  let result;
41174
41174
  if (result = initResponseRegex.exec(response)) {
41175
- return new InitSummary(bare, path84, false, result[1]);
41175
+ return new InitSummary(bare, path86, false, result[1]);
41176
41176
  }
41177
41177
  if (result = reInitResponseRegex.exec(response)) {
41178
- return new InitSummary(bare, path84, true, result[1]);
41178
+ return new InitSummary(bare, path86, true, result[1]);
41179
41179
  }
41180
41180
  let gitDir = "";
41181
41181
  const tokens = response.split(" ");
@@ -41186,7 +41186,7 @@ function parseInit(bare, path84, text) {
41186
41186
  break;
41187
41187
  }
41188
41188
  }
41189
- return new InitSummary(bare, path84, /^re/i.test(response), gitDir);
41189
+ return new InitSummary(bare, path86, /^re/i.test(response), gitDir);
41190
41190
  }
41191
41191
  var InitSummary;
41192
41192
  var initResponseRegex;
@@ -41195,9 +41195,9 @@ var init_InitSummary = __esm2({
41195
41195
  "src/lib/responses/InitSummary.ts"() {
41196
41196
  "use strict";
41197
41197
  InitSummary = class {
41198
- constructor(bare, path84, existing, gitDir) {
41198
+ constructor(bare, path86, existing, gitDir) {
41199
41199
  this.bare = bare;
41200
- this.path = path84;
41200
+ this.path = path86;
41201
41201
  this.existing = existing;
41202
41202
  this.gitDir = gitDir;
41203
41203
  }
@@ -41209,7 +41209,7 @@ var init_InitSummary = __esm2({
41209
41209
  function hasBareCommand(command) {
41210
41210
  return command.includes(bareCommand);
41211
41211
  }
41212
- function initTask(bare = false, path84, customArgs) {
41212
+ function initTask(bare = false, path86, customArgs) {
41213
41213
  const commands = ["init", ...customArgs];
41214
41214
  if (bare && !hasBareCommand(commands)) {
41215
41215
  commands.splice(1, 0, bareCommand);
@@ -41218,7 +41218,7 @@ function initTask(bare = false, path84, customArgs) {
41218
41218
  commands,
41219
41219
  format: "utf-8",
41220
41220
  parser(text) {
41221
- return parseInit(commands.includes("--bare"), path84, text);
41221
+ return parseInit(commands.includes("--bare"), path86, text);
41222
41222
  }
41223
41223
  };
41224
41224
  }
@@ -42034,12 +42034,12 @@ var init_FileStatusSummary = __esm2({
42034
42034
  "use strict";
42035
42035
  fromPathRegex = /^(.+)\0(.+)$/;
42036
42036
  FileStatusSummary = class {
42037
- constructor(path84, index, working_dir) {
42038
- this.path = path84;
42037
+ constructor(path86, index, working_dir) {
42038
+ this.path = path86;
42039
42039
  this.index = index;
42040
42040
  this.working_dir = working_dir;
42041
42041
  if (index === "R" || working_dir === "R") {
42042
- const detail = fromPathRegex.exec(path84) || [null, path84, path84];
42042
+ const detail = fromPathRegex.exec(path86) || [null, path86, path86];
42043
42043
  this.from = detail[2] || "";
42044
42044
  this.path = detail[1] || "";
42045
42045
  }
@@ -42070,14 +42070,14 @@ function splitLine(result, lineStr) {
42070
42070
  default:
42071
42071
  return;
42072
42072
  }
42073
- function data(index, workingDir, path84) {
42073
+ function data(index, workingDir, path86) {
42074
42074
  const raw = `${index}${workingDir}`;
42075
42075
  const handler = parsers6.get(raw);
42076
42076
  if (handler) {
42077
- handler(result, path84);
42077
+ handler(result, path86);
42078
42078
  }
42079
42079
  if (raw !== "##" && raw !== "!!") {
42080
- result.files.push(new FileStatusSummary(path84, index, workingDir));
42080
+ result.files.push(new FileStatusSummary(path86, index, workingDir));
42081
42081
  }
42082
42082
  }
42083
42083
  }
@@ -42386,9 +42386,9 @@ var init_simple_git_api = __esm2({
42386
42386
  next
42387
42387
  );
42388
42388
  }
42389
- hashObject(path84, write) {
42389
+ hashObject(path86, write) {
42390
42390
  return this._runTask(
42391
- hashObjectTask(path84, write === true),
42391
+ hashObjectTask(path86, write === true),
42392
42392
  trailingFunctionArgument(arguments)
42393
42393
  );
42394
42394
  }
@@ -42741,8 +42741,8 @@ var init_branch = __esm2({
42741
42741
  }
42742
42742
  });
42743
42743
  function toPath(input) {
42744
- const path84 = input.trim().replace(/^["']|["']$/g, "");
42745
- return path84 && normalize3(path84);
42744
+ const path86 = input.trim().replace(/^["']|["']$/g, "");
42745
+ return path86 && normalize3(path86);
42746
42746
  }
42747
42747
  var parseCheckIgnore;
42748
42748
  var init_CheckIgnore = __esm2({
@@ -43056,8 +43056,8 @@ __export2(sub_module_exports, {
43056
43056
  subModuleTask: () => subModuleTask,
43057
43057
  updateSubModuleTask: () => updateSubModuleTask
43058
43058
  });
43059
- function addSubModuleTask(repo, path84) {
43060
- return subModuleTask(["add", repo, path84]);
43059
+ function addSubModuleTask(repo, path86) {
43060
+ return subModuleTask(["add", repo, path86]);
43061
43061
  }
43062
43062
  function initSubModuleTask(customArgs) {
43063
43063
  return subModuleTask(["init", ...customArgs]);
@@ -43390,8 +43390,8 @@ var require_git = __commonJS2({
43390
43390
  }
43391
43391
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
43392
43392
  };
43393
- Git2.prototype.submoduleAdd = function(repo, path84, then) {
43394
- return this._runTask(addSubModuleTask2(repo, path84), trailingFunctionArgument2(arguments));
43393
+ Git2.prototype.submoduleAdd = function(repo, path86, then) {
43394
+ return this._runTask(addSubModuleTask2(repo, path86), trailingFunctionArgument2(arguments));
43395
43395
  };
43396
43396
  Git2.prototype.submoduleUpdate = function(args, then) {
43397
43397
  return this._runTask(
@@ -44130,8 +44130,8 @@ function parseNumstatEntries(lines) {
44130
44130
  }
44131
44131
  function parseNumstat(lines) {
44132
44132
  const m = /* @__PURE__ */ new Map();
44133
- for (const [path84, entry] of parseNumstatEntries(lines)) {
44134
- m.set(path84, { additions: entry.additions, deletions: entry.deletions });
44133
+ for (const [path86, entry] of parseNumstatEntries(lines)) {
44134
+ m.set(path86, { additions: entry.additions, deletions: entry.deletions });
44135
44135
  }
44136
44136
  return m;
44137
44137
  }
@@ -48219,7 +48219,7 @@ init_symbol_index_file_ready();
48219
48219
  var CODE_NAV_INDEX_READY_WAIT_MS = 75;
48220
48220
  var CODE_NAV_INDEX_READY_POLL_MS = 15;
48221
48221
  function delay2(ms) {
48222
- return new Promise((resolve35) => setTimeout(resolve35, ms));
48222
+ return new Promise((resolve36) => setTimeout(resolve36, ms));
48223
48223
  }
48224
48224
  async function waitForSymbolIndexReady(sessionParentPath, reqPath, maxWaitMs = CODE_NAV_INDEX_READY_WAIT_MS) {
48225
48225
  const deadline = Date.now() + maxWaitMs;
@@ -48351,12 +48351,12 @@ function parseOptionalInt2(raw) {
48351
48351
  return Number.isInteger(parsed) ? parsed : void 0;
48352
48352
  }
48353
48353
  function parseCodeNavParams(url2) {
48354
- const path84 = url2.searchParams.get("path") ?? "";
48354
+ const path86 = url2.searchParams.get("path") ?? "";
48355
48355
  const opRaw = url2.searchParams.get("op")?.trim();
48356
48356
  const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
48357
48357
  const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
48358
48358
  const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
48359
- return { path: path84, op, line, column };
48359
+ return { path: path86, op, line, column };
48360
48360
  }
48361
48361
  function parseCodeNavPath(url2) {
48362
48362
  const raw = url2.searchParams.get("path")?.trim();
@@ -48532,7 +48532,7 @@ function createLocalShortcutRequestHandler(ctx) {
48532
48532
  var RESTART_DELAY_MS = 250;
48533
48533
  var MAX_RESTART_ATTEMPTS = 5;
48534
48534
  function listenOnPort(server, port) {
48535
- return new Promise((resolve35, reject) => {
48535
+ return new Promise((resolve36, reject) => {
48536
48536
  server.once("error", reject);
48537
48537
  server.listen(port, "127.0.0.1", () => {
48538
48538
  const addr = server.address();
@@ -48540,12 +48540,12 @@ function listenOnPort(server, port) {
48540
48540
  reject(new Error("Local shortcut server did not bind"));
48541
48541
  return;
48542
48542
  }
48543
- resolve35(addr.port);
48543
+ resolve36(addr.port);
48544
48544
  });
48545
48545
  });
48546
48546
  }
48547
48547
  function delay3(ms) {
48548
- return new Promise((resolve35) => setTimeout(resolve35, ms));
48548
+ return new Promise((resolve36) => setTimeout(resolve36, ms));
48549
48549
  }
48550
48550
  function startLocalShortcutServer(ctx) {
48551
48551
  let closed = false;
@@ -48745,7 +48745,8 @@ var API_TO_BRIDGE_MESSAGE_TYPES = [
48745
48745
  "install_agent",
48746
48746
  "refresh_local_skills",
48747
48747
  "bridge_git_context_request",
48748
- "list_repo_branches_request"
48748
+ "list_repo_branches_request",
48749
+ "bridge_git_checkout_request"
48749
48750
  ];
48750
48751
  var API_TO_BRIDGE_TYPE_SET = new Set(API_TO_BRIDGE_MESSAGE_TYPES);
48751
48752
  function parseApiToBridgeMessage(data, log2) {
@@ -49438,10 +49439,10 @@ async function awaitGitStatePreparation(options) {
49438
49439
  try {
49439
49440
  return await Promise.race([
49440
49441
  work,
49441
- new Promise((resolve35) => {
49442
+ new Promise((resolve36) => {
49442
49443
  timer = setTimeout(() => {
49443
49444
  log2(`[Agent] ${label} exceeded ${timeoutMs}ms; continuing without it.`);
49444
- resolve35(fallback);
49445
+ resolve36(fallback);
49445
49446
  }, timeoutMs);
49446
49447
  timer.unref?.();
49447
49448
  })
@@ -50100,7 +50101,7 @@ var handleInstallSkillsMessage = (msg, deps) => {
50100
50101
  import { spawn as spawn11 } from "node:child_process";
50101
50102
  import * as readline3 from "node:readline";
50102
50103
  function runStreamingCommand(command, args, options) {
50103
- return new Promise((resolve35, reject) => {
50104
+ return new Promise((resolve36, reject) => {
50104
50105
  const child = spawn11(command, args, {
50105
50106
  env: options.env,
50106
50107
  stdio: ["ignore", "pipe", "pipe"]
@@ -50133,7 +50134,7 @@ function runStreamingCommand(command, args, options) {
50133
50134
  if (timer) clearTimeout(timer);
50134
50135
  if (!settled) {
50135
50136
  settled = true;
50136
- resolve35({ code, signal });
50137
+ resolve36({ code, signal });
50137
50138
  }
50138
50139
  });
50139
50140
  });
@@ -50572,6 +50573,23 @@ async function listRepoBranchRefs(repoPath) {
50572
50573
  }
50573
50574
  }
50574
50575
 
50576
+ // src/git/checkout/pending-checkouts.ts
50577
+ var pendingByRelPath = /* @__PURE__ */ new Map();
50578
+ function beginPendingCheckout(row) {
50579
+ const relPath = row.relPath.trim() || ".";
50580
+ pendingByRelPath.set(relPath, {
50581
+ relPath,
50582
+ folderName: row.folderName.trim() || (relPath === "." ? "repo" : relPath),
50583
+ remoteUrl: row.remoteUrl
50584
+ });
50585
+ }
50586
+ function endPendingCheckout(relPath) {
50587
+ pendingByRelPath.delete(relPath.trim() || ".");
50588
+ }
50589
+ function listPendingCheckouts() {
50590
+ return [...pendingByRelPath.values()];
50591
+ }
50592
+
50575
50593
  // src/git/bridge-git-context.ts
50576
50594
  function folderNameForRelPath(relPath, bridgeRoot) {
50577
50595
  if (relPath === "." || relPath === "") {
@@ -50608,7 +50626,23 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
50608
50626
  relPath,
50609
50627
  folderName: folderNameForRelPath(relPath, bridgeResolved),
50610
50628
  currentBranch,
50611
- remoteUrl
50629
+ remoteUrl,
50630
+ cloning: false
50631
+ });
50632
+ }
50633
+ const seen = new Set(rows.map((r) => r.relPath));
50634
+ for (const pending2 of listPendingCheckouts()) {
50635
+ if (seen.has(pending2.relPath)) {
50636
+ const row = rows.find((r) => r.relPath === pending2.relPath);
50637
+ if (row) row.cloning = true;
50638
+ continue;
50639
+ }
50640
+ rows.push({
50641
+ relPath: pending2.relPath,
50642
+ folderName: pending2.folderName,
50643
+ currentBranch: null,
50644
+ remoteUrl: pending2.remoteUrl,
50645
+ cloning: true
50612
50646
  });
50613
50647
  }
50614
50648
  rows.sort((a, b) => a.relPath.localeCompare(b.relPath));
@@ -50668,6 +50702,143 @@ function handleListRepoBranchesRequestMessage(msg, getWs) {
50668
50702
  })();
50669
50703
  }
50670
50704
 
50705
+ // src/git/checkout/bridge-git-checkout.ts
50706
+ import * as fs64 from "node:fs/promises";
50707
+ import * as path85 from "node:path";
50708
+
50709
+ // src/git/checkout/normalize-clone-url.ts
50710
+ function normalizeCloneUrl(url2) {
50711
+ const u = url2.trim();
50712
+ if (!u.startsWith("http://") && !u.startsWith("https://")) {
50713
+ throw new Error("Only http(s) git remote URLs are supported");
50714
+ }
50715
+ return u.endsWith(".git") ? u : `${u}.git`;
50716
+ }
50717
+ function cloneUrlWithHttpsAuth(url2, auth) {
50718
+ const normalized = normalizeCloneUrl(url2);
50719
+ if (!auth) return normalized;
50720
+ const parsed = new URL(normalized);
50721
+ parsed.username = auth.username;
50722
+ parsed.password = auth.password;
50723
+ return parsed.toString();
50724
+ }
50725
+
50726
+ // src/git/checkout/resolve-checkout-target.ts
50727
+ import * as fs63 from "node:fs/promises";
50728
+ import * as path84 from "node:path";
50729
+ var FOLDER_NAME_RE = /^[A-Za-z0-9._-]+$/;
50730
+ async function pathExists(p) {
50731
+ try {
50732
+ await fs63.access(p);
50733
+ return true;
50734
+ } catch {
50735
+ return false;
50736
+ }
50737
+ }
50738
+ async function resolveCheckoutTarget(opts) {
50739
+ const bridgeRoot = getBridgeRoot();
50740
+ if (opts.layout === "monorepo") {
50741
+ if (await isGitRepoDirectory(bridgeRoot)) {
50742
+ throw new Error("Bridge root is already a git repository");
50743
+ }
50744
+ const entries = await fs63.readdir(bridgeRoot).catch(() => []);
50745
+ if (entries.length > 0) {
50746
+ throw new Error("Bridge root must be empty to initialize a monorepo checkout");
50747
+ }
50748
+ return { targetDir: bridgeRoot, relPath: "." };
50749
+ }
50750
+ const folder = (opts.folderName ?? "").trim();
50751
+ if (!folder || folder === "." || folder === ".." || !FOLDER_NAME_RE.test(folder)) {
50752
+ throw new Error("folderName must be a single path segment (letters, numbers, . _ -)");
50753
+ }
50754
+ if (await isGitRepoDirectory(bridgeRoot)) {
50755
+ throw new Error("Cannot add a nested repo while the bridge root is itself a git repository");
50756
+ }
50757
+ const targetDir = path84.resolve(bridgeRoot, folder);
50758
+ if (!targetDir.startsWith(bridgeRoot + path84.sep)) {
50759
+ throw new Error("Invalid folderName");
50760
+ }
50761
+ if (await pathExists(targetDir)) {
50762
+ throw new Error(`Folder already exists: ${folder}`);
50763
+ }
50764
+ return { targetDir, relPath: folder };
50765
+ }
50766
+
50767
+ // src/git/checkout/bridge-git-checkout.ts
50768
+ async function bridgeGitCheckout(params) {
50769
+ const cloneUrl = (params.cloneUrl ?? "").trim();
50770
+ if (!cloneUrl) throw new Error("cloneUrl required");
50771
+ const { targetDir, relPath } = await resolveCheckoutTarget({
50772
+ layout: params.layout,
50773
+ folderName: params.folderName
50774
+ });
50775
+ const folderName = relPath === "." ? "repo" : relPath;
50776
+ beginPendingCheckout({ relPath, folderName, remoteUrl: cloneUrl });
50777
+ const parent = path85.dirname(targetDir);
50778
+ await fs64.mkdir(parent, { recursive: true });
50779
+ if (relPath !== ".") {
50780
+ await fs64.mkdir(targetDir, { recursive: true });
50781
+ }
50782
+ const url2 = cloneUrlWithHttpsAuth(cloneUrl, params.auth ?? null);
50783
+ try {
50784
+ await execGitFile(["clone", "--", url2, targetDir], {
50785
+ cwd: parent,
50786
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
50787
+ });
50788
+ return { relPath, folderName };
50789
+ } catch (e) {
50790
+ if (relPath !== ".") {
50791
+ await fs64.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
50792
+ }
50793
+ const msg = e instanceof Error ? e.message : String(e);
50794
+ throw new Error(
50795
+ msg.includes("Authentication") || msg.includes("403") || msg.includes("401") ? `Clone failed (auth?): ${msg}` : `Clone failed: ${msg}`
50796
+ );
50797
+ } finally {
50798
+ endPendingCheckout(relPath);
50799
+ }
50800
+ }
50801
+
50802
+ // src/routing/handlers/bridge-git-checkout-messages.ts
50803
+ function handleBridgeGitCheckoutRequestMessage(msg, getWs) {
50804
+ void (async () => {
50805
+ const socket = getWs();
50806
+ if (!socket) return;
50807
+ const layout = msg.layout === "multi_repo" ? "multi_repo" : msg.layout === "monorepo" ? "monorepo" : null;
50808
+ if (!layout) {
50809
+ sendWsMessage(socket, {
50810
+ type: "bridge_git_checkout_response",
50811
+ id: msg.id,
50812
+ error: "layout must be monorepo or multi_repo"
50813
+ });
50814
+ return;
50815
+ }
50816
+ try {
50817
+ const user = typeof msg.authUsername === "string" ? msg.authUsername : "";
50818
+ const pass = typeof msg.authPassword === "string" ? msg.authPassword : "";
50819
+ const result = await bridgeGitCheckout({
50820
+ layout,
50821
+ folderName: msg.folderName,
50822
+ cloneUrl: msg.cloneUrl ?? "",
50823
+ auth: user && pass ? { username: user, password: pass } : null
50824
+ });
50825
+ sendWsMessage(socket, {
50826
+ type: "bridge_git_checkout_response",
50827
+ id: msg.id,
50828
+ ok: true,
50829
+ relPath: result.relPath,
50830
+ folderName: result.folderName
50831
+ });
50832
+ } catch (e) {
50833
+ sendWsMessage(socket, {
50834
+ type: "bridge_git_checkout_response",
50835
+ id: msg.id,
50836
+ error: e instanceof Error ? e.message : String(e)
50837
+ });
50838
+ }
50839
+ })();
50840
+ }
50841
+
50671
50842
  // src/routing/dispatch/file-browser.ts
50672
50843
  function dispatchBridgeFileBrowserMessage(msg, deps) {
50673
50844
  switch (msg.type) {
@@ -50686,6 +50857,9 @@ function dispatchBridgeFileBrowserMessage(msg, deps) {
50686
50857
  case "list_repo_branches_request":
50687
50858
  handleListRepoBranchesRequestMessage(msg, deps.getWs);
50688
50859
  break;
50860
+ case "bridge_git_checkout_request":
50861
+ handleBridgeGitCheckoutRequestMessage(msg, deps.getWs);
50862
+ break;
50689
50863
  }
50690
50864
  }
50691
50865
 
@@ -50726,6 +50900,7 @@ function dispatchBridgeMessage(msg, deps) {
50726
50900
  case "code_nav":
50727
50901
  case "bridge_git_context_request":
50728
50902
  case "list_repo_branches_request":
50903
+ case "bridge_git_checkout_request":
50729
50904
  dispatchBridgeFileBrowserMessage(msg, deps);
50730
50905
  break;
50731
50906
  }
@@ -51191,12 +51366,12 @@ async function runConnectedBridge(options, restartWithoutAuth) {
51191
51366
  let cleanupKeyCommand;
51192
51367
  let bridgeClose = null;
51193
51368
  let endConnectedSession;
51194
- const sessionDone = new Promise((resolve35) => {
51195
- endConnectedSession = resolve35;
51369
+ const sessionDone = new Promise((resolve36) => {
51370
+ endConnectedSession = resolve36;
51196
51371
  });
51197
51372
  let resolveHandleReady;
51198
- const handleReady = new Promise((resolve35) => {
51199
- resolveHandleReady = resolve35;
51373
+ const handleReady = new Promise((resolve36) => {
51374
+ resolveHandleReady = resolve36;
51200
51375
  });
51201
51376
  const handleRef = { current: null };
51202
51377
  const signals = installConnectedBridgeSignals({