@buildautomaton/cli 0.1.80 → 0.1.82
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 +388 -189
- package/dist/cli.js.map +4 -4
- package/dist/index.js +367 -168
- 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.82".length > 0 ? "0.1.82" : "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,
|
|
@@ -35153,21 +35153,45 @@ async function execProbeShutdownAware(file2, args, timeoutMs) {
|
|
|
35153
35153
|
}
|
|
35154
35154
|
}
|
|
35155
35155
|
|
|
35156
|
+
// src/agents/acp/clients/format-stderr-for-terminal.ts
|
|
35157
|
+
var STDERR_TERMINAL_CHUNK_MAX = 400;
|
|
35158
|
+
function formatStderrForTerminal(text, maxChars = STDERR_TERMINAL_CHUNK_MAX) {
|
|
35159
|
+
if (!text) return text;
|
|
35160
|
+
const bodyIdx = text.indexOf("; body:");
|
|
35161
|
+
if (bodyIdx >= 0) {
|
|
35162
|
+
const s = `${text.slice(0, bodyIdx)}; body: [omitted]`;
|
|
35163
|
+
return s.length <= maxChars ? `${s}
|
|
35164
|
+
` : `${s.slice(0, maxChars)}\u2026 [stderr truncated]
|
|
35165
|
+
`;
|
|
35166
|
+
}
|
|
35167
|
+
const trimmed2 = text.trimStart();
|
|
35168
|
+
if (text.length > maxChars && (trimmed2.startsWith("{") || trimmed2.startsWith('"') || trimmed2.startsWith("["))) {
|
|
35169
|
+
return "";
|
|
35170
|
+
}
|
|
35171
|
+
if (text.length <= maxChars) return text;
|
|
35172
|
+
return `${text.slice(0, maxChars)}\u2026 [stderr truncated]
|
|
35173
|
+
`;
|
|
35174
|
+
}
|
|
35175
|
+
|
|
35156
35176
|
// src/agents/acp/clients/agent-stderr-capture.ts
|
|
35157
|
-
var STDERR_CAPTURE_MAX =
|
|
35158
|
-
function createStderrCapture(
|
|
35177
|
+
var STDERR_CAPTURE_MAX = 4e3;
|
|
35178
|
+
function createStderrCapture(_child) {
|
|
35159
35179
|
const chunks = [];
|
|
35160
35180
|
let total = 0;
|
|
35161
35181
|
return {
|
|
35162
35182
|
append(chunk) {
|
|
35163
|
-
|
|
35164
|
-
|
|
35165
|
-
|
|
35183
|
+
const forTerminal = formatStderrForTerminal(chunk.toString("utf8"));
|
|
35184
|
+
if (forTerminal) {
|
|
35185
|
+
try {
|
|
35186
|
+
process.stderr.write(forTerminal);
|
|
35187
|
+
} catch {
|
|
35188
|
+
}
|
|
35166
35189
|
}
|
|
35167
|
-
if (total >= STDERR_CAPTURE_MAX) return;
|
|
35168
|
-
const
|
|
35190
|
+
if (!forTerminal || total >= STDERR_CAPTURE_MAX) return;
|
|
35191
|
+
const buf = Buffer.from(forTerminal, "utf8");
|
|
35192
|
+
const n = Math.min(buf.length, STDERR_CAPTURE_MAX - total);
|
|
35169
35193
|
if (n <= 0) return;
|
|
35170
|
-
chunks.push(n ===
|
|
35194
|
+
chunks.push(n === buf.length ? buf : buf.subarray(0, n));
|
|
35171
35195
|
total += n;
|
|
35172
35196
|
},
|
|
35173
35197
|
getText() {
|
|
@@ -35246,10 +35270,10 @@ async function killChildProcessTreeGracefully(child, graceMs = ACP_PROCESS_TREE_
|
|
|
35246
35270
|
}
|
|
35247
35271
|
await killProcessTree(pid, "SIGTERM");
|
|
35248
35272
|
if (graceMs <= 0) return;
|
|
35249
|
-
const exited = new Promise((
|
|
35250
|
-
child.once("exit", () =>
|
|
35273
|
+
const exited = new Promise((resolve38) => {
|
|
35274
|
+
child.once("exit", () => resolve38());
|
|
35251
35275
|
});
|
|
35252
|
-
await Promise.race([exited, new Promise((
|
|
35276
|
+
await Promise.race([exited, new Promise((resolve38) => setTimeout(resolve38, graceMs))]);
|
|
35253
35277
|
if (child.exitCode == null && child.signalCode == null) {
|
|
35254
35278
|
await killProcessTree(pid, "SIGKILL");
|
|
35255
35279
|
}
|
|
@@ -35266,8 +35290,8 @@ async function gracefulAcpSubprocessDisconnect(params) {
|
|
|
35266
35290
|
await transport.closeSession?.(sessionId);
|
|
35267
35291
|
} catch {
|
|
35268
35292
|
}
|
|
35269
|
-
await new Promise((
|
|
35270
|
-
const timer = setTimeout(
|
|
35293
|
+
await new Promise((resolve38) => {
|
|
35294
|
+
const timer = setTimeout(resolve38, ACP_GRACEFUL_SESSION_CLOSE_WAIT_MS);
|
|
35271
35295
|
timer.unref?.();
|
|
35272
35296
|
});
|
|
35273
35297
|
}
|
|
@@ -35542,11 +35566,11 @@ function createSdkStdioExtNotificationHandler(options) {
|
|
|
35542
35566
|
// src/agents/acp/clients/sdk/sdk-stdio-permission-request-handshake.ts
|
|
35543
35567
|
function awaitSdkStdioPermissionRequestHandshake(params) {
|
|
35544
35568
|
const { requestId, paramsRecord, pending: pending2, onRequest } = params;
|
|
35545
|
-
return new Promise((
|
|
35546
|
-
pending2.set(requestId, { resolve:
|
|
35569
|
+
return new Promise((resolve38) => {
|
|
35570
|
+
pending2.set(requestId, { resolve: resolve38, params: paramsRecord });
|
|
35547
35571
|
if (onRequest == null) {
|
|
35548
35572
|
pending2.delete(requestId);
|
|
35549
|
-
|
|
35573
|
+
resolve38({ outcome: { outcome: "denied" } });
|
|
35550
35574
|
return;
|
|
35551
35575
|
}
|
|
35552
35576
|
try {
|
|
@@ -36058,10 +36082,10 @@ function createSdkStdioInitSettle(child) {
|
|
|
36058
36082
|
forceAcpSubprocessDisconnect(child);
|
|
36059
36083
|
reject(err);
|
|
36060
36084
|
},
|
|
36061
|
-
settleResolve(
|
|
36085
|
+
settleResolve(resolve38, handle) {
|
|
36062
36086
|
if (initSettled) return;
|
|
36063
36087
|
initSettled = true;
|
|
36064
|
-
|
|
36088
|
+
resolve38(handle);
|
|
36065
36089
|
}
|
|
36066
36090
|
};
|
|
36067
36091
|
}
|
|
@@ -36150,7 +36174,7 @@ async function createSdkStdioAcpClient(options) {
|
|
|
36150
36174
|
onFileChange,
|
|
36151
36175
|
stderrCapture
|
|
36152
36176
|
});
|
|
36153
|
-
return new Promise((
|
|
36177
|
+
return new Promise((resolve38, reject) => {
|
|
36154
36178
|
const init = createSdkStdioInitSettle(child);
|
|
36155
36179
|
child.on("error", (err) => {
|
|
36156
36180
|
init.settleReject(reject, new Error(formatSpawnError(err, command[0])));
|
|
@@ -36175,7 +36199,7 @@ async function createSdkStdioAcpClient(options) {
|
|
|
36175
36199
|
protocolVersion: PROTOCOL_VERSION2
|
|
36176
36200
|
});
|
|
36177
36201
|
init.settleResolve(
|
|
36178
|
-
|
|
36202
|
+
resolve38,
|
|
36179
36203
|
createSdkStdioHandle({
|
|
36180
36204
|
child,
|
|
36181
36205
|
sessionId: established.sessionId,
|
|
@@ -36756,7 +36780,7 @@ async function createCursorAcpClient(options) {
|
|
|
36756
36780
|
onFileChange,
|
|
36757
36781
|
stderrCapture
|
|
36758
36782
|
});
|
|
36759
|
-
return new Promise((
|
|
36783
|
+
return new Promise((resolve38, reject) => {
|
|
36760
36784
|
child.on("error", (err) => {
|
|
36761
36785
|
killChildProcessTree(child, "SIGKILL");
|
|
36762
36786
|
reject(new Error(formatSpawnError(err, command[0])));
|
|
@@ -36769,7 +36793,7 @@ async function createCursorAcpClient(options) {
|
|
|
36769
36793
|
skipBrowserAuthenticate,
|
|
36770
36794
|
incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
|
|
36771
36795
|
});
|
|
36772
|
-
|
|
36796
|
+
resolve38(
|
|
36773
36797
|
createCursorAcpHandle({
|
|
36774
36798
|
child,
|
|
36775
36799
|
sessionId: established.sessionId,
|
|
@@ -38208,8 +38232,8 @@ async function runGitTask(fn) {
|
|
|
38208
38232
|
}
|
|
38209
38233
|
async function yieldToEventLoop2() {
|
|
38210
38234
|
throwIfGitShutdownRequested();
|
|
38211
|
-
await new Promise((
|
|
38212
|
-
setImmediate(
|
|
38235
|
+
await new Promise((resolve38) => {
|
|
38236
|
+
setImmediate(resolve38);
|
|
38213
38237
|
});
|
|
38214
38238
|
throwIfGitShutdownRequested();
|
|
38215
38239
|
}
|
|
@@ -38246,8 +38270,8 @@ async function execGitFile(args, options) {
|
|
|
38246
38270
|
}
|
|
38247
38271
|
|
|
38248
38272
|
// src/git/changes/parse/normalize-git-diff-path.ts
|
|
38249
|
-
function normalizeGitDiffPath(
|
|
38250
|
-
return
|
|
38273
|
+
function normalizeGitDiffPath(path88) {
|
|
38274
|
+
return path88.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
|
|
38251
38275
|
}
|
|
38252
38276
|
|
|
38253
38277
|
// src/git/changes/parse/parse-name-status-entries.ts
|
|
@@ -39565,11 +39589,11 @@ function isServerNotRunningError(err) {
|
|
|
39565
39589
|
}
|
|
39566
39590
|
function closeHttpServer(server) {
|
|
39567
39591
|
if (!server) return Promise.resolve();
|
|
39568
|
-
return new Promise((
|
|
39592
|
+
return new Promise((resolve38) => {
|
|
39569
39593
|
server.close((err) => {
|
|
39570
39594
|
if (err && !isServerNotRunningError(err)) {
|
|
39571
39595
|
}
|
|
39572
|
-
|
|
39596
|
+
resolve38();
|
|
39573
39597
|
});
|
|
39574
39598
|
});
|
|
39575
39599
|
}
|
|
@@ -39582,7 +39606,7 @@ var RequestBodyTooLargeError = class extends Error {
|
|
|
39582
39606
|
}
|
|
39583
39607
|
};
|
|
39584
39608
|
function readJsonBody(req) {
|
|
39585
|
-
return new Promise((
|
|
39609
|
+
return new Promise((resolve38, reject) => {
|
|
39586
39610
|
const chunks = [];
|
|
39587
39611
|
let total = 0;
|
|
39588
39612
|
let tooLarge = false;
|
|
@@ -39602,11 +39626,11 @@ function readJsonBody(req) {
|
|
|
39602
39626
|
try {
|
|
39603
39627
|
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
39604
39628
|
if (!raw) {
|
|
39605
|
-
|
|
39629
|
+
resolve38({});
|
|
39606
39630
|
return;
|
|
39607
39631
|
}
|
|
39608
39632
|
const parsed = JSON.parse(raw);
|
|
39609
|
-
|
|
39633
|
+
resolve38(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {});
|
|
39610
39634
|
} catch (e) {
|
|
39611
39635
|
reject(e);
|
|
39612
39636
|
}
|
|
@@ -39664,7 +39688,7 @@ function createBridgeAccessRequestHandler(registry2) {
|
|
|
39664
39688
|
// src/mcp/bridge-access/start-server.ts
|
|
39665
39689
|
function startBridgeAccessServer(registry2) {
|
|
39666
39690
|
const server = http.createServer(createBridgeAccessRequestHandler(registry2));
|
|
39667
|
-
return new Promise((
|
|
39691
|
+
return new Promise((resolve38, reject) => {
|
|
39668
39692
|
server.once("error", reject);
|
|
39669
39693
|
server.listen(0, "127.0.0.1", () => {
|
|
39670
39694
|
const addr = server.address();
|
|
@@ -39672,7 +39696,7 @@ function startBridgeAccessServer(registry2) {
|
|
|
39672
39696
|
reject(new Error("Bridge access server did not bind"));
|
|
39673
39697
|
return;
|
|
39674
39698
|
}
|
|
39675
|
-
|
|
39699
|
+
resolve38({
|
|
39676
39700
|
port: addr.port,
|
|
39677
39701
|
close: () => closeHttpServer(server)
|
|
39678
39702
|
});
|
|
@@ -41311,19 +41335,19 @@ function buildLocalHttpRequestOptions(built) {
|
|
|
41311
41335
|
}
|
|
41312
41336
|
function runLocalHttpRequestOnce(mod, built) {
|
|
41313
41337
|
const opts = buildLocalHttpRequestOptions(built);
|
|
41314
|
-
return new Promise((
|
|
41338
|
+
return new Promise((resolve38) => {
|
|
41315
41339
|
const req = mod.request(opts, (res) => {
|
|
41316
41340
|
const chunks = [];
|
|
41317
41341
|
res.on("data", (chunk) => chunks.push(chunk));
|
|
41318
41342
|
res.on("end", () => {
|
|
41319
|
-
|
|
41343
|
+
resolve38({
|
|
41320
41344
|
statusCode: res.statusCode ?? 0,
|
|
41321
41345
|
headers: incomingMessageHeaders(res),
|
|
41322
41346
|
body: Buffer.concat(chunks)
|
|
41323
41347
|
});
|
|
41324
41348
|
});
|
|
41325
41349
|
res.on("error", (err) => {
|
|
41326
|
-
|
|
41350
|
+
resolve38({
|
|
41327
41351
|
statusCode: 0,
|
|
41328
41352
|
headers: {},
|
|
41329
41353
|
body: Buffer.alloc(0),
|
|
@@ -41335,7 +41359,7 @@ function runLocalHttpRequestOnce(mod, built) {
|
|
|
41335
41359
|
req.destroy(new Error(`Local preview request timed out after ${LOCAL_PROXY_REQUEST_TIMEOUT_MS}ms`));
|
|
41336
41360
|
});
|
|
41337
41361
|
req.on("error", (err) => {
|
|
41338
|
-
|
|
41362
|
+
resolve38({
|
|
41339
41363
|
statusCode: 0,
|
|
41340
41364
|
headers: {},
|
|
41341
41365
|
body: Buffer.alloc(0),
|
|
@@ -41359,14 +41383,14 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41359
41383
|
const isHttps = request.url.startsWith("https:");
|
|
41360
41384
|
const mod = await loadHttpModule(isHttps);
|
|
41361
41385
|
const opts = buildLocalHttpRequestOptions(built);
|
|
41362
|
-
await new Promise((
|
|
41386
|
+
await new Promise((resolve38) => {
|
|
41363
41387
|
const req = mod.request(opts, (res) => {
|
|
41364
41388
|
try {
|
|
41365
41389
|
callbacks.onStart(res.statusCode ?? 0, incomingMessageHeaders(res));
|
|
41366
41390
|
} catch (err) {
|
|
41367
41391
|
req.destroy();
|
|
41368
41392
|
callbacks.onError(err instanceof Error ? err.message : String(err));
|
|
41369
|
-
|
|
41393
|
+
resolve38();
|
|
41370
41394
|
return;
|
|
41371
41395
|
}
|
|
41372
41396
|
res.on("data", (chunk) => {
|
|
@@ -41379,11 +41403,11 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41379
41403
|
});
|
|
41380
41404
|
res.on("end", () => {
|
|
41381
41405
|
callbacks.onEnd();
|
|
41382
|
-
|
|
41406
|
+
resolve38();
|
|
41383
41407
|
});
|
|
41384
41408
|
res.on("error", (err) => {
|
|
41385
41409
|
callbacks.onError(err.message);
|
|
41386
|
-
|
|
41410
|
+
resolve38();
|
|
41387
41411
|
});
|
|
41388
41412
|
});
|
|
41389
41413
|
req.setTimeout(LOCAL_PROXY_REQUEST_TIMEOUT_MS, () => {
|
|
@@ -41391,7 +41415,7 @@ async function proxyToLocalStreaming(request, callbacks) {
|
|
|
41391
41415
|
});
|
|
41392
41416
|
req.on("error", (err) => {
|
|
41393
41417
|
callbacks.onError(err.message);
|
|
41394
|
-
|
|
41418
|
+
resolve38();
|
|
41395
41419
|
});
|
|
41396
41420
|
if (built.sendingBody && built.body != null) {
|
|
41397
41421
|
req.write(built.body);
|
|
@@ -42515,8 +42539,8 @@ function pathspec(...paths) {
|
|
|
42515
42539
|
cache.set(key, paths);
|
|
42516
42540
|
return key;
|
|
42517
42541
|
}
|
|
42518
|
-
function isPathSpec(
|
|
42519
|
-
return
|
|
42542
|
+
function isPathSpec(path88) {
|
|
42543
|
+
return path88 instanceof String && cache.has(path88);
|
|
42520
42544
|
}
|
|
42521
42545
|
function toPaths(pathSpec) {
|
|
42522
42546
|
return cache.get(pathSpec) || [];
|
|
@@ -42605,8 +42629,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
42605
42629
|
function forEachLineWithContent(input, callback) {
|
|
42606
42630
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
42607
42631
|
}
|
|
42608
|
-
function folderExists(
|
|
42609
|
-
return (0, import_file_exists.exists)(
|
|
42632
|
+
function folderExists(path88) {
|
|
42633
|
+
return (0, import_file_exists.exists)(path88, import_file_exists.FOLDER);
|
|
42610
42634
|
}
|
|
42611
42635
|
function append(target, item) {
|
|
42612
42636
|
if (Array.isArray(target)) {
|
|
@@ -43010,8 +43034,8 @@ function checkIsRepoRootTask() {
|
|
|
43010
43034
|
commands,
|
|
43011
43035
|
format: "utf-8",
|
|
43012
43036
|
onError,
|
|
43013
|
-
parser(
|
|
43014
|
-
return /^\.(git)?$/.test(
|
|
43037
|
+
parser(path88) {
|
|
43038
|
+
return /^\.(git)?$/.test(path88.trim());
|
|
43015
43039
|
}
|
|
43016
43040
|
};
|
|
43017
43041
|
}
|
|
@@ -43445,11 +43469,11 @@ function parseGrep(grep) {
|
|
|
43445
43469
|
const paths = /* @__PURE__ */ new Set();
|
|
43446
43470
|
const results = {};
|
|
43447
43471
|
forEachLineWithContent(grep, (input) => {
|
|
43448
|
-
const [
|
|
43449
|
-
paths.add(
|
|
43450
|
-
(results[
|
|
43472
|
+
const [path88, line, preview] = input.split(NULL);
|
|
43473
|
+
paths.add(path88);
|
|
43474
|
+
(results[path88] = results[path88] || []).push({
|
|
43451
43475
|
line: asNumber(line),
|
|
43452
|
-
path:
|
|
43476
|
+
path: path88,
|
|
43453
43477
|
preview
|
|
43454
43478
|
});
|
|
43455
43479
|
});
|
|
@@ -44214,14 +44238,14 @@ var init_hash_object = __esm2({
|
|
|
44214
44238
|
init_task();
|
|
44215
44239
|
}
|
|
44216
44240
|
});
|
|
44217
|
-
function parseInit(bare,
|
|
44241
|
+
function parseInit(bare, path88, text) {
|
|
44218
44242
|
const response = String(text).trim();
|
|
44219
44243
|
let result;
|
|
44220
44244
|
if (result = initResponseRegex.exec(response)) {
|
|
44221
|
-
return new InitSummary(bare,
|
|
44245
|
+
return new InitSummary(bare, path88, false, result[1]);
|
|
44222
44246
|
}
|
|
44223
44247
|
if (result = reInitResponseRegex.exec(response)) {
|
|
44224
|
-
return new InitSummary(bare,
|
|
44248
|
+
return new InitSummary(bare, path88, true, result[1]);
|
|
44225
44249
|
}
|
|
44226
44250
|
let gitDir = "";
|
|
44227
44251
|
const tokens = response.split(" ");
|
|
@@ -44232,7 +44256,7 @@ function parseInit(bare, path86, text) {
|
|
|
44232
44256
|
break;
|
|
44233
44257
|
}
|
|
44234
44258
|
}
|
|
44235
|
-
return new InitSummary(bare,
|
|
44259
|
+
return new InitSummary(bare, path88, /^re/i.test(response), gitDir);
|
|
44236
44260
|
}
|
|
44237
44261
|
var InitSummary;
|
|
44238
44262
|
var initResponseRegex;
|
|
@@ -44241,9 +44265,9 @@ var init_InitSummary = __esm2({
|
|
|
44241
44265
|
"src/lib/responses/InitSummary.ts"() {
|
|
44242
44266
|
"use strict";
|
|
44243
44267
|
InitSummary = class {
|
|
44244
|
-
constructor(bare,
|
|
44268
|
+
constructor(bare, path88, existing, gitDir) {
|
|
44245
44269
|
this.bare = bare;
|
|
44246
|
-
this.path =
|
|
44270
|
+
this.path = path88;
|
|
44247
44271
|
this.existing = existing;
|
|
44248
44272
|
this.gitDir = gitDir;
|
|
44249
44273
|
}
|
|
@@ -44255,7 +44279,7 @@ var init_InitSummary = __esm2({
|
|
|
44255
44279
|
function hasBareCommand(command) {
|
|
44256
44280
|
return command.includes(bareCommand);
|
|
44257
44281
|
}
|
|
44258
|
-
function initTask(bare = false,
|
|
44282
|
+
function initTask(bare = false, path88, customArgs) {
|
|
44259
44283
|
const commands = ["init", ...customArgs];
|
|
44260
44284
|
if (bare && !hasBareCommand(commands)) {
|
|
44261
44285
|
commands.splice(1, 0, bareCommand);
|
|
@@ -44264,7 +44288,7 @@ function initTask(bare = false, path86, customArgs) {
|
|
|
44264
44288
|
commands,
|
|
44265
44289
|
format: "utf-8",
|
|
44266
44290
|
parser(text) {
|
|
44267
|
-
return parseInit(commands.includes("--bare"),
|
|
44291
|
+
return parseInit(commands.includes("--bare"), path88, text);
|
|
44268
44292
|
}
|
|
44269
44293
|
};
|
|
44270
44294
|
}
|
|
@@ -45080,12 +45104,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
45080
45104
|
"use strict";
|
|
45081
45105
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
45082
45106
|
FileStatusSummary = class {
|
|
45083
|
-
constructor(
|
|
45084
|
-
this.path =
|
|
45107
|
+
constructor(path88, index, working_dir) {
|
|
45108
|
+
this.path = path88;
|
|
45085
45109
|
this.index = index;
|
|
45086
45110
|
this.working_dir = working_dir;
|
|
45087
45111
|
if (index === "R" || working_dir === "R") {
|
|
45088
|
-
const detail = fromPathRegex.exec(
|
|
45112
|
+
const detail = fromPathRegex.exec(path88) || [null, path88, path88];
|
|
45089
45113
|
this.from = detail[2] || "";
|
|
45090
45114
|
this.path = detail[1] || "";
|
|
45091
45115
|
}
|
|
@@ -45116,14 +45140,14 @@ function splitLine(result, lineStr) {
|
|
|
45116
45140
|
default:
|
|
45117
45141
|
return;
|
|
45118
45142
|
}
|
|
45119
|
-
function data(index, workingDir,
|
|
45143
|
+
function data(index, workingDir, path88) {
|
|
45120
45144
|
const raw = `${index}${workingDir}`;
|
|
45121
45145
|
const handler = parsers6.get(raw);
|
|
45122
45146
|
if (handler) {
|
|
45123
|
-
handler(result,
|
|
45147
|
+
handler(result, path88);
|
|
45124
45148
|
}
|
|
45125
45149
|
if (raw !== "##" && raw !== "!!") {
|
|
45126
|
-
result.files.push(new FileStatusSummary(
|
|
45150
|
+
result.files.push(new FileStatusSummary(path88, index, workingDir));
|
|
45127
45151
|
}
|
|
45128
45152
|
}
|
|
45129
45153
|
}
|
|
@@ -45432,9 +45456,9 @@ var init_simple_git_api = __esm2({
|
|
|
45432
45456
|
next
|
|
45433
45457
|
);
|
|
45434
45458
|
}
|
|
45435
|
-
hashObject(
|
|
45459
|
+
hashObject(path88, write) {
|
|
45436
45460
|
return this._runTask(
|
|
45437
|
-
hashObjectTask(
|
|
45461
|
+
hashObjectTask(path88, write === true),
|
|
45438
45462
|
trailingFunctionArgument(arguments)
|
|
45439
45463
|
);
|
|
45440
45464
|
}
|
|
@@ -45787,8 +45811,8 @@ var init_branch = __esm2({
|
|
|
45787
45811
|
}
|
|
45788
45812
|
});
|
|
45789
45813
|
function toPath(input) {
|
|
45790
|
-
const
|
|
45791
|
-
return
|
|
45814
|
+
const path88 = input.trim().replace(/^["']|["']$/g, "");
|
|
45815
|
+
return path88 && normalize3(path88);
|
|
45792
45816
|
}
|
|
45793
45817
|
var parseCheckIgnore;
|
|
45794
45818
|
var init_CheckIgnore = __esm2({
|
|
@@ -46102,8 +46126,8 @@ __export2(sub_module_exports, {
|
|
|
46102
46126
|
subModuleTask: () => subModuleTask,
|
|
46103
46127
|
updateSubModuleTask: () => updateSubModuleTask
|
|
46104
46128
|
});
|
|
46105
|
-
function addSubModuleTask(repo,
|
|
46106
|
-
return subModuleTask(["add", repo,
|
|
46129
|
+
function addSubModuleTask(repo, path88) {
|
|
46130
|
+
return subModuleTask(["add", repo, path88]);
|
|
46107
46131
|
}
|
|
46108
46132
|
function initSubModuleTask(customArgs) {
|
|
46109
46133
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -46436,8 +46460,8 @@ var require_git = __commonJS2({
|
|
|
46436
46460
|
}
|
|
46437
46461
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
46438
46462
|
};
|
|
46439
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
46440
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
46463
|
+
Git2.prototype.submoduleAdd = function(repo, path88, then) {
|
|
46464
|
+
return this._runTask(addSubModuleTask2(repo, path88), trailingFunctionArgument2(arguments));
|
|
46441
46465
|
};
|
|
46442
46466
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
46443
46467
|
return this._runTask(
|
|
@@ -47176,8 +47200,8 @@ function parseNumstatEntries(lines) {
|
|
|
47176
47200
|
}
|
|
47177
47201
|
function parseNumstat(lines) {
|
|
47178
47202
|
const m = /* @__PURE__ */ new Map();
|
|
47179
|
-
for (const [
|
|
47180
|
-
m.set(
|
|
47203
|
+
for (const [path88, entry] of parseNumstatEntries(lines)) {
|
|
47204
|
+
m.set(path88, { additions: entry.additions, deletions: entry.deletions });
|
|
47181
47205
|
}
|
|
47182
47206
|
return m;
|
|
47183
47207
|
}
|
|
@@ -51265,7 +51289,7 @@ init_symbol_index_file_ready();
|
|
|
51265
51289
|
var CODE_NAV_INDEX_READY_WAIT_MS = 75;
|
|
51266
51290
|
var CODE_NAV_INDEX_READY_POLL_MS = 15;
|
|
51267
51291
|
function delay2(ms) {
|
|
51268
|
-
return new Promise((
|
|
51292
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
51269
51293
|
}
|
|
51270
51294
|
async function waitForSymbolIndexReady(sessionParentPath, reqPath, maxWaitMs = CODE_NAV_INDEX_READY_WAIT_MS) {
|
|
51271
51295
|
const deadline = Date.now() + maxWaitMs;
|
|
@@ -51397,12 +51421,12 @@ function parseOptionalInt2(raw) {
|
|
|
51397
51421
|
return Number.isInteger(parsed) ? parsed : void 0;
|
|
51398
51422
|
}
|
|
51399
51423
|
function parseCodeNavParams(url2) {
|
|
51400
|
-
const
|
|
51424
|
+
const path88 = url2.searchParams.get("path") ?? "";
|
|
51401
51425
|
const opRaw = url2.searchParams.get("op")?.trim();
|
|
51402
51426
|
const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
|
|
51403
51427
|
const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
|
|
51404
51428
|
const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
|
|
51405
|
-
return { path:
|
|
51429
|
+
return { path: path88, op, line, column };
|
|
51406
51430
|
}
|
|
51407
51431
|
function parseCodeNavPath(url2) {
|
|
51408
51432
|
const raw = url2.searchParams.get("path")?.trim();
|
|
@@ -51578,7 +51602,7 @@ function createLocalShortcutRequestHandler(ctx) {
|
|
|
51578
51602
|
var RESTART_DELAY_MS = 250;
|
|
51579
51603
|
var MAX_RESTART_ATTEMPTS = 5;
|
|
51580
51604
|
function listenOnPort(server, port) {
|
|
51581
|
-
return new Promise((
|
|
51605
|
+
return new Promise((resolve38, reject) => {
|
|
51582
51606
|
server.once("error", reject);
|
|
51583
51607
|
server.listen(port, "127.0.0.1", () => {
|
|
51584
51608
|
const addr = server.address();
|
|
@@ -51586,12 +51610,12 @@ function listenOnPort(server, port) {
|
|
|
51586
51610
|
reject(new Error("Local shortcut server did not bind"));
|
|
51587
51611
|
return;
|
|
51588
51612
|
}
|
|
51589
|
-
|
|
51613
|
+
resolve38(addr.port);
|
|
51590
51614
|
});
|
|
51591
51615
|
});
|
|
51592
51616
|
}
|
|
51593
51617
|
function delay3(ms) {
|
|
51594
|
-
return new Promise((
|
|
51618
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
51595
51619
|
}
|
|
51596
51620
|
function startLocalShortcutServer(ctx) {
|
|
51597
51621
|
let closed = false;
|
|
@@ -51791,7 +51815,8 @@ var API_TO_BRIDGE_MESSAGE_TYPES = [
|
|
|
51791
51815
|
"install_agent",
|
|
51792
51816
|
"refresh_local_skills",
|
|
51793
51817
|
"bridge_git_context_request",
|
|
51794
|
-
"list_repo_branches_request"
|
|
51818
|
+
"list_repo_branches_request",
|
|
51819
|
+
"bridge_git_checkout_request"
|
|
51795
51820
|
];
|
|
51796
51821
|
var API_TO_BRIDGE_TYPE_SET = new Set(API_TO_BRIDGE_MESSAGE_TYPES);
|
|
51797
51822
|
function parseApiToBridgeMessage(data, log2) {
|
|
@@ -52484,10 +52509,10 @@ async function awaitGitStatePreparation(options) {
|
|
|
52484
52509
|
try {
|
|
52485
52510
|
return await Promise.race([
|
|
52486
52511
|
work,
|
|
52487
|
-
new Promise((
|
|
52512
|
+
new Promise((resolve38) => {
|
|
52488
52513
|
timer = setTimeout(() => {
|
|
52489
52514
|
log2(`[Agent] ${label} exceeded ${timeoutMs}ms; continuing without it.`);
|
|
52490
|
-
|
|
52515
|
+
resolve38(fallback);
|
|
52491
52516
|
}, timeoutMs);
|
|
52492
52517
|
timer.unref?.();
|
|
52493
52518
|
})
|
|
@@ -53050,8 +53075,8 @@ function randomSecret() {
|
|
|
53050
53075
|
}
|
|
53051
53076
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
53052
53077
|
}
|
|
53053
|
-
async function requestPreviewApi(port, secret, method,
|
|
53054
|
-
const url2 = `http://127.0.0.1:${port}${
|
|
53078
|
+
async function requestPreviewApi(port, secret, method, path88, body) {
|
|
53079
|
+
const url2 = `http://127.0.0.1:${port}${path88}`;
|
|
53055
53080
|
const headers = {
|
|
53056
53081
|
[PREVIEW_SECRET_HEADER]: secret,
|
|
53057
53082
|
"Content-Type": "application/json"
|
|
@@ -53063,7 +53088,7 @@ async function requestPreviewApi(port, secret, method, path86, body) {
|
|
|
53063
53088
|
});
|
|
53064
53089
|
const data = await res.json().catch(() => ({}));
|
|
53065
53090
|
if (!res.ok) {
|
|
53066
|
-
throw new Error(data?.error ?? `Preview API ${method} ${
|
|
53091
|
+
throw new Error(data?.error ?? `Preview API ${method} ${path88}: ${res.status}`);
|
|
53067
53092
|
}
|
|
53068
53093
|
return data;
|
|
53069
53094
|
}
|
|
@@ -53320,7 +53345,7 @@ var handleInstallSkillsMessage = (msg, deps) => {
|
|
|
53320
53345
|
import { spawn as spawn11 } from "node:child_process";
|
|
53321
53346
|
import * as readline3 from "node:readline";
|
|
53322
53347
|
function runStreamingCommand(command, args, options) {
|
|
53323
|
-
return new Promise((
|
|
53348
|
+
return new Promise((resolve38, reject) => {
|
|
53324
53349
|
const child = spawn11(command, args, {
|
|
53325
53350
|
env: options.env,
|
|
53326
53351
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -53353,7 +53378,7 @@ function runStreamingCommand(command, args, options) {
|
|
|
53353
53378
|
if (timer) clearTimeout(timer);
|
|
53354
53379
|
if (!settled) {
|
|
53355
53380
|
settled = true;
|
|
53356
|
-
|
|
53381
|
+
resolve38({ code, signal });
|
|
53357
53382
|
}
|
|
53358
53383
|
});
|
|
53359
53384
|
});
|
|
@@ -53792,6 +53817,23 @@ async function listRepoBranchRefs(repoPath) {
|
|
|
53792
53817
|
}
|
|
53793
53818
|
}
|
|
53794
53819
|
|
|
53820
|
+
// src/git/checkout/pending-checkouts.ts
|
|
53821
|
+
var pendingByRelPath = /* @__PURE__ */ new Map();
|
|
53822
|
+
function beginPendingCheckout(row) {
|
|
53823
|
+
const relPath = row.relPath.trim() || ".";
|
|
53824
|
+
pendingByRelPath.set(relPath, {
|
|
53825
|
+
relPath,
|
|
53826
|
+
folderName: row.folderName.trim() || (relPath === "." ? "repo" : relPath),
|
|
53827
|
+
remoteUrl: row.remoteUrl
|
|
53828
|
+
});
|
|
53829
|
+
}
|
|
53830
|
+
function endPendingCheckout(relPath) {
|
|
53831
|
+
pendingByRelPath.delete(relPath.trim() || ".");
|
|
53832
|
+
}
|
|
53833
|
+
function listPendingCheckouts() {
|
|
53834
|
+
return [...pendingByRelPath.values()];
|
|
53835
|
+
}
|
|
53836
|
+
|
|
53795
53837
|
// src/git/bridge-git-context.ts
|
|
53796
53838
|
function folderNameForRelPath(relPath, bridgeRoot) {
|
|
53797
53839
|
if (relPath === "." || relPath === "") {
|
|
@@ -53828,7 +53870,23 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
|
|
|
53828
53870
|
relPath,
|
|
53829
53871
|
folderName: folderNameForRelPath(relPath, bridgeResolved),
|
|
53830
53872
|
currentBranch,
|
|
53831
|
-
remoteUrl
|
|
53873
|
+
remoteUrl,
|
|
53874
|
+
cloning: false
|
|
53875
|
+
});
|
|
53876
|
+
}
|
|
53877
|
+
const seen = new Set(rows.map((r) => r.relPath));
|
|
53878
|
+
for (const pending2 of listPendingCheckouts()) {
|
|
53879
|
+
if (seen.has(pending2.relPath)) {
|
|
53880
|
+
const row = rows.find((r) => r.relPath === pending2.relPath);
|
|
53881
|
+
if (row) row.cloning = true;
|
|
53882
|
+
continue;
|
|
53883
|
+
}
|
|
53884
|
+
rows.push({
|
|
53885
|
+
relPath: pending2.relPath,
|
|
53886
|
+
folderName: pending2.folderName,
|
|
53887
|
+
currentBranch: null,
|
|
53888
|
+
remoteUrl: pending2.remoteUrl,
|
|
53889
|
+
cloning: true
|
|
53832
53890
|
});
|
|
53833
53891
|
}
|
|
53834
53892
|
rows.sort((a, b) => a.relPath.localeCompare(b.relPath));
|
|
@@ -53888,6 +53946,143 @@ function handleListRepoBranchesRequestMessage(msg, getWs) {
|
|
|
53888
53946
|
})();
|
|
53889
53947
|
}
|
|
53890
53948
|
|
|
53949
|
+
// src/git/checkout/bridge-git-checkout.ts
|
|
53950
|
+
import * as fs65 from "node:fs/promises";
|
|
53951
|
+
import * as path86 from "node:path";
|
|
53952
|
+
|
|
53953
|
+
// src/git/checkout/normalize-clone-url.ts
|
|
53954
|
+
function normalizeCloneUrl(url2) {
|
|
53955
|
+
const u = url2.trim();
|
|
53956
|
+
if (!u.startsWith("http://") && !u.startsWith("https://")) {
|
|
53957
|
+
throw new Error("Only http(s) git remote URLs are supported");
|
|
53958
|
+
}
|
|
53959
|
+
return u.endsWith(".git") ? u : `${u}.git`;
|
|
53960
|
+
}
|
|
53961
|
+
function cloneUrlWithHttpsAuth(url2, auth) {
|
|
53962
|
+
const normalized = normalizeCloneUrl(url2);
|
|
53963
|
+
if (!auth) return normalized;
|
|
53964
|
+
const parsed = new URL(normalized);
|
|
53965
|
+
parsed.username = auth.username;
|
|
53966
|
+
parsed.password = auth.password;
|
|
53967
|
+
return parsed.toString();
|
|
53968
|
+
}
|
|
53969
|
+
|
|
53970
|
+
// src/git/checkout/resolve-checkout-target.ts
|
|
53971
|
+
import * as fs64 from "node:fs/promises";
|
|
53972
|
+
import * as path85 from "node:path";
|
|
53973
|
+
var FOLDER_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
53974
|
+
async function pathExists(p) {
|
|
53975
|
+
try {
|
|
53976
|
+
await fs64.access(p);
|
|
53977
|
+
return true;
|
|
53978
|
+
} catch {
|
|
53979
|
+
return false;
|
|
53980
|
+
}
|
|
53981
|
+
}
|
|
53982
|
+
async function resolveCheckoutTarget(opts) {
|
|
53983
|
+
const bridgeRoot = getBridgeRoot();
|
|
53984
|
+
if (opts.layout === "monorepo") {
|
|
53985
|
+
if (await isGitRepoDirectory(bridgeRoot)) {
|
|
53986
|
+
throw new Error("Bridge root is already a git repository");
|
|
53987
|
+
}
|
|
53988
|
+
const entries = await fs64.readdir(bridgeRoot).catch(() => []);
|
|
53989
|
+
if (entries.length > 0) {
|
|
53990
|
+
throw new Error("Bridge root must be empty to initialize a monorepo checkout");
|
|
53991
|
+
}
|
|
53992
|
+
return { targetDir: bridgeRoot, relPath: "." };
|
|
53993
|
+
}
|
|
53994
|
+
const folder = (opts.folderName ?? "").trim();
|
|
53995
|
+
if (!folder || folder === "." || folder === ".." || !FOLDER_NAME_RE.test(folder)) {
|
|
53996
|
+
throw new Error("folderName must be a single path segment (letters, numbers, . _ -)");
|
|
53997
|
+
}
|
|
53998
|
+
if (await isGitRepoDirectory(bridgeRoot)) {
|
|
53999
|
+
throw new Error("Cannot add a nested repo while the bridge root is itself a git repository");
|
|
54000
|
+
}
|
|
54001
|
+
const targetDir = path85.resolve(bridgeRoot, folder);
|
|
54002
|
+
if (!targetDir.startsWith(bridgeRoot + path85.sep)) {
|
|
54003
|
+
throw new Error("Invalid folderName");
|
|
54004
|
+
}
|
|
54005
|
+
if (await pathExists(targetDir)) {
|
|
54006
|
+
throw new Error(`Folder already exists: ${folder}`);
|
|
54007
|
+
}
|
|
54008
|
+
return { targetDir, relPath: folder };
|
|
54009
|
+
}
|
|
54010
|
+
|
|
54011
|
+
// src/git/checkout/bridge-git-checkout.ts
|
|
54012
|
+
async function bridgeGitCheckout(params) {
|
|
54013
|
+
const cloneUrl = (params.cloneUrl ?? "").trim();
|
|
54014
|
+
if (!cloneUrl) throw new Error("cloneUrl required");
|
|
54015
|
+
const { targetDir, relPath } = await resolveCheckoutTarget({
|
|
54016
|
+
layout: params.layout,
|
|
54017
|
+
folderName: params.folderName
|
|
54018
|
+
});
|
|
54019
|
+
const folderName = relPath === "." ? "repo" : relPath;
|
|
54020
|
+
beginPendingCheckout({ relPath, folderName, remoteUrl: cloneUrl });
|
|
54021
|
+
const parent = path86.dirname(targetDir);
|
|
54022
|
+
await fs65.mkdir(parent, { recursive: true });
|
|
54023
|
+
if (relPath !== ".") {
|
|
54024
|
+
await fs65.mkdir(targetDir, { recursive: true });
|
|
54025
|
+
}
|
|
54026
|
+
const url2 = cloneUrlWithHttpsAuth(cloneUrl, params.auth ?? null);
|
|
54027
|
+
try {
|
|
54028
|
+
await execGitFile(["clone", "--", url2, targetDir], {
|
|
54029
|
+
cwd: parent,
|
|
54030
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
54031
|
+
});
|
|
54032
|
+
return { relPath, folderName };
|
|
54033
|
+
} catch (e) {
|
|
54034
|
+
if (relPath !== ".") {
|
|
54035
|
+
await fs65.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
|
|
54036
|
+
}
|
|
54037
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
54038
|
+
throw new Error(
|
|
54039
|
+
msg.includes("Authentication") || msg.includes("403") || msg.includes("401") ? `Clone failed (auth?): ${msg}` : `Clone failed: ${msg}`
|
|
54040
|
+
);
|
|
54041
|
+
} finally {
|
|
54042
|
+
endPendingCheckout(relPath);
|
|
54043
|
+
}
|
|
54044
|
+
}
|
|
54045
|
+
|
|
54046
|
+
// src/routing/handlers/bridge-git-checkout-messages.ts
|
|
54047
|
+
function handleBridgeGitCheckoutRequestMessage(msg, getWs) {
|
|
54048
|
+
void (async () => {
|
|
54049
|
+
const socket = getWs();
|
|
54050
|
+
if (!socket) return;
|
|
54051
|
+
const layout = msg.layout === "multi_repo" ? "multi_repo" : msg.layout === "monorepo" ? "monorepo" : null;
|
|
54052
|
+
if (!layout) {
|
|
54053
|
+
sendWsMessage(socket, {
|
|
54054
|
+
type: "bridge_git_checkout_response",
|
|
54055
|
+
id: msg.id,
|
|
54056
|
+
error: "layout must be monorepo or multi_repo"
|
|
54057
|
+
});
|
|
54058
|
+
return;
|
|
54059
|
+
}
|
|
54060
|
+
try {
|
|
54061
|
+
const user = typeof msg.authUsername === "string" ? msg.authUsername : "";
|
|
54062
|
+
const pass = typeof msg.authPassword === "string" ? msg.authPassword : "";
|
|
54063
|
+
const result = await bridgeGitCheckout({
|
|
54064
|
+
layout,
|
|
54065
|
+
folderName: msg.folderName,
|
|
54066
|
+
cloneUrl: msg.cloneUrl ?? "",
|
|
54067
|
+
auth: user && pass ? { username: user, password: pass } : null
|
|
54068
|
+
});
|
|
54069
|
+
sendWsMessage(socket, {
|
|
54070
|
+
type: "bridge_git_checkout_response",
|
|
54071
|
+
id: msg.id,
|
|
54072
|
+
ok: true,
|
|
54073
|
+
relPath: result.relPath,
|
|
54074
|
+
folderName: result.folderName
|
|
54075
|
+
});
|
|
54076
|
+
} catch (e) {
|
|
54077
|
+
sendWsMessage(socket, {
|
|
54078
|
+
type: "bridge_git_checkout_response",
|
|
54079
|
+
id: msg.id,
|
|
54080
|
+
error: e instanceof Error ? e.message : String(e)
|
|
54081
|
+
});
|
|
54082
|
+
}
|
|
54083
|
+
})();
|
|
54084
|
+
}
|
|
54085
|
+
|
|
53891
54086
|
// src/routing/dispatch/file-browser.ts
|
|
53892
54087
|
function dispatchBridgeFileBrowserMessage(msg, deps) {
|
|
53893
54088
|
switch (msg.type) {
|
|
@@ -53906,6 +54101,9 @@ function dispatchBridgeFileBrowserMessage(msg, deps) {
|
|
|
53906
54101
|
case "list_repo_branches_request":
|
|
53907
54102
|
handleListRepoBranchesRequestMessage(msg, deps.getWs);
|
|
53908
54103
|
break;
|
|
54104
|
+
case "bridge_git_checkout_request":
|
|
54105
|
+
handleBridgeGitCheckoutRequestMessage(msg, deps.getWs);
|
|
54106
|
+
break;
|
|
53909
54107
|
}
|
|
53910
54108
|
}
|
|
53911
54109
|
|
|
@@ -53946,6 +54144,7 @@ function dispatchBridgeMessage(msg, deps) {
|
|
|
53946
54144
|
case "code_nav":
|
|
53947
54145
|
case "bridge_git_context_request":
|
|
53948
54146
|
case "list_repo_branches_request":
|
|
54147
|
+
case "bridge_git_checkout_request":
|
|
53949
54148
|
dispatchBridgeFileBrowserMessage(msg, deps);
|
|
53950
54149
|
break;
|
|
53951
54150
|
}
|
|
@@ -54411,12 +54610,12 @@ async function runConnectedBridge(options, restartWithoutAuth) {
|
|
|
54411
54610
|
let cleanupKeyCommand;
|
|
54412
54611
|
let bridgeClose = null;
|
|
54413
54612
|
let endConnectedSession;
|
|
54414
|
-
const sessionDone = new Promise((
|
|
54415
|
-
endConnectedSession =
|
|
54613
|
+
const sessionDone = new Promise((resolve38) => {
|
|
54614
|
+
endConnectedSession = resolve38;
|
|
54416
54615
|
});
|
|
54417
54616
|
let resolveHandleReady;
|
|
54418
|
-
const handleReady = new Promise((
|
|
54419
|
-
resolveHandleReady =
|
|
54617
|
+
const handleReady = new Promise((resolve38) => {
|
|
54618
|
+
resolveHandleReady = resolve38;
|
|
54420
54619
|
});
|
|
54421
54620
|
const handleRef = { current: null };
|
|
54422
54621
|
const signals = installConnectedBridgeSignals({
|
|
@@ -54567,9 +54766,9 @@ async function runCliAction(program2, opts) {
|
|
|
54567
54766
|
const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAUTOMATON_FIREHOSE_URL ?? process.env.BUILDAUTOMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
|
|
54568
54767
|
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
54768
|
if (bridgeRootOpt) {
|
|
54570
|
-
const resolvedBridgeRoot =
|
|
54769
|
+
const resolvedBridgeRoot = path87.resolve(process.cwd(), bridgeRootOpt);
|
|
54571
54770
|
try {
|
|
54572
|
-
const st =
|
|
54771
|
+
const st = fs66.statSync(resolvedBridgeRoot);
|
|
54573
54772
|
if (!st.isDirectory()) {
|
|
54574
54773
|
console.error(`Bridge root is not a directory: ${resolvedBridgeRoot}`);
|
|
54575
54774
|
process.exit(1);
|
|
@@ -54589,7 +54788,7 @@ async function runCliAction(program2, opts) {
|
|
|
54589
54788
|
);
|
|
54590
54789
|
let worktreesRootPath;
|
|
54591
54790
|
if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
|
|
54592
|
-
worktreesRootPath =
|
|
54791
|
+
worktreesRootPath = path87.resolve(opts.worktreesRoot.trim());
|
|
54593
54792
|
}
|
|
54594
54793
|
const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
|
|
54595
54794
|
if (e2eCertificates) {
|