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,186 @@
|
|
|
1
|
+
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
stagePathFor
|
|
4
|
+
} from "./chunk-LJDODBBZ.js";
|
|
5
|
+
|
|
6
|
+
// dist/clients/gzip-stage-write.js
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
import { Readable } from "node:stream";
|
|
10
|
+
import { pipeline } from "node:stream/promises";
|
|
11
|
+
import { parentPort } from "node:worker_threads";
|
|
12
|
+
import { createGzip } from "node:zlib";
|
|
13
|
+
function routingFields(value) {
|
|
14
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
15
|
+
return `not a routable object (${value === null ? "null" : Array.isArray(value) ? "array" : typeof value})`;
|
|
16
|
+
}
|
|
17
|
+
const wire = value;
|
|
18
|
+
const missing = [];
|
|
19
|
+
const id = requiredNumber(wire, "id", missing);
|
|
20
|
+
const generation = requiredNumber(wire, "generation", missing);
|
|
21
|
+
if (missing.length > 0)
|
|
22
|
+
return `no numeric ${missing.join(" and ")}`;
|
|
23
|
+
return {
|
|
24
|
+
id,
|
|
25
|
+
generation,
|
|
26
|
+
...fieldEntry(wire, "stagePath", "string", [])
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function requiredNumber(wire, key, missing) {
|
|
30
|
+
const field = wire[key];
|
|
31
|
+
if (typeof field === "number")
|
|
32
|
+
return field;
|
|
33
|
+
missing.push(key);
|
|
34
|
+
return Number.NaN;
|
|
35
|
+
}
|
|
36
|
+
function fieldEntry(wire, key, type, malformed) {
|
|
37
|
+
const field = wire[key];
|
|
38
|
+
if (typeof field === type) {
|
|
39
|
+
return { [key]: field };
|
|
40
|
+
}
|
|
41
|
+
if (field !== void 0)
|
|
42
|
+
malformed.push(key);
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
function readGzipStageWorkerResult(value) {
|
|
46
|
+
const routing = routingFields(value);
|
|
47
|
+
if (typeof routing === "string")
|
|
48
|
+
return routing;
|
|
49
|
+
const wire = value;
|
|
50
|
+
const malformed = [];
|
|
51
|
+
const result = {
|
|
52
|
+
...routing,
|
|
53
|
+
...fieldEntry(wire, "rawBytes", "number", malformed),
|
|
54
|
+
...fieldEntry(wire, "gzBytes", "number", malformed),
|
|
55
|
+
...fieldEntry(wire, "serializeMs", "number", malformed),
|
|
56
|
+
...fieldEntry(wire, "writeMs", "number", malformed),
|
|
57
|
+
...fieldEntry(wire, "durationMs", "number", malformed),
|
|
58
|
+
...fieldEntry(wire, "semanticFingerprint", "string", malformed),
|
|
59
|
+
...fieldEntry(wire, "skippedUnchanged", "boolean", malformed),
|
|
60
|
+
...fieldEntry(wire, "error", "string", malformed)
|
|
61
|
+
};
|
|
62
|
+
if (malformed.length === 0)
|
|
63
|
+
return result;
|
|
64
|
+
return {
|
|
65
|
+
...routing,
|
|
66
|
+
error: `malformed worker result: ${malformed.join(", ")}`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function isGzipStageWorkerRequest(value) {
|
|
70
|
+
const routing = routingFields(value);
|
|
71
|
+
return typeof routing !== "string" && routing.stagePath !== void 0;
|
|
72
|
+
}
|
|
73
|
+
function reapStageFile(stagePath) {
|
|
74
|
+
try {
|
|
75
|
+
fs.rmSync(stagePath, { force: true });
|
|
76
|
+
return void 0;
|
|
77
|
+
} catch (err) {
|
|
78
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function writeGzipStageFile(data, stagePath, testDelayMs, options) {
|
|
82
|
+
const startedAt = performance.now();
|
|
83
|
+
const tmpPath = stagePathFor(stagePath);
|
|
84
|
+
try {
|
|
85
|
+
if (testDelayMs) {
|
|
86
|
+
await new Promise((resolve) => setTimeout(resolve, testDelayMs));
|
|
87
|
+
}
|
|
88
|
+
const serializeStarted = performance.now();
|
|
89
|
+
const body = data instanceof Uint8Array ? data : JSON.stringify(data);
|
|
90
|
+
const serializeMs = performance.now() - serializeStarted;
|
|
91
|
+
const rawBytes = Buffer.byteLength(body);
|
|
92
|
+
const semanticFingerprint = options?.semanticFingerprint?.(body);
|
|
93
|
+
if (semanticFingerprint !== void 0 && options?.skipIfFingerprints?.includes(semanticFingerprint)) {
|
|
94
|
+
return {
|
|
95
|
+
rawBytes,
|
|
96
|
+
gzBytes: 0,
|
|
97
|
+
serializeMs,
|
|
98
|
+
writeMs: 0,
|
|
99
|
+
durationMs: performance.now() - startedAt,
|
|
100
|
+
semanticFingerprint,
|
|
101
|
+
skippedUnchanged: true
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const writeStarted = performance.now();
|
|
105
|
+
await fs.promises.mkdir(path.dirname(stagePath), { recursive: true });
|
|
106
|
+
const chunks = function* () {
|
|
107
|
+
const chunkSize = 256 * 1024;
|
|
108
|
+
let offset = 0;
|
|
109
|
+
while (offset < body.length) {
|
|
110
|
+
let end = Math.min(offset + chunkSize, body.length);
|
|
111
|
+
if (typeof body === "string" && end < body.length) {
|
|
112
|
+
const last = body.charCodeAt(end - 1);
|
|
113
|
+
if (last >= 55296 && last <= 56319)
|
|
114
|
+
end--;
|
|
115
|
+
}
|
|
116
|
+
yield typeof body === "string" ? body.slice(offset, end) : body.subarray(offset, end);
|
|
117
|
+
offset = end;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
await pipeline(Readable.from(chunks()), createGzip(), fs.createWriteStream(tmpPath));
|
|
121
|
+
await fs.promises.rename(tmpPath, stagePath);
|
|
122
|
+
const writeMs = performance.now() - writeStarted;
|
|
123
|
+
const gzBytes = (await fs.promises.stat(stagePath)).size;
|
|
124
|
+
return {
|
|
125
|
+
rawBytes,
|
|
126
|
+
gzBytes,
|
|
127
|
+
serializeMs,
|
|
128
|
+
writeMs,
|
|
129
|
+
durationMs: performance.now() - startedAt,
|
|
130
|
+
semanticFingerprint
|
|
131
|
+
};
|
|
132
|
+
} catch (err) {
|
|
133
|
+
await fs.promises.rm(tmpPath, { force: true }).catch(() => {
|
|
134
|
+
});
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function serveGzipStageWorker(buildBaseResult, options) {
|
|
139
|
+
const port = parentPort;
|
|
140
|
+
if (!port) {
|
|
141
|
+
throw new Error("gzip stage persist worker requires a parent port");
|
|
142
|
+
}
|
|
143
|
+
port.on("message", (message) => {
|
|
144
|
+
void (async () => {
|
|
145
|
+
try {
|
|
146
|
+
if (!isGzipStageWorkerRequest(message)) {
|
|
147
|
+
const routing = routingFields(message);
|
|
148
|
+
throw new Error(`malformed persist request: ${typeof routing === "string" ? routing : "no stage path"}`);
|
|
149
|
+
}
|
|
150
|
+
const request = message;
|
|
151
|
+
const result = {
|
|
152
|
+
...buildBaseResult(request)
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
const fingerprint = options?.semanticFingerprint;
|
|
156
|
+
const metrics = await writeGzipStageFile(request.data, request.stagePath, request.testDelayMs, {
|
|
157
|
+
semanticFingerprint: fingerprint ? (body) => fingerprint(request, body) : void 0,
|
|
158
|
+
skipIfFingerprints: options?.skipIfFingerprints?.(request)
|
|
159
|
+
});
|
|
160
|
+
result.rawBytes = metrics.rawBytes;
|
|
161
|
+
result.gzBytes = metrics.gzBytes;
|
|
162
|
+
result.serializeMs = metrics.serializeMs;
|
|
163
|
+
result.writeMs = metrics.writeMs;
|
|
164
|
+
result.durationMs = metrics.durationMs;
|
|
165
|
+
result.semanticFingerprint = metrics.semanticFingerprint;
|
|
166
|
+
result.skippedUnchanged = metrics.skippedUnchanged;
|
|
167
|
+
} catch (err) {
|
|
168
|
+
result.error = err instanceof Error ? err.message : String(err);
|
|
169
|
+
}
|
|
170
|
+
port.postMessage(result);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
const routing = routingFields(message);
|
|
173
|
+
port.postMessage({
|
|
174
|
+
...typeof routing === "string" ? {} : routing,
|
|
175
|
+
error: err instanceof Error ? err.message : String(err)
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
})();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
readGzipStageWorkerResult,
|
|
184
|
+
reapStageFile,
|
|
185
|
+
serveGzipStageWorker
|
|
186
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
resolveToolCwd
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4FHUGDKU.js";
|
|
5
5
|
import {
|
|
6
6
|
allAvailableGlobalBinDirs,
|
|
7
7
|
installArgs,
|
|
8
8
|
pmBinary,
|
|
9
9
|
resolveNodePackageManager
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-K4SZB56V.js";
|
|
11
11
|
import {
|
|
12
12
|
probeToolAsync
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XI34NWDI.js";
|
|
14
14
|
import {
|
|
15
15
|
TRANSIENT_MAX_COOLDOWN_MS,
|
|
16
16
|
classifyProbeFailure,
|
|
17
17
|
createAvailabilityLatch,
|
|
18
18
|
logAvailabilityDecision,
|
|
19
19
|
startHostStallSampler
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5LRUKYFA.js";
|
|
21
21
|
import {
|
|
22
22
|
acquireBoundedPidFileLock,
|
|
23
23
|
acquireQuarantinePidFileLock,
|
|
@@ -25,52 +25,50 @@ import {
|
|
|
25
25
|
getGlobalPiLensDir,
|
|
26
26
|
heartbeatIntervalMs,
|
|
27
27
|
isLockContention,
|
|
28
|
+
isUntrustedProjectPath,
|
|
28
29
|
ownsTopGeneration,
|
|
29
30
|
recordGenerationTakeover,
|
|
30
31
|
recordLegacyLockHeld,
|
|
32
|
+
recordProjectCommandRefusal,
|
|
31
33
|
releaseGeneration,
|
|
32
34
|
resetSafeSpawnWindowsCommandCache,
|
|
33
35
|
safeSpawnAsync,
|
|
34
36
|
startGenerationHeartbeat,
|
|
35
37
|
tryAcquireGeneration
|
|
36
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TPYYEDP5.js";
|
|
37
39
|
import {
|
|
38
40
|
assertInstallAllowed,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
import {
|
|
42
|
-
DEFAULT_MAX_OUTPUT_BYTES,
|
|
43
|
-
createBoundedOutputSink,
|
|
41
|
+
getProjectTrustGeneration,
|
|
42
|
+
projectTrustDenialReason,
|
|
44
43
|
writeFileAtomic,
|
|
45
44
|
writeFileAtomicAsync
|
|
46
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-EIKRZ32J.js";
|
|
47
46
|
import {
|
|
48
47
|
getDegradationLedgerGeneration,
|
|
49
48
|
incrementDegradationCount,
|
|
50
49
|
recordDegradationOnce
|
|
51
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-FWZRGGGY.js";
|
|
52
51
|
import {
|
|
53
52
|
logExtension
|
|
54
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-N3PLNNCW.js";
|
|
55
54
|
import {
|
|
56
55
|
createNdjsonLogger,
|
|
57
56
|
getGlobalPiLensLogDir,
|
|
58
57
|
getMaxLogSizeMB,
|
|
59
58
|
isTestMode
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import {
|
|
62
|
-
BoundedLruCache
|
|
63
|
-
} from "./chunk-ABBOA7UD.js";
|
|
59
|
+
} from "./chunk-TVZRLTG6.js";
|
|
64
60
|
import {
|
|
61
|
+
BoundedLruCache,
|
|
65
62
|
findLocalToolConfig,
|
|
66
|
-
isFullyQualified
|
|
67
|
-
|
|
63
|
+
isFullyQualified,
|
|
64
|
+
isUnderDir,
|
|
65
|
+
realpathOrResolve
|
|
66
|
+
} from "./chunk-EWXXLS26.js";
|
|
68
67
|
import {
|
|
69
68
|
__require
|
|
70
69
|
} from "./chunk-NXL4FFQQ.js";
|
|
71
70
|
|
|
72
71
|
// dist/clients/installer/index.js
|
|
73
|
-
import { spawn } from "node:child_process";
|
|
74
72
|
import { existsSync, readFileSync as readFileSync2, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
75
73
|
import fs2 from "node:fs/promises";
|
|
76
74
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -331,6 +329,8 @@ async function resolveGitHubToken(envKeys = ["GITHUB_TOKEN", "GH_TOKEN"], option
|
|
|
331
329
|
// dist/clients/installer/index.js
|
|
332
330
|
var _installerRequire = createRequire(import.meta.url);
|
|
333
331
|
var TOOLS_DIR = path3.join(getGlobalPiLensDir(), "tools");
|
|
332
|
+
var USER_BASE_PROBE_TIMEOUT_MS = 5e3;
|
|
333
|
+
var ARCHIVE_COMMAND_TIMEOUT_MS = 12e4;
|
|
334
334
|
var INSTALL_LOCK_PATH = path3.join(TOOLS_DIR, ".install.lock");
|
|
335
335
|
var INSTALL_LOCK_GENERATIONS = `${INSTALL_LOCK_PATH}s`;
|
|
336
336
|
var activeInstallLocks = /* @__PURE__ */ new Set();
|
|
@@ -465,7 +465,24 @@ async function acquireInstallLock() {
|
|
|
465
465
|
reason: `timed out after ${timeoutMs}ms waiting for shared tools install lock (${installLockOwner()})`
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
|
-
var
|
|
468
|
+
var GLOBAL_HOME_DIR = getGlobalPiLensDir();
|
|
469
|
+
var GITHUB_BIN_DIR = path3.join(GLOBAL_HOME_DIR, "bin");
|
|
470
|
+
var GITHUB_BIN_DIR_PINNED = Boolean(process.env.PI_LENS_HOME?.trim());
|
|
471
|
+
function assertManagedBinDirInsidePinnedHome(toolId) {
|
|
472
|
+
if (!GITHUB_BIN_DIR_PINNED)
|
|
473
|
+
return;
|
|
474
|
+
const home = realpathOrResolve(GLOBAL_HOME_DIR);
|
|
475
|
+
const bin = realpathOrResolve(GITHUB_BIN_DIR);
|
|
476
|
+
if (isUnderDir(bin, home))
|
|
477
|
+
return;
|
|
478
|
+
const reason = `bin directory escapes the pinned PI_LENS_HOME: ${GITHUB_BIN_DIR} resolves to ${bin}, outside ${home}; refusing to write through the link`;
|
|
479
|
+
recordDegradationOnce({
|
|
480
|
+
kind: "managed-tool-install",
|
|
481
|
+
subject: `${toolId}:bin-dir-escape`,
|
|
482
|
+
reason
|
|
483
|
+
});
|
|
484
|
+
throw new Error(reason);
|
|
485
|
+
}
|
|
469
486
|
var DEBUG = process.env.PI_LENS_DEBUG === "1" || process.argv.includes("--debug");
|
|
470
487
|
function installerPlatform() {
|
|
471
488
|
const override = process.env.PI_LENS_TEST_PLATFORM;
|
|
@@ -734,8 +751,8 @@ var TOOLS = [
|
|
|
734
751
|
checkCommand: "jscpd",
|
|
735
752
|
checkArgs: ["--version"],
|
|
736
753
|
installStrategy: "npm",
|
|
737
|
-
packageName: "jscpd@5.4.
|
|
738
|
-
// v5.4.
|
|
754
|
+
packageName: "jscpd@5.4.1",
|
|
755
|
+
// v5.4.1 is the repository's exact devDependency; the v4 packaging defect that required the older v5.0.12 pin is gone, and parseReport() reads the unchanged clone-report fields.
|
|
739
756
|
binaryName: "jscpd"
|
|
740
757
|
},
|
|
741
758
|
// Structural search and dead code detection
|
|
@@ -894,8 +911,8 @@ var TOOLS = [
|
|
|
894
911
|
id: "helm",
|
|
895
912
|
name: "Helm",
|
|
896
913
|
checkCommand: "helm",
|
|
897
|
-
//
|
|
898
|
-
checkArgs: ["
|
|
914
|
+
// Probed against helm 4.3.0: `--version` exits 1 ("unknown flag"), `version --short` exits 0.
|
|
915
|
+
checkArgs: ["version", "--short"],
|
|
899
916
|
installStrategy: "github",
|
|
900
917
|
binaryName: "helm",
|
|
901
918
|
github: {
|
|
@@ -1229,8 +1246,8 @@ var TOOLS = [
|
|
|
1229
1246
|
id: "spotbugs",
|
|
1230
1247
|
name: "SpotBugs",
|
|
1231
1248
|
checkCommand: "spotbugs",
|
|
1232
|
-
//
|
|
1233
|
-
checkArgs: ["
|
|
1249
|
+
// Probed against spotbugs 4.10.2 (JRE 21): `--version` exits 1 ("Unknown option"), `-version` prints 4.10.2.
|
|
1250
|
+
checkArgs: ["-version"],
|
|
1234
1251
|
installStrategy: "archive",
|
|
1235
1252
|
binaryName: "spotbugs",
|
|
1236
1253
|
archive: {
|
|
@@ -1501,7 +1518,7 @@ var TOOLS = [
|
|
|
1501
1518
|
id: "gitleaks",
|
|
1502
1519
|
name: "gitleaks",
|
|
1503
1520
|
checkCommand: "gitleaks",
|
|
1504
|
-
//
|
|
1521
|
+
// Probed against gitleaks 8.30.1: `--version` exits 0.
|
|
1505
1522
|
checkArgs: ["--version"],
|
|
1506
1523
|
installStrategy: "github",
|
|
1507
1524
|
binaryName: "gitleaks",
|
|
@@ -1606,7 +1623,7 @@ var TOOLS = [
|
|
|
1606
1623
|
id: "terraform-ls",
|
|
1607
1624
|
name: "terraform-ls",
|
|
1608
1625
|
checkCommand: "terraform-ls",
|
|
1609
|
-
//
|
|
1626
|
+
// Probed against terraform-ls 0.39.0: `--version` exits 0.
|
|
1610
1627
|
checkArgs: ["--version"],
|
|
1611
1628
|
installStrategy: "github",
|
|
1612
1629
|
binaryName: "terraform-ls",
|
|
@@ -2091,12 +2108,16 @@ async function isCommandAvailable(command, _args) {
|
|
|
2091
2108
|
if (!dir)
|
|
2092
2109
|
continue;
|
|
2093
2110
|
for (const name of names) {
|
|
2094
|
-
const candidate = path3.join(dir, name)
|
|
2111
|
+
const candidate = isWindows ? path3.join(dir, name) : `${dir}${path3.sep}${name}`;
|
|
2095
2112
|
try {
|
|
2096
2113
|
const stat = statSync(candidate);
|
|
2097
|
-
if (stat.isFile()
|
|
2098
|
-
|
|
2114
|
+
if (!stat.isFile() || stat.size === 0)
|
|
2115
|
+
continue;
|
|
2116
|
+
if (isUntrustedProjectPath(candidate)) {
|
|
2117
|
+
recordProjectCommandRefusal(candidate);
|
|
2118
|
+
continue;
|
|
2099
2119
|
}
|
|
2120
|
+
return true;
|
|
2100
2121
|
} catch {
|
|
2101
2122
|
}
|
|
2102
2123
|
}
|
|
@@ -2104,7 +2125,8 @@ async function isCommandAvailable(command, _args) {
|
|
|
2104
2125
|
return false;
|
|
2105
2126
|
}
|
|
2106
2127
|
async function isSpawnableCommand(command) {
|
|
2107
|
-
|
|
2128
|
+
const namesPath = installerPlatform() === "win32" ? /[\\/]/.test(command) : command.includes("/");
|
|
2129
|
+
if (namesPath) {
|
|
2108
2130
|
try {
|
|
2109
2131
|
const stat = statSync(command);
|
|
2110
2132
|
return stat.isFile() && stat.size > 0;
|
|
@@ -2112,7 +2134,7 @@ async function isSpawnableCommand(command) {
|
|
|
2112
2134
|
return false;
|
|
2113
2135
|
}
|
|
2114
2136
|
}
|
|
2115
|
-
const memoKey = `${command}:${hashSync(process.env.PATH || "")}`;
|
|
2137
|
+
const memoKey = `${getProjectTrustGeneration()}:${command}:${hashSync(process.env.PATH || "")}`;
|
|
2116
2138
|
if (pathWalkMemo.has(memoKey))
|
|
2117
2139
|
return pathWalkMemo.get(memoKey) ?? false;
|
|
2118
2140
|
const isSpawnable = await isCommandAvailable(command);
|
|
@@ -2377,16 +2399,16 @@ var lastInstallResolutionId = /* @__PURE__ */ new Map();
|
|
|
2377
2399
|
function wasLastResolveTransient(toolId) {
|
|
2378
2400
|
return lastResolveTransient.get(toolId) ?? false;
|
|
2379
2401
|
}
|
|
2380
|
-
async function getToolPath(toolId) {
|
|
2402
|
+
async function getToolPath(toolId, opts) {
|
|
2381
2403
|
let sawTransient = false;
|
|
2382
2404
|
const markTransient = () => {
|
|
2383
2405
|
sawTransient = true;
|
|
2384
2406
|
};
|
|
2385
|
-
const result = await getToolPathResolved(toolId, markTransient);
|
|
2407
|
+
const result = await getToolPathResolved(toolId, markTransient, opts?.storeOnly === true);
|
|
2386
2408
|
lastResolveTransient.set(toolId, sawTransient);
|
|
2387
2409
|
return result;
|
|
2388
2410
|
}
|
|
2389
|
-
async function getToolPathResolved(toolId, onTransient) {
|
|
2411
|
+
async function getToolPathResolved(toolId, onTransient, storeOnly) {
|
|
2390
2412
|
const tool = TOOLS.find((t) => t.id === toolId);
|
|
2391
2413
|
if (!tool)
|
|
2392
2414
|
return void 0;
|
|
@@ -2445,6 +2467,9 @@ async function getToolPathResolved(toolId, onTransient) {
|
|
|
2445
2467
|
if (githubPath)
|
|
2446
2468
|
return githubPath;
|
|
2447
2469
|
}
|
|
2470
|
+
if (storeOnly) {
|
|
2471
|
+
return tool.installStrategy === "pip" ? findPipUserToolPath(tool.binaryName || tool.id, onTransient, tool.checkArgs, getToolVerificationTimeout(tool), true) : void 0;
|
|
2472
|
+
}
|
|
2448
2473
|
if (await isCommandAvailable(tool.checkCommand)) {
|
|
2449
2474
|
if (packageEntryVerification(tool) !== void 0)
|
|
2450
2475
|
return tool.checkCommand;
|
|
@@ -2554,6 +2579,10 @@ async function findNpmGlobalToolPath(binaryName, onTransient, verificationArgs =
|
|
|
2554
2579
|
for (const candidate of candidates) {
|
|
2555
2580
|
try {
|
|
2556
2581
|
await fs2.access(candidate);
|
|
2582
|
+
if (isUntrustedProjectPath(candidate)) {
|
|
2583
|
+
recordProjectCommandRefusal(candidate);
|
|
2584
|
+
continue;
|
|
2585
|
+
}
|
|
2557
2586
|
if (await verifyToolBinary(candidate, void 0, onTransient, verificationTimeoutMs, verificationArgs)) {
|
|
2558
2587
|
return candidate;
|
|
2559
2588
|
}
|
|
@@ -2587,12 +2616,12 @@ async function getNpmGlobalBinCandidates(onTransient) {
|
|
|
2587
2616
|
}
|
|
2588
2617
|
return dirs;
|
|
2589
2618
|
}
|
|
2590
|
-
async function findPipUserToolPath(binaryName, onTransient, verificationArgs = ["--version"], verificationTimeoutMs = 1e4) {
|
|
2619
|
+
async function findPipUserToolPath(binaryName, onTransient, verificationArgs = ["--version"], verificationTimeoutMs = 1e4, piLensPrefixesOnly = false) {
|
|
2591
2620
|
const isWindows = installerPlatform() === "win32";
|
|
2592
2621
|
const userBaseCandidates = [
|
|
2593
2622
|
path3.join(getGlobalPiLensDir(), "pip-tools"),
|
|
2594
2623
|
path3.join(getGlobalPiLensDir(), "pip-user"),
|
|
2595
|
-
...await getPythonUserBaseCandidates()
|
|
2624
|
+
...piLensPrefixesOnly ? [] : await getPythonUserBaseCandidates()
|
|
2596
2625
|
];
|
|
2597
2626
|
for (const userBase of userBaseCandidates) {
|
|
2598
2627
|
const scriptDirs = [pipScriptsDir(userBase, installerPlatform())];
|
|
@@ -2618,6 +2647,10 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
|
|
|
2618
2647
|
for (const candidate of candidates) {
|
|
2619
2648
|
try {
|
|
2620
2649
|
await fs2.access(candidate);
|
|
2650
|
+
if (isUntrustedProjectPath(candidate)) {
|
|
2651
|
+
recordProjectCommandRefusal(candidate);
|
|
2652
|
+
continue;
|
|
2653
|
+
}
|
|
2621
2654
|
if (await verifyToolBinary(candidate, void 0, onTransient, verificationTimeoutMs, verificationArgs)) {
|
|
2622
2655
|
return candidate;
|
|
2623
2656
|
}
|
|
@@ -2628,22 +2661,18 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
|
|
|
2628
2661
|
}
|
|
2629
2662
|
return void 0;
|
|
2630
2663
|
}
|
|
2631
|
-
function userBaseProbeResult(
|
|
2632
|
-
if (
|
|
2633
|
-
recordDegradationOnce({
|
|
2634
|
-
kind: "spawn-output-cap-truncated",
|
|
2635
|
-
subject: `user-base-probe:${command}`,
|
|
2636
|
-
reason: `\`${command} -m site --user-base\` reached the ${DEFAULT_MAX_OUTPUT_BYTES}-byte default cap after ${stdout.observedBytes} bytes; the probed user base is unusable`,
|
|
2637
|
-
metadata: {
|
|
2638
|
-
capBytes: DEFAULT_MAX_OUTPUT_BYTES,
|
|
2639
|
-
capSource: "default",
|
|
2640
|
-
observedBytes: stdout.observedBytes,
|
|
2641
|
-
killed: false
|
|
2642
|
-
}
|
|
2643
|
-
});
|
|
2664
|
+
function userBaseProbeResult(result) {
|
|
2665
|
+
if (result.outputTruncated || result.error || result.status !== 0)
|
|
2644
2666
|
return "";
|
|
2645
|
-
|
|
2646
|
-
|
|
2667
|
+
return result.stdout.trim();
|
|
2668
|
+
}
|
|
2669
|
+
async function probeUserBase(command) {
|
|
2670
|
+
return userBaseProbeResult(await safeSpawnAsync(command, ["-m", "site", "--user-base"], {
|
|
2671
|
+
timeout: USER_BASE_PROBE_TIMEOUT_MS,
|
|
2672
|
+
cwd: os.homedir(),
|
|
2673
|
+
ignoreAmbientSignal: true,
|
|
2674
|
+
lifetimeCoupled: true
|
|
2675
|
+
}));
|
|
2647
2676
|
}
|
|
2648
2677
|
async function getPythonUserBaseCandidates() {
|
|
2649
2678
|
const candidates = [];
|
|
@@ -2670,24 +2699,7 @@ async function getPythonUserBaseCandidates() {
|
|
|
2670
2699
|
{ command: "python", args: ["-m", "site", "--user-base"] }
|
|
2671
2700
|
];
|
|
2672
2701
|
for (const probe of probes) {
|
|
2673
|
-
const userBase = await
|
|
2674
|
-
const isWin = process.platform === "win32";
|
|
2675
|
-
const spawnCmd = isWin ? [probe.command, ...probe.args].join(" ") : probe.command;
|
|
2676
|
-
let proc;
|
|
2677
|
-
try {
|
|
2678
|
-
proc = spawn(spawnCmd, isWin ? [] : probe.args, {
|
|
2679
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
2680
|
-
shell: isWin
|
|
2681
|
-
});
|
|
2682
|
-
} catch {
|
|
2683
|
-
resolve("");
|
|
2684
|
-
return;
|
|
2685
|
-
}
|
|
2686
|
-
const stdout = createBoundedOutputSink();
|
|
2687
|
-
proc.stdout?.on("data", (data) => stdout.append(data));
|
|
2688
|
-
proc.on("exit", (code) => resolve(userBaseProbeResult(probe.command, code, stdout)));
|
|
2689
|
-
proc.on("error", () => resolve(""));
|
|
2690
|
-
});
|
|
2702
|
+
const userBase = await probeUserBase(probe.command);
|
|
2691
2703
|
add(userBase);
|
|
2692
2704
|
}
|
|
2693
2705
|
return candidates;
|
|
@@ -2767,22 +2779,14 @@ async function httpsGet(url, maxRedirects = 5, headers = {}) {
|
|
|
2767
2779
|
}
|
|
2768
2780
|
return response.body;
|
|
2769
2781
|
}
|
|
2770
|
-
function runCommand(command, args, cwd) {
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
stdio: "ignore",
|
|
2777
|
-
shell: process.platform === "win32"
|
|
2778
|
-
});
|
|
2779
|
-
} catch {
|
|
2780
|
-
resolve(false);
|
|
2781
|
-
return;
|
|
2782
|
-
}
|
|
2783
|
-
proc.on("exit", (code) => resolve(code === 0));
|
|
2784
|
-
proc.on("error", () => resolve(false));
|
|
2782
|
+
async function runCommand(command, args, cwd) {
|
|
2783
|
+
const result = await safeSpawnAsync(command, args, {
|
|
2784
|
+
cwd,
|
|
2785
|
+
timeout: ARCHIVE_COMMAND_TIMEOUT_MS,
|
|
2786
|
+
ignoreAmbientSignal: true,
|
|
2787
|
+
lifetimeCoupled: true
|
|
2785
2788
|
});
|
|
2789
|
+
return !result.error && result.status === 0;
|
|
2786
2790
|
}
|
|
2787
2791
|
async function installGitHubTool(tool, prefetchedRelease) {
|
|
2788
2792
|
const spec = tool.github;
|
|
@@ -2852,6 +2856,7 @@ async function installGitHubTool(tool, prefetchedRelease) {
|
|
|
2852
2856
|
return void 0;
|
|
2853
2857
|
}
|
|
2854
2858
|
try {
|
|
2859
|
+
assertManagedBinDirInsidePinnedHome(tool.id);
|
|
2855
2860
|
if (launcherRuntime) {
|
|
2856
2861
|
const assetPath = path3.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
|
|
2857
2862
|
await writeFileAtomicAsync(assetPath, assetBuffer, {
|
|
@@ -3419,6 +3424,7 @@ async function installMavenTool(tool) {
|
|
|
3419
3424
|
}
|
|
3420
3425
|
try {
|
|
3421
3426
|
await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
|
|
3427
|
+
assertManagedBinDirInsidePinnedHome(tool.id);
|
|
3422
3428
|
const jarPath = path3.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
|
|
3423
3429
|
await writeFileAtomicAsync(jarPath, jarBuffer, { bestEffort: false });
|
|
3424
3430
|
const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
|
|
@@ -3642,10 +3648,11 @@ async function installArchiveTool(tool) {
|
|
|
3642
3648
|
});
|
|
3643
3649
|
return void 0;
|
|
3644
3650
|
}
|
|
3651
|
+
await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
|
|
3652
|
+
assertManagedBinDirInsidePinnedHome(tool.id);
|
|
3645
3653
|
await swapExtractedDir(tool.id, tmpExtractDir, extractDir);
|
|
3646
3654
|
const innerLauncher = path3.join(extractDir, ...launcherParts);
|
|
3647
3655
|
const resolvedInner = isWindows ? `${innerLauncher}.bat` : innerLauncher;
|
|
3648
|
-
await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
|
|
3649
3656
|
const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
|
|
3650
3657
|
const shimPath = path3.join(GITHUB_BIN_DIR, launcherName);
|
|
3651
3658
|
if (isWindows) {
|
|
@@ -3976,22 +3983,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
|
|
|
3976
3983
|
const result = await run(candidate.command, args);
|
|
3977
3984
|
const error = (result.error?.message ?? result.stderr).trim();
|
|
3978
3985
|
if (result.status === 0) {
|
|
3979
|
-
const base = await
|
|
3980
|
-
let probe;
|
|
3981
|
-
try {
|
|
3982
|
-
probe = spawn(candidate.command, ["-m", "site", "--user-base"], {
|
|
3983
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
3984
|
-
shell: isWindows
|
|
3985
|
-
});
|
|
3986
|
-
} catch {
|
|
3987
|
-
resolve("");
|
|
3988
|
-
return;
|
|
3989
|
-
}
|
|
3990
|
-
const stdout = createBoundedOutputSink();
|
|
3991
|
-
probe.stdout?.on("data", (data) => stdout.append(data));
|
|
3992
|
-
probe.on("exit", (code) => resolve(userBaseProbeResult(candidate.command, code, stdout)));
|
|
3993
|
-
probe.on("error", () => resolve(""));
|
|
3994
|
-
});
|
|
3986
|
+
const base = await probeUserBase(candidate.command);
|
|
3995
3987
|
const binaryPath = base ? await addBinToPath(pipScriptsDir(base, installerPlatform())) : void 0;
|
|
3996
3988
|
return succeeded("user", binaryPath ?? packageName);
|
|
3997
3989
|
}
|
|
@@ -4057,7 +4049,7 @@ async function stampInstallResolution(toolId) {
|
|
|
4057
4049
|
return;
|
|
4058
4050
|
try {
|
|
4059
4051
|
const resolutionId = lastInstallResolutionId.get(toolId);
|
|
4060
|
-
const refresh = await import("./chunk-
|
|
4052
|
+
const refresh = await import("./chunk-PJXNTPB2.js");
|
|
4061
4053
|
await refresh.stampManagedToolInstall(toolId, resolutionId);
|
|
4062
4054
|
} catch {
|
|
4063
4055
|
}
|
|
@@ -4070,7 +4062,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
|
|
|
4070
4062
|
if (ok) {
|
|
4071
4063
|
resetSafeSpawnWindowsCommandCache();
|
|
4072
4064
|
try {
|
|
4073
|
-
const { resetMadgeManagedPathMemo } = await import("./chunk-
|
|
4065
|
+
const { resetMadgeManagedPathMemo } = await import("./chunk-RG7OODGM.js");
|
|
4074
4066
|
resetMadgeManagedPathMemo();
|
|
4075
4067
|
} catch (err) {
|
|
4076
4068
|
logSessionStart(`auto-install ${toolId}: madge memo reset failed: ${err.message}`);
|
|
@@ -4100,7 +4092,7 @@ async function installTool(toolId, ownsLock) {
|
|
|
4100
4092
|
return false;
|
|
4101
4093
|
const npmPath = await installNpmTool(tool.id, tool.packageName, tool.binaryName, tool.checkArgs, getToolVerificationTimeout(tool), packageEntryVerification(tool), ownsLock);
|
|
4102
4094
|
if (npmPath !== void 0) {
|
|
4103
|
-
await import("./chunk-
|
|
4095
|
+
await import("./chunk-PJXNTPB2.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
|
|
4104
4096
|
});
|
|
4105
4097
|
}
|
|
4106
4098
|
return finishInstallAttempt(tool.id, npmPath !== void 0, startedAt);
|
|
@@ -4470,13 +4462,13 @@ function resolveDerivedHashiCorpReleaseAsset(toolId, tagName, platform, arch) {
|
|
|
4470
4462
|
}
|
|
4471
4463
|
|
|
4472
4464
|
export {
|
|
4473
|
-
commitDurableStore,
|
|
4474
|
-
commitDurableStoreAsync,
|
|
4475
4465
|
findLocalZizmorConfig,
|
|
4476
4466
|
isZizmorAuditTarget,
|
|
4477
4467
|
resetZizmorTokenAvailability,
|
|
4478
4468
|
resolveZizmorGitHubToken,
|
|
4479
4469
|
logSessionStart,
|
|
4470
|
+
commitDurableStore,
|
|
4471
|
+
commitDurableStoreAsync,
|
|
4480
4472
|
getManagedToolsDir,
|
|
4481
4473
|
TOOLS,
|
|
4482
4474
|
getToolVerificationTimeout,
|