@buildautomaton/cli 0.1.94 → 0.1.96
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 +802 -1100
- package/dist/cli.js.map +4 -4
- package/dist/index.js +768 -1064
- package/dist/index.js.map +4 -4
- package/dist/worker.js +83 -161
- package/dist/worker.js.map +4 -4
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -773,7 +773,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
|
|
|
773
773
|
join(moduleDir, "..", sub, filename),
|
|
774
774
|
join(moduleDir, "..", "..", "dist", sub, filename)
|
|
775
775
|
]);
|
|
776
|
-
const resolved = candidates.find((
|
|
776
|
+
const resolved = candidates.find((path14) => existsSync(path14));
|
|
777
777
|
if (!resolved) {
|
|
778
778
|
throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
|
|
779
779
|
}
|
|
@@ -1124,31 +1124,18 @@ var init_constants = __esm({
|
|
|
1124
1124
|
}
|
|
1125
1125
|
});
|
|
1126
1126
|
|
|
1127
|
-
// ../bridge/src/prompt-turn-queue/paths.ts
|
|
1128
|
-
import path5 from "node:path";
|
|
1129
|
-
import os4 from "node:os";
|
|
1130
|
-
function getPromptQueuesDirectory() {
|
|
1131
|
-
const override = process.env.BUILDAMATON_PROMPT_QUEUES_DIR?.trim();
|
|
1132
|
-
if (override) return path5.resolve(override);
|
|
1133
|
-
return path5.join(os4.homedir(), ".buildautomaton", "queues");
|
|
1134
|
-
}
|
|
1135
|
-
var init_paths = __esm({
|
|
1136
|
-
"../bridge/src/prompt-turn-queue/paths.ts"() {
|
|
1137
|
-
}
|
|
1138
|
-
});
|
|
1139
|
-
|
|
1140
1127
|
// ../bridge/src/sqlite/legacy_migration/archive-to-old-version.ts
|
|
1141
1128
|
import fs7 from "node:fs";
|
|
1142
|
-
import
|
|
1129
|
+
import path5 from "node:path";
|
|
1143
1130
|
function moveLegacyFileToOldVersionBackup(category, sourcePath) {
|
|
1144
|
-
const destDir =
|
|
1131
|
+
const destDir = path5.join(OLD_VERSION_DIR, category);
|
|
1145
1132
|
fs7.mkdirSync(destDir, { recursive: true });
|
|
1146
|
-
const base =
|
|
1147
|
-
let dest =
|
|
1133
|
+
const base = path5.basename(sourcePath);
|
|
1134
|
+
let dest = path5.join(destDir, base);
|
|
1148
1135
|
if (fs7.existsSync(dest)) {
|
|
1149
|
-
const ext =
|
|
1136
|
+
const ext = path5.extname(base);
|
|
1150
1137
|
const stem = ext ? base.slice(0, -ext.length) : base;
|
|
1151
|
-
dest =
|
|
1138
|
+
dest = path5.join(destDir, `${stem}-${Date.now()}${ext}`);
|
|
1152
1139
|
}
|
|
1153
1140
|
fs7.renameSync(sourcePath, dest);
|
|
1154
1141
|
}
|
|
@@ -1157,19 +1144,19 @@ var init_archive_to_old_version = __esm({
|
|
|
1157
1144
|
"../bridge/src/sqlite/legacy_migration/archive-to-old-version.ts"() {
|
|
1158
1145
|
"use strict";
|
|
1159
1146
|
init_constants();
|
|
1160
|
-
OLD_VERSION_DIR =
|
|
1147
|
+
OLD_VERSION_DIR = path5.join(INDEX_DIR, "old-version");
|
|
1161
1148
|
}
|
|
1162
1149
|
});
|
|
1163
1150
|
|
|
1164
1151
|
// ../bridge/src/sqlite/legacy_migration/archive-file-index-json.ts
|
|
1165
1152
|
import fs8 from "node:fs";
|
|
1166
|
-
import
|
|
1153
|
+
import path6 from "node:path";
|
|
1167
1154
|
function archiveLegacyFileIndexJsonFiles() {
|
|
1168
1155
|
try {
|
|
1169
1156
|
if (!fs8.existsSync(INDEX_DIR)) return;
|
|
1170
1157
|
for (const name of fs8.readdirSync(INDEX_DIR)) {
|
|
1171
1158
|
if (name.startsWith(".file-index-") && name.endsWith(".json")) {
|
|
1172
|
-
const full =
|
|
1159
|
+
const full = path6.join(INDEX_DIR, name);
|
|
1173
1160
|
try {
|
|
1174
1161
|
moveLegacyFileToOldVersionBackup("file-index", full);
|
|
1175
1162
|
} catch (err) {
|
|
@@ -1191,15 +1178,15 @@ var init_archive_file_index_json = __esm({
|
|
|
1191
1178
|
|
|
1192
1179
|
// ../bridge/src/sqlite/legacy_migration/import-agent-sessions-from-disk.ts
|
|
1193
1180
|
import fs9 from "node:fs";
|
|
1194
|
-
import
|
|
1195
|
-
import
|
|
1181
|
+
import path7 from "node:path";
|
|
1182
|
+
import os4 from "node:os";
|
|
1196
1183
|
function importLegacyAgentSessionsFromDisk(db) {
|
|
1197
1184
|
try {
|
|
1198
1185
|
if (!fs9.existsSync(LEGACY_AGENT_SESSION_DIR)) return;
|
|
1199
1186
|
const names = fs9.readdirSync(LEGACY_AGENT_SESSION_DIR).filter((n) => n.endsWith(".json"));
|
|
1200
1187
|
for (const name of names) {
|
|
1201
1188
|
const sessionKey = name.slice(0, -".json".length);
|
|
1202
|
-
const full =
|
|
1189
|
+
const full = path7.join(LEGACY_AGENT_SESSION_DIR, name);
|
|
1203
1190
|
let raw;
|
|
1204
1191
|
try {
|
|
1205
1192
|
raw = fs9.readFileSync(full, "utf8");
|
|
@@ -1236,89 +1223,27 @@ var init_import_agent_sessions_from_disk = __esm({
|
|
|
1236
1223
|
"../bridge/src/sqlite/legacy_migration/import-agent-sessions-from-disk.ts"() {
|
|
1237
1224
|
"use strict";
|
|
1238
1225
|
init_archive_to_old_version();
|
|
1239
|
-
LEGACY_AGENT_SESSION_DIR =
|
|
1240
|
-
}
|
|
1241
|
-
});
|
|
1242
|
-
|
|
1243
|
-
// ../bridge/src/sqlite/legacy_migration/parse-persisted-queue-json.ts
|
|
1244
|
-
function parsePersistedQueueFromJson(raw) {
|
|
1245
|
-
try {
|
|
1246
|
-
const o = JSON.parse(raw);
|
|
1247
|
-
const queueKey = typeof o.queueKey === "string" ? o.queueKey : typeof o.queueKeyHash === "string" ? o.queueKeyHash : null;
|
|
1248
|
-
if (!queueKey || typeof o.updatedAt !== "string" || !Array.isArray(o.turns)) return null;
|
|
1249
|
-
return { queueKey, updatedAt: o.updatedAt, turns: o.turns };
|
|
1250
|
-
} catch {
|
|
1251
|
-
return null;
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
var init_parse_persisted_queue_json = __esm({
|
|
1255
|
-
"../bridge/src/sqlite/legacy_migration/parse-persisted-queue-json.ts"() {
|
|
1256
|
-
"use strict";
|
|
1257
|
-
}
|
|
1258
|
-
});
|
|
1259
|
-
|
|
1260
|
-
// ../bridge/src/sqlite/legacy_migration/import-prompt-queues-from-disk.ts
|
|
1261
|
-
import fs10 from "node:fs";
|
|
1262
|
-
import path9 from "node:path";
|
|
1263
|
-
function importLegacyPromptQueuesFromDisk(db) {
|
|
1264
|
-
try {
|
|
1265
|
-
const dir = getPromptQueuesDirectory();
|
|
1266
|
-
if (!fs10.existsSync(dir)) return;
|
|
1267
|
-
for (const name of fs10.readdirSync(dir)) {
|
|
1268
|
-
if (!name.endsWith(".json")) continue;
|
|
1269
|
-
const full = path9.join(dir, name);
|
|
1270
|
-
let raw;
|
|
1271
|
-
try {
|
|
1272
|
-
raw = fs10.readFileSync(full, "utf8");
|
|
1273
|
-
} catch {
|
|
1274
|
-
continue;
|
|
1275
|
-
}
|
|
1276
|
-
const file = parsePersistedQueueFromJson(raw);
|
|
1277
|
-
if (!file) continue;
|
|
1278
|
-
db.run(
|
|
1279
|
-
`INSERT OR REPLACE INTO prompt_queue (queue_key, updated_at, turns_json) VALUES (?, ?, ?)`,
|
|
1280
|
-
[file.queueKey, file.updatedAt, JSON.stringify(file.turns)]
|
|
1281
|
-
);
|
|
1282
|
-
try {
|
|
1283
|
-
moveLegacyFileToOldVersionBackup("queues", full);
|
|
1284
|
-
} catch {
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
} catch (e) {
|
|
1288
|
-
console.error("[cli-sqlite] legacy import: prompt queues from disk failed", e);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
var init_import_prompt_queues_from_disk = __esm({
|
|
1292
|
-
"../bridge/src/sqlite/legacy_migration/import-prompt-queues-from-disk.ts"() {
|
|
1293
|
-
"use strict";
|
|
1294
|
-
init_paths();
|
|
1295
|
-
init_archive_to_old_version();
|
|
1296
|
-
init_parse_persisted_queue_json();
|
|
1226
|
+
LEGACY_AGENT_SESSION_DIR = path7.join(os4.homedir(), ".buildautomaton", "agent-sessions");
|
|
1297
1227
|
}
|
|
1298
1228
|
});
|
|
1299
1229
|
|
|
1300
1230
|
// ../bridge/src/sqlite/legacy_migration/import-cli-legacy-disk-data.ts
|
|
1301
|
-
import
|
|
1231
|
+
import fs10 from "node:fs";
|
|
1302
1232
|
function legacyCliDiskMigrationIsPending() {
|
|
1303
1233
|
try {
|
|
1304
|
-
if (
|
|
1305
|
-
for (const name of
|
|
1234
|
+
if (fs10.existsSync(INDEX_DIR)) {
|
|
1235
|
+
for (const name of fs10.readdirSync(INDEX_DIR)) {
|
|
1306
1236
|
if (name.startsWith(".file-index-") && name.endsWith(".json")) return true;
|
|
1307
1237
|
}
|
|
1308
1238
|
}
|
|
1309
1239
|
} catch {
|
|
1310
1240
|
}
|
|
1311
1241
|
try {
|
|
1312
|
-
if (
|
|
1313
|
-
if (
|
|
1242
|
+
if (fs10.existsSync(LEGACY_AGENT_SESSION_DIR)) {
|
|
1243
|
+
if (fs10.readdirSync(LEGACY_AGENT_SESSION_DIR).some((n) => n.endsWith(".json"))) return true;
|
|
1314
1244
|
}
|
|
1315
1245
|
} catch {
|
|
1316
1246
|
}
|
|
1317
|
-
try {
|
|
1318
|
-
const dir = getPromptQueuesDirectory();
|
|
1319
|
-
if (fs11.existsSync(dir) && fs11.readdirSync(dir).some((n) => n.endsWith(".json"))) return true;
|
|
1320
|
-
} catch {
|
|
1321
|
-
}
|
|
1322
1247
|
return false;
|
|
1323
1248
|
}
|
|
1324
1249
|
function importCliSqliteLegacyDiskData(db, log) {
|
|
@@ -1328,7 +1253,6 @@ function importCliSqliteLegacyDiskData(db, log) {
|
|
|
1328
1253
|
}
|
|
1329
1254
|
archiveLegacyFileIndexJsonFiles();
|
|
1330
1255
|
importLegacyAgentSessionsFromDisk(db);
|
|
1331
|
-
importLegacyPromptQueuesFromDisk(db);
|
|
1332
1256
|
if (pending && log) {
|
|
1333
1257
|
log("Legacy on-disk CLI data migration finished.");
|
|
1334
1258
|
}
|
|
@@ -1337,10 +1261,8 @@ var init_import_cli_legacy_disk_data = __esm({
|
|
|
1337
1261
|
"../bridge/src/sqlite/legacy_migration/import-cli-legacy-disk-data.ts"() {
|
|
1338
1262
|
"use strict";
|
|
1339
1263
|
init_constants();
|
|
1340
|
-
init_paths();
|
|
1341
1264
|
init_archive_file_index_json();
|
|
1342
1265
|
init_import_agent_sessions_from_disk();
|
|
1343
|
-
init_import_prompt_queues_from_disk();
|
|
1344
1266
|
}
|
|
1345
1267
|
});
|
|
1346
1268
|
|
|
@@ -1769,7 +1691,7 @@ var require_ignore = __commonJS({
|
|
|
1769
1691
|
// path matching.
|
|
1770
1692
|
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
1771
1693
|
// @returns {TestResult} true if a file is ignored
|
|
1772
|
-
test(
|
|
1694
|
+
test(path14, checkUnignored, mode) {
|
|
1773
1695
|
let ignored = false;
|
|
1774
1696
|
let unignored = false;
|
|
1775
1697
|
let matchedRule;
|
|
@@ -1778,7 +1700,7 @@ var require_ignore = __commonJS({
|
|
|
1778
1700
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
1779
1701
|
return;
|
|
1780
1702
|
}
|
|
1781
|
-
const matched = rule[mode].test(
|
|
1703
|
+
const matched = rule[mode].test(path14);
|
|
1782
1704
|
if (!matched) {
|
|
1783
1705
|
return;
|
|
1784
1706
|
}
|
|
@@ -1799,17 +1721,17 @@ var require_ignore = __commonJS({
|
|
|
1799
1721
|
var throwError = (message, Ctor) => {
|
|
1800
1722
|
throw new Ctor(message);
|
|
1801
1723
|
};
|
|
1802
|
-
var checkPath = (
|
|
1803
|
-
if (!isString(
|
|
1724
|
+
var checkPath = (path14, originalPath, doThrow) => {
|
|
1725
|
+
if (!isString(path14)) {
|
|
1804
1726
|
return doThrow(
|
|
1805
1727
|
`path must be a string, but got \`${originalPath}\``,
|
|
1806
1728
|
TypeError
|
|
1807
1729
|
);
|
|
1808
1730
|
}
|
|
1809
|
-
if (!
|
|
1731
|
+
if (!path14) {
|
|
1810
1732
|
return doThrow(`path must not be empty`, TypeError);
|
|
1811
1733
|
}
|
|
1812
|
-
if (checkPath.isNotRelative(
|
|
1734
|
+
if (checkPath.isNotRelative(path14)) {
|
|
1813
1735
|
const r = "`path.relative()`d";
|
|
1814
1736
|
return doThrow(
|
|
1815
1737
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -1818,7 +1740,7 @@ var require_ignore = __commonJS({
|
|
|
1818
1740
|
}
|
|
1819
1741
|
return true;
|
|
1820
1742
|
};
|
|
1821
|
-
var isNotRelative = (
|
|
1743
|
+
var isNotRelative = (path14) => REGEX_TEST_INVALID_PATH.test(path14);
|
|
1822
1744
|
checkPath.isNotRelative = isNotRelative;
|
|
1823
1745
|
checkPath.convert = (p) => p;
|
|
1824
1746
|
var Ignore = class {
|
|
@@ -1848,19 +1770,19 @@ var require_ignore = __commonJS({
|
|
|
1848
1770
|
}
|
|
1849
1771
|
// @returns {TestResult}
|
|
1850
1772
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
1851
|
-
const
|
|
1773
|
+
const path14 = originalPath && checkPath.convert(originalPath);
|
|
1852
1774
|
checkPath(
|
|
1853
|
-
|
|
1775
|
+
path14,
|
|
1854
1776
|
originalPath,
|
|
1855
1777
|
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
1856
1778
|
);
|
|
1857
|
-
return this._t(
|
|
1779
|
+
return this._t(path14, cache, checkUnignored, slices);
|
|
1858
1780
|
}
|
|
1859
|
-
checkIgnore(
|
|
1860
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(
|
|
1861
|
-
return this.test(
|
|
1781
|
+
checkIgnore(path14) {
|
|
1782
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path14)) {
|
|
1783
|
+
return this.test(path14);
|
|
1862
1784
|
}
|
|
1863
|
-
const slices =
|
|
1785
|
+
const slices = path14.split(SLASH).filter(Boolean);
|
|
1864
1786
|
slices.pop();
|
|
1865
1787
|
if (slices.length) {
|
|
1866
1788
|
const parent = this._t(
|
|
@@ -1873,18 +1795,18 @@ var require_ignore = __commonJS({
|
|
|
1873
1795
|
return parent;
|
|
1874
1796
|
}
|
|
1875
1797
|
}
|
|
1876
|
-
return this._rules.test(
|
|
1798
|
+
return this._rules.test(path14, false, MODE_CHECK_IGNORE);
|
|
1877
1799
|
}
|
|
1878
|
-
_t(
|
|
1879
|
-
if (
|
|
1880
|
-
return cache[
|
|
1800
|
+
_t(path14, cache, checkUnignored, slices) {
|
|
1801
|
+
if (path14 in cache) {
|
|
1802
|
+
return cache[path14];
|
|
1881
1803
|
}
|
|
1882
1804
|
if (!slices) {
|
|
1883
|
-
slices =
|
|
1805
|
+
slices = path14.split(SLASH).filter(Boolean);
|
|
1884
1806
|
}
|
|
1885
1807
|
slices.pop();
|
|
1886
1808
|
if (!slices.length) {
|
|
1887
|
-
return cache[
|
|
1809
|
+
return cache[path14] = this._rules.test(path14, checkUnignored, MODE_IGNORE);
|
|
1888
1810
|
}
|
|
1889
1811
|
const parent = this._t(
|
|
1890
1812
|
slices.join(SLASH) + SLASH,
|
|
@@ -1892,29 +1814,29 @@ var require_ignore = __commonJS({
|
|
|
1892
1814
|
checkUnignored,
|
|
1893
1815
|
slices
|
|
1894
1816
|
);
|
|
1895
|
-
return cache[
|
|
1817
|
+
return cache[path14] = parent.ignored ? parent : this._rules.test(path14, checkUnignored, MODE_IGNORE);
|
|
1896
1818
|
}
|
|
1897
|
-
ignores(
|
|
1898
|
-
return this._test(
|
|
1819
|
+
ignores(path14) {
|
|
1820
|
+
return this._test(path14, this._ignoreCache, false).ignored;
|
|
1899
1821
|
}
|
|
1900
1822
|
createFilter() {
|
|
1901
|
-
return (
|
|
1823
|
+
return (path14) => !this.ignores(path14);
|
|
1902
1824
|
}
|
|
1903
1825
|
filter(paths) {
|
|
1904
1826
|
return makeArray(paths).filter(this.createFilter());
|
|
1905
1827
|
}
|
|
1906
1828
|
// @returns {TestResult}
|
|
1907
|
-
test(
|
|
1908
|
-
return this._test(
|
|
1829
|
+
test(path14) {
|
|
1830
|
+
return this._test(path14, this._testCache, true);
|
|
1909
1831
|
}
|
|
1910
1832
|
};
|
|
1911
1833
|
var factory = (options) => new Ignore(options);
|
|
1912
|
-
var isPathValid = (
|
|
1834
|
+
var isPathValid = (path14) => checkPath(path14 && checkPath.convert(path14), path14, RETURN_FALSE);
|
|
1913
1835
|
var setupWindows = () => {
|
|
1914
1836
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
1915
1837
|
checkPath.convert = makePosix;
|
|
1916
1838
|
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
1917
|
-
checkPath.isNotRelative = (
|
|
1839
|
+
checkPath.isNotRelative = (path14) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path14) || isNotRelative(path14);
|
|
1918
1840
|
};
|
|
1919
1841
|
if (
|
|
1920
1842
|
// Detect `process` so that it can run in browsers.
|
|
@@ -1930,8 +1852,8 @@ var require_ignore = __commonJS({
|
|
|
1930
1852
|
});
|
|
1931
1853
|
|
|
1932
1854
|
// ../bridge/src/code-nav/gitignore-filter.ts
|
|
1933
|
-
import
|
|
1934
|
-
import
|
|
1855
|
+
import fs11 from "node:fs";
|
|
1856
|
+
import path8 from "node:path";
|
|
1935
1857
|
function normalizeRelPath(relPath) {
|
|
1936
1858
|
return relPath.replace(/\\/g, "/");
|
|
1937
1859
|
}
|
|
@@ -1941,12 +1863,12 @@ function isUnderDir(relPath, dirRel) {
|
|
|
1941
1863
|
async function createGitignoreFilterForRelativePath(root, relPath) {
|
|
1942
1864
|
const filter = new GitignoreFilter();
|
|
1943
1865
|
await filter.enterDirectory(root, "");
|
|
1944
|
-
const dirRel = normalizeRelPath(
|
|
1866
|
+
const dirRel = normalizeRelPath(path8.dirname(relPath));
|
|
1945
1867
|
if (dirRel === "." || dirRel === "") return filter;
|
|
1946
1868
|
let abs = root;
|
|
1947
1869
|
let rel = "";
|
|
1948
1870
|
for (const segment of dirRel.split("/")) {
|
|
1949
|
-
abs =
|
|
1871
|
+
abs = path8.join(abs, segment);
|
|
1950
1872
|
rel = rel ? `${rel}/${segment}` : segment;
|
|
1951
1873
|
await filter.enterDirectory(abs, rel);
|
|
1952
1874
|
}
|
|
@@ -1968,7 +1890,7 @@ var init_gitignore_filter = __esm({
|
|
|
1968
1890
|
/** Load `.gitignore` in `absDir` and push a layer when the file exists. */
|
|
1969
1891
|
async enterDirectory(absDir, dirRel) {
|
|
1970
1892
|
try {
|
|
1971
|
-
const content = await
|
|
1893
|
+
const content = await fs11.promises.readFile(path8.join(absDir, ".gitignore"), "utf8");
|
|
1972
1894
|
this.layers.push({ dirRel, ig: (0, import_ignore.default)().add(content) });
|
|
1973
1895
|
} catch {
|
|
1974
1896
|
}
|
|
@@ -1995,7 +1917,7 @@ var init_gitignore_filter = __esm({
|
|
|
1995
1917
|
});
|
|
1996
1918
|
|
|
1997
1919
|
// ../bridge/src/code-nav/language-registry.ts
|
|
1998
|
-
import
|
|
1920
|
+
import path9 from "node:path";
|
|
1999
1921
|
function languageAssetPaths(key, wasmFile) {
|
|
2000
1922
|
return {
|
|
2001
1923
|
wasmFile,
|
|
@@ -2003,7 +1925,7 @@ function languageAssetPaths(key, wasmFile) {
|
|
|
2003
1925
|
};
|
|
2004
1926
|
}
|
|
2005
1927
|
function getLanguageKeyForFilePath(filePath) {
|
|
2006
|
-
const ext =
|
|
1928
|
+
const ext = path9.extname(filePath).replace(/^\./, "").toLowerCase();
|
|
2007
1929
|
if (!ext) return null;
|
|
2008
1930
|
return EXT_TO_LANGUAGE_KEY[ext] ?? null;
|
|
2009
1931
|
}
|
|
@@ -2053,13 +1975,13 @@ var init_language_registry = __esm({
|
|
|
2053
1975
|
});
|
|
2054
1976
|
|
|
2055
1977
|
// ../bridge/src/code-nav/walk-code-nav-files.ts
|
|
2056
|
-
import
|
|
2057
|
-
import
|
|
1978
|
+
import fs12 from "node:fs";
|
|
1979
|
+
import path10 from "node:path";
|
|
2058
1980
|
async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile, state) {
|
|
2059
1981
|
await filter.enterDirectory(dir, relDir);
|
|
2060
1982
|
let names;
|
|
2061
1983
|
try {
|
|
2062
|
-
names = await
|
|
1984
|
+
names = await fs12.promises.readdir(dir);
|
|
2063
1985
|
} catch {
|
|
2064
1986
|
filter.leaveDirectory(relDir);
|
|
2065
1987
|
return;
|
|
@@ -2076,10 +1998,10 @@ async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile,
|
|
|
2076
1998
|
}
|
|
2077
1999
|
state.n++;
|
|
2078
2000
|
const relPath = relDir ? `${relDir}/${name}` : name;
|
|
2079
|
-
const full =
|
|
2001
|
+
const full = path10.join(dir, name);
|
|
2080
2002
|
let stat;
|
|
2081
2003
|
try {
|
|
2082
|
-
stat = await
|
|
2004
|
+
stat = await fs12.promises.stat(full);
|
|
2083
2005
|
} catch {
|
|
2084
2006
|
continue;
|
|
2085
2007
|
}
|
|
@@ -2096,7 +2018,7 @@ async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile,
|
|
|
2096
2018
|
filter.leaveDirectory(relDir);
|
|
2097
2019
|
}
|
|
2098
2020
|
async function walkCodeNavFilesAsync(rootDir, onFile, state = createWalkYieldState()) {
|
|
2099
|
-
const resolved =
|
|
2021
|
+
const resolved = path10.resolve(rootDir);
|
|
2100
2022
|
const filter = new GitignoreFilter();
|
|
2101
2023
|
await walkCodeNavFilesInDirectory(resolved, resolved, "", filter, onFile, state);
|
|
2102
2024
|
}
|
|
@@ -2138,12 +2060,12 @@ var init_bridge_root = __esm({
|
|
|
2138
2060
|
});
|
|
2139
2061
|
|
|
2140
2062
|
// ../bridge/src/files/index/paths.ts
|
|
2141
|
-
import
|
|
2063
|
+
import path11 from "node:path";
|
|
2142
2064
|
import crypto from "node:crypto";
|
|
2143
2065
|
function getCwdHashForFileIndex(resolvedCwd) {
|
|
2144
|
-
return crypto.createHash("sha256").update(
|
|
2066
|
+
return crypto.createHash("sha256").update(path11.resolve(resolvedCwd)).digest("hex").slice(0, INDEX_HASH_LEN);
|
|
2145
2067
|
}
|
|
2146
|
-
var
|
|
2068
|
+
var init_paths = __esm({
|
|
2147
2069
|
"../bridge/src/files/index/paths.ts"() {
|
|
2148
2070
|
init_constants();
|
|
2149
2071
|
}
|
|
@@ -2204,7 +2126,7 @@ var init_parent_path = __esm({
|
|
|
2204
2126
|
"../bridge/src/code-nav/symbol-index/sqlite/parent-path.ts"() {
|
|
2205
2127
|
"use strict";
|
|
2206
2128
|
init_bridge_root();
|
|
2207
|
-
|
|
2129
|
+
init_paths();
|
|
2208
2130
|
init_normalize_resolved_path();
|
|
2209
2131
|
init_database();
|
|
2210
2132
|
init_symbol_index_version();
|
|
@@ -2832,7 +2754,7 @@ var init_persist_single_file = __esm({
|
|
|
2832
2754
|
});
|
|
2833
2755
|
|
|
2834
2756
|
// ../bridge/src/code-nav/resolve-module-import-path.ts
|
|
2835
|
-
import
|
|
2757
|
+
import path12 from "node:path";
|
|
2836
2758
|
function normalizeWorkspacePath(filePath) {
|
|
2837
2759
|
return filePath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
2838
2760
|
}
|
|
@@ -2872,28 +2794,28 @@ function tsJsImportCandidates(joined) {
|
|
|
2872
2794
|
function resolveModuleImportPath(importerFilePath, moduleSpecifier, workspaceFiles) {
|
|
2873
2795
|
const spec = moduleSpecifier.trim();
|
|
2874
2796
|
if (!spec || !isRelativeModuleSpecifier(spec)) return null;
|
|
2875
|
-
const importerDir =
|
|
2876
|
-
const joined = normalizeWorkspacePath(
|
|
2797
|
+
const importerDir = path12.posix.dirname(normalizeWorkspacePath(importerFilePath));
|
|
2798
|
+
const joined = normalizeWorkspacePath(path12.posix.normalize(path12.posix.join(importerDir, spec)));
|
|
2877
2799
|
return firstExistingPath(tsJsImportCandidates(joined), workspaceFiles);
|
|
2878
2800
|
}
|
|
2879
2801
|
function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFiles) {
|
|
2880
2802
|
const moduleName = moduleSpecifier.trim().replace(/\s+/g, "");
|
|
2881
2803
|
if (!moduleName) return null;
|
|
2882
|
-
const importerDir =
|
|
2804
|
+
const importerDir = path12.posix.dirname(normalizeWorkspacePath(importerFilePath));
|
|
2883
2805
|
if (moduleName.startsWith(".")) {
|
|
2884
2806
|
const dotMatch = /^(\.+)(.*)$/.exec(moduleName);
|
|
2885
2807
|
const dotCount = dotMatch?.[1]?.length ?? 1;
|
|
2886
2808
|
const rest = (dotMatch?.[2] ?? "").replace(/^\./, "");
|
|
2887
2809
|
let baseDir = importerDir;
|
|
2888
2810
|
for (let i = 1; i < dotCount; i++) {
|
|
2889
|
-
baseDir =
|
|
2811
|
+
baseDir = path12.posix.dirname(baseDir);
|
|
2890
2812
|
}
|
|
2891
2813
|
const dottedPath2 = rest ? rest.split(".").join("/") : "";
|
|
2892
|
-
const relativeBase = dottedPath2 ?
|
|
2814
|
+
const relativeBase = dottedPath2 ? path12.posix.join(baseDir, dottedPath2) : baseDir;
|
|
2893
2815
|
return firstExistingPath(
|
|
2894
2816
|
[
|
|
2895
2817
|
...withSuffixes(relativeBase, PYTHON_EXTENSIONS),
|
|
2896
|
-
...withSuffixes(
|
|
2818
|
+
...withSuffixes(path12.posix.join(relativeBase, "__init__"), [".py"])
|
|
2897
2819
|
],
|
|
2898
2820
|
workspaceFiles
|
|
2899
2821
|
);
|
|
@@ -2902,7 +2824,7 @@ function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFil
|
|
|
2902
2824
|
return firstExistingPath(
|
|
2903
2825
|
[
|
|
2904
2826
|
...withSuffixes(dottedPath, PYTHON_EXTENSIONS),
|
|
2905
|
-
...withSuffixes(
|
|
2827
|
+
...withSuffixes(path12.posix.join(importerDir, dottedPath), PYTHON_EXTENSIONS)
|
|
2906
2828
|
],
|
|
2907
2829
|
workspaceFiles
|
|
2908
2830
|
);
|
|
@@ -2910,9 +2832,9 @@ function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFil
|
|
|
2910
2832
|
function resolveIncludePath(importerFilePath, includePath, workspaceFiles) {
|
|
2911
2833
|
const spec = includePath.trim().replace(/^["']|["']$/g, "");
|
|
2912
2834
|
if (!spec) return null;
|
|
2913
|
-
const importerDir =
|
|
2835
|
+
const importerDir = path12.posix.dirname(normalizeWorkspacePath(importerFilePath));
|
|
2914
2836
|
const joined = normalizeWorkspacePath(
|
|
2915
|
-
|
|
2837
|
+
path12.posix.normalize(path12.posix.join(importerDir, spec.replace(/\\/g, "/")))
|
|
2916
2838
|
);
|
|
2917
2839
|
if (workspaceFiles.has(joined)) return joined;
|
|
2918
2840
|
return firstExistingPath(withSuffixes(joined, C_CPP_EXTENSIONS), workspaceFiles);
|
|
@@ -2931,8 +2853,8 @@ function resolveGoImportPath(importerFilePath, moduleSpecifier, workspaceFiles)
|
|
|
2931
2853
|
const spec = moduleSpecifier.trim();
|
|
2932
2854
|
if (!spec) return null;
|
|
2933
2855
|
if (isRelativeModuleSpecifier(spec)) {
|
|
2934
|
-
const importerDir =
|
|
2935
|
-
const joined = normalizeWorkspacePath(
|
|
2856
|
+
const importerDir = path12.posix.dirname(normalizeWorkspacePath(importerFilePath));
|
|
2857
|
+
const joined = normalizeWorkspacePath(path12.posix.normalize(path12.posix.join(importerDir, spec)));
|
|
2936
2858
|
if (workspaceFiles.has(joined)) return joined;
|
|
2937
2859
|
return firstExistingPath(withSuffixes(joined, [".go"]), workspaceFiles);
|
|
2938
2860
|
}
|
|
@@ -4339,12 +4261,12 @@ var init_workspace_files = __esm({
|
|
|
4339
4261
|
});
|
|
4340
4262
|
|
|
4341
4263
|
// ../bridge/src/code-nav/symbol-index/build/extract-file-symbol-data.ts
|
|
4342
|
-
import
|
|
4343
|
-
import
|
|
4264
|
+
import fs13 from "node:fs";
|
|
4265
|
+
import path13 from "node:path";
|
|
4344
4266
|
import { isMainThread as isMainThread3 } from "node:worker_threads";
|
|
4345
4267
|
async function extractFileSymbolData(resolved, relPath, workspaceFilesOverride) {
|
|
4346
4268
|
await yieldForBridgeInteractivePriority();
|
|
4347
|
-
const absPath =
|
|
4269
|
+
const absPath = path13.join(resolved, relPath);
|
|
4348
4270
|
let tags = [];
|
|
4349
4271
|
let source = null;
|
|
4350
4272
|
if (isCodeNavSupportedPath(relPath) && !await isPathGitIgnored(resolved, relPath)) {
|
|
@@ -4352,16 +4274,16 @@ async function extractFileSymbolData(resolved, relPath, workspaceFilesOverride)
|
|
|
4352
4274
|
assertBackgroundIndexingAllowed();
|
|
4353
4275
|
let fileSource = null;
|
|
4354
4276
|
if (isMainThread3) {
|
|
4355
|
-
const stat = await
|
|
4277
|
+
const stat = await fs13.promises.stat(absPath);
|
|
4356
4278
|
if (stat.isFile() && stat.size <= MAX_INDEX_FILE_BYTES) {
|
|
4357
4279
|
assertBackgroundIndexingAllowed();
|
|
4358
|
-
fileSource = await
|
|
4280
|
+
fileSource = await fs13.promises.readFile(absPath, "utf8");
|
|
4359
4281
|
}
|
|
4360
4282
|
} else {
|
|
4361
|
-
const stat =
|
|
4283
|
+
const stat = fs13.statSync(absPath);
|
|
4362
4284
|
if (stat.isFile() && stat.size <= MAX_INDEX_FILE_BYTES) {
|
|
4363
4285
|
assertBackgroundIndexingAllowed();
|
|
4364
|
-
fileSource =
|
|
4286
|
+
fileSource = fs13.readFileSync(absPath, "utf8");
|
|
4365
4287
|
}
|
|
4366
4288
|
}
|
|
4367
4289
|
source = fileSource;
|