@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/cli.js +356 -181
- package/dist/cli.js.map +4 -4
- package/dist/index.js +335 -160
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -973,8 +973,8 @@ var require_command = __commonJS({
|
|
|
973
973
|
"../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
|
|
974
974
|
var EventEmitter2 = __require("node:events").EventEmitter;
|
|
975
975
|
var childProcess2 = __require("node:child_process");
|
|
976
|
-
var
|
|
977
|
-
var
|
|
976
|
+
var path88 = __require("node:path");
|
|
977
|
+
var fs67 = __require("node:fs");
|
|
978
978
|
var process8 = __require("node:process");
|
|
979
979
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
980
980
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1906,11 +1906,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1906
1906
|
let launchWithNode = false;
|
|
1907
1907
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1908
1908
|
function findFile(baseDir, baseName) {
|
|
1909
|
-
const localBin =
|
|
1910
|
-
if (
|
|
1911
|
-
if (sourceExt.includes(
|
|
1909
|
+
const localBin = path88.resolve(baseDir, baseName);
|
|
1910
|
+
if (fs67.existsSync(localBin)) return localBin;
|
|
1911
|
+
if (sourceExt.includes(path88.extname(baseName))) return void 0;
|
|
1912
1912
|
const foundExt = sourceExt.find(
|
|
1913
|
-
(ext) =>
|
|
1913
|
+
(ext) => fs67.existsSync(`${localBin}${ext}`)
|
|
1914
1914
|
);
|
|
1915
1915
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1916
1916
|
return void 0;
|
|
@@ -1922,21 +1922,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1922
1922
|
if (this._scriptPath) {
|
|
1923
1923
|
let resolvedScriptPath;
|
|
1924
1924
|
try {
|
|
1925
|
-
resolvedScriptPath =
|
|
1925
|
+
resolvedScriptPath = fs67.realpathSync(this._scriptPath);
|
|
1926
1926
|
} catch (err) {
|
|
1927
1927
|
resolvedScriptPath = this._scriptPath;
|
|
1928
1928
|
}
|
|
1929
|
-
executableDir =
|
|
1930
|
-
|
|
1929
|
+
executableDir = path88.resolve(
|
|
1930
|
+
path88.dirname(resolvedScriptPath),
|
|
1931
1931
|
executableDir
|
|
1932
1932
|
);
|
|
1933
1933
|
}
|
|
1934
1934
|
if (executableDir) {
|
|
1935
1935
|
let localFile = findFile(executableDir, executableFile);
|
|
1936
1936
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1937
|
-
const legacyName =
|
|
1937
|
+
const legacyName = path88.basename(
|
|
1938
1938
|
this._scriptPath,
|
|
1939
|
-
|
|
1939
|
+
path88.extname(this._scriptPath)
|
|
1940
1940
|
);
|
|
1941
1941
|
if (legacyName !== this._name) {
|
|
1942
1942
|
localFile = findFile(
|
|
@@ -1947,7 +1947,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1947
1947
|
}
|
|
1948
1948
|
executableFile = localFile || executableFile;
|
|
1949
1949
|
}
|
|
1950
|
-
launchWithNode = sourceExt.includes(
|
|
1950
|
+
launchWithNode = sourceExt.includes(path88.extname(executableFile));
|
|
1951
1951
|
let proc;
|
|
1952
1952
|
if (process8.platform !== "win32") {
|
|
1953
1953
|
if (launchWithNode) {
|
|
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2787
2787
|
* @return {Command}
|
|
2788
2788
|
*/
|
|
2789
2789
|
nameFromFilename(filename) {
|
|
2790
|
-
this._name =
|
|
2790
|
+
this._name = path88.basename(filename, path88.extname(filename));
|
|
2791
2791
|
return this;
|
|
2792
2792
|
}
|
|
2793
2793
|
/**
|
|
@@ -2801,9 +2801,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2801
2801
|
* @param {string} [path]
|
|
2802
2802
|
* @return {(string|null|Command)}
|
|
2803
2803
|
*/
|
|
2804
|
-
executableDir(
|
|
2805
|
-
if (
|
|
2806
|
-
this._executableDir =
|
|
2804
|
+
executableDir(path89) {
|
|
2805
|
+
if (path89 === void 0) return this._executableDir;
|
|
2806
|
+
this._executableDir = path89;
|
|
2807
2807
|
return this;
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
@@ -7004,7 +7004,7 @@ var init_activity_tracker = __esm({
|
|
|
7004
7004
|
|
|
7005
7005
|
// src/runtime/yield-to-event-loop.ts
|
|
7006
7006
|
function yieldToEventLoop() {
|
|
7007
|
-
return new Promise((
|
|
7007
|
+
return new Promise((resolve38) => setImmediate(resolve38));
|
|
7008
7008
|
}
|
|
7009
7009
|
var init_yield_to_event_loop = __esm({
|
|
7010
7010
|
"src/runtime/yield-to-event-loop.ts"() {
|
|
@@ -7045,7 +7045,7 @@ async function yieldUntilFileBrowserReadsIdle(pollMs = 5) {
|
|
|
7045
7045
|
while (getFileBrowserInFlightReadCount() > 0) {
|
|
7046
7046
|
await yieldToEventLoop();
|
|
7047
7047
|
if (getFileBrowserInFlightReadCount() > 0) {
|
|
7048
|
-
await new Promise((
|
|
7048
|
+
await new Promise((resolve38) => setTimeout(resolve38, pollMs));
|
|
7049
7049
|
}
|
|
7050
7050
|
}
|
|
7051
7051
|
}
|
|
@@ -7055,7 +7055,7 @@ async function yieldUntilFileBrowserBrowseIdle(pollMs = 5) {
|
|
|
7055
7055
|
const browseCooldownDone = lastActivityAt === 0 || Date.now() - lastActivityAt >= BROWSE_INDEX_COOLDOWN_MS;
|
|
7056
7056
|
if (inFlightRequests2 === 0 && browseCooldownDone) return;
|
|
7057
7057
|
await yieldToEventLoop();
|
|
7058
|
-
await new Promise((
|
|
7058
|
+
await new Promise((resolve38) => setTimeout(resolve38, pollMs));
|
|
7059
7059
|
}
|
|
7060
7060
|
}
|
|
7061
7061
|
async function yieldUntilFileBrowserIdle(pollMs = 5) {
|
|
@@ -7232,8 +7232,8 @@ function createRequestId(prefix) {
|
|
|
7232
7232
|
}
|
|
7233
7233
|
function waitForWorkerReady() {
|
|
7234
7234
|
if (workerReady) return Promise.resolve();
|
|
7235
|
-
return new Promise((
|
|
7236
|
-
workerReadyWaiters.push(
|
|
7235
|
+
return new Promise((resolve38) => {
|
|
7236
|
+
workerReadyWaiters.push(resolve38);
|
|
7237
7237
|
});
|
|
7238
7238
|
}
|
|
7239
7239
|
function registerWorkerReadyListener(listener) {
|
|
@@ -7245,7 +7245,7 @@ function registerWorkerReadyListener(listener) {
|
|
|
7245
7245
|
}
|
|
7246
7246
|
function markWorkerReady() {
|
|
7247
7247
|
workerReady = true;
|
|
7248
|
-
for (const
|
|
7248
|
+
for (const resolve38 of workerReadyWaiters) resolve38();
|
|
7249
7249
|
workerReadyWaiters = [];
|
|
7250
7250
|
workerReadyListener?.();
|
|
7251
7251
|
}
|
|
@@ -7392,7 +7392,7 @@ async function waitForOuterCodeNavCacheAccessAsync() {
|
|
|
7392
7392
|
if (isCliImmediateShutdownRequested() || isSymbolIndexWorkerShutdownRequested()) {
|
|
7393
7393
|
throw new CliSqliteInterrupted();
|
|
7394
7394
|
}
|
|
7395
|
-
await new Promise((
|
|
7395
|
+
await new Promise((resolve38) => setTimeout(resolve38, 5));
|
|
7396
7396
|
await yieldToEventLoop();
|
|
7397
7397
|
}
|
|
7398
7398
|
}
|
|
@@ -7729,7 +7729,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
|
|
|
7729
7729
|
join3(moduleDir, "..", sub, filename),
|
|
7730
7730
|
join3(moduleDir, "..", "..", "dist", sub, filename)
|
|
7731
7731
|
]);
|
|
7732
|
-
const resolved = candidates.find((
|
|
7732
|
+
const resolved = candidates.find((path88) => existsSync(path88));
|
|
7733
7733
|
if (!resolved) {
|
|
7734
7734
|
throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
|
|
7735
7735
|
}
|
|
@@ -8807,7 +8807,7 @@ var require_ignore = __commonJS({
|
|
|
8807
8807
|
// path matching.
|
|
8808
8808
|
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
8809
8809
|
// @returns {TestResult} true if a file is ignored
|
|
8810
|
-
test(
|
|
8810
|
+
test(path88, checkUnignored, mode) {
|
|
8811
8811
|
let ignored = false;
|
|
8812
8812
|
let unignored = false;
|
|
8813
8813
|
let matchedRule;
|
|
@@ -8816,7 +8816,7 @@ var require_ignore = __commonJS({
|
|
|
8816
8816
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
8817
8817
|
return;
|
|
8818
8818
|
}
|
|
8819
|
-
const matched = rule[mode].test(
|
|
8819
|
+
const matched = rule[mode].test(path88);
|
|
8820
8820
|
if (!matched) {
|
|
8821
8821
|
return;
|
|
8822
8822
|
}
|
|
@@ -8837,17 +8837,17 @@ var require_ignore = __commonJS({
|
|
|
8837
8837
|
var throwError = (message, Ctor) => {
|
|
8838
8838
|
throw new Ctor(message);
|
|
8839
8839
|
};
|
|
8840
|
-
var checkPath = (
|
|
8841
|
-
if (!isString(
|
|
8840
|
+
var checkPath = (path88, originalPath, doThrow) => {
|
|
8841
|
+
if (!isString(path88)) {
|
|
8842
8842
|
return doThrow(
|
|
8843
8843
|
`path must be a string, but got \`${originalPath}\``,
|
|
8844
8844
|
TypeError
|
|
8845
8845
|
);
|
|
8846
8846
|
}
|
|
8847
|
-
if (!
|
|
8847
|
+
if (!path88) {
|
|
8848
8848
|
return doThrow(`path must not be empty`, TypeError);
|
|
8849
8849
|
}
|
|
8850
|
-
if (checkPath.isNotRelative(
|
|
8850
|
+
if (checkPath.isNotRelative(path88)) {
|
|
8851
8851
|
const r = "`path.relative()`d";
|
|
8852
8852
|
return doThrow(
|
|
8853
8853
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -8856,7 +8856,7 @@ var require_ignore = __commonJS({
|
|
|
8856
8856
|
}
|
|
8857
8857
|
return true;
|
|
8858
8858
|
};
|
|
8859
|
-
var isNotRelative = (
|
|
8859
|
+
var isNotRelative = (path88) => REGEX_TEST_INVALID_PATH.test(path88);
|
|
8860
8860
|
checkPath.isNotRelative = isNotRelative;
|
|
8861
8861
|
checkPath.convert = (p) => p;
|
|
8862
8862
|
var Ignore = class {
|
|
@@ -8886,19 +8886,19 @@ var require_ignore = __commonJS({
|
|
|
8886
8886
|
}
|
|
8887
8887
|
// @returns {TestResult}
|
|
8888
8888
|
_test(originalPath, cache2, checkUnignored, slices) {
|
|
8889
|
-
const
|
|
8889
|
+
const path88 = originalPath && checkPath.convert(originalPath);
|
|
8890
8890
|
checkPath(
|
|
8891
|
-
|
|
8891
|
+
path88,
|
|
8892
8892
|
originalPath,
|
|
8893
8893
|
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
8894
8894
|
);
|
|
8895
|
-
return this._t(
|
|
8895
|
+
return this._t(path88, cache2, checkUnignored, slices);
|
|
8896
8896
|
}
|
|
8897
|
-
checkIgnore(
|
|
8898
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(
|
|
8899
|
-
return this.test(
|
|
8897
|
+
checkIgnore(path88) {
|
|
8898
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path88)) {
|
|
8899
|
+
return this.test(path88);
|
|
8900
8900
|
}
|
|
8901
|
-
const slices =
|
|
8901
|
+
const slices = path88.split(SLASH).filter(Boolean);
|
|
8902
8902
|
slices.pop();
|
|
8903
8903
|
if (slices.length) {
|
|
8904
8904
|
const parent = this._t(
|
|
@@ -8911,18 +8911,18 @@ var require_ignore = __commonJS({
|
|
|
8911
8911
|
return parent;
|
|
8912
8912
|
}
|
|
8913
8913
|
}
|
|
8914
|
-
return this._rules.test(
|
|
8914
|
+
return this._rules.test(path88, false, MODE_CHECK_IGNORE);
|
|
8915
8915
|
}
|
|
8916
|
-
_t(
|
|
8917
|
-
if (
|
|
8918
|
-
return cache2[
|
|
8916
|
+
_t(path88, cache2, checkUnignored, slices) {
|
|
8917
|
+
if (path88 in cache2) {
|
|
8918
|
+
return cache2[path88];
|
|
8919
8919
|
}
|
|
8920
8920
|
if (!slices) {
|
|
8921
|
-
slices =
|
|
8921
|
+
slices = path88.split(SLASH).filter(Boolean);
|
|
8922
8922
|
}
|
|
8923
8923
|
slices.pop();
|
|
8924
8924
|
if (!slices.length) {
|
|
8925
|
-
return cache2[
|
|
8925
|
+
return cache2[path88] = this._rules.test(path88, checkUnignored, MODE_IGNORE);
|
|
8926
8926
|
}
|
|
8927
8927
|
const parent = this._t(
|
|
8928
8928
|
slices.join(SLASH) + SLASH,
|
|
@@ -8930,29 +8930,29 @@ var require_ignore = __commonJS({
|
|
|
8930
8930
|
checkUnignored,
|
|
8931
8931
|
slices
|
|
8932
8932
|
);
|
|
8933
|
-
return cache2[
|
|
8933
|
+
return cache2[path88] = parent.ignored ? parent : this._rules.test(path88, checkUnignored, MODE_IGNORE);
|
|
8934
8934
|
}
|
|
8935
|
-
ignores(
|
|
8936
|
-
return this._test(
|
|
8935
|
+
ignores(path88) {
|
|
8936
|
+
return this._test(path88, this._ignoreCache, false).ignored;
|
|
8937
8937
|
}
|
|
8938
8938
|
createFilter() {
|
|
8939
|
-
return (
|
|
8939
|
+
return (path88) => !this.ignores(path88);
|
|
8940
8940
|
}
|
|
8941
8941
|
filter(paths) {
|
|
8942
8942
|
return makeArray(paths).filter(this.createFilter());
|
|
8943
8943
|
}
|
|
8944
8944
|
// @returns {TestResult}
|
|
8945
|
-
test(
|
|
8946
|
-
return this._test(
|
|
8945
|
+
test(path88) {
|
|
8946
|
+
return this._test(path88, this._testCache, true);
|
|
8947
8947
|
}
|
|
8948
8948
|
};
|
|
8949
8949
|
var factory = (options) => new Ignore(options);
|
|
8950
|
-
var isPathValid = (
|
|
8950
|
+
var isPathValid = (path88) => checkPath(path88 && checkPath.convert(path88), path88, RETURN_FALSE);
|
|
8951
8951
|
var setupWindows = () => {
|
|
8952
8952
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
8953
8953
|
checkPath.convert = makePosix;
|
|
8954
8954
|
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
8955
|
-
checkPath.isNotRelative = (
|
|
8955
|
+
checkPath.isNotRelative = (path88) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path88) || isNotRelative(path88);
|
|
8956
8956
|
};
|
|
8957
8957
|
if (
|
|
8958
8958
|
// Detect `process` so that it can run in browsers.
|
|
@@ -12143,7 +12143,7 @@ var init_setup_handlers = __esm({
|
|
|
12143
12143
|
// src/code-nav/symbol-index/worker/handle-message.ts
|
|
12144
12144
|
async function waitForActiveWorkerHandlersIdle(pollMs = 10) {
|
|
12145
12145
|
while (activeWorkerHandlers > 0) {
|
|
12146
|
-
await new Promise((
|
|
12146
|
+
await new Promise((resolve38) => setTimeout(resolve38, pollMs));
|
|
12147
12147
|
}
|
|
12148
12148
|
}
|
|
12149
12149
|
async function handleRequestMessage(port, msg) {
|
|
@@ -12386,9 +12386,9 @@ async function requestWorker(message) {
|
|
|
12386
12386
|
}
|
|
12387
12387
|
ensureWorkerStarted();
|
|
12388
12388
|
await ensureWorkerReadyForRequests();
|
|
12389
|
-
return new Promise((
|
|
12389
|
+
return new Promise((resolve38, reject) => {
|
|
12390
12390
|
pendingRequests.set(message.requestId, {
|
|
12391
|
-
resolve: (value) =>
|
|
12391
|
+
resolve: (value) => resolve38(value),
|
|
12392
12392
|
reject
|
|
12393
12393
|
});
|
|
12394
12394
|
postToWorker(message);
|
|
@@ -12414,37 +12414,37 @@ async function shutdownWorkerThread() {
|
|
|
12414
12414
|
if (activeWorker != null) {
|
|
12415
12415
|
setWorker(null);
|
|
12416
12416
|
await Promise.race([
|
|
12417
|
-
new Promise((
|
|
12417
|
+
new Promise((resolve38) => {
|
|
12418
12418
|
const onMessage = (message) => {
|
|
12419
12419
|
if (message.type !== "shutdownComplete") return;
|
|
12420
12420
|
activeWorker.off("message", onMessage);
|
|
12421
|
-
|
|
12421
|
+
resolve38();
|
|
12422
12422
|
};
|
|
12423
12423
|
activeWorker.on("message", onMessage);
|
|
12424
12424
|
try {
|
|
12425
12425
|
activeWorker.postMessage({ type: "shutdown" });
|
|
12426
12426
|
} catch {
|
|
12427
12427
|
activeWorker.off("message", onMessage);
|
|
12428
|
-
|
|
12428
|
+
resolve38();
|
|
12429
12429
|
}
|
|
12430
12430
|
}),
|
|
12431
|
-
new Promise((
|
|
12431
|
+
new Promise((resolve38) => setTimeout(resolve38, WORKER_SHUTDOWN_GRACE_MS))
|
|
12432
12432
|
]);
|
|
12433
12433
|
await activeWorker.terminate();
|
|
12434
12434
|
} else {
|
|
12435
12435
|
const inProcess = getInProcessBridge();
|
|
12436
12436
|
if (inProcess != null) {
|
|
12437
12437
|
await Promise.race([
|
|
12438
|
-
new Promise((
|
|
12438
|
+
new Promise((resolve38) => {
|
|
12439
12439
|
const onMessage = (message) => {
|
|
12440
12440
|
if (message.type !== "shutdownComplete") return;
|
|
12441
12441
|
inProcess.off("message", onMessage);
|
|
12442
|
-
|
|
12442
|
+
resolve38();
|
|
12443
12443
|
};
|
|
12444
12444
|
inProcess.on("message", onMessage);
|
|
12445
12445
|
inProcess.postMessage({ type: "shutdown" });
|
|
12446
12446
|
}),
|
|
12447
|
-
new Promise((
|
|
12447
|
+
new Promise((resolve38) => setTimeout(resolve38, WORKER_SHUTDOWN_GRACE_MS))
|
|
12448
12448
|
]);
|
|
12449
12449
|
}
|
|
12450
12450
|
}
|
|
@@ -12968,8 +12968,8 @@ var init_parseUtil = __esm({
|
|
|
12968
12968
|
init_errors();
|
|
12969
12969
|
init_en();
|
|
12970
12970
|
makeIssue = (params) => {
|
|
12971
|
-
const { data, path:
|
|
12972
|
-
const fullPath = [...
|
|
12971
|
+
const { data, path: path88, errorMaps, issueData } = params;
|
|
12972
|
+
const fullPath = [...path88, ...issueData.path || []];
|
|
12973
12973
|
const fullIssue = {
|
|
12974
12974
|
...issueData,
|
|
12975
12975
|
path: fullPath
|
|
@@ -13277,11 +13277,11 @@ var init_types2 = __esm({
|
|
|
13277
13277
|
init_parseUtil();
|
|
13278
13278
|
init_util();
|
|
13279
13279
|
ParseInputLazyPath = class {
|
|
13280
|
-
constructor(parent, value,
|
|
13280
|
+
constructor(parent, value, path88, key) {
|
|
13281
13281
|
this._cachedPath = [];
|
|
13282
13282
|
this.parent = parent;
|
|
13283
13283
|
this.data = value;
|
|
13284
|
-
this._path =
|
|
13284
|
+
this._path = path88;
|
|
13285
13285
|
this._key = key;
|
|
13286
13286
|
}
|
|
13287
13287
|
get path() {
|
|
@@ -17006,10 +17006,10 @@ function assignProp(target, prop, value) {
|
|
|
17006
17006
|
configurable: true
|
|
17007
17007
|
});
|
|
17008
17008
|
}
|
|
17009
|
-
function getElementAtPath(obj,
|
|
17010
|
-
if (!
|
|
17009
|
+
function getElementAtPath(obj, path88) {
|
|
17010
|
+
if (!path88)
|
|
17011
17011
|
return obj;
|
|
17012
|
-
return
|
|
17012
|
+
return path88.reduce((acc, key) => acc?.[key], obj);
|
|
17013
17013
|
}
|
|
17014
17014
|
function promiseAllObject(promisesObj) {
|
|
17015
17015
|
const keys = Object.keys(promisesObj);
|
|
@@ -17258,11 +17258,11 @@ function aborted(x, startIndex = 0) {
|
|
|
17258
17258
|
}
|
|
17259
17259
|
return false;
|
|
17260
17260
|
}
|
|
17261
|
-
function prefixIssues(
|
|
17261
|
+
function prefixIssues(path88, issues) {
|
|
17262
17262
|
return issues.map((iss) => {
|
|
17263
17263
|
var _a2;
|
|
17264
17264
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
17265
|
-
iss.path.unshift(
|
|
17265
|
+
iss.path.unshift(path88);
|
|
17266
17266
|
return iss;
|
|
17267
17267
|
});
|
|
17268
17268
|
}
|
|
@@ -17451,7 +17451,7 @@ function treeifyError(error40, _mapper) {
|
|
|
17451
17451
|
return issue2.message;
|
|
17452
17452
|
};
|
|
17453
17453
|
const result = { errors: [] };
|
|
17454
|
-
const processError = (error41,
|
|
17454
|
+
const processError = (error41, path88 = []) => {
|
|
17455
17455
|
var _a2, _b;
|
|
17456
17456
|
for (const issue2 of error41.issues) {
|
|
17457
17457
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -17461,7 +17461,7 @@ function treeifyError(error40, _mapper) {
|
|
|
17461
17461
|
} else if (issue2.code === "invalid_element") {
|
|
17462
17462
|
processError({ issues: issue2.issues }, issue2.path);
|
|
17463
17463
|
} else {
|
|
17464
|
-
const fullpath = [...
|
|
17464
|
+
const fullpath = [...path88, ...issue2.path];
|
|
17465
17465
|
if (fullpath.length === 0) {
|
|
17466
17466
|
result.errors.push(mapper(issue2));
|
|
17467
17467
|
continue;
|
|
@@ -17491,9 +17491,9 @@ function treeifyError(error40, _mapper) {
|
|
|
17491
17491
|
processError(error40);
|
|
17492
17492
|
return result;
|
|
17493
17493
|
}
|
|
17494
|
-
function toDotPath(
|
|
17494
|
+
function toDotPath(path88) {
|
|
17495
17495
|
const segs = [];
|
|
17496
|
-
for (const seg of
|
|
17496
|
+
for (const seg of path88) {
|
|
17497
17497
|
if (typeof seg === "number")
|
|
17498
17498
|
segs.push(`[${seg}]`);
|
|
17499
17499
|
else if (typeof seg === "symbol")
|
|
@@ -29956,8 +29956,8 @@ var init_acp = __esm({
|
|
|
29956
29956
|
this.#requestHandler = requestHandler;
|
|
29957
29957
|
this.#notificationHandler = notificationHandler;
|
|
29958
29958
|
this.#stream = stream;
|
|
29959
|
-
this.#closedPromise = new Promise((
|
|
29960
|
-
this.#abortController.signal.addEventListener("abort", () =>
|
|
29959
|
+
this.#closedPromise = new Promise((resolve38) => {
|
|
29960
|
+
this.#abortController.signal.addEventListener("abort", () => resolve38());
|
|
29961
29961
|
});
|
|
29962
29962
|
this.#receive();
|
|
29963
29963
|
}
|
|
@@ -30106,8 +30106,8 @@ var init_acp = __esm({
|
|
|
30106
30106
|
}
|
|
30107
30107
|
async sendRequest(method, params) {
|
|
30108
30108
|
const id = this.#nextRequestId++;
|
|
30109
|
-
const responsePromise = new Promise((
|
|
30110
|
-
this.#pendingResponses.set(id, { resolve:
|
|
30109
|
+
const responsePromise = new Promise((resolve38, reject) => {
|
|
30110
|
+
this.#pendingResponses.set(id, { resolve: resolve38, reject });
|
|
30111
30111
|
});
|
|
30112
30112
|
await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
|
|
30113
30113
|
return responsePromise;
|
|
@@ -30976,10 +30976,10 @@ var require_src2 = __commonJS({
|
|
|
30976
30976
|
var fs_1 = __require("fs");
|
|
30977
30977
|
var debug_1 = __importDefault(require_src());
|
|
30978
30978
|
var log2 = debug_1.default("@kwsites/file-exists");
|
|
30979
|
-
function check2(
|
|
30980
|
-
log2(`checking %s`,
|
|
30979
|
+
function check2(path88, isFile, isDirectory) {
|
|
30980
|
+
log2(`checking %s`, path88);
|
|
30981
30981
|
try {
|
|
30982
|
-
const stat3 = fs_1.statSync(
|
|
30982
|
+
const stat3 = fs_1.statSync(path88);
|
|
30983
30983
|
if (stat3.isFile() && isFile) {
|
|
30984
30984
|
log2(`[OK] path represents a file`);
|
|
30985
30985
|
return true;
|
|
@@ -30999,8 +30999,8 @@ var require_src2 = __commonJS({
|
|
|
30999
30999
|
throw e;
|
|
31000
31000
|
}
|
|
31001
31001
|
}
|
|
31002
|
-
function exists2(
|
|
31003
|
-
return check2(
|
|
31002
|
+
function exists2(path88, type = exports.READABLE) {
|
|
31003
|
+
return check2(path88, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
31004
31004
|
}
|
|
31005
31005
|
exports.exists = exists2;
|
|
31006
31006
|
exports.FILE = 1;
|
|
@@ -31081,7 +31081,7 @@ var {
|
|
|
31081
31081
|
} = import_index.default;
|
|
31082
31082
|
|
|
31083
31083
|
// src/cli-version.ts
|
|
31084
|
-
var CLI_VERSION = "0.1.
|
|
31084
|
+
var CLI_VERSION = "0.1.81".length > 0 ? "0.1.81" : "0.0.0-dev";
|
|
31085
31085
|
|
|
31086
31086
|
// src/cli/defaults.ts
|
|
31087
31087
|
var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
|
|
@@ -31089,8 +31089,8 @@ var DEFAULT_FIREHOSE_URL = "https://buildautomaton-firehose.fly.dev";
|
|
|
31089
31089
|
|
|
31090
31090
|
// src/cli/run-cli-action.ts
|
|
31091
31091
|
init_cli_log_level();
|
|
31092
|
-
import * as
|
|
31093
|
-
import * as
|
|
31092
|
+
import * as fs66 from "node:fs";
|
|
31093
|
+
import * as path87 from "node:path";
|
|
31094
31094
|
|
|
31095
31095
|
// src/config.ts
|
|
31096
31096
|
import fs from "node:fs";
|
|
@@ -31979,14 +31979,14 @@ var baseOpen = async (options) => {
|
|
|
31979
31979
|
}
|
|
31980
31980
|
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
31981
31981
|
if (options.wait) {
|
|
31982
|
-
return new Promise((
|
|
31982
|
+
return new Promise((resolve38, reject) => {
|
|
31983
31983
|
subprocess.once("error", reject);
|
|
31984
31984
|
subprocess.once("close", (exitCode) => {
|
|
31985
31985
|
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
31986
31986
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
31987
31987
|
return;
|
|
31988
31988
|
}
|
|
31989
|
-
|
|
31989
|
+
resolve38(subprocess);
|
|
31990
31990
|
});
|
|
31991
31991
|
});
|
|
31992
31992
|
}
|
|
@@ -32748,8 +32748,8 @@ function createPendingAuthOnClose(params) {
|
|
|
32748
32748
|
// src/auth/pending/pending-auth-session.ts
|
|
32749
32749
|
function createPendingAuthSession() {
|
|
32750
32750
|
let resolveAuth;
|
|
32751
|
-
const authPromise = new Promise((
|
|
32752
|
-
resolveAuth =
|
|
32751
|
+
const authPromise = new Promise((resolve38) => {
|
|
32752
|
+
resolveAuth = resolve38;
|
|
32753
32753
|
});
|
|
32754
32754
|
return {
|
|
32755
32755
|
ws: null,
|
|
@@ -35246,10 +35246,10 @@ async function killChildProcessTreeGracefully(child, graceMs = ACP_PROCESS_TREE_
|
|
|
35246
35246
|
}
|
|
35247
35247
|
await killProcessTree(pid, "SIGTERM");
|
|
35248
35248
|
if (graceMs <= 0) return;
|
|
35249
|
-
const exited = new Promise((
|
|
35250
|
-
child.once("exit", () =>
|
|
35249
|
+
const exited = new Promise((resolve38) => {
|
|
35250
|
+
child.once("exit", () => resolve38());
|
|
35251
35251
|
});
|
|
35252
|
-
await Promise.race([exited, new Promise((
|
|
35252
|
+
await Promise.race([exited, new Promise((resolve38) => setTimeout(resolve38, graceMs))]);
|
|
35253
35253
|
if (child.exitCode == null && child.signalCode == null) {
|
|
35254
35254
|
await killProcessTree(pid, "SIGKILL");
|
|
35255
35255
|
}
|
|
@@ -35266,8 +35266,8 @@ async function gracefulAcpSubprocessDisconnect(params) {
|
|
|
35266
35266
|
await transport.closeSession?.(sessionId);
|
|
35267
35267
|
} catch {
|
|
35268
35268
|
}
|
|
35269
|
-
await new Promise((
|
|
35270
|
-
const timer = setTimeout(
|
|
35269
|
+
await new Promise((resolve38) => {
|
|
35270
|
+
const timer = setTimeout(resolve38, ACP_GRACEFUL_SESSION_CLOSE_WAIT_MS);
|
|
35271
35271
|
timer.unref?.();
|
|
35272
35272
|
});
|
|
35273
35273
|
}
|
|
@@ -35542,11 +35542,11 @@ function createSdkStdioExtNotificationHandler(options) {
|
|
|
35542
35542
|
// src/agents/acp/clients/sdk/sdk-stdio-permission-request-handshake.ts
|
|
35543
35543
|
function awaitSdkStdioPermissionRequestHandshake(params) {
|
|
35544
35544
|
const { requestId, paramsRecord, pending: pending2, onRequest } = params;
|
|
35545
|
-
return new Promise((
|
|
35546
|
-
pending2.set(requestId, { resolve:
|
|
35545
|
+
return new Promise((resolve38) => {
|
|
35546
|
+
pending2.set(requestId, { resolve: resolve38, params: paramsRecord });
|
|
35547
35547
|
if (onRequest == null) {
|
|
35548
35548
|
pending2.delete(requestId);
|
|
35549
|
-
|
|
35549
|
+
resolve38({ outcome: { outcome: "denied" } });
|
|
35550
35550
|
return;
|
|
35551
35551
|
}
|
|
35552
35552
|
try {
|
|
@@ -36058,10 +36058,10 @@ function createSdkStdioInitSettle(child) {
|
|
|
36058
36058
|
forceAcpSubprocessDisconnect(child);
|
|
36059
36059
|
reject(err);
|
|
36060
36060
|
},
|
|
36061
|
-
settleResolve(
|
|
36061
|
+
settleResolve(resolve38, handle) {
|
|
36062
36062
|
if (initSettled) return;
|
|
36063
36063
|
initSettled = true;
|
|
36064
|
-
|
|
36064
|
+
resolve38(handle);
|
|
36065
36065
|
}
|
|
36066
36066
|
};
|
|
36067
36067
|
}
|
|
@@ -36150,7 +36150,7 @@ async function createSdkStdioAcpClient(options) {
|
|
|
36150
36150
|
onFileChange,
|
|
36151
36151
|
stderrCapture
|
|
36152
36152
|
});
|
|
36153
|
-
return new Promise((
|
|
36153
|
+
return new Promise((resolve38, reject) => {
|
|
36154
36154
|
const init = createSdkStdioInitSettle(child);
|
|
36155
36155
|
child.on("error", (err) => {
|
|
36156
36156
|
init.settleReject(reject, new Error(formatSpawnError(err, command[0])));
|
|
@@ -36175,7 +36175,7 @@ async function createSdkStdioAcpClient(options) {
|
|
|
36175
36175
|
protocolVersion: PROTOCOL_VERSION2
|
|
36176
36176
|
});
|
|
36177
36177
|
init.settleResolve(
|
|
36178
|
-
|
|
36178
|
+
resolve38,
|
|
36179
36179
|
createSdkStdioHandle({
|
|
36180
36180
|
child,
|
|
36181
36181
|
sessionId: established.sessionId,
|
|
@@ -36756,7 +36756,7 @@ async function createCursorAcpClient(options) {
|
|
|
36756
36756
|
onFileChange,
|
|
36757
36757
|
stderrCapture
|
|
36758
36758
|
});
|
|
36759
|
-
return new Promise((
|
|
36759
|
+
return new Promise((resolve38, reject) => {
|
|
36760
36760
|
child.on("error", (err) => {
|
|
36761
36761
|
killChildProcessTree(child, "SIGKILL");
|
|
36762
36762
|
reject(new Error(formatSpawnError(err, command[0])));
|
|
@@ -36769,7 +36769,7 @@ async function createCursorAcpClient(options) {
|
|
|
36769
36769
|
skipBrowserAuthenticate,
|
|
36770
36770
|
incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
|
|
36771
36771
|
});
|
|
36772
|
-
|
|
36772
|
+
resolve38(
|
|
36773
36773
|
createCursorAcpHandle({
|
|
36774
36774
|
child,
|
|
36775
36775
|
sessionId: established.sessionId,
|
|
@@ -38208,8 +38208,8 @@ async function runGitTask(fn) {
|
|
|
38208
38208
|
}
|
|
38209
38209
|
async function yieldToEventLoop2() {
|
|
38210
38210
|
throwIfGitShutdownRequested();
|
|
38211
|
-
await new Promise((
|
|
38212
|
-
setImmediate(
|
|
38211
|
+
await new Promise((resolve38) => {
|
|
38212
|
+
setImmediate(resolve38);
|
|
38213
38213
|
});
|
|
38214
38214
|
throwIfGitShutdownRequested();
|
|
38215
38215
|
}
|
|
@@ -38246,8 +38246,8 @@ async function execGitFile(args, options) {
|
|
|
38246
38246
|
}
|
|
38247
38247
|
|
|
38248
38248
|
// src/git/changes/parse/normalize-git-diff-path.ts
|
|
38249
|
-
function normalizeGitDiffPath(
|
|
38250
|
-
return
|
|
38249
|
+
function normalizeGitDiffPath(path88) {
|
|
38250
|
+
return path88.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
|
|
38251
38251
|
}
|
|
38252
38252
|
|
|
38253
38253
|
// src/git/changes/parse/parse-name-status-entries.ts
|
|
@@ -39565,11 +39565,11 @@ function isServerNotRunningError(err) {
|
|
|
39565
39565
|
}
|
|
39566
39566
|
function closeHttpServer(server) {
|
|
39567
39567
|
if (!server) return Promise.resolve();
|
|
39568
|
-
return new Promise((
|
|
39568
|
+
return new Promise((resolve38) => {
|
|
39569
39569
|
server.close((err) => {
|
|
39570
39570
|
if (err && !isServerNotRunningError(err)) {
|
|
39571
39571
|
}
|
|
39572
|
-
|
|
39572
|
+
resolve38();
|
|
39573
39573
|
});
|
|
39574
39574
|
});
|
|
39575
39575
|
}
|
|
@@ -39582,7 +39582,7 @@ var RequestBodyTooLargeError = class extends Error {
|
|
|
39582
39582
|
}
|
|
39583
39583
|
};
|
|
39584
39584
|
function readJsonBody(req) {
|
|
39585
|
-
return new Promise((
|
|
39585
|
+
return new Promise((resolve38, reject) => {
|
|
39586
39586
|
const chunks = [];
|
|
39587
39587
|
let total = 0;
|
|
39588
39588
|
let tooLarge = false;
|
|
@@ -39602,11 +39602,11 @@ function readJsonBody(req) {
|
|
|
39602
39602
|
try {
|
|
39603
39603
|
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
39604
39604
|
if (!raw) {
|
|
39605
|
-
|
|
39605
|
+
resolve38({});
|
|
39606
39606
|
return;
|
|
39607
39607
|
}
|
|
39608
39608
|
const parsed = JSON.parse(raw);
|
|
39609
|
-
|
|
39609
|
+
resolve38(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {});
|
|
39610
39610
|
} catch (e) {
|
|
39611
39611
|
reject(e);
|
|
39612
39612
|
}
|
|
@@ -39664,7 +39664,7 @@ function createBridgeAccessRequestHandler(registry2) {
|
|
|
39664
39664
|
// src/mcp/bridge-access/start-server.ts
|
|
39665
39665
|
function startBridgeAccessServer(registry2) {
|
|
39666
39666
|
const server = http.createServer(createBridgeAccessRequestHandler(registry2));
|
|
39667
|
-
return new Promise((
|
|
39667
|
+
return new Promise((resolve38, reject) => {
|
|
39668
39668
|
server.once("error", reject);
|
|
39669
39669
|
server.listen(0, "127.0.0.1", () => {
|
|
39670
39670
|
const addr = server.address();
|
|
@@ -39672,7 +39672,7 @@ function startBridgeAccessServer(registry2) {
|
|
|
39672
39672
|
reject(new Error("Bridge access server did not bind"));
|
|
39673
39673
|
return;
|
|
39674
39674
|
}
|
|
39675
|
-
|
|
39675
|
+
resolve38({
|
|
39676
39676
|
port: addr.port,
|
|
39677
39677
|
close: () => closeHttpServer(server)
|
|
39678
39678
|
});
|
|
@@ -41311,19 +41311,19 @@ function buildLocalHttpRequestOptions(built) {
|
|
|
41311
41311
|
}
|
|
41312
41312
|
function runLocalHttpRequestOnce(mod, built) {
|
|
41313
41313
|
const opts = buildLocalHttpRequestOptions(built);
|
|
41314
|
-
return new Promise((
|
|
41314
|
+
return new Promise((resolve38) => {
|
|
41315
41315
|
const req = mod.request(opts, (res) => {
|
|
41316
41316
|
const chunks = [];
|
|
41317
41317
|
res.on("data", (chunk) => chunks.push(chunk));
|
|
41318
41318
|
res.on("end", () => {
|
|
41319
|
-
|
|
41319
|
+
resolve38({
|
|
41320
41320
|
statusCode: res.statusCode ?? 0,
|
|
41321
41321
|
headers: incomingMessageHeaders(res),
|
|
41322
41322
|
body: Buffer.concat(chunks)
|
|
41323
41323
|
});
|
|
41324
41324
|
});
|
|
41325
41325
|
res.on("error", (err) => {
|
|
41326
|
-
|
|
41326
|
+
resolve38({
|
|
41327
41327
|
statusCode: 0,
|
|
41328
41328
|
headers: {},
|
|
41329
41329
|
body: Buffer.alloc(0),
|
|
@@ -41335,7 +41335,7 @@ function runLocalHttpRequestOnce(mod, built) {
|
|
|
41335
41335
|
req.destroy(new Error(`Local preview request timed out after ${LOCAL_PROXY_REQUEST_TIMEOUT_MS}ms`));
|
|
41336
41336
|
});
|
|
41337
41337
|
req.on("error", (err) => {
|
|
41338
|
-
|
|
41338
|
+
resolve38({
|
|
41339
41339
|
statusCode: 0,
|
|
41340
41340
|
headers: {},
|
|
41341
41341
|
body: Buffer.alloc(0),
|
|
@@ -41359,14 +41359,14 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41359
41359
|
const isHttps = request.url.startsWith("https:");
|
|
41360
41360
|
const mod = await loadHttpModule(isHttps);
|
|
41361
41361
|
const opts = buildLocalHttpRequestOptions(built);
|
|
41362
|
-
await new Promise((
|
|
41362
|
+
await new Promise((resolve38) => {
|
|
41363
41363
|
const req = mod.request(opts, (res) => {
|
|
41364
41364
|
try {
|
|
41365
41365
|
callbacks.onStart(res.statusCode ?? 0, incomingMessageHeaders(res));
|
|
41366
41366
|
} catch (err) {
|
|
41367
41367
|
req.destroy();
|
|
41368
41368
|
callbacks.onError(err instanceof Error ? err.message : String(err));
|
|
41369
|
-
|
|
41369
|
+
resolve38();
|
|
41370
41370
|
return;
|
|
41371
41371
|
}
|
|
41372
41372
|
res.on("data", (chunk) => {
|
|
@@ -41379,11 +41379,11 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41379
41379
|
});
|
|
41380
41380
|
res.on("end", () => {
|
|
41381
41381
|
callbacks.onEnd();
|
|
41382
|
-
|
|
41382
|
+
resolve38();
|
|
41383
41383
|
});
|
|
41384
41384
|
res.on("error", (err) => {
|
|
41385
41385
|
callbacks.onError(err.message);
|
|
41386
|
-
|
|
41386
|
+
resolve38();
|
|
41387
41387
|
});
|
|
41388
41388
|
});
|
|
41389
41389
|
req.setTimeout(LOCAL_PROXY_REQUEST_TIMEOUT_MS, () => {
|
|
@@ -41391,7 +41391,7 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41391
41391
|
});
|
|
41392
41392
|
req.on("error", (err) => {
|
|
41393
41393
|
callbacks.onError(err.message);
|
|
41394
|
-
|
|
41394
|
+
resolve38();
|
|
41395
41395
|
});
|
|
41396
41396
|
if (built.sendingBody && built.body != null) {
|
|
41397
41397
|
req.write(built.body);
|
|
@@ -42515,8 +42515,8 @@ function pathspec(...paths) {
|
|
|
42515
42515
|
cache.set(key, paths);
|
|
42516
42516
|
return key;
|
|
42517
42517
|
}
|
|
42518
|
-
function isPathSpec(
|
|
42519
|
-
return
|
|
42518
|
+
function isPathSpec(path88) {
|
|
42519
|
+
return path88 instanceof String && cache.has(path88);
|
|
42520
42520
|
}
|
|
42521
42521
|
function toPaths(pathSpec) {
|
|
42522
42522
|
return cache.get(pathSpec) || [];
|
|
@@ -42605,8 +42605,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
42605
42605
|
function forEachLineWithContent(input, callback) {
|
|
42606
42606
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
42607
42607
|
}
|
|
42608
|
-
function folderExists(
|
|
42609
|
-
return (0, import_file_exists.exists)(
|
|
42608
|
+
function folderExists(path88) {
|
|
42609
|
+
return (0, import_file_exists.exists)(path88, import_file_exists.FOLDER);
|
|
42610
42610
|
}
|
|
42611
42611
|
function append(target, item) {
|
|
42612
42612
|
if (Array.isArray(target)) {
|
|
@@ -43010,8 +43010,8 @@ function checkIsRepoRootTask() {
|
|
|
43010
43010
|
commands,
|
|
43011
43011
|
format: "utf-8",
|
|
43012
43012
|
onError,
|
|
43013
|
-
parser(
|
|
43014
|
-
return /^\.(git)?$/.test(
|
|
43013
|
+
parser(path88) {
|
|
43014
|
+
return /^\.(git)?$/.test(path88.trim());
|
|
43015
43015
|
}
|
|
43016
43016
|
};
|
|
43017
43017
|
}
|
|
@@ -43445,11 +43445,11 @@ function parseGrep(grep) {
|
|
|
43445
43445
|
const paths = /* @__PURE__ */ new Set();
|
|
43446
43446
|
const results = {};
|
|
43447
43447
|
forEachLineWithContent(grep, (input) => {
|
|
43448
|
-
const [
|
|
43449
|
-
paths.add(
|
|
43450
|
-
(results[
|
|
43448
|
+
const [path88, line, preview] = input.split(NULL);
|
|
43449
|
+
paths.add(path88);
|
|
43450
|
+
(results[path88] = results[path88] || []).push({
|
|
43451
43451
|
line: asNumber(line),
|
|
43452
|
-
path:
|
|
43452
|
+
path: path88,
|
|
43453
43453
|
preview
|
|
43454
43454
|
});
|
|
43455
43455
|
});
|
|
@@ -44214,14 +44214,14 @@ var init_hash_object = __esm2({
|
|
|
44214
44214
|
init_task();
|
|
44215
44215
|
}
|
|
44216
44216
|
});
|
|
44217
|
-
function parseInit(bare,
|
|
44217
|
+
function parseInit(bare, path88, text) {
|
|
44218
44218
|
const response = String(text).trim();
|
|
44219
44219
|
let result;
|
|
44220
44220
|
if (result = initResponseRegex.exec(response)) {
|
|
44221
|
-
return new InitSummary(bare,
|
|
44221
|
+
return new InitSummary(bare, path88, false, result[1]);
|
|
44222
44222
|
}
|
|
44223
44223
|
if (result = reInitResponseRegex.exec(response)) {
|
|
44224
|
-
return new InitSummary(bare,
|
|
44224
|
+
return new InitSummary(bare, path88, true, result[1]);
|
|
44225
44225
|
}
|
|
44226
44226
|
let gitDir = "";
|
|
44227
44227
|
const tokens = response.split(" ");
|
|
@@ -44232,7 +44232,7 @@ function parseInit(bare, path86, text) {
|
|
|
44232
44232
|
break;
|
|
44233
44233
|
}
|
|
44234
44234
|
}
|
|
44235
|
-
return new InitSummary(bare,
|
|
44235
|
+
return new InitSummary(bare, path88, /^re/i.test(response), gitDir);
|
|
44236
44236
|
}
|
|
44237
44237
|
var InitSummary;
|
|
44238
44238
|
var initResponseRegex;
|
|
@@ -44241,9 +44241,9 @@ var init_InitSummary = __esm2({
|
|
|
44241
44241
|
"src/lib/responses/InitSummary.ts"() {
|
|
44242
44242
|
"use strict";
|
|
44243
44243
|
InitSummary = class {
|
|
44244
|
-
constructor(bare,
|
|
44244
|
+
constructor(bare, path88, existing, gitDir) {
|
|
44245
44245
|
this.bare = bare;
|
|
44246
|
-
this.path =
|
|
44246
|
+
this.path = path88;
|
|
44247
44247
|
this.existing = existing;
|
|
44248
44248
|
this.gitDir = gitDir;
|
|
44249
44249
|
}
|
|
@@ -44255,7 +44255,7 @@ var init_InitSummary = __esm2({
|
|
|
44255
44255
|
function hasBareCommand(command) {
|
|
44256
44256
|
return command.includes(bareCommand);
|
|
44257
44257
|
}
|
|
44258
|
-
function initTask(bare = false,
|
|
44258
|
+
function initTask(bare = false, path88, customArgs) {
|
|
44259
44259
|
const commands = ["init", ...customArgs];
|
|
44260
44260
|
if (bare && !hasBareCommand(commands)) {
|
|
44261
44261
|
commands.splice(1, 0, bareCommand);
|
|
@@ -44264,7 +44264,7 @@ function initTask(bare = false, path86, customArgs) {
|
|
|
44264
44264
|
commands,
|
|
44265
44265
|
format: "utf-8",
|
|
44266
44266
|
parser(text) {
|
|
44267
|
-
return parseInit(commands.includes("--bare"),
|
|
44267
|
+
return parseInit(commands.includes("--bare"), path88, text);
|
|
44268
44268
|
}
|
|
44269
44269
|
};
|
|
44270
44270
|
}
|
|
@@ -45080,12 +45080,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
45080
45080
|
"use strict";
|
|
45081
45081
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
45082
45082
|
FileStatusSummary = class {
|
|
45083
|
-
constructor(
|
|
45084
|
-
this.path =
|
|
45083
|
+
constructor(path88, index, working_dir) {
|
|
45084
|
+
this.path = path88;
|
|
45085
45085
|
this.index = index;
|
|
45086
45086
|
this.working_dir = working_dir;
|
|
45087
45087
|
if (index === "R" || working_dir === "R") {
|
|
45088
|
-
const detail = fromPathRegex.exec(
|
|
45088
|
+
const detail = fromPathRegex.exec(path88) || [null, path88, path88];
|
|
45089
45089
|
this.from = detail[2] || "";
|
|
45090
45090
|
this.path = detail[1] || "";
|
|
45091
45091
|
}
|
|
@@ -45116,14 +45116,14 @@ function splitLine(result, lineStr) {
|
|
|
45116
45116
|
default:
|
|
45117
45117
|
return;
|
|
45118
45118
|
}
|
|
45119
|
-
function data(index, workingDir,
|
|
45119
|
+
function data(index, workingDir, path88) {
|
|
45120
45120
|
const raw = `${index}${workingDir}`;
|
|
45121
45121
|
const handler = parsers6.get(raw);
|
|
45122
45122
|
if (handler) {
|
|
45123
|
-
handler(result,
|
|
45123
|
+
handler(result, path88);
|
|
45124
45124
|
}
|
|
45125
45125
|
if (raw !== "##" && raw !== "!!") {
|
|
45126
|
-
result.files.push(new FileStatusSummary(
|
|
45126
|
+
result.files.push(new FileStatusSummary(path88, index, workingDir));
|
|
45127
45127
|
}
|
|
45128
45128
|
}
|
|
45129
45129
|
}
|
|
@@ -45432,9 +45432,9 @@ var init_simple_git_api = __esm2({
|
|
|
45432
45432
|
next
|
|
45433
45433
|
);
|
|
45434
45434
|
}
|
|
45435
|
-
hashObject(
|
|
45435
|
+
hashObject(path88, write) {
|
|
45436
45436
|
return this._runTask(
|
|
45437
|
-
hashObjectTask(
|
|
45437
|
+
hashObjectTask(path88, write === true),
|
|
45438
45438
|
trailingFunctionArgument(arguments)
|
|
45439
45439
|
);
|
|
45440
45440
|
}
|
|
@@ -45787,8 +45787,8 @@ var init_branch = __esm2({
|
|
|
45787
45787
|
}
|
|
45788
45788
|
});
|
|
45789
45789
|
function toPath(input) {
|
|
45790
|
-
const
|
|
45791
|
-
return
|
|
45790
|
+
const path88 = input.trim().replace(/^["']|["']$/g, "");
|
|
45791
|
+
return path88 && normalize3(path88);
|
|
45792
45792
|
}
|
|
45793
45793
|
var parseCheckIgnore;
|
|
45794
45794
|
var init_CheckIgnore = __esm2({
|
|
@@ -46102,8 +46102,8 @@ __export2(sub_module_exports, {
|
|
|
46102
46102
|
subModuleTask: () => subModuleTask,
|
|
46103
46103
|
updateSubModuleTask: () => updateSubModuleTask
|
|
46104
46104
|
});
|
|
46105
|
-
function addSubModuleTask(repo,
|
|
46106
|
-
return subModuleTask(["add", repo,
|
|
46105
|
+
function addSubModuleTask(repo, path88) {
|
|
46106
|
+
return subModuleTask(["add", repo, path88]);
|
|
46107
46107
|
}
|
|
46108
46108
|
function initSubModuleTask(customArgs) {
|
|
46109
46109
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -46436,8 +46436,8 @@ var require_git = __commonJS2({
|
|
|
46436
46436
|
}
|
|
46437
46437
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
46438
46438
|
};
|
|
46439
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
46440
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
46439
|
+
Git2.prototype.submoduleAdd = function(repo, path88, then) {
|
|
46440
|
+
return this._runTask(addSubModuleTask2(repo, path88), trailingFunctionArgument2(arguments));
|
|
46441
46441
|
};
|
|
46442
46442
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
46443
46443
|
return this._runTask(
|
|
@@ -47176,8 +47176,8 @@ function parseNumstatEntries(lines) {
|
|
|
47176
47176
|
}
|
|
47177
47177
|
function parseNumstat(lines) {
|
|
47178
47178
|
const m = /* @__PURE__ */ new Map();
|
|
47179
|
-
for (const [
|
|
47180
|
-
m.set(
|
|
47179
|
+
for (const [path88, entry] of parseNumstatEntries(lines)) {
|
|
47180
|
+
m.set(path88, { additions: entry.additions, deletions: entry.deletions });
|
|
47181
47181
|
}
|
|
47182
47182
|
return m;
|
|
47183
47183
|
}
|
|
@@ -51265,7 +51265,7 @@ init_symbol_index_file_ready();
|
|
|
51265
51265
|
var CODE_NAV_INDEX_READY_WAIT_MS = 75;
|
|
51266
51266
|
var CODE_NAV_INDEX_READY_POLL_MS = 15;
|
|
51267
51267
|
function delay2(ms) {
|
|
51268
|
-
return new Promise((
|
|
51268
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
51269
51269
|
}
|
|
51270
51270
|
async function waitForSymbolIndexReady(sessionParentPath, reqPath, maxWaitMs = CODE_NAV_INDEX_READY_WAIT_MS) {
|
|
51271
51271
|
const deadline = Date.now() + maxWaitMs;
|
|
@@ -51397,12 +51397,12 @@ function parseOptionalInt2(raw) {
|
|
|
51397
51397
|
return Number.isInteger(parsed) ? parsed : void 0;
|
|
51398
51398
|
}
|
|
51399
51399
|
function parseCodeNavParams(url2) {
|
|
51400
|
-
const
|
|
51400
|
+
const path88 = url2.searchParams.get("path") ?? "";
|
|
51401
51401
|
const opRaw = url2.searchParams.get("op")?.trim();
|
|
51402
51402
|
const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
|
|
51403
51403
|
const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
|
|
51404
51404
|
const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
|
|
51405
|
-
return { path:
|
|
51405
|
+
return { path: path88, op, line, column };
|
|
51406
51406
|
}
|
|
51407
51407
|
function parseCodeNavPath(url2) {
|
|
51408
51408
|
const raw = url2.searchParams.get("path")?.trim();
|
|
@@ -51578,7 +51578,7 @@ function createLocalShortcutRequestHandler(ctx) {
|
|
|
51578
51578
|
var RESTART_DELAY_MS = 250;
|
|
51579
51579
|
var MAX_RESTART_ATTEMPTS = 5;
|
|
51580
51580
|
function listenOnPort(server, port) {
|
|
51581
|
-
return new Promise((
|
|
51581
|
+
return new Promise((resolve38, reject) => {
|
|
51582
51582
|
server.once("error", reject);
|
|
51583
51583
|
server.listen(port, "127.0.0.1", () => {
|
|
51584
51584
|
const addr = server.address();
|
|
@@ -51586,12 +51586,12 @@ function listenOnPort(server, port) {
|
|
|
51586
51586
|
reject(new Error("Local shortcut server did not bind"));
|
|
51587
51587
|
return;
|
|
51588
51588
|
}
|
|
51589
|
-
|
|
51589
|
+
resolve38(addr.port);
|
|
51590
51590
|
});
|
|
51591
51591
|
});
|
|
51592
51592
|
}
|
|
51593
51593
|
function delay3(ms) {
|
|
51594
|
-
return new Promise((
|
|
51594
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
51595
51595
|
}
|
|
51596
51596
|
function startLocalShortcutServer(ctx) {
|
|
51597
51597
|
let closed = false;
|
|
@@ -51791,7 +51791,8 @@ var API_TO_BRIDGE_MESSAGE_TYPES = [
|
|
|
51791
51791
|
"install_agent",
|
|
51792
51792
|
"refresh_local_skills",
|
|
51793
51793
|
"bridge_git_context_request",
|
|
51794
|
-
"list_repo_branches_request"
|
|
51794
|
+
"list_repo_branches_request",
|
|
51795
|
+
"bridge_git_checkout_request"
|
|
51795
51796
|
];
|
|
51796
51797
|
var API_TO_BRIDGE_TYPE_SET = new Set(API_TO_BRIDGE_MESSAGE_TYPES);
|
|
51797
51798
|
function parseApiToBridgeMessage(data, log2) {
|
|
@@ -52484,10 +52485,10 @@ async function awaitGitStatePreparation(options) {
|
|
|
52484
52485
|
try {
|
|
52485
52486
|
return await Promise.race([
|
|
52486
52487
|
work,
|
|
52487
|
-
new Promise((
|
|
52488
|
+
new Promise((resolve38) => {
|
|
52488
52489
|
timer = setTimeout(() => {
|
|
52489
52490
|
log2(`[Agent] ${label} exceeded ${timeoutMs}ms; continuing without it.`);
|
|
52490
|
-
|
|
52491
|
+
resolve38(fallback);
|
|
52491
52492
|
}, timeoutMs);
|
|
52492
52493
|
timer.unref?.();
|
|
52493
52494
|
})
|
|
@@ -53050,8 +53051,8 @@ function randomSecret() {
|
|
|
53050
53051
|
}
|
|
53051
53052
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
53052
53053
|
}
|
|
53053
|
-
async function requestPreviewApi(port, secret, method,
|
|
53054
|
-
const url2 = `http://127.0.0.1:${port}${
|
|
53054
|
+
async function requestPreviewApi(port, secret, method, path88, body) {
|
|
53055
|
+
const url2 = `http://127.0.0.1:${port}${path88}`;
|
|
53055
53056
|
const headers = {
|
|
53056
53057
|
[PREVIEW_SECRET_HEADER]: secret,
|
|
53057
53058
|
"Content-Type": "application/json"
|
|
@@ -53063,7 +53064,7 @@ async function requestPreviewApi(port, secret, method, path86, body) {
|
|
|
53063
53064
|
});
|
|
53064
53065
|
const data = await res.json().catch(() => ({}));
|
|
53065
53066
|
if (!res.ok) {
|
|
53066
|
-
throw new Error(data?.error ?? `Preview API ${method} ${
|
|
53067
|
+
throw new Error(data?.error ?? `Preview API ${method} ${path88}: ${res.status}`);
|
|
53067
53068
|
}
|
|
53068
53069
|
return data;
|
|
53069
53070
|
}
|
|
@@ -53320,7 +53321,7 @@ var handleInstallSkillsMessage = (msg, deps) => {
|
|
|
53320
53321
|
import { spawn as spawn11 } from "node:child_process";
|
|
53321
53322
|
import * as readline3 from "node:readline";
|
|
53322
53323
|
function runStreamingCommand(command, args, options) {
|
|
53323
|
-
return new Promise((
|
|
53324
|
+
return new Promise((resolve38, reject) => {
|
|
53324
53325
|
const child = spawn11(command, args, {
|
|
53325
53326
|
env: options.env,
|
|
53326
53327
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -53353,7 +53354,7 @@ function runStreamingCommand(command, args, options) {
|
|
|
53353
53354
|
if (timer) clearTimeout(timer);
|
|
53354
53355
|
if (!settled) {
|
|
53355
53356
|
settled = true;
|
|
53356
|
-
|
|
53357
|
+
resolve38({ code, signal });
|
|
53357
53358
|
}
|
|
53358
53359
|
});
|
|
53359
53360
|
});
|
|
@@ -53792,6 +53793,23 @@ async function listRepoBranchRefs(repoPath) {
|
|
|
53792
53793
|
}
|
|
53793
53794
|
}
|
|
53794
53795
|
|
|
53796
|
+
// src/git/checkout/pending-checkouts.ts
|
|
53797
|
+
var pendingByRelPath = /* @__PURE__ */ new Map();
|
|
53798
|
+
function beginPendingCheckout(row) {
|
|
53799
|
+
const relPath = row.relPath.trim() || ".";
|
|
53800
|
+
pendingByRelPath.set(relPath, {
|
|
53801
|
+
relPath,
|
|
53802
|
+
folderName: row.folderName.trim() || (relPath === "." ? "repo" : relPath),
|
|
53803
|
+
remoteUrl: row.remoteUrl
|
|
53804
|
+
});
|
|
53805
|
+
}
|
|
53806
|
+
function endPendingCheckout(relPath) {
|
|
53807
|
+
pendingByRelPath.delete(relPath.trim() || ".");
|
|
53808
|
+
}
|
|
53809
|
+
function listPendingCheckouts() {
|
|
53810
|
+
return [...pendingByRelPath.values()];
|
|
53811
|
+
}
|
|
53812
|
+
|
|
53795
53813
|
// src/git/bridge-git-context.ts
|
|
53796
53814
|
function folderNameForRelPath(relPath, bridgeRoot) {
|
|
53797
53815
|
if (relPath === "." || relPath === "") {
|
|
@@ -53828,7 +53846,23 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
|
|
|
53828
53846
|
relPath,
|
|
53829
53847
|
folderName: folderNameForRelPath(relPath, bridgeResolved),
|
|
53830
53848
|
currentBranch,
|
|
53831
|
-
remoteUrl
|
|
53849
|
+
remoteUrl,
|
|
53850
|
+
cloning: false
|
|
53851
|
+
});
|
|
53852
|
+
}
|
|
53853
|
+
const seen = new Set(rows.map((r) => r.relPath));
|
|
53854
|
+
for (const pending2 of listPendingCheckouts()) {
|
|
53855
|
+
if (seen.has(pending2.relPath)) {
|
|
53856
|
+
const row = rows.find((r) => r.relPath === pending2.relPath);
|
|
53857
|
+
if (row) row.cloning = true;
|
|
53858
|
+
continue;
|
|
53859
|
+
}
|
|
53860
|
+
rows.push({
|
|
53861
|
+
relPath: pending2.relPath,
|
|
53862
|
+
folderName: pending2.folderName,
|
|
53863
|
+
currentBranch: null,
|
|
53864
|
+
remoteUrl: pending2.remoteUrl,
|
|
53865
|
+
cloning: true
|
|
53832
53866
|
});
|
|
53833
53867
|
}
|
|
53834
53868
|
rows.sort((a, b) => a.relPath.localeCompare(b.relPath));
|
|
@@ -53888,6 +53922,143 @@ function handleListRepoBranchesRequestMessage(msg, getWs) {
|
|
|
53888
53922
|
})();
|
|
53889
53923
|
}
|
|
53890
53924
|
|
|
53925
|
+
// src/git/checkout/bridge-git-checkout.ts
|
|
53926
|
+
import * as fs65 from "node:fs/promises";
|
|
53927
|
+
import * as path86 from "node:path";
|
|
53928
|
+
|
|
53929
|
+
// src/git/checkout/normalize-clone-url.ts
|
|
53930
|
+
function normalizeCloneUrl(url2) {
|
|
53931
|
+
const u = url2.trim();
|
|
53932
|
+
if (!u.startsWith("http://") && !u.startsWith("https://")) {
|
|
53933
|
+
throw new Error("Only http(s) git remote URLs are supported");
|
|
53934
|
+
}
|
|
53935
|
+
return u.endsWith(".git") ? u : `${u}.git`;
|
|
53936
|
+
}
|
|
53937
|
+
function cloneUrlWithHttpsAuth(url2, auth) {
|
|
53938
|
+
const normalized = normalizeCloneUrl(url2);
|
|
53939
|
+
if (!auth) return normalized;
|
|
53940
|
+
const parsed = new URL(normalized);
|
|
53941
|
+
parsed.username = auth.username;
|
|
53942
|
+
parsed.password = auth.password;
|
|
53943
|
+
return parsed.toString();
|
|
53944
|
+
}
|
|
53945
|
+
|
|
53946
|
+
// src/git/checkout/resolve-checkout-target.ts
|
|
53947
|
+
import * as fs64 from "node:fs/promises";
|
|
53948
|
+
import * as path85 from "node:path";
|
|
53949
|
+
var FOLDER_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
53950
|
+
async function pathExists(p) {
|
|
53951
|
+
try {
|
|
53952
|
+
await fs64.access(p);
|
|
53953
|
+
return true;
|
|
53954
|
+
} catch {
|
|
53955
|
+
return false;
|
|
53956
|
+
}
|
|
53957
|
+
}
|
|
53958
|
+
async function resolveCheckoutTarget(opts) {
|
|
53959
|
+
const bridgeRoot = getBridgeRoot();
|
|
53960
|
+
if (opts.layout === "monorepo") {
|
|
53961
|
+
if (await isGitRepoDirectory(bridgeRoot)) {
|
|
53962
|
+
throw new Error("Bridge root is already a git repository");
|
|
53963
|
+
}
|
|
53964
|
+
const entries = await fs64.readdir(bridgeRoot).catch(() => []);
|
|
53965
|
+
if (entries.length > 0) {
|
|
53966
|
+
throw new Error("Bridge root must be empty to initialize a monorepo checkout");
|
|
53967
|
+
}
|
|
53968
|
+
return { targetDir: bridgeRoot, relPath: "." };
|
|
53969
|
+
}
|
|
53970
|
+
const folder = (opts.folderName ?? "").trim();
|
|
53971
|
+
if (!folder || folder === "." || folder === ".." || !FOLDER_NAME_RE.test(folder)) {
|
|
53972
|
+
throw new Error("folderName must be a single path segment (letters, numbers, . _ -)");
|
|
53973
|
+
}
|
|
53974
|
+
if (await isGitRepoDirectory(bridgeRoot)) {
|
|
53975
|
+
throw new Error("Cannot add a nested repo while the bridge root is itself a git repository");
|
|
53976
|
+
}
|
|
53977
|
+
const targetDir = path85.resolve(bridgeRoot, folder);
|
|
53978
|
+
if (!targetDir.startsWith(bridgeRoot + path85.sep)) {
|
|
53979
|
+
throw new Error("Invalid folderName");
|
|
53980
|
+
}
|
|
53981
|
+
if (await pathExists(targetDir)) {
|
|
53982
|
+
throw new Error(`Folder already exists: ${folder}`);
|
|
53983
|
+
}
|
|
53984
|
+
return { targetDir, relPath: folder };
|
|
53985
|
+
}
|
|
53986
|
+
|
|
53987
|
+
// src/git/checkout/bridge-git-checkout.ts
|
|
53988
|
+
async function bridgeGitCheckout(params) {
|
|
53989
|
+
const cloneUrl = (params.cloneUrl ?? "").trim();
|
|
53990
|
+
if (!cloneUrl) throw new Error("cloneUrl required");
|
|
53991
|
+
const { targetDir, relPath } = await resolveCheckoutTarget({
|
|
53992
|
+
layout: params.layout,
|
|
53993
|
+
folderName: params.folderName
|
|
53994
|
+
});
|
|
53995
|
+
const folderName = relPath === "." ? "repo" : relPath;
|
|
53996
|
+
beginPendingCheckout({ relPath, folderName, remoteUrl: cloneUrl });
|
|
53997
|
+
const parent = path86.dirname(targetDir);
|
|
53998
|
+
await fs65.mkdir(parent, { recursive: true });
|
|
53999
|
+
if (relPath !== ".") {
|
|
54000
|
+
await fs65.mkdir(targetDir, { recursive: true });
|
|
54001
|
+
}
|
|
54002
|
+
const url2 = cloneUrlWithHttpsAuth(cloneUrl, params.auth ?? null);
|
|
54003
|
+
try {
|
|
54004
|
+
await execGitFile(["clone", "--", url2, targetDir], {
|
|
54005
|
+
cwd: parent,
|
|
54006
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
54007
|
+
});
|
|
54008
|
+
return { relPath, folderName };
|
|
54009
|
+
} catch (e) {
|
|
54010
|
+
if (relPath !== ".") {
|
|
54011
|
+
await fs65.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
|
|
54012
|
+
}
|
|
54013
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
54014
|
+
throw new Error(
|
|
54015
|
+
msg.includes("Authentication") || msg.includes("403") || msg.includes("401") ? `Clone failed (auth?): ${msg}` : `Clone failed: ${msg}`
|
|
54016
|
+
);
|
|
54017
|
+
} finally {
|
|
54018
|
+
endPendingCheckout(relPath);
|
|
54019
|
+
}
|
|
54020
|
+
}
|
|
54021
|
+
|
|
54022
|
+
// src/routing/handlers/bridge-git-checkout-messages.ts
|
|
54023
|
+
function handleBridgeGitCheckoutRequestMessage(msg, getWs) {
|
|
54024
|
+
void (async () => {
|
|
54025
|
+
const socket = getWs();
|
|
54026
|
+
if (!socket) return;
|
|
54027
|
+
const layout = msg.layout === "multi_repo" ? "multi_repo" : msg.layout === "monorepo" ? "monorepo" : null;
|
|
54028
|
+
if (!layout) {
|
|
54029
|
+
sendWsMessage(socket, {
|
|
54030
|
+
type: "bridge_git_checkout_response",
|
|
54031
|
+
id: msg.id,
|
|
54032
|
+
error: "layout must be monorepo or multi_repo"
|
|
54033
|
+
});
|
|
54034
|
+
return;
|
|
54035
|
+
}
|
|
54036
|
+
try {
|
|
54037
|
+
const user = typeof msg.authUsername === "string" ? msg.authUsername : "";
|
|
54038
|
+
const pass = typeof msg.authPassword === "string" ? msg.authPassword : "";
|
|
54039
|
+
const result = await bridgeGitCheckout({
|
|
54040
|
+
layout,
|
|
54041
|
+
folderName: msg.folderName,
|
|
54042
|
+
cloneUrl: msg.cloneUrl ?? "",
|
|
54043
|
+
auth: user && pass ? { username: user, password: pass } : null
|
|
54044
|
+
});
|
|
54045
|
+
sendWsMessage(socket, {
|
|
54046
|
+
type: "bridge_git_checkout_response",
|
|
54047
|
+
id: msg.id,
|
|
54048
|
+
ok: true,
|
|
54049
|
+
relPath: result.relPath,
|
|
54050
|
+
folderName: result.folderName
|
|
54051
|
+
});
|
|
54052
|
+
} catch (e) {
|
|
54053
|
+
sendWsMessage(socket, {
|
|
54054
|
+
type: "bridge_git_checkout_response",
|
|
54055
|
+
id: msg.id,
|
|
54056
|
+
error: e instanceof Error ? e.message : String(e)
|
|
54057
|
+
});
|
|
54058
|
+
}
|
|
54059
|
+
})();
|
|
54060
|
+
}
|
|
54061
|
+
|
|
53891
54062
|
// src/routing/dispatch/file-browser.ts
|
|
53892
54063
|
function dispatchBridgeFileBrowserMessage(msg, deps) {
|
|
53893
54064
|
switch (msg.type) {
|
|
@@ -53906,6 +54077,9 @@ function dispatchBridgeFileBrowserMessage(msg, deps) {
|
|
|
53906
54077
|
case "list_repo_branches_request":
|
|
53907
54078
|
handleListRepoBranchesRequestMessage(msg, deps.getWs);
|
|
53908
54079
|
break;
|
|
54080
|
+
case "bridge_git_checkout_request":
|
|
54081
|
+
handleBridgeGitCheckoutRequestMessage(msg, deps.getWs);
|
|
54082
|
+
break;
|
|
53909
54083
|
}
|
|
53910
54084
|
}
|
|
53911
54085
|
|
|
@@ -53946,6 +54120,7 @@ function dispatchBridgeMessage(msg, deps) {
|
|
|
53946
54120
|
case "code_nav":
|
|
53947
54121
|
case "bridge_git_context_request":
|
|
53948
54122
|
case "list_repo_branches_request":
|
|
54123
|
+
case "bridge_git_checkout_request":
|
|
53949
54124
|
dispatchBridgeFileBrowserMessage(msg, deps);
|
|
53950
54125
|
break;
|
|
53951
54126
|
}
|
|
@@ -54411,12 +54586,12 @@ async function runConnectedBridge(options, restartWithoutAuth) {
|
|
|
54411
54586
|
let cleanupKeyCommand;
|
|
54412
54587
|
let bridgeClose = null;
|
|
54413
54588
|
let endConnectedSession;
|
|
54414
|
-
const sessionDone = new Promise((
|
|
54415
|
-
endConnectedSession =
|
|
54589
|
+
const sessionDone = new Promise((resolve38) => {
|
|
54590
|
+
endConnectedSession = resolve38;
|
|
54416
54591
|
});
|
|
54417
54592
|
let resolveHandleReady;
|
|
54418
|
-
const handleReady = new Promise((
|
|
54419
|
-
resolveHandleReady =
|
|
54593
|
+
const handleReady = new Promise((resolve38) => {
|
|
54594
|
+
resolveHandleReady = resolve38;
|
|
54420
54595
|
});
|
|
54421
54596
|
const handleRef = { current: null };
|
|
54422
54597
|
const signals = installConnectedBridgeSignals({
|
|
@@ -54567,9 +54742,9 @@ async function runCliAction(program2, opts) {
|
|
|
54567
54742
|
const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAUTOMATON_FIREHOSE_URL ?? process.env.BUILDAUTOMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
|
|
54568
54743
|
const bridgeRootOpt = (opts.bridgeRoot && typeof opts.bridgeRoot === "string" && opts.bridgeRoot.trim() ? opts.bridgeRoot.trim() : null) ?? (opts.cwd && typeof opts.cwd === "string" && opts.cwd.trim() ? opts.cwd.trim() : null);
|
|
54569
54744
|
if (bridgeRootOpt) {
|
|
54570
|
-
const resolvedBridgeRoot =
|
|
54745
|
+
const resolvedBridgeRoot = path87.resolve(process.cwd(), bridgeRootOpt);
|
|
54571
54746
|
try {
|
|
54572
|
-
const st =
|
|
54747
|
+
const st = fs66.statSync(resolvedBridgeRoot);
|
|
54573
54748
|
if (!st.isDirectory()) {
|
|
54574
54749
|
console.error(`Bridge root is not a directory: ${resolvedBridgeRoot}`);
|
|
54575
54750
|
process.exit(1);
|
|
@@ -54589,7 +54764,7 @@ async function runCliAction(program2, opts) {
|
|
|
54589
54764
|
);
|
|
54590
54765
|
let worktreesRootPath;
|
|
54591
54766
|
if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
|
|
54592
|
-
worktreesRootPath =
|
|
54767
|
+
worktreesRootPath = path87.resolve(opts.worktreesRoot.trim());
|
|
54593
54768
|
}
|
|
54594
54769
|
const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
|
|
54595
54770
|
if (e2eCertificates) {
|