@proxysoul/soulforge 2.18.6 → 2.20.0
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/index.js +2669 -1255
- package/dist/workers/intelligence.worker.js +636 -88
- package/dist/workers/io.worker.js +2 -1
- package/package.json +14 -12
|
@@ -18416,6 +18416,378 @@ var init_file_tree = __esm(() => {
|
|
|
18416
18416
|
IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", ".next", ".nuxt", "target", "__pycache__", ".cache", ".soulforge", "coverage"]);
|
|
18417
18417
|
});
|
|
18418
18418
|
|
|
18419
|
+
// node_modules/ignore/index.js
|
|
18420
|
+
var require_ignore = __commonJS((exports, module2) => {
|
|
18421
|
+
function makeArray(subject) {
|
|
18422
|
+
return Array.isArray(subject) ? subject : [subject];
|
|
18423
|
+
}
|
|
18424
|
+
var UNDEFINED = undefined;
|
|
18425
|
+
var EMPTY = "";
|
|
18426
|
+
var SPACE = " ";
|
|
18427
|
+
var ESCAPE = "\\";
|
|
18428
|
+
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
18429
|
+
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
18430
|
+
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
18431
|
+
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
18432
|
+
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
18433
|
+
var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
|
|
18434
|
+
var REGEX_TEST_TRAILING_SLASH = /\/$/;
|
|
18435
|
+
var SLASH = "/";
|
|
18436
|
+
var TMP_KEY_IGNORE = "node-ignore";
|
|
18437
|
+
if (typeof Symbol !== "undefined") {
|
|
18438
|
+
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
18439
|
+
}
|
|
18440
|
+
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
18441
|
+
var define = (object, key2, value) => {
|
|
18442
|
+
Object.defineProperty(object, key2, { value });
|
|
18443
|
+
return value;
|
|
18444
|
+
};
|
|
18445
|
+
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
18446
|
+
var RETURN_FALSE = () => false;
|
|
18447
|
+
var sanitizeRange = (range2) => range2.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
|
|
18448
|
+
var cleanRangeBackSlash = (slashes) => {
|
|
18449
|
+
const { length } = slashes;
|
|
18450
|
+
return slashes.slice(0, length - length % 2);
|
|
18451
|
+
};
|
|
18452
|
+
var REPLACERS = [
|
|
18453
|
+
[
|
|
18454
|
+
/^\uFEFF/,
|
|
18455
|
+
() => EMPTY
|
|
18456
|
+
],
|
|
18457
|
+
[
|
|
18458
|
+
/((?:\\\\)*?)(\\?\s+)$/,
|
|
18459
|
+
(_3, m1, m22) => m1 + (m22.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
18460
|
+
],
|
|
18461
|
+
[
|
|
18462
|
+
/(\\+?)\s/g,
|
|
18463
|
+
(_3, m1) => {
|
|
18464
|
+
const { length } = m1;
|
|
18465
|
+
return m1.slice(0, length - length % 2) + SPACE;
|
|
18466
|
+
}
|
|
18467
|
+
],
|
|
18468
|
+
[
|
|
18469
|
+
/[\\$.|*+(){^]/g,
|
|
18470
|
+
(match) => `\\${match}`
|
|
18471
|
+
],
|
|
18472
|
+
[
|
|
18473
|
+
/(?!\\)\?/g,
|
|
18474
|
+
() => "[^/]"
|
|
18475
|
+
],
|
|
18476
|
+
[
|
|
18477
|
+
/^\//,
|
|
18478
|
+
() => "^"
|
|
18479
|
+
],
|
|
18480
|
+
[
|
|
18481
|
+
/\//g,
|
|
18482
|
+
() => "\\/"
|
|
18483
|
+
],
|
|
18484
|
+
[
|
|
18485
|
+
/^\^*\\\*\\\*\\\//,
|
|
18486
|
+
() => "^(?:.*\\/)?"
|
|
18487
|
+
],
|
|
18488
|
+
[
|
|
18489
|
+
/^(?=[^^])/,
|
|
18490
|
+
function startingReplacer() {
|
|
18491
|
+
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
|
18492
|
+
}
|
|
18493
|
+
],
|
|
18494
|
+
[
|
|
18495
|
+
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
18496
|
+
(_3, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
|
18497
|
+
],
|
|
18498
|
+
[
|
|
18499
|
+
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
18500
|
+
(_3, p1, p2) => {
|
|
18501
|
+
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
|
18502
|
+
return p1 + unescaped;
|
|
18503
|
+
}
|
|
18504
|
+
],
|
|
18505
|
+
[
|
|
18506
|
+
/\\\\\\(?=[$.|*+(){^])/g,
|
|
18507
|
+
() => ESCAPE
|
|
18508
|
+
],
|
|
18509
|
+
[
|
|
18510
|
+
/\\\\/g,
|
|
18511
|
+
() => ESCAPE
|
|
18512
|
+
],
|
|
18513
|
+
[
|
|
18514
|
+
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
18515
|
+
(match, leadEscape, range2, endEscape, close) => leadEscape === ESCAPE ? `\\[${range2}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range2)}${endEscape}]` : "[]" : "[]"
|
|
18516
|
+
],
|
|
18517
|
+
[
|
|
18518
|
+
/(?:[^*])$/,
|
|
18519
|
+
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
|
18520
|
+
]
|
|
18521
|
+
];
|
|
18522
|
+
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
|
|
18523
|
+
var MODE_IGNORE = "regex";
|
|
18524
|
+
var MODE_CHECK_IGNORE = "checkRegex";
|
|
18525
|
+
var UNDERSCORE = "_";
|
|
18526
|
+
var TRAILING_WILD_CARD_REPLACERS = {
|
|
18527
|
+
[MODE_IGNORE](_3, p1) {
|
|
18528
|
+
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
18529
|
+
return `${prefix}(?=$|\\/$)`;
|
|
18530
|
+
},
|
|
18531
|
+
[MODE_CHECK_IGNORE](_3, p1) {
|
|
18532
|
+
const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
|
|
18533
|
+
return `${prefix}(?=$|\\/$)`;
|
|
18534
|
+
}
|
|
18535
|
+
};
|
|
18536
|
+
var makeRegexPrefix = (pattern) => REPLACERS.reduce((prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)), pattern);
|
|
18537
|
+
var isString = (subject) => typeof subject === "string";
|
|
18538
|
+
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
18539
|
+
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
18540
|
+
|
|
18541
|
+
class IgnoreRule {
|
|
18542
|
+
constructor(pattern, mark2, body4, ignoreCase, negative, prefix) {
|
|
18543
|
+
this.pattern = pattern;
|
|
18544
|
+
this.mark = mark2;
|
|
18545
|
+
this.negative = negative;
|
|
18546
|
+
define(this, "body", body4);
|
|
18547
|
+
define(this, "ignoreCase", ignoreCase);
|
|
18548
|
+
define(this, "regexPrefix", prefix);
|
|
18549
|
+
}
|
|
18550
|
+
get regex() {
|
|
18551
|
+
const key2 = UNDERSCORE + MODE_IGNORE;
|
|
18552
|
+
if (this[key2]) {
|
|
18553
|
+
return this[key2];
|
|
18554
|
+
}
|
|
18555
|
+
return this._make(MODE_IGNORE, key2);
|
|
18556
|
+
}
|
|
18557
|
+
get checkRegex() {
|
|
18558
|
+
const key2 = UNDERSCORE + MODE_CHECK_IGNORE;
|
|
18559
|
+
if (this[key2]) {
|
|
18560
|
+
return this[key2];
|
|
18561
|
+
}
|
|
18562
|
+
return this._make(MODE_CHECK_IGNORE, key2);
|
|
18563
|
+
}
|
|
18564
|
+
_make(mode, key2) {
|
|
18565
|
+
const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
|
|
18566
|
+
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
18567
|
+
return define(this, key2, regex);
|
|
18568
|
+
}
|
|
18569
|
+
}
|
|
18570
|
+
var createRule = ({
|
|
18571
|
+
pattern,
|
|
18572
|
+
mark: mark2
|
|
18573
|
+
}, ignoreCase) => {
|
|
18574
|
+
let negative = false;
|
|
18575
|
+
let body4 = pattern;
|
|
18576
|
+
if (body4.indexOf("!") === 0) {
|
|
18577
|
+
negative = true;
|
|
18578
|
+
body4 = body4.substr(1);
|
|
18579
|
+
}
|
|
18580
|
+
body4 = body4.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
18581
|
+
const regexPrefix = makeRegexPrefix(body4);
|
|
18582
|
+
return new IgnoreRule(pattern, mark2, body4, ignoreCase, negative, regexPrefix);
|
|
18583
|
+
};
|
|
18584
|
+
|
|
18585
|
+
class RuleManager {
|
|
18586
|
+
constructor(ignoreCase) {
|
|
18587
|
+
this._ignoreCase = ignoreCase;
|
|
18588
|
+
this._rules = [];
|
|
18589
|
+
}
|
|
18590
|
+
_add(pattern) {
|
|
18591
|
+
if (pattern && pattern[KEY_IGNORE]) {
|
|
18592
|
+
this._rules = this._rules.concat(pattern._rules._rules);
|
|
18593
|
+
this._added = true;
|
|
18594
|
+
return;
|
|
18595
|
+
}
|
|
18596
|
+
if (isString(pattern)) {
|
|
18597
|
+
pattern = {
|
|
18598
|
+
pattern
|
|
18599
|
+
};
|
|
18600
|
+
}
|
|
18601
|
+
if (checkPattern(pattern.pattern)) {
|
|
18602
|
+
const rule = createRule(pattern, this._ignoreCase);
|
|
18603
|
+
this._added = true;
|
|
18604
|
+
this._rules.push(rule);
|
|
18605
|
+
}
|
|
18606
|
+
}
|
|
18607
|
+
add(pattern) {
|
|
18608
|
+
this._added = false;
|
|
18609
|
+
makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._add, this);
|
|
18610
|
+
return this._added;
|
|
18611
|
+
}
|
|
18612
|
+
test(path, checkUnignored, mode) {
|
|
18613
|
+
let ignored = false;
|
|
18614
|
+
let unignored = false;
|
|
18615
|
+
let matchedRule;
|
|
18616
|
+
this._rules.forEach((rule) => {
|
|
18617
|
+
const { negative } = rule;
|
|
18618
|
+
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
18619
|
+
return;
|
|
18620
|
+
}
|
|
18621
|
+
const matched = rule[mode].test(path);
|
|
18622
|
+
if (!matched) {
|
|
18623
|
+
return;
|
|
18624
|
+
}
|
|
18625
|
+
ignored = !negative;
|
|
18626
|
+
unignored = negative;
|
|
18627
|
+
matchedRule = negative ? UNDEFINED : rule;
|
|
18628
|
+
});
|
|
18629
|
+
const ret = {
|
|
18630
|
+
ignored,
|
|
18631
|
+
unignored
|
|
18632
|
+
};
|
|
18633
|
+
if (matchedRule) {
|
|
18634
|
+
ret.rule = matchedRule;
|
|
18635
|
+
}
|
|
18636
|
+
return ret;
|
|
18637
|
+
}
|
|
18638
|
+
}
|
|
18639
|
+
var throwError = (message, Ctor) => {
|
|
18640
|
+
throw new Ctor(message);
|
|
18641
|
+
};
|
|
18642
|
+
var checkPath = (path, originalPath, doThrow) => {
|
|
18643
|
+
if (!isString(path)) {
|
|
18644
|
+
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
18645
|
+
}
|
|
18646
|
+
if (!path) {
|
|
18647
|
+
return doThrow(`path must not be empty`, TypeError);
|
|
18648
|
+
}
|
|
18649
|
+
if (checkPath.isNotRelative(path)) {
|
|
18650
|
+
const r4 = "`path.relative()`d";
|
|
18651
|
+
return doThrow(`path should be a ${r4} string, but got "${originalPath}"`, RangeError);
|
|
18652
|
+
}
|
|
18653
|
+
return true;
|
|
18654
|
+
};
|
|
18655
|
+
var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
|
|
18656
|
+
checkPath.isNotRelative = isNotRelative;
|
|
18657
|
+
checkPath.convert = (p2) => p2;
|
|
18658
|
+
|
|
18659
|
+
class Ignore {
|
|
18660
|
+
constructor({
|
|
18661
|
+
ignorecase = true,
|
|
18662
|
+
ignoreCase = ignorecase,
|
|
18663
|
+
allowRelativePaths = false
|
|
18664
|
+
} = {}) {
|
|
18665
|
+
define(this, KEY_IGNORE, true);
|
|
18666
|
+
this._rules = new RuleManager(ignoreCase);
|
|
18667
|
+
this._strictPathCheck = !allowRelativePaths;
|
|
18668
|
+
this._initCache();
|
|
18669
|
+
}
|
|
18670
|
+
_initCache() {
|
|
18671
|
+
this._ignoreCache = Object.create(null);
|
|
18672
|
+
this._testCache = Object.create(null);
|
|
18673
|
+
}
|
|
18674
|
+
add(pattern) {
|
|
18675
|
+
if (this._rules.add(pattern)) {
|
|
18676
|
+
this._initCache();
|
|
18677
|
+
}
|
|
18678
|
+
return this;
|
|
18679
|
+
}
|
|
18680
|
+
addPattern(pattern) {
|
|
18681
|
+
return this.add(pattern);
|
|
18682
|
+
}
|
|
18683
|
+
_test(originalPath, cache, checkUnignored, slices) {
|
|
18684
|
+
const path = originalPath && checkPath.convert(originalPath);
|
|
18685
|
+
checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
|
|
18686
|
+
return this._t(path, cache, checkUnignored, slices);
|
|
18687
|
+
}
|
|
18688
|
+
checkIgnore(path) {
|
|
18689
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
|
|
18690
|
+
return this.test(path);
|
|
18691
|
+
}
|
|
18692
|
+
const slices = path.split(SLASH).filter(Boolean);
|
|
18693
|
+
slices.pop();
|
|
18694
|
+
if (slices.length) {
|
|
18695
|
+
const parent = this._t(slices.join(SLASH) + SLASH, this._testCache, true, slices);
|
|
18696
|
+
if (parent.ignored) {
|
|
18697
|
+
return parent;
|
|
18698
|
+
}
|
|
18699
|
+
}
|
|
18700
|
+
return this._rules.test(path, false, MODE_CHECK_IGNORE);
|
|
18701
|
+
}
|
|
18702
|
+
_t(path, cache, checkUnignored, slices) {
|
|
18703
|
+
if (path in cache) {
|
|
18704
|
+
return cache[path];
|
|
18705
|
+
}
|
|
18706
|
+
if (!slices) {
|
|
18707
|
+
slices = path.split(SLASH).filter(Boolean);
|
|
18708
|
+
}
|
|
18709
|
+
slices.pop();
|
|
18710
|
+
if (!slices.length) {
|
|
18711
|
+
return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
18712
|
+
}
|
|
18713
|
+
const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
18714
|
+
return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
18715
|
+
}
|
|
18716
|
+
ignores(path) {
|
|
18717
|
+
return this._test(path, this._ignoreCache, false).ignored;
|
|
18718
|
+
}
|
|
18719
|
+
createFilter() {
|
|
18720
|
+
return (path) => !this.ignores(path);
|
|
18721
|
+
}
|
|
18722
|
+
filter(paths) {
|
|
18723
|
+
return makeArray(paths).filter(this.createFilter());
|
|
18724
|
+
}
|
|
18725
|
+
test(path) {
|
|
18726
|
+
return this._test(path, this._testCache, true);
|
|
18727
|
+
}
|
|
18728
|
+
}
|
|
18729
|
+
var factory = (options) => new Ignore(options);
|
|
18730
|
+
var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
|
18731
|
+
var setupWindows = () => {
|
|
18732
|
+
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
18733
|
+
checkPath.convert = makePosix;
|
|
18734
|
+
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
18735
|
+
checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
|
18736
|
+
};
|
|
18737
|
+
if (typeof process !== "undefined" && process.platform === "win32") {
|
|
18738
|
+
setupWindows();
|
|
18739
|
+
}
|
|
18740
|
+
module2.exports = factory;
|
|
18741
|
+
factory.default = factory;
|
|
18742
|
+
module2.exports.isPathValid = isPathValid;
|
|
18743
|
+
define(module2.exports, Symbol.for("setupWindows"), setupWindows);
|
|
18744
|
+
});
|
|
18745
|
+
|
|
18746
|
+
// src/core/intelligence/ignore.ts
|
|
18747
|
+
function parseIgnore(text2) {
|
|
18748
|
+
const out2 = [];
|
|
18749
|
+
for (const line of text2.split(`
|
|
18750
|
+
`)) {
|
|
18751
|
+
const s2 = line.trim();
|
|
18752
|
+
if (s2 === "" || s2.startsWith("#"))
|
|
18753
|
+
continue;
|
|
18754
|
+
out2.push(s2);
|
|
18755
|
+
}
|
|
18756
|
+
return out2;
|
|
18757
|
+
}
|
|
18758
|
+
|
|
18759
|
+
class IgnoreMatcher {
|
|
18760
|
+
ig = import_ignore.default();
|
|
18761
|
+
size;
|
|
18762
|
+
constructor(patterns) {
|
|
18763
|
+
if (patterns.length > 0)
|
|
18764
|
+
this.ig.add(patterns);
|
|
18765
|
+
this.size = patterns.length;
|
|
18766
|
+
}
|
|
18767
|
+
ignores(relPath, isDir) {
|
|
18768
|
+
if (this.size === 0)
|
|
18769
|
+
return false;
|
|
18770
|
+
let p2 = relPath.replace(/\\/g, "/");
|
|
18771
|
+
if (p2.startsWith("/"))
|
|
18772
|
+
p2 = p2.slice(1);
|
|
18773
|
+
if (p2 === "" || p2 === ".")
|
|
18774
|
+
return false;
|
|
18775
|
+
return this.ig.ignores(isDir ? `${p2}/` : p2);
|
|
18776
|
+
}
|
|
18777
|
+
}
|
|
18778
|
+
function buildIgnoreMatcher(...texts) {
|
|
18779
|
+
const patterns = [];
|
|
18780
|
+
for (const t of texts) {
|
|
18781
|
+
if (t)
|
|
18782
|
+
patterns.push(...parseIgnore(t));
|
|
18783
|
+
}
|
|
18784
|
+
return new IgnoreMatcher(patterns);
|
|
18785
|
+
}
|
|
18786
|
+
var import_ignore;
|
|
18787
|
+
var init_ignore = __esm(() => {
|
|
18788
|
+
import_ignore = __toESM(require_ignore(), 1);
|
|
18789
|
+
});
|
|
18790
|
+
|
|
18419
18791
|
// src/core/intelligence/types.ts
|
|
18420
18792
|
function detectLanguageFromPath(file) {
|
|
18421
18793
|
const slash = file.lastIndexOf("/");
|
|
@@ -18562,9 +18934,9 @@ var init_types2 = __esm(() => {
|
|
|
18562
18934
|
});
|
|
18563
18935
|
|
|
18564
18936
|
// src/core/intelligence/repo-map-utils.ts
|
|
18565
|
-
import { readdir, stat } from "fs/promises";
|
|
18937
|
+
import { readdir, readFile, stat } from "fs/promises";
|
|
18566
18938
|
import { homedir as homedir3 } from "os";
|
|
18567
|
-
import { join as join5, resolve as resolve2 } from "path";
|
|
18939
|
+
import { join as join5, relative, resolve as resolve2 } from "path";
|
|
18568
18940
|
function isIndexablePath(file) {
|
|
18569
18941
|
return detectLanguageFromPath(file) !== "unknown" || isBareIndexable(file);
|
|
18570
18942
|
}
|
|
@@ -18759,9 +19131,10 @@ async function collectFiles(dir, depth = 0) {
|
|
|
18759
19131
|
warning: "Opened in home directory or system root \u2014 no files indexed. Open a project directory instead."
|
|
18760
19132
|
};
|
|
18761
19133
|
}
|
|
19134
|
+
const ignore = buildIgnoreMatcher(await readIgnoreFile(join5(dir, ".gitignore")), await readIgnoreFile(join5(dir, ".soulforgeignore")));
|
|
18762
19135
|
const collected = [];
|
|
18763
19136
|
let hitCap = false;
|
|
18764
|
-
const walkDone = collectFilesWalk(dir, depth, undefined, collected).then(() => {
|
|
19137
|
+
const walkDone = collectFilesWalk(dir, depth, undefined, collected, dir, ignore).then(() => {
|
|
18765
19138
|
hitCap = collected.length >= WALK_FILE_CAP;
|
|
18766
19139
|
});
|
|
18767
19140
|
const timedOut = await Promise.race([walkDone.then(() => false), new Promise((r4) => setTimeout(() => r4(true), 60000))]);
|
|
@@ -18802,7 +19175,8 @@ async function collectFilesViaGit(dir) {
|
|
|
18802
19175
|
if (s2.size < MAX_FILE_SIZE)
|
|
18803
19176
|
files.push({
|
|
18804
19177
|
path: fullPath,
|
|
18805
|
-
mtimeMs: s2.mtimeMs
|
|
19178
|
+
mtimeMs: s2.mtimeMs,
|
|
19179
|
+
size: s2.size
|
|
18806
19180
|
});
|
|
18807
19181
|
} catch {}
|
|
18808
19182
|
if (files.length % 50 === 0)
|
|
@@ -18813,7 +19187,14 @@ async function collectFilesViaGit(dir) {
|
|
|
18813
19187
|
return null;
|
|
18814
19188
|
}
|
|
18815
19189
|
}
|
|
18816
|
-
async function
|
|
19190
|
+
async function readIgnoreFile(path) {
|
|
19191
|
+
try {
|
|
19192
|
+
return await readFile(path, "utf-8");
|
|
19193
|
+
} catch {
|
|
19194
|
+
return null;
|
|
19195
|
+
}
|
|
19196
|
+
}
|
|
19197
|
+
async function collectFilesWalk(dir, depth, counter, out2, rootDir, ignore) {
|
|
18817
19198
|
if (depth > MAX_DEPTH)
|
|
18818
19199
|
return [];
|
|
18819
19200
|
const ctx = counter ?? {
|
|
@@ -18831,20 +19212,24 @@ async function collectFilesWalk(dir, depth, counter, out2) {
|
|
|
18831
19212
|
continue;
|
|
18832
19213
|
}
|
|
18833
19214
|
const fullPath = join5(dir, entry.name);
|
|
19215
|
+
const rel = relative(rootDir, fullPath);
|
|
18834
19216
|
if (entry.isDirectory()) {
|
|
18835
|
-
if (!IGNORED_DIRS.has(entry.name)) {
|
|
18836
|
-
await collectFilesWalk(fullPath, depth + 1, ctx, files);
|
|
19217
|
+
if (!IGNORED_DIRS.has(entry.name) && !ignore.ignores(rel, true)) {
|
|
19218
|
+
await collectFilesWalk(fullPath, depth + 1, ctx, files, rootDir, ignore);
|
|
18837
19219
|
}
|
|
18838
19220
|
} else if (entry.isFile()) {
|
|
18839
19221
|
if (isForbidden(fullPath))
|
|
18840
19222
|
continue;
|
|
19223
|
+
if (ignore.ignores(rel, false))
|
|
19224
|
+
continue;
|
|
18841
19225
|
if (isIndexablePath(entry.name)) {
|
|
18842
19226
|
try {
|
|
18843
19227
|
const s2 = await stat(fullPath);
|
|
18844
19228
|
if (s2.size < MAX_FILE_SIZE) {
|
|
18845
19229
|
files.push({
|
|
18846
19230
|
path: fullPath,
|
|
18847
|
-
mtimeMs: s2.mtimeMs
|
|
19231
|
+
mtimeMs: s2.mtimeMs,
|
|
19232
|
+
size: s2.size
|
|
18848
19233
|
});
|
|
18849
19234
|
ctx.n++;
|
|
18850
19235
|
}
|
|
@@ -18861,6 +19246,7 @@ var INDEXABLE_EXTENSIONS, NON_CODE_LANGUAGES, IMPORT_TRACKABLE_LANGUAGES, BARREL
|
|
|
18861
19246
|
var init_repo_map_utils = __esm(() => {
|
|
18862
19247
|
init_file_tree();
|
|
18863
19248
|
init_forbidden();
|
|
19249
|
+
init_ignore();
|
|
18864
19250
|
init_types2();
|
|
18865
19251
|
INDEXABLE_EXTENSIONS = EXT_TO_LANGUAGE;
|
|
18866
19252
|
NON_CODE_LANGUAGES = new Set(["unknown", "css", "html", "json", "jsonnet", "toml", "yaml", "xml", "markdown", "mdx", "sql", "graphql", "proto", "properties", "ini", "env", "dockerfile", "makefile", "nix", "hcl", "bazel", "just", "svg", "csv", "ignore", "lockfile"]);
|
|
@@ -18881,6 +19267,64 @@ var init_repo_map_utils = __esm(() => {
|
|
|
18881
19267
|
WINDOWS_DRIVE_ROOT_RE = /^[A-Za-z]:\\?$/;
|
|
18882
19268
|
});
|
|
18883
19269
|
|
|
19270
|
+
// src/core/intelligence/trigram.ts
|
|
19271
|
+
function pack(a2, b3, c) {
|
|
19272
|
+
return a2 << 16 | b3 << 8 | c;
|
|
19273
|
+
}
|
|
19274
|
+
function lower(byte) {
|
|
19275
|
+
return byte >= 65 && byte <= 90 ? byte + 32 : byte;
|
|
19276
|
+
}
|
|
19277
|
+
function extractContentTrigrams(content) {
|
|
19278
|
+
const out2 = new Set;
|
|
19279
|
+
const len = content.length;
|
|
19280
|
+
if (len < MIN_TRIGRAM_LEN)
|
|
19281
|
+
return out2;
|
|
19282
|
+
for (let i4 = 0;i4 + 2 < len; i4++) {
|
|
19283
|
+
const a2 = lower(content.charCodeAt(i4));
|
|
19284
|
+
const b3 = lower(content.charCodeAt(i4 + 1));
|
|
19285
|
+
const c = lower(content.charCodeAt(i4 + 2));
|
|
19286
|
+
if (isWs(a2) && isWs(b3) && isWs(c))
|
|
19287
|
+
continue;
|
|
19288
|
+
if (a2 > 255 || b3 > 255 || c > 255)
|
|
19289
|
+
continue;
|
|
19290
|
+
out2.add(pack(a2, b3, c));
|
|
19291
|
+
}
|
|
19292
|
+
return out2;
|
|
19293
|
+
}
|
|
19294
|
+
function isWs(byte) {
|
|
19295
|
+
return byte === 32 || byte === 9 || byte === 10 || byte === 13;
|
|
19296
|
+
}
|
|
19297
|
+
function extractPatternTrigrams(pattern) {
|
|
19298
|
+
const literal = longestLiteralRun(pattern);
|
|
19299
|
+
if (literal.length < MIN_TRIGRAM_LEN)
|
|
19300
|
+
return null;
|
|
19301
|
+
const set = extractContentTrigrams(literal);
|
|
19302
|
+
if (set.size === 0)
|
|
19303
|
+
return null;
|
|
19304
|
+
return [...set];
|
|
19305
|
+
}
|
|
19306
|
+
function longestLiteralRun(pattern) {
|
|
19307
|
+
let best = "";
|
|
19308
|
+
let cur = "";
|
|
19309
|
+
for (const ch of pattern) {
|
|
19310
|
+
if (META.has(ch) || ch === " " || ch === "\t" || ch === `
|
|
19311
|
+
`) {
|
|
19312
|
+
if (cur.length > best.length)
|
|
19313
|
+
best = cur;
|
|
19314
|
+
cur = "";
|
|
19315
|
+
} else {
|
|
19316
|
+
cur += ch;
|
|
19317
|
+
}
|
|
19318
|
+
}
|
|
19319
|
+
if (cur.length > best.length)
|
|
19320
|
+
best = cur;
|
|
19321
|
+
return best;
|
|
19322
|
+
}
|
|
19323
|
+
var MAX_POSTINGS_PER_TRIGRAM = 512, MIN_TRIGRAM_LEN = 3, META;
|
|
19324
|
+
var init_trigram = __esm(() => {
|
|
19325
|
+
META = new Set([".", "*", "+", "?", "(", ")", "[", "]", "{", "}", "|", "^", "$", "\\"]);
|
|
19326
|
+
});
|
|
19327
|
+
|
|
18884
19328
|
// node_modules/web-tree-sitter/tree-sitter.js
|
|
18885
19329
|
var exports_tree_sitter = {};
|
|
18886
19330
|
__export(exports_tree_sitter, {
|
|
@@ -22105,7 +22549,7 @@ __export(exports_tree_sitter2, {
|
|
|
22105
22549
|
TreeSitterBackend: () => TreeSitterBackend
|
|
22106
22550
|
});
|
|
22107
22551
|
import { existsSync as existsSync4 } from "fs";
|
|
22108
|
-
import { readFile } from "fs/promises";
|
|
22552
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
22109
22553
|
import { dirname, join as join6, resolve as resolve3 } from "path";
|
|
22110
22554
|
function extractImportSpecifiers(node, language) {
|
|
22111
22555
|
const specifiers = [];
|
|
@@ -23194,7 +23638,7 @@ var init_tree_sitter2 = __esm(() => {
|
|
|
23194
23638
|
const lines = node.endPosition.row - node.startPosition.row + 1;
|
|
23195
23639
|
if (lines >= TreeSitterBackend.MIN_HASH_LINES) {
|
|
23196
23640
|
const hasArrow = node.namedChildren.some((c) => {
|
|
23197
|
-
if (
|
|
23641
|
+
if (c?.type !== "variable_declarator")
|
|
23198
23642
|
return false;
|
|
23199
23643
|
return c.namedChildren.some((gc) => gc != null && (gc.type === "arrow_function" || gc.type === "function_expression"));
|
|
23200
23644
|
});
|
|
@@ -23377,7 +23821,7 @@ var init_tree_sitter2 = __esm(() => {
|
|
|
23377
23821
|
return this.cache.get(absPath);
|
|
23378
23822
|
}
|
|
23379
23823
|
try {
|
|
23380
|
-
return await
|
|
23824
|
+
return await readFile2(absPath, "utf-8");
|
|
23381
23825
|
} catch {
|
|
23382
23826
|
return null;
|
|
23383
23827
|
}
|
|
@@ -24003,7 +24447,7 @@ __export(exports_repo_map, {
|
|
|
24003
24447
|
import { Database } from "bun:sqlite";
|
|
24004
24448
|
import { chmodSync, existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync } from "fs";
|
|
24005
24449
|
import { stat as statAsync } from "fs/promises";
|
|
24006
|
-
import { dirname as dirname2, extname, join as join7, relative, resolve as resolve4 } from "path";
|
|
24450
|
+
import { dirname as dirname2, extname, join as join7, relative as relative2, resolve as resolve4 } from "path";
|
|
24007
24451
|
|
|
24008
24452
|
class RepoMap {
|
|
24009
24453
|
static testFileMatch(alias = "f") {
|
|
@@ -24194,6 +24638,21 @@ class RepoMap {
|
|
|
24194
24638
|
CREATE INDEX IF NOT EXISTS idx_calls_callee ON calls(callee_symbol_id);
|
|
24195
24639
|
CREATE INDEX IF NOT EXISTS idx_calls_callee_file ON calls(callee_file_id);
|
|
24196
24640
|
`);
|
|
24641
|
+
this.db.run(`
|
|
24642
|
+
CREATE TABLE IF NOT EXISTS trigrams (
|
|
24643
|
+
trigram INTEGER NOT NULL,
|
|
24644
|
+
file_id INTEGER NOT NULL REFERENCES files(id) ON DELETE CASCADE,
|
|
24645
|
+
PRIMARY KEY (trigram, file_id)
|
|
24646
|
+
) WITHOUT ROWID;
|
|
24647
|
+
`);
|
|
24648
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_trigrams_file ON trigrams(file_id)");
|
|
24649
|
+
try {
|
|
24650
|
+
this.db.run("ALTER TABLE files ADD COLUMN size_bytes INTEGER NOT NULL DEFAULT 0");
|
|
24651
|
+
} catch {}
|
|
24652
|
+
try {
|
|
24653
|
+
this.db.run("ALTER TABLE symbols ADD COLUMN moniker TEXT");
|
|
24654
|
+
} catch {}
|
|
24655
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_symbols_moniker ON symbols(moniker)");
|
|
24197
24656
|
this.migrateSemanticSource();
|
|
24198
24657
|
this.migrateSemanticNoCascade();
|
|
24199
24658
|
this.backfillSummaryPaths();
|
|
@@ -24323,26 +24782,28 @@ class RepoMap {
|
|
|
24323
24782
|
files = allFiles;
|
|
24324
24783
|
}
|
|
24325
24784
|
const existingFiles = new Map;
|
|
24326
|
-
for (const row of this.db.query("SELECT id, path, mtime_ms FROM files").all()) {
|
|
24785
|
+
for (const row of this.db.query("SELECT id, path, mtime_ms, size_bytes FROM files").all()) {
|
|
24327
24786
|
existingFiles.set(row.path, {
|
|
24328
24787
|
id: row.id,
|
|
24329
|
-
mtime_ms: row.mtime_ms
|
|
24788
|
+
mtime_ms: row.mtime_ms,
|
|
24789
|
+
size_bytes: row.size_bytes
|
|
24330
24790
|
});
|
|
24331
24791
|
}
|
|
24332
24792
|
const currentPaths = new Set;
|
|
24333
24793
|
const toIndex = [];
|
|
24334
24794
|
for (const file of files) {
|
|
24335
|
-
const relPath =
|
|
24795
|
+
const relPath = relative2(this.cwd, file.path);
|
|
24336
24796
|
currentPaths.add(relPath);
|
|
24337
24797
|
const existing = existingFiles.get(relPath);
|
|
24338
|
-
if (existing && existing.mtime_ms === file.mtimeMs)
|
|
24798
|
+
if (existing && existing.mtime_ms === file.mtimeMs && existing.size_bytes === file.size)
|
|
24339
24799
|
continue;
|
|
24340
24800
|
const language = detectLanguageFromPath(file.path);
|
|
24341
24801
|
toIndex.push({
|
|
24342
24802
|
absPath: file.path,
|
|
24343
24803
|
relPath,
|
|
24344
24804
|
mtime: file.mtimeMs,
|
|
24345
|
-
language
|
|
24805
|
+
language,
|
|
24806
|
+
size: file.size
|
|
24346
24807
|
});
|
|
24347
24808
|
}
|
|
24348
24809
|
const stale = [...existingFiles.keys()].filter((p2) => !currentPaths.has(p2));
|
|
@@ -24364,7 +24825,7 @@ class RepoMap {
|
|
|
24364
24825
|
const file = toIndex[i4];
|
|
24365
24826
|
if (file) {
|
|
24366
24827
|
try {
|
|
24367
|
-
await this.indexFile(file.absPath, file.relPath, file.mtime, file.language);
|
|
24828
|
+
await this.indexFile(file.absPath, file.relPath, file.mtime, file.language, file.size);
|
|
24368
24829
|
} catch (err2) {
|
|
24369
24830
|
this.indexErrors++;
|
|
24370
24831
|
if (this.indexErrors <= 5) {
|
|
@@ -24442,17 +24903,16 @@ class RepoMap {
|
|
|
24442
24903
|
}
|
|
24443
24904
|
} catch {}
|
|
24444
24905
|
}
|
|
24445
|
-
const
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
const
|
|
24451
|
-
const bGit = b3.gitRank !== undefined;
|
|
24906
|
+
const rankFor = (f2) => gitRecency.get(relative2(this.cwd, f2.path));
|
|
24907
|
+
const sorted = [...files].sort((a2, b3) => {
|
|
24908
|
+
const ra = rankFor(a2);
|
|
24909
|
+
const rb = rankFor(b3);
|
|
24910
|
+
const aGit = ra !== undefined;
|
|
24911
|
+
const bGit = rb !== undefined;
|
|
24452
24912
|
if (aGit !== bGit)
|
|
24453
24913
|
return aGit ? -1 : 1;
|
|
24454
24914
|
if (aGit && bGit)
|
|
24455
|
-
return
|
|
24915
|
+
return ra - rb;
|
|
24456
24916
|
return b3.mtimeMs - a2.mtimeMs;
|
|
24457
24917
|
});
|
|
24458
24918
|
return sorted.slice(0, this.maxFiles);
|
|
@@ -24471,7 +24931,7 @@ class RepoMap {
|
|
|
24471
24931
|
this.onError?.(`Tree-sitter init failed: ${err2 instanceof Error ? err2.message : String(err2)} \u2014 indexing without AST symbols`);
|
|
24472
24932
|
}
|
|
24473
24933
|
}
|
|
24474
|
-
async indexFile(absPath, relPath, mtime, language) {
|
|
24934
|
+
async indexFile(absPath, relPath, mtime, language, size = 0) {
|
|
24475
24935
|
const existing = this.db.query("SELECT id FROM files WHERE path = ?").get(relPath);
|
|
24476
24936
|
if (existing) {
|
|
24477
24937
|
this.db.transaction(() => {
|
|
@@ -24483,6 +24943,7 @@ class RepoMap {
|
|
|
24483
24943
|
this.db.query("DELETE FROM shape_hashes WHERE file_id = ?").run(existing.id);
|
|
24484
24944
|
this.db.query("DELETE FROM token_signatures WHERE file_id = ?").run(existing.id);
|
|
24485
24945
|
this.db.query("DELETE FROM token_fragments WHERE file_id = ?").run(existing.id);
|
|
24946
|
+
this.db.query("DELETE FROM trigrams WHERE file_id = ?").run(existing.id);
|
|
24486
24947
|
this.db.query("DELETE FROM edges WHERE source_file_id = ? OR target_file_id = ?").run(existing.id, existing.id);
|
|
24487
24948
|
})();
|
|
24488
24949
|
}
|
|
@@ -24510,9 +24971,9 @@ class RepoMap {
|
|
|
24510
24971
|
}
|
|
24511
24972
|
const symbolCount = outline?.symbols.length ?? 0;
|
|
24512
24973
|
if (existing) {
|
|
24513
|
-
this.db.query("UPDATE files SET mtime_ms = ?, language = ?, line_count = ?, symbol_count = ? WHERE id = ?").run(mtime, language, lineCount, symbolCount, existing.id);
|
|
24974
|
+
this.db.query("UPDATE files SET mtime_ms = ?, language = ?, line_count = ?, symbol_count = ?, size_bytes = ? WHERE id = ?").run(mtime, language, lineCount, symbolCount, size, existing.id);
|
|
24514
24975
|
} else {
|
|
24515
|
-
this.db.query("INSERT INTO files (path, mtime_ms, language, line_count, symbol_count) VALUES (?, ?, ?, ?, ?)").run(relPath, mtime, language, lineCount, symbolCount);
|
|
24976
|
+
this.db.query("INSERT INTO files (path, mtime_ms, language, line_count, symbol_count, size_bytes) VALUES (?, ?, ?, ?, ?, ?)").run(relPath, mtime, language, lineCount, symbolCount, size);
|
|
24516
24977
|
}
|
|
24517
24978
|
const fileId = existing?.id ?? this.db.query("SELECT id FROM files WHERE path = ?").get(relPath)?.id;
|
|
24518
24979
|
if (outline) {
|
|
@@ -24566,6 +25027,18 @@ class RepoMap {
|
|
|
24566
25027
|
});
|
|
24567
25028
|
qTx();
|
|
24568
25029
|
}
|
|
25030
|
+
{
|
|
25031
|
+
const mod = relPath.replace(/\.[^./]+$/, "");
|
|
25032
|
+
const rows = this.db.query("SELECT id, name, kind, qualified_name FROM symbols WHERE file_id = ?").all(fileId);
|
|
25033
|
+
const updateMoniker = this.db.prepare("UPDATE symbols SET moniker = ? WHERE id = ?");
|
|
25034
|
+
const mTx = this.db.transaction(() => {
|
|
25035
|
+
for (const r4 of rows) {
|
|
25036
|
+
const descriptor = r4.qualified_name ?? r4.name;
|
|
25037
|
+
updateMoniker.run(`${mod}#${descriptor}(${r4.kind})`, r4.id);
|
|
25038
|
+
}
|
|
25039
|
+
});
|
|
25040
|
+
mTx();
|
|
25041
|
+
}
|
|
24569
25042
|
}
|
|
24570
25043
|
{
|
|
24571
25044
|
const BARREL_RE2 = /\/(index\.(ts|js|tsx|mts|mjs)|__init__\.py|mod\.rs|lib\.rs)$/;
|
|
@@ -24659,6 +25132,9 @@ class RepoMap {
|
|
|
24659
25132
|
tx();
|
|
24660
25133
|
}
|
|
24661
25134
|
}
|
|
25135
|
+
if (content.length <= TRIGRAM_MAX_FILE_BYTES) {
|
|
25136
|
+
this.indexTrigrams(fileId, content);
|
|
25137
|
+
}
|
|
24662
25138
|
if (!NON_CODE_LANGUAGES.has(language)) {
|
|
24663
25139
|
const identifiers = this.extractIdentifiers(content, language);
|
|
24664
25140
|
for (const id of identifiers) {
|
|
@@ -24823,7 +25299,7 @@ class RepoMap {
|
|
|
24823
25299
|
}
|
|
24824
25300
|
if (normalized) {
|
|
24825
25301
|
const base = resolve4(importerDir, normalized);
|
|
24826
|
-
const relBase =
|
|
25302
|
+
const relBase = relative2(this.cwd, base);
|
|
24827
25303
|
if (relBase.startsWith(".."))
|
|
24828
25304
|
return null;
|
|
24829
25305
|
return this.resolveRelPath(relBase);
|
|
@@ -24871,7 +25347,7 @@ class RepoMap {
|
|
|
24871
25347
|
candidates.push(`${base}.go`);
|
|
24872
25348
|
}
|
|
24873
25349
|
for (const candidate of candidates) {
|
|
24874
|
-
const relPath =
|
|
25350
|
+
const relPath = relative2(this.cwd, candidate);
|
|
24875
25351
|
if (relPath.startsWith(".."))
|
|
24876
25352
|
continue;
|
|
24877
25353
|
const row = this.db.query("SELECT id FROM files WHERE path = ?").get(relPath);
|
|
@@ -26034,7 +26510,7 @@ class RepoMap {
|
|
|
26034
26510
|
return result;
|
|
26035
26511
|
}
|
|
26036
26512
|
onFileChanged(absPath) {
|
|
26037
|
-
const relPath =
|
|
26513
|
+
const relPath = relative2(this.cwd, absPath);
|
|
26038
26514
|
if (relPath === "package.json" || relPath === "Cargo.toml" || relPath === "go.mod") {
|
|
26039
26515
|
this.entryPointsCache = null;
|
|
26040
26516
|
}
|
|
@@ -26064,7 +26540,7 @@ class RepoMap {
|
|
|
26064
26540
|
}] of batch) {
|
|
26065
26541
|
try {
|
|
26066
26542
|
const st = await statAsync(absPath);
|
|
26067
|
-
this.indexFile(absPath, relPath, st.mtimeMs, language);
|
|
26543
|
+
this.indexFile(absPath, relPath, st.mtimeMs, language, st.size);
|
|
26068
26544
|
} catch (e) {
|
|
26069
26545
|
this.onError?.(`reindex failed for ${relPath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
26070
26546
|
}
|
|
@@ -26086,12 +26562,12 @@ class RepoMap {
|
|
|
26086
26562
|
recheckModifiedFiles() {
|
|
26087
26563
|
if (!this.ready)
|
|
26088
26564
|
return;
|
|
26089
|
-
const files = this.db.query("SELECT path, mtime_ms FROM files").all();
|
|
26565
|
+
const files = this.db.query("SELECT path, mtime_ms, size_bytes FROM files").all();
|
|
26090
26566
|
for (const f2 of files) {
|
|
26091
26567
|
const absPath = join7(this.cwd, f2.path);
|
|
26092
26568
|
try {
|
|
26093
26569
|
const st = statSync(absPath);
|
|
26094
|
-
if (st.mtimeMs !== f2.mtime_ms) {
|
|
26570
|
+
if (st.mtimeMs !== f2.mtime_ms || st.size !== f2.size_bytes) {
|
|
26095
26571
|
this.onFileChanged(absPath);
|
|
26096
26572
|
}
|
|
26097
26573
|
} catch {}
|
|
@@ -26481,9 +26957,9 @@ class RepoMap {
|
|
|
26481
26957
|
}
|
|
26482
26958
|
buildPersonalization(opts) {
|
|
26483
26959
|
const pv = new Map;
|
|
26484
|
-
const mentionedSet = new Set((opts.mentionedFiles ?? []).map((f2) =>
|
|
26485
|
-
const editedSet = new Set((opts.editedFiles ?? []).map((f2) =>
|
|
26486
|
-
const editorRel = opts.editorFile ?
|
|
26960
|
+
const mentionedSet = new Set((opts.mentionedFiles ?? []).map((f2) => relative2(this.cwd, f2)));
|
|
26961
|
+
const editedSet = new Set((opts.editedFiles ?? []).map((f2) => relative2(this.cwd, f2)));
|
|
26962
|
+
const editorRel = opts.editorFile ? relative2(this.cwd, opts.editorFile) : null;
|
|
26487
26963
|
const entryPoints = new Set(this.getEntryPoints());
|
|
26488
26964
|
if (mentionedSet.size === 0 && editedSet.size === 0 && !editorRel && entryPoints.size === 0)
|
|
26489
26965
|
return pv;
|
|
@@ -26527,9 +27003,9 @@ class RepoMap {
|
|
|
26527
27003
|
}
|
|
26528
27004
|
rankFiles(opts) {
|
|
26529
27005
|
const allFiles = this.db.query("SELECT id, path, mtime_ms, language, line_count, symbol_count, pagerank, is_barrel FROM files ORDER BY pagerank DESC").all();
|
|
26530
|
-
const mentionedSet = new Set((opts.mentionedFiles ?? []).map((f2) =>
|
|
26531
|
-
const editedSet = new Set((opts.editedFiles ?? []).map((f2) =>
|
|
26532
|
-
const editorRel = opts.editorFile ?
|
|
27006
|
+
const mentionedSet = new Set((opts.mentionedFiles ?? []).map((f2) => relative2(this.cwd, f2)));
|
|
27007
|
+
const editedSet = new Set((opts.editedFiles ?? []).map((f2) => relative2(this.cwd, f2)));
|
|
27008
|
+
const editorRel = opts.editorFile ? relative2(this.cwd, opts.editorFile) : null;
|
|
26533
27009
|
const neighborFiles = new Set;
|
|
26534
27010
|
const boostFileIds = new Set;
|
|
26535
27011
|
for (const f2 of allFiles) {
|
|
@@ -26666,7 +27142,7 @@ class RepoMap {
|
|
|
26666
27142
|
};
|
|
26667
27143
|
}
|
|
26668
27144
|
getFileSymbolRanges(relPath) {
|
|
26669
|
-
return this.db.query(`SELECT s.name, s.qualified_name, s.kind, s.line, s.end_line
|
|
27145
|
+
return this.db.query(`SELECT s.name, s.qualified_name, s.kind, s.line, s.end_line, s.moniker
|
|
26670
27146
|
FROM symbols s JOIN files f ON f.id = s.file_id
|
|
26671
27147
|
WHERE f.path = ?
|
|
26672
27148
|
AND s.kind IN ('interface','type','class','function','enum','method','constant')
|
|
@@ -26677,7 +27153,8 @@ class RepoMap {
|
|
|
26677
27153
|
qualifiedName: r4.qualified_name,
|
|
26678
27154
|
kind: r4.kind,
|
|
26679
27155
|
line: r4.line,
|
|
26680
|
-
endLine: r4.end_line
|
|
27156
|
+
endLine: r4.end_line,
|
|
27157
|
+
moniker: r4.moniker
|
|
26681
27158
|
}));
|
|
26682
27159
|
}
|
|
26683
27160
|
findSymbol(name2) {
|
|
@@ -27645,17 +28122,75 @@ class RepoMap {
|
|
|
27645
28122
|
return null;
|
|
27646
28123
|
}
|
|
27647
28124
|
}
|
|
28125
|
+
getEnclosingSymbols(relPath) {
|
|
28126
|
+
return this.db.query(`SELECT s.name, s.kind, s.line, s.end_line
|
|
28127
|
+
FROM symbols s JOIN files f ON f.id = s.file_id
|
|
28128
|
+
WHERE f.path = ? AND s.end_line >= s.line
|
|
28129
|
+
ORDER BY s.line
|
|
28130
|
+
LIMIT 2000`).all(relPath).map((r4) => ({
|
|
28131
|
+
name: r4.name,
|
|
28132
|
+
kind: r4.kind,
|
|
28133
|
+
line: r4.line,
|
|
28134
|
+
endLine: r4.end_line
|
|
28135
|
+
}));
|
|
28136
|
+
}
|
|
28137
|
+
resolveMoniker(moniker) {
|
|
28138
|
+
const row = this.db.query(`SELECT s.name, s.kind, s.line, s.qualified_name, f.path
|
|
28139
|
+
FROM symbols s JOIN files f ON f.id = s.file_id
|
|
28140
|
+
WHERE s.moniker = ?
|
|
28141
|
+
LIMIT 1`).get(moniker);
|
|
28142
|
+
if (!row)
|
|
28143
|
+
return null;
|
|
28144
|
+
return {
|
|
28145
|
+
name: row.name,
|
|
28146
|
+
kind: row.kind,
|
|
28147
|
+
line: row.line,
|
|
28148
|
+
qualifiedName: row.qualified_name,
|
|
28149
|
+
path: row.path
|
|
28150
|
+
};
|
|
28151
|
+
}
|
|
28152
|
+
indexTrigrams(fileId, content) {
|
|
28153
|
+
const trigrams = extractContentTrigrams(content);
|
|
28154
|
+
if (trigrams.size === 0)
|
|
28155
|
+
return;
|
|
28156
|
+
const insert = this.db.prepare("INSERT OR IGNORE INTO trigrams (trigram, file_id) VALUES (?, ?)");
|
|
28157
|
+
const countFor = this.db.prepare("SELECT COUNT(*) AS c FROM trigrams WHERE trigram = ?");
|
|
28158
|
+
const tx = this.db.transaction(() => {
|
|
28159
|
+
for (const tri of trigrams) {
|
|
28160
|
+
const existing = countFor.get(tri)?.c ?? 0;
|
|
28161
|
+
if (existing >= MAX_POSTINGS_PER_TRIGRAM)
|
|
28162
|
+
continue;
|
|
28163
|
+
insert.run(tri, fileId);
|
|
28164
|
+
}
|
|
28165
|
+
});
|
|
28166
|
+
tx();
|
|
28167
|
+
}
|
|
28168
|
+
searchTrigramCandidates(pattern, limit = 5000) {
|
|
28169
|
+
const tris = extractPatternTrigrams(pattern);
|
|
28170
|
+
if (!tris || tris.length === 0)
|
|
28171
|
+
return null;
|
|
28172
|
+
const hasTrigrams = this.db.query("SELECT 1 AS x FROM trigrams LIMIT 1").get();
|
|
28173
|
+
if (!hasTrigrams)
|
|
28174
|
+
return null;
|
|
28175
|
+
const selects = tris.map(() => "SELECT file_id FROM trigrams WHERE trigram = ?");
|
|
28176
|
+
const sql = `SELECT f.path FROM files f WHERE f.id IN (${selects.join(" INTERSECT ")}) LIMIT ?`;
|
|
28177
|
+
const rows = this.db.query(sql).all(...tris, limit);
|
|
28178
|
+
return rows.map((r4) => r4.path);
|
|
28179
|
+
}
|
|
27648
28180
|
}
|
|
28181
|
+
var TRIGRAM_MAX_FILE_BYTES;
|
|
27649
28182
|
var init_repo_map = __esm(() => {
|
|
27650
28183
|
init_ensure_soulforge_dir();
|
|
27651
28184
|
init_clone_detection();
|
|
27652
28185
|
init_repo_map_constants();
|
|
27653
28186
|
init_repo_map_utils();
|
|
28187
|
+
init_trigram();
|
|
27654
28188
|
init_types2();
|
|
28189
|
+
TRIGRAM_MAX_FILE_BYTES = 256 * 1024;
|
|
27655
28190
|
});
|
|
27656
28191
|
|
|
27657
28192
|
// src/core/intelligence/cache.ts
|
|
27658
|
-
import { readFile as
|
|
28193
|
+
import { readFile as readFile3, stat as stat2 } from "fs/promises";
|
|
27659
28194
|
|
|
27660
28195
|
class FileCache {
|
|
27661
28196
|
entries = new Map;
|
|
@@ -27673,7 +28208,7 @@ class FileCache {
|
|
|
27673
28208
|
this.entries.set(filePath, cached);
|
|
27674
28209
|
return cached.content;
|
|
27675
28210
|
}
|
|
27676
|
-
const content = await
|
|
28211
|
+
const content = await readFile3(filePath, "utf-8");
|
|
27677
28212
|
this.set(filePath, content, mtime);
|
|
27678
28213
|
return content;
|
|
27679
28214
|
} catch {
|
|
@@ -28551,6 +29086,15 @@ var init_config = __esm(() => {
|
|
|
28551
29086
|
NESTED_KEYS = ["editor", "theme", "editorIntegration", "codeIntelligence", "thinking", "performance", "contextManagement", "agentFeatures", "compaction", "retry", "addons"];
|
|
28552
29087
|
});
|
|
28553
29088
|
|
|
29089
|
+
// src/core/cwd.ts
|
|
29090
|
+
function getCwd() {
|
|
29091
|
+
return _cwd;
|
|
29092
|
+
}
|
|
29093
|
+
var _cwd;
|
|
29094
|
+
var init_cwd = __esm(() => {
|
|
29095
|
+
_cwd = process.cwd();
|
|
29096
|
+
});
|
|
29097
|
+
|
|
28554
29098
|
// src/core/intelligence/backends/lsp/server-registry.ts
|
|
28555
29099
|
import { existsSync as existsSync8 } from "fs";
|
|
28556
29100
|
import { join as join10 } from "path";
|
|
@@ -28596,7 +29140,7 @@ function resolveCommand(cmd) {
|
|
|
28596
29140
|
return null;
|
|
28597
29141
|
}
|
|
28598
29142
|
function isServerDisabled(cmd) {
|
|
28599
|
-
const cwd =
|
|
29143
|
+
const cwd = getCwd();
|
|
28600
29144
|
const global2 = loadConfig();
|
|
28601
29145
|
const project = loadProjectConfig(cwd);
|
|
28602
29146
|
const disabled = project?.disabledLspServers ?? global2.disabledLspServers ?? [];
|
|
@@ -28624,6 +29168,7 @@ function findServersForLanguage(language) {
|
|
|
28624
29168
|
var SERVER_CANDIDATES, MASON_BIN_DIR, SOULFORGE_BIN_DIR, BIN_SUFFIXES, probeCache;
|
|
28625
29169
|
var init_server_registry = __esm(() => {
|
|
28626
29170
|
init_config();
|
|
29171
|
+
init_cwd();
|
|
28627
29172
|
init_platform();
|
|
28628
29173
|
SERVER_CANDIDATES = {
|
|
28629
29174
|
typescript: [{
|
|
@@ -29781,7 +30326,7 @@ var init_pid_tracker = __esm(() => {
|
|
|
29781
30326
|
|
|
29782
30327
|
// src/core/intelligence/backends/lsp/standalone-client.ts
|
|
29783
30328
|
import { spawn as spawn2 } from "child_process";
|
|
29784
|
-
import { readFile as
|
|
30329
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
29785
30330
|
|
|
29786
30331
|
class StandaloneLspClient {
|
|
29787
30332
|
config;
|
|
@@ -29959,7 +30504,7 @@ class StandaloneLspClient {
|
|
|
29959
30504
|
const uri = filePathToUri(filePath);
|
|
29960
30505
|
let text2;
|
|
29961
30506
|
try {
|
|
29962
|
-
text2 = await
|
|
30507
|
+
text2 = await readFile4(filePath, "utf-8");
|
|
29963
30508
|
} catch {
|
|
29964
30509
|
return;
|
|
29965
30510
|
}
|
|
@@ -30429,7 +30974,7 @@ __export(exports_lsp, {
|
|
|
30429
30974
|
LspBackend: () => LspBackend
|
|
30430
30975
|
});
|
|
30431
30976
|
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
|
|
30432
|
-
import { readdir as readdir2, readFile as
|
|
30977
|
+
import { readdir as readdir2, readFile as readFile5 } from "fs/promises";
|
|
30433
30978
|
import { dirname as dirname3, join as join12, resolve as resolve5 } from "path";
|
|
30434
30979
|
function getNvimBridge() {
|
|
30435
30980
|
if (_nvimBridge === null) {
|
|
@@ -30529,7 +31074,7 @@ class LspBackend {
|
|
|
30529
31074
|
const absFile = resolve5(file);
|
|
30530
31075
|
let content;
|
|
30531
31076
|
try {
|
|
30532
|
-
content = await
|
|
31077
|
+
content = await readFile5(absFile, "utf-8");
|
|
30533
31078
|
} catch {
|
|
30534
31079
|
return null;
|
|
30535
31080
|
}
|
|
@@ -30703,7 +31248,7 @@ class LspBackend {
|
|
|
30703
31248
|
const absFile = resolve5(file);
|
|
30704
31249
|
let content;
|
|
30705
31250
|
try {
|
|
30706
|
-
content = await
|
|
31251
|
+
content = await readFile5(absFile, "utf-8");
|
|
30707
31252
|
} catch {
|
|
30708
31253
|
return null;
|
|
30709
31254
|
}
|
|
@@ -30844,7 +31389,7 @@ class LspBackend {
|
|
|
30844
31389
|
const absFile = resolve5(file);
|
|
30845
31390
|
let content;
|
|
30846
31391
|
try {
|
|
30847
|
-
content = await
|
|
31392
|
+
content = await readFile5(absFile, "utf-8");
|
|
30848
31393
|
} catch {
|
|
30849
31394
|
return null;
|
|
30850
31395
|
}
|
|
@@ -31308,7 +31853,7 @@ class LspBackend {
|
|
|
31308
31853
|
};
|
|
31309
31854
|
}
|
|
31310
31855
|
try {
|
|
31311
|
-
const content = await
|
|
31856
|
+
const content = await readFile5(file, "utf-8");
|
|
31312
31857
|
const fileLines = content.split(`
|
|
31313
31858
|
`);
|
|
31314
31859
|
const wordPattern = new RegExp(`\\b${escapeRegex(symbol)}\\b`);
|
|
@@ -31524,7 +32069,7 @@ async function workspaceEditToRefactorResult(edit, oldName, newName) {
|
|
|
31524
32069
|
for (const [filePath, edits] of fileEdits) {
|
|
31525
32070
|
let content;
|
|
31526
32071
|
try {
|
|
31527
|
-
content = await
|
|
32072
|
+
content = await readFile5(filePath, "utf-8");
|
|
31528
32073
|
} catch {
|
|
31529
32074
|
continue;
|
|
31530
32075
|
}
|
|
@@ -39749,7 +40294,7 @@ ${lanes.join(`
|
|
|
39749
40294
|
writeOutputIsTTY() {
|
|
39750
40295
|
return process.stdout.isTTY;
|
|
39751
40296
|
},
|
|
39752
|
-
readFile:
|
|
40297
|
+
readFile: readFile6,
|
|
39753
40298
|
writeFile: writeFile2,
|
|
39754
40299
|
watchFile: watchFile2,
|
|
39755
40300
|
watchDirectory,
|
|
@@ -39942,7 +40487,7 @@ ${lanes.join(`
|
|
|
39942
40487
|
function fsWatchWorker(fileOrDirectory, recursive, callback) {
|
|
39943
40488
|
return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
|
|
39944
40489
|
}
|
|
39945
|
-
function
|
|
40490
|
+
function readFile6(fileName, _encoding) {
|
|
39946
40491
|
let buffer;
|
|
39947
40492
|
try {
|
|
39948
40493
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -40539,11 +41084,11 @@ ${lanes.join(`
|
|
|
40539
41084
|
return toComponents;
|
|
40540
41085
|
}
|
|
40541
41086
|
const components = toComponents.slice(start2);
|
|
40542
|
-
const
|
|
41087
|
+
const relative3 = [];
|
|
40543
41088
|
for (;start2 < fromComponents.length; start2++) {
|
|
40544
|
-
|
|
41089
|
+
relative3.push("..");
|
|
40545
41090
|
}
|
|
40546
|
-
return ["", ...
|
|
41091
|
+
return ["", ...relative3, ...components];
|
|
40547
41092
|
}
|
|
40548
41093
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
40549
41094
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -43018,10 +43563,10 @@ ${lanes.join(`
|
|
|
43018
43563
|
if (pos1 === pos2)
|
|
43019
43564
|
return 0;
|
|
43020
43565
|
const lineStarts = getLineStarts(sourceFile);
|
|
43021
|
-
const
|
|
43022
|
-
const isNegative =
|
|
43566
|
+
const lower2 = Math.min(pos1, pos2);
|
|
43567
|
+
const isNegative = lower2 === pos2;
|
|
43023
43568
|
const upper = isNegative ? pos1 : pos2;
|
|
43024
|
-
const lowerLine = computeLineOfPosition(lineStarts,
|
|
43569
|
+
const lowerLine = computeLineOfPosition(lineStarts, lower2);
|
|
43025
43570
|
const upperLine = computeLineOfPosition(lineStarts, upper, lowerLine);
|
|
43026
43571
|
return isNegative ? lowerLine - upperLine : upperLine - lowerLine;
|
|
43027
43572
|
}
|
|
@@ -71009,7 +71554,7 @@ ${lanes.join(`
|
|
|
71009
71554
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
71010
71555
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
71011
71556
|
}
|
|
71012
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
71557
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile6) {
|
|
71013
71558
|
const options = {};
|
|
71014
71559
|
let watchOptions;
|
|
71015
71560
|
const fileNames = [];
|
|
@@ -71047,7 +71592,7 @@ ${lanes.join(`
|
|
|
71047
71592
|
}
|
|
71048
71593
|
}
|
|
71049
71594
|
function parseResponseFile(fileName) {
|
|
71050
|
-
const text2 = tryReadFile(fileName,
|
|
71595
|
+
const text2 = tryReadFile(fileName, readFile6 || ((fileName2) => sys.readFile(fileName2)));
|
|
71051
71596
|
if (!isString(text2)) {
|
|
71052
71597
|
errors.push(text2);
|
|
71053
71598
|
return;
|
|
@@ -71150,8 +71695,8 @@ ${lanes.join(`
|
|
|
71150
71695
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
71151
71696
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
71152
71697
|
};
|
|
71153
|
-
function parseCommandLine(commandLine,
|
|
71154
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
71698
|
+
function parseCommandLine(commandLine, readFile6) {
|
|
71699
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile6);
|
|
71155
71700
|
}
|
|
71156
71701
|
function getOptionFromName(optionName, allowShort) {
|
|
71157
71702
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -71219,8 +71764,8 @@ ${lanes.join(`
|
|
|
71219
71764
|
result.originalFileName = result.fileName;
|
|
71220
71765
|
return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
|
|
71221
71766
|
}
|
|
71222
|
-
function readConfigFile(fileName,
|
|
71223
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
71767
|
+
function readConfigFile(fileName, readFile6) {
|
|
71768
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile6);
|
|
71224
71769
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
71225
71770
|
}
|
|
71226
71771
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -71230,14 +71775,14 @@ ${lanes.join(`
|
|
|
71230
71775
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
|
|
71231
71776
|
};
|
|
71232
71777
|
}
|
|
71233
|
-
function readJsonConfigFile(fileName,
|
|
71234
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
71778
|
+
function readJsonConfigFile(fileName, readFile6) {
|
|
71779
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile6);
|
|
71235
71780
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
71236
71781
|
}
|
|
71237
|
-
function tryReadFile(fileName,
|
|
71782
|
+
function tryReadFile(fileName, readFile6) {
|
|
71238
71783
|
let text2;
|
|
71239
71784
|
try {
|
|
71240
|
-
text2 =
|
|
71785
|
+
text2 = readFile6(fileName);
|
|
71241
71786
|
} catch (e) {
|
|
71242
71787
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
|
|
71243
71788
|
}
|
|
@@ -77916,9 +78461,9 @@ ${lanes.join(`
|
|
|
77916
78461
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
77917
78462
|
return;
|
|
77918
78463
|
}
|
|
77919
|
-
const
|
|
78464
|
+
const relative3 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
77920
78465
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
77921
|
-
const option2 = resolvePath(symlinkDirectory,
|
|
78466
|
+
const option2 = resolvePath(symlinkDirectory, relative3);
|
|
77922
78467
|
const result2 = cb(option2, target === referenceRedirect);
|
|
77923
78468
|
shouldFilterIgnoredPaths = true;
|
|
77924
78469
|
if (result2)
|
|
@@ -139132,12 +139677,12 @@ ${lanes.join(`
|
|
|
139132
139677
|
function createCompilerHost(options, setParentNodes) {
|
|
139133
139678
|
return createCompilerHostWorker(options, setParentNodes);
|
|
139134
139679
|
}
|
|
139135
|
-
function createGetSourceFile(
|
|
139680
|
+
function createGetSourceFile(readFile6, setParentNodes) {
|
|
139136
139681
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
139137
139682
|
let text2;
|
|
139138
139683
|
try {
|
|
139139
139684
|
mark2("beforeIORead");
|
|
139140
|
-
text2 =
|
|
139685
|
+
text2 = readFile6(fileName);
|
|
139141
139686
|
mark2("afterIORead");
|
|
139142
139687
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
139143
139688
|
} catch (e) {
|
|
@@ -139928,7 +140473,7 @@ ${lanes.join(`
|
|
|
139928
140473
|
getRedirectFromOutput,
|
|
139929
140474
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
139930
140475
|
});
|
|
139931
|
-
const
|
|
140476
|
+
const readFile6 = host.readFile.bind(host);
|
|
139932
140477
|
(_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
139933
140478
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
139934
140479
|
(_f = tracing) == null || _f.pop();
|
|
@@ -140105,7 +140650,7 @@ ${lanes.join(`
|
|
|
140105
140650
|
shouldTransformImportCall,
|
|
140106
140651
|
emitBuildInfo,
|
|
140107
140652
|
fileExists,
|
|
140108
|
-
readFile:
|
|
140653
|
+
readFile: readFile6,
|
|
140109
140654
|
directoryExists,
|
|
140110
140655
|
getSymlinkCache,
|
|
140111
140656
|
realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
|
|
@@ -202995,7 +203540,7 @@ var require_path_browserify = __commonJS((exports, module2) => {
|
|
|
202995
203540
|
return ".";
|
|
202996
203541
|
return posix.normalize(joined);
|
|
202997
203542
|
},
|
|
202998
|
-
relative: function
|
|
203543
|
+
relative: function relative3(from, to) {
|
|
202999
203544
|
assertPath(from);
|
|
203000
203545
|
assertPath(to);
|
|
203001
203546
|
if (from === to)
|
|
@@ -205817,12 +206362,12 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
205817
206362
|
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
205818
206363
|
}
|
|
205819
206364
|
async function glob(globInput, options) {
|
|
205820
|
-
const [crawler,
|
|
205821
|
-
return crawler ? formatPaths(await crawler.withPromise(),
|
|
206365
|
+
const [crawler, relative3] = getCrawler(globInput, options);
|
|
206366
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative3) : [];
|
|
205822
206367
|
}
|
|
205823
206368
|
function globSync(globInput, options) {
|
|
205824
|
-
const [crawler,
|
|
205825
|
-
return crawler ? formatPaths(crawler.sync(),
|
|
206369
|
+
const [crawler, relative3] = getCrawler(globInput, options);
|
|
206370
|
+
return crawler ? formatPaths(crawler.sync(), relative3) : [];
|
|
205826
206371
|
}
|
|
205827
206372
|
exports.convertPathToPattern = convertPathToPattern;
|
|
205828
206373
|
exports.escapePath = escapePath;
|
|
@@ -280394,7 +280939,7 @@ var exports_regex = {};
|
|
|
280394
280939
|
__export(exports_regex, {
|
|
280395
280940
|
RegexBackend: () => RegexBackend
|
|
280396
280941
|
});
|
|
280397
|
-
import { readFile as
|
|
280942
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
280398
280943
|
import { resolve as resolve7 } from "path";
|
|
280399
280944
|
function getPatternsForLanguage(language) {
|
|
280400
280945
|
switch (language) {
|
|
@@ -280469,7 +281014,7 @@ class RegexBackend {
|
|
|
280469
281014
|
name = "regex";
|
|
280470
281015
|
tier = 4;
|
|
280471
281016
|
cache = null;
|
|
280472
|
-
initialize(
|
|
281017
|
+
initialize(_cwd2) {
|
|
280473
281018
|
return Promise.resolve();
|
|
280474
281019
|
}
|
|
280475
281020
|
setCache(cache) {
|
|
@@ -280769,7 +281314,7 @@ class RegexBackend {
|
|
|
280769
281314
|
return this.cache.get(resolve7(file));
|
|
280770
281315
|
}
|
|
280771
281316
|
try {
|
|
280772
|
-
return await
|
|
281317
|
+
return await readFile6(resolve7(file), "utf-8");
|
|
280773
281318
|
} catch {
|
|
280774
281319
|
return null;
|
|
280775
281320
|
}
|
|
@@ -281200,8 +281745,8 @@ var LANG_ALIASES = {
|
|
|
281200
281745
|
};
|
|
281201
281746
|
var SHIKI_LANGS = ["typescript", "javascript", "tsx", "jsx", "python", "rust", "go", "bash", "json", "yaml", "toml", "html", "css", "sql", "markdown", "ruby", "java", "kotlin", "swift", "c", "cpp", "csharp", "php", "lua", "zig", "elixir", "haskell", "ocaml", "scala", "dart", "dockerfile", "graphql", "terraform", "vim", "diff", "ini", "xml"];
|
|
281202
281747
|
function normalizeLang(lang254) {
|
|
281203
|
-
const
|
|
281204
|
-
return LANG_ALIASES[
|
|
281748
|
+
const lower2 = lang254.toLowerCase().trim();
|
|
281749
|
+
return LANG_ALIASES[lower2] ?? lower2;
|
|
281205
281750
|
}
|
|
281206
281751
|
async function ensureHighlighter() {
|
|
281207
281752
|
if (highlighter)
|
|
@@ -281278,9 +281823,12 @@ var handlers = {
|
|
|
281278
281823
|
findSymbols: (name2) => requireRepoMap().findSymbols(name2),
|
|
281279
281824
|
findSymbol: (name2) => requireRepoMap().findSymbol(name2),
|
|
281280
281825
|
searchSymbolsSubstring: (query, limit) => requireRepoMap().searchSymbolsSubstring(query, limit),
|
|
281826
|
+
searchTrigramCandidates: (pattern, limit) => requireRepoMap().searchTrigramCandidates(pattern, limit),
|
|
281281
281827
|
searchSymbolsFts: (query, limit) => requireRepoMap().searchSymbolsFts(query, limit),
|
|
281282
281828
|
getFileSymbols: (relPath) => requireRepoMap().getFileSymbols(relPath),
|
|
281283
281829
|
getFileSymbolRanges: (relPath) => requireRepoMap().getFileSymbolRanges(relPath),
|
|
281830
|
+
getEnclosingSymbols: (relPath) => requireRepoMap().getEnclosingSymbols(relPath),
|
|
281831
|
+
resolveMoniker: (moniker) => requireRepoMap().resolveMoniker(moniker),
|
|
281284
281832
|
getSymbolSignature: (name2) => requireRepoMap().getSymbolSignature(name2),
|
|
281285
281833
|
getSymbolsByKind: (kind, limit) => requireRepoMap().getSymbolsByKind(kind, limit),
|
|
281286
281834
|
matchFiles: (pattern, limit) => requireRepoMap().matchFiles(pattern, limit),
|