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