pi-lens 4.4.3 → 4.4.5
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 +721 -0
- package/README.md +25 -3
- package/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/dist/chunk-22Y2BM7H.js +23 -0
- package/dist/{chunk-WU567RSC.js → chunk-27VWVB23.js} +16 -14
- package/dist/{chunk-FLKWCIZH.js → chunk-2FYKETQJ.js} +10 -6
- package/dist/{chunk-MQLUAEOC.js → chunk-2LDMXL2M.js} +2 -2
- package/dist/{chunk-YSZNHOBY.js → chunk-2SDHYHHO.js} +17 -17
- package/dist/chunk-2Y6OJRSI.js +38 -0
- package/dist/chunk-3SNDVPOR.js +507 -0
- package/dist/{chunk-EJIUXPBX.js → chunk-3WCEHYOI.js} +1 -1
- package/dist/chunk-44X7VIKR.js +73 -0
- package/dist/{chunk-Q7DUK4LX.js → chunk-4FHUGDKU.js} +16 -14
- package/dist/{chunk-H6MF6EVN.js → chunk-4ODSZ35Z.js} +1498 -534
- package/dist/{chunk-ZGDGW2V3.js → chunk-4U7GDSZQ.js} +2 -2
- package/dist/chunk-54NIOJJZ.js +25 -0
- package/dist/{chunk-ZWFS3OEF.js → chunk-5DKE4HGX.js} +38 -37
- package/dist/{chunk-VRZP76YM.js → chunk-5LRUKYFA.js} +34 -4
- package/dist/{chunk-QOBUHWHX.js → chunk-63NMUNYP.js} +12 -16
- package/dist/{chunk-VWCXW2E7.js → chunk-6XSESGWD.js} +13 -6
- package/dist/{chunk-QGQ5CCCG.js → chunk-72J27ICO.js} +2 -3
- package/dist/{chunk-CSHFH5IN.js → chunk-7FLRUH6B.js} +1 -1
- package/dist/chunk-7IYC4ENJ.js +297 -0
- package/dist/chunk-7WWQAW5P.js +30 -0
- package/dist/{chunk-EU63SDCG.js → chunk-7ZS7MC24.js} +885 -451
- package/dist/{chunk-KBG47GHP.js → chunk-AHWA4AKM.js} +18 -12
- package/dist/{chunk-FMSO6RDZ.js → chunk-AI3GP74G.js} +17 -19
- package/dist/chunk-APFJKOP6.js +67 -0
- package/dist/{chunk-RXCOMYPY.js → chunk-ASRAO7KG.js} +31 -33
- package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/dist/{chunk-QILIYSJF.js → chunk-CG5V25HX.js} +1 -1
- package/dist/chunk-CKEQFGLT.js +32 -0
- package/dist/{chunk-RPLINGVB.js → chunk-COOUUC5W.js} +6 -6
- package/dist/{chunk-GBPP5P7X.js → chunk-CPZ5JJW6.js} +4 -4
- package/dist/{chunk-OCAGUNBC.js → chunk-DS2USX5G.js} +13 -15
- package/dist/chunk-EA2ZRG44.js +27 -0
- package/dist/{chunk-ZHFZWTZV.js → chunk-EDMLIW6W.js} +13 -14
- package/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
- package/dist/chunk-EKNWOL2I.js +27 -0
- package/dist/{chunk-CMMHNUZ2.js → chunk-ELZRSR5N.js} +65 -43
- package/dist/{chunk-BKE7E7TC.js → chunk-EN5AM7PX.js} +11 -12
- package/dist/{chunk-N2H3ZPZY.js → chunk-EWXXLS26.js} +227 -24
- package/dist/chunk-EX4EXBW7.js +37 -0
- package/dist/{chunk-YYOIQFRS.js → chunk-EXVXBSGN.js} +130 -52
- package/dist/{chunk-6GFRNVYR.js → chunk-F7BO6FWH.js} +12 -13
- package/dist/chunk-FEDWAYDS.js +2485 -0
- package/dist/{chunk-JAU72XNY.js → chunk-FWZRGGGY.js} +73 -9
- package/dist/{chunk-GXW6K4YJ.js → chunk-G224FADB.js} +1 -1
- package/dist/chunk-G5UCJFT7.js +26 -0
- package/dist/{chunk-67WMNWEE.js → chunk-GLW3YDZZ.js} +22 -13
- package/dist/{chunk-724UL2TJ.js → chunk-GTDSYEA2.js} +72 -39
- package/dist/{chunk-PHDMFAKM.js → chunk-GYRZ72R4.js} +10 -4
- package/dist/chunk-HYVXA3BB.js +49 -0
- package/dist/{chunk-SAEFPSB6.js → chunk-IEBJF3PN.js} +23 -15
- package/dist/chunk-IJYGIDF4.js +186 -0
- package/dist/{chunk-ACXEQZOU.js → chunk-IL7K66ZQ.js} +101 -109
- package/dist/{chunk-ZXYDQ3TZ.js → chunk-JWOVP5BL.js} +50 -19
- package/dist/{chunk-OXXKQCSV.js → chunk-K2GUZ4DN.js} +4 -4
- package/dist/{chunk-AW7R2GWG.js → chunk-K4SZB56V.js} +39 -39
- package/dist/{chunk-WOA4LN2R.js → chunk-KCBRHV5E.js} +3 -3
- package/dist/{chunk-3W7IEVVL.js → chunk-KFXCL4OV.js} +47 -45
- package/dist/{chunk-2BBLFX75.js → chunk-KJJAVH3X.js} +81 -15
- package/dist/{chunk-VCHXCQFG.js → chunk-KPVLQHCZ.js} +4 -6
- package/dist/{chunk-P7266HLM.js → chunk-KX56K73G.js} +10 -13
- package/dist/{chunk-VSSBEUFT.js → chunk-LMCTHJ2H.js} +19 -19
- package/dist/{chunk-IBGIOBEE.js → chunk-MEFLGBCS.js} +69 -8
- package/dist/{chunk-TYM6OUIT.js → chunk-MKPCELNI.js} +17 -17
- package/dist/{chunk-XTMJ7XDT.js → chunk-N3PLNNCW.js} +1 -1
- package/dist/chunk-N5FBM25N.js +22 -0
- package/dist/{chunk-CHOW74WE.js → chunk-NFNVDDGB.js} +7 -12
- package/dist/{chunk-52FUZI6K.js → chunk-NLIVE7L6.js} +2 -30
- package/dist/{chunk-SS36ZX4J.js → chunk-OMJ3OFBJ.js} +6 -6
- package/dist/{chunk-4W4VLAPJ.js → chunk-OZNCKLOX.js} +13 -14
- package/dist/chunk-P5XUGPIX.js +31 -0
- package/dist/{chunk-5UCAH366.js → chunk-PJXNTPB2.js} +253 -33
- package/dist/chunk-PKOXJIVT.js +88 -0
- package/dist/{chunk-6C7JWPCP.js → chunk-PP2A5V2T.js} +27 -26
- package/dist/{chunk-L3BLXZG7.js → chunk-Q42LJANT.js} +31 -70
- package/dist/{chunk-AB3YYG6N.js → chunk-Q4BKKOVC.js} +8 -8
- package/dist/{chunk-3EFKIGZN.js → chunk-QT66NEYN.js} +4 -4
- package/dist/{chunk-3VPVG5SU.js → chunk-RCHO5W7M.js} +19 -18
- package/dist/{chunk-77M37OKR.js → chunk-RG3MXTRI.js} +7 -7
- package/dist/chunk-RG7OODGM.js +57 -0
- package/dist/{chunk-T6CPIZNT.js → chunk-RU34BA4D.js} +44 -39
- package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/dist/{chunk-5NGR67U5.js → chunk-S55TEC7I.js} +33 -5
- package/dist/{chunk-M6HSLBWY.js → chunk-SJHC3BCZ.js} +7956 -8047
- package/dist/{chunk-XCJN5IJU.js → chunk-SNEUMLM7.js} +4 -4
- package/dist/{chunk-UZ3TUTRV.js → chunk-T4NGVFYI.js} +2 -2
- package/dist/{chunk-2VUQMUMT.js → chunk-THEXI2QO.js} +49 -43
- package/dist/{chunk-R3PCY3YS.js → chunk-TL2TCJYL.js} +15 -16
- package/dist/{chunk-C34ZXZ7O.js → chunk-TPYYEDP5.js} +838 -352
- package/dist/{chunk-AOHZU2BM.js → chunk-TVZRLTG6.js} +8 -1
- package/dist/{chunk-XMSXXAHW.js → chunk-UCVMSOXF.js} +2 -2
- package/dist/chunk-UL5SXQVX.js +32 -0
- package/dist/{chunk-GAEGEPOC.js → chunk-UO66IMVP.js} +2 -2
- package/dist/{chunk-N3X6Q4YT.js → chunk-UVY4TOJH.js} +3 -3
- package/dist/{chunk-2CD5RS6M.js → chunk-VIDEKABZ.js} +23 -2
- package/dist/{chunk-JSQFTSC6.js → chunk-VITFDI3O.js} +13 -14
- package/dist/{chunk-YIUAVF7E.js → chunk-VUAVE3QC.js} +42 -42
- package/dist/{chunk-QOZXJ4NA.js → chunk-WUY4BZEP.js} +21 -20
- package/dist/{chunk-VCO24T4L.js → chunk-X3UTCXAA.js} +43 -53
- package/dist/chunk-XHDBJODR.js +45 -0
- package/dist/{chunk-MXGY6KPT.js → chunk-XHLK33VM.js} +28 -21
- package/dist/{chunk-RWWYJ623.js → chunk-XI34NWDI.js} +2 -2
- package/dist/{chunk-QQNQ7SJW.js → chunk-XWFIHYCH.js} +12 -4
- package/dist/{chunk-6SDEP3AJ.js → chunk-Y2TPADJR.js} +10 -11
- package/dist/{chunk-MRXKYPCS.js → chunk-Y5KTA2OB.js} +17 -17
- package/dist/{chunk-7DYBLXYA.js → chunk-YKVDBNPO.js} +11 -5
- package/dist/{chunk-2B73ZPOK.js → chunk-YSDPVDFC.js} +3 -3
- package/dist/chunk-YWNO5Q4R.js +44 -0
- package/dist/{chunk-QHJ6DQ2R.js → chunk-YWWG4AQA.js} +165 -32
- package/dist/{chunk-3JNKMP3B.js → chunk-YXDCRUKQ.js} +4 -4
- package/dist/{chunk-UXGETRP4.js → chunk-YXGRRORB.js} +16 -17
- package/dist/{chunk-SQ4TVJBR.js → chunk-ZAPSUBLU.js} +13 -7
- package/dist/{chunk-76MWC2K6.js → chunk-ZPJM7DID.js} +90 -97
- package/dist/{chunk-XVF2VVXP.js → chunk-ZSUX7KEM.js} +16 -15
- package/dist/index.js +31038 -20893
- package/dist/mcp/analyze-cli.js +11 -11
- package/dist/mcp/cli.js +47 -43
- package/dist/mcp/server.js +2188 -906
- package/dist/mcp/worker.js +66 -63
- package/dist/probes/installer.js +21 -23
- package/dist/workers/project-snapshot-persist-worker.js +28 -9
- package/dist/workers/review-graph-persist-worker.js +1 -1
- package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/docs/adr/README.md +1 -0
- package/docs/ast-grep_rules_catalog.md +5 -3
- package/docs/configuration.md +20 -0
- package/docs/engineering-principles.md +44 -0
- package/docs/environment-variables.md +20 -0
- package/docs/features.md +16 -1
- package/docs/globalconfig.md +37 -8
- package/docs/lsp-capability-matrix.md +105 -12
- package/docs/lsp-idle-eviction.md +44 -36
- package/docs/pi-lens-fixer.md +139 -14
- package/docs/pi-lens-investigator.md +14 -0
- package/docs/pi-lens-merge-policy.md +120 -17
- package/docs/pi-lens-monitor.md +71 -9
- package/docs/pi-lens-retro.md +6 -3
- package/docs/pi-lens-reviewer.md +160 -5
- package/docs/pi-lens-subagent.md +29 -14
- package/docs/release-qa-baseline.md +21 -7
- package/docs/servercapabilities.md +53 -63
- package/docs/settings.md +9 -5
- package/docs/subagent-compat.md +1 -1
- package/docs/usage.md +1 -0
- package/package.json +9 -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/download-grammars.js +40 -7
- package/scripts/lib/is-main-module.mjs +27 -0
- package/scripts/lib/latency-log-phases.mjs +95 -0
- package/scripts/lib/scratch-home-env.mjs +21 -0
- package/scripts/rpc-load-check.mjs +568 -81
- package/scripts/warm-loader-cache.mjs +2 -5
- package/dist/chunk-23WOO7TX.js +0 -23
- package/dist/chunk-3YN6V5TV.js +0 -85
- package/dist/chunk-466Z26MG.js +0 -30
- package/dist/chunk-4UNXBNE2.js +0 -24
- package/dist/chunk-6STA6Z7I.js +0 -47
- package/dist/chunk-ABBOA7UD.js +0 -157
- package/dist/chunk-BRGDSBJE.js +0 -28
- package/dist/chunk-EC47DWFA.js +0 -56
- package/dist/chunk-FCSOVF55.js +0 -273
- package/dist/chunk-IZSHAIJ7.js +0 -26
- package/dist/chunk-KDERNTCQ.js +0 -28
- package/dist/chunk-KSX3TXSZ.js +0 -69
- package/dist/chunk-LOP6GRPH.js +0 -31
- package/dist/chunk-PNQDPDRC.js +0 -184
- package/dist/chunk-UOPVJQ4N.js +0 -103
- package/dist/chunk-XAGLWMJ4.js +0 -51
- package/dist/chunk-XIJZVPD5.js +0 -39
- package/dist/chunk-Z3CCVDUB.js +0 -76
- package/dist/chunk-Z527N6YQ.js +0 -28
- package/dist/chunk-ZANLILYD.js +0 -79
- /package/dist/{chunk-FC4RP4I2.js → chunk-6HWVI6MI.js} +0 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
parseJsonc
|
|
4
|
+
} from "./chunk-7IYC4ENJ.js";
|
|
5
|
+
import {
|
|
6
|
+
extractTomlTableSection,
|
|
7
|
+
hasTomlTable,
|
|
8
|
+
parseTomlScalarString,
|
|
9
|
+
parseTomlStringArray
|
|
10
|
+
} from "./chunk-KX56K73G.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveLanguage
|
|
13
|
+
} from "./chunk-GTDSYEA2.js";
|
|
14
|
+
import {
|
|
15
|
+
getProjectTrustState
|
|
16
|
+
} from "./chunk-EIKRZ32J.js";
|
|
17
|
+
import {
|
|
18
|
+
incrementDegradationCount,
|
|
19
|
+
recordDegradationOnce
|
|
20
|
+
} from "./chunk-FWZRGGGY.js";
|
|
21
|
+
import {
|
|
22
|
+
logExtension
|
|
23
|
+
} from "./chunk-N3PLNNCW.js";
|
|
24
|
+
import {
|
|
25
|
+
logLatency
|
|
26
|
+
} from "./chunk-XWFIHYCH.js";
|
|
27
|
+
import {
|
|
28
|
+
UV_WORKSPACE_EXCLUDE_DIALECT,
|
|
29
|
+
UV_WORKSPACE_MEMBERS_DIALECT,
|
|
30
|
+
matchesWorkspaceMemberPattern,
|
|
31
|
+
realpathOrResolve,
|
|
32
|
+
toPosix,
|
|
33
|
+
walkUpDirs
|
|
34
|
+
} from "./chunk-EWXXLS26.js";
|
|
35
|
+
|
|
36
|
+
// dist/clients/bounded-telemetry.js
|
|
37
|
+
var MAX_TRACKED_TURN_CAPS = 64;
|
|
38
|
+
var turnCounts = /* @__PURE__ */ new Map();
|
|
39
|
+
var latestCountedTurnIndex;
|
|
40
|
+
var retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
|
|
41
|
+
function admitBounded(phase, identity, options = {}) {
|
|
42
|
+
try {
|
|
43
|
+
let isRisingEdge = true;
|
|
44
|
+
if (options.ledgerKind !== void 0) {
|
|
45
|
+
isRisingEdge = incrementDegradationCount({
|
|
46
|
+
kind: options.ledgerKind,
|
|
47
|
+
subject: identity,
|
|
48
|
+
reason: options.reason ?? phase
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (options.risingEdgePer !== void 0 && !isRisingEdge)
|
|
52
|
+
return false;
|
|
53
|
+
return admitAgainstTurnCap(phase, options.capPerTurn);
|
|
54
|
+
} catch {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function emitBounded(phase, identity, payload, options = {}) {
|
|
59
|
+
try {
|
|
60
|
+
if (!admitBounded(phase, identity, options))
|
|
61
|
+
return false;
|
|
62
|
+
logLatency({
|
|
63
|
+
...payload,
|
|
64
|
+
type: payload.type ?? "phase",
|
|
65
|
+
phase,
|
|
66
|
+
// `filePath` is what existing latency.log queries filter on, so a site
|
|
67
|
+
// may keep a coarser one; `metadata.identity` below always carries the
|
|
68
|
+
// full discriminating identity. Aggregation that loses WHICH subject
|
|
69
|
+
// is stuck is the failure AGENTS.md names.
|
|
70
|
+
filePath: payload.filePath ?? identity,
|
|
71
|
+
metadata: { ...payload.metadata, identity }
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function admitAgainstTurnCap(phase, cap) {
|
|
79
|
+
if (cap === void 0)
|
|
80
|
+
return true;
|
|
81
|
+
if (cap.turnIndex <= retiredThroughTurnIndex)
|
|
82
|
+
return false;
|
|
83
|
+
let counts = turnCounts.get(cap.turnIndex);
|
|
84
|
+
if (!counts) {
|
|
85
|
+
if (turnCounts.size >= MAX_TRACKED_TURN_CAPS) {
|
|
86
|
+
const oldestTrackedTurn = Math.min(...turnCounts.keys());
|
|
87
|
+
if (cap.turnIndex < oldestTrackedTurn)
|
|
88
|
+
return false;
|
|
89
|
+
turnCounts.delete(oldestTrackedTurn);
|
|
90
|
+
retiredThroughTurnIndex = Math.max(retiredThroughTurnIndex, oldestTrackedTurn);
|
|
91
|
+
}
|
|
92
|
+
counts = /* @__PURE__ */ new Map();
|
|
93
|
+
turnCounts.set(cap.turnIndex, counts);
|
|
94
|
+
}
|
|
95
|
+
latestCountedTurnIndex = Math.max(latestCountedTurnIndex ?? cap.turnIndex, cap.turnIndex);
|
|
96
|
+
const used = counts.get(phase) ?? 0;
|
|
97
|
+
if (used >= cap.limit)
|
|
98
|
+
return false;
|
|
99
|
+
counts.set(phase, used + 1);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
function resetBoundedTelemetry() {
|
|
103
|
+
turnCounts = /* @__PURE__ */ new Map();
|
|
104
|
+
latestCountedTurnIndex = void 0;
|
|
105
|
+
retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// dist/clients/python-environment.js
|
|
109
|
+
import { access, readFile } from "node:fs/promises";
|
|
110
|
+
import os from "node:os";
|
|
111
|
+
import path, { dirname, join } from "node:path";
|
|
112
|
+
var UV_WORKSPACE_TABLE = "tool\\.uv\\.workspace";
|
|
113
|
+
async function findUvWorkspace(startDir, homeDir) {
|
|
114
|
+
let walkStart;
|
|
115
|
+
let nearestProject;
|
|
116
|
+
for (const dir of walkUpDirs(startDir, { homeDir })) {
|
|
117
|
+
walkStart ??= dir;
|
|
118
|
+
let content;
|
|
119
|
+
try {
|
|
120
|
+
content = await readFile(path.join(dir, "pyproject.toml"), "utf8");
|
|
121
|
+
} catch {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (!nearestProject)
|
|
125
|
+
nearestProject = dir;
|
|
126
|
+
if (hasTomlTable(content, UV_WORKSPACE_TABLE)) {
|
|
127
|
+
const workspaceTable = extractTomlTableSection(content, UV_WORKSPACE_TABLE);
|
|
128
|
+
return {
|
|
129
|
+
root: dir,
|
|
130
|
+
explicit: true,
|
|
131
|
+
projectRoot: nearestProject,
|
|
132
|
+
isStartDir: nearestProject === walkStart,
|
|
133
|
+
members: parseTomlStringArray(workspaceTable, "members"),
|
|
134
|
+
exclude: parseTomlStringArray(workspaceTable, "exclude")
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return nearestProject ? {
|
|
139
|
+
root: nearestProject,
|
|
140
|
+
explicit: false,
|
|
141
|
+
projectRoot: nearestProject,
|
|
142
|
+
isStartDir: nearestProject === walkStart,
|
|
143
|
+
members: [],
|
|
144
|
+
exclude: []
|
|
145
|
+
} : void 0;
|
|
146
|
+
}
|
|
147
|
+
function isUvWorkspaceMember(workspace, projectRoot) {
|
|
148
|
+
const relative = toPosix(path.relative(workspace.root, projectRoot));
|
|
149
|
+
if (relative.length === 0 || relative === ".." || relative.startsWith("../") || path.isAbsolute(relative)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const matches = (dialect) => (pattern) => matchesWorkspaceMemberPattern(pattern, relative, dialect, () => recordDegradationOnce({
|
|
153
|
+
kind: "workspace-glob-cap",
|
|
154
|
+
subject: String(pattern.length),
|
|
155
|
+
reason: "workspace glob matcher exceeded its memo-table cell cap"
|
|
156
|
+
}));
|
|
157
|
+
return !workspace.exclude.some(matches(UV_WORKSPACE_EXCLUDE_DIALECT)) && workspace.members.some(matches(UV_WORKSPACE_MEMBERS_DIALECT));
|
|
158
|
+
}
|
|
159
|
+
var PROJECT_SOURCED_PYTHON_SOURCES = /* @__PURE__ */ new Set([
|
|
160
|
+
"project-dot-venv",
|
|
161
|
+
"project-venv",
|
|
162
|
+
"uv-workspace"
|
|
163
|
+
]);
|
|
164
|
+
var AMBIENT_ENVIRONMENT_VARIABLES = {
|
|
165
|
+
"uv-project-environment": "UV_PROJECT_ENVIRONMENT",
|
|
166
|
+
"virtual-env": "VIRTUAL_ENV",
|
|
167
|
+
conda: "CONDA_PREFIX"
|
|
168
|
+
};
|
|
169
|
+
function hasAmbientPythonEnvironment(env = process.env) {
|
|
170
|
+
return Object.values(AMBIENT_ENVIRONMENT_VARIABLES).some((name) => Boolean(env[name]));
|
|
171
|
+
}
|
|
172
|
+
async function detectPythonEnvironment(projectRoot, homeDir = os.homedir(), options = {}) {
|
|
173
|
+
const root = realpathOrResolve(projectRoot);
|
|
174
|
+
const uvWorkspace = await findUvWorkspace(root, homeDir);
|
|
175
|
+
const isProjectRoot = uvWorkspace?.isStartDir === true;
|
|
176
|
+
const memberWorkspaceRoot = isProjectRoot && uvWorkspace.explicit && isUvWorkspaceMember(uvWorkspace, root) ? uvWorkspace.root : void 0;
|
|
177
|
+
const uvEnvironmentRoot = isProjectRoot ? memberWorkspaceRoot ?? uvWorkspace.projectRoot : void 0;
|
|
178
|
+
const uvProjectEnvironment = process.env.UV_PROJECT_ENVIRONMENT;
|
|
179
|
+
const allowAmbient = options.allowAmbient ?? true;
|
|
180
|
+
const isWithinProjectRoot = (candidateRoot) => {
|
|
181
|
+
const relative = path.relative(root, realpathOrResolve(candidateRoot));
|
|
182
|
+
return relative !== ".." && !relative.startsWith(`..${path.sep}`) && // #3871 V1: another Windows drive has no relative path, so
|
|
183
|
+
// `path.relative` returns the absolute target: no `..`, not inside.
|
|
184
|
+
!path.isAbsolute(relative);
|
|
185
|
+
};
|
|
186
|
+
const candidates = [
|
|
187
|
+
...uvEnvironmentRoot !== void 0 && uvProjectEnvironment ? [
|
|
188
|
+
{
|
|
189
|
+
// `path.resolve` leaves an absolute value untouched and
|
|
190
|
+
// anchors a relative one at the project's workspace root.
|
|
191
|
+
root: path.resolve(uvEnvironmentRoot, uvProjectEnvironment),
|
|
192
|
+
source: "uv-project-environment"
|
|
193
|
+
}
|
|
194
|
+
] : [],
|
|
195
|
+
...memberWorkspaceRoot !== void 0 ? [
|
|
196
|
+
{
|
|
197
|
+
root: path.join(memberWorkspaceRoot, ".venv"),
|
|
198
|
+
source: "uv-workspace"
|
|
199
|
+
}
|
|
200
|
+
] : [],
|
|
201
|
+
{ root: process.env.VIRTUAL_ENV, source: "virtual-env" },
|
|
202
|
+
{ root: process.env.CONDA_PREFIX, source: "conda" },
|
|
203
|
+
{ root: path.join(root, ".venv"), source: "project-dot-venv" },
|
|
204
|
+
{ root: path.join(root, "venv"), source: "project-venv" }
|
|
205
|
+
];
|
|
206
|
+
for (const candidate of candidates) {
|
|
207
|
+
if (!candidate.root)
|
|
208
|
+
continue;
|
|
209
|
+
if (!allowAmbient && candidate.source in AMBIENT_ENVIRONMENT_VARIABLES && !isWithinProjectRoot(candidate.root))
|
|
210
|
+
continue;
|
|
211
|
+
if (PROJECT_SOURCED_PYTHON_SOURCES.has(candidate.source) && getProjectTrustState() !== "trusted") {
|
|
212
|
+
if (recordDegradationOnce({
|
|
213
|
+
kind: "trust-refusal",
|
|
214
|
+
subject: `python-environment:${candidate.root}`,
|
|
215
|
+
reason: `project Python environment refused: pi project trust is ${getProjectTrustState()}`
|
|
216
|
+
})) {
|
|
217
|
+
logExtension({
|
|
218
|
+
subsystem: "project-trust",
|
|
219
|
+
level: "warn",
|
|
220
|
+
message: "project Python environment refused: mark the project trusted in pi or upgrade pi",
|
|
221
|
+
metadata: { source: candidate.source }
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const binDir = path.join(candidate.root, process.platform === "win32" ? "Scripts" : "bin");
|
|
227
|
+
const pythonPath = path.join(binDir, process.platform === "win32" ? "python.exe" : "python");
|
|
228
|
+
try {
|
|
229
|
+
await access(pythonPath);
|
|
230
|
+
return {
|
|
231
|
+
root: candidate.root,
|
|
232
|
+
binDir,
|
|
233
|
+
pythonPath,
|
|
234
|
+
source: candidate.source
|
|
235
|
+
};
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return void 0;
|
|
240
|
+
}
|
|
241
|
+
function augmentPythonEnvironment(baseEnvironment, environment) {
|
|
242
|
+
if (!environment)
|
|
243
|
+
return baseEnvironment;
|
|
244
|
+
const inheritedPath = baseEnvironment.PATH ?? baseEnvironment.Path ?? baseEnvironment.path ?? "";
|
|
245
|
+
const augmentedPath = inheritedPath ? `${environment.binDir}${path.delimiter}${inheritedPath}` : environment.binDir;
|
|
246
|
+
const childEnvironment = {
|
|
247
|
+
...baseEnvironment,
|
|
248
|
+
PATH: augmentedPath,
|
|
249
|
+
VIRTUAL_ENV: environment.root
|
|
250
|
+
};
|
|
251
|
+
if (process.platform === "win32")
|
|
252
|
+
childEnvironment.Path = augmentedPath;
|
|
253
|
+
return childEnvironment;
|
|
254
|
+
}
|
|
255
|
+
function pythonEnvironmentToolCandidates(environment, command) {
|
|
256
|
+
if (!environment)
|
|
257
|
+
return [];
|
|
258
|
+
if (process.platform !== "win32") {
|
|
259
|
+
return [path.join(environment.binDir, command)];
|
|
260
|
+
}
|
|
261
|
+
return [
|
|
262
|
+
path.join(environment.binDir, `${command}.exe`),
|
|
263
|
+
path.join(environment.binDir, `${command}.cmd`),
|
|
264
|
+
path.join(environment.binDir, command)
|
|
265
|
+
];
|
|
266
|
+
}
|
|
267
|
+
var PYTHON_DECLARATION_CONCURRENCY = 8;
|
|
268
|
+
var PYTHON_COMPILE_VERDICT_SERVER_ID = "python-jedi";
|
|
269
|
+
var PYTHON_COMPILE_VERDICT_FLOOR = { major: 3, minor: 14 };
|
|
270
|
+
function isJediCompileVerdict(diagnostic) {
|
|
271
|
+
const server = diagnostic.serverId ?? diagnostic.tool;
|
|
272
|
+
const source = diagnostic.source ?? diagnostic.rule?.split(":")[0];
|
|
273
|
+
return server === PYTHON_COMPILE_VERDICT_SERVER_ID && source === "compile";
|
|
274
|
+
}
|
|
275
|
+
function isJediCompileVerdictOutranked(diagnostic, declared) {
|
|
276
|
+
if (declared === void 0)
|
|
277
|
+
return false;
|
|
278
|
+
if (!isJediCompileVerdict(diagnostic))
|
|
279
|
+
return false;
|
|
280
|
+
return declared.major > PYTHON_COMPILE_VERDICT_FLOOR.major || declared.major === PYTHON_COMPILE_VERDICT_FLOOR.major && declared.minor >= PYTHON_COMPILE_VERDICT_FLOOR.minor;
|
|
281
|
+
}
|
|
282
|
+
function partitionOutrankedPythonCompileVerdicts(diagnostics, declared) {
|
|
283
|
+
const kept = [];
|
|
284
|
+
let dropped = 0;
|
|
285
|
+
for (const diagnostic of diagnostics) {
|
|
286
|
+
if (isJediCompileVerdictOutranked(diagnostic, declared))
|
|
287
|
+
dropped += 1;
|
|
288
|
+
else
|
|
289
|
+
kept.push(diagnostic);
|
|
290
|
+
}
|
|
291
|
+
return { kept, dropped };
|
|
292
|
+
}
|
|
293
|
+
function recordPythonCompileVerdictDrop(file, declared, dropped) {
|
|
294
|
+
recordDegradationOnce({
|
|
295
|
+
kind: "python-compile-target-mismatch",
|
|
296
|
+
subject: file,
|
|
297
|
+
reason: `${dropped} jedi compile ${dropped === 1 ? "finding" : "findings"} dropped: declared Python ${declared.major}.${declared.minor} (${declared.source}) in ${declared.file}`,
|
|
298
|
+
metadata: {
|
|
299
|
+
declared: `${declared.major}.${declared.minor}`,
|
|
300
|
+
source: declared.source,
|
|
301
|
+
declarationFile: declared.file,
|
|
302
|
+
dropped
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function describePythonCompileWithheld(count, declared) {
|
|
307
|
+
return `${count} python-jedi compile finding${count === 1 ? "" : "s"} withheld: the project declares Python ${declared.major}.${declared.minor} (${declared.source}) in ${declared.file}`;
|
|
308
|
+
}
|
|
309
|
+
var BARE_VERSION_PREFIX = /^v?(\d+)\.(\d+)/i;
|
|
310
|
+
var VERSION_SUFFIX = /^[-+._a-z0-9]*$/i;
|
|
311
|
+
var SPECIFIER_LOWER_BOUND = /^(?:>=|==|~=)\s*v?(\d+)\.(\d+)/;
|
|
312
|
+
var RUFF_LEVEL = /^py(\d)(\d+)$/i;
|
|
313
|
+
function reducePythonVersion(match) {
|
|
314
|
+
if (!match)
|
|
315
|
+
return void 0;
|
|
316
|
+
return { major: Number(match[1]), minor: Number(match[2]) };
|
|
317
|
+
}
|
|
318
|
+
function reduceBarePythonVersion(text) {
|
|
319
|
+
const trimmed = text.trim();
|
|
320
|
+
const prefix = BARE_VERSION_PREFIX.exec(trimmed);
|
|
321
|
+
if (!prefix)
|
|
322
|
+
return void 0;
|
|
323
|
+
if (!VERSION_SUFFIX.test(trimmed.slice(prefix[0].length)))
|
|
324
|
+
return void 0;
|
|
325
|
+
return reducePythonVersion(prefix);
|
|
326
|
+
}
|
|
327
|
+
function reducePythonSpecifier(text) {
|
|
328
|
+
let strongest;
|
|
329
|
+
for (const clause of text.split(",")) {
|
|
330
|
+
const lowerBound = reducePythonVersion(SPECIFIER_LOWER_BOUND.exec(clause.trim()));
|
|
331
|
+
if (!lowerBound)
|
|
332
|
+
continue;
|
|
333
|
+
if (!strongest || lowerBound.major > strongest.major || lowerBound.major === strongest.major && lowerBound.minor > strongest.minor) {
|
|
334
|
+
strongest = lowerBound;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return strongest ?? reduceBarePythonVersion(text);
|
|
338
|
+
}
|
|
339
|
+
function reduceRuffTargetVersion(text) {
|
|
340
|
+
return reducePythonVersion(RUFF_LEVEL.exec(text.trim()));
|
|
341
|
+
}
|
|
342
|
+
function withSource(level, source, file) {
|
|
343
|
+
return level ? { ...level, source, file } : void 0;
|
|
344
|
+
}
|
|
345
|
+
async function readDeclarationFile(filePath) {
|
|
346
|
+
try {
|
|
347
|
+
return await readFile(filePath, "utf-8");
|
|
348
|
+
} catch (err) {
|
|
349
|
+
const code = err.code;
|
|
350
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
351
|
+
return void 0;
|
|
352
|
+
}
|
|
353
|
+
recordDegradationOnce({
|
|
354
|
+
kind: "python-target-version-unreadable",
|
|
355
|
+
subject: filePath,
|
|
356
|
+
reason: `Python syntax-level declaration could not be read: ${err instanceof Error ? err.message : String(err)}`
|
|
357
|
+
});
|
|
358
|
+
return void 0;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function parsePyrightJsonVersion(content) {
|
|
362
|
+
let parsed;
|
|
363
|
+
try {
|
|
364
|
+
parsed = parseJsonc(content);
|
|
365
|
+
} catch {
|
|
366
|
+
return void 0;
|
|
367
|
+
}
|
|
368
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
369
|
+
return void 0;
|
|
370
|
+
}
|
|
371
|
+
const value = parsed.pythonVersion;
|
|
372
|
+
return typeof value === "string" ? reduceBarePythonVersion(value) : void 0;
|
|
373
|
+
}
|
|
374
|
+
async function readRuffTier(dir, pyproject, pyprojectPath) {
|
|
375
|
+
let configPath;
|
|
376
|
+
let config;
|
|
377
|
+
for (const name of [".ruff.toml", "ruff.toml"]) {
|
|
378
|
+
const candidatePath = join(dir, name);
|
|
379
|
+
config = await readDeclarationFile(candidatePath);
|
|
380
|
+
if (config !== void 0) {
|
|
381
|
+
configPath = candidatePath;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (config === void 0) {
|
|
386
|
+
if (pyproject === void 0 || !hasTomlTable(pyproject, String.raw`tool\.ruff`)) {
|
|
387
|
+
return { declaration: void 0, owned: false };
|
|
388
|
+
}
|
|
389
|
+
configPath = pyprojectPath;
|
|
390
|
+
config = extractTomlTableSection(pyproject, String.raw`tool\.ruff`);
|
|
391
|
+
}
|
|
392
|
+
if (configPath === void 0 || config === void 0) {
|
|
393
|
+
return { declaration: void 0, owned: false };
|
|
394
|
+
}
|
|
395
|
+
const target = parseTomlScalarString(config, "target-version");
|
|
396
|
+
return {
|
|
397
|
+
declaration: withSource(target ? reduceRuffTargetVersion(target) : void 0, "ruff-target-version", configPath),
|
|
398
|
+
owned: true
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
async function readPyrightTier(dir, pyproject, pyprojectPath) {
|
|
402
|
+
const configPath = join(dir, "pyrightconfig.json");
|
|
403
|
+
const config = await readDeclarationFile(configPath);
|
|
404
|
+
if (config !== void 0) {
|
|
405
|
+
return {
|
|
406
|
+
declaration: withSource(parsePyrightJsonVersion(config), "pyright-python-version", configPath),
|
|
407
|
+
owned: true
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
if (pyproject === void 0)
|
|
411
|
+
return { declaration: void 0, owned: false };
|
|
412
|
+
const section = extractTomlTableSection(pyproject, String.raw`tool\.pyright`);
|
|
413
|
+
if (section === void 0)
|
|
414
|
+
return { declaration: void 0, owned: false };
|
|
415
|
+
const raw = parseTomlScalarString(section, "pythonVersion");
|
|
416
|
+
return {
|
|
417
|
+
declaration: withSource(raw ? reduceBarePythonVersion(raw) : void 0, "pyright-python-version", pyprojectPath),
|
|
418
|
+
owned: true
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function readRequiresPythonTier(pyproject, pyprojectPath) {
|
|
422
|
+
if (pyproject === void 0)
|
|
423
|
+
return { declaration: void 0, owned: false };
|
|
424
|
+
const projectSection = extractTomlTableSection(pyproject, "project");
|
|
425
|
+
const raw = projectSection !== void 0 ? parseTomlScalarString(projectSection, "requires-python") : void 0;
|
|
426
|
+
return {
|
|
427
|
+
declaration: withSource(raw ? reducePythonSpecifier(raw) : void 0, "requires-python", pyprojectPath),
|
|
428
|
+
owned: raw !== void 0
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
async function readVersionFileTier(dir) {
|
|
432
|
+
const levelFilePath = join(dir, ".python-version");
|
|
433
|
+
const content = await readDeclarationFile(levelFilePath);
|
|
434
|
+
if (content === void 0)
|
|
435
|
+
return { declaration: void 0, owned: false };
|
|
436
|
+
const firstLine = (content.split(/\r?\n/, 1)[0] ?? "").trim();
|
|
437
|
+
return {
|
|
438
|
+
declaration: withSource(reduceBarePythonVersion(firstLine), "python-version-file", levelFilePath),
|
|
439
|
+
owned: true
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
var PYTHON_DECLARATION_SOURCES = [
|
|
443
|
+
"ruff-target-version",
|
|
444
|
+
"pyright-python-version",
|
|
445
|
+
"requires-python",
|
|
446
|
+
"python-version-file"
|
|
447
|
+
];
|
|
448
|
+
async function readPythonDeclarationInDirectory(dir, open) {
|
|
449
|
+
const pyprojectPath = join(dir, "pyproject.toml");
|
|
450
|
+
const pyproject = await readDeclarationFile(pyprojectPath);
|
|
451
|
+
const tiers = [
|
|
452
|
+
["ruff-target-version", () => readRuffTier(dir, pyproject, pyprojectPath)],
|
|
453
|
+
[
|
|
454
|
+
"pyright-python-version",
|
|
455
|
+
() => readPyrightTier(dir, pyproject, pyprojectPath)
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
"requires-python",
|
|
459
|
+
async () => readRequiresPythonTier(pyproject, pyprojectPath)
|
|
460
|
+
],
|
|
461
|
+
["python-version-file", () => readVersionFileTier(dir)]
|
|
462
|
+
];
|
|
463
|
+
const closed = [];
|
|
464
|
+
for (const [source, read] of tiers) {
|
|
465
|
+
if (!open.has(source))
|
|
466
|
+
continue;
|
|
467
|
+
const { declaration, owned } = await read();
|
|
468
|
+
if (declaration)
|
|
469
|
+
return { declaration, closed: [] };
|
|
470
|
+
if (owned)
|
|
471
|
+
closed.push(source);
|
|
472
|
+
}
|
|
473
|
+
return { declaration: void 0, closed };
|
|
474
|
+
}
|
|
475
|
+
async function detectPythonTargetVersion(filePath, homeDir = os.homedir()) {
|
|
476
|
+
if (resolveLanguage(filePath)?.id !== "python")
|
|
477
|
+
return void 0;
|
|
478
|
+
const open = new Set(PYTHON_DECLARATION_SOURCES);
|
|
479
|
+
for (const dir of walkUpDirs(dirname(realpathOrResolve(filePath)), {
|
|
480
|
+
homeDir
|
|
481
|
+
})) {
|
|
482
|
+
const { declaration, closed } = await readPythonDeclarationInDirectory(dir, open);
|
|
483
|
+
if (declaration)
|
|
484
|
+
return declaration;
|
|
485
|
+
for (const source of closed)
|
|
486
|
+
open.delete(source);
|
|
487
|
+
if (open.size === 0)
|
|
488
|
+
return void 0;
|
|
489
|
+
}
|
|
490
|
+
return void 0;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export {
|
|
494
|
+
emitBounded,
|
|
495
|
+
resetBoundedTelemetry,
|
|
496
|
+
hasAmbientPythonEnvironment,
|
|
497
|
+
detectPythonEnvironment,
|
|
498
|
+
augmentPythonEnvironment,
|
|
499
|
+
pythonEnvironmentToolCandidates,
|
|
500
|
+
PYTHON_DECLARATION_CONCURRENCY,
|
|
501
|
+
PYTHON_COMPILE_VERDICT_SERVER_ID,
|
|
502
|
+
isJediCompileVerdict,
|
|
503
|
+
partitionOutrankedPythonCompileVerdicts,
|
|
504
|
+
recordPythonCompileVerdictDrop,
|
|
505
|
+
describePythonCompileWithheld,
|
|
506
|
+
detectPythonTargetVersion
|
|
507
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
detectFileRole
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KJJAVH3X.js";
|
|
5
5
|
|
|
6
6
|
// dist/clients/collateral-test-role.js
|
|
7
7
|
function isTestRoleCollateral(filePath) {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
adaptLspService,
|
|
4
|
+
getLSPService,
|
|
5
|
+
groupFilesByPrimaryServer,
|
|
6
|
+
hasAuxiliaryLspPublishedForRoot,
|
|
7
|
+
notifyExternalFileChange,
|
|
8
|
+
peekLSPService,
|
|
9
|
+
resetLSPService,
|
|
10
|
+
resyncGitChangedFiles,
|
|
11
|
+
runPerServerGroups
|
|
12
|
+
} from "./chunk-SJHC3BCZ.js";
|
|
13
|
+
import "./chunk-MEFLGBCS.js";
|
|
14
|
+
import "./chunk-XIMYZ3JA.js";
|
|
15
|
+
import "./chunk-7ZS7MC24.js";
|
|
16
|
+
import "./chunk-6XSESGWD.js";
|
|
17
|
+
import "./chunk-3SNDVPOR.js";
|
|
18
|
+
import "./chunk-JWOVP5BL.js";
|
|
19
|
+
import "./chunk-2LDMXL2M.js";
|
|
20
|
+
import "./chunk-FEDWAYDS.js";
|
|
21
|
+
import "./chunk-CPZ5JJW6.js";
|
|
22
|
+
import "./chunk-7IYC4ENJ.js";
|
|
23
|
+
import "./chunk-KX56K73G.js";
|
|
24
|
+
import "./chunk-YWWG4AQA.js";
|
|
25
|
+
import "./chunk-Z54ZSOBZ.js";
|
|
26
|
+
import "./chunk-2Y6OJRSI.js";
|
|
27
|
+
import "./chunk-WUY4BZEP.js";
|
|
28
|
+
import "./chunk-GTDSYEA2.js";
|
|
29
|
+
import "./chunk-6HWVI6MI.js";
|
|
30
|
+
import "./chunk-UL5SXQVX.js";
|
|
31
|
+
import "./chunk-CKEQFGLT.js";
|
|
32
|
+
import "./chunk-NLIVE7L6.js";
|
|
33
|
+
import "./chunk-IEBJF3PN.js";
|
|
34
|
+
import "./chunk-UO66IMVP.js";
|
|
35
|
+
import "./chunk-Q42LJANT.js";
|
|
36
|
+
import "./chunk-APFJKOP6.js";
|
|
37
|
+
import "./chunk-2BEMIWEW.js";
|
|
38
|
+
import "./chunk-IJYGIDF4.js";
|
|
39
|
+
import "./chunk-IL7K66ZQ.js";
|
|
40
|
+
import "./chunk-4FHUGDKU.js";
|
|
41
|
+
import "./chunk-K4SZB56V.js";
|
|
42
|
+
import "./chunk-XI34NWDI.js";
|
|
43
|
+
import "./chunk-5LRUKYFA.js";
|
|
44
|
+
import "./chunk-63NMUNYP.js";
|
|
45
|
+
import "./chunk-CG5V25HX.js";
|
|
46
|
+
import "./chunk-PP2A5V2T.js";
|
|
47
|
+
import "./chunk-S55TEC7I.js";
|
|
48
|
+
import "./chunk-TPYYEDP5.js";
|
|
49
|
+
import "./chunk-AWQWXSW4.js";
|
|
50
|
+
import "./chunk-QYF5S6P6.js";
|
|
51
|
+
import "./chunk-GYRZ72R4.js";
|
|
52
|
+
import "./chunk-KJJAVH3X.js";
|
|
53
|
+
import "./chunk-ZSUX7KEM.js";
|
|
54
|
+
import "./chunk-EIKRZ32J.js";
|
|
55
|
+
import "./chunk-FWZRGGGY.js";
|
|
56
|
+
import "./chunk-N3PLNNCW.js";
|
|
57
|
+
import "./chunk-S26LC76R.js";
|
|
58
|
+
import "./chunk-XWFIHYCH.js";
|
|
59
|
+
import "./chunk-TVZRLTG6.js";
|
|
60
|
+
import "./chunk-LJDODBBZ.js";
|
|
61
|
+
import "./chunk-EWXXLS26.js";
|
|
62
|
+
import "./chunk-NXL4FFQQ.js";
|
|
63
|
+
export {
|
|
64
|
+
adaptLspService,
|
|
65
|
+
getLSPService,
|
|
66
|
+
groupFilesByPrimaryServer,
|
|
67
|
+
hasAuxiliaryLspPublishedForRoot,
|
|
68
|
+
notifyExternalFileChange,
|
|
69
|
+
peekLSPService,
|
|
70
|
+
resetLSPService,
|
|
71
|
+
resyncGitChangedFiles,
|
|
72
|
+
runPerServerGroups
|
|
73
|
+
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
rootMarkersForFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-63NMUNYP.js";
|
|
5
5
|
import {
|
|
6
6
|
createGenerationMap,
|
|
7
7
|
createGenerationSource
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TPYYEDP5.js";
|
|
9
9
|
import {
|
|
10
10
|
getDegradationLedgerGeneration,
|
|
11
11
|
recordDegradationOnce
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FWZRGGGY.js";
|
|
13
13
|
import {
|
|
14
14
|
logExtension
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N3PLNNCW.js";
|
|
16
16
|
import {
|
|
17
17
|
isAtOrAboveHomeDir,
|
|
18
18
|
isRealGitMarker,
|
|
19
19
|
isUnderDir,
|
|
20
20
|
isWindowsPath,
|
|
21
21
|
nameMatchesMarkerGlob,
|
|
22
|
-
normalizeEphemeralMapKey
|
|
23
|
-
|
|
22
|
+
normalizeEphemeralMapKey,
|
|
23
|
+
realpathOrResolve
|
|
24
|
+
} from "./chunk-EWXXLS26.js";
|
|
24
25
|
|
|
25
26
|
// dist/clients/tool-cwd.js
|
|
26
27
|
import * as os from "node:os";
|
|
@@ -180,11 +181,6 @@ function logRunnerAdvisoryOnce(ctx, tool, root, message) {
|
|
|
180
181
|
ctx.log(message, "debug");
|
|
181
182
|
}
|
|
182
183
|
function resolveToolCwd(kind, tool, file, ctx) {
|
|
183
|
-
const dispatchRoot = path.resolve(ctx.cwd ?? process.cwd());
|
|
184
|
-
const absoluteFile = path.resolve(file);
|
|
185
|
-
const fileDir = path.dirname(absoluteFile);
|
|
186
|
-
const homeDir = ctx.homeDir ?? os.homedir();
|
|
187
|
-
const insideDispatch = isUnderDir(absoluteFile, dispatchRoot);
|
|
188
184
|
if (ctx.serverRoot) {
|
|
189
185
|
const rootPath = isWindowsPath(ctx.serverRoot) ? path.win32 : path;
|
|
190
186
|
const serverRoot = rootPath.resolve(ctx.serverRoot);
|
|
@@ -192,8 +188,14 @@ function resolveToolCwd(kind, tool, file, ctx) {
|
|
|
192
188
|
emitResolution(kind, tool, serverRoot, "server-root");
|
|
193
189
|
return { cwd: serverRoot };
|
|
194
190
|
}
|
|
191
|
+
const dispatchRoot = path.resolve(ctx.cwd ?? process.cwd());
|
|
192
|
+
const absoluteFile = realpathOrResolve(file);
|
|
193
|
+
const fileDir = path.dirname(absoluteFile);
|
|
194
|
+
const homeDir = ctx.homeDir ?? os.homedir();
|
|
195
|
+
const homeCeiling = realpathOrResolve(homeDir);
|
|
196
|
+
const insideDispatch = isUnderDir(absoluteFile, dispatchRoot);
|
|
195
197
|
const markers = markersFor(kind, tool, absoluteFile, ctx);
|
|
196
|
-
const markerResult = markers.length ? findMarkerRoot(fileDir, markers, ctx.allowHomeMarker ? path.parse(
|
|
198
|
+
const markerResult = markers.length ? findMarkerRoot(fileDir, markers, ctx.allowHomeMarker ? path.parse(homeCeiling).root : homeCeiling) : { root: null };
|
|
197
199
|
const markerRoot = markerResult.root;
|
|
198
200
|
if (markerRoot && (insideDispatch ? isUnderDir(markerRoot, dispatchRoot) : true)) {
|
|
199
201
|
const finalReason = `marker:${markerResult.marker ?? markers[0]}`;
|
|
@@ -206,11 +208,11 @@ function resolveToolCwd(kind, tool, file, ctx) {
|
|
|
206
208
|
}
|
|
207
209
|
const memo = ctx.toolCwdMemo;
|
|
208
210
|
if (memo && memo.gitRoot === void 0) {
|
|
209
|
-
const gitResult = findMarkerRoot(fileDir, [".git"],
|
|
211
|
+
const gitResult = findMarkerRoot(fileDir, [".git"], homeCeiling);
|
|
210
212
|
memo.gitRoot = gitResult.root && isRealGitMarker(path.join(gitResult.root, ".git")) ? gitResult.root : null;
|
|
211
213
|
}
|
|
212
214
|
const gitRoot = memo && memo.gitRoot !== void 0 ? memo.gitRoot : (() => {
|
|
213
|
-
const gitResult = findMarkerRoot(fileDir, [".git"],
|
|
215
|
+
const gitResult = findMarkerRoot(fileDir, [".git"], homeCeiling);
|
|
214
216
|
return gitResult.root && isRealGitMarker(path.join(gitResult.root, ".git")) ? gitResult.root : null;
|
|
215
217
|
})();
|
|
216
218
|
if (gitRoot && (insideDispatch ? isUnderDir(gitRoot, dispatchRoot) : true)) {
|