pi-lens 4.4.4 → 4.4.6
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/CHANGELOG.md +477 -0
- package/README.md +45 -3
- package/config/biome/core.jsonc +3 -3
- package/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/dist/{chunk-UBOQLVT2.js → chunk-2DDDCJDL.js} +4 -4
- package/dist/{chunk-RKKOYPRA.js → chunk-2DMLM3ZO.js} +13 -15
- package/dist/chunk-2F47TQOA.js +73 -0
- package/dist/{chunk-O4NWQT6I.js → chunk-2PHMIAKO.js} +4 -4
- package/dist/{chunk-DGUKIYSI.js → chunk-2RLWJO5K.js} +8 -10
- package/dist/{chunk-S67KYG37.js → chunk-2X4VLOCC.js} +2 -2
- package/dist/{chunk-TIQ2PKDW.js → chunk-3MYEA7QD.js} +4 -4
- package/dist/{chunk-3DA2JDOL.js → chunk-3WEPUD2V.js} +551 -203
- package/dist/{chunk-AMERCH6V.js → chunk-4AVZ3TG7.js} +15 -16
- package/dist/{chunk-IYNJ6YPZ.js → chunk-4PCQCU47.js} +4 -4
- package/dist/chunk-4WX4CTUE.js +57 -0
- package/dist/{chunk-P63GXC37.js → chunk-5APMQ2IJ.js} +31 -4
- package/dist/{chunk-ZIVJBOO3.js → chunk-5CV5ITZF.js} +2 -2
- package/dist/{chunk-6DLWKFEX.js → chunk-5ZR3APIM.js} +41 -42
- package/dist/{chunk-XTBDCR27.js → chunk-63RIVFQI.js} +4 -4
- package/dist/{chunk-GSLNCYGG.js → chunk-75SY4F24.js} +13 -14
- package/dist/{chunk-U44DJXQP.js → chunk-7RQXA5GG.js} +15 -18
- package/dist/chunk-A3YNG5KP.js +45 -0
- package/dist/{chunk-5OFV52AM.js → chunk-AE37FEGH.js} +1 -1
- package/dist/{chunk-BWD5EPKO.js → chunk-AMXIUN2R.js} +4 -6
- package/dist/{chunk-3KAZU3VR.js → chunk-ARD426WI.js} +2 -2
- package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/dist/{chunk-YH5MVY2U.js → chunk-BHUWL2Y3.js} +7 -7
- package/dist/{chunk-CT4MN5IU.js → chunk-BI5LAQ3Y.js} +353 -359
- package/dist/{chunk-KAPJINKN.js → chunk-BM5GS6ZH.js} +2 -2
- package/dist/{chunk-TLX72JTG.js → chunk-BWYQUPOS.js} +1 -1
- package/dist/chunk-CFRQMBGP.js +49 -0
- package/dist/{chunk-RMLC67LF.js → chunk-CJYKEW2L.js} +2 -30
- package/dist/chunk-CKEQFGLT.js +32 -0
- package/dist/{chunk-IWDLU6K3.js → chunk-DC4CFXM5.js} +4 -6
- package/dist/{chunk-ZVUL7QYY.js → chunk-DMSLNKF7.js} +29 -32
- package/dist/{chunk-KN35K52N.js → chunk-DQXSPYRI.js} +3 -3
- package/dist/{chunk-HYGZEMX6.js → chunk-EVDGNG4F.js} +11 -5
- package/dist/{chunk-SRYEJNES.js → chunk-F5Z6URKM.js} +2 -2
- package/dist/{chunk-UMS2MFPZ.js → chunk-F6X3YJWD.js} +2 -3
- package/dist/{chunk-XYURS6EN.js → chunk-FA5LDARD.js} +15 -17
- package/dist/{chunk-24AKHFGP.js → chunk-FFL3A2VP.js} +6 -6
- package/dist/chunk-FJIVKLPH.js +31 -0
- package/dist/chunk-G2B7F6ZU.js +88 -0
- package/dist/{chunk-US7ECLD7.js → chunk-GAACZY6R.js} +131 -41
- package/dist/{chunk-MZGQNL3Y.js → chunk-GMTFDAOK.js} +12 -13
- package/dist/{chunk-VOOAPROD.js → chunk-GNSIWBAT.js} +3 -3
- package/dist/chunk-GTAI2J6U.js +27 -0
- package/dist/{chunk-RVK72CZX.js → chunk-GZE7WOI4.js} +1362 -459
- package/dist/{chunk-IUE7SSKV.js → chunk-H7HTEQUZ.js} +13 -7
- package/dist/{chunk-EUXZEFTV.js → chunk-HK6JVFZC.js} +3 -3
- package/dist/chunk-IPDG45G5.js +26 -0
- package/dist/{chunk-5HSRT26B.js → chunk-J6JP25XU.js} +16 -15
- package/dist/{chunk-HWCCCQNX.js → chunk-JL6CXUMW.js} +13 -6
- package/dist/{chunk-EBC36LNN.js → chunk-K2YGBXOA.js} +17 -17
- package/dist/{chunk-WMYE35PX.js → chunk-KLQVC3XC.js} +7 -5
- package/dist/{chunk-ATKJFDQN.js → chunk-KSR7RGQY.js} +12 -14
- package/dist/{chunk-POMLXPMY.js → chunk-KXF5R4UN.js} +1 -1
- package/dist/{chunk-LLJNQKQW.js → chunk-LEJOJDXL.js} +20 -13
- package/dist/{chunk-JUKMK5Y4.js → chunk-MA77RSFN.js} +10 -11
- package/dist/{chunk-GAQ7OQG6.js → chunk-MKVZQUEG.js} +85 -96
- package/dist/{chunk-2EECBNC5.js → chunk-MN7MHUXQ.js} +75 -0
- package/dist/{chunk-DEL2U6CM.js → chunk-MT6BVNFW.js} +16 -14
- package/dist/chunk-NDMCVUYK.js +507 -0
- package/dist/{chunk-HRNHZA3N.js → chunk-NIU2IPC5.js} +12 -16
- package/dist/{chunk-AGSS7277.js → chunk-NNKXDXXS.js} +7 -24
- package/dist/{chunk-V35JG4JB.js → chunk-OJLTLYHB.js} +152 -334
- package/dist/{chunk-J6MPGQTS.js → chunk-OLAWH5UQ.js} +81 -15
- package/dist/{chunk-T57LYLZT.js → chunk-OOU2WZZE.js} +1 -1
- package/dist/{chunk-CYRKQRPM.js → chunk-OSTKYB55.js} +2 -4
- package/dist/chunk-P4QNXS6I.js +27 -0
- package/dist/chunk-PKES3ISE.js +297 -0
- package/dist/{chunk-ROYSX2S5.js → chunk-PO45POGF.js} +2 -2
- package/dist/{chunk-T7FEBKXN.js → chunk-PPIBVH4R.js} +7 -9
- package/dist/{chunk-3RKP3FMS.js → chunk-PQJFG24Z.js} +295 -23
- package/dist/{chunk-KUA4OJ5Y.js → chunk-Q3UZHW6N.js} +846 -350
- package/dist/{chunk-N5FLEO7W.js → chunk-Q4EMRFNA.js} +37 -37
- package/dist/{chunk-5IUSNGOC.js → chunk-Q4FCYCRE.js} +28 -21
- package/dist/chunk-Q6D6VMI4.js +22 -0
- package/dist/{chunk-UZ2XCLYS.js → chunk-QGSTQH4D.js} +8 -8
- package/dist/{chunk-DUO2TU77.js → chunk-RZOXUSPC.js} +10 -4
- package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/dist/{chunk-GMX5OS7B.js → chunk-S67UJDGQ.js} +11 -12
- package/dist/chunk-SCIUNBPF.js +44 -0
- package/dist/{chunk-RKBXZN3A.js → chunk-SJJYRZB4.js} +2 -2
- package/dist/chunk-SXGD4ANG.js +25 -0
- package/dist/{chunk-YCWYO6TQ.js → chunk-T7FTXGS3.js} +48 -45
- package/dist/{chunk-FM4RDMKT.js → chunk-TIQJPRDD.js} +115 -61
- package/dist/{chunk-XHJBS436.js → chunk-TIYGSODX.js} +25 -25
- package/dist/{chunk-S2HEXIWI.js → chunk-U2SDMG7C.js} +10 -6
- package/dist/{chunk-2KXTHF3M.js → chunk-U6OC3QEM.js} +253 -33
- package/dist/{chunk-AWSCPCN2.js → chunk-UCGQT677.js} +19 -19
- package/dist/chunk-UHGF5UT5.js +32 -0
- package/dist/{chunk-JW3YWBVB.js → chunk-UN4TEBWN.js} +17 -19
- package/dist/{chunk-ZHH37KZL.js → chunk-V3APN3DY.js} +17 -17
- package/dist/{chunk-ED36RF6Y.js → chunk-V63BC55Q.js} +1 -1
- package/dist/{chunk-XBJVAEEO.js → chunk-VG5JS5SW.js} +3 -2
- package/dist/{chunk-W66O5E25.js → chunk-VPBIMOAQ.js} +13 -15
- package/dist/chunk-VQH24FIP.js +37 -0
- package/dist/{chunk-YNE3RP52.js → chunk-VSFLRN5Y.js} +8 -1
- package/dist/{chunk-7D6L4MTX.js → chunk-W2V54OCL.js} +3 -3
- package/dist/{chunk-2FN63LPV.js → chunk-W5LGKNET.js} +13 -14
- package/dist/{chunk-IQWN5JCP.js → chunk-W5R5SABV.js} +13 -14
- package/dist/{chunk-R3T7CLQ2.js → chunk-WIZWZR4C.js} +41 -41
- package/dist/{chunk-TOY6QKOH.js → chunk-WQOIR3QY.js} +17 -17
- package/dist/{chunk-Y6GZHWSJ.js → chunk-XAIT2YGS.js} +6 -6
- package/dist/chunk-XCUHKYCQ.js +23 -0
- package/dist/{chunk-GSM5UU7A.js → chunk-XQCSWV2G.js} +44 -35
- package/dist/{chunk-OHKJ7PQF.js → chunk-YBSONGSZ.js} +43 -39
- package/dist/{chunk-GXFV6MYU.js → chunk-YISME6ON.js} +72 -39
- package/dist/chunk-YRD4ISED.js +30 -0
- package/dist/{chunk-SD4I7ZO4.js → chunk-YSBHPOY6.js} +43 -53
- package/dist/{chunk-QBFBRV2B.js → chunk-Z2XAOKHK.js} +4 -2
- package/dist/{chunk-5VSF4UUQ.js → chunk-Z7IGUAXL.js} +34 -39
- package/dist/{chunk-MPNJLASA.js → chunk-ZKXQKGWZ.js} +10 -13
- package/dist/{chunk-J64T55EI.js → chunk-ZQ6NZZTB.js} +75 -9
- package/dist/chunk-ZUUI3ZSA.js +38 -0
- package/dist/{chunk-7HXE67BN.js → chunk-ZYNI26MI.js} +2 -2
- package/dist/index.js +32674 -27567
- package/dist/mcp/analyze-cli.js +11 -12
- package/dist/mcp/cli.js +46 -45
- package/dist/mcp/server.js +1210 -574
- package/dist/mcp/worker.js +65 -65
- package/dist/probes/installer.js +21 -23
- package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/docs/adr/README.md +1 -0
- package/docs/agent-tools.md +28 -7
- package/docs/ast-grep_rules_catalog.md +5 -3
- package/docs/configuration.md +12 -1
- package/docs/defect-shapes.md +738 -0
- package/docs/engineering-principles.md +12 -0
- package/docs/environment-variables.md +20 -0
- package/docs/features.md +16 -1
- package/docs/globalconfig.md +37 -8
- package/docs/invariants/caches-stores.md +30 -0
- package/docs/invariants/dispatch-runners.md +164 -0
- package/docs/invariants/git-guard-host.md +53 -0
- package/docs/invariants/language-config.md +31 -0
- package/docs/invariants/lsp-trust-exec.md +286 -0
- package/docs/invariants/paths-os.md +59 -0
- package/docs/invariants/session-telemetry.md +74 -0
- package/docs/lsp-capability-matrix.md +105 -12
- package/docs/lsp-idle-eviction.md +37 -18
- package/docs/pi-lens-fixer.md +24 -2
- package/docs/pi-lens-investigator.md +14 -0
- package/docs/pi-lens-merge-policy.md +32 -17
- package/docs/pi-lens-monitor.md +66 -10
- package/docs/pi-lens-orchestration.md +41 -0
- package/docs/pi-lens-release.md +20 -0
- package/docs/pi-lens-retro.md +5 -4
- package/docs/pi-lens-reviewer.md +54 -7
- package/docs/pi-lens-subagent.md +10 -3
- package/docs/release-qa-baseline.md +19 -7
- package/docs/servercapabilities.md +47 -47
- package/docs/settings.md +9 -5
- package/docs/subagent-compat.md +1 -1
- package/docs/usage.md +1 -0
- package/package.json +8 -5
- package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
- package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
- package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
- package/rules/rule-catalog.json +25 -1
- package/scripts/analyze-pi-lens-logs.mjs +15 -5
- package/scripts/lib/is-main-module.mjs +27 -0
- package/scripts/lib/scratch-home-env.mjs +21 -0
- package/scripts/rpc-load-check.mjs +4 -6
- package/scripts/warm-loader-cache.mjs +2 -5
- package/dist/chunk-3PTHXJXR.js +0 -28
- package/dist/chunk-3QED2P4V.js +0 -31
- package/dist/chunk-5WRPDP2A.js +0 -47
- package/dist/chunk-ABBOA7UD.js +0 -157
- package/dist/chunk-CUHSHSB6.js +0 -273
- package/dist/chunk-GL5LUMZE.js +0 -51
- package/dist/chunk-HAD7QRQI.js +0 -30
- package/dist/chunk-JORED7EX.js +0 -44
- package/dist/chunk-KYUB6QDC.js +0 -72
- package/dist/chunk-LZSEQW6A.js +0 -57
- package/dist/chunk-M2IFVFWU.js +0 -79
- package/dist/chunk-M2UD3LPU.js +0 -88
- package/dist/chunk-MBKQHGA7.js +0 -39
- package/dist/chunk-R7YOCSNV.js +0 -23
- package/dist/chunk-SKAMFC7A.js +0 -28
- package/dist/chunk-SYE6T2EB.js +0 -28
- package/dist/chunk-TRETHTQO.js +0 -26
- package/dist/chunk-UA7ZXYDR.js +0 -184
- package/dist/chunk-XTFDJI3T.js +0 -24
- package/dist/chunk-Z3CCVDUB.js +0 -76
|
@@ -1,60 +1,61 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
buildModuleGraph
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-63RIVFQI.js";
|
|
5
|
+
import {
|
|
6
|
+
aliasedImportTargets,
|
|
7
|
+
referencedProjectImportTarget
|
|
8
|
+
} from "./chunk-PKES3ISE.js";
|
|
5
9
|
import {
|
|
6
10
|
getSharedTreeSitterClient,
|
|
7
11
|
loadWebTreeSitter,
|
|
8
12
|
logTreeSitterDiagnostic,
|
|
9
13
|
resolveTreeSitterLanguage,
|
|
10
14
|
wasmQueryInput
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GAACZY6R.js";
|
|
12
16
|
import {
|
|
13
17
|
EXTENSION_TO_GRAMMAR,
|
|
14
18
|
KIND_TO_GRAMMAR
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YISME6ON.js";
|
|
20
|
+
import {
|
|
21
|
+
HOOK_WALL_BUDGET_MS
|
|
22
|
+
} from "./chunk-CKEQFGLT.js";
|
|
16
23
|
import {
|
|
17
|
-
HOOK_WALL_BUDGET_MS,
|
|
18
24
|
bounded
|
|
19
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-CJYKEW2L.js";
|
|
20
26
|
import {
|
|
21
|
-
freshnessFromMtime,
|
|
22
27
|
hashContentBytes,
|
|
23
28
|
toRunnerDisplayPath
|
|
24
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NNKXDXXS.js";
|
|
25
30
|
import {
|
|
26
31
|
loadPiLensGlobalConfig
|
|
27
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-Q3UZHW6N.js";
|
|
28
33
|
import {
|
|
29
34
|
isFileKind
|
|
30
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-RZOXUSPC.js";
|
|
31
36
|
import {
|
|
32
37
|
isDeclarationFile
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
findGoverningTsconfigDir,
|
|
36
|
-
getDirectoryMarkers,
|
|
37
|
-
registerWorkspaceTopologyReset
|
|
38
|
-
} from "./chunk-5HSRT26B.js";
|
|
38
|
+
} from "./chunk-OLAWH5UQ.js";
|
|
39
39
|
import {
|
|
40
40
|
incrementDegradationCount,
|
|
41
41
|
recordDegradationOnce
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ZQ6NZZTB.js";
|
|
43
|
+
import {
|
|
44
|
+
freshnessFromMtime
|
|
45
|
+
} from "./chunk-S26LC76R.js";
|
|
43
46
|
import {
|
|
44
47
|
toPositiveFinite
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-VSFLRN5Y.js";
|
|
46
49
|
import {
|
|
47
50
|
BoundedFifoMap,
|
|
48
|
-
BoundedLruCache
|
|
49
|
-
} from "./chunk-ABBOA7UD.js";
|
|
50
|
-
import {
|
|
51
|
+
BoundedLruCache,
|
|
51
52
|
isUnderDir,
|
|
52
53
|
normalizeEphemeralMapKey,
|
|
53
54
|
normalizeMapKey
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-PQJFG24Z.js";
|
|
55
56
|
|
|
56
57
|
// dist/clients/blocker-freshness.js
|
|
57
|
-
import * as
|
|
58
|
+
import * as fs4 from "node:fs";
|
|
58
59
|
import * as nodePath from "node:path";
|
|
59
60
|
|
|
60
61
|
// dist/clients/lsp/implicit-scope.js
|
|
@@ -125,6 +126,72 @@ var RUNTIME_CONFIG = {
|
|
|
125
126
|
}
|
|
126
127
|
};
|
|
127
128
|
|
|
129
|
+
// dist/clients/lsp/content-scan.js
|
|
130
|
+
function walkLfLines(content) {
|
|
131
|
+
let lfNewlineCount = 0;
|
|
132
|
+
let lastStart = 0;
|
|
133
|
+
for (let i = content.indexOf("\n"); i !== -1; i = content.indexOf("\n", i + 1)) {
|
|
134
|
+
lfNewlineCount++;
|
|
135
|
+
lastStart = i + 1;
|
|
136
|
+
}
|
|
137
|
+
return { lfNewlineCount, lastStart };
|
|
138
|
+
}
|
|
139
|
+
var lastNewlineWalk;
|
|
140
|
+
function countLfNewlines(content) {
|
|
141
|
+
const lfNewlineCount = walkLfLines(content).lfNewlineCount;
|
|
142
|
+
lastNewlineWalk = { content, lfNewlineCount };
|
|
143
|
+
return lfNewlineCount;
|
|
144
|
+
}
|
|
145
|
+
function reusedNewlineCount(content) {
|
|
146
|
+
return lastNewlineWalk?.content === content ? lastNewlineWalk.lfNewlineCount : void 0;
|
|
147
|
+
}
|
|
148
|
+
function lastLfLineStart(content) {
|
|
149
|
+
const lastNewline = content.lastIndexOf("\n");
|
|
150
|
+
return lastNewline === -1 ? 0 : lastNewline + 1;
|
|
151
|
+
}
|
|
152
|
+
function scanDocumentContent(content) {
|
|
153
|
+
const reused = reusedNewlineCount(content);
|
|
154
|
+
if (content.indexOf("\r") === -1) {
|
|
155
|
+
if (reused !== void 0) {
|
|
156
|
+
return {
|
|
157
|
+
lfNewlineCount: reused,
|
|
158
|
+
lastLine: { index: reused, start: lastLfLineStart(content) }
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const { lfNewlineCount: lfNewlineCount2, lastStart } = walkLfLines(content);
|
|
162
|
+
return {
|
|
163
|
+
lfNewlineCount: lfNewlineCount2,
|
|
164
|
+
lastLine: { index: lfNewlineCount2, start: lastStart }
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const lfNewlineCount = reused ?? walkLfLines(content).lfNewlineCount;
|
|
168
|
+
let index = 0;
|
|
169
|
+
let start = 0;
|
|
170
|
+
for (let i = 0; i < content.length; i++) {
|
|
171
|
+
const code = content.charCodeAt(i);
|
|
172
|
+
if (code !== 10 && code !== 13)
|
|
173
|
+
continue;
|
|
174
|
+
if (code === 13 && content.charCodeAt(i + 1) === 10)
|
|
175
|
+
i++;
|
|
176
|
+
index++;
|
|
177
|
+
start = i + 1;
|
|
178
|
+
}
|
|
179
|
+
return { lfNewlineCount, lastLine: { index, start } };
|
|
180
|
+
}
|
|
181
|
+
function lineTextAt(content, line) {
|
|
182
|
+
if (!Number.isInteger(line) || line < 0)
|
|
183
|
+
return "";
|
|
184
|
+
let start = 0;
|
|
185
|
+
for (let current = 0; current < line; current++) {
|
|
186
|
+
const next = content.indexOf("\n", start);
|
|
187
|
+
if (next === -1)
|
|
188
|
+
return "";
|
|
189
|
+
start = next + 1;
|
|
190
|
+
}
|
|
191
|
+
const end = content.indexOf("\n", start);
|
|
192
|
+
return end === -1 ? content.slice(start) : content.slice(start, end);
|
|
193
|
+
}
|
|
194
|
+
|
|
128
195
|
// dist/clients/lsp/content-limits.js
|
|
129
196
|
var LSP_MAX_FILE_BYTES = RUNTIME_CONFIG.pipeline.lspMaxFileBytes;
|
|
130
197
|
var LSP_MAX_FILE_LINES = RUNTIME_CONFIG.pipeline.lspMaxFileLines;
|
|
@@ -136,7 +203,7 @@ function exceedsLspSyncLimits(content) {
|
|
|
136
203
|
reason: `${sizeBytes} bytes > ${LSP_MAX_FILE_BYTES} limit`
|
|
137
204
|
};
|
|
138
205
|
}
|
|
139
|
-
const lineCount = content
|
|
206
|
+
const lineCount = countLfNewlines(content) + 1;
|
|
140
207
|
if (lineCount > LSP_MAX_FILE_LINES) {
|
|
141
208
|
return {
|
|
142
209
|
tooLarge: true,
|
|
@@ -398,272 +465,21 @@ function inodeBirthtimeMs(stat) {
|
|
|
398
465
|
}
|
|
399
466
|
|
|
400
467
|
// dist/clients/review-graph/import-resolvers.js
|
|
401
|
-
import * as fs4 from "node:fs";
|
|
402
|
-
import * as path3 from "node:path";
|
|
403
|
-
|
|
404
|
-
// dist/clients/review-graph/tsconfig-paths.js
|
|
405
468
|
import * as fs3 from "node:fs";
|
|
406
|
-
import * as os from "node:os";
|
|
407
469
|
import * as path2 from "node:path";
|
|
408
|
-
var cache = new BoundedLruCache(64);
|
|
409
|
-
var referencesCache = new BoundedLruCache(64);
|
|
410
|
-
registerWorkspaceTopologyReset(() => {
|
|
411
|
-
cache.clear();
|
|
412
|
-
referencesCache.clear();
|
|
413
|
-
});
|
|
414
|
-
function parseJsonc(content) {
|
|
415
|
-
let output = "";
|
|
416
|
-
let inString = false;
|
|
417
|
-
let escaped = false;
|
|
418
|
-
for (let i = 0; i < content.length; i++) {
|
|
419
|
-
const char = content[i];
|
|
420
|
-
const next = content[i + 1];
|
|
421
|
-
if (inString) {
|
|
422
|
-
output += char;
|
|
423
|
-
if (escaped)
|
|
424
|
-
escaped = false;
|
|
425
|
-
else if (char === "\\")
|
|
426
|
-
escaped = true;
|
|
427
|
-
else if (char === '"')
|
|
428
|
-
inString = false;
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
if (char === '"') {
|
|
432
|
-
inString = true;
|
|
433
|
-
output += char;
|
|
434
|
-
} else if (char === "/" && next === "/") {
|
|
435
|
-
while (i < content.length && content[i] !== "\n")
|
|
436
|
-
i++;
|
|
437
|
-
output += "\n";
|
|
438
|
-
} else if (char === "/" && next === "*") {
|
|
439
|
-
i += 2;
|
|
440
|
-
while (i < content.length && !(content[i] === "*" && content[i + 1] === "/"))
|
|
441
|
-
i++;
|
|
442
|
-
i++;
|
|
443
|
-
} else {
|
|
444
|
-
output += char;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return JSON.parse(output.replace(/,\s*([}\]])/g, "$1"));
|
|
448
|
-
}
|
|
449
|
-
function configSignature(configPath) {
|
|
450
|
-
try {
|
|
451
|
-
const stat = fs3.statSync(configPath);
|
|
452
|
-
return `${stat.mtimeMs}:${stat.size}`;
|
|
453
|
-
} catch {
|
|
454
|
-
return "missing";
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function configDependencyPaths(configPath) {
|
|
458
|
-
const paths = /* @__PURE__ */ new Set();
|
|
459
|
-
const visit = (currentPath) => {
|
|
460
|
-
const normalized = path2.resolve(currentPath);
|
|
461
|
-
if (paths.has(normalized))
|
|
462
|
-
return;
|
|
463
|
-
paths.add(normalized);
|
|
464
|
-
let json;
|
|
465
|
-
try {
|
|
466
|
-
json = parseJsonc(fs3.readFileSync(normalized, "utf8"));
|
|
467
|
-
} catch {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
if (typeof json.extends === "string") {
|
|
471
|
-
const parent = resolveExtends(normalized, json.extends);
|
|
472
|
-
if (parent)
|
|
473
|
-
visit(parent);
|
|
474
|
-
}
|
|
475
|
-
for (const reference of json.references ?? []) {
|
|
476
|
-
if (typeof reference?.path !== "string")
|
|
477
|
-
continue;
|
|
478
|
-
const referenced = resolveReferenceConfig(normalized, reference.path);
|
|
479
|
-
if (referenced)
|
|
480
|
-
visit(referenced);
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
visit(configPath);
|
|
484
|
-
return [...paths].sort((a, b) => a.localeCompare(b));
|
|
485
|
-
}
|
|
486
|
-
function dependencySignature(configPath) {
|
|
487
|
-
return configDependencyPaths(configPath).map((dependency) => `${dependency}:${configSignature(dependency)}`).join("|");
|
|
488
|
-
}
|
|
489
|
-
function resolveExtends(configPath, value) {
|
|
490
|
-
if (!value.startsWith("."))
|
|
491
|
-
return void 0;
|
|
492
|
-
const resolved = path2.resolve(path2.dirname(configPath), value);
|
|
493
|
-
return resolved.toLowerCase().endsWith(".json") ? resolved : `${resolved}.json`;
|
|
494
|
-
}
|
|
495
|
-
function readConfig(configPath, seen) {
|
|
496
|
-
const normalized = path2.resolve(configPath);
|
|
497
|
-
if (seen.has(normalized))
|
|
498
|
-
return void 0;
|
|
499
|
-
seen.add(normalized);
|
|
500
|
-
let json;
|
|
501
|
-
try {
|
|
502
|
-
json = parseJsonc(fs3.readFileSync(normalized, "utf8"));
|
|
503
|
-
} catch {
|
|
504
|
-
return void 0;
|
|
505
|
-
}
|
|
506
|
-
let inherited;
|
|
507
|
-
if (typeof json.extends === "string") {
|
|
508
|
-
const parentPath = resolveExtends(normalized, json.extends);
|
|
509
|
-
if (parentPath)
|
|
510
|
-
inherited = readConfig(parentPath, seen);
|
|
511
|
-
}
|
|
512
|
-
const options = json.compilerOptions;
|
|
513
|
-
const baseUrl = typeof options?.baseUrl === "string" ? path2.resolve(path2.dirname(normalized), options.baseUrl) : inherited?.baseUrl ?? path2.dirname(normalized);
|
|
514
|
-
const paths = options?.paths && typeof options.paths === "object" ? Object.fromEntries(Object.entries(options.paths).map(([pattern, targets]) => [
|
|
515
|
-
pattern,
|
|
516
|
-
Array.isArray(targets) ? targets.map((target) => path2.resolve(baseUrl, target)) : targets
|
|
517
|
-
])) : inherited?.paths;
|
|
518
|
-
const rootDir = typeof options?.rootDir === "string" ? path2.resolve(path2.dirname(normalized), options.rootDir) : inherited?.rootDir;
|
|
519
|
-
const include = Array.isArray(json.include) ? json.include.filter((value) => typeof value === "string") : inherited?.include;
|
|
520
|
-
const references = Array.isArray(json.references) ? json.references.map((reference) => reference?.path).filter((value) => typeof value === "string" && value.startsWith(".")) : [];
|
|
521
|
-
return { baseUrl, paths, rootDir, include, references };
|
|
522
|
-
}
|
|
523
|
-
function resolveReferenceConfig(configPath, value) {
|
|
524
|
-
const target = path2.resolve(path2.dirname(configPath), value);
|
|
525
|
-
try {
|
|
526
|
-
if (fs3.statSync(target).isDirectory()) {
|
|
527
|
-
return getDirectoryMarkers(target).tsconfigPath;
|
|
528
|
-
}
|
|
529
|
-
if (fs3.statSync(target).isFile())
|
|
530
|
-
return target;
|
|
531
|
-
} catch {
|
|
532
|
-
return void 0;
|
|
533
|
-
}
|
|
534
|
-
return void 0;
|
|
535
|
-
}
|
|
536
|
-
function includeRoot(configDir, pattern) {
|
|
537
|
-
const wildcard = pattern.search(/[*?]/);
|
|
538
|
-
const prefix = wildcard === -1 ? pattern : pattern.slice(0, wildcard);
|
|
539
|
-
const trimmed = prefix.replace(/[\\/]+$/, "");
|
|
540
|
-
if (!trimmed)
|
|
541
|
-
return void 0;
|
|
542
|
-
const resolved = path2.resolve(configDir, trimmed);
|
|
543
|
-
return path2.extname(resolved) ? path2.dirname(resolved) : resolved;
|
|
544
|
-
}
|
|
545
|
-
function firstSourceEntry(configPath, parsed) {
|
|
546
|
-
const configDir = path2.dirname(configPath);
|
|
547
|
-
const roots = [
|
|
548
|
-
...parsed.rootDir ? [parsed.rootDir] : [],
|
|
549
|
-
...(parsed.include ?? []).map((pattern) => includeRoot(configDir, pattern)).filter((value) => value !== void 0)
|
|
550
|
-
];
|
|
551
|
-
const candidates = [
|
|
552
|
-
...roots.flatMap((root) => [
|
|
553
|
-
path2.join(root, "index.ts"),
|
|
554
|
-
path2.join(root, "index.tsx")
|
|
555
|
-
]),
|
|
556
|
-
path2.join(configDir, "src", "index.ts"),
|
|
557
|
-
path2.join(configDir, "src", "index.tsx"),
|
|
558
|
-
path2.join(configDir, "index.ts"),
|
|
559
|
-
path2.join(configDir, "index.tsx")
|
|
560
|
-
];
|
|
561
|
-
for (const candidate of candidates) {
|
|
562
|
-
try {
|
|
563
|
-
if (fs3.statSync(candidate).isFile())
|
|
564
|
-
return candidate;
|
|
565
|
-
} catch {
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
return void 0;
|
|
569
|
-
}
|
|
570
|
-
function collectReferencedProjects(configPath, result, visited) {
|
|
571
|
-
const normalized = path2.resolve(configPath);
|
|
572
|
-
if (visited.has(normalized))
|
|
573
|
-
return;
|
|
574
|
-
visited.add(normalized);
|
|
575
|
-
const parsed = readConfig(normalized, /* @__PURE__ */ new Set());
|
|
576
|
-
if (!parsed)
|
|
577
|
-
return;
|
|
578
|
-
for (const reference of parsed.references) {
|
|
579
|
-
const referencedConfig = resolveReferenceConfig(normalized, reference);
|
|
580
|
-
if (!referencedConfig)
|
|
581
|
-
continue;
|
|
582
|
-
const referenced = readConfig(referencedConfig, /* @__PURE__ */ new Set());
|
|
583
|
-
if (referenced) {
|
|
584
|
-
const packageJsonPath = getDirectoryMarkers(path2.dirname(referencedConfig)).packageJsonPath;
|
|
585
|
-
const entry = firstSourceEntry(referencedConfig, referenced);
|
|
586
|
-
if (packageJsonPath && entry) {
|
|
587
|
-
try {
|
|
588
|
-
const pkg = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
589
|
-
if (typeof pkg.name === "string" && !result.has(pkg.name)) {
|
|
590
|
-
result.set(pkg.name, entry);
|
|
591
|
-
}
|
|
592
|
-
} catch {
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
collectReferencedProjects(referencedConfig, result, visited);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
function parseTsconfigPaths(cwd, homeDir = os.homedir()) {
|
|
600
|
-
const normalizedCwd = path2.resolve(cwd);
|
|
601
|
-
const configDir = findGoverningTsconfigDir(normalizedCwd, homeDir);
|
|
602
|
-
const configPath = configDir ? path2.join(configDir, "tsconfig.json") : "";
|
|
603
|
-
const signature = configPath ? dependencySignature(configPath) : "missing";
|
|
604
|
-
const key = `${normalizedCwd}|${configPath}|${signature}`;
|
|
605
|
-
const cached = cache.get(key);
|
|
606
|
-
if (cached)
|
|
607
|
-
return cached;
|
|
608
|
-
if (!configDir) {
|
|
609
|
-
cache.set(key, []);
|
|
610
|
-
return [];
|
|
611
|
-
}
|
|
612
|
-
const parsed = readConfig(path2.join(configDir, "tsconfig.json"), /* @__PURE__ */ new Set());
|
|
613
|
-
const matchers = Object.entries(parsed?.paths ?? {}).filter((entry) => Array.isArray(entry[1]) && entry[1].every((target) => typeof target === "string")).map(([pattern, targets]) => {
|
|
614
|
-
const star = pattern.indexOf("*");
|
|
615
|
-
return {
|
|
616
|
-
pattern,
|
|
617
|
-
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
618
|
-
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
619
|
-
targets
|
|
620
|
-
};
|
|
621
|
-
}).sort((a, b) => b.prefix.length - a.prefix.length);
|
|
622
|
-
cache.set(key, matchers);
|
|
623
|
-
return matchers;
|
|
624
|
-
}
|
|
625
|
-
function aliasedImportTargets(specifier, importerDir) {
|
|
626
|
-
for (const matcher of parseTsconfigPaths(importerDir)) {
|
|
627
|
-
if (!specifier.startsWith(matcher.prefix) || !specifier.endsWith(matcher.suffix))
|
|
628
|
-
continue;
|
|
629
|
-
const wildcard = specifier.slice(matcher.prefix.length, specifier.length - matcher.suffix.length);
|
|
630
|
-
if (!matcher.pattern.includes("*") && wildcard)
|
|
631
|
-
continue;
|
|
632
|
-
return matcher.targets.map((target) => target.replaceAll("*", wildcard));
|
|
633
|
-
}
|
|
634
|
-
return [];
|
|
635
|
-
}
|
|
636
|
-
function referencedProjectImportTarget(specifier, importerDir) {
|
|
637
|
-
const normalizedImporterDir = path2.resolve(importerDir);
|
|
638
|
-
const governingDir = findGoverningTsconfigDir(normalizedImporterDir);
|
|
639
|
-
const governingPath = governingDir ? path2.join(governingDir, "tsconfig.json") : "";
|
|
640
|
-
const key = `${normalizedImporterDir}|${governingPath}|${governingPath ? dependencySignature(governingPath) : "missing"}`;
|
|
641
|
-
let projects = referencesCache.get(key);
|
|
642
|
-
if (!projects) {
|
|
643
|
-
projects = /* @__PURE__ */ new Map();
|
|
644
|
-
const configDir = governingDir;
|
|
645
|
-
if (configDir) {
|
|
646
|
-
collectReferencedProjects(path2.join(configDir, "tsconfig.json"), projects, /* @__PURE__ */ new Set());
|
|
647
|
-
}
|
|
648
|
-
referencesCache.set(key, projects);
|
|
649
|
-
}
|
|
650
|
-
return projects.get(specifier);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// dist/clients/review-graph/import-resolvers.js
|
|
654
470
|
function isWithin(cwd, p) {
|
|
655
|
-
return isUnderDir(
|
|
471
|
+
return isUnderDir(path2.resolve(p), path2.resolve(cwd));
|
|
656
472
|
}
|
|
657
473
|
function isFile(p) {
|
|
658
474
|
try {
|
|
659
|
-
return
|
|
475
|
+
return fs3.statSync(p).isFile();
|
|
660
476
|
} catch {
|
|
661
477
|
return false;
|
|
662
478
|
}
|
|
663
479
|
}
|
|
664
480
|
function isDir(p) {
|
|
665
481
|
try {
|
|
666
|
-
return
|
|
482
|
+
return fs3.statSync(p).isDirectory();
|
|
667
483
|
} catch {
|
|
668
484
|
return false;
|
|
669
485
|
}
|
|
@@ -679,13 +495,13 @@ function sourceFilesIn(cwd, dir, ext) {
|
|
|
679
495
|
if (!isDir(dir) || !isWithin(cwd, dir))
|
|
680
496
|
return [];
|
|
681
497
|
try {
|
|
682
|
-
return
|
|
498
|
+
return fs3.readdirSync(dir).filter((n) => n.endsWith(ext)).map((n) => normalizeMapKey(path2.join(dir, n))).sort();
|
|
683
499
|
} catch {
|
|
684
500
|
return [];
|
|
685
501
|
}
|
|
686
502
|
}
|
|
687
503
|
function resolveRelative(cwd, filePath, source, exts) {
|
|
688
|
-
const base =
|
|
504
|
+
const base = path2.resolve(path2.dirname(filePath), source);
|
|
689
505
|
return firstExistingFile(cwd, [base, ...exts.map((e) => base + e)]);
|
|
690
506
|
}
|
|
691
507
|
function resolveDart(cwd, filePath, source) {
|
|
@@ -716,15 +532,15 @@ function jsTsExtensionCandidates(base, strippedBase, ext) {
|
|
|
716
532
|
"index.mjs",
|
|
717
533
|
"index.cjs"
|
|
718
534
|
]) {
|
|
719
|
-
candidates.push(
|
|
535
|
+
candidates.push(path2.join(base, index));
|
|
720
536
|
}
|
|
721
537
|
return [...new Set(candidates)];
|
|
722
538
|
}
|
|
723
539
|
function jsTsCandidatePaths(filePath, source) {
|
|
724
|
-
const base =
|
|
540
|
+
const base = path2.resolve(path2.dirname(filePath), source);
|
|
725
541
|
const strippedSource = source.replace(JS_TS_EXT_RE, "");
|
|
726
|
-
const strippedBase = strippedSource === source ? base :
|
|
727
|
-
const ext =
|
|
542
|
+
const strippedBase = strippedSource === source ? base : path2.resolve(path2.dirname(filePath), strippedSource);
|
|
543
|
+
const ext = path2.extname(source).toLowerCase();
|
|
728
544
|
return jsTsExtensionCandidates(base, strippedBase, ext);
|
|
729
545
|
}
|
|
730
546
|
function findWorkspaceModuleForSpecifier(modules, source) {
|
|
@@ -763,32 +579,32 @@ function pickExportsMain(exportsField) {
|
|
|
763
579
|
function workspaceEntryCandidates(pkgRoot) {
|
|
764
580
|
let main;
|
|
765
581
|
try {
|
|
766
|
-
const pkg = JSON.parse(
|
|
582
|
+
const pkg = JSON.parse(fs3.readFileSync(path2.join(pkgRoot, "package.json"), "utf-8"));
|
|
767
583
|
main = pickExportsMain(pkg.exports) ?? pkg.module ?? pkg.main;
|
|
768
584
|
} catch {
|
|
769
585
|
}
|
|
770
586
|
const candidates = [];
|
|
771
587
|
if (main) {
|
|
772
|
-
const mainPath =
|
|
773
|
-
const ext =
|
|
588
|
+
const mainPath = path2.resolve(pkgRoot, main);
|
|
589
|
+
const ext = path2.extname(mainPath).toLowerCase();
|
|
774
590
|
const stripped = mainPath.replace(JS_TS_EXT_RE, "");
|
|
775
591
|
candidates.push(...jsTsExtensionCandidates(mainPath, stripped, ext));
|
|
776
592
|
}
|
|
777
|
-
for (const base of [pkgRoot,
|
|
778
|
-
candidates.push(
|
|
593
|
+
for (const base of [pkgRoot, path2.join(pkgRoot, "src")]) {
|
|
594
|
+
candidates.push(path2.join(base, "index.ts"), path2.join(base, "index.tsx"), path2.join(base, "index.mts"), path2.join(base, "index.cts"), path2.join(base, "index.js"), path2.join(base, "index.jsx"), path2.join(base, "index.mjs"), path2.join(base, "index.cjs"));
|
|
779
595
|
}
|
|
780
596
|
return [...new Set(candidates)];
|
|
781
597
|
}
|
|
782
598
|
function workspaceSubpathCandidates(pkgRoot, subpath) {
|
|
783
|
-
const base =
|
|
599
|
+
const base = path2.join(pkgRoot, subpath);
|
|
784
600
|
const strippedSubpath = subpath.replace(JS_TS_EXT_RE, "");
|
|
785
|
-
const strippedBase = strippedSubpath === subpath ? base :
|
|
786
|
-
const ext =
|
|
601
|
+
const strippedBase = strippedSubpath === subpath ? base : path2.join(pkgRoot, strippedSubpath);
|
|
602
|
+
const ext = path2.extname(subpath).toLowerCase();
|
|
787
603
|
return jsTsExtensionCandidates(base, strippedBase, ext);
|
|
788
604
|
}
|
|
789
605
|
function resolveAliasedImport(cwd, specifier, importerDir) {
|
|
790
606
|
for (const target of aliasedImportTargets(specifier, importerDir)) {
|
|
791
|
-
const ext =
|
|
607
|
+
const ext = path2.extname(target).toLowerCase();
|
|
792
608
|
const stripped = target.replace(JS_TS_EXT_RE, "");
|
|
793
609
|
const found = firstExistingFile(cwd, jsTsExtensionCandidates(target, stripped, ext));
|
|
794
610
|
if (found.length)
|
|
@@ -814,10 +630,10 @@ function resolveWorkspacePackageImport(cwd, source) {
|
|
|
814
630
|
}
|
|
815
631
|
function resolveJsTs(cwd, filePath, source) {
|
|
816
632
|
if (!source.startsWith(".")) {
|
|
817
|
-
const aliased = resolveAliasedImport(cwd, source,
|
|
633
|
+
const aliased = resolveAliasedImport(cwd, source, path2.dirname(filePath));
|
|
818
634
|
if (aliased.length)
|
|
819
635
|
return aliased;
|
|
820
|
-
const referenced = resolveProjectReferenceImport(cwd, source,
|
|
636
|
+
const referenced = resolveProjectReferenceImport(cwd, source, path2.dirname(filePath));
|
|
821
637
|
return referenced.length ? referenced : resolveWorkspacePackageImport(cwd, source);
|
|
822
638
|
}
|
|
823
639
|
return firstExistingFile(cwd, jsTsCandidatePaths(filePath, source));
|
|
@@ -825,28 +641,28 @@ function resolveJsTs(cwd, filePath, source) {
|
|
|
825
641
|
function resolveCxx(cwd, filePath, source) {
|
|
826
642
|
if (source.startsWith("<"))
|
|
827
643
|
return [];
|
|
828
|
-
const dir =
|
|
644
|
+
const dir = path2.dirname(path2.resolve(filePath));
|
|
829
645
|
return firstExistingFile(cwd, [
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
646
|
+
path2.resolve(dir, source),
|
|
647
|
+
path2.resolve(cwd, source),
|
|
648
|
+
path2.resolve(cwd, "include", source),
|
|
649
|
+
path2.resolve(cwd, "src", source)
|
|
834
650
|
]);
|
|
835
651
|
}
|
|
836
652
|
function pythonRoots(cwd, fileDir) {
|
|
837
653
|
let p = fileDir;
|
|
838
|
-
const root =
|
|
839
|
-
while (isFile(
|
|
840
|
-
const parent =
|
|
654
|
+
const root = path2.resolve(cwd);
|
|
655
|
+
while (isFile(path2.join(p, "__init__.py")) && isWithin(cwd, p)) {
|
|
656
|
+
const parent = path2.dirname(p);
|
|
841
657
|
if (parent === p)
|
|
842
658
|
break;
|
|
843
659
|
p = parent;
|
|
844
660
|
}
|
|
845
|
-
const roots = /* @__PURE__ */ new Set([p, root,
|
|
661
|
+
const roots = /* @__PURE__ */ new Set([p, root, path2.join(root, "src")]);
|
|
846
662
|
return [...roots].filter((r) => isDir(r));
|
|
847
663
|
}
|
|
848
664
|
function resolvePython(cwd, filePath, source) {
|
|
849
|
-
const fileDir =
|
|
665
|
+
const fileDir = path2.dirname(path2.resolve(filePath));
|
|
850
666
|
if (source.startsWith(".")) {
|
|
851
667
|
const m = source.match(/^(\.+)(.*)$/);
|
|
852
668
|
if (!m)
|
|
@@ -854,20 +670,20 @@ function resolvePython(cwd, filePath, source) {
|
|
|
854
670
|
const dots = m[1].length;
|
|
855
671
|
let baseDir = fileDir;
|
|
856
672
|
for (let i = 1; i < dots; i++)
|
|
857
|
-
baseDir =
|
|
673
|
+
baseDir = path2.dirname(baseDir);
|
|
858
674
|
const rest = m[2] ? m[2].split(".") : [];
|
|
859
|
-
const target =
|
|
675
|
+
const target = path2.join(baseDir, ...rest);
|
|
860
676
|
return firstExistingFile(cwd, [
|
|
861
677
|
`${target}.py`,
|
|
862
|
-
|
|
678
|
+
path2.join(target, "__init__.py")
|
|
863
679
|
]);
|
|
864
680
|
}
|
|
865
681
|
const parts = source.split(".");
|
|
866
682
|
for (const root of pythonRoots(cwd, fileDir)) {
|
|
867
|
-
const target =
|
|
683
|
+
const target = path2.join(root, ...parts);
|
|
868
684
|
const found = firstExistingFile(cwd, [
|
|
869
685
|
`${target}.py`,
|
|
870
|
-
|
|
686
|
+
path2.join(target, "__init__.py")
|
|
871
687
|
]);
|
|
872
688
|
if (found.length)
|
|
873
689
|
return found;
|
|
@@ -875,11 +691,11 @@ function resolvePython(cwd, filePath, source) {
|
|
|
875
691
|
return [];
|
|
876
692
|
}
|
|
877
693
|
function findGoModule(cwd, filePath) {
|
|
878
|
-
let dir =
|
|
879
|
-
const root =
|
|
694
|
+
let dir = path2.dirname(path2.resolve(filePath));
|
|
695
|
+
const root = path2.resolve(cwd);
|
|
880
696
|
while (true) {
|
|
881
697
|
try {
|
|
882
|
-
const content =
|
|
698
|
+
const content = fs3.readFileSync(path2.join(dir, "go.mod"), "utf-8");
|
|
883
699
|
const m = content.match(/^[^\S\n\r\u2028\u2029]*module\s+(\S+)/m);
|
|
884
700
|
if (m)
|
|
885
701
|
return { moduleDir: dir, modulePath: m[1] };
|
|
@@ -887,7 +703,7 @@ function findGoModule(cwd, filePath) {
|
|
|
887
703
|
}
|
|
888
704
|
if (dir === root)
|
|
889
705
|
break;
|
|
890
|
-
const parent =
|
|
706
|
+
const parent = path2.dirname(dir);
|
|
891
707
|
if (parent === dir || !isWithin(cwd, parent))
|
|
892
708
|
break;
|
|
893
709
|
dir = parent;
|
|
@@ -902,20 +718,20 @@ function resolveGo(cwd, filePath, source) {
|
|
|
902
718
|
return [];
|
|
903
719
|
}
|
|
904
720
|
const rel = source === mod.modulePath ? "" : source.slice(mod.modulePath.length + 1);
|
|
905
|
-
return sourceFilesIn(cwd,
|
|
721
|
+
return sourceFilesIn(cwd, path2.join(mod.moduleDir, rel), ".go");
|
|
906
722
|
}
|
|
907
723
|
function javaSourceRoots(cwd, filePath) {
|
|
908
|
-
const root =
|
|
724
|
+
const root = path2.resolve(cwd);
|
|
909
725
|
const roots = /* @__PURE__ */ new Set();
|
|
910
726
|
for (const c of ["src/main/java", "src/test/java", "src", ""]) {
|
|
911
|
-
roots.add(
|
|
727
|
+
roots.add(path2.join(root, c));
|
|
912
728
|
}
|
|
913
|
-
let p =
|
|
729
|
+
let p = path2.dirname(path2.resolve(filePath));
|
|
914
730
|
while (true) {
|
|
915
731
|
roots.add(p);
|
|
916
732
|
if (p === root)
|
|
917
733
|
break;
|
|
918
|
-
const parent =
|
|
734
|
+
const parent = path2.dirname(p);
|
|
919
735
|
if (parent === p || !isWithin(cwd, parent))
|
|
920
736
|
break;
|
|
921
737
|
p = parent;
|
|
@@ -926,16 +742,16 @@ function resolveJava(cwd, filePath, source) {
|
|
|
926
742
|
const parts = source.split(".");
|
|
927
743
|
for (const root of javaSourceRoots(cwd, filePath)) {
|
|
928
744
|
const asFile = firstExistingFile(cwd, [
|
|
929
|
-
`${
|
|
745
|
+
`${path2.join(root, ...parts)}.java`
|
|
930
746
|
]);
|
|
931
747
|
if (asFile.length)
|
|
932
748
|
return asFile;
|
|
933
|
-
const asPkg = sourceFilesIn(cwd,
|
|
749
|
+
const asPkg = sourceFilesIn(cwd, path2.join(root, ...parts), ".java");
|
|
934
750
|
if (asPkg.length)
|
|
935
751
|
return asPkg;
|
|
936
752
|
if (parts.length > 1) {
|
|
937
753
|
const dropLast = firstExistingFile(cwd, [
|
|
938
|
-
`${
|
|
754
|
+
`${path2.join(root, ...parts.slice(0, -1))}.java`
|
|
939
755
|
]);
|
|
940
756
|
if (dropLast.length)
|
|
941
757
|
return dropLast;
|
|
@@ -948,8 +764,8 @@ function importSourceNameParts(source) {
|
|
|
948
764
|
}
|
|
949
765
|
function fileAnswerNames(file) {
|
|
950
766
|
return [
|
|
951
|
-
|
|
952
|
-
|
|
767
|
+
path2.basename(file).split(".")[0] ?? "",
|
|
768
|
+
path2.basename(path2.dirname(file))
|
|
953
769
|
].flatMap((name) => name.length > 0 ? [name] : []);
|
|
954
770
|
}
|
|
955
771
|
function resolveImportToFiles(cwd, filePath, languageId, source) {
|
|
@@ -982,7 +798,7 @@ function resolveImportToFiles(cwd, filePath, languageId, source) {
|
|
|
982
798
|
}
|
|
983
799
|
|
|
984
800
|
// dist/clients/tree-sitter-symbol-extractor.js
|
|
985
|
-
import * as
|
|
801
|
+
import * as path3 from "node:path";
|
|
986
802
|
var SYMBOL_QUERIES = {
|
|
987
803
|
typescript: {
|
|
988
804
|
defs: `
|
|
@@ -1529,7 +1345,7 @@ function symbolExtractionGrammar(kind, filePath) {
|
|
|
1529
1345
|
const kindGrammar = KIND_TO_GRAMMAR[kind];
|
|
1530
1346
|
if (!kindGrammar)
|
|
1531
1347
|
return void 0;
|
|
1532
|
-
const byExtension = filePath ? EXTENSION_TO_GRAMMAR[
|
|
1348
|
+
const byExtension = filePath ? EXTENSION_TO_GRAMMAR[path3.extname(filePath).toLowerCase()] : void 0;
|
|
1533
1349
|
const grammar = byExtension ?? kindGrammar;
|
|
1534
1350
|
return grammar in SYMBOL_QUERIES ? grammar : void 0;
|
|
1535
1351
|
}
|
|
@@ -1722,7 +1538,7 @@ var TreeSitterSymbolExtractor = class _TreeSitterSymbolExtractor {
|
|
|
1722
1538
|
extract(tree, filePath, content) {
|
|
1723
1539
|
const symbols = [];
|
|
1724
1540
|
const refs = [];
|
|
1725
|
-
const relativePath =
|
|
1541
|
+
const relativePath = path3.relative(process.cwd(), filePath);
|
|
1726
1542
|
if (this.defQuery) {
|
|
1727
1543
|
let lines;
|
|
1728
1544
|
const lineAt = (row) => (lines ??= content.split("\n"))[row] ?? "";
|
|
@@ -2097,7 +1913,7 @@ var GLOBAL_SCOPE_ROLE_MEMO_ENTRIES = 1024;
|
|
|
2097
1913
|
var globalScopeRoleMemo = new BoundedLruCache(GLOBAL_SCOPE_ROLE_MEMO_ENTRIES);
|
|
2098
1914
|
function roleByTextOf(filePath) {
|
|
2099
1915
|
try {
|
|
2100
|
-
return globalScopeRoleByText(
|
|
1916
|
+
return globalScopeRoleByText(fs4.readFileSync(filePath, "utf8"));
|
|
2101
1917
|
} catch {
|
|
2102
1918
|
return void 0;
|
|
2103
1919
|
}
|
|
@@ -2113,7 +1929,7 @@ function createImplicitScopeCheck(runtime, cwd) {
|
|
|
2113
1929
|
return known;
|
|
2114
1930
|
let stat;
|
|
2115
1931
|
try {
|
|
2116
|
-
stat =
|
|
1932
|
+
stat = fs4.statSync(other);
|
|
2117
1933
|
} catch {
|
|
2118
1934
|
roles.set(other, "none");
|
|
2119
1935
|
return "none";
|
|
@@ -2272,7 +2088,7 @@ function _getForwardImportParsesForTests() {
|
|
|
2272
2088
|
async function forwardImportSources(filePath, languageId) {
|
|
2273
2089
|
let stat;
|
|
2274
2090
|
try {
|
|
2275
|
-
stat =
|
|
2091
|
+
stat = fs4.statSync(filePath);
|
|
2276
2092
|
} catch {
|
|
2277
2093
|
return void 0;
|
|
2278
2094
|
}
|
|
@@ -2289,7 +2105,7 @@ async function forwardImportSources(filePath, languageId) {
|
|
|
2289
2105
|
return void 0;
|
|
2290
2106
|
let content;
|
|
2291
2107
|
try {
|
|
2292
|
-
content =
|
|
2108
|
+
content = fs4.readFileSync(filePath, "utf-8");
|
|
2293
2109
|
} catch {
|
|
2294
2110
|
return void 0;
|
|
2295
2111
|
}
|
|
@@ -2348,7 +2164,7 @@ function extractForwardImportPaths(cwd, filePath) {
|
|
|
2348
2164
|
}
|
|
2349
2165
|
async function statSignature(filePath) {
|
|
2350
2166
|
try {
|
|
2351
|
-
const stat = await
|
|
2167
|
+
const stat = await fs4.promises.stat(filePath);
|
|
2352
2168
|
return { mtimeMs: stat.mtimeMs, size: stat.size };
|
|
2353
2169
|
} catch {
|
|
2354
2170
|
return void 0;
|
|
@@ -2356,7 +2172,7 @@ async function statSignature(filePath) {
|
|
|
2356
2172
|
}
|
|
2357
2173
|
async function statMtimeMs(filePath) {
|
|
2358
2174
|
try {
|
|
2359
|
-
const stat = await
|
|
2175
|
+
const stat = await fs4.promises.stat(filePath);
|
|
2360
2176
|
return stat.mtimeMs;
|
|
2361
2177
|
} catch {
|
|
2362
2178
|
return void 0;
|
|
@@ -2369,7 +2185,7 @@ async function detectSelfDrift(args) {
|
|
|
2369
2185
|
hook: "turn_end",
|
|
2370
2186
|
label
|
|
2371
2187
|
});
|
|
2372
|
-
const stat = await bounded(
|
|
2188
|
+
const stat = await bounded(fs4.promises.stat(args.filePath), boundOptions("selfDriftStat"));
|
|
2373
2189
|
if (stat === void 0)
|
|
2374
2190
|
return { verdict: "unverifiable", unverifiableReason: "stat-unavailable" };
|
|
2375
2191
|
if (args.recordedSize === void 0)
|
|
@@ -2385,7 +2201,7 @@ async function detectSelfDrift(args) {
|
|
|
2385
2201
|
unverifiableReason: "hash-budget-exhausted"
|
|
2386
2202
|
};
|
|
2387
2203
|
}
|
|
2388
|
-
const content = await bounded(
|
|
2204
|
+
const content = await bounded(fs4.promises.readFile(args.filePath), boundOptions("selfDriftHash"));
|
|
2389
2205
|
if (content === void 0)
|
|
2390
2206
|
return { verdict: "unverifiable", unverifiableReason: "hash-unavailable" };
|
|
2391
2207
|
args.budget.bytesLeft -= content.byteLength;
|
|
@@ -2641,6 +2457,8 @@ async function sweepInlineBlockerFreshness(runtime, cwd, options) {
|
|
|
2641
2457
|
export {
|
|
2642
2458
|
getRunnerTimeoutFloorMs,
|
|
2643
2459
|
RUNTIME_CONFIG,
|
|
2460
|
+
scanDocumentContent,
|
|
2461
|
+
lineTextAt,
|
|
2644
2462
|
exceedsLspSyncLimits,
|
|
2645
2463
|
loadAstGrepNapi,
|
|
2646
2464
|
isGoSourceFile,
|