@buildautomaton/cli 0.1.74 → 0.1.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +431 -432
- package/dist/cli.js.map +4 -4
- package/dist/index.js +410 -411
- 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 path86 = __require("node:path");
|
|
977
|
+
var fs65 = __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 = path86.resolve(baseDir, baseName);
|
|
1910
|
+
if (fs65.existsSync(localBin)) return localBin;
|
|
1911
|
+
if (sourceExt.includes(path86.extname(baseName))) return void 0;
|
|
1912
1912
|
const foundExt = sourceExt.find(
|
|
1913
|
-
(ext) =>
|
|
1913
|
+
(ext) => fs65.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 = fs65.realpathSync(this._scriptPath);
|
|
1926
1926
|
} catch (err) {
|
|
1927
1927
|
resolvedScriptPath = this._scriptPath;
|
|
1928
1928
|
}
|
|
1929
|
-
executableDir =
|
|
1930
|
-
|
|
1929
|
+
executableDir = path86.resolve(
|
|
1930
|
+
path86.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 = path86.basename(
|
|
1938
1938
|
this._scriptPath,
|
|
1939
|
-
|
|
1939
|
+
path86.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(path86.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 = path86.basename(filename, path86.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(path87) {
|
|
2805
|
+
if (path87 === void 0) return this._executableDir;
|
|
2806
|
+
this._executableDir = path87;
|
|
2807
2807
|
return this;
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
@@ -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((path86) => existsSync(path86));
|
|
7733
7733
|
if (!resolved) {
|
|
7734
7734
|
throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
|
|
7735
7735
|
}
|
|
@@ -8800,7 +8800,7 @@ var require_ignore = __commonJS({
|
|
|
8800
8800
|
// path matching.
|
|
8801
8801
|
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
8802
8802
|
// @returns {TestResult} true if a file is ignored
|
|
8803
|
-
test(
|
|
8803
|
+
test(path86, checkUnignored, mode) {
|
|
8804
8804
|
let ignored = false;
|
|
8805
8805
|
let unignored = false;
|
|
8806
8806
|
let matchedRule;
|
|
@@ -8809,7 +8809,7 @@ var require_ignore = __commonJS({
|
|
|
8809
8809
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
8810
8810
|
return;
|
|
8811
8811
|
}
|
|
8812
|
-
const matched = rule[mode].test(
|
|
8812
|
+
const matched = rule[mode].test(path86);
|
|
8813
8813
|
if (!matched) {
|
|
8814
8814
|
return;
|
|
8815
8815
|
}
|
|
@@ -8830,17 +8830,17 @@ var require_ignore = __commonJS({
|
|
|
8830
8830
|
var throwError = (message, Ctor) => {
|
|
8831
8831
|
throw new Ctor(message);
|
|
8832
8832
|
};
|
|
8833
|
-
var checkPath = (
|
|
8834
|
-
if (!isString(
|
|
8833
|
+
var checkPath = (path86, originalPath, doThrow) => {
|
|
8834
|
+
if (!isString(path86)) {
|
|
8835
8835
|
return doThrow(
|
|
8836
8836
|
`path must be a string, but got \`${originalPath}\``,
|
|
8837
8837
|
TypeError
|
|
8838
8838
|
);
|
|
8839
8839
|
}
|
|
8840
|
-
if (!
|
|
8840
|
+
if (!path86) {
|
|
8841
8841
|
return doThrow(`path must not be empty`, TypeError);
|
|
8842
8842
|
}
|
|
8843
|
-
if (checkPath.isNotRelative(
|
|
8843
|
+
if (checkPath.isNotRelative(path86)) {
|
|
8844
8844
|
const r = "`path.relative()`d";
|
|
8845
8845
|
return doThrow(
|
|
8846
8846
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -8849,7 +8849,7 @@ var require_ignore = __commonJS({
|
|
|
8849
8849
|
}
|
|
8850
8850
|
return true;
|
|
8851
8851
|
};
|
|
8852
|
-
var isNotRelative = (
|
|
8852
|
+
var isNotRelative = (path86) => REGEX_TEST_INVALID_PATH.test(path86);
|
|
8853
8853
|
checkPath.isNotRelative = isNotRelative;
|
|
8854
8854
|
checkPath.convert = (p) => p;
|
|
8855
8855
|
var Ignore = class {
|
|
@@ -8879,19 +8879,19 @@ var require_ignore = __commonJS({
|
|
|
8879
8879
|
}
|
|
8880
8880
|
// @returns {TestResult}
|
|
8881
8881
|
_test(originalPath, cache2, checkUnignored, slices) {
|
|
8882
|
-
const
|
|
8882
|
+
const path86 = originalPath && checkPath.convert(originalPath);
|
|
8883
8883
|
checkPath(
|
|
8884
|
-
|
|
8884
|
+
path86,
|
|
8885
8885
|
originalPath,
|
|
8886
8886
|
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
8887
8887
|
);
|
|
8888
|
-
return this._t(
|
|
8888
|
+
return this._t(path86, cache2, checkUnignored, slices);
|
|
8889
8889
|
}
|
|
8890
|
-
checkIgnore(
|
|
8891
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(
|
|
8892
|
-
return this.test(
|
|
8890
|
+
checkIgnore(path86) {
|
|
8891
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path86)) {
|
|
8892
|
+
return this.test(path86);
|
|
8893
8893
|
}
|
|
8894
|
-
const slices =
|
|
8894
|
+
const slices = path86.split(SLASH).filter(Boolean);
|
|
8895
8895
|
slices.pop();
|
|
8896
8896
|
if (slices.length) {
|
|
8897
8897
|
const parent = this._t(
|
|
@@ -8904,18 +8904,18 @@ var require_ignore = __commonJS({
|
|
|
8904
8904
|
return parent;
|
|
8905
8905
|
}
|
|
8906
8906
|
}
|
|
8907
|
-
return this._rules.test(
|
|
8907
|
+
return this._rules.test(path86, false, MODE_CHECK_IGNORE);
|
|
8908
8908
|
}
|
|
8909
|
-
_t(
|
|
8910
|
-
if (
|
|
8911
|
-
return cache2[
|
|
8909
|
+
_t(path86, cache2, checkUnignored, slices) {
|
|
8910
|
+
if (path86 in cache2) {
|
|
8911
|
+
return cache2[path86];
|
|
8912
8912
|
}
|
|
8913
8913
|
if (!slices) {
|
|
8914
|
-
slices =
|
|
8914
|
+
slices = path86.split(SLASH).filter(Boolean);
|
|
8915
8915
|
}
|
|
8916
8916
|
slices.pop();
|
|
8917
8917
|
if (!slices.length) {
|
|
8918
|
-
return cache2[
|
|
8918
|
+
return cache2[path86] = this._rules.test(path86, checkUnignored, MODE_IGNORE);
|
|
8919
8919
|
}
|
|
8920
8920
|
const parent = this._t(
|
|
8921
8921
|
slices.join(SLASH) + SLASH,
|
|
@@ -8923,29 +8923,29 @@ var require_ignore = __commonJS({
|
|
|
8923
8923
|
checkUnignored,
|
|
8924
8924
|
slices
|
|
8925
8925
|
);
|
|
8926
|
-
return cache2[
|
|
8926
|
+
return cache2[path86] = parent.ignored ? parent : this._rules.test(path86, checkUnignored, MODE_IGNORE);
|
|
8927
8927
|
}
|
|
8928
|
-
ignores(
|
|
8929
|
-
return this._test(
|
|
8928
|
+
ignores(path86) {
|
|
8929
|
+
return this._test(path86, this._ignoreCache, false).ignored;
|
|
8930
8930
|
}
|
|
8931
8931
|
createFilter() {
|
|
8932
|
-
return (
|
|
8932
|
+
return (path86) => !this.ignores(path86);
|
|
8933
8933
|
}
|
|
8934
8934
|
filter(paths) {
|
|
8935
8935
|
return makeArray(paths).filter(this.createFilter());
|
|
8936
8936
|
}
|
|
8937
8937
|
// @returns {TestResult}
|
|
8938
|
-
test(
|
|
8939
|
-
return this._test(
|
|
8938
|
+
test(path86) {
|
|
8939
|
+
return this._test(path86, this._testCache, true);
|
|
8940
8940
|
}
|
|
8941
8941
|
};
|
|
8942
8942
|
var factory = (options) => new Ignore(options);
|
|
8943
|
-
var isPathValid = (
|
|
8943
|
+
var isPathValid = (path86) => checkPath(path86 && checkPath.convert(path86), path86, RETURN_FALSE);
|
|
8944
8944
|
var setupWindows = () => {
|
|
8945
8945
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
8946
8946
|
checkPath.convert = makePosix;
|
|
8947
8947
|
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
8948
|
-
checkPath.isNotRelative = (
|
|
8948
|
+
checkPath.isNotRelative = (path86) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path86) || isNotRelative(path86);
|
|
8949
8949
|
};
|
|
8950
8950
|
if (
|
|
8951
8951
|
// Detect `process` so that it can run in browsers.
|
|
@@ -12951,8 +12951,8 @@ var init_parseUtil = __esm({
|
|
|
12951
12951
|
init_errors();
|
|
12952
12952
|
init_en();
|
|
12953
12953
|
makeIssue = (params) => {
|
|
12954
|
-
const { data, path:
|
|
12955
|
-
const fullPath = [...
|
|
12954
|
+
const { data, path: path86, errorMaps, issueData } = params;
|
|
12955
|
+
const fullPath = [...path86, ...issueData.path || []];
|
|
12956
12956
|
const fullIssue = {
|
|
12957
12957
|
...issueData,
|
|
12958
12958
|
path: fullPath
|
|
@@ -13260,11 +13260,11 @@ var init_types2 = __esm({
|
|
|
13260
13260
|
init_parseUtil();
|
|
13261
13261
|
init_util();
|
|
13262
13262
|
ParseInputLazyPath = class {
|
|
13263
|
-
constructor(parent, value,
|
|
13263
|
+
constructor(parent, value, path86, key) {
|
|
13264
13264
|
this._cachedPath = [];
|
|
13265
13265
|
this.parent = parent;
|
|
13266
13266
|
this.data = value;
|
|
13267
|
-
this._path =
|
|
13267
|
+
this._path = path86;
|
|
13268
13268
|
this._key = key;
|
|
13269
13269
|
}
|
|
13270
13270
|
get path() {
|
|
@@ -16989,15 +16989,15 @@ function assignProp(target, prop, value) {
|
|
|
16989
16989
|
configurable: true
|
|
16990
16990
|
});
|
|
16991
16991
|
}
|
|
16992
|
-
function getElementAtPath(obj,
|
|
16993
|
-
if (!
|
|
16992
|
+
function getElementAtPath(obj, path86) {
|
|
16993
|
+
if (!path86)
|
|
16994
16994
|
return obj;
|
|
16995
|
-
return
|
|
16995
|
+
return path86.reduce((acc, key) => acc?.[key], obj);
|
|
16996
16996
|
}
|
|
16997
16997
|
function promiseAllObject(promisesObj) {
|
|
16998
16998
|
const keys = Object.keys(promisesObj);
|
|
16999
|
-
const
|
|
17000
|
-
return Promise.all(
|
|
16999
|
+
const promises13 = keys.map((key) => promisesObj[key]);
|
|
17000
|
+
return Promise.all(promises13).then((results) => {
|
|
17001
17001
|
const resolvedObj = {};
|
|
17002
17002
|
for (let i = 0; i < keys.length; i++) {
|
|
17003
17003
|
resolvedObj[keys[i]] = results[i];
|
|
@@ -17241,11 +17241,11 @@ function aborted(x, startIndex = 0) {
|
|
|
17241
17241
|
}
|
|
17242
17242
|
return false;
|
|
17243
17243
|
}
|
|
17244
|
-
function prefixIssues(
|
|
17244
|
+
function prefixIssues(path86, issues) {
|
|
17245
17245
|
return issues.map((iss) => {
|
|
17246
17246
|
var _a2;
|
|
17247
17247
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
17248
|
-
iss.path.unshift(
|
|
17248
|
+
iss.path.unshift(path86);
|
|
17249
17249
|
return iss;
|
|
17250
17250
|
});
|
|
17251
17251
|
}
|
|
@@ -17434,7 +17434,7 @@ function treeifyError(error40, _mapper) {
|
|
|
17434
17434
|
return issue2.message;
|
|
17435
17435
|
};
|
|
17436
17436
|
const result = { errors: [] };
|
|
17437
|
-
const processError = (error41,
|
|
17437
|
+
const processError = (error41, path86 = []) => {
|
|
17438
17438
|
var _a2, _b;
|
|
17439
17439
|
for (const issue2 of error41.issues) {
|
|
17440
17440
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -17444,7 +17444,7 @@ function treeifyError(error40, _mapper) {
|
|
|
17444
17444
|
} else if (issue2.code === "invalid_element") {
|
|
17445
17445
|
processError({ issues: issue2.issues }, issue2.path);
|
|
17446
17446
|
} else {
|
|
17447
|
-
const fullpath = [...
|
|
17447
|
+
const fullpath = [...path86, ...issue2.path];
|
|
17448
17448
|
if (fullpath.length === 0) {
|
|
17449
17449
|
result.errors.push(mapper(issue2));
|
|
17450
17450
|
continue;
|
|
@@ -17474,9 +17474,9 @@ function treeifyError(error40, _mapper) {
|
|
|
17474
17474
|
processError(error40);
|
|
17475
17475
|
return result;
|
|
17476
17476
|
}
|
|
17477
|
-
function toDotPath(
|
|
17477
|
+
function toDotPath(path86) {
|
|
17478
17478
|
const segs = [];
|
|
17479
|
-
for (const seg of
|
|
17479
|
+
for (const seg of path86) {
|
|
17480
17480
|
if (typeof seg === "number")
|
|
17481
17481
|
segs.push(`[${seg}]`);
|
|
17482
17482
|
else if (typeof seg === "symbol")
|
|
@@ -30959,10 +30959,10 @@ var require_src2 = __commonJS({
|
|
|
30959
30959
|
var fs_1 = __require("fs");
|
|
30960
30960
|
var debug_1 = __importDefault(require_src());
|
|
30961
30961
|
var log2 = debug_1.default("@kwsites/file-exists");
|
|
30962
|
-
function check2(
|
|
30963
|
-
log2(`checking %s`,
|
|
30962
|
+
function check2(path86, isFile, isDirectory) {
|
|
30963
|
+
log2(`checking %s`, path86);
|
|
30964
30964
|
try {
|
|
30965
|
-
const stat3 = fs_1.statSync(
|
|
30965
|
+
const stat3 = fs_1.statSync(path86);
|
|
30966
30966
|
if (stat3.isFile() && isFile) {
|
|
30967
30967
|
log2(`[OK] path represents a file`);
|
|
30968
30968
|
return true;
|
|
@@ -30982,8 +30982,8 @@ var require_src2 = __commonJS({
|
|
|
30982
30982
|
throw e;
|
|
30983
30983
|
}
|
|
30984
30984
|
}
|
|
30985
|
-
function exists2(
|
|
30986
|
-
return check2(
|
|
30985
|
+
function exists2(path86, type = exports.READABLE) {
|
|
30986
|
+
return check2(path86, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
30987
30987
|
}
|
|
30988
30988
|
exports.exists = exists2;
|
|
30989
30989
|
exports.FILE = 1;
|
|
@@ -31064,7 +31064,7 @@ var {
|
|
|
31064
31064
|
} = import_index.default;
|
|
31065
31065
|
|
|
31066
31066
|
// src/cli-version.ts
|
|
31067
|
-
var CLI_VERSION = "0.1.
|
|
31067
|
+
var CLI_VERSION = "0.1.76".length > 0 ? "0.1.76" : "0.0.0-dev";
|
|
31068
31068
|
|
|
31069
31069
|
// src/cli/defaults.ts
|
|
31070
31070
|
var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
|
|
@@ -31072,8 +31072,8 @@ var DEFAULT_FIREHOSE_URL = "https://buildautomaton-firehose.fly.dev";
|
|
|
31072
31072
|
|
|
31073
31073
|
// src/cli/run-cli-action.ts
|
|
31074
31074
|
init_cli_log_level();
|
|
31075
|
-
import * as
|
|
31076
|
-
import * as
|
|
31075
|
+
import * as fs64 from "node:fs";
|
|
31076
|
+
import * as path85 from "node:path";
|
|
31077
31077
|
|
|
31078
31078
|
// src/config.ts
|
|
31079
31079
|
import fs from "node:fs";
|
|
@@ -38065,8 +38065,8 @@ async function execGitFile(args, options) {
|
|
|
38065
38065
|
}
|
|
38066
38066
|
|
|
38067
38067
|
// src/git/changes/parse/normalize-git-diff-path.ts
|
|
38068
|
-
function normalizeGitDiffPath(
|
|
38069
|
-
return
|
|
38068
|
+
function normalizeGitDiffPath(path86) {
|
|
38069
|
+
return path86.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
|
|
38070
38070
|
}
|
|
38071
38071
|
|
|
38072
38072
|
// src/git/changes/parse/parse-name-status-entries.ts
|
|
@@ -38325,6 +38325,7 @@ async function loadPreTurnSnapshot(options) {
|
|
|
38325
38325
|
}
|
|
38326
38326
|
return data;
|
|
38327
38327
|
} catch (e) {
|
|
38328
|
+
if (e.code === "ENOENT") return null;
|
|
38328
38329
|
log2(
|
|
38329
38330
|
`[turn-diff] No pre-turn snapshot for run ${runId.slice(0, 8)}\u2026: ${e instanceof Error ? e.message : String(e)}`
|
|
38330
38331
|
);
|
|
@@ -42360,8 +42361,8 @@ function pathspec(...paths) {
|
|
|
42360
42361
|
cache.set(key, paths);
|
|
42361
42362
|
return key;
|
|
42362
42363
|
}
|
|
42363
|
-
function isPathSpec(
|
|
42364
|
-
return
|
|
42364
|
+
function isPathSpec(path86) {
|
|
42365
|
+
return path86 instanceof String && cache.has(path86);
|
|
42365
42366
|
}
|
|
42366
42367
|
function toPaths(pathSpec) {
|
|
42367
42368
|
return cache.get(pathSpec) || [];
|
|
@@ -42450,8 +42451,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
42450
42451
|
function forEachLineWithContent(input, callback) {
|
|
42451
42452
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
42452
42453
|
}
|
|
42453
|
-
function folderExists(
|
|
42454
|
-
return (0, import_file_exists.exists)(
|
|
42454
|
+
function folderExists(path86) {
|
|
42455
|
+
return (0, import_file_exists.exists)(path86, import_file_exists.FOLDER);
|
|
42455
42456
|
}
|
|
42456
42457
|
function append(target, item) {
|
|
42457
42458
|
if (Array.isArray(target)) {
|
|
@@ -42855,8 +42856,8 @@ function checkIsRepoRootTask() {
|
|
|
42855
42856
|
commands,
|
|
42856
42857
|
format: "utf-8",
|
|
42857
42858
|
onError,
|
|
42858
|
-
parser(
|
|
42859
|
-
return /^\.(git)?$/.test(
|
|
42859
|
+
parser(path86) {
|
|
42860
|
+
return /^\.(git)?$/.test(path86.trim());
|
|
42860
42861
|
}
|
|
42861
42862
|
};
|
|
42862
42863
|
}
|
|
@@ -43290,11 +43291,11 @@ function parseGrep(grep) {
|
|
|
43290
43291
|
const paths = /* @__PURE__ */ new Set();
|
|
43291
43292
|
const results = {};
|
|
43292
43293
|
forEachLineWithContent(grep, (input) => {
|
|
43293
|
-
const [
|
|
43294
|
-
paths.add(
|
|
43295
|
-
(results[
|
|
43294
|
+
const [path86, line, preview] = input.split(NULL);
|
|
43295
|
+
paths.add(path86);
|
|
43296
|
+
(results[path86] = results[path86] || []).push({
|
|
43296
43297
|
line: asNumber(line),
|
|
43297
|
-
path:
|
|
43298
|
+
path: path86,
|
|
43298
43299
|
preview
|
|
43299
43300
|
});
|
|
43300
43301
|
});
|
|
@@ -44059,14 +44060,14 @@ var init_hash_object = __esm2({
|
|
|
44059
44060
|
init_task();
|
|
44060
44061
|
}
|
|
44061
44062
|
});
|
|
44062
|
-
function parseInit(bare,
|
|
44063
|
+
function parseInit(bare, path86, text) {
|
|
44063
44064
|
const response = String(text).trim();
|
|
44064
44065
|
let result;
|
|
44065
44066
|
if (result = initResponseRegex.exec(response)) {
|
|
44066
|
-
return new InitSummary(bare,
|
|
44067
|
+
return new InitSummary(bare, path86, false, result[1]);
|
|
44067
44068
|
}
|
|
44068
44069
|
if (result = reInitResponseRegex.exec(response)) {
|
|
44069
|
-
return new InitSummary(bare,
|
|
44070
|
+
return new InitSummary(bare, path86, true, result[1]);
|
|
44070
44071
|
}
|
|
44071
44072
|
let gitDir = "";
|
|
44072
44073
|
const tokens = response.split(" ");
|
|
@@ -44077,7 +44078,7 @@ function parseInit(bare, path84, text) {
|
|
|
44077
44078
|
break;
|
|
44078
44079
|
}
|
|
44079
44080
|
}
|
|
44080
|
-
return new InitSummary(bare,
|
|
44081
|
+
return new InitSummary(bare, path86, /^re/i.test(response), gitDir);
|
|
44081
44082
|
}
|
|
44082
44083
|
var InitSummary;
|
|
44083
44084
|
var initResponseRegex;
|
|
@@ -44086,9 +44087,9 @@ var init_InitSummary = __esm2({
|
|
|
44086
44087
|
"src/lib/responses/InitSummary.ts"() {
|
|
44087
44088
|
"use strict";
|
|
44088
44089
|
InitSummary = class {
|
|
44089
|
-
constructor(bare,
|
|
44090
|
+
constructor(bare, path86, existing, gitDir) {
|
|
44090
44091
|
this.bare = bare;
|
|
44091
|
-
this.path =
|
|
44092
|
+
this.path = path86;
|
|
44092
44093
|
this.existing = existing;
|
|
44093
44094
|
this.gitDir = gitDir;
|
|
44094
44095
|
}
|
|
@@ -44100,7 +44101,7 @@ var init_InitSummary = __esm2({
|
|
|
44100
44101
|
function hasBareCommand(command) {
|
|
44101
44102
|
return command.includes(bareCommand);
|
|
44102
44103
|
}
|
|
44103
|
-
function initTask(bare = false,
|
|
44104
|
+
function initTask(bare = false, path86, customArgs) {
|
|
44104
44105
|
const commands = ["init", ...customArgs];
|
|
44105
44106
|
if (bare && !hasBareCommand(commands)) {
|
|
44106
44107
|
commands.splice(1, 0, bareCommand);
|
|
@@ -44109,7 +44110,7 @@ function initTask(bare = false, path84, customArgs) {
|
|
|
44109
44110
|
commands,
|
|
44110
44111
|
format: "utf-8",
|
|
44111
44112
|
parser(text) {
|
|
44112
|
-
return parseInit(commands.includes("--bare"),
|
|
44113
|
+
return parseInit(commands.includes("--bare"), path86, text);
|
|
44113
44114
|
}
|
|
44114
44115
|
};
|
|
44115
44116
|
}
|
|
@@ -44925,12 +44926,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
44925
44926
|
"use strict";
|
|
44926
44927
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
44927
44928
|
FileStatusSummary = class {
|
|
44928
|
-
constructor(
|
|
44929
|
-
this.path =
|
|
44929
|
+
constructor(path86, index, working_dir) {
|
|
44930
|
+
this.path = path86;
|
|
44930
44931
|
this.index = index;
|
|
44931
44932
|
this.working_dir = working_dir;
|
|
44932
44933
|
if (index === "R" || working_dir === "R") {
|
|
44933
|
-
const detail = fromPathRegex.exec(
|
|
44934
|
+
const detail = fromPathRegex.exec(path86) || [null, path86, path86];
|
|
44934
44935
|
this.from = detail[2] || "";
|
|
44935
44936
|
this.path = detail[1] || "";
|
|
44936
44937
|
}
|
|
@@ -44961,14 +44962,14 @@ function splitLine(result, lineStr) {
|
|
|
44961
44962
|
default:
|
|
44962
44963
|
return;
|
|
44963
44964
|
}
|
|
44964
|
-
function data(index, workingDir,
|
|
44965
|
+
function data(index, workingDir, path86) {
|
|
44965
44966
|
const raw = `${index}${workingDir}`;
|
|
44966
44967
|
const handler = parsers6.get(raw);
|
|
44967
44968
|
if (handler) {
|
|
44968
|
-
handler(result,
|
|
44969
|
+
handler(result, path86);
|
|
44969
44970
|
}
|
|
44970
44971
|
if (raw !== "##" && raw !== "!!") {
|
|
44971
|
-
result.files.push(new FileStatusSummary(
|
|
44972
|
+
result.files.push(new FileStatusSummary(path86, index, workingDir));
|
|
44972
44973
|
}
|
|
44973
44974
|
}
|
|
44974
44975
|
}
|
|
@@ -45277,9 +45278,9 @@ var init_simple_git_api = __esm2({
|
|
|
45277
45278
|
next
|
|
45278
45279
|
);
|
|
45279
45280
|
}
|
|
45280
|
-
hashObject(
|
|
45281
|
+
hashObject(path86, write) {
|
|
45281
45282
|
return this._runTask(
|
|
45282
|
-
hashObjectTask(
|
|
45283
|
+
hashObjectTask(path86, write === true),
|
|
45283
45284
|
trailingFunctionArgument(arguments)
|
|
45284
45285
|
);
|
|
45285
45286
|
}
|
|
@@ -45632,8 +45633,8 @@ var init_branch = __esm2({
|
|
|
45632
45633
|
}
|
|
45633
45634
|
});
|
|
45634
45635
|
function toPath(input) {
|
|
45635
|
-
const
|
|
45636
|
-
return
|
|
45636
|
+
const path86 = input.trim().replace(/^["']|["']$/g, "");
|
|
45637
|
+
return path86 && normalize3(path86);
|
|
45637
45638
|
}
|
|
45638
45639
|
var parseCheckIgnore;
|
|
45639
45640
|
var init_CheckIgnore = __esm2({
|
|
@@ -45947,8 +45948,8 @@ __export2(sub_module_exports, {
|
|
|
45947
45948
|
subModuleTask: () => subModuleTask,
|
|
45948
45949
|
updateSubModuleTask: () => updateSubModuleTask
|
|
45949
45950
|
});
|
|
45950
|
-
function addSubModuleTask(repo,
|
|
45951
|
-
return subModuleTask(["add", repo,
|
|
45951
|
+
function addSubModuleTask(repo, path86) {
|
|
45952
|
+
return subModuleTask(["add", repo, path86]);
|
|
45952
45953
|
}
|
|
45953
45954
|
function initSubModuleTask(customArgs) {
|
|
45954
45955
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -46281,8 +46282,8 @@ var require_git = __commonJS2({
|
|
|
46281
46282
|
}
|
|
46282
46283
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
46283
46284
|
};
|
|
46284
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
46285
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
46285
|
+
Git2.prototype.submoduleAdd = function(repo, path86, then) {
|
|
46286
|
+
return this._runTask(addSubModuleTask2(repo, path86), trailingFunctionArgument2(arguments));
|
|
46286
46287
|
};
|
|
46287
46288
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
46288
46289
|
return this._runTask(
|
|
@@ -47021,8 +47022,8 @@ function parseNumstatEntries(lines) {
|
|
|
47021
47022
|
}
|
|
47022
47023
|
function parseNumstat(lines) {
|
|
47023
47024
|
const m = /* @__PURE__ */ new Map();
|
|
47024
|
-
for (const [
|
|
47025
|
-
m.set(
|
|
47025
|
+
for (const [path86, entry] of parseNumstatEntries(lines)) {
|
|
47026
|
+
m.set(path86, { additions: entry.additions, deletions: entry.deletions });
|
|
47026
47027
|
}
|
|
47027
47028
|
return m;
|
|
47028
47029
|
}
|
|
@@ -47305,23 +47306,26 @@ function formatRemoteDisplayLabel(remoteUrl) {
|
|
|
47305
47306
|
}
|
|
47306
47307
|
|
|
47307
47308
|
// src/git/changes/repo/get-working-tree-change-repo-details.ts
|
|
47308
|
-
import * as
|
|
47309
|
+
import * as path53 from "node:path";
|
|
47309
47310
|
|
|
47310
47311
|
// src/git/changes/repo/build-working-tree-change-repo-detail.ts
|
|
47311
|
-
import * as
|
|
47312
|
+
import * as path52 from "node:path";
|
|
47312
47313
|
|
|
47313
47314
|
// src/git/is-git-repo.ts
|
|
47315
|
+
import * as fs33 from "node:fs";
|
|
47316
|
+
import * as path44 from "node:path";
|
|
47314
47317
|
async function isGitRepoDirectory(dirPath) {
|
|
47315
47318
|
try {
|
|
47316
|
-
|
|
47319
|
+
await fs33.promises.access(path44.join(dirPath, ".git"));
|
|
47320
|
+
return true;
|
|
47317
47321
|
} catch {
|
|
47318
47322
|
return false;
|
|
47319
47323
|
}
|
|
47320
47324
|
}
|
|
47321
47325
|
|
|
47322
47326
|
// src/git/changes/listing/apply-untracked-file-stats.ts
|
|
47323
|
-
import * as
|
|
47324
|
-
import * as
|
|
47327
|
+
import * as fs34 from "node:fs";
|
|
47328
|
+
import * as path45 from "node:path";
|
|
47325
47329
|
|
|
47326
47330
|
// src/git/changes/lines/count-lines.ts
|
|
47327
47331
|
import { createReadStream } from "node:fs";
|
|
@@ -47353,7 +47357,7 @@ function createUntrackedStatsApplier(options) {
|
|
|
47353
47357
|
if (!options.untrackedSet.has(pathInRepo)) return;
|
|
47354
47358
|
if (options.nameByPath.has(pathInRepo)) return;
|
|
47355
47359
|
if (row.change === "moved") return;
|
|
47356
|
-
const repoFilePath =
|
|
47360
|
+
const repoFilePath = path45.join(options.repoGitCwd, pathInRepo);
|
|
47357
47361
|
const fromGit = await numstatFromGitNoIndex(options.g, pathInRepo);
|
|
47358
47362
|
if (fromGit) {
|
|
47359
47363
|
row.additions = fromGit.additions;
|
|
@@ -47361,7 +47365,7 @@ function createUntrackedStatsApplier(options) {
|
|
|
47361
47365
|
return;
|
|
47362
47366
|
}
|
|
47363
47367
|
try {
|
|
47364
|
-
const st = await
|
|
47368
|
+
const st = await fs34.promises.stat(repoFilePath);
|
|
47365
47369
|
row.additions = st.isFile() ? await countTextFileLines(repoFilePath) : 0;
|
|
47366
47370
|
} catch {
|
|
47367
47371
|
row.additions = 0;
|
|
@@ -47438,7 +47442,7 @@ async function buildChangedFileRowsFromPaths(options) {
|
|
|
47438
47442
|
}
|
|
47439
47443
|
|
|
47440
47444
|
// src/git/changes/listing/enrich-working-tree-file-rows.ts
|
|
47441
|
-
import * as
|
|
47445
|
+
import * as path47 from "node:path";
|
|
47442
47446
|
|
|
47443
47447
|
// src/git/changes/patch/patch-truncate.ts
|
|
47444
47448
|
function truncatePatch(s) {
|
|
@@ -47526,10 +47530,10 @@ async function readGitBlobLines(repoCwd, pathInRepo) {
|
|
|
47526
47530
|
}
|
|
47527
47531
|
|
|
47528
47532
|
// src/git/changes/patch/hydrate/read-worktree-file-lines.ts
|
|
47529
|
-
import * as
|
|
47533
|
+
import * as fs35 from "node:fs";
|
|
47530
47534
|
async function readWorktreeFileLines(filePath) {
|
|
47531
47535
|
try {
|
|
47532
|
-
const raw = await
|
|
47536
|
+
const raw = await fs35.promises.readFile(filePath, "utf8");
|
|
47533
47537
|
return raw.split(/\r?\n/);
|
|
47534
47538
|
} catch {
|
|
47535
47539
|
return null;
|
|
@@ -47667,8 +47671,8 @@ async function unifiedDiffForFileInRange(repoCwd, range, pathInRepo, change, mov
|
|
|
47667
47671
|
}
|
|
47668
47672
|
|
|
47669
47673
|
// src/git/changes/total-lines/resolve-changed-file-total-lines.ts
|
|
47670
|
-
import * as
|
|
47671
|
-
import * as
|
|
47674
|
+
import * as fs36 from "node:fs";
|
|
47675
|
+
import * as path46 from "node:path";
|
|
47672
47676
|
var MAX_BYTES = 512e3;
|
|
47673
47677
|
async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
|
|
47674
47678
|
const spec = `${ref}:${pathInRepo}`;
|
|
@@ -47688,13 +47692,13 @@ async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
|
|
|
47688
47692
|
}
|
|
47689
47693
|
async function resolveWorkingTreeFileTotalLines(options) {
|
|
47690
47694
|
if (options.isBinary) return null;
|
|
47691
|
-
const filePath =
|
|
47695
|
+
const filePath = path46.join(options.repoGitCwd, options.pathInRepo);
|
|
47692
47696
|
if (options.change === "removed") {
|
|
47693
47697
|
return countLinesInGitRef(options.repoGitCwd, "HEAD", options.pathInRepo);
|
|
47694
47698
|
}
|
|
47695
47699
|
if (options.change === "moved" || options.change === "modified") {
|
|
47696
47700
|
try {
|
|
47697
|
-
const st = await
|
|
47701
|
+
const st = await fs36.promises.stat(filePath);
|
|
47698
47702
|
if (!st.isFile()) return null;
|
|
47699
47703
|
return await countTextFileLines(filePath);
|
|
47700
47704
|
} catch {
|
|
@@ -47737,7 +47741,7 @@ async function enrichWorkingTreeFileRows(options) {
|
|
|
47737
47741
|
row.workspaceRelPath,
|
|
47738
47742
|
options.repoPathRelativeToWorkspaceRoot
|
|
47739
47743
|
);
|
|
47740
|
-
const filePath =
|
|
47744
|
+
const filePath = path47.join(options.repoGitCwd, filePathRelativeToRepoRoot);
|
|
47741
47745
|
const hydrateKind = row.change === "moved" ? "modified" : row.change;
|
|
47742
47746
|
let patch = await unifiedDiffForFile(
|
|
47743
47747
|
options.repoGitCwd,
|
|
@@ -47895,7 +47899,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoPathRelativeToWorkspaceRo
|
|
|
47895
47899
|
}
|
|
47896
47900
|
|
|
47897
47901
|
// src/git/changes/listing/list-changed-files-for-commit.ts
|
|
47898
|
-
import * as
|
|
47902
|
+
import * as path48 from "node:path";
|
|
47899
47903
|
|
|
47900
47904
|
// src/git/changes/listing/enrich-commit-file-rows.ts
|
|
47901
47905
|
async function enrichCommitFileRows(options) {
|
|
@@ -47940,7 +47944,7 @@ async function parentForCommitDiff(g, sha) {
|
|
|
47940
47944
|
var COMMIT_FILES_CACHE_TTL_MS = 5 * 6e4;
|
|
47941
47945
|
var commitFilesCache = /* @__PURE__ */ new Map();
|
|
47942
47946
|
function commitFilesCacheKey(repoGitCwd, commitSha) {
|
|
47943
|
-
return `${
|
|
47947
|
+
return `${path48.resolve(repoGitCwd)}:${commitSha}`;
|
|
47944
47948
|
}
|
|
47945
47949
|
async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspaceRoot, commitSha, options = {}) {
|
|
47946
47950
|
const cacheKey = commitFilesCacheKey(repoGitCwd, commitSha);
|
|
@@ -47995,7 +47999,7 @@ async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspace
|
|
|
47995
47999
|
}
|
|
47996
48000
|
|
|
47997
48001
|
// src/git/commits/list-unpushed-commits.ts
|
|
47998
|
-
import * as
|
|
48002
|
+
import * as path49 from "node:path";
|
|
47999
48003
|
|
|
48000
48004
|
// src/git/commits/lib/parse-log-lines.ts
|
|
48001
48005
|
function parseLogShaDateSubjectLines(raw) {
|
|
@@ -48030,7 +48034,7 @@ async function gitLogNotReachableFromBase(g, baseSha, headSha) {
|
|
|
48030
48034
|
}
|
|
48031
48035
|
}
|
|
48032
48036
|
async function listUnpushedCommits(repoDir) {
|
|
48033
|
-
const key =
|
|
48037
|
+
const key = path49.resolve(repoDir);
|
|
48034
48038
|
const now = Date.now();
|
|
48035
48039
|
const cached2 = unpushedCache.get(key);
|
|
48036
48040
|
if (cached2 && cached2.expiresAt > now) return cached2.commits;
|
|
@@ -48091,7 +48095,7 @@ async function loadRecentAndUnpushedCommitsForRepoDetail(repoDir, recentCommitsL
|
|
|
48091
48095
|
}
|
|
48092
48096
|
|
|
48093
48097
|
// src/git/changes/repo/load-working-tree-change-repo-git-info.ts
|
|
48094
|
-
import * as
|
|
48098
|
+
import * as path50 from "node:path";
|
|
48095
48099
|
|
|
48096
48100
|
// src/git/remote-origin-url.ts
|
|
48097
48101
|
async function getRemoteOriginUrl(gitDir) {
|
|
@@ -48106,7 +48110,7 @@ async function getRemoteOriginUrl(gitDir) {
|
|
|
48106
48110
|
|
|
48107
48111
|
// src/git/changes/repo/load-working-tree-change-repo-git-info.ts
|
|
48108
48112
|
async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
|
|
48109
|
-
const resolvedCheckoutPath =
|
|
48113
|
+
const resolvedCheckoutPath = path50.resolve(checkoutPath);
|
|
48110
48114
|
const git = cliSimpleGit(resolvedCheckoutPath);
|
|
48111
48115
|
await yieldToEventLoop2();
|
|
48112
48116
|
const [branch, remoteUrl] = await Promise.all([
|
|
@@ -48121,14 +48125,14 @@ async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
|
|
|
48121
48125
|
}
|
|
48122
48126
|
|
|
48123
48127
|
// src/git/changes/repo/resolve-repo-path-relative-to-workspace-root.ts
|
|
48124
|
-
import * as
|
|
48128
|
+
import * as path51 from "node:path";
|
|
48125
48129
|
async function resolveRepoPathRelativeToWorkspaceRoot(options) {
|
|
48126
|
-
const checkoutPath =
|
|
48130
|
+
const checkoutPath = path51.resolve(options.checkoutPath);
|
|
48127
48131
|
const git = cliSimpleGit(checkoutPath);
|
|
48128
|
-
const sessionParentPath = options.sessionParentPath ?
|
|
48132
|
+
const sessionParentPath = options.sessionParentPath ? path51.resolve(options.sessionParentPath) : null;
|
|
48129
48133
|
let repoPathRelativeToWorkspaceRoot;
|
|
48130
48134
|
if (sessionParentPath) {
|
|
48131
|
-
const checkoutPathRelativeToSessionParent =
|
|
48135
|
+
const checkoutPathRelativeToSessionParent = path51.relative(sessionParentPath, checkoutPath);
|
|
48132
48136
|
repoPathRelativeToWorkspaceRoot = checkoutPathRelativeToSessionParent === "" ? "." : checkoutPathRelativeToSessionParent.replace(/\\/g, "/");
|
|
48133
48137
|
} else {
|
|
48134
48138
|
let gitTopLevel = checkoutPath;
|
|
@@ -48138,8 +48142,8 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
|
|
|
48138
48142
|
} catch {
|
|
48139
48143
|
gitTopLevel = checkoutPath;
|
|
48140
48144
|
}
|
|
48141
|
-
const gitTopLevelRelativeToBridgeRoot =
|
|
48142
|
-
repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ?
|
|
48145
|
+
const gitTopLevelRelativeToBridgeRoot = path51.relative(options.bridgeRoot, path51.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
|
|
48146
|
+
repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path51.basename(path51.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
|
|
48143
48147
|
}
|
|
48144
48148
|
return normalizeRepoPathRelativeToWorkspaceRoot(
|
|
48145
48149
|
repoPathRelativeToWorkspaceRoot === "" ? "." : repoPathRelativeToWorkspaceRoot
|
|
@@ -48148,10 +48152,10 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
|
|
|
48148
48152
|
|
|
48149
48153
|
// src/git/changes/repo/build-working-tree-change-repo-detail.ts
|
|
48150
48154
|
async function buildWorkingTreeChangeRepoDetail(options) {
|
|
48151
|
-
const checkoutPath =
|
|
48155
|
+
const checkoutPath = path52.resolve(options.targetPath);
|
|
48152
48156
|
if (!await isGitRepoDirectory(checkoutPath)) return null;
|
|
48153
48157
|
const isCommitView = options.basis.kind === "commit";
|
|
48154
|
-
const sessionParentPath = options.sessionParentPath ?
|
|
48158
|
+
const sessionParentPath = options.sessionParentPath ? path52.resolve(options.sessionParentPath) : null;
|
|
48155
48159
|
const git = cliSimpleGit(checkoutPath);
|
|
48156
48160
|
const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
|
|
48157
48161
|
checkoutPath,
|
|
@@ -48199,8 +48203,8 @@ async function buildWorkingTreeChangeRepoDetail(options) {
|
|
|
48199
48203
|
|
|
48200
48204
|
// src/git/changes/repo/get-working-tree-change-repo-details.ts
|
|
48201
48205
|
async function getWorkingTreeChangeRepoDetails(options) {
|
|
48202
|
-
const bridgeRoot =
|
|
48203
|
-
const sessionParentPath = options.sessionParentPath ?
|
|
48206
|
+
const bridgeRoot = path53.resolve(getBridgeRoot());
|
|
48207
|
+
const sessionParentPath = options.sessionParentPath ? path53.resolve(options.sessionParentPath) : null;
|
|
48204
48208
|
const out = [];
|
|
48205
48209
|
const filter = options.repoFilterRelPath != null ? normalizeRepoPathRelativeToWorkspaceRoot(options.repoFilterRelPath) : null;
|
|
48206
48210
|
const basisInput = options.basis ?? { kind: "working" };
|
|
@@ -48231,9 +48235,9 @@ async function getWorkingTreeChangeRepoDetails(options) {
|
|
|
48231
48235
|
}
|
|
48232
48236
|
|
|
48233
48237
|
// src/git/changes/repo/get-working-tree-change-file-patch.ts
|
|
48234
|
-
import * as
|
|
48238
|
+
import * as path54 from "node:path";
|
|
48235
48239
|
async function getWorkingTreeChangeFilePatch(options) {
|
|
48236
|
-
const repoGitCwd =
|
|
48240
|
+
const repoGitCwd = path54.resolve(options.repoGitCwd);
|
|
48237
48241
|
if (!await isGitRepoDirectory(repoGitCwd)) {
|
|
48238
48242
|
throw new Error("Not a git repository");
|
|
48239
48243
|
}
|
|
@@ -48272,7 +48276,7 @@ async function getWorkingTreeChangeFilePatch(options) {
|
|
|
48272
48276
|
});
|
|
48273
48277
|
return { patchContent: patchContent2, totalLines: totalLines2 };
|
|
48274
48278
|
}
|
|
48275
|
-
const filePath =
|
|
48279
|
+
const filePath = path54.join(repoGitCwd, filePathRelativeToRepoRoot);
|
|
48276
48280
|
const hydrateKind = options.change === "moved" ? "modified" : options.change;
|
|
48277
48281
|
let patchContent = await unifiedDiffForFile(
|
|
48278
48282
|
repoGitCwd,
|
|
@@ -48318,18 +48322,18 @@ function parseWorkingTreeChangeKind(value) {
|
|
|
48318
48322
|
}
|
|
48319
48323
|
|
|
48320
48324
|
// src/worktrees/manager/git/get-session-working-tree-change-file-patch.ts
|
|
48321
|
-
import * as
|
|
48325
|
+
import * as path55 from "node:path";
|
|
48322
48326
|
async function getSessionWorkingTreeChangeFilePatch(cache2, sessionId, discover, opts) {
|
|
48323
48327
|
const targets = await resolveCommitTargetsAsync(sessionId, cache2, discover);
|
|
48324
|
-
const bridgeRoot =
|
|
48325
|
-
const sessionParentPath = cache2.getSessionParentPath(sessionId) ?
|
|
48328
|
+
const bridgeRoot = path55.resolve(getBridgeRoot());
|
|
48329
|
+
const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path55.resolve(cache2.getSessionParentPath(sessionId)) : null;
|
|
48326
48330
|
const repoPathRelativeToWorkspaceRootFilter = normalizeRepoPathRelativeToWorkspaceRoot(
|
|
48327
48331
|
opts.repoRelPath.trim()
|
|
48328
48332
|
);
|
|
48329
48333
|
let result = null;
|
|
48330
48334
|
await forEachWithGitYield(targets, async (targetPath) => {
|
|
48331
48335
|
if (result) return;
|
|
48332
|
-
const checkoutPath =
|
|
48336
|
+
const checkoutPath = path55.resolve(targetPath);
|
|
48333
48337
|
if (!await isGitRepoDirectory(checkoutPath)) return;
|
|
48334
48338
|
const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
|
|
48335
48339
|
checkoutPath,
|
|
@@ -48362,13 +48366,13 @@ async function pushSessionUpstream(cache2, sessionId, discover) {
|
|
|
48362
48366
|
}
|
|
48363
48367
|
|
|
48364
48368
|
// src/worktrees/remove-session-worktrees.ts
|
|
48365
|
-
import * as
|
|
48369
|
+
import * as fs39 from "node:fs";
|
|
48366
48370
|
|
|
48367
48371
|
// src/git/worktrees/worktree-remove.ts
|
|
48368
|
-
import * as
|
|
48372
|
+
import * as fs38 from "node:fs";
|
|
48369
48373
|
|
|
48370
48374
|
// src/worktrees/is-removable-session-worktree-checkout-path.ts
|
|
48371
|
-
import
|
|
48375
|
+
import path56 from "node:path";
|
|
48372
48376
|
init_normalize_resolved_path();
|
|
48373
48377
|
function isBridgeRootCheckoutPath(checkoutPath) {
|
|
48374
48378
|
return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
|
|
@@ -48377,23 +48381,23 @@ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath)
|
|
|
48377
48381
|
if (isBridgeRootCheckoutPath(checkoutPath)) return false;
|
|
48378
48382
|
const normalized = normalizeResolvedPath(checkoutPath);
|
|
48379
48383
|
const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
|
|
48380
|
-
const rel =
|
|
48381
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
48384
|
+
const rel = path56.relative(worktreesRoot, normalized);
|
|
48385
|
+
if (rel === "" || rel.startsWith("..") || path56.isAbsolute(rel)) return false;
|
|
48382
48386
|
return true;
|
|
48383
48387
|
}
|
|
48384
48388
|
|
|
48385
48389
|
// src/git/worktrees/resolve-main-repo-from-git-file.ts
|
|
48386
|
-
import * as
|
|
48387
|
-
import * as
|
|
48390
|
+
import * as fs37 from "node:fs";
|
|
48391
|
+
import * as path57 from "node:path";
|
|
48388
48392
|
function resolveMainRepoFromWorktreeGitFile(wt) {
|
|
48389
|
-
const gitDirFile =
|
|
48390
|
-
if (!
|
|
48391
|
-
const first2 =
|
|
48393
|
+
const gitDirFile = path57.join(wt, ".git");
|
|
48394
|
+
if (!fs37.existsSync(gitDirFile) || !fs37.statSync(gitDirFile).isFile()) return "";
|
|
48395
|
+
const first2 = fs37.readFileSync(gitDirFile, "utf8").trim();
|
|
48392
48396
|
const m = first2.match(/^gitdir:\s*(.+)$/im);
|
|
48393
48397
|
if (!m) return "";
|
|
48394
|
-
const gitWorktreePath =
|
|
48395
|
-
const gitDir =
|
|
48396
|
-
return
|
|
48398
|
+
const gitWorktreePath = path57.resolve(wt, m[1].trim());
|
|
48399
|
+
const gitDir = path57.dirname(path57.dirname(gitWorktreePath));
|
|
48400
|
+
return path57.dirname(gitDir);
|
|
48397
48401
|
}
|
|
48398
48402
|
|
|
48399
48403
|
// src/git/worktrees/worktree-remove.ts
|
|
@@ -48404,7 +48408,7 @@ async function gitWorktreeRemoveForce(worktreePath) {
|
|
|
48404
48408
|
return true;
|
|
48405
48409
|
}
|
|
48406
48410
|
if (isBridgeRootCheckoutPath(worktreePath)) return false;
|
|
48407
|
-
|
|
48411
|
+
fs38.rmSync(worktreePath, { recursive: true, force: true });
|
|
48408
48412
|
return true;
|
|
48409
48413
|
}
|
|
48410
48414
|
|
|
@@ -48426,7 +48430,7 @@ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
|
|
|
48426
48430
|
log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
|
|
48427
48431
|
if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
|
|
48428
48432
|
try {
|
|
48429
|
-
|
|
48433
|
+
fs39.rmSync(wt, { recursive: true, force: true });
|
|
48430
48434
|
} catch {
|
|
48431
48435
|
}
|
|
48432
48436
|
}
|
|
@@ -48451,6 +48455,7 @@ async function gitRenameCurrentBranch(repoDir, newName) {
|
|
|
48451
48455
|
async function renameSessionWorktreeBranches(paths, newBranch, log2) {
|
|
48452
48456
|
const safe = newBranch.replace(/[^a-zA-Z0-9/_-]+/g, "-").slice(0, 80) || "session-branch";
|
|
48453
48457
|
await forEachWithGitYield(paths, async (wt) => {
|
|
48458
|
+
if (!await isGitRepoDirectory(wt)) return;
|
|
48454
48459
|
try {
|
|
48455
48460
|
await gitRenameCurrentBranch(wt, safe);
|
|
48456
48461
|
log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
|
|
@@ -48472,12 +48477,12 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
|
|
|
48472
48477
|
// src/worktrees/discovery/discover-session-worktree-on-disk.ts
|
|
48473
48478
|
init_cli_process_interrupt();
|
|
48474
48479
|
init_yield_to_event_loop();
|
|
48475
|
-
import * as
|
|
48476
|
-
import * as
|
|
48480
|
+
import * as fs43 from "node:fs";
|
|
48481
|
+
import * as path62 from "node:path";
|
|
48477
48482
|
|
|
48478
48483
|
// src/worktrees/discovery/collect-worktree-paths.ts
|
|
48479
|
-
import * as
|
|
48480
|
-
import * as
|
|
48484
|
+
import * as fs41 from "node:fs";
|
|
48485
|
+
import * as path59 from "node:path";
|
|
48481
48486
|
|
|
48482
48487
|
// src/worktrees/discovery/disk-walk-constants.ts
|
|
48483
48488
|
var DISK_WALK_YIELD_EVERY = 64;
|
|
@@ -48507,8 +48512,8 @@ function shouldSkipDiskWalkEntry(name) {
|
|
|
48507
48512
|
// src/worktrees/discovery/disk-walk-utils.ts
|
|
48508
48513
|
init_cli_process_interrupt();
|
|
48509
48514
|
init_yield_to_event_loop();
|
|
48510
|
-
import * as
|
|
48511
|
-
import * as
|
|
48515
|
+
import * as fs40 from "node:fs";
|
|
48516
|
+
import * as path58 from "node:path";
|
|
48512
48517
|
async function yieldDuringDiskWalk(state) {
|
|
48513
48518
|
state.entries++;
|
|
48514
48519
|
if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
|
|
@@ -48518,7 +48523,7 @@ async function yieldDuringDiskWalk(state) {
|
|
|
48518
48523
|
}
|
|
48519
48524
|
async function isGitDir(dirPath) {
|
|
48520
48525
|
try {
|
|
48521
|
-
await
|
|
48526
|
+
await fs40.promises.access(path58.join(dirPath, ".git"));
|
|
48522
48527
|
return true;
|
|
48523
48528
|
} catch {
|
|
48524
48529
|
return false;
|
|
@@ -48532,23 +48537,23 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
|
|
|
48532
48537
|
const walk = async (dir) => {
|
|
48533
48538
|
if (!await yieldDuringDiskWalk(state)) return;
|
|
48534
48539
|
if (await isGitDir(dir)) {
|
|
48535
|
-
out.push(
|
|
48540
|
+
out.push(path59.resolve(dir));
|
|
48536
48541
|
return;
|
|
48537
48542
|
}
|
|
48538
48543
|
let entries;
|
|
48539
48544
|
try {
|
|
48540
|
-
entries = await
|
|
48545
|
+
entries = await fs41.promises.readdir(dir, { withFileTypes: true });
|
|
48541
48546
|
} catch {
|
|
48542
48547
|
return;
|
|
48543
48548
|
}
|
|
48544
48549
|
for (const e of entries) {
|
|
48545
48550
|
if (shouldSkipDiskWalkEntry(e.name)) continue;
|
|
48546
|
-
const full =
|
|
48551
|
+
const full = path59.join(dir, e.name);
|
|
48547
48552
|
if (!e.isDirectory()) continue;
|
|
48548
48553
|
await walk(full);
|
|
48549
48554
|
}
|
|
48550
48555
|
};
|
|
48551
|
-
await walk(
|
|
48556
|
+
await walk(path59.resolve(rootPath));
|
|
48552
48557
|
return { paths: [...new Set(out)], entriesVisited: state.entries };
|
|
48553
48558
|
}
|
|
48554
48559
|
async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
|
|
@@ -48559,16 +48564,16 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
|
|
|
48559
48564
|
if (!await yieldDuringDiskWalk(state)) return;
|
|
48560
48565
|
let entries;
|
|
48561
48566
|
try {
|
|
48562
|
-
entries = await
|
|
48567
|
+
entries = await fs41.promises.readdir(dir, { withFileTypes: true });
|
|
48563
48568
|
} catch {
|
|
48564
48569
|
return;
|
|
48565
48570
|
}
|
|
48566
48571
|
for (const e of entries) {
|
|
48567
48572
|
if (shouldSkipDiskWalkEntry(e.name)) continue;
|
|
48568
|
-
const full =
|
|
48573
|
+
const full = path59.join(dir, e.name);
|
|
48569
48574
|
if (!e.isDirectory()) continue;
|
|
48570
48575
|
if (e.name === sessionId) {
|
|
48571
|
-
if (await isGitDir(full)) out.push(
|
|
48576
|
+
if (await isGitDir(full)) out.push(path59.resolve(full));
|
|
48572
48577
|
continue;
|
|
48573
48578
|
}
|
|
48574
48579
|
if (await isGitDir(full)) continue;
|
|
@@ -48580,14 +48585,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
|
|
|
48580
48585
|
}
|
|
48581
48586
|
|
|
48582
48587
|
// src/worktrees/discovery/layout-keys-for-bridge-root.ts
|
|
48583
|
-
import * as
|
|
48588
|
+
import * as path60 from "node:path";
|
|
48584
48589
|
function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
|
|
48585
|
-
const bridge =
|
|
48590
|
+
const bridge = path60.resolve(bridgeRoot);
|
|
48586
48591
|
const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
|
|
48587
48592
|
const relevant = layout.launcherCwds.filter((e) => {
|
|
48588
|
-
const entry =
|
|
48589
|
-
return bridge === entry || bridge.startsWith(entry +
|
|
48590
|
-
}).sort((a, b) =>
|
|
48593
|
+
const entry = path60.resolve(e.absolutePath);
|
|
48594
|
+
return bridge === entry || bridge.startsWith(entry + path60.sep) || entry.startsWith(bridge + path60.sep);
|
|
48595
|
+
}).sort((a, b) => path60.resolve(b.absolutePath).length - path60.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
|
|
48591
48596
|
const ordered = [];
|
|
48592
48597
|
const seen = /* @__PURE__ */ new Set();
|
|
48593
48598
|
const add = (k) => {
|
|
@@ -48605,19 +48610,19 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
|
|
|
48605
48610
|
}
|
|
48606
48611
|
|
|
48607
48612
|
// src/worktrees/discovery/try-binding-from-isolated-directory.ts
|
|
48608
|
-
import * as
|
|
48609
|
-
import * as
|
|
48613
|
+
import * as fs42 from "node:fs";
|
|
48614
|
+
import * as path61 from "node:path";
|
|
48610
48615
|
async function tryBindingFromIsolatedDirectory(scopeDir) {
|
|
48611
48616
|
let st;
|
|
48612
48617
|
try {
|
|
48613
|
-
st = await
|
|
48618
|
+
st = await fs42.promises.stat(scopeDir);
|
|
48614
48619
|
} catch {
|
|
48615
48620
|
return null;
|
|
48616
48621
|
}
|
|
48617
48622
|
if (!st.isDirectory()) return null;
|
|
48618
48623
|
const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(scopeDir);
|
|
48619
48624
|
if (worktreePaths.length === 0) return null;
|
|
48620
|
-
const abs =
|
|
48625
|
+
const abs = path61.resolve(scopeDir);
|
|
48621
48626
|
return {
|
|
48622
48627
|
parentPath: abs,
|
|
48623
48628
|
repoCheckoutPaths: worktreePaths
|
|
@@ -48640,7 +48645,7 @@ async function discoverSessionWorktreeOnDisk(options) {
|
|
|
48640
48645
|
const sid = sessionId.trim();
|
|
48641
48646
|
if (!sid) return null;
|
|
48642
48647
|
try {
|
|
48643
|
-
await
|
|
48648
|
+
await fs43.promises.access(worktreesRootPath);
|
|
48644
48649
|
} catch {
|
|
48645
48650
|
return null;
|
|
48646
48651
|
}
|
|
@@ -48649,13 +48654,13 @@ async function discoverSessionWorktreeOnDisk(options) {
|
|
|
48649
48654
|
if (preferredKey) keysOnDisk.push(preferredKey);
|
|
48650
48655
|
const scanState = { entries: 0 };
|
|
48651
48656
|
try {
|
|
48652
|
-
for (const name of await
|
|
48657
|
+
for (const name of await fs43.promises.readdir(worktreesRootPath)) {
|
|
48653
48658
|
if (!await yieldDuringDiskWalk(scanState)) break;
|
|
48654
48659
|
if (name.startsWith(".")) continue;
|
|
48655
|
-
const p =
|
|
48660
|
+
const p = path62.join(worktreesRootPath, name);
|
|
48656
48661
|
let st;
|
|
48657
48662
|
try {
|
|
48658
|
-
st = await
|
|
48663
|
+
st = await fs43.promises.stat(p);
|
|
48659
48664
|
} catch {
|
|
48660
48665
|
continue;
|
|
48661
48666
|
}
|
|
@@ -48669,23 +48674,23 @@ async function discoverSessionWorktreeOnDisk(options) {
|
|
|
48669
48674
|
for (const key of keys) {
|
|
48670
48675
|
if (isCliImmediateShutdownRequested()) return null;
|
|
48671
48676
|
await yieldToEventLoop();
|
|
48672
|
-
const layoutRoot =
|
|
48677
|
+
const layoutRoot = path62.join(worktreesRootPath, key);
|
|
48673
48678
|
let layoutSt;
|
|
48674
48679
|
try {
|
|
48675
|
-
layoutSt = await
|
|
48680
|
+
layoutSt = await fs43.promises.stat(layoutRoot);
|
|
48676
48681
|
} catch {
|
|
48677
48682
|
continue;
|
|
48678
48683
|
}
|
|
48679
48684
|
if (!layoutSt.isDirectory()) continue;
|
|
48680
|
-
const sessionDir =
|
|
48685
|
+
const sessionDir = path62.join(layoutRoot, sid);
|
|
48681
48686
|
const nested = await tryBindingFromSessionDirectory(sessionDir);
|
|
48682
48687
|
if (nested) return nested;
|
|
48683
48688
|
const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
|
|
48684
48689
|
if (legacy.paths.length > 0) {
|
|
48685
|
-
const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ??
|
|
48690
|
+
const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path62.resolve(legacy.paths[0]);
|
|
48686
48691
|
return {
|
|
48687
|
-
sessionParentPath:
|
|
48688
|
-
repoCheckoutPaths: legacy.paths.map((p) =>
|
|
48692
|
+
sessionParentPath: path62.resolve(isolated),
|
|
48693
|
+
repoCheckoutPaths: legacy.paths.map((p) => path62.resolve(p))
|
|
48689
48694
|
};
|
|
48690
48695
|
}
|
|
48691
48696
|
}
|
|
@@ -48693,31 +48698,31 @@ async function discoverSessionWorktreeOnDisk(options) {
|
|
|
48693
48698
|
}
|
|
48694
48699
|
|
|
48695
48700
|
// src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
|
|
48696
|
-
import * as
|
|
48697
|
-
import * as
|
|
48701
|
+
import * as fs44 from "node:fs";
|
|
48702
|
+
import * as path64 from "node:path";
|
|
48698
48703
|
|
|
48699
48704
|
// src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
|
|
48700
48705
|
init_cli_process_interrupt();
|
|
48701
48706
|
init_yield_to_event_loop();
|
|
48702
|
-
import * as
|
|
48707
|
+
import * as path63 from "node:path";
|
|
48703
48708
|
async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
|
|
48704
48709
|
const sid = sessionId.trim();
|
|
48705
48710
|
if (!sid) return null;
|
|
48706
|
-
const hintR =
|
|
48711
|
+
const hintR = path63.resolve(checkoutPath);
|
|
48707
48712
|
let best = null;
|
|
48708
|
-
let cur =
|
|
48713
|
+
let cur = path63.dirname(hintR);
|
|
48709
48714
|
for (let i = 0; i < 40; i++) {
|
|
48710
48715
|
if (isCliImmediateShutdownRequested()) return best;
|
|
48711
48716
|
await yieldToEventLoop();
|
|
48712
48717
|
const paths = await collectWorktreeRootsNamed(cur, sid);
|
|
48713
|
-
if (paths.paths.some((p) =>
|
|
48714
|
-
const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ??
|
|
48718
|
+
if (paths.paths.some((p) => path63.resolve(p) === hintR)) {
|
|
48719
|
+
const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path63.resolve(paths.paths[0]);
|
|
48715
48720
|
best = {
|
|
48716
|
-
sessionParentPath:
|
|
48717
|
-
repoCheckoutPaths: paths.paths.map((p) =>
|
|
48721
|
+
sessionParentPath: path63.resolve(isolated),
|
|
48722
|
+
repoCheckoutPaths: paths.paths.map((p) => path63.resolve(p))
|
|
48718
48723
|
};
|
|
48719
48724
|
}
|
|
48720
|
-
const next =
|
|
48725
|
+
const next = path63.dirname(cur);
|
|
48721
48726
|
if (next === cur) break;
|
|
48722
48727
|
cur = next;
|
|
48723
48728
|
}
|
|
@@ -48728,12 +48733,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
|
|
|
48728
48733
|
async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPathOrHint, sessionId) {
|
|
48729
48734
|
const sid = sessionId.trim();
|
|
48730
48735
|
if (!sid) return null;
|
|
48731
|
-
const hint =
|
|
48732
|
-
const underHint = await tryBindingFromSessionDirectory(
|
|
48736
|
+
const hint = path64.resolve(sessionParentPathOrHint);
|
|
48737
|
+
const underHint = await tryBindingFromSessionDirectory(path64.join(hint, sid));
|
|
48733
48738
|
if (underHint) return underHint;
|
|
48734
48739
|
const direct = await tryBindingFromSessionDirectory(hint);
|
|
48735
48740
|
if (direct) {
|
|
48736
|
-
if (
|
|
48741
|
+
if (path64.basename(hint) === sid && await isGitDir(hint)) {
|
|
48737
48742
|
const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
|
|
48738
48743
|
if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
|
|
48739
48744
|
return legacyFromCheckout;
|
|
@@ -48741,23 +48746,23 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPat
|
|
|
48741
48746
|
}
|
|
48742
48747
|
return direct;
|
|
48743
48748
|
}
|
|
48744
|
-
if (
|
|
48749
|
+
if (path64.basename(hint) === sid && await isGitDir(hint)) {
|
|
48745
48750
|
const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
|
|
48746
48751
|
if (legacyFromCheckout) return legacyFromCheckout;
|
|
48747
48752
|
}
|
|
48748
48753
|
let st;
|
|
48749
48754
|
try {
|
|
48750
|
-
st = await
|
|
48755
|
+
st = await fs44.promises.stat(hint);
|
|
48751
48756
|
} catch {
|
|
48752
48757
|
return null;
|
|
48753
48758
|
}
|
|
48754
48759
|
if (!st.isDirectory()) return null;
|
|
48755
48760
|
const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
|
|
48756
48761
|
if (legacyPaths.paths.length === 0) return null;
|
|
48757
|
-
const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ??
|
|
48762
|
+
const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path64.resolve(legacyPaths.paths[0]);
|
|
48758
48763
|
return {
|
|
48759
|
-
sessionParentPath:
|
|
48760
|
-
repoCheckoutPaths: legacyPaths.paths.map((p) =>
|
|
48764
|
+
sessionParentPath: path64.resolve(isolated),
|
|
48765
|
+
repoCheckoutPaths: legacyPaths.paths.map((p) => path64.resolve(p))
|
|
48761
48766
|
};
|
|
48762
48767
|
}
|
|
48763
48768
|
|
|
@@ -48818,11 +48823,11 @@ function parseSessionParent(v) {
|
|
|
48818
48823
|
}
|
|
48819
48824
|
|
|
48820
48825
|
// src/worktrees/prepare/prepare-new-isolated-worktrees.ts
|
|
48821
|
-
import * as
|
|
48826
|
+
import * as fs48 from "node:fs";
|
|
48822
48827
|
|
|
48823
48828
|
// src/git/discover-repos.ts
|
|
48824
|
-
import * as
|
|
48825
|
-
import * as
|
|
48829
|
+
import * as fs45 from "node:fs";
|
|
48830
|
+
import * as path65 from "node:path";
|
|
48826
48831
|
init_yield_to_event_loop();
|
|
48827
48832
|
var GIT_DISCOVER_YIELD_EVERY = 32;
|
|
48828
48833
|
async function yieldGitDiscoverWork(entryCount) {
|
|
@@ -48832,14 +48837,14 @@ async function yieldGitDiscoverWork(entryCount) {
|
|
|
48832
48837
|
}
|
|
48833
48838
|
async function discoverGitRepos(cwd = getBridgeRoot()) {
|
|
48834
48839
|
const result = [];
|
|
48835
|
-
const cwdResolved =
|
|
48840
|
+
const cwdResolved = path65.resolve(cwd);
|
|
48836
48841
|
if (await isGitRepoDirectory(cwdResolved)) {
|
|
48837
48842
|
const remoteUrl = await getRemoteOriginUrl(cwdResolved);
|
|
48838
48843
|
result.push({ absolutePath: cwdResolved, remoteUrl });
|
|
48839
48844
|
}
|
|
48840
48845
|
let entries;
|
|
48841
48846
|
try {
|
|
48842
|
-
entries =
|
|
48847
|
+
entries = fs45.readdirSync(cwdResolved, { withFileTypes: true });
|
|
48843
48848
|
} catch {
|
|
48844
48849
|
return result;
|
|
48845
48850
|
}
|
|
@@ -48847,7 +48852,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
|
|
|
48847
48852
|
await yieldGitDiscoverWork(i + 1);
|
|
48848
48853
|
const ent = entries[i];
|
|
48849
48854
|
if (!ent.isDirectory()) continue;
|
|
48850
|
-
const childPath2 =
|
|
48855
|
+
const childPath2 = path65.join(cwdResolved, ent.name);
|
|
48851
48856
|
if (await isGitRepoDirectory(childPath2)) {
|
|
48852
48857
|
const remoteUrl = await getRemoteOriginUrl(childPath2);
|
|
48853
48858
|
result.push({ absolutePath: childPath2, remoteUrl });
|
|
@@ -48856,17 +48861,17 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
|
|
|
48856
48861
|
return result;
|
|
48857
48862
|
}
|
|
48858
48863
|
async function discoverGitReposUnderRoot(rootPath) {
|
|
48859
|
-
const root =
|
|
48864
|
+
const root = path65.resolve(rootPath);
|
|
48860
48865
|
const roots = [];
|
|
48861
48866
|
let walkEntries = 0;
|
|
48862
48867
|
async function walk(dir) {
|
|
48863
48868
|
if (await isGitRepoDirectory(dir)) {
|
|
48864
|
-
roots.push(
|
|
48869
|
+
roots.push(path65.resolve(dir));
|
|
48865
48870
|
return;
|
|
48866
48871
|
}
|
|
48867
48872
|
let entries;
|
|
48868
48873
|
try {
|
|
48869
|
-
entries =
|
|
48874
|
+
entries = fs45.readdirSync(dir, { withFileTypes: true });
|
|
48870
48875
|
} catch {
|
|
48871
48876
|
return;
|
|
48872
48877
|
}
|
|
@@ -48874,7 +48879,7 @@ async function discoverGitReposUnderRoot(rootPath) {
|
|
|
48874
48879
|
await yieldGitDiscoverWork(++walkEntries);
|
|
48875
48880
|
const ent = entries[i];
|
|
48876
48881
|
if (!ent.isDirectory() || ent.name === ".git") continue;
|
|
48877
|
-
await walk(
|
|
48882
|
+
await walk(path65.join(dir, ent.name));
|
|
48878
48883
|
}
|
|
48879
48884
|
}
|
|
48880
48885
|
await walk(root);
|
|
@@ -48890,8 +48895,8 @@ async function discoverGitReposUnderRoot(rootPath) {
|
|
|
48890
48895
|
}
|
|
48891
48896
|
|
|
48892
48897
|
// src/worktrees/prepare/add-isolated-repo-worktree.ts
|
|
48893
|
-
import * as
|
|
48894
|
-
import * as
|
|
48898
|
+
import * as fs47 from "node:fs";
|
|
48899
|
+
import * as path67 from "node:path";
|
|
48895
48900
|
|
|
48896
48901
|
// src/git/worktrees/worktree-add.ts
|
|
48897
48902
|
async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch, baseRef = "HEAD") {
|
|
@@ -48907,8 +48912,8 @@ async function gitWorktreeAddExistingBranch(mainRepoPath, worktreePath, branch)
|
|
|
48907
48912
|
}
|
|
48908
48913
|
|
|
48909
48914
|
// src/worktrees/prepare/copy-bridge-files-along-worktree-path.ts
|
|
48910
|
-
import * as
|
|
48911
|
-
import * as
|
|
48915
|
+
import * as fs46 from "node:fs";
|
|
48916
|
+
import * as path66 from "node:path";
|
|
48912
48917
|
var BRIDGE_FILES_ALONG_WORKTREE_PATH = ["AGENTS.md"];
|
|
48913
48918
|
function copyBridgeFilesAlongWorktreePath(options) {
|
|
48914
48919
|
const { bridgeRoot, scopeDir, repoPathRelativeToBridgeRoot, log: log2 } = options;
|
|
@@ -48917,19 +48922,19 @@ function copyBridgeFilesAlongWorktreePath(options) {
|
|
|
48917
48922
|
const segments = repoPathRelativeToBridgeRoot.split("/").filter(Boolean);
|
|
48918
48923
|
for (let i = 0; i < segments.length; i++) {
|
|
48919
48924
|
const prefix = segments.slice(0, i).join("/");
|
|
48920
|
-
const bridgeDir = prefix ?
|
|
48921
|
-
const destDir = prefix ?
|
|
48925
|
+
const bridgeDir = prefix ? path66.join(bridgeRoot, prefix) : bridgeRoot;
|
|
48926
|
+
const destDir = prefix ? path66.join(scopeDir, prefix) : scopeDir;
|
|
48922
48927
|
for (const fileName of fileNames) {
|
|
48923
48928
|
copyFileIfPresent(bridgeDir, destDir, fileName, log2);
|
|
48924
48929
|
}
|
|
48925
48930
|
}
|
|
48926
48931
|
}
|
|
48927
48932
|
function copyFileIfPresent(srcDir, destDir, fileName, log2) {
|
|
48928
|
-
const src =
|
|
48929
|
-
if (!
|
|
48930
|
-
const dest =
|
|
48933
|
+
const src = path66.join(srcDir, fileName);
|
|
48934
|
+
if (!fs46.existsSync(src)) return;
|
|
48935
|
+
const dest = path66.join(destDir, fileName);
|
|
48931
48936
|
try {
|
|
48932
|
-
|
|
48937
|
+
fs46.copyFileSync(src, dest);
|
|
48933
48938
|
log2?.(`[worktrees] Copied ${fileName} to ${dest}`);
|
|
48934
48939
|
} catch (e) {
|
|
48935
48940
|
log2?.(
|
|
@@ -48961,16 +48966,16 @@ async function addIsolatedRepoWorktree(options) {
|
|
|
48961
48966
|
worktreeBaseBranches,
|
|
48962
48967
|
log: log2
|
|
48963
48968
|
} = options;
|
|
48964
|
-
const repoPathRelativeToBridgeRootRaw =
|
|
48965
|
-
if (repoPathRelativeToBridgeRootRaw.startsWith("..") ||
|
|
48969
|
+
const repoPathRelativeToBridgeRootRaw = path67.relative(bridgeResolved, repoAbsolutePath);
|
|
48970
|
+
if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path67.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
|
|
48966
48971
|
return null;
|
|
48967
48972
|
}
|
|
48968
48973
|
const repoPathRelativeToBridgeRoot = normalizeRepoPathRelativeToWorkspaceRoot(
|
|
48969
48974
|
repoPathRelativeToBridgeRootRaw === "" ? "." : repoPathRelativeToBridgeRootRaw
|
|
48970
48975
|
);
|
|
48971
|
-
const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir :
|
|
48976
|
+
const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path67.join(scopeDir, repoPathRelativeToBridgeRoot);
|
|
48972
48977
|
if (repoPathRelativeToBridgeRoot !== ".") {
|
|
48973
|
-
|
|
48978
|
+
fs47.mkdirSync(path67.dirname(worktreePath), { recursive: true });
|
|
48974
48979
|
copyBridgeFilesAlongWorktreePath({
|
|
48975
48980
|
bridgeRoot: bridgeResolved,
|
|
48976
48981
|
scopeDir,
|
|
@@ -48998,7 +49003,7 @@ async function addIsolatedRepoWorktree(options) {
|
|
|
48998
49003
|
}
|
|
48999
49004
|
|
|
49000
49005
|
// src/worktrees/prepare/resolve-isolated-scope-dir.ts
|
|
49001
|
-
import * as
|
|
49006
|
+
import * as path68 from "node:path";
|
|
49002
49007
|
|
|
49003
49008
|
// src/worktrees/worktree-layout-kind.ts
|
|
49004
49009
|
function sanitizeWorktreeBranchSegment(value) {
|
|
@@ -49028,10 +49033,10 @@ function previewDeployBranchName(environmentId) {
|
|
|
49028
49033
|
|
|
49029
49034
|
// src/worktrees/prepare/resolve-isolated-scope-dir.ts
|
|
49030
49035
|
function resolveIsolatedScopeDir(options) {
|
|
49031
|
-
const bridgeResolved =
|
|
49036
|
+
const bridgeResolved = path68.resolve(options.bridgeRoot);
|
|
49032
49037
|
const cwdKey = allocateDirNameForLauncherCwd(options.layout, bridgeResolved);
|
|
49033
|
-
const bridgeKeyDir =
|
|
49034
|
-
const scopeDir =
|
|
49038
|
+
const bridgeKeyDir = path68.join(options.worktreesRootPath, cwdKey);
|
|
49039
|
+
const scopeDir = path68.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
|
|
49035
49040
|
return { bridgeResolved, scopeDir };
|
|
49036
49041
|
}
|
|
49037
49042
|
|
|
@@ -49061,7 +49066,7 @@ async function prepareNewIsolatedWorktrees(options) {
|
|
|
49061
49066
|
return null;
|
|
49062
49067
|
}
|
|
49063
49068
|
const worktreePaths = [];
|
|
49064
|
-
|
|
49069
|
+
fs48.mkdirSync(scopeDir, { recursive: true });
|
|
49065
49070
|
await forEachWithGitYield(repos, async (repo) => {
|
|
49066
49071
|
const worktreePath = await addIsolatedRepoWorktree({
|
|
49067
49072
|
kind,
|
|
@@ -49133,10 +49138,10 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
|
|
|
49133
49138
|
}
|
|
49134
49139
|
|
|
49135
49140
|
// src/worktrees/manager/resolve-explicit-session-parent-path.ts
|
|
49136
|
-
import * as
|
|
49141
|
+
import * as path69 from "node:path";
|
|
49137
49142
|
init_yield_to_event_loop();
|
|
49138
49143
|
async function resolveExplicitSessionParentPath(params) {
|
|
49139
|
-
const resolved =
|
|
49144
|
+
const resolved = path69.resolve(params.parentPathRaw);
|
|
49140
49145
|
if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
|
|
49141
49146
|
return resolved;
|
|
49142
49147
|
}
|
|
@@ -49153,7 +49158,7 @@ async function resolveExplicitSessionParentPath(params) {
|
|
|
49153
49158
|
await yieldToEventLoop();
|
|
49154
49159
|
const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
|
|
49155
49160
|
if (tryRoot) return rememberAndReturn(tryRoot);
|
|
49156
|
-
const next =
|
|
49161
|
+
const next = path69.dirname(cur);
|
|
49157
49162
|
if (next === cur) break;
|
|
49158
49163
|
cur = next;
|
|
49159
49164
|
}
|
|
@@ -49301,15 +49306,15 @@ var SessionWorktreeManager = class {
|
|
|
49301
49306
|
};
|
|
49302
49307
|
|
|
49303
49308
|
// src/worktrees/discovery/discover-preview-worktree-on-disk.ts
|
|
49304
|
-
import * as
|
|
49305
|
-
import * as
|
|
49309
|
+
import * as fs49 from "node:fs";
|
|
49310
|
+
import * as path70 from "node:path";
|
|
49306
49311
|
init_yield_to_event_loop();
|
|
49307
49312
|
async function discoverPreviewWorktreeOnDisk(options) {
|
|
49308
49313
|
const { environmentId, worktreesRootPath, layout, bridgeRoot } = options;
|
|
49309
49314
|
const eid = environmentId.trim();
|
|
49310
49315
|
if (!eid) return null;
|
|
49311
49316
|
try {
|
|
49312
|
-
await
|
|
49317
|
+
await fs49.promises.access(worktreesRootPath);
|
|
49313
49318
|
} catch {
|
|
49314
49319
|
return null;
|
|
49315
49320
|
}
|
|
@@ -49318,13 +49323,13 @@ async function discoverPreviewWorktreeOnDisk(options) {
|
|
|
49318
49323
|
if (preferredKey) keysOnDisk.push(preferredKey);
|
|
49319
49324
|
const scanState = { entries: 0 };
|
|
49320
49325
|
try {
|
|
49321
|
-
for (const name of await
|
|
49326
|
+
for (const name of await fs49.promises.readdir(worktreesRootPath)) {
|
|
49322
49327
|
if (!await yieldDuringDiskWalk(scanState)) break;
|
|
49323
49328
|
if (name.startsWith(".")) continue;
|
|
49324
|
-
const p =
|
|
49329
|
+
const p = path70.join(worktreesRootPath, name);
|
|
49325
49330
|
let st;
|
|
49326
49331
|
try {
|
|
49327
|
-
st = await
|
|
49332
|
+
st = await fs49.promises.stat(p);
|
|
49328
49333
|
} catch {
|
|
49329
49334
|
continue;
|
|
49330
49335
|
}
|
|
@@ -49338,7 +49343,7 @@ async function discoverPreviewWorktreeOnDisk(options) {
|
|
|
49338
49343
|
const previewDirRel = layoutDirSegments("preview_environment", eid);
|
|
49339
49344
|
for (const key of keys) {
|
|
49340
49345
|
await yieldToEventLoop();
|
|
49341
|
-
const previewDir =
|
|
49346
|
+
const previewDir = path70.join(worktreesRootPath, key, ...previewDirRel);
|
|
49342
49347
|
const binding = await tryBindingFromIsolatedDirectory(previewDir);
|
|
49343
49348
|
if (binding) return binding;
|
|
49344
49349
|
}
|
|
@@ -49465,7 +49470,7 @@ var PreviewWorktreeManager = class {
|
|
|
49465
49470
|
};
|
|
49466
49471
|
|
|
49467
49472
|
// src/worktrees/deploy/deploy-session-to-preview-environment.ts
|
|
49468
|
-
import * as
|
|
49473
|
+
import * as path74 from "node:path";
|
|
49469
49474
|
|
|
49470
49475
|
// src/git/worktrees/reset-worktree-to-branch.ts
|
|
49471
49476
|
async function gitResetWorktreeToBranch(worktreePath, branch) {
|
|
@@ -49476,8 +49481,8 @@ async function gitResetWorktreeToBranch(worktreePath, branch) {
|
|
|
49476
49481
|
}
|
|
49477
49482
|
|
|
49478
49483
|
// src/worktrees/deploy/capture-and-apply-wip.ts
|
|
49479
|
-
import * as
|
|
49480
|
-
import * as
|
|
49484
|
+
import * as fs50 from "node:fs";
|
|
49485
|
+
import * as path71 from "node:path";
|
|
49481
49486
|
|
|
49482
49487
|
// src/git/snapshot/git.ts
|
|
49483
49488
|
async function gitStashCreate(repoRoot, log2) {
|
|
@@ -49525,12 +49530,12 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
|
|
|
49525
49530
|
if (!ap.ok) return ap;
|
|
49526
49531
|
}
|
|
49527
49532
|
await forEachWithGitYield(wip.untrackedPaths, async (rel) => {
|
|
49528
|
-
const src =
|
|
49529
|
-
const dst =
|
|
49533
|
+
const src = path71.join(sourceRepoPath, rel);
|
|
49534
|
+
const dst = path71.join(targetRepoPath, rel);
|
|
49530
49535
|
try {
|
|
49531
|
-
if (!
|
|
49532
|
-
|
|
49533
|
-
|
|
49536
|
+
if (!fs50.existsSync(src)) return;
|
|
49537
|
+
fs50.mkdirSync(path71.dirname(dst), { recursive: true });
|
|
49538
|
+
fs50.copyFileSync(src, dst);
|
|
49534
49539
|
} catch (e) {
|
|
49535
49540
|
log2(
|
|
49536
49541
|
`[worktrees] Failed to copy untracked ${rel}: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -49541,14 +49546,14 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
|
|
|
49541
49546
|
}
|
|
49542
49547
|
|
|
49543
49548
|
// src/worktrees/deploy/resolve-isolated-checkout-for-repo-path-relative-to-workspace-root.ts
|
|
49544
|
-
import * as
|
|
49549
|
+
import * as path72 from "node:path";
|
|
49545
49550
|
async function resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot(options) {
|
|
49546
49551
|
const { checkoutPaths, sessionParentPath, bridgeRoot, repoPathRelativeToWorkspaceRoot } = options;
|
|
49547
|
-
const resolvedSessionParentPath = sessionParentPath ?
|
|
49552
|
+
const resolvedSessionParentPath = sessionParentPath ? path72.resolve(sessionParentPath) : null;
|
|
49548
49553
|
let match = null;
|
|
49549
49554
|
await forEachWithGitYield(checkoutPaths, async (checkoutPath) => {
|
|
49550
49555
|
if (match) return;
|
|
49551
|
-
const resolvedCheckoutPath =
|
|
49556
|
+
const resolvedCheckoutPath = path72.resolve(checkoutPath);
|
|
49552
49557
|
if (!await isGitRepoDirectory(resolvedCheckoutPath)) return;
|
|
49553
49558
|
const resolvedRepoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
|
|
49554
49559
|
checkoutPath: resolvedCheckoutPath,
|
|
@@ -49602,7 +49607,7 @@ async function applySessionWipToPreviewCheckouts(options) {
|
|
|
49602
49607
|
}
|
|
49603
49608
|
|
|
49604
49609
|
// src/worktrees/deploy/collect-session-repo-deploy-states.ts
|
|
49605
|
-
import * as
|
|
49610
|
+
import * as path73 from "node:path";
|
|
49606
49611
|
|
|
49607
49612
|
// src/git/branches/create-or-update-branch.ts
|
|
49608
49613
|
async function gitCreateOrUpdateBranch(repoPath, branch, startRef, options) {
|
|
@@ -49639,19 +49644,19 @@ async function collectSessionRepoDeployStates(options) {
|
|
|
49639
49644
|
const sessionParentPath = sessionWorktreeManager.getSessionParentPath(sid);
|
|
49640
49645
|
const states = [];
|
|
49641
49646
|
await forEachWithGitYield(sessionTargets, async (sessionCheckout) => {
|
|
49642
|
-
const checkoutPath =
|
|
49647
|
+
const checkoutPath = path73.resolve(sessionCheckout);
|
|
49643
49648
|
if (!await isGitRepoDirectory(checkoutPath)) return;
|
|
49644
49649
|
const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
|
|
49645
49650
|
checkoutPath,
|
|
49646
49651
|
bridgeRoot,
|
|
49647
|
-
sessionParentPath: sessionParentPath ?
|
|
49652
|
+
sessionParentPath: sessionParentPath ? path73.resolve(sessionParentPath) : null
|
|
49648
49653
|
});
|
|
49649
49654
|
if (!repoPathRelativeToWorkspaceRoot) return;
|
|
49650
49655
|
const mainRepoPath = resolveMainRepoPath(checkoutPath);
|
|
49651
49656
|
const headSha = (await cliSimpleGit(checkoutPath).revparse(["HEAD"])).trim();
|
|
49652
49657
|
const previewCheckout = previewCheckoutPaths.length > 0 ? await resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot({
|
|
49653
49658
|
checkoutPaths: previewCheckoutPaths,
|
|
49654
|
-
sessionParentPath: previewParentPath ?
|
|
49659
|
+
sessionParentPath: previewParentPath ? path73.resolve(previewParentPath) : null,
|
|
49655
49660
|
bridgeRoot,
|
|
49656
49661
|
repoPathRelativeToWorkspaceRoot
|
|
49657
49662
|
}) : null;
|
|
@@ -49671,7 +49676,7 @@ async function deploySessionToPreviewEnvironment(options) {
|
|
|
49671
49676
|
const eid = options.environmentId.trim();
|
|
49672
49677
|
if (!sid || !eid) return { ok: false, error: "sessionId and environmentId are required" };
|
|
49673
49678
|
const deployBranch = previewDeployBranchName(eid);
|
|
49674
|
-
const bridgeRoot =
|
|
49679
|
+
const bridgeRoot = path74.resolve(getBridgeRoot());
|
|
49675
49680
|
await previewWorktreeManager.ensureCached(eid);
|
|
49676
49681
|
const existingPreviewParentPath = previewWorktreeManager.getPreviewParentPath(eid) ?? null;
|
|
49677
49682
|
const existingPreviewCheckoutPaths = previewWorktreeManager.getRepoCheckoutPaths(eid) ?? [];
|
|
@@ -49711,10 +49716,10 @@ async function deploySessionToPreviewEnvironment(options) {
|
|
|
49711
49716
|
}
|
|
49712
49717
|
|
|
49713
49718
|
// src/worktrees/manager/default-worktrees-root-path.ts
|
|
49714
|
-
import * as
|
|
49719
|
+
import * as path75 from "node:path";
|
|
49715
49720
|
import os9 from "node:os";
|
|
49716
49721
|
function defaultWorktreesRootPath() {
|
|
49717
|
-
return
|
|
49722
|
+
return path75.join(os9.homedir(), ".buildautomaton", "worktrees");
|
|
49718
49723
|
}
|
|
49719
49724
|
|
|
49720
49725
|
// src/connection/create-bridge-worktree-managers.ts
|
|
@@ -49844,14 +49849,14 @@ function assertBridgeWorkspace(ctx) {
|
|
|
49844
49849
|
}
|
|
49845
49850
|
|
|
49846
49851
|
// src/files/list-dir/index.ts
|
|
49847
|
-
import
|
|
49852
|
+
import fs52 from "node:fs";
|
|
49848
49853
|
|
|
49849
49854
|
// src/files/ensure-under-cwd.ts
|
|
49850
|
-
import
|
|
49855
|
+
import path76 from "node:path";
|
|
49851
49856
|
function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
|
|
49852
|
-
const normalized =
|
|
49853
|
-
const resolved =
|
|
49854
|
-
if (!resolved.startsWith(cwd +
|
|
49857
|
+
const normalized = path76.normalize(relativePath).replace(/^(\.\/)+/, "");
|
|
49858
|
+
const resolved = path76.resolve(cwd, normalized);
|
|
49859
|
+
if (!resolved.startsWith(cwd + path76.sep) && resolved !== cwd) {
|
|
49855
49860
|
return null;
|
|
49856
49861
|
}
|
|
49857
49862
|
return resolved;
|
|
@@ -49864,15 +49869,15 @@ init_yield_to_event_loop();
|
|
|
49864
49869
|
var LIST_DIR_YIELD_EVERY = 256;
|
|
49865
49870
|
|
|
49866
49871
|
// src/files/list-dir/map-dir-entry.ts
|
|
49867
|
-
import
|
|
49868
|
-
import
|
|
49872
|
+
import path77 from "node:path";
|
|
49873
|
+
import fs51 from "node:fs";
|
|
49869
49874
|
async function mapDirEntry(d, relativePath, resolved) {
|
|
49870
|
-
const entryPath =
|
|
49871
|
-
const fullPath =
|
|
49875
|
+
const entryPath = path77.join(relativePath || ".", d.name).replace(/\\/g, "/");
|
|
49876
|
+
const fullPath = path77.join(resolved, d.name);
|
|
49872
49877
|
let isDir = d.isDirectory();
|
|
49873
49878
|
if (d.isSymbolicLink()) {
|
|
49874
49879
|
try {
|
|
49875
|
-
const targetStat = await
|
|
49880
|
+
const targetStat = await fs51.promises.stat(fullPath);
|
|
49876
49881
|
isDir = targetStat.isDirectory();
|
|
49877
49882
|
} catch {
|
|
49878
49883
|
isDir = false;
|
|
@@ -49902,7 +49907,7 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
|
|
|
49902
49907
|
return { error: "Path is outside working directory" };
|
|
49903
49908
|
}
|
|
49904
49909
|
try {
|
|
49905
|
-
const names = await
|
|
49910
|
+
const names = await fs52.promises.readdir(resolved, { withFileTypes: true });
|
|
49906
49911
|
const entries = [];
|
|
49907
49912
|
for (let i = 0; i < names.length; i++) {
|
|
49908
49913
|
if (i > 0 && i % LIST_DIR_YIELD_EVERY === 0) {
|
|
@@ -49918,13 +49923,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
|
|
|
49918
49923
|
}
|
|
49919
49924
|
|
|
49920
49925
|
// src/git/tree/resolve-repo-abs-path.ts
|
|
49921
|
-
import * as
|
|
49926
|
+
import * as path78 from "node:path";
|
|
49922
49927
|
function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
|
|
49923
|
-
const bridgeResolved =
|
|
49928
|
+
const bridgeResolved = path78.resolve(bridgeRoot);
|
|
49924
49929
|
const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
|
|
49925
|
-
const repoPath = rel === "" ? bridgeResolved :
|
|
49926
|
-
const resolved =
|
|
49927
|
-
if (!resolved.startsWith(bridgeResolved +
|
|
49930
|
+
const repoPath = rel === "" ? bridgeResolved : path78.join(bridgeResolved, rel);
|
|
49931
|
+
const resolved = path78.resolve(repoPath);
|
|
49932
|
+
if (!resolved.startsWith(bridgeResolved + path78.sep) && resolved !== bridgeResolved) {
|
|
49928
49933
|
return null;
|
|
49929
49934
|
}
|
|
49930
49935
|
return resolved;
|
|
@@ -50405,25 +50410,25 @@ async function GET2(ctx) {
|
|
|
50405
50410
|
init_in_flight();
|
|
50406
50411
|
|
|
50407
50412
|
// src/files/read/read-file-async.ts
|
|
50408
|
-
import
|
|
50413
|
+
import fs58 from "node:fs";
|
|
50409
50414
|
init_yield_to_event_loop();
|
|
50410
50415
|
|
|
50411
50416
|
// src/files/read/resolve-file-cache.ts
|
|
50412
|
-
import
|
|
50413
|
-
import
|
|
50417
|
+
import fs53 from "node:fs";
|
|
50418
|
+
import path79 from "node:path";
|
|
50414
50419
|
var RESOLVE_CACHE_MAX = 4096;
|
|
50415
50420
|
var resolveCache = /* @__PURE__ */ new Map();
|
|
50416
50421
|
function resolveCacheKey(sessionParentPath, relativePath) {
|
|
50417
50422
|
return `${sessionParentPath}\0${relativePath}`;
|
|
50418
50423
|
}
|
|
50419
50424
|
function pathStaysUnderParent(filePath, sessionParentPath) {
|
|
50420
|
-
const parent =
|
|
50421
|
-
const resolved =
|
|
50422
|
-
return resolved === parent || resolved.startsWith(`${parent}${
|
|
50425
|
+
const parent = path79.resolve(sessionParentPath);
|
|
50426
|
+
const resolved = path79.resolve(filePath);
|
|
50427
|
+
return resolved === parent || resolved.startsWith(`${parent}${path79.sep}`);
|
|
50423
50428
|
}
|
|
50424
50429
|
function statMatchesCacheSync(entry) {
|
|
50425
50430
|
try {
|
|
50426
|
-
const stat3 =
|
|
50431
|
+
const stat3 = fs53.statSync(entry.path);
|
|
50427
50432
|
return stat3.isFile() && stat3.mtimeMs === entry.mtimeMs && stat3.size === entry.size;
|
|
50428
50433
|
} catch {
|
|
50429
50434
|
return false;
|
|
@@ -50456,7 +50461,7 @@ function joinInflightResolve(cacheKey, factory) {
|
|
|
50456
50461
|
}
|
|
50457
50462
|
|
|
50458
50463
|
// src/files/read/resolve-file-for-read-core.ts
|
|
50459
|
-
import
|
|
50464
|
+
import fs54 from "node:fs";
|
|
50460
50465
|
import { isMainThread as isMainThread4 } from "node:worker_threads";
|
|
50461
50466
|
function resolveFileForReadImplSync(relativePath, sessionParentPath) {
|
|
50462
50467
|
const cacheKey = resolveCacheKey(sessionParentPath, relativePath);
|
|
@@ -50466,13 +50471,13 @@ function resolveFileForReadImplSync(relativePath, sessionParentPath) {
|
|
|
50466
50471
|
let size;
|
|
50467
50472
|
let mtimeMs;
|
|
50468
50473
|
try {
|
|
50469
|
-
const lstat =
|
|
50474
|
+
const lstat = fs54.lstatSync(resolved);
|
|
50470
50475
|
if (lstat.isSymbolicLink()) {
|
|
50471
|
-
real =
|
|
50476
|
+
real = fs54.realpathSync(resolved);
|
|
50472
50477
|
if (!pathStaysUnderParent(real, sessionParentPath)) {
|
|
50473
50478
|
return { error: "Path is outside working directory" };
|
|
50474
50479
|
}
|
|
50475
|
-
const stat3 =
|
|
50480
|
+
const stat3 = fs54.statSync(real);
|
|
50476
50481
|
if (!stat3.isFile()) return { error: "Not a file" };
|
|
50477
50482
|
size = stat3.size;
|
|
50478
50483
|
mtimeMs = stat3.mtimeMs;
|
|
@@ -50500,13 +50505,13 @@ async function resolveFileForReadImpl(relativePath, sessionParentPath) {
|
|
|
50500
50505
|
let size;
|
|
50501
50506
|
let mtimeMs;
|
|
50502
50507
|
try {
|
|
50503
|
-
const lstat = await
|
|
50508
|
+
const lstat = await fs54.promises.lstat(resolved);
|
|
50504
50509
|
if (lstat.isSymbolicLink()) {
|
|
50505
|
-
real = await
|
|
50510
|
+
real = await fs54.promises.realpath(resolved);
|
|
50506
50511
|
if (!pathStaysUnderParent(real, sessionParentPath)) {
|
|
50507
50512
|
return { error: "Path is outside working directory" };
|
|
50508
50513
|
}
|
|
50509
|
-
const stat3 = await
|
|
50514
|
+
const stat3 = await fs54.promises.stat(real);
|
|
50510
50515
|
if (!stat3.isFile()) return { error: "Not a file" };
|
|
50511
50516
|
size = stat3.size;
|
|
50512
50517
|
mtimeMs = stat3.mtimeMs;
|
|
@@ -50555,7 +50560,7 @@ async function resolveFilePathAsync(relativePath, sessionParentPath = getBridgeR
|
|
|
50555
50560
|
|
|
50556
50561
|
// src/files/read/read-file-range-async.ts
|
|
50557
50562
|
init_yield_to_event_loop();
|
|
50558
|
-
import
|
|
50563
|
+
import fs55 from "node:fs";
|
|
50559
50564
|
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
50560
50565
|
|
|
50561
50566
|
// src/files/read/read-file-range-line-zero.ts
|
|
@@ -50669,8 +50674,8 @@ function finishLineZeroTail(state, tail, resultLines, fileSize, lineChunkSize, l
|
|
|
50669
50674
|
|
|
50670
50675
|
// src/files/read/read-file-range-async.ts
|
|
50671
50676
|
async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE, fileSizeIn) {
|
|
50672
|
-
const fileSize = fileSizeIn ?? (await
|
|
50673
|
-
const fd = await
|
|
50677
|
+
const fileSize = fileSizeIn ?? (await fs55.promises.stat(filePath)).size;
|
|
50678
|
+
const fd = await fs55.promises.open(filePath, "r");
|
|
50674
50679
|
const bufSize = 64 * 1024;
|
|
50675
50680
|
const buf = Buffer.alloc(bufSize);
|
|
50676
50681
|
const decoder = new StringDecoder2("utf8");
|
|
@@ -50771,7 +50776,7 @@ async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, li
|
|
|
50771
50776
|
}
|
|
50772
50777
|
|
|
50773
50778
|
// src/files/read/read-small-file-range-async.ts
|
|
50774
|
-
import
|
|
50779
|
+
import fs56 from "node:fs";
|
|
50775
50780
|
import { isMainThread as isMainThread5 } from "node:worker_threads";
|
|
50776
50781
|
var SMALL_FILE_RANGE_MAX_BYTES = 512 * 1024;
|
|
50777
50782
|
function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize) {
|
|
@@ -50801,7 +50806,7 @@ function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize,
|
|
|
50801
50806
|
};
|
|
50802
50807
|
}
|
|
50803
50808
|
function readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE) {
|
|
50804
|
-
const raw =
|
|
50809
|
+
const raw = fs56.readFileSync(filePath, "utf8");
|
|
50805
50810
|
const lines = raw.split(/\r?\n/);
|
|
50806
50811
|
return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
|
|
50807
50812
|
}
|
|
@@ -50809,28 +50814,28 @@ async function readSmallFileRangeAsync(filePath, fileSize, startLine, endLine, l
|
|
|
50809
50814
|
if (isMainThread5) {
|
|
50810
50815
|
return readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize);
|
|
50811
50816
|
}
|
|
50812
|
-
const raw = await
|
|
50817
|
+
const raw = await fs56.promises.readFile(filePath, "utf8");
|
|
50813
50818
|
const lines = raw.split(/\r?\n/);
|
|
50814
50819
|
return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
|
|
50815
50820
|
}
|
|
50816
50821
|
|
|
50817
50822
|
// src/files/read/read-file-buffer-full-async.ts
|
|
50818
50823
|
init_yield_to_event_loop();
|
|
50819
|
-
import
|
|
50824
|
+
import fs57 from "node:fs";
|
|
50820
50825
|
import { isMainThread as isMainThread6 } from "node:worker_threads";
|
|
50821
50826
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
50822
50827
|
var MAIN_THREAD_SYNC_READ_MAX_BYTES = 512 * 1024;
|
|
50823
50828
|
async function readFileBufferFullAsync(filePath, knownSize) {
|
|
50824
50829
|
if (isMainThread6) {
|
|
50825
|
-
const size2 = knownSize ??
|
|
50830
|
+
const size2 = knownSize ?? fs57.statSync(filePath).size;
|
|
50826
50831
|
if (size2 <= MAIN_THREAD_SYNC_READ_MAX_BYTES) {
|
|
50827
50832
|
await yieldToEventLoop();
|
|
50828
|
-
const buffer =
|
|
50833
|
+
const buffer = fs57.readFileSync(filePath);
|
|
50829
50834
|
return { buffer, size: buffer.length };
|
|
50830
50835
|
}
|
|
50831
50836
|
}
|
|
50832
|
-
const size = knownSize ?? (await
|
|
50833
|
-
const fd = await
|
|
50837
|
+
const size = knownSize ?? (await fs57.promises.stat(filePath)).size;
|
|
50838
|
+
const fd = await fs57.promises.open(filePath, "r");
|
|
50834
50839
|
const chunks = [];
|
|
50835
50840
|
let position = 0;
|
|
50836
50841
|
let bytesSinceYield = 0;
|
|
@@ -50933,7 +50938,7 @@ async function readFileAsync(relativePath, startLine, endLine, lineOffset, lineC
|
|
|
50933
50938
|
}
|
|
50934
50939
|
if (hasRange) {
|
|
50935
50940
|
if (fileSize == null) {
|
|
50936
|
-
const stat3 = await
|
|
50941
|
+
const stat3 = await fs58.promises.stat(resolvedPath);
|
|
50937
50942
|
fileSize = stat3.size;
|
|
50938
50943
|
}
|
|
50939
50944
|
const read2 = fileSize <= SMALL_FILE_RANGE_MAX_BYTES ? await readSmallFileRangeAsync(
|
|
@@ -51231,12 +51236,12 @@ function parseOptionalInt2(raw) {
|
|
|
51231
51236
|
return Number.isInteger(parsed) ? parsed : void 0;
|
|
51232
51237
|
}
|
|
51233
51238
|
function parseCodeNavParams(url2) {
|
|
51234
|
-
const
|
|
51239
|
+
const path86 = url2.searchParams.get("path") ?? "";
|
|
51235
51240
|
const opRaw = url2.searchParams.get("op")?.trim();
|
|
51236
51241
|
const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
|
|
51237
51242
|
const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
|
|
51238
51243
|
const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
|
|
51239
|
-
return { path:
|
|
51244
|
+
return { path: path86, op, line, column };
|
|
51240
51245
|
}
|
|
51241
51246
|
function parseCodeNavPath(url2) {
|
|
51242
51247
|
const raw = url2.searchParams.get("path")?.trim();
|
|
@@ -51911,15 +51916,21 @@ function dispatchLocalPrompt(next, deps) {
|
|
|
51911
51916
|
|
|
51912
51917
|
// src/prompt-turn-queue/runner/run-id-queue-key-map.ts
|
|
51913
51918
|
var runIdToQueueKey = /* @__PURE__ */ new Map();
|
|
51919
|
+
var locallyDispatchedRunIds = /* @__PURE__ */ new Set();
|
|
51914
51920
|
function getRunIdQueueKey(runId) {
|
|
51915
51921
|
return runIdToQueueKey.get(runId);
|
|
51916
51922
|
}
|
|
51917
51923
|
function setRunIdQueueKey(runId, queueKey) {
|
|
51918
51924
|
runIdToQueueKey.set(runId, queueKey);
|
|
51925
|
+
locallyDispatchedRunIds.add(runId);
|
|
51926
|
+
}
|
|
51927
|
+
function isLocallyDispatchedRun(runId) {
|
|
51928
|
+
return locallyDispatchedRunIds.has(runId);
|
|
51919
51929
|
}
|
|
51920
51930
|
function deleteRunIdQueueKey(runId) {
|
|
51921
51931
|
const queueKey = runIdToQueueKey.get(runId);
|
|
51922
51932
|
runIdToQueueKey.delete(runId);
|
|
51933
|
+
locallyDispatchedRunIds.delete(runId);
|
|
51923
51934
|
return queueKey;
|
|
51924
51935
|
}
|
|
51925
51936
|
function syncRunningTurnQueueKeys(turns, queueKey) {
|
|
@@ -51942,39 +51953,11 @@ async function dispatchStartedPromptQueueRuns(entries, started, deps) {
|
|
|
51942
51953
|
|
|
51943
51954
|
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
51944
51955
|
init_yield_to_event_loop();
|
|
51945
|
-
|
|
51946
|
-
// src/prompt-turn-queue/client-report.ts
|
|
51947
|
-
function sendPromptQueueClientReport(ws, queues) {
|
|
51948
|
-
if (!ws) return false;
|
|
51949
|
-
const wireQueues = {};
|
|
51950
|
-
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
51951
|
-
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
51952
|
-
}
|
|
51953
|
-
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
51954
|
-
return true;
|
|
51955
|
-
}
|
|
51956
|
-
|
|
51957
|
-
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
51958
|
-
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
51959
|
-
if (!runId) return false;
|
|
51960
|
-
const queueKey = deleteRunIdQueueKey(runId);
|
|
51961
|
-
if (!queueKey) return false;
|
|
51962
|
-
const f = await readPersistedQueue(queueKey);
|
|
51963
|
-
if (!f) return false;
|
|
51964
|
-
const t = f.turns.find((x) => x.turnId === runId);
|
|
51965
|
-
if (!t) return false;
|
|
51966
|
-
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
51967
|
-
await writePersistedQueue(f);
|
|
51968
|
-
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
51969
|
-
return true;
|
|
51970
|
-
}
|
|
51971
|
-
|
|
51972
|
-
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
51973
51956
|
async function handlePromptQueueCancellations(entries, deps) {
|
|
51974
51957
|
for (const [queueKey] of entries) {
|
|
51975
51958
|
const file2 = await readPersistedQueue(queueKey);
|
|
51976
51959
|
const turn = file2?.turns.find((row) => row.bridgeServerState === "cancel_requested" && row.lastCliState === "running");
|
|
51977
|
-
if (!turn) {
|
|
51960
|
+
if (!turn || getRunIdQueueKey(turn.turnId) !== queueKey || !isLocallyDispatchedRun(turn.turnId)) {
|
|
51978
51961
|
await yieldToEventLoop();
|
|
51979
51962
|
continue;
|
|
51980
51963
|
}
|
|
@@ -51983,19 +51966,7 @@ async function handlePromptQueueCancellations(entries, deps) {
|
|
|
51983
51966
|
await yieldToEventLoop();
|
|
51984
51967
|
continue;
|
|
51985
51968
|
}
|
|
51986
|
-
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026
|
|
51987
|
-
await finalizePromptTurnOnBridge(deps.getWs, turn.turnId, false, { terminalCliState: "cancelled" });
|
|
51988
|
-
const ws = deps.getWs();
|
|
51989
|
-
if (ws && turn.sessionId) {
|
|
51990
|
-
sendWsMessage(ws, {
|
|
51991
|
-
type: "prompt_result",
|
|
51992
|
-
sessionId: turn.sessionId,
|
|
51993
|
-
runId: turn.turnId,
|
|
51994
|
-
success: false,
|
|
51995
|
-
error: "Stopped by user",
|
|
51996
|
-
stopReason: "cancelled"
|
|
51997
|
-
});
|
|
51998
|
-
}
|
|
51969
|
+
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026 but no local ACP run remains.`);
|
|
51999
51970
|
await yieldToEventLoop();
|
|
52000
51971
|
}
|
|
52001
51972
|
}
|
|
@@ -52023,6 +51994,17 @@ function promptQueueSnapshotEntries(queues) {
|
|
|
52023
51994
|
// src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
|
|
52024
51995
|
init_yield_to_event_loop();
|
|
52025
51996
|
|
|
51997
|
+
// src/prompt-turn-queue/client-report.ts
|
|
51998
|
+
function sendPromptQueueClientReport(ws, queues) {
|
|
51999
|
+
if (!ws) return false;
|
|
52000
|
+
const wireQueues = {};
|
|
52001
|
+
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
52002
|
+
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
52003
|
+
}
|
|
52004
|
+
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
52005
|
+
return true;
|
|
52006
|
+
}
|
|
52007
|
+
|
|
52026
52008
|
// src/prompt-turn-queue/runner/queue-selection.ts
|
|
52027
52009
|
function pickNextRunnableTurn(turns) {
|
|
52028
52010
|
for (const t of turns) {
|
|
@@ -52041,31 +52023,66 @@ function hasRunningTurn(turns) {
|
|
|
52041
52023
|
}
|
|
52042
52024
|
|
|
52043
52025
|
// src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
|
|
52044
|
-
import
|
|
52026
|
+
import fs61 from "node:fs";
|
|
52045
52027
|
|
|
52046
52028
|
// src/git/snapshot/capture.ts
|
|
52047
|
-
import * as
|
|
52048
|
-
import * as
|
|
52029
|
+
import * as fs60 from "node:fs";
|
|
52030
|
+
import * as path81 from "node:path";
|
|
52031
|
+
|
|
52032
|
+
// src/git/snapshot/apply-pre-turn-snapshot.ts
|
|
52033
|
+
import * as fs59 from "node:fs";
|
|
52034
|
+
async function applyPreTurnSnapshot(filePath, log2) {
|
|
52035
|
+
let data;
|
|
52036
|
+
try {
|
|
52037
|
+
data = JSON.parse(fs59.readFileSync(filePath, "utf8"));
|
|
52038
|
+
} catch (error40) {
|
|
52039
|
+
return { ok: false, error: error40 instanceof Error ? error40.message : String(error40) };
|
|
52040
|
+
}
|
|
52041
|
+
if (!Array.isArray(data.repos)) return { ok: false, error: "Invalid snapshot file" };
|
|
52042
|
+
let applyError = null;
|
|
52043
|
+
await forEachWithGitYield(data.repos, async (repo) => {
|
|
52044
|
+
if (applyError || !repo.path) return;
|
|
52045
|
+
const reset = await gitRun(repo.path, ["reset", "--hard", "HEAD"], log2, "reset --hard");
|
|
52046
|
+
if (!reset.ok) {
|
|
52047
|
+
applyError = reset;
|
|
52048
|
+
return;
|
|
52049
|
+
}
|
|
52050
|
+
const clean = await gitRun(repo.path, ["clean", "-fd"], log2, "clean -fd");
|
|
52051
|
+
if (!clean.ok) {
|
|
52052
|
+
applyError = clean;
|
|
52053
|
+
return;
|
|
52054
|
+
}
|
|
52055
|
+
if (repo.stashSha) {
|
|
52056
|
+
const applied = await gitRun(repo.path, ["stash", "apply", repo.stashSha], log2, "stash apply");
|
|
52057
|
+
if (!applied.ok) applyError = applied;
|
|
52058
|
+
}
|
|
52059
|
+
});
|
|
52060
|
+
if (applyError) return applyError;
|
|
52061
|
+
log2(`[snapshot] Restored pre-turn state for ${data.runId.slice(0, 8)}\u2026`);
|
|
52062
|
+
return { ok: true };
|
|
52063
|
+
}
|
|
52064
|
+
|
|
52065
|
+
// src/git/snapshot/resolve-repo-roots.ts
|
|
52066
|
+
import * as path80 from "node:path";
|
|
52049
52067
|
async function resolveSnapshotRepoRoots(options) {
|
|
52050
52068
|
const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
|
|
52051
52069
|
if (worktreePaths?.length) {
|
|
52052
|
-
const
|
|
52053
|
-
return
|
|
52070
|
+
const paths = [...new Set(worktreePaths.map((p) => path80.resolve(p)))];
|
|
52071
|
+
return (await Promise.all(paths.map(async (p) => await isGitRepoDirectory(p) ? p : null))).filter((p) => p != null);
|
|
52054
52072
|
}
|
|
52055
52073
|
try {
|
|
52056
|
-
const
|
|
52057
|
-
const mapped = repos.map((r) => r.absolutePath);
|
|
52074
|
+
const roots = (await discoverGitReposUnderRoot(fallbackCwd)).map((repo) => repo.absolutePath);
|
|
52058
52075
|
const sid = sessionId?.trim();
|
|
52059
|
-
if (sid)
|
|
52060
|
-
|
|
52061
|
-
|
|
52062
|
-
|
|
52063
|
-
|
|
52064
|
-
} catch (e) {
|
|
52065
|
-
log2(`[snapshot] Discover repositories failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
52076
|
+
if (!sid) return roots;
|
|
52077
|
+
const sessionRoots = roots.filter((root) => path80.basename(root) === sid);
|
|
52078
|
+
return sessionRoots.length > 0 ? sessionRoots : roots;
|
|
52079
|
+
} catch (error40) {
|
|
52080
|
+
log2(`[snapshot] Discover repositories failed: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
52066
52081
|
return [];
|
|
52067
52082
|
}
|
|
52068
52083
|
}
|
|
52084
|
+
|
|
52085
|
+
// src/git/snapshot/capture.ts
|
|
52069
52086
|
async function capturePreTurnSnapshot(options) {
|
|
52070
52087
|
const { runId, repoRoots, agentCwd, log: log2 } = options;
|
|
52071
52088
|
if (!runId || !repoRoots.length) {
|
|
@@ -52079,7 +52096,7 @@ async function capturePreTurnSnapshot(options) {
|
|
|
52079
52096
|
});
|
|
52080
52097
|
const dir = snapshotsDirForCwd(agentCwd);
|
|
52081
52098
|
try {
|
|
52082
|
-
|
|
52099
|
+
fs60.mkdirSync(dir, { recursive: true });
|
|
52083
52100
|
} catch (e) {
|
|
52084
52101
|
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
52085
52102
|
}
|
|
@@ -52088,9 +52105,9 @@ async function capturePreTurnSnapshot(options) {
|
|
|
52088
52105
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52089
52106
|
repos
|
|
52090
52107
|
};
|
|
52091
|
-
const filePath =
|
|
52108
|
+
const filePath = path81.join(dir, `${runId}.json`);
|
|
52092
52109
|
try {
|
|
52093
|
-
|
|
52110
|
+
fs60.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
|
|
52094
52111
|
} catch (e) {
|
|
52095
52112
|
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
52096
52113
|
}
|
|
@@ -52100,39 +52117,6 @@ async function capturePreTurnSnapshot(options) {
|
|
|
52100
52117
|
);
|
|
52101
52118
|
return { ok: true, filePath, repos };
|
|
52102
52119
|
}
|
|
52103
|
-
async function applyPreTurnSnapshot(filePath, log2) {
|
|
52104
|
-
let data;
|
|
52105
|
-
try {
|
|
52106
|
-
const raw = fs58.readFileSync(filePath, "utf8");
|
|
52107
|
-
data = JSON.parse(raw);
|
|
52108
|
-
} catch (e) {
|
|
52109
|
-
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
52110
|
-
}
|
|
52111
|
-
if (!Array.isArray(data.repos)) {
|
|
52112
|
-
return { ok: false, error: "Invalid snapshot file" };
|
|
52113
|
-
}
|
|
52114
|
-
let applyError = null;
|
|
52115
|
-
await forEachWithGitYield(data.repos, async (r) => {
|
|
52116
|
-
if (applyError || !r.path) return;
|
|
52117
|
-
const reset = await gitRun(r.path, ["reset", "--hard", "HEAD"], log2, "reset --hard");
|
|
52118
|
-
if (!reset.ok) {
|
|
52119
|
-
applyError = reset;
|
|
52120
|
-
return;
|
|
52121
|
-
}
|
|
52122
|
-
const clean = await gitRun(r.path, ["clean", "-fd"], log2, "clean -fd");
|
|
52123
|
-
if (!clean.ok) {
|
|
52124
|
-
applyError = clean;
|
|
52125
|
-
return;
|
|
52126
|
-
}
|
|
52127
|
-
if (r.stashSha) {
|
|
52128
|
-
const ap = await gitRun(r.path, ["stash", "apply", r.stashSha], log2, "stash apply");
|
|
52129
|
-
if (!ap.ok) applyError = ap;
|
|
52130
|
-
}
|
|
52131
|
-
});
|
|
52132
|
-
if (applyError) return applyError;
|
|
52133
|
-
log2(`[snapshot] Restored pre-turn state for ${data.runId.slice(0, 8)}\u2026`);
|
|
52134
|
-
return { ok: true };
|
|
52135
|
-
}
|
|
52136
52120
|
|
|
52137
52121
|
// src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
|
|
52138
52122
|
async function runLocalRevertBeforeQueuedPrompt(next, deps) {
|
|
@@ -52143,7 +52127,7 @@ async function runLocalRevertBeforeQueuedPrompt(next, deps) {
|
|
|
52143
52127
|
const agentBase = deps.sessionWorktreeManager.getSessionWorktreeRootForSession(sid) ?? getBridgeRoot();
|
|
52144
52128
|
const file2 = snapshotFilePath(agentBase, tid);
|
|
52145
52129
|
try {
|
|
52146
|
-
await
|
|
52130
|
+
await fs61.promises.access(file2, fs61.constants.F_OK);
|
|
52147
52131
|
} catch {
|
|
52148
52132
|
deps.log(
|
|
52149
52133
|
`[Queue] requeued_with_revert: no pre-turn snapshot for ${tid.slice(0, 8)}\u2026; continuing without revert.`
|
|
@@ -52194,6 +52178,21 @@ async function applyPromptQueueStateFromServer(msg, deps) {
|
|
|
52194
52178
|
await dispatchStartedPromptQueueRuns(entries, started, deps);
|
|
52195
52179
|
}
|
|
52196
52180
|
|
|
52181
|
+
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
52182
|
+
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
52183
|
+
if (!runId) return false;
|
|
52184
|
+
const queueKey = deleteRunIdQueueKey(runId);
|
|
52185
|
+
if (!queueKey) return false;
|
|
52186
|
+
const f = await readPersistedQueue(queueKey);
|
|
52187
|
+
if (!f) return false;
|
|
52188
|
+
const t = f.turns.find((x) => x.turnId === runId);
|
|
52189
|
+
if (!t) return false;
|
|
52190
|
+
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
52191
|
+
await writePersistedQueue(f);
|
|
52192
|
+
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
52193
|
+
return true;
|
|
52194
|
+
}
|
|
52195
|
+
|
|
52197
52196
|
// src/agents/acp/from-bridge/bridge-prompt-wiring.ts
|
|
52198
52197
|
function createBridgePromptSenders(deps, getWs) {
|
|
52199
52198
|
const sendBridgeMessage = (message, encryptedFields = []) => {
|
|
@@ -52292,8 +52291,8 @@ async function runBridgePromptPreamble(params) {
|
|
|
52292
52291
|
log: log2
|
|
52293
52292
|
});
|
|
52294
52293
|
if (s && sessionId) {
|
|
52295
|
-
const cliGitBranch = await readGitBranch(effectiveCwd);
|
|
52296
52294
|
const usesWt = sessionWorktreeManager.usesWorktreeSession(sessionId);
|
|
52295
|
+
const cliGitBranch = repoRoots.length > 0 ? await readGitBranch(effectiveCwd) : null;
|
|
52297
52296
|
const isolatedSessionParentPath = sessionWorktreeManager.getIsolatedSessionParentPathForSession(sessionId);
|
|
52298
52297
|
sendWsMessage(s, {
|
|
52299
52298
|
type: "session_git_context_report",
|
|
@@ -52735,7 +52734,7 @@ var handleSessionDiscardedMessage = (msg, deps) => {
|
|
|
52735
52734
|
};
|
|
52736
52735
|
|
|
52737
52736
|
// src/routing/handlers/revert-turn-snapshot.ts
|
|
52738
|
-
import * as
|
|
52737
|
+
import * as fs62 from "node:fs";
|
|
52739
52738
|
var handleRevertTurnSnapshotMessage = (msg, deps) => {
|
|
52740
52739
|
const id = typeof msg.id === "string" ? msg.id : "";
|
|
52741
52740
|
const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
|
|
@@ -52748,7 +52747,7 @@ var handleRevertTurnSnapshotMessage = (msg, deps) => {
|
|
|
52748
52747
|
const agentBase = sessionWorktreeManager.getSessionWorktreeRootForSession(sessionId) ?? getBridgeRoot();
|
|
52749
52748
|
const file2 = snapshotFilePath(agentBase, turnId);
|
|
52750
52749
|
try {
|
|
52751
|
-
await
|
|
52750
|
+
await fs62.promises.access(file2, fs62.constants.F_OK);
|
|
52752
52751
|
} catch {
|
|
52753
52752
|
sendWsMessage(s, {
|
|
52754
52753
|
type: "revert_turn_snapshot_result",
|
|
@@ -52822,8 +52821,8 @@ function randomSecret() {
|
|
|
52822
52821
|
}
|
|
52823
52822
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
52824
52823
|
}
|
|
52825
|
-
async function requestPreviewApi(port, secret, method,
|
|
52826
|
-
const url2 = `http://127.0.0.1:${port}${
|
|
52824
|
+
async function requestPreviewApi(port, secret, method, path86, body) {
|
|
52825
|
+
const url2 = `http://127.0.0.1:${port}${path86}`;
|
|
52827
52826
|
const headers = {
|
|
52828
52827
|
[PREVIEW_SECRET_HEADER]: secret,
|
|
52829
52828
|
"Content-Type": "application/json"
|
|
@@ -52835,7 +52834,7 @@ async function requestPreviewApi(port, secret, method, path84, body) {
|
|
|
52835
52834
|
});
|
|
52836
52835
|
const data = await res.json().catch(() => ({}));
|
|
52837
52836
|
if (!res.ok) {
|
|
52838
|
-
throw new Error(data?.error ?? `Preview API ${method} ${
|
|
52837
|
+
throw new Error(data?.error ?? `Preview API ${method} ${path86}: ${res.status}`);
|
|
52839
52838
|
}
|
|
52840
52839
|
return data;
|
|
52841
52840
|
}
|
|
@@ -53020,8 +53019,8 @@ function isValidRemoteSkillInstallItem(item) {
|
|
|
53020
53019
|
|
|
53021
53020
|
// src/skills/install/install-remote-skills-async.ts
|
|
53022
53021
|
init_yield_to_event_loop();
|
|
53023
|
-
import
|
|
53024
|
-
import
|
|
53022
|
+
import fs63 from "node:fs";
|
|
53023
|
+
import path82 from "node:path";
|
|
53025
53024
|
|
|
53026
53025
|
// src/skills/install/constants.ts
|
|
53027
53026
|
var INSTALL_SKILLS_YIELD_EVERY = 16;
|
|
@@ -53032,12 +53031,12 @@ async function writeInstallFileAsync(skillDir, f, filesWritten) {
|
|
|
53032
53031
|
if (++filesWritten.count % INSTALL_SKILLS_YIELD_EVERY === 0) {
|
|
53033
53032
|
await yieldToEventLoop();
|
|
53034
53033
|
}
|
|
53035
|
-
const dest =
|
|
53036
|
-
await
|
|
53034
|
+
const dest = path82.join(skillDir, f.path);
|
|
53035
|
+
await fs63.promises.mkdir(path82.dirname(dest), { recursive: true });
|
|
53037
53036
|
if (f.text !== void 0) {
|
|
53038
|
-
await
|
|
53037
|
+
await fs63.promises.writeFile(dest, f.text, "utf8");
|
|
53039
53038
|
} else if (f.base64) {
|
|
53040
|
-
await
|
|
53039
|
+
await fs63.promises.writeFile(dest, Buffer.from(f.base64, "base64"));
|
|
53041
53040
|
}
|
|
53042
53041
|
}
|
|
53043
53042
|
async function installRemoteSkillsAsync(cwd, targetDir, items) {
|
|
@@ -53049,7 +53048,7 @@ async function installRemoteSkillsAsync(cwd, targetDir, items) {
|
|
|
53049
53048
|
try {
|
|
53050
53049
|
for (const item of items) {
|
|
53051
53050
|
if (!isValidRemoteSkillInstallItem(item)) continue;
|
|
53052
|
-
const skillDir =
|
|
53051
|
+
const skillDir = path82.join(cwd, targetDir, item.skillName);
|
|
53053
53052
|
for (const f of item.files) {
|
|
53054
53053
|
await writeInstallFileAsync(skillDir, f, filesWritten);
|
|
53055
53054
|
}
|
|
@@ -53356,13 +53355,13 @@ function handleFileBrowserRequest(msg, socket, e2ee, sessionWorktreeManager) {
|
|
|
53356
53355
|
|
|
53357
53356
|
// src/files/handle-file-browser-search.ts
|
|
53358
53357
|
init_yield_to_event_loop();
|
|
53359
|
-
import
|
|
53358
|
+
import path83 from "node:path";
|
|
53360
53359
|
var SEARCH_LIMIT = 100;
|
|
53361
53360
|
function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
|
|
53362
53361
|
void (async () => {
|
|
53363
53362
|
await yieldToEventLoop();
|
|
53364
53363
|
const q = typeof msg.q === "string" ? msg.q : "";
|
|
53365
|
-
const sessionParentPath =
|
|
53364
|
+
const sessionParentPath = path83.resolve(
|
|
53366
53365
|
sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
|
|
53367
53366
|
);
|
|
53368
53367
|
if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
|
|
@@ -53460,7 +53459,7 @@ function handleFileBrowserCodeNavMessage(msg, { getWs, e2ee, sessionWorktreeMana
|
|
|
53460
53459
|
}
|
|
53461
53460
|
|
|
53462
53461
|
// src/git/bridge-git-context.ts
|
|
53463
|
-
import * as
|
|
53462
|
+
import * as path84 from "node:path";
|
|
53464
53463
|
init_yield_to_event_loop();
|
|
53465
53464
|
|
|
53466
53465
|
// src/git/branches/get-current-branch.ts
|
|
@@ -53511,12 +53510,12 @@ async function listRepoBranchRefs(repoPath) {
|
|
|
53511
53510
|
// src/git/bridge-git-context.ts
|
|
53512
53511
|
function folderNameForRelPath(relPath, bridgeRoot) {
|
|
53513
53512
|
if (relPath === "." || relPath === "") {
|
|
53514
|
-
return
|
|
53513
|
+
return path84.basename(path84.resolve(bridgeRoot)) || "repo";
|
|
53515
53514
|
}
|
|
53516
|
-
return
|
|
53515
|
+
return path84.basename(relPath) || relPath;
|
|
53517
53516
|
}
|
|
53518
53517
|
async function discoverGitReposForBridgeContext(bridgeRoot) {
|
|
53519
|
-
const root =
|
|
53518
|
+
const root = path84.resolve(bridgeRoot);
|
|
53520
53519
|
if (await isGitRepoDirectory(root)) {
|
|
53521
53520
|
const remoteUrl = await getRemoteOriginUrl(root);
|
|
53522
53521
|
return [{ absolutePath: root, remoteUrl }];
|
|
@@ -53524,19 +53523,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
|
|
|
53524
53523
|
const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
|
|
53525
53524
|
const byPath = /* @__PURE__ */ new Map();
|
|
53526
53525
|
for (const repo of [...deep, ...shallow]) {
|
|
53527
|
-
byPath.set(
|
|
53526
|
+
byPath.set(path84.resolve(repo.absolutePath), repo);
|
|
53528
53527
|
}
|
|
53529
53528
|
return [...byPath.values()];
|
|
53530
53529
|
}
|
|
53531
53530
|
async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
|
|
53532
|
-
const bridgeResolved =
|
|
53531
|
+
const bridgeResolved = path84.resolve(bridgeRoot);
|
|
53533
53532
|
const repos = await discoverGitReposForBridgeContext(bridgeResolved);
|
|
53534
53533
|
const rows = [];
|
|
53535
53534
|
for (let i = 0; i < repos.length; i++) {
|
|
53536
53535
|
if (i > 0) await yieldToEventLoop();
|
|
53537
53536
|
const repo = repos[i];
|
|
53538
|
-
let rel =
|
|
53539
|
-
if (rel.startsWith("..") ||
|
|
53537
|
+
let rel = path84.relative(bridgeResolved, repo.absolutePath);
|
|
53538
|
+
if (rel.startsWith("..") || path84.isAbsolute(rel)) continue;
|
|
53540
53539
|
const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
|
|
53541
53540
|
const currentBranch = await getCurrentBranch(repo.absolutePath);
|
|
53542
53541
|
const remoteUrl = repo.remoteUrl.trim() || null;
|
|
@@ -53551,11 +53550,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
|
|
|
53551
53550
|
return rows;
|
|
53552
53551
|
}
|
|
53553
53552
|
async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
|
|
53554
|
-
const bridgeResolved =
|
|
53553
|
+
const bridgeResolved = path84.resolve(bridgeRoot);
|
|
53555
53554
|
const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
|
|
53556
|
-
const repoPath = rel === "" ? bridgeResolved :
|
|
53557
|
-
const resolved =
|
|
53558
|
-
if (!resolved.startsWith(bridgeResolved +
|
|
53555
|
+
const repoPath = rel === "" ? bridgeResolved : path84.join(bridgeResolved, rel);
|
|
53556
|
+
const resolved = path84.resolve(repoPath);
|
|
53557
|
+
if (!resolved.startsWith(bridgeResolved + path84.sep) && resolved !== bridgeResolved) {
|
|
53559
53558
|
return [];
|
|
53560
53559
|
}
|
|
53561
53560
|
return listRepoBranchRefs(resolved);
|
|
@@ -54219,9 +54218,9 @@ async function runCliAction(program2, opts) {
|
|
|
54219
54218
|
const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAUTOMATON_FIREHOSE_URL ?? process.env.BUILDAUTOMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
|
|
54220
54219
|
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);
|
|
54221
54220
|
if (bridgeRootOpt) {
|
|
54222
|
-
const resolvedBridgeRoot =
|
|
54221
|
+
const resolvedBridgeRoot = path85.resolve(process.cwd(), bridgeRootOpt);
|
|
54223
54222
|
try {
|
|
54224
|
-
const st =
|
|
54223
|
+
const st = fs64.statSync(resolvedBridgeRoot);
|
|
54225
54224
|
if (!st.isDirectory()) {
|
|
54226
54225
|
console.error(`Bridge root is not a directory: ${resolvedBridgeRoot}`);
|
|
54227
54226
|
process.exit(1);
|
|
@@ -54241,7 +54240,7 @@ async function runCliAction(program2, opts) {
|
|
|
54241
54240
|
);
|
|
54242
54241
|
let worktreesRootPath;
|
|
54243
54242
|
if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
|
|
54244
|
-
worktreesRootPath =
|
|
54243
|
+
worktreesRootPath = path85.resolve(opts.worktreesRoot.trim());
|
|
54245
54244
|
}
|
|
54246
54245
|
const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
|
|
54247
54246
|
if (e2eCertificates) {
|