pi-lens 4.4.7 → 4.4.8
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 +149 -0
- package/README.md +12 -2
- package/config/markdownlint/run-no-fix.mjs +36 -0
- package/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
- package/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
- package/dist/chunk-2TS4GLOJ.js +31 -0
- package/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
- package/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
- package/dist/chunk-3JAHQBSY.js +27 -0
- package/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
- package/dist/chunk-447YZL4S.js +25 -0
- package/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
- package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
- package/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
- package/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
- package/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
- package/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
- package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
- package/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
- package/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
- package/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
- package/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
- package/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
- package/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
- package/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
- package/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
- package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
- package/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
- package/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
- package/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
- package/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
- package/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
- package/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
- package/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
- package/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
- package/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
- package/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
- package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
- package/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
- package/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
- package/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
- package/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
- package/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
- package/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
- package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
- package/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
- package/dist/chunk-GGYOZWHW.js +27 -0
- package/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
- package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
- package/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
- package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
- package/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
- package/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
- package/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
- package/dist/chunk-IE5D3RA5.js +58 -0
- package/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
- package/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
- package/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
- package/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
- package/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
- package/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
- package/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
- package/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
- package/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
- package/dist/chunk-LPYTPNOJ.js +22 -0
- package/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
- package/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
- package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
- package/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
- package/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
- package/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
- package/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
- package/dist/chunk-OFNMHPBT.js +89 -0
- package/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
- package/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
- package/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
- package/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
- package/dist/chunk-PKLB2XJL.js +8 -0
- package/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
- package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
- package/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
- package/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
- package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
- package/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
- package/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
- package/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
- package/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
- package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
- package/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
- package/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
- package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
- package/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
- package/dist/chunk-UYXV5NIS.js +20 -0
- package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
- package/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
- package/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
- package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
- package/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
- package/dist/chunk-W3BGKBBK.js +27 -0
- package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
- package/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
- package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
- package/dist/chunk-WXUDRAG6.js +24 -0
- package/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
- package/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
- package/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
- package/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
- package/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
- package/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
- package/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
- package/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
- package/dist/chunk-ZONZ6YY3.js +74 -0
- package/dist/chunk-ZSM35JF4.js +30 -0
- package/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
- package/dist/index.js +6993 -5396
- package/dist/mcp/analyze-cli.js +10 -10
- package/dist/mcp/cli.js +44 -42
- package/dist/mcp/server.js +1627 -504
- package/dist/mcp/worker.js +62 -61
- package/dist/probes/installer.js +20 -19
- package/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/docs/agent-tools.md +18 -8
- package/docs/alignment-families.md +29 -0
- package/docs/ast-grep_rules_catalog.md +6 -4
- package/docs/ci-bot-pr-checks.md +126 -0
- package/docs/configuration.md +99 -3
- package/docs/defect-shapes.md +55 -12
- package/docs/engineering-principles.md +27 -2
- package/docs/features.md +2 -2
- package/docs/invariants/git-guard-host.md +7 -3
- package/docs/invariants/language-config.md +15 -4
- package/docs/invariants/lsp-trust-exec.md +16 -2
- package/docs/invariants/paths-os.md +4 -2
- package/docs/lsp-capability-matrix.md +119 -39
- package/docs/merge-queue-rollout.md +1 -1
- package/docs/pi-lens-fixer.md +24 -17
- package/docs/pi-lens-merge-policy.md +20 -11
- package/docs/pi-lens-monitor.md +9 -0
- package/docs/pi-lens-orchestration.md +4 -1
- package/docs/pi-lens-reviewer.md +5 -5
- package/docs/pi-lens-subagent.md +6 -3
- package/docs/public-api-stability.md +18 -2
- package/docs/schema/pi-lens-config-v1.json +10 -0
- package/docs/settings.md +10 -6
- package/docs/word-index.md +17 -5
- package/package.json +5 -3
- package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
- package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
- package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
- package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
- package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
- package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
- package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
- package/dist/chunk-46TNM7XZ.js +0 -88
- package/dist/chunk-72OKUXSD.js +0 -31
- package/dist/chunk-7GLOLOSH.js +0 -57
- package/dist/chunk-AKUUMGD5.js +0 -26
- package/dist/chunk-ASUXV767.js +0 -22
- package/dist/chunk-CTADOKYM.js +0 -25
- package/dist/chunk-JJ2RRESP.js +0 -58
- package/dist/chunk-LSC3VADM.js +0 -23
- package/dist/chunk-SHLDT3OI.js +0 -27
- package/dist/chunk-UF7RTZSO.js +0 -27
- package/dist/chunk-W4WP2ERB.js +0 -30
- package/dist/chunk-YES5CACN.js +0 -73
|
@@ -2,7 +2,20 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
getLazyInstallAttempt,
|
|
4
4
|
tryLazyInstall
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MC6VB2E5.js";
|
|
6
|
+
import {
|
|
7
|
+
computeImpactCascade
|
|
8
|
+
} from "./chunk-PKSUMEPT.js";
|
|
9
|
+
import {
|
|
10
|
+
goClient
|
|
11
|
+
} from "./chunk-3O5EII3W.js";
|
|
12
|
+
import {
|
|
13
|
+
isTrivyEnabled,
|
|
14
|
+
resolveSeverityFloor
|
|
15
|
+
} from "./chunk-ZKLTNLAW.js";
|
|
16
|
+
import {
|
|
17
|
+
scannerReportParentDir
|
|
18
|
+
} from "./chunk-RGGH6M34.js";
|
|
6
19
|
import {
|
|
7
20
|
faultIfCutShort,
|
|
8
21
|
faultResult,
|
|
@@ -11,30 +24,19 @@ import {
|
|
|
11
24
|
finishParsedRun,
|
|
12
25
|
formatToolFailure,
|
|
13
26
|
hasUsableResult,
|
|
27
|
+
isNotApplicableSkipReason,
|
|
14
28
|
isRunnerClaimSource,
|
|
15
29
|
isRunnerSkipReason,
|
|
16
30
|
parseToolRun,
|
|
31
|
+
processCutShort,
|
|
17
32
|
reachedNoVerdict,
|
|
18
33
|
skipUnlessToolRan,
|
|
19
|
-
spanOverlapsModifiedRanges
|
|
20
|
-
} from "./chunk-Y7F7IEE3.js";
|
|
21
|
-
import {
|
|
22
|
-
processCutShort,
|
|
34
|
+
spanOverlapsModifiedRanges,
|
|
23
35
|
spawnFailedWithNoOutput
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import {
|
|
26
|
-
computeImpactCascade
|
|
27
|
-
} from "./chunk-EAOK7MIZ.js";
|
|
28
|
-
import {
|
|
29
|
-
goClient
|
|
30
|
-
} from "./chunk-4LM3VAZH.js";
|
|
31
|
-
import {
|
|
32
|
-
isTrivyEnabled,
|
|
33
|
-
resolveSeverityFloor
|
|
34
|
-
} from "./chunk-E7HJ56Y7.js";
|
|
36
|
+
} from "./chunk-RZG472YW.js";
|
|
35
37
|
import {
|
|
36
38
|
rustClient
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-4W52ZKZX.js";
|
|
38
40
|
import {
|
|
39
41
|
coveringLaneAvailable,
|
|
40
42
|
createAvailabilityChecker,
|
|
@@ -50,7 +52,7 @@ import {
|
|
|
50
52
|
resolveToolCommand,
|
|
51
53
|
resolveToolCommandWithInstallFallback,
|
|
52
54
|
resolveVendorToolCommand
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-ZFORSIED.js";
|
|
54
56
|
import {
|
|
55
57
|
biomeConfigArgs,
|
|
56
58
|
findCompiledClassesDir,
|
|
@@ -69,21 +71,21 @@ import {
|
|
|
69
71
|
hasYamllintConfig,
|
|
70
72
|
markdownlintConfigArgs,
|
|
71
73
|
ruffConfigArgs
|
|
72
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-5F3XF3SX.js";
|
|
73
75
|
import {
|
|
74
76
|
importFactProvider
|
|
75
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-FRLAUP2B.js";
|
|
76
78
|
import {
|
|
77
79
|
functionFactProvider
|
|
78
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-6YUNI7B5.js";
|
|
79
81
|
import {
|
|
80
82
|
extractFactsFromTree
|
|
81
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-7TNILKGY.js";
|
|
82
84
|
import {
|
|
83
85
|
buildOrUpdateGraph,
|
|
84
86
|
clearReviewGraphWorkspaceCache,
|
|
85
87
|
fileContentProvider
|
|
86
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-4B2YFN4U.js";
|
|
87
89
|
import {
|
|
88
90
|
MAX_BLOCKING_RULE_COMPLEXITY,
|
|
89
91
|
PRIMARY_UNAVAILABLE_CAUSE,
|
|
@@ -109,18 +111,21 @@ import {
|
|
|
109
111
|
isStructuredRule,
|
|
110
112
|
lineContentHash,
|
|
111
113
|
primaryUnavailableCause,
|
|
114
|
+
readBoundToCurrentDisk,
|
|
112
115
|
recordDiagnostics,
|
|
113
116
|
recordNapiFallbackCoverage,
|
|
114
117
|
recordRunner,
|
|
115
118
|
retagAuxiliaryDiagnostics,
|
|
119
|
+
touchCompletedConfirmationPolicy,
|
|
116
120
|
touchCoverageGap,
|
|
117
121
|
tryWarmAttachedCodeActions,
|
|
118
|
-
tryWarmAttachedDiagnostics
|
|
119
|
-
|
|
122
|
+
tryWarmAttachedDiagnostics,
|
|
123
|
+
warmAnswerBinding
|
|
124
|
+
} from "./chunk-2BKUFQKR.js";
|
|
120
125
|
import {
|
|
121
126
|
ANY_POSITION,
|
|
122
127
|
retainRecordedFindings
|
|
123
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-GIRBSBGL.js";
|
|
124
129
|
import {
|
|
125
130
|
mapWithConcurrency
|
|
126
131
|
} from "./chunk-XIMYZ3JA.js";
|
|
@@ -129,9 +134,12 @@ import {
|
|
|
129
134
|
canWriteAnalysisRoot,
|
|
130
135
|
disabledPrimaries,
|
|
131
136
|
getAstGrepRuleSources,
|
|
137
|
+
isKnownRunnerId,
|
|
132
138
|
registerRunnerId,
|
|
133
|
-
resolveAnalysisRoot
|
|
134
|
-
|
|
139
|
+
resolveAnalysisRoot,
|
|
140
|
+
resolveSessionConfigRoot,
|
|
141
|
+
runnerIdentityPopulated
|
|
142
|
+
} from "./chunk-XYLC35E4.js";
|
|
135
143
|
import {
|
|
136
144
|
augmentPythonEnvironment,
|
|
137
145
|
describePythonCompileWithheld,
|
|
@@ -140,22 +148,22 @@ import {
|
|
|
140
148
|
emitBounded,
|
|
141
149
|
partitionOutrankedPythonCompileVerdicts,
|
|
142
150
|
recordPythonCompileVerdictDrop
|
|
143
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-FHEV6T4L.js";
|
|
144
152
|
import {
|
|
145
153
|
loadProjectSnapshot,
|
|
146
154
|
readJsonCache,
|
|
147
155
|
readJsonCacheAsync
|
|
148
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-ZZDIOAAJ.js";
|
|
149
157
|
import {
|
|
150
158
|
RUNTIME_CONFIG,
|
|
151
159
|
exceedsLspSyncLimits,
|
|
152
160
|
getRunnerTimeoutFloorMs,
|
|
153
161
|
loadAstGrepNapi
|
|
154
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-35WKJWO5.js";
|
|
155
163
|
import {
|
|
156
164
|
buildModuleGraph,
|
|
157
165
|
clearModuleGraphCache
|
|
158
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-CUDD35TW.js";
|
|
159
167
|
import {
|
|
160
168
|
BUNDLED_QUERIES_ROOT,
|
|
161
169
|
classifyTreeSitterWasmError,
|
|
@@ -175,7 +183,10 @@ import {
|
|
|
175
183
|
ruleFilesForLanguage,
|
|
176
184
|
ruleSourceLanguages,
|
|
177
185
|
walk
|
|
178
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-BHWW6FAX.js";
|
|
187
|
+
import {
|
|
188
|
+
resolvePackagePath
|
|
189
|
+
} from "./chunk-HKIL6DCL.js";
|
|
179
190
|
import {
|
|
180
191
|
stripAnsi
|
|
181
192
|
} from "./chunk-6HWVI6MI.js";
|
|
@@ -187,32 +198,33 @@ import {
|
|
|
187
198
|
scheduleWordIndexPersist,
|
|
188
199
|
setWordIndexPublishedListener,
|
|
189
200
|
updateWordIndexDocumentForEdit
|
|
190
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-HUAM7QG3.js";
|
|
191
202
|
import {
|
|
192
203
|
WARM_CODE_ACTION_LOOKUP_LIMIT,
|
|
193
204
|
contentHash
|
|
194
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-CZL44WFN.js";
|
|
195
206
|
import {
|
|
196
207
|
resolveRunnerPath,
|
|
197
208
|
toRunnerDisplayPath
|
|
198
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-VPLBLWFO.js";
|
|
199
210
|
import {
|
|
211
|
+
findCommandOnPath,
|
|
200
212
|
isSpawnableCommand
|
|
201
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-BQG2QFVO.js";
|
|
202
214
|
import {
|
|
203
215
|
logRunnerAdvisoryOnce,
|
|
204
216
|
resolveRunnerCwd,
|
|
205
217
|
resolveRunnerCwdWithReason
|
|
206
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-IYVYZQRL.js";
|
|
207
219
|
import {
|
|
208
220
|
findLocalBinUpwards,
|
|
209
221
|
localBinPath
|
|
210
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-VOP4PJKA.js";
|
|
211
223
|
import {
|
|
212
224
|
createAvailabilityProbeFlight,
|
|
213
225
|
getIsolatedNpxSpawnOptions,
|
|
214
226
|
probeToolAsync
|
|
215
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-JBP7KESM.js";
|
|
216
228
|
import {
|
|
217
229
|
classifyProbeFailure,
|
|
218
230
|
createAvailabilityLatch,
|
|
@@ -222,69 +234,75 @@ import {
|
|
|
222
234
|
logAvailabilityDecision,
|
|
223
235
|
startHostStallSampler,
|
|
224
236
|
transientRetryDelayMs
|
|
225
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-JZRP4DGP.js";
|
|
226
238
|
import {
|
|
227
239
|
getLspCapableKinds,
|
|
228
240
|
getPrimaryDispatchGroup,
|
|
229
241
|
resolveLanguageRootForFile
|
|
230
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-SDFKOLSF.js";
|
|
231
243
|
import {
|
|
232
244
|
getGlobalPiLensDir,
|
|
233
245
|
getProjectDataDir,
|
|
246
|
+
isIgnoredByGitignoreLines,
|
|
234
247
|
isInSpawnTimeoutCooldown,
|
|
235
248
|
isTestFile,
|
|
236
249
|
loadPiLensGlobalConfig,
|
|
237
250
|
noteSpawnTimeout,
|
|
238
251
|
resolvePiLensFlag,
|
|
239
252
|
safeSpawnAsync
|
|
240
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-WMDUT4KH.js";
|
|
241
254
|
import {
|
|
242
255
|
DOTNET_CSHARP_PROJECT_MARKERS,
|
|
243
256
|
DOTNET_CSHARP_SOLUTION_MARKERS,
|
|
244
257
|
detectFileKind
|
|
245
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-G5GV2Q7K.js";
|
|
246
259
|
import {
|
|
247
260
|
PathKeyedMap,
|
|
261
|
+
boundedKeyLabel,
|
|
248
262
|
classifyGeneratedOrArtifactDetailed,
|
|
249
263
|
detectFileRole,
|
|
264
|
+
finalizeRecords,
|
|
250
265
|
loadPiLensProjectConfig,
|
|
266
|
+
migrationSubject,
|
|
267
|
+
reportPiLensConfigRecords,
|
|
268
|
+
resolveOnePiLensConfigDocument,
|
|
251
269
|
resolvePiLensConfig
|
|
252
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-X35S7HSB.js";
|
|
253
271
|
import {
|
|
254
272
|
findNearestDirWithAnyBasename,
|
|
255
273
|
findNearestDirWithMarker,
|
|
256
274
|
getPiLensGlobalConfigPath
|
|
257
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-SQC7K3SP.js";
|
|
258
276
|
import {
|
|
259
277
|
getProjectTrustState,
|
|
260
278
|
killedForOutputCap,
|
|
261
279
|
projectTrustDenialReason,
|
|
262
280
|
truncatedByOutputCap,
|
|
263
281
|
writeFileAtomic
|
|
264
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-JE6HKLC7.js";
|
|
265
283
|
import {
|
|
266
284
|
incrementDegradationCount,
|
|
267
285
|
recordDegradationOnce
|
|
268
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-2453RRJ2.js";
|
|
269
287
|
import {
|
|
270
288
|
createSubsystemLogger,
|
|
271
289
|
logExtension
|
|
272
|
-
} from "./chunk-
|
|
290
|
+
} from "./chunk-WQV6BI4Q.js";
|
|
273
291
|
import {
|
|
274
292
|
logLatency,
|
|
275
293
|
phaseFinished,
|
|
276
294
|
phaseStarted
|
|
277
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-565VRUP4.js";
|
|
278
296
|
import {
|
|
279
297
|
createNdjsonLogger,
|
|
280
298
|
getGlobalPiLensLogDir,
|
|
281
299
|
getMaxLogSizeMB,
|
|
282
300
|
isTestMode
|
|
283
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-VLQ7UKZH.js";
|
|
284
302
|
import {
|
|
285
303
|
FactStore,
|
|
286
304
|
setFactStoreEvictionReporter
|
|
287
|
-
} from "./chunk-
|
|
305
|
+
} from "./chunk-4BKU7PV3.js";
|
|
288
306
|
import {
|
|
289
307
|
BoundedFifoMap,
|
|
290
308
|
BoundedLruCache,
|
|
@@ -294,15 +312,20 @@ import {
|
|
|
294
312
|
isAbsoluteFilePath,
|
|
295
313
|
isUnderDir,
|
|
296
314
|
isWindowsPath,
|
|
315
|
+
isWithinIdentity,
|
|
297
316
|
normalizeEphemeralMapKey,
|
|
298
317
|
normalizeLoggedPath,
|
|
299
318
|
normalizeMapKey,
|
|
300
|
-
pathsEqual
|
|
301
|
-
|
|
319
|
+
pathsEqual,
|
|
320
|
+
realpathOrResolve,
|
|
321
|
+
relativeInside,
|
|
322
|
+
toPosix,
|
|
323
|
+
toProjectRelativePath
|
|
324
|
+
} from "./chunk-GMROJJRN.js";
|
|
302
325
|
|
|
303
326
|
// dist/clients/mcp/analyze.js
|
|
304
|
-
import * as
|
|
305
|
-
import * as
|
|
327
|
+
import * as fs19 from "node:fs";
|
|
328
|
+
import * as path50 from "node:path";
|
|
306
329
|
|
|
307
330
|
// dist/clients/cache-manager.js
|
|
308
331
|
import * as fs from "node:fs";
|
|
@@ -340,12 +363,7 @@ var CacheManager = class {
|
|
|
340
363
|
toTurnStateKey(filePath, cwd) {
|
|
341
364
|
const cwdNorm = normalizeMapKey(path.resolve(cwd));
|
|
342
365
|
const fileNorm = normalizeMapKey(path.resolve(cwd, filePath));
|
|
343
|
-
|
|
344
|
-
if (!rel || rel === ".")
|
|
345
|
-
return fileNorm;
|
|
346
|
-
if (rel === ".." || rel.startsWith("../"))
|
|
347
|
-
return fileNorm;
|
|
348
|
-
return rel;
|
|
366
|
+
return relativeInside(cwdNorm, fileNorm) || fileNorm;
|
|
349
367
|
}
|
|
350
368
|
/**
|
|
351
369
|
* Get turn-state entry for a file path using normalized lookup.
|
|
@@ -952,7 +970,7 @@ function createDiagnosticLogger() {
|
|
|
952
970
|
}
|
|
953
971
|
|
|
954
972
|
// dist/clients/dispatch/dispatcher.js
|
|
955
|
-
import * as
|
|
973
|
+
import * as fs4 from "node:fs";
|
|
956
974
|
import * as path4 from "node:path";
|
|
957
975
|
|
|
958
976
|
// dist/clients/line-alignment.js
|
|
@@ -1118,6 +1136,496 @@ function applyInlineSuppressions(diagnostics, content) {
|
|
|
1118
1136
|
});
|
|
1119
1137
|
}
|
|
1120
1138
|
|
|
1139
|
+
// dist/clients/dispatch/runners/utils.js
|
|
1140
|
+
import * as fs3 from "node:fs";
|
|
1141
|
+
function readFileContent(filePath) {
|
|
1142
|
+
try {
|
|
1143
|
+
return fs3.readFileSync(filePath, "utf-8");
|
|
1144
|
+
} catch {
|
|
1145
|
+
return void 0;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// dist/clients/dispatch/rule-policy.js
|
|
1150
|
+
import * as nodePath from "node:path";
|
|
1151
|
+
function resolveDispatchPolicyConfig(root) {
|
|
1152
|
+
return resolvePiLensConfig({
|
|
1153
|
+
cwd: root,
|
|
1154
|
+
globalDir: getGlobalPiLensDir(),
|
|
1155
|
+
globalConfigPath: getPiLensGlobalConfigPath()
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
function configOwnerFor(filePath, root) {
|
|
1159
|
+
return resolveSessionConfigRoot(nodePath.resolve(root, filePath), root).register ?? root;
|
|
1160
|
+
}
|
|
1161
|
+
function resolveDispatchPolicyConfigForFile(filePath, root) {
|
|
1162
|
+
return resolveDispatchPolicyConfig(configOwnerFor(filePath, root));
|
|
1163
|
+
}
|
|
1164
|
+
function rulePolicyMapFromResolution(resolution, root) {
|
|
1165
|
+
const rules2 = resolution.value.rules;
|
|
1166
|
+
const map = rulePolicyMapFromConfig(rules2);
|
|
1167
|
+
if (!map || !Object.values(map).some((entry) => entry?.ignorePaths)) {
|
|
1168
|
+
return map;
|
|
1169
|
+
}
|
|
1170
|
+
const anchored = anchoredIgnorePaths(resolution.documents, root);
|
|
1171
|
+
for (const [key2, entry] of Object.entries(map)) {
|
|
1172
|
+
if (!entry?.ignorePaths)
|
|
1173
|
+
continue;
|
|
1174
|
+
const paths = anchored.get(key2);
|
|
1175
|
+
if (paths && paths.length > 0)
|
|
1176
|
+
entry.ignorePaths = paths;
|
|
1177
|
+
}
|
|
1178
|
+
return map;
|
|
1179
|
+
}
|
|
1180
|
+
function anchoredIgnorePaths(documents, root) {
|
|
1181
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1182
|
+
for (const document of documents) {
|
|
1183
|
+
if (document.location.lspScoped)
|
|
1184
|
+
continue;
|
|
1185
|
+
const rules2 = resolveOnePiLensConfigDocument(document).value.rules;
|
|
1186
|
+
if (!rules2 || typeof rules2 !== "object" || Array.isArray(rules2))
|
|
1187
|
+
continue;
|
|
1188
|
+
const prefix = document.tier === "global" ? void 0 : anchorPrefix(document, root);
|
|
1189
|
+
const baseDir = prefix ? nodePath.resolve(root, prefix) : root;
|
|
1190
|
+
for (const [key2, rawEntry] of Object.entries(rules2)) {
|
|
1191
|
+
const ignorePaths = rawEntry?.ignorePaths;
|
|
1192
|
+
if (!Array.isArray(ignorePaths))
|
|
1193
|
+
continue;
|
|
1194
|
+
const patterns = [];
|
|
1195
|
+
for (const pattern of ignorePaths) {
|
|
1196
|
+
if (typeof pattern === "string")
|
|
1197
|
+
patterns.push(pattern);
|
|
1198
|
+
}
|
|
1199
|
+
const scopes = byKey.get(key2) ?? [];
|
|
1200
|
+
scopes.push({ baseDir, patterns });
|
|
1201
|
+
byKey.set(key2, scopes);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
return byKey;
|
|
1205
|
+
}
|
|
1206
|
+
function anchorPrefix(document, root) {
|
|
1207
|
+
const pathApi = isWindowsPath(root) || isWindowsPath(document.file) ? nodePath.win32 : nodePath.posix;
|
|
1208
|
+
let dir = document.file;
|
|
1209
|
+
for (const _segment of document.location.relativePath.split("/")) {
|
|
1210
|
+
dir = pathApi.dirname(dir);
|
|
1211
|
+
}
|
|
1212
|
+
if (pathsEqual(dir, root) || !isUnderDir(dir, root))
|
|
1213
|
+
return void 0;
|
|
1214
|
+
return toProjectRelativePath(dir, root);
|
|
1215
|
+
}
|
|
1216
|
+
function projectRulePolicy(root, known) {
|
|
1217
|
+
const ownerByDir = /* @__PURE__ */ new Map();
|
|
1218
|
+
const mapByOwner = /* @__PURE__ */ new Map();
|
|
1219
|
+
const ownerOf = (filePath) => {
|
|
1220
|
+
const dir = nodePath.dirname(nodePath.resolve(root, filePath));
|
|
1221
|
+
let owner = ownerByDir.get(dir);
|
|
1222
|
+
if (owner === void 0) {
|
|
1223
|
+
owner = configOwnerFor(filePath, root);
|
|
1224
|
+
ownerByDir.set(dir, owner);
|
|
1225
|
+
}
|
|
1226
|
+
return owner;
|
|
1227
|
+
};
|
|
1228
|
+
let unseeded = known;
|
|
1229
|
+
return {
|
|
1230
|
+
root,
|
|
1231
|
+
forFile(filePath) {
|
|
1232
|
+
if (unseeded) {
|
|
1233
|
+
mapByOwner.set(ownerOf(unseeded.filePath), unseeded.map);
|
|
1234
|
+
unseeded = void 0;
|
|
1235
|
+
}
|
|
1236
|
+
const owner = ownerOf(filePath);
|
|
1237
|
+
if (!mapByOwner.has(owner)) {
|
|
1238
|
+
mapByOwner.set(owner, rulePolicyMapFromResolution(resolveDispatchPolicyConfig(owner), root));
|
|
1239
|
+
}
|
|
1240
|
+
return mapByOwner.get(owner);
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
function isProjectRulePolicy(policy) {
|
|
1245
|
+
return typeof policy.forFile === "function";
|
|
1246
|
+
}
|
|
1247
|
+
function ruleIgnoredForPath(ruleId, filePath, root, policyMap) {
|
|
1248
|
+
const normalized = normalizeRuleId(ruleId);
|
|
1249
|
+
const scopes = [];
|
|
1250
|
+
for (const [configuredId, entry] of Object.entries(policyMap ?? {})) {
|
|
1251
|
+
if (normalizeRuleId(configuredId) !== normalized || !entry?.ignorePaths)
|
|
1252
|
+
continue;
|
|
1253
|
+
const rootLines = [];
|
|
1254
|
+
for (const item of entry.ignorePaths) {
|
|
1255
|
+
if (typeof item === "string")
|
|
1256
|
+
rootLines.push(item);
|
|
1257
|
+
else
|
|
1258
|
+
scopes.push(item);
|
|
1259
|
+
}
|
|
1260
|
+
if (rootLines.length > 0)
|
|
1261
|
+
scopes.push({ baseDir: root, patterns: rootLines });
|
|
1262
|
+
}
|
|
1263
|
+
const absolute = nodePath.resolve(root, filePath);
|
|
1264
|
+
return scopes.some((scope) => isIgnoredByGitignoreLines(scope.patterns, scope.baseDir, absolute));
|
|
1265
|
+
}
|
|
1266
|
+
function evaluateRulePolicy(ruleId, policyMap) {
|
|
1267
|
+
if (!policyMap)
|
|
1268
|
+
return { dropped: false };
|
|
1269
|
+
const raw = ruleId || "";
|
|
1270
|
+
const norm = normalizeRuleId(raw);
|
|
1271
|
+
if (scanList(policyMap, (e) => e.disable, raw, norm).matched) {
|
|
1272
|
+
return { dropped: true };
|
|
1273
|
+
}
|
|
1274
|
+
const select = scanList(policyMap, (e) => e.select, raw, norm);
|
|
1275
|
+
return { dropped: select.sawEntry && !select.matched };
|
|
1276
|
+
}
|
|
1277
|
+
function scanList(policyMap, pick, raw, norm) {
|
|
1278
|
+
let sawEntry = false;
|
|
1279
|
+
for (const entry of Object.values(policyMap)) {
|
|
1280
|
+
for (const candidate of (entry && pick(entry)) ?? []) {
|
|
1281
|
+
sawEntry = true;
|
|
1282
|
+
if (matchesRule(candidate, raw, norm))
|
|
1283
|
+
return { matched: true, sawEntry };
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return { matched: false, sawEntry };
|
|
1287
|
+
}
|
|
1288
|
+
function matchesRule(entry, raw, normalized) {
|
|
1289
|
+
if (entry === raw)
|
|
1290
|
+
return true;
|
|
1291
|
+
return normalizeRuleId(entry) === normalized;
|
|
1292
|
+
}
|
|
1293
|
+
function applyRulePolicy(diagnostics, policy, options) {
|
|
1294
|
+
if (!policy)
|
|
1295
|
+
return diagnostics;
|
|
1296
|
+
const project = isProjectRulePolicy(policy) ? policy : void 0;
|
|
1297
|
+
if (!project && !hasOutputFilter(policy))
|
|
1298
|
+
return diagnostics;
|
|
1299
|
+
const anchored = project ? { ...options, root: project.root } : options;
|
|
1300
|
+
return diagnostics.filter((d) => {
|
|
1301
|
+
const map = project ? project.forFile(d.filePath ?? options.filePath) : policy;
|
|
1302
|
+
return !map || !hasOutputFilter(map) || keptByRulePolicy(d, map, anchored);
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
function hasOutputFilter(policyMap) {
|
|
1306
|
+
for (const rawEntry of Object.values(policyMap)) {
|
|
1307
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1308
|
+
continue;
|
|
1309
|
+
}
|
|
1310
|
+
const entry = rawEntry;
|
|
1311
|
+
if ((entry.disable?.length ?? 0) > 0 || (entry.select?.length ?? 0) > 0 || (entry.ignorePaths?.length ?? 0) > 0) {
|
|
1312
|
+
return true;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
function keptByRulePolicy(d, policyMap, options) {
|
|
1318
|
+
const ruleId = d.rule ?? d.code;
|
|
1319
|
+
if (!ruleId)
|
|
1320
|
+
return true;
|
|
1321
|
+
const filePath = d.filePath ?? options.filePath;
|
|
1322
|
+
if (filePath && ruleIgnoredForPath(ruleId, filePath, options.root, policyMap))
|
|
1323
|
+
return false;
|
|
1324
|
+
const { dropped } = evaluateRulePolicy(ruleId, policyMap);
|
|
1325
|
+
return !dropped;
|
|
1326
|
+
}
|
|
1327
|
+
function rulePolicyMapFromConfig(rules2) {
|
|
1328
|
+
if (!rules2)
|
|
1329
|
+
return void 0;
|
|
1330
|
+
let built;
|
|
1331
|
+
for (const [key2, rawEntry] of Object.entries(rules2)) {
|
|
1332
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
const entry = rawEntry;
|
|
1336
|
+
const hasDisable = (entry.disable?.length ?? 0) > 0;
|
|
1337
|
+
const hasSelect = (entry.select?.length ?? 0) > 0;
|
|
1338
|
+
const hasIgnorePaths = (entry.ignorePaths?.length ?? 0) > 0;
|
|
1339
|
+
if (!hasDisable && !hasSelect && !hasIgnorePaths)
|
|
1340
|
+
continue;
|
|
1341
|
+
built ??= {};
|
|
1342
|
+
built[key2] = {
|
|
1343
|
+
...hasDisable ? { disable: entry.disable } : {},
|
|
1344
|
+
...hasSelect ? { select: entry.select } : {},
|
|
1345
|
+
...hasIgnorePaths ? { ignorePaths: entry.ignorePaths } : {}
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
return built;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// dist/clients/dispatch/utils/lsp-diagnostics.js
|
|
1352
|
+
function convertLspDiagnostics(diags, filePath, options = {}) {
|
|
1353
|
+
const tool = options.tool ?? "lsp";
|
|
1354
|
+
return diags.filter((d) => d.range?.start?.line !== void 0).map((d, idx) => {
|
|
1355
|
+
const severityMap = {
|
|
1356
|
+
1: "error",
|
|
1357
|
+
2: "warning",
|
|
1358
|
+
4: "hint"
|
|
1359
|
+
};
|
|
1360
|
+
const severity = severityMap[d.severity] ?? "info";
|
|
1361
|
+
const semantic = d.severity === 1 ? "blocking" : d.severity === 2 ? "warning" : "none";
|
|
1362
|
+
const code = String(d.code ?? "unknown");
|
|
1363
|
+
const source = d.source ?? tool;
|
|
1364
|
+
const hasSuggestion = options.fixSuggestionByIndex?.has(idx) ?? false;
|
|
1365
|
+
return {
|
|
1366
|
+
id: `${tool}:${code}:${d.range.start.line}`,
|
|
1367
|
+
message: d.message,
|
|
1368
|
+
filePath,
|
|
1369
|
+
line: d.range.start.line + 1,
|
|
1370
|
+
column: d.range.start.character + 1,
|
|
1371
|
+
severity,
|
|
1372
|
+
semantic,
|
|
1373
|
+
tool,
|
|
1374
|
+
rule: `${source}:${code}`,
|
|
1375
|
+
fixable: hasSuggestion,
|
|
1376
|
+
autoFixAvailable: false,
|
|
1377
|
+
fixKind: hasSuggestion ? "suggestion" : void 0,
|
|
1378
|
+
fixSuggestion: options.fixSuggestionByIndex?.get(idx),
|
|
1379
|
+
scanOrigin: options.scanOrigin,
|
|
1380
|
+
// #4484 r2: the publishing server, so a run that leaves it
|
|
1381
|
+
// unconfirmed keeps its recorded blockers. Never identity.
|
|
1382
|
+
...d.serverId !== void 0 && { serverId: d.serverId }
|
|
1383
|
+
};
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// dist/clients/dispatch/finding-policy.js
|
|
1388
|
+
function applyFindingPolicy(diagnostics, options) {
|
|
1389
|
+
const inlineKept = applyInlineSuppressions(diagnostics, options.content);
|
|
1390
|
+
const disposed = filterDisposed(inlineKept, options);
|
|
1391
|
+
return {
|
|
1392
|
+
kept: applyRulePolicy(disposed, options.policyMap, {
|
|
1393
|
+
root: options.cwd,
|
|
1394
|
+
filePath: options.filePath
|
|
1395
|
+
}),
|
|
1396
|
+
inlineKept,
|
|
1397
|
+
disposed
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
function applyFindingPolicyByOwner(diagnostics, options) {
|
|
1401
|
+
const own = [];
|
|
1402
|
+
const byOwner = /* @__PURE__ */ new Map();
|
|
1403
|
+
for (const d of diagnostics) {
|
|
1404
|
+
const owner = d.filePath;
|
|
1405
|
+
if (!owner || owner === options.filePath) {
|
|
1406
|
+
own.push(d);
|
|
1407
|
+
continue;
|
|
1408
|
+
}
|
|
1409
|
+
const group = byOwner.get(owner);
|
|
1410
|
+
if (group)
|
|
1411
|
+
group.push(d);
|
|
1412
|
+
else
|
|
1413
|
+
byOwner.set(owner, [d]);
|
|
1414
|
+
}
|
|
1415
|
+
for (const [owner, group] of byOwner) {
|
|
1416
|
+
if (!pathsEqual(owner, options.filePath))
|
|
1417
|
+
continue;
|
|
1418
|
+
own.push(...group);
|
|
1419
|
+
byOwner.delete(owner);
|
|
1420
|
+
}
|
|
1421
|
+
if (byOwner.size === 0)
|
|
1422
|
+
return applyFindingPolicy(diagnostics, options);
|
|
1423
|
+
const inlineKept = /* @__PURE__ */ new Set();
|
|
1424
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1425
|
+
const kept = /* @__PURE__ */ new Set();
|
|
1426
|
+
const collect = (result) => {
|
|
1427
|
+
for (const d of result.inlineKept)
|
|
1428
|
+
inlineKept.add(d);
|
|
1429
|
+
for (const d of result.disposed)
|
|
1430
|
+
disposed.add(d);
|
|
1431
|
+
for (const d of result.kept)
|
|
1432
|
+
kept.add(d);
|
|
1433
|
+
};
|
|
1434
|
+
collect(applyFindingPolicy(own, options));
|
|
1435
|
+
for (const [owner, group] of byOwner) {
|
|
1436
|
+
const content = isWithinIdentity(owner, options.cwd) ? readFileContent(owner) : void 0;
|
|
1437
|
+
if (content === void 0) {
|
|
1438
|
+
collect({
|
|
1439
|
+
kept: applyRulePolicy(group, options.policyMap, {
|
|
1440
|
+
root: options.cwd,
|
|
1441
|
+
filePath: owner
|
|
1442
|
+
}),
|
|
1443
|
+
inlineKept: group,
|
|
1444
|
+
disposed: group
|
|
1445
|
+
});
|
|
1446
|
+
continue;
|
|
1447
|
+
}
|
|
1448
|
+
collect(applyFindingPolicy(group, { ...options, filePath: owner, content }));
|
|
1449
|
+
}
|
|
1450
|
+
const inOrder = (survivors) => diagnostics.flatMap((d) => survivors.has(d) ? [d] : []);
|
|
1451
|
+
return {
|
|
1452
|
+
kept: inOrder(kept),
|
|
1453
|
+
inlineKept: inOrder(inlineKept),
|
|
1454
|
+
disposed: inOrder(disposed)
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function loadProjectRulePolicy(cwd) {
|
|
1458
|
+
return projectRulePolicy(cwd);
|
|
1459
|
+
}
|
|
1460
|
+
function filterDisposed(diagnostics, options) {
|
|
1461
|
+
const identities = options.identities;
|
|
1462
|
+
if (!identities) {
|
|
1463
|
+
return applyDispositions(diagnostics, options.cwd, options.filePath, options.content);
|
|
1464
|
+
}
|
|
1465
|
+
if (!diagnostics.length || !hasAnyDispositionMarks(options.cwd)) {
|
|
1466
|
+
return diagnostics;
|
|
1467
|
+
}
|
|
1468
|
+
const expanded = diagnostics.flatMap((diagnostic) => identities(diagnostic).map((identity) => ({
|
|
1469
|
+
diagnostic,
|
|
1470
|
+
candidate: {
|
|
1471
|
+
...identity,
|
|
1472
|
+
message: diagnostic.message,
|
|
1473
|
+
...diagnostic.line !== void 0 && { line: diagnostic.line },
|
|
1474
|
+
...diagnostic.semantic !== void 0 && {
|
|
1475
|
+
semantic: diagnostic.semantic
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
})));
|
|
1479
|
+
const survivors = new Set(applyDispositions(expanded.map((entry) => entry.candidate), options.cwd, options.filePath, options.content));
|
|
1480
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1481
|
+
for (const entry of expanded) {
|
|
1482
|
+
if (!survivors.has(entry.candidate))
|
|
1483
|
+
disposed.add(entry.diagnostic);
|
|
1484
|
+
}
|
|
1485
|
+
return disposed.size === 0 ? diagnostics : diagnostics.filter((diagnostic) => !disposed.has(diagnostic));
|
|
1486
|
+
}
|
|
1487
|
+
function probeIdentities(canonical, raw) {
|
|
1488
|
+
const rendered = [
|
|
1489
|
+
[canonical.tool, canonical.rule]
|
|
1490
|
+
];
|
|
1491
|
+
if (raw !== void 0 && (raw.source !== void 0 || raw.code !== void 0)) {
|
|
1492
|
+
rendered.push([
|
|
1493
|
+
raw.source,
|
|
1494
|
+
raw.code === void 0 ? void 0 : String(raw.code)
|
|
1495
|
+
]);
|
|
1496
|
+
}
|
|
1497
|
+
return expandRenderedIdentities(rendered);
|
|
1498
|
+
}
|
|
1499
|
+
function renderedRuleIdentities(diagnostic) {
|
|
1500
|
+
return expandRenderedIdentities([[diagnostic.tool, diagnostic.rule]]);
|
|
1501
|
+
}
|
|
1502
|
+
function inlineBlockerIdentities(diagnostic) {
|
|
1503
|
+
return expandRenderedIdentities([
|
|
1504
|
+
[diagnostic.tool, diagnostic.rule],
|
|
1505
|
+
[void 0, void 0]
|
|
1506
|
+
]);
|
|
1507
|
+
}
|
|
1508
|
+
function applyPushedFindingPolicy(findings, options) {
|
|
1509
|
+
const { kept } = applyFindingPolicyByOwner(findings, {
|
|
1510
|
+
cwd: options.cwd,
|
|
1511
|
+
filePath: options.filePath,
|
|
1512
|
+
content: options.content ?? "",
|
|
1513
|
+
// The file's own config owner decides, so a nested `.pi-lens.json` applies.
|
|
1514
|
+
policyMap: loadProjectRulePolicy(options.cwd),
|
|
1515
|
+
identities: renderedRuleIdentities
|
|
1516
|
+
});
|
|
1517
|
+
return { kept, suppressed: findings.length - kept.length };
|
|
1518
|
+
}
|
|
1519
|
+
function applyPushedFindingPolicyByFile(findings, cwd) {
|
|
1520
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
1521
|
+
for (const finding of findings) {
|
|
1522
|
+
const group = byFile.get(finding.filePath);
|
|
1523
|
+
if (group)
|
|
1524
|
+
group.push(finding);
|
|
1525
|
+
else
|
|
1526
|
+
byFile.set(finding.filePath, [finding]);
|
|
1527
|
+
}
|
|
1528
|
+
const kept = [];
|
|
1529
|
+
let suppressed = 0;
|
|
1530
|
+
for (const [filePath, group] of byFile) {
|
|
1531
|
+
const policy = applyPushedFindingPolicy(group, {
|
|
1532
|
+
cwd,
|
|
1533
|
+
filePath,
|
|
1534
|
+
content: readFileContent(filePath)
|
|
1535
|
+
});
|
|
1536
|
+
kept.push(...policy.kept);
|
|
1537
|
+
suppressed += policy.suppressed;
|
|
1538
|
+
}
|
|
1539
|
+
return { kept, suppressed };
|
|
1540
|
+
}
|
|
1541
|
+
function expandRenderedIdentities(rendered) {
|
|
1542
|
+
const out = [];
|
|
1543
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1544
|
+
for (const [tool, rule] of rendered) {
|
|
1545
|
+
for (const candidateTool of [tool, void 0]) {
|
|
1546
|
+
const key2 = `${candidateTool ?? ""}\0${rule ?? ""}`;
|
|
1547
|
+
if (seen.has(key2))
|
|
1548
|
+
continue;
|
|
1549
|
+
seen.add(key2);
|
|
1550
|
+
out.push({
|
|
1551
|
+
...candidateTool !== void 0 && { tool: candidateTool },
|
|
1552
|
+
...rule !== void 0 && { rule }
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
return out;
|
|
1557
|
+
}
|
|
1558
|
+
function applyLspFindingPolicy(diagnostics, options) {
|
|
1559
|
+
if (!diagnostics.length)
|
|
1560
|
+
return { kept: diagnostics, inlineKept: diagnostics };
|
|
1561
|
+
const content = options.content ?? "";
|
|
1562
|
+
const anchored = [];
|
|
1563
|
+
for (const diagnostic of diagnostics) {
|
|
1564
|
+
if (diagnostic.range?.start?.line !== void 0)
|
|
1565
|
+
anchored.push(diagnostic);
|
|
1566
|
+
}
|
|
1567
|
+
if (!anchored.length)
|
|
1568
|
+
return { kept: diagnostics, inlineKept: diagnostics };
|
|
1569
|
+
const converted = convertLspDiagnostics(anchored, options.filePath);
|
|
1570
|
+
retagAuxiliaryDiagnostics(converted, anchored, content, {
|
|
1571
|
+
cwd: options.cwd,
|
|
1572
|
+
fileRole: options.fileRole
|
|
1573
|
+
});
|
|
1574
|
+
const rawByConverted = /* @__PURE__ */ new Map();
|
|
1575
|
+
for (const [index, diagnostic] of converted.entries()) {
|
|
1576
|
+
const raw = anchored[index];
|
|
1577
|
+
if (raw !== void 0)
|
|
1578
|
+
rawByConverted.set(diagnostic, raw);
|
|
1579
|
+
}
|
|
1580
|
+
const { kept, inlineKept } = applyFindingPolicy(converted, {
|
|
1581
|
+
cwd: options.cwd,
|
|
1582
|
+
filePath: options.filePath,
|
|
1583
|
+
content,
|
|
1584
|
+
policyMap: options.policyMap,
|
|
1585
|
+
identities: (diagnostic) => probeIdentities(diagnostic, rawByConverted.get(diagnostic))
|
|
1586
|
+
});
|
|
1587
|
+
const survivorsOf = (survivors) => {
|
|
1588
|
+
if (survivors.length === converted.length)
|
|
1589
|
+
return diagnostics;
|
|
1590
|
+
const keptConverted = new Set(survivors);
|
|
1591
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
1592
|
+
for (const [diagnostic, raw] of rawByConverted) {
|
|
1593
|
+
if (!keptConverted.has(diagnostic))
|
|
1594
|
+
dropped.add(raw);
|
|
1595
|
+
}
|
|
1596
|
+
return diagnostics.filter((d) => !dropped.has(d));
|
|
1597
|
+
};
|
|
1598
|
+
return { kept: survivorsOf(kept), inlineKept: survivorsOf(inlineKept) };
|
|
1599
|
+
}
|
|
1600
|
+
function filterFindingsByDisposition(findings, cwd, toDiagnostic3) {
|
|
1601
|
+
if (findings.length === 0)
|
|
1602
|
+
return { kept: findings, suppressed: 0 };
|
|
1603
|
+
const candidates = findings.flatMap((finding) => {
|
|
1604
|
+
const diagnostic = toDiagnostic3(finding);
|
|
1605
|
+
return renderedRuleIdentities(diagnostic).map((identity) => ({
|
|
1606
|
+
finding,
|
|
1607
|
+
candidate: {
|
|
1608
|
+
filePath: diagnostic.filePath,
|
|
1609
|
+
message: diagnostic.message,
|
|
1610
|
+
...diagnostic.line !== void 0 && { line: diagnostic.line },
|
|
1611
|
+
...diagnostic.semantic !== void 0 && {
|
|
1612
|
+
semantic: diagnostic.semantic
|
|
1613
|
+
},
|
|
1614
|
+
...identity.tool !== void 0 && { tool: identity.tool },
|
|
1615
|
+
...identity.rule !== void 0 && { rule: identity.rule }
|
|
1616
|
+
}
|
|
1617
|
+
}));
|
|
1618
|
+
});
|
|
1619
|
+
const survivors = new Set(applyDispositionsMultiFile(candidates.map((c) => c.candidate), cwd, (d) => d.filePath));
|
|
1620
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1621
|
+
for (const candidate of candidates) {
|
|
1622
|
+
if (!survivors.has(candidate.candidate))
|
|
1623
|
+
disposed.add(candidate.finding);
|
|
1624
|
+
}
|
|
1625
|
+
const kept = disposed.size === 0 ? findings : findings.filter((finding) => !disposed.has(finding));
|
|
1626
|
+
return { kept, suppressed: findings.length - kept.length };
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1121
1629
|
// dist/clients/dispatch/plan.js
|
|
1122
1630
|
function primary(kind) {
|
|
1123
1631
|
const group = getPrimaryDispatchGroup(kind, true);
|
|
@@ -1443,6 +1951,7 @@ function settledSnapshot(entry) {
|
|
|
1443
1951
|
// the scope that owned it, and the gate's peek can fence with it.
|
|
1444
1952
|
session: entry.session,
|
|
1445
1953
|
sessionId: entry.sessionId,
|
|
1954
|
+
carriedFromTurnKey: entry.carriedFromTurnKey,
|
|
1446
1955
|
result: entry.result
|
|
1447
1956
|
};
|
|
1448
1957
|
}
|
|
@@ -1503,7 +2012,7 @@ function track(tracked) {
|
|
|
1503
2012
|
}
|
|
1504
2013
|
}
|
|
1505
2014
|
}
|
|
1506
|
-
async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, currentSessionId) {
|
|
2015
|
+
async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, currentSessionId, turnKey) {
|
|
1507
2016
|
if (pending.length === 0)
|
|
1508
2017
|
return [];
|
|
1509
2018
|
const current = pending.splice(0, pending.length);
|
|
@@ -1511,8 +2020,8 @@ async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, curre
|
|
|
1511
2020
|
if (maxWaitMs === 0)
|
|
1512
2021
|
await Promise.resolve();
|
|
1513
2022
|
if (maxWaitMs > 0 && current.some((entry) => !entry.settled)) {
|
|
1514
|
-
await new Promise((
|
|
1515
|
-
const timer = setTimeout(
|
|
2023
|
+
await new Promise((resolve47) => {
|
|
2024
|
+
const timer = setTimeout(resolve47, maxWaitMs);
|
|
1516
2025
|
timer.unref?.();
|
|
1517
2026
|
});
|
|
1518
2027
|
}
|
|
@@ -1530,6 +2039,8 @@ async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, curre
|
|
|
1530
2039
|
if (entry.settled && entry.result) {
|
|
1531
2040
|
results.push(settledSnapshot(entry));
|
|
1532
2041
|
} else {
|
|
2042
|
+
if (turnKey !== void 0 && entry.carriedFromTurnKey === void 0)
|
|
2043
|
+
entry.carriedFromTurnKey = turnKey;
|
|
1533
2044
|
pending.push(entry);
|
|
1534
2045
|
}
|
|
1535
2046
|
}
|
|
@@ -1599,103 +2110,60 @@ function laneCopyStandsFor(lane) {
|
|
|
1599
2110
|
return (d) => (rankByKey.get(laneKey(d)) ?? -1) >= semanticRank(d.semantic);
|
|
1600
2111
|
}
|
|
1601
2112
|
|
|
1602
|
-
// dist/clients/dispatch/
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
return
|
|
1610
|
-
}
|
|
1611
|
-
function
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
if (matchesRule(candidate, raw, norm))
|
|
1640
|
-
return { matched: true, sawEntry };
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
return { matched: false, sawEntry };
|
|
1644
|
-
}
|
|
1645
|
-
function matchesRule(entry, raw, normalized) {
|
|
1646
|
-
if (entry === raw)
|
|
1647
|
-
return true;
|
|
1648
|
-
return normalizeRuleId(entry) === normalized;
|
|
1649
|
-
}
|
|
1650
|
-
function applyRulePolicy(diagnostics, policyMap, options) {
|
|
1651
|
-
if (!policyMap)
|
|
1652
|
-
return diagnostics;
|
|
1653
|
-
let hasFilter = false;
|
|
1654
|
-
for (const rawEntry of Object.values(policyMap)) {
|
|
1655
|
-
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1656
|
-
continue;
|
|
1657
|
-
}
|
|
1658
|
-
const entry = rawEntry;
|
|
1659
|
-
if ((entry.disable?.length ?? 0) > 0 || (entry.select?.length ?? 0) > 0 || (entry.ignorePaths?.length ?? 0) > 0) {
|
|
1660
|
-
hasFilter = true;
|
|
1661
|
-
break;
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
if (!hasFilter)
|
|
1665
|
-
return diagnostics;
|
|
1666
|
-
return diagnostics.filter((d) => {
|
|
1667
|
-
const ruleId = d.rule ?? d.code;
|
|
1668
|
-
if (!ruleId)
|
|
1669
|
-
return true;
|
|
1670
|
-
const filePath = d.filePath ?? options.filePath;
|
|
1671
|
-
if (filePath && ruleIgnoredForPath(ruleId, filePath, options.root, policyMap))
|
|
1672
|
-
return false;
|
|
1673
|
-
const { dropped } = evaluateRulePolicy(ruleId, policyMap);
|
|
1674
|
-
return !dropped;
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
function rulePolicyMapFromConfig(rules2) {
|
|
1678
|
-
if (!rules2)
|
|
1679
|
-
return void 0;
|
|
1680
|
-
let built;
|
|
1681
|
-
for (const [key2, rawEntry] of Object.entries(rules2)) {
|
|
1682
|
-
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1683
|
-
continue;
|
|
2113
|
+
// dist/clients/dispatch/disabled-runners.js
|
|
2114
|
+
var DISABLED_BY_CONFIG_SKIP_REASON = "disabled-by-config";
|
|
2115
|
+
var DISABLED_RUNNERS_POINTER = "/dispatch/disabledRunners";
|
|
2116
|
+
function memberPointer(index) {
|
|
2117
|
+
return `${DISABLED_RUNNERS_POINTER}/${index}`;
|
|
2118
|
+
}
|
|
2119
|
+
function memberProvenance(resolution, index) {
|
|
2120
|
+
return resolution.provenance.get(memberPointer(index)) ?? resolution.provenance.get(DISABLED_RUNNERS_POINTER);
|
|
2121
|
+
}
|
|
2122
|
+
function dispatchSection(value) {
|
|
2123
|
+
const section = value.dispatch;
|
|
2124
|
+
return section && typeof section === "object" && !Array.isArray(section) ? section : {};
|
|
2125
|
+
}
|
|
2126
|
+
function disabledRunnersOf(resolution) {
|
|
2127
|
+
const members = dispatchSection(resolution.value).disabledRunners;
|
|
2128
|
+
if (!Array.isArray(members))
|
|
2129
|
+
return { runners: [], records: [] };
|
|
2130
|
+
const validate = runnerIdentityPopulated();
|
|
2131
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2132
|
+
const runners = [];
|
|
2133
|
+
const records = [];
|
|
2134
|
+
members.forEach((member, index) => {
|
|
2135
|
+
if (typeof member !== "string" || seen.has(member))
|
|
2136
|
+
return;
|
|
2137
|
+
const decidedBy = memberProvenance(resolution, index);
|
|
2138
|
+
if (validate && !isKnownRunnerId(member)) {
|
|
2139
|
+
const pointer = memberPointer(index);
|
|
2140
|
+
const file = decidedBy?.file ?? resolution.documents.at(-1)?.file ?? "";
|
|
2141
|
+
records.push({
|
|
2142
|
+
code: "PILENS_CFG_0005",
|
|
2143
|
+
file,
|
|
2144
|
+
key: pointer,
|
|
2145
|
+
subject: migrationSubject(file, pointer),
|
|
2146
|
+
reason: `dispatch.disabledRunners entry "${boundedKeyLabel(member)}" is not a recognized dispatch runner id; dropped`,
|
|
2147
|
+
...decidedBy?.tier ? { tier: decidedBy.tier } : {}
|
|
2148
|
+
});
|
|
2149
|
+
return;
|
|
1684
2150
|
}
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
2151
|
+
seen.add(member);
|
|
2152
|
+
runners.push({ id: member, ...decidedBy ? { decidedBy } : {} });
|
|
2153
|
+
});
|
|
2154
|
+
return { runners, records };
|
|
2155
|
+
}
|
|
2156
|
+
function disabledRunnerIdsFor(resolution) {
|
|
2157
|
+
const resolved = disabledRunnersOf(resolution);
|
|
2158
|
+
if (resolved.records.length > 0) {
|
|
2159
|
+
const anchor = resolved.records.at(-1);
|
|
2160
|
+
const file = anchor?.file ?? resolution.documents.at(-1)?.file ?? "";
|
|
2161
|
+
reportPiLensConfigRecords(finalizeRecords(resolved.records, {
|
|
2162
|
+
file,
|
|
2163
|
+
...anchor?.tier ? { tier: anchor.tier } : {}
|
|
2164
|
+
}));
|
|
1697
2165
|
}
|
|
1698
|
-
return
|
|
2166
|
+
return resolved.runners.length === 0 ? void 0 : new Set(resolved.runners.map((runner) => runner.id));
|
|
1699
2167
|
}
|
|
1700
2168
|
|
|
1701
2169
|
// dist/clients/dispatch/tool-profile.js
|
|
@@ -1969,16 +2437,16 @@ async function checkToolAvailability(command, facts) {
|
|
|
1969
2437
|
function readFilePrefix(filePath, maxBytes = 4096) {
|
|
1970
2438
|
let fd;
|
|
1971
2439
|
try {
|
|
1972
|
-
fd =
|
|
2440
|
+
fd = fs4.openSync(filePath, "r");
|
|
1973
2441
|
const buffer = Buffer.alloc(maxBytes);
|
|
1974
|
-
const bytesRead =
|
|
2442
|
+
const bytesRead = fs4.readSync(fd, buffer, 0, maxBytes, 0);
|
|
1975
2443
|
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
1976
2444
|
} catch {
|
|
1977
2445
|
return void 0;
|
|
1978
2446
|
} finally {
|
|
1979
2447
|
if (fd !== void 0) {
|
|
1980
2448
|
try {
|
|
1981
|
-
|
|
2449
|
+
fs4.closeSync(fd);
|
|
1982
2450
|
} catch {
|
|
1983
2451
|
}
|
|
1984
2452
|
}
|
|
@@ -1998,7 +2466,9 @@ function createDispatchContext(filePath, cwd, pi, facts, blockingOnly, modifiedR
|
|
|
1998
2466
|
includeDeclarations: false
|
|
1999
2467
|
}) : void 0;
|
|
2000
2468
|
const projectConfig = loadPiLensProjectConfig(normalizedCwd);
|
|
2001
|
-
const
|
|
2469
|
+
const policyConfig = resolveDispatchPolicyConfigForFile(absoluteFilePath, normalizedProjectRoot);
|
|
2470
|
+
const rulePolicy = rulePolicyMapFromResolution(policyConfig, normalizedProjectRoot);
|
|
2471
|
+
const disabledRunnerIds = disabledRunnerIdsFor(policyConfig);
|
|
2002
2472
|
return {
|
|
2003
2473
|
filePath: normalizedFilePath,
|
|
2004
2474
|
projectRoot: normalizedProjectRoot,
|
|
@@ -2014,6 +2484,7 @@ function createDispatchContext(filePath, cwd, pi, facts, blockingOnly, modifiedR
|
|
|
2014
2484
|
facts,
|
|
2015
2485
|
projectConfig,
|
|
2016
2486
|
rulePolicy,
|
|
2487
|
+
...disabledRunnerIds !== void 0 && { disabledRunnerIds },
|
|
2017
2488
|
blockingOnly,
|
|
2018
2489
|
modifiedRanges,
|
|
2019
2490
|
writeIndex,
|
|
@@ -2191,9 +2662,15 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2191
2662
|
const silentServerIds = unconfirmedServerIds.filter((id) => !deferredIds.has(id));
|
|
2192
2663
|
const dedupeSet = (ids) => [...new Set(ids)].map(normalizeEphemeralMapKey).sort((a, b) => Number(a > b) - Number(a < b)).join(",");
|
|
2193
2664
|
const onceKey2 = `${ctx.kind}:${ctx.filePath}:${dedupeSet(silentServerIds)}|${dedupeSet(deferredServerIds)}`;
|
|
2665
|
+
const statusParts = [];
|
|
2666
|
+
if (deferredServerIds.length > 0)
|
|
2667
|
+
statusParts.push(`${markerFor(deferredServerIds)} deferred`);
|
|
2668
|
+
if (silentServerIds.length > 0)
|
|
2669
|
+
statusParts.push(`${markerFor(silentServerIds)} silent`);
|
|
2670
|
+
const unconfirmedStatus2 = `${statusParts.join(", ")} (diagnostics are incomplete)`;
|
|
2194
2671
|
if (dedupe) {
|
|
2195
2672
|
if (coverageNoticeSeen.has(onceKey2))
|
|
2196
|
-
return {};
|
|
2673
|
+
return { unconfirmedStatus: unconfirmedStatus2 };
|
|
2197
2674
|
coverageNoticeSeen.add(onceKey2);
|
|
2198
2675
|
}
|
|
2199
2676
|
const coverageParts = [];
|
|
@@ -2211,7 +2688,8 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2211
2688
|
severity: "warning",
|
|
2212
2689
|
semantic: "warning",
|
|
2213
2690
|
tool: "pi-lens"
|
|
2214
|
-
}
|
|
2691
|
+
},
|
|
2692
|
+
unconfirmedStatus: unconfirmedStatus2
|
|
2215
2693
|
};
|
|
2216
2694
|
}
|
|
2217
2695
|
const primaryHasCoverage = relevant.some(hasUsableResult);
|
|
@@ -2240,12 +2718,18 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2240
2718
|
if (anyFallbackHasCoverage)
|
|
2241
2719
|
return { coverage: "fallback" };
|
|
2242
2720
|
const cause = combinePrimaryUnavailableCauses(relevant.flatMap((r) => r.primaryUnavailableCause ?? []));
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2721
|
+
const deniedRunnerIds = relevant.filter((r) => r.skipReason === DISABLED_BY_CONFIG_SKIP_REASON).map((r) => r.runnerId);
|
|
2722
|
+
const deniedNote = `${deniedRunnerIds.join(", ")} disabled in config by dispatch.disabledRunners`;
|
|
2723
|
+
const onlySwitchedOff = relevant.every((r) => r.skipReason === DISABLED_BY_CONFIG_SKIP_REASON || isNotApplicableSkipReason(r.skipReason) || r.primaryUnavailableCause === "disabled" || r.primaryUnavailableCause === "disabledFallback");
|
|
2724
|
+
const unconfirmedStatus = cause ? `no primary language server answered (${PRIMARY_UNAVAILABLE_CAUSE[cause]})${deniedRunnerIds.length > 0 ? `; ${deniedNote}` : ""}` : deniedRunnerIds.length > 0 ? onlySwitchedOff ? `not checked (${deniedNote})` : `not fully checked (a language tool is missing, timed out, or failed to run; ${deniedNote})` : "not fully checked (a language tool is missing, timed out, or failed to run)";
|
|
2725
|
+
if (onlySwitchedOff && (cause === "disabled" || cause === "disabledFallback" || cause === void 0 && deniedRunnerIds.length > 0)) {
|
|
2245
2726
|
const disabledIds = [
|
|
2246
2727
|
...new Set(relevant.flatMap((r) => r.disabledPrimaryServerIds ?? []))
|
|
2247
2728
|
].sort((a, b) => Number(a > b) - Number(a < b));
|
|
2248
|
-
const onceKeys =
|
|
2729
|
+
const onceKeys = [
|
|
2730
|
+
...disabledIds.map((id) => `disabled-primary:${id}`),
|
|
2731
|
+
...deniedRunnerIds.map((id) => `disabled-runner:${id}`)
|
|
2732
|
+
];
|
|
2249
2733
|
if (dedupe) {
|
|
2250
2734
|
if (onceKeys.every((key2) => coverageNoticeSeen.has(key2)))
|
|
2251
2735
|
return { unconfirmedStatus };
|
|
@@ -2254,8 +2738,8 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2254
2738
|
}
|
|
2255
2739
|
return {
|
|
2256
2740
|
notice: {
|
|
2257
|
-
id: `coverage-disabled:${ctx.kind}:${disabledIds.join(",")}`,
|
|
2258
|
-
message: cause === "disabled" ? `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Primary LSP (${disabledIds.join(", ")}) is disabled in config by lsp.disabledServers, so no language server checks these files this session (not a clean result).` : `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Primary LSP (${disabledIds.join(", ")}) is disabled in config by lsp.disabledServers and its fallback did not answer, so no language server checked these files (not a clean result).`,
|
|
2741
|
+
id: `coverage-disabled:${ctx.kind}:${[...disabledIds, ...deniedRunnerIds].join(",")}`,
|
|
2742
|
+
message: disabledIds.length === 0 ? `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Runner (${deniedRunnerIds.join(", ")}) is disabled in config by dispatch.disabledRunners, so no runner checks these files this session (not a clean result).` : deniedRunnerIds.length > 0 ? `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Primary LSP (${disabledIds.join(", ")}) is disabled in config by lsp.disabledServers and runner (${deniedRunnerIds.join(", ")}) by dispatch.disabledRunners, so nothing checks these files this session (not a clean result).` : cause === "disabled" ? `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Primary LSP (${disabledIds.join(", ")}) is disabled in config by lsp.disabledServers, so no language server checks these files this session (not a clean result).` : `Pi-lens ${ctx.kind} analysis unconfirmed \u2014 Primary LSP (${disabledIds.join(", ")}) is disabled in config by lsp.disabledServers and its fallback did not answer, so no language server checked these files (not a clean result).`,
|
|
2259
2743
|
filePath: ctx.filePath,
|
|
2260
2744
|
severity: "warning",
|
|
2261
2745
|
semantic: "warning",
|
|
@@ -2273,7 +2757,7 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2273
2757
|
return {
|
|
2274
2758
|
notice: {
|
|
2275
2759
|
id: `coverage-unavailable:${ctx.kind}:${path4.basename(ctx.filePath)}`,
|
|
2276
|
-
message: `Pi-lens ${ctx.kind} analysis unavailable \u2014 a language tool is missing, timed out, or failed to run, or the LSP server isn't ready yet, so this file was not fully checked (not a clean result)
|
|
2760
|
+
message: `Pi-lens ${ctx.kind} analysis unavailable \u2014 a language tool is missing, timed out, or failed to run, or the LSP server isn't ready yet, so this file was not fully checked (not a clean result).${deniedRunnerIds.length > 0 ? ` Runner (${deniedRunnerIds.join(", ")}) is also disabled in config by dispatch.disabledRunners.` : ""}`,
|
|
2277
2761
|
filePath: ctx.filePath,
|
|
2278
2762
|
severity: "warning",
|
|
2279
2763
|
semantic: "warning",
|
|
@@ -2389,6 +2873,30 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2389
2873
|
});
|
|
2390
2874
|
continue;
|
|
2391
2875
|
}
|
|
2876
|
+
if (ctx.disabledRunnerIds?.has(runnerId)) {
|
|
2877
|
+
const runnerEnd2 = Date.now();
|
|
2878
|
+
latencies.push({
|
|
2879
|
+
runnerId,
|
|
2880
|
+
startTime: runnerStart,
|
|
2881
|
+
endTime: runnerEnd2,
|
|
2882
|
+
durationMs: 0,
|
|
2883
|
+
status: "skipped",
|
|
2884
|
+
diagnosticCount: 0,
|
|
2885
|
+
semantic: "none",
|
|
2886
|
+
skipReason: DISABLED_BY_CONFIG_SKIP_REASON
|
|
2887
|
+
});
|
|
2888
|
+
logLatency({
|
|
2889
|
+
type: "runner",
|
|
2890
|
+
filePath: ctx.filePath,
|
|
2891
|
+
runnerId,
|
|
2892
|
+
durationMs: 0,
|
|
2893
|
+
status: "skipped",
|
|
2894
|
+
diagnosticCount: 0,
|
|
2895
|
+
semantic: "none",
|
|
2896
|
+
metadata: { skipReason: DISABLED_BY_CONFIG_SKIP_REASON }
|
|
2897
|
+
});
|
|
2898
|
+
continue;
|
|
2899
|
+
}
|
|
2392
2900
|
let shouldRun = true;
|
|
2393
2901
|
if (runner.when) {
|
|
2394
2902
|
try {
|
|
@@ -2764,14 +3272,19 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2764
3272
|
const deliveredDiagnostics = laneCopyByRunner.size === 0 ? allDiagnostics : allDiagnostics.flatMap((d) => laneCopyByRunner.get(d.runnerId ?? "")?.(d) ? [] : [d]);
|
|
2765
3273
|
const dedupedDiagnostics = dedupeOverlappingDiagnostics(deliveredDiagnostics);
|
|
2766
3274
|
const fileContent = ctx.facts.getFileFact(ctx.filePath, "file.content") ?? "";
|
|
2767
|
-
const
|
|
3275
|
+
const rulePolicyRoot = ctx.projectRoot ?? ctx.cwd;
|
|
3276
|
+
const rulePolicy = projectRulePolicy(rulePolicyRoot, "rulePolicy" in ctx ? { filePath: ctx.filePath, map: ctx.rulePolicy } : void 0);
|
|
2768
3277
|
const applyOutputFilters = (diags) => {
|
|
2769
3278
|
const dockerOverlap = suppressTrivyConfigDockerOverlap(diags);
|
|
2770
3279
|
const overlap = suppressLintOverlapsWithLsp(dockerOverlap);
|
|
2771
|
-
const
|
|
2772
|
-
|
|
3280
|
+
const { disposed: disposition } = applyFindingPolicyByOwner(overlap, {
|
|
3281
|
+
cwd: rulePolicyRoot,
|
|
3282
|
+
filePath: ctx.filePath,
|
|
3283
|
+
content: fileContent,
|
|
3284
|
+
policyMap: void 0
|
|
3285
|
+
});
|
|
2773
3286
|
return applyRulePolicy(disposition, rulePolicy, {
|
|
2774
|
-
root:
|
|
3287
|
+
root: rulePolicyRoot,
|
|
2775
3288
|
filePath: ctx.filePath
|
|
2776
3289
|
});
|
|
2777
3290
|
};
|
|
@@ -2815,14 +3328,14 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2815
3328
|
provider: ctx.telemetryProvider
|
|
2816
3329
|
};
|
|
2817
3330
|
if (fixedItems.length > 0) {
|
|
2818
|
-
import("./chunk-
|
|
3331
|
+
import("./chunk-4NBWFYWW.js").then(({ appendToWorklog }) => {
|
|
2819
3332
|
appendToWorklog(ctx.cwd, fixedItems, true, worklogIdentity);
|
|
2820
3333
|
}).catch(() => {
|
|
2821
3334
|
});
|
|
2822
3335
|
}
|
|
2823
3336
|
const fixableWarnings = warnings.filter((d) => d.fixable);
|
|
2824
3337
|
if (fixableWarnings.length > 0) {
|
|
2825
|
-
import("./chunk-
|
|
3338
|
+
import("./chunk-4NBWFYWW.js").then(({ appendToWorklog }) => {
|
|
2826
3339
|
appendToWorklog(ctx.cwd, fixableWarnings, false, worklogIdentity);
|
|
2827
3340
|
}).catch(() => {
|
|
2828
3341
|
});
|
|
@@ -2951,313 +3464,82 @@ function looksLikeDiagnosticCodePath(value) {
|
|
|
2951
3464
|
const text = value.trim();
|
|
2952
3465
|
if (!text)
|
|
2953
3466
|
return false;
|
|
2954
|
-
const base = path4.basename(text.replace(/\\/g, "/"));
|
|
2955
|
-
if (/^lsp:\d+(?::\d+)?$/i.test(text) || /^lsp:\d+(?::\d+)?$/i.test(base)) {
|
|
2956
|
-
return true;
|
|
2957
|
-
}
|
|
2958
|
-
if (/^similarity[-:]/i.test(text) || /^similarity[-:]/i.test(base)) {
|
|
2959
|
-
return true;
|
|
2960
|
-
}
|
|
2961
|
-
if (/^[a-z-]+:\d+(?::\d+)?$/i.test(text) || /^[a-z-]+:\d+(?::\d+)?$/i.test(base)) {
|
|
2962
|
-
return true;
|
|
2963
|
-
}
|
|
2964
|
-
return false;
|
|
2965
|
-
}
|
|
2966
|
-
function normalizeDiagnosticFilePath(ctx, rawPath) {
|
|
2967
|
-
if (typeof rawPath === "string" && looksLikeDiagnosticCodePath(rawPath)) {
|
|
2968
|
-
ctx.log(`runner path normalization: ignored diagnostic code-like path '${rawPath}', using current file`);
|
|
2969
|
-
return resolveRunnerPath(ctx.cwd, ctx.filePath);
|
|
2970
|
-
}
|
|
2971
|
-
return resolveRunnerPath(ctx.cwd, rawPath || ctx.filePath);
|
|
2972
|
-
}
|
|
2973
|
-
function failureRowMetadata(result) {
|
|
2974
|
-
const inconclusive = result.inconclusive === true ? { inconclusive: true } : {};
|
|
2975
|
-
if (result.status === "failed" && result.failureKind) {
|
|
2976
|
-
return {
|
|
2977
|
-
failureKind: result.failureKind,
|
|
2978
|
-
failureMessage: result.failureMessage,
|
|
2979
|
-
...inconclusive
|
|
2980
|
-
};
|
|
2981
|
-
}
|
|
2982
|
-
return result.inconclusive === true ? inconclusive : void 0;
|
|
2983
|
-
}
|
|
2984
|
-
async function runRunner(ctx, runner, defaultSemantic) {
|
|
2985
|
-
const timeoutMs = Math.max(runner.timeoutMs ?? RUNNER_TIMEOUT_MS, getRunnerTimeoutFloorMs());
|
|
2986
|
-
let timer;
|
|
2987
|
-
const phaseToken = phaseStarted(runner.id);
|
|
2988
|
-
try {
|
|
2989
|
-
const result = await Promise.race([
|
|
2990
|
-
runner.run(ctx).finally(() => clearTimeout(timer)),
|
|
2991
|
-
new Promise((_, reject) => {
|
|
2992
|
-
timer = setTimeout(() => reject(new Error(`Runner ${runner.id} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
2993
|
-
})
|
|
2994
|
-
]);
|
|
2995
|
-
const diagnostics = result.diagnostics.map((d) => ({
|
|
2996
|
-
...d,
|
|
2997
|
-
filePath: normalizeDiagnosticFilePath(ctx, d.filePath)
|
|
2998
|
-
}));
|
|
2999
|
-
return {
|
|
3000
|
-
...result,
|
|
3001
|
-
diagnostics,
|
|
3002
|
-
semantic: result.semantic ?? defaultSemantic
|
|
3003
|
-
};
|
|
3004
|
-
} catch (error) {
|
|
3005
|
-
clearTimeout(timer);
|
|
3006
|
-
ctx.log(`Runner ${runner.id} failed: ${error}`);
|
|
3007
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3008
|
-
return {
|
|
3009
|
-
status: "failed",
|
|
3010
|
-
diagnostics: [],
|
|
3011
|
-
semantic: defaultSemantic,
|
|
3012
|
-
failureKind: message.includes("timed out") ? "timeout" : "exception",
|
|
3013
|
-
failureMessage: message.slice(0, 200)
|
|
3014
|
-
};
|
|
3015
|
-
} finally {
|
|
3016
|
-
phaseFinished(phaseToken);
|
|
3017
|
-
}
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
// dist/clients/cascade-budget.js
|
|
3021
|
-
function cascadeSettleWaitMs() {
|
|
3022
|
-
const raw = Number(process.env.PI_LENS_CASCADE_SETTLE_WAIT_MS);
|
|
3023
|
-
return Number.isFinite(raw) && raw >= 0 ? raw : 5e3;
|
|
3024
|
-
}
|
|
3025
|
-
var MIN_NEIGHBOUR_BUDGET = RUNTIME_CONFIG.pipeline.cascadeMaxFiles;
|
|
3026
|
-
var DEFAULT_NEIGHBOUR_BUDGET = 40;
|
|
3027
|
-
var CASCADE_NEIGHBOUR_BUDGET = Math.max(MIN_NEIGHBOUR_BUDGET, Number.parseInt(process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET ?? "40", 10) || DEFAULT_NEIGHBOUR_BUDGET);
|
|
3028
|
-
var NEIGHBOUR_BUDGET_OVERRIDDEN = process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET !== void 0 && CASCADE_NEIGHBOUR_BUDGET !== DEFAULT_NEIGHBOUR_BUDGET;
|
|
3029
|
-
|
|
3030
|
-
// dist/clients/dispatch/runners/utils.js
|
|
3031
|
-
import * as fs4 from "node:fs";
|
|
3032
|
-
function readFileContent(filePath) {
|
|
3033
|
-
try {
|
|
3034
|
-
return fs4.readFileSync(filePath, "utf-8");
|
|
3035
|
-
} catch {
|
|
3036
|
-
return void 0;
|
|
3037
|
-
}
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
// dist/clients/dispatch/utils/lsp-diagnostics.js
|
|
3041
|
-
function convertLspDiagnostics(diags, filePath, options = {}) {
|
|
3042
|
-
const tool = options.tool ?? "lsp";
|
|
3043
|
-
return diags.filter((d) => d.range?.start?.line !== void 0).map((d, idx) => {
|
|
3044
|
-
const severityMap = {
|
|
3045
|
-
1: "error",
|
|
3046
|
-
2: "warning",
|
|
3047
|
-
4: "hint"
|
|
3048
|
-
};
|
|
3049
|
-
const severity = severityMap[d.severity] ?? "info";
|
|
3050
|
-
const semantic = d.severity === 1 ? "blocking" : d.severity === 2 ? "warning" : "none";
|
|
3051
|
-
const code = String(d.code ?? "unknown");
|
|
3052
|
-
const source = d.source ?? tool;
|
|
3053
|
-
const hasSuggestion = options.fixSuggestionByIndex?.has(idx) ?? false;
|
|
3054
|
-
return {
|
|
3055
|
-
id: `${tool}:${code}:${d.range.start.line}`,
|
|
3056
|
-
message: d.message,
|
|
3057
|
-
filePath,
|
|
3058
|
-
line: d.range.start.line + 1,
|
|
3059
|
-
column: d.range.start.character + 1,
|
|
3060
|
-
severity,
|
|
3061
|
-
semantic,
|
|
3062
|
-
tool,
|
|
3063
|
-
rule: `${source}:${code}`,
|
|
3064
|
-
fixable: hasSuggestion,
|
|
3065
|
-
autoFixAvailable: false,
|
|
3066
|
-
fixKind: hasSuggestion ? "suggestion" : void 0,
|
|
3067
|
-
fixSuggestion: options.fixSuggestionByIndex?.get(idx),
|
|
3068
|
-
scanOrigin: options.scanOrigin,
|
|
3069
|
-
// #4484 r2: the publishing server, so a run that leaves it
|
|
3070
|
-
// unconfirmed keeps its recorded blockers. Never identity.
|
|
3071
|
-
...d.serverId !== void 0 && { serverId: d.serverId }
|
|
3072
|
-
};
|
|
3073
|
-
});
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
// dist/clients/dispatch/finding-policy.js
|
|
3077
|
-
function applyFindingPolicy(diagnostics, options) {
|
|
3078
|
-
const inlineKept = applyInlineSuppressions(diagnostics, options.content);
|
|
3079
|
-
const disposed = filterDisposed(inlineKept, options);
|
|
3080
|
-
return {
|
|
3081
|
-
kept: applyRulePolicy(disposed, options.policyMap, {
|
|
3082
|
-
root: options.cwd,
|
|
3083
|
-
filePath: options.filePath
|
|
3084
|
-
}),
|
|
3085
|
-
inlineKept,
|
|
3086
|
-
disposed
|
|
3087
|
-
};
|
|
3088
|
-
}
|
|
3089
|
-
function loadProjectRulePolicyMap(cwd) {
|
|
3090
|
-
return resolvedRulePolicyMap(cwd);
|
|
3091
|
-
}
|
|
3092
|
-
function filterDisposed(diagnostics, options) {
|
|
3093
|
-
const identities = options.identities;
|
|
3094
|
-
if (!identities) {
|
|
3095
|
-
return applyDispositions(diagnostics, options.cwd, options.filePath, options.content);
|
|
3096
|
-
}
|
|
3097
|
-
if (!diagnostics.length || !hasAnyDispositionMarks(options.cwd)) {
|
|
3098
|
-
return diagnostics;
|
|
3099
|
-
}
|
|
3100
|
-
const expanded = diagnostics.flatMap((diagnostic) => identities(diagnostic).map((identity) => ({
|
|
3101
|
-
diagnostic,
|
|
3102
|
-
candidate: {
|
|
3103
|
-
...identity,
|
|
3104
|
-
message: diagnostic.message,
|
|
3105
|
-
...diagnostic.line !== void 0 && { line: diagnostic.line },
|
|
3106
|
-
...diagnostic.semantic !== void 0 && {
|
|
3107
|
-
semantic: diagnostic.semantic
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
})));
|
|
3111
|
-
const survivors = new Set(applyDispositions(expanded.map((entry) => entry.candidate), options.cwd, options.filePath, options.content));
|
|
3112
|
-
const disposed = /* @__PURE__ */ new Set();
|
|
3113
|
-
for (const entry of expanded) {
|
|
3114
|
-
if (!survivors.has(entry.candidate))
|
|
3115
|
-
disposed.add(entry.diagnostic);
|
|
3116
|
-
}
|
|
3117
|
-
return disposed.size === 0 ? diagnostics : diagnostics.filter((diagnostic) => !disposed.has(diagnostic));
|
|
3118
|
-
}
|
|
3119
|
-
function probeIdentities(canonical, raw) {
|
|
3120
|
-
const rendered = [
|
|
3121
|
-
[canonical.tool, canonical.rule]
|
|
3122
|
-
];
|
|
3123
|
-
if (raw !== void 0 && (raw.source !== void 0 || raw.code !== void 0)) {
|
|
3124
|
-
rendered.push([
|
|
3125
|
-
raw.source,
|
|
3126
|
-
raw.code === void 0 ? void 0 : String(raw.code)
|
|
3127
|
-
]);
|
|
3128
|
-
}
|
|
3129
|
-
return expandRenderedIdentities(rendered);
|
|
3130
|
-
}
|
|
3131
|
-
function renderedRuleIdentities(diagnostic) {
|
|
3132
|
-
return expandRenderedIdentities([[diagnostic.tool, diagnostic.rule]]);
|
|
3133
|
-
}
|
|
3134
|
-
function inlineBlockerIdentities(diagnostic) {
|
|
3135
|
-
return expandRenderedIdentities([
|
|
3136
|
-
[diagnostic.tool, diagnostic.rule],
|
|
3137
|
-
[void 0, void 0]
|
|
3138
|
-
]);
|
|
3139
|
-
}
|
|
3140
|
-
function applyPushedFindingPolicy(findings, options) {
|
|
3141
|
-
const { kept } = applyFindingPolicy(findings, {
|
|
3142
|
-
cwd: options.cwd,
|
|
3143
|
-
filePath: options.filePath,
|
|
3144
|
-
content: options.content ?? "",
|
|
3145
|
-
// mtime-cached, so several files in one drain cost one stat.
|
|
3146
|
-
policyMap: loadProjectRulePolicyMap(options.cwd),
|
|
3147
|
-
identities: renderedRuleIdentities
|
|
3148
|
-
});
|
|
3149
|
-
return { kept, suppressed: findings.length - kept.length };
|
|
3150
|
-
}
|
|
3151
|
-
function applyPushedFindingPolicyByFile(findings, cwd) {
|
|
3152
|
-
const byFile = /* @__PURE__ */ new Map();
|
|
3153
|
-
for (const finding of findings) {
|
|
3154
|
-
const group = byFile.get(finding.filePath);
|
|
3155
|
-
if (group)
|
|
3156
|
-
group.push(finding);
|
|
3157
|
-
else
|
|
3158
|
-
byFile.set(finding.filePath, [finding]);
|
|
3159
|
-
}
|
|
3160
|
-
const kept = [];
|
|
3161
|
-
let suppressed = 0;
|
|
3162
|
-
for (const [filePath, group] of byFile) {
|
|
3163
|
-
const policy = applyPushedFindingPolicy(group, {
|
|
3164
|
-
cwd,
|
|
3165
|
-
filePath,
|
|
3166
|
-
content: readFileContent(filePath)
|
|
3167
|
-
});
|
|
3168
|
-
kept.push(...policy.kept);
|
|
3169
|
-
suppressed += policy.suppressed;
|
|
3170
|
-
}
|
|
3171
|
-
return { kept, suppressed };
|
|
3172
|
-
}
|
|
3173
|
-
function expandRenderedIdentities(rendered) {
|
|
3174
|
-
const out = [];
|
|
3175
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3176
|
-
for (const [tool, rule] of rendered) {
|
|
3177
|
-
for (const candidateTool of [tool, void 0]) {
|
|
3178
|
-
const key2 = `${candidateTool ?? ""}\0${rule ?? ""}`;
|
|
3179
|
-
if (seen.has(key2))
|
|
3180
|
-
continue;
|
|
3181
|
-
seen.add(key2);
|
|
3182
|
-
out.push({
|
|
3183
|
-
...candidateTool !== void 0 && { tool: candidateTool },
|
|
3184
|
-
...rule !== void 0 && { rule }
|
|
3185
|
-
});
|
|
3186
|
-
}
|
|
3467
|
+
const base = path4.basename(text.replace(/\\/g, "/"));
|
|
3468
|
+
if (/^lsp:\d+(?::\d+)?$/i.test(text) || /^lsp:\d+(?::\d+)?$/i.test(base)) {
|
|
3469
|
+
return true;
|
|
3187
3470
|
}
|
|
3188
|
-
|
|
3471
|
+
if (/^similarity[-:]/i.test(text) || /^similarity[-:]/i.test(base)) {
|
|
3472
|
+
return true;
|
|
3473
|
+
}
|
|
3474
|
+
if (/^[a-z-]+:\d+(?::\d+)?$/i.test(text) || /^[a-z-]+:\d+(?::\d+)?$/i.test(base)) {
|
|
3475
|
+
return true;
|
|
3476
|
+
}
|
|
3477
|
+
return false;
|
|
3189
3478
|
}
|
|
3190
|
-
function
|
|
3191
|
-
if (
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
const anchored = [];
|
|
3195
|
-
for (const diagnostic of diagnostics) {
|
|
3196
|
-
if (diagnostic.range?.start?.line !== void 0)
|
|
3197
|
-
anchored.push(diagnostic);
|
|
3479
|
+
function normalizeDiagnosticFilePath(ctx, rawPath) {
|
|
3480
|
+
if (typeof rawPath === "string" && looksLikeDiagnosticCodePath(rawPath)) {
|
|
3481
|
+
ctx.log(`runner path normalization: ignored diagnostic code-like path '${rawPath}', using current file`);
|
|
3482
|
+
return resolveRunnerPath(ctx.cwd, ctx.filePath);
|
|
3198
3483
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
if (raw !== void 0)
|
|
3210
|
-
rawByConverted.set(diagnostic, raw);
|
|
3484
|
+
return resolveRunnerPath(ctx.cwd, rawPath || ctx.filePath);
|
|
3485
|
+
}
|
|
3486
|
+
function failureRowMetadata(result) {
|
|
3487
|
+
const inconclusive = result.inconclusive === true ? { inconclusive: true } : {};
|
|
3488
|
+
if (result.status === "failed" && result.failureKind) {
|
|
3489
|
+
return {
|
|
3490
|
+
failureKind: result.failureKind,
|
|
3491
|
+
failureMessage: result.failureMessage,
|
|
3492
|
+
...inconclusive
|
|
3493
|
+
};
|
|
3211
3494
|
}
|
|
3212
|
-
|
|
3213
|
-
cwd: options.cwd,
|
|
3214
|
-
filePath: options.filePath,
|
|
3215
|
-
content,
|
|
3216
|
-
policyMap: options.policyMap,
|
|
3217
|
-
identities: (diagnostic) => probeIdentities(diagnostic, rawByConverted.get(diagnostic))
|
|
3218
|
-
});
|
|
3219
|
-
const survivorsOf = (survivors) => {
|
|
3220
|
-
if (survivors.length === converted.length)
|
|
3221
|
-
return diagnostics;
|
|
3222
|
-
const keptConverted = new Set(survivors);
|
|
3223
|
-
const dropped = /* @__PURE__ */ new Set();
|
|
3224
|
-
for (const [diagnostic, raw] of rawByConverted) {
|
|
3225
|
-
if (!keptConverted.has(diagnostic))
|
|
3226
|
-
dropped.add(raw);
|
|
3227
|
-
}
|
|
3228
|
-
return diagnostics.filter((d) => !dropped.has(d));
|
|
3229
|
-
};
|
|
3230
|
-
return { kept: survivorsOf(kept), inlineKept: survivorsOf(inlineKept) };
|
|
3495
|
+
return result.inconclusive === true ? inconclusive : void 0;
|
|
3231
3496
|
}
|
|
3232
|
-
function
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
...identity.tool !== void 0 && { tool: identity.tool },
|
|
3247
|
-
...identity.rule !== void 0 && { rule: identity.rule }
|
|
3248
|
-
}
|
|
3497
|
+
async function runRunner(ctx, runner, defaultSemantic) {
|
|
3498
|
+
const timeoutMs = Math.max(runner.timeoutMs ?? RUNNER_TIMEOUT_MS, getRunnerTimeoutFloorMs());
|
|
3499
|
+
let timer;
|
|
3500
|
+
const phaseToken = phaseStarted(runner.id);
|
|
3501
|
+
try {
|
|
3502
|
+
const result = await Promise.race([
|
|
3503
|
+
runner.run(ctx).finally(() => clearTimeout(timer)),
|
|
3504
|
+
new Promise((_, reject) => {
|
|
3505
|
+
timer = setTimeout(() => reject(new Error(`Runner ${runner.id} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
3506
|
+
})
|
|
3507
|
+
]);
|
|
3508
|
+
const diagnostics = result.diagnostics.map((d) => ({
|
|
3509
|
+
...d,
|
|
3510
|
+
filePath: normalizeDiagnosticFilePath(ctx, d.filePath)
|
|
3249
3511
|
}));
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3512
|
+
return {
|
|
3513
|
+
...result,
|
|
3514
|
+
diagnostics,
|
|
3515
|
+
semantic: result.semantic ?? defaultSemantic
|
|
3516
|
+
};
|
|
3517
|
+
} catch (error) {
|
|
3518
|
+
clearTimeout(timer);
|
|
3519
|
+
ctx.log(`Runner ${runner.id} failed: ${error}`);
|
|
3520
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3521
|
+
return {
|
|
3522
|
+
status: "failed",
|
|
3523
|
+
diagnostics: [],
|
|
3524
|
+
semantic: defaultSemantic,
|
|
3525
|
+
failureKind: message.includes("timed out") ? "timeout" : "exception",
|
|
3526
|
+
failureMessage: message.slice(0, 200)
|
|
3527
|
+
};
|
|
3528
|
+
} finally {
|
|
3529
|
+
phaseFinished(phaseToken);
|
|
3256
3530
|
}
|
|
3257
|
-
const kept = disposed.size === 0 ? findings : findings.filter((finding) => !disposed.has(finding));
|
|
3258
|
-
return { kept, suppressed: findings.length - kept.length };
|
|
3259
3531
|
}
|
|
3260
3532
|
|
|
3533
|
+
// dist/clients/cascade-budget.js
|
|
3534
|
+
function cascadeSettleWaitMs() {
|
|
3535
|
+
const raw = Number(process.env.PI_LENS_CASCADE_SETTLE_WAIT_MS);
|
|
3536
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : 5e3;
|
|
3537
|
+
}
|
|
3538
|
+
var MIN_NEIGHBOUR_BUDGET = RUNTIME_CONFIG.pipeline.cascadeMaxFiles;
|
|
3539
|
+
var DEFAULT_NEIGHBOUR_BUDGET = 40;
|
|
3540
|
+
var CASCADE_NEIGHBOUR_BUDGET = Math.max(MIN_NEIGHBOUR_BUDGET, Number.parseInt(process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET ?? "40", 10) || DEFAULT_NEIGHBOUR_BUDGET);
|
|
3541
|
+
var NEIGHBOUR_BUDGET_OVERRIDDEN = process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET !== void 0 && CASCADE_NEIGHBOUR_BUDGET !== DEFAULT_NEIGHBOUR_BUDGET;
|
|
3542
|
+
|
|
3261
3543
|
// dist/clients/finding-delivery-gate.js
|
|
3262
3544
|
var MS_PER_MINUTE = 6e4;
|
|
3263
3545
|
function markUnreconciledFindings(findings) {
|
|
@@ -3348,7 +3630,7 @@ var DELIVERY_SURFACES = {
|
|
|
3348
3630
|
// interpolation — proves the label is actually rendered, not merely
|
|
3349
3631
|
// computed and discarded (review round F1's "deleted the age
|
|
3350
3632
|
// interpolations" attack).
|
|
3351
|
-
"runtime-turn:trivy-critical-blocker": labeled(RUNTIME_TURN_FILE, "Turn-end \u{1F534} CRITICAL dependency CVE blocker (trivy).", "Package-pinned finding with no cited file:line to stat \u2014
|
|
3633
|
+
"runtime-turn:trivy-critical-blocker": labeled(RUNTIME_TURN_FILE, "Turn-end \u{1F534} CRITICAL dependency CVE blocker (trivy).", "Package-pinned finding with no cited file:line to stat \u2014 this gate has nothing to check drift against. The session_start cache can be arbitrarily old, so its age is stated instead. #4617: the advisory provenance stamp does have a subject \u2014 the dependency declarations the scan reported for the rows this report shows (`trivyEvidenceFiles`, each result's target resolved against the scan root, falling back to `existingDependencyManifests` only when no shown row cites one), so a lockfile edit supersedes the message \u2014 nested ones included, not only the manifests at the scan root \u2014 even though a package row cannot be stat'd. Also routes through `filterFindingsByDisposition` (#1625) first \u2014 a suppressed/false-positive finding never reaches this render, so the age label and the disposition filter compose rather than substitute for each other.", "TrivyResult.scannedAt", ["CRITICAL dependency CVEs (trivy, ${trivyAgeLabel}"]),
|
|
3352
3634
|
"runtime-turn:trivy-cve-advisory": labeled(RUNTIME_TURN_FILE, "Turn-end \u{1F6E1}\uFE0F non-critical dependency CVE advisory (trivy).", "Same package-pinned shape and #1625 disposition composition as the CRITICAL blocker above.", "TrivyResult.scannedAt", ["Dependency CVEs (trivy, ${trivyAgeLabel}"]),
|
|
3353
3635
|
"runtime-turn:trivy-license-advisory": labeled(RUNTIME_TURN_FILE, "Turn-end \u{1F4DC} dependency license-risk advisory (trivy).", "Same package-pinned shape as the CRITICAL blocker above.", "TrivyResult.scannedAt", ["Dependency license risk (trivy, ${trivyAgeLabel}"]),
|
|
3354
3636
|
"runtime-turn:dead-code-advisory": labeled(RUNTIME_TURN_FILE, "Turn-end dead-code delta advisory (knip/vulture/etc).", "The delta shown is computed from THIS turn's own analyze() call, diffed against the previous cache \u2014 never a replay of a stale cache.", "live"),
|
|
@@ -5007,7 +5289,7 @@ var tryCatchFactProvider = {
|
|
|
5007
5289
|
import path7 from "node:path";
|
|
5008
5290
|
var actionlint = createAvailabilityChecker("actionlint", ".exe");
|
|
5009
5291
|
function isGitHubWorkflowFile(filePath) {
|
|
5010
|
-
const normalized = filePath
|
|
5292
|
+
const normalized = toPosix(filePath);
|
|
5011
5293
|
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(normalized);
|
|
5012
5294
|
}
|
|
5013
5295
|
function toDiagnostic(issue, filePath) {
|
|
@@ -6557,7 +6839,7 @@ ${result.stdout || ""}`, ctx.filePath, cwd);
|
|
|
6557
6839
|
var gleam_check_default = gleamCheckRunner;
|
|
6558
6840
|
|
|
6559
6841
|
// dist/clients/dispatch/runners/go-vet.js
|
|
6560
|
-
import {
|
|
6842
|
+
import { resolve as resolve15 } from "node:path";
|
|
6561
6843
|
|
|
6562
6844
|
// dist/clients/dispatch/runners/utils/diagnostic-parsers.js
|
|
6563
6845
|
import * as path18 from "node:path";
|
|
@@ -6633,8 +6915,8 @@ var goVetRunner = {
|
|
|
6633
6915
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
6634
6916
|
}
|
|
6635
6917
|
const cwd = resolveRunnerCwd(ctx, "go-vet");
|
|
6636
|
-
const fileRel =
|
|
6637
|
-
const pkgPath = fileRel
|
|
6918
|
+
const fileRel = relativeInside(cwd, ctx.filePath);
|
|
6919
|
+
const pkgPath = fileRel === void 0 ? (
|
|
6638
6920
|
// File isn't under ctx.cwd (unexpected — ctx.cwd is the go.mod root).
|
|
6639
6921
|
// Vet the root package as a safe fallback rather than emit `./../x`;
|
|
6640
6922
|
// the filename filter below still prevents mis-attribution.
|
|
@@ -6655,10 +6937,10 @@ var goVetRunner = {
|
|
|
6655
6937
|
if (result.status === 0 && !raw.trim()) {
|
|
6656
6938
|
return { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
6657
6939
|
}
|
|
6658
|
-
const absTarget =
|
|
6940
|
+
const absTarget = resolve15(ctx.filePath);
|
|
6659
6941
|
const relevant = raw.split("\n").filter((line) => {
|
|
6660
6942
|
const m = line.match(GO_VET_LINE);
|
|
6661
|
-
return m != null && pathsEqual(
|
|
6943
|
+
return m != null && pathsEqual(resolve15(cwd, m[1].trim()), absTarget);
|
|
6662
6944
|
}).join("\n");
|
|
6663
6945
|
const diagnostics = parseGoVetOutput(relevant, ctx.filePath, cwd);
|
|
6664
6946
|
return diagnostics.length > 0 ? findingsResult(diagnostics, { status: "failed", semantic: "warning" }) : { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
@@ -6741,6 +7023,7 @@ var golangciRunner = {
|
|
|
6741
7023
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
6742
7024
|
const result = await safeSpawnAsync(cmd, [
|
|
6743
7025
|
"run",
|
|
7026
|
+
"--fix=false",
|
|
6744
7027
|
"--output.json.path=stdout",
|
|
6745
7028
|
...OTHER_OUTPUT_FORMATS.map((format) => `--output.${format}.path=`),
|
|
6746
7029
|
"--show-stats=false",
|
|
@@ -6854,10 +7137,6 @@ var SKIPPED = {
|
|
|
6854
7137
|
diagnostics: [],
|
|
6855
7138
|
semantic: "none"
|
|
6856
7139
|
};
|
|
6857
|
-
function isWithin(root, candidate) {
|
|
6858
|
-
const relative5 = path21.relative(normalizeMapKey(root), normalizeMapKey(candidate));
|
|
6859
|
-
return relative5 === "" || !relative5.startsWith(`..${path21.sep}`) && relative5 !== ".." && !path21.isAbsolute(relative5);
|
|
6860
|
-
}
|
|
6861
7140
|
function diagnosticLocation(message, chartRoot) {
|
|
6862
7141
|
const location = message.match(/(?:^|[\s(])((?:[^\s:()\r\n]*\/[^:()\r\n"]*?|[^\s:()\r\n]+)\.(?:ya?ml|tpl|json))(?::(\d+))?(?=[:\s)]|$)/i);
|
|
6863
7142
|
const [, found, rawLine] = location ?? [];
|
|
@@ -6865,10 +7144,10 @@ function diagnosticLocation(message, chartRoot) {
|
|
|
6865
7144
|
return { filePath: path21.join(chartRoot, "Chart.yaml"), message };
|
|
6866
7145
|
}
|
|
6867
7146
|
const embedded = !message.startsWith(found);
|
|
6868
|
-
const
|
|
6869
|
-
const candidate = path21.resolve(chartRoot,
|
|
7147
|
+
const relative2 = embedded ? found.slice(found.indexOf("/") + 1) : found;
|
|
7148
|
+
const candidate = path21.resolve(chartRoot, relative2);
|
|
6870
7149
|
return {
|
|
6871
|
-
filePath:
|
|
7150
|
+
filePath: isWithinIdentity(candidate, chartRoot) ? candidate : path21.join(chartRoot, "Chart.yaml"),
|
|
6872
7151
|
line: rawLine ? Number(rawLine) : void 0,
|
|
6873
7152
|
message
|
|
6874
7153
|
};
|
|
@@ -6968,7 +7247,7 @@ var helmLintRunner = {
|
|
|
6968
7247
|
if (!discovered)
|
|
6969
7248
|
return SKIPPED;
|
|
6970
7249
|
const chartRoot = path21.resolve(discovered);
|
|
6971
|
-
if (!
|
|
7250
|
+
if (!isWithinIdentity(chartRoot, workspaceRoot))
|
|
6972
7251
|
return SKIPPED;
|
|
6973
7252
|
const existing = inFlightByChartRoot.get(chartRoot);
|
|
6974
7253
|
if (existing)
|
|
@@ -6985,7 +7264,6 @@ var helm_lint_default = helmLintRunner;
|
|
|
6985
7264
|
|
|
6986
7265
|
// dist/clients/dispatch/runners/helm-render.js
|
|
6987
7266
|
import * as fs12 from "node:fs";
|
|
6988
|
-
import * as os from "node:os";
|
|
6989
7267
|
import * as path22 from "node:path";
|
|
6990
7268
|
var helm2 = createAvailabilityChecker("helm", ".exe", ["version", "--short"]);
|
|
6991
7269
|
var trivy = createAvailabilityChecker("trivy", ".exe");
|
|
@@ -7000,10 +7278,7 @@ var SKIPPED2 = {
|
|
|
7000
7278
|
diagnostics: [],
|
|
7001
7279
|
semantic: "none"
|
|
7002
7280
|
};
|
|
7003
|
-
|
|
7004
|
-
const relative5 = path22.relative(normalizeMapKey(root), normalizeMapKey(candidate));
|
|
7005
|
-
return relative5 === "" || !relative5.startsWith(`..${path22.sep}`) && relative5 !== ".." && !path22.isAbsolute(relative5);
|
|
7006
|
-
}
|
|
7281
|
+
var NOT_ENABLED = { ...SKIPPED2, skipReason: "not-enabled" };
|
|
7007
7282
|
function isHelmRenderEnabled(workspaceRoot) {
|
|
7008
7283
|
try {
|
|
7009
7284
|
const config = loadPiLensProjectConfig(workspaceRoot);
|
|
@@ -7018,13 +7293,13 @@ function resolveTemplateSource(sourceRef, chartRoot, realChartRoot) {
|
|
|
7018
7293
|
if (segments.length < 2)
|
|
7019
7294
|
return null;
|
|
7020
7295
|
const candidate = path22.resolve(chartRoot, ...segments.slice(1));
|
|
7021
|
-
if (!
|
|
7296
|
+
if (!isWithinIdentity(candidate, chartRoot))
|
|
7022
7297
|
return null;
|
|
7023
7298
|
try {
|
|
7024
7299
|
if (!fs12.lstatSync(candidate).isFile())
|
|
7025
7300
|
return null;
|
|
7026
7301
|
const root = realChartRoot ?? fs12.realpathSync(chartRoot);
|
|
7027
|
-
if (!
|
|
7302
|
+
if (!isWithinIdentity(fs12.realpathSync(candidate), root))
|
|
7028
7303
|
return null;
|
|
7029
7304
|
} catch {
|
|
7030
7305
|
return null;
|
|
@@ -7066,9 +7341,9 @@ function mapRenderedToSource(options) {
|
|
|
7066
7341
|
if (resolved)
|
|
7067
7342
|
return { filePath: resolved, mapped: true };
|
|
7068
7343
|
}
|
|
7069
|
-
const
|
|
7070
|
-
if (
|
|
7071
|
-
const resolved = resolveTemplateSource(
|
|
7344
|
+
const relative2 = toProjectRelativePath(options.renderedPath, options.outputDir);
|
|
7345
|
+
if (!isAbsoluteFilePath(relative2)) {
|
|
7346
|
+
const resolved = resolveTemplateSource(relative2, chartRoot, realChartRoot);
|
|
7072
7347
|
if (resolved)
|
|
7073
7348
|
return { filePath: resolved, mapped: true };
|
|
7074
7349
|
}
|
|
@@ -7447,7 +7722,7 @@ async function renderAndValidate(chartRoot, cwd, filePath) {
|
|
|
7447
7722
|
const helmCmd = await resolveAvailableOrInstall(helm2, "helm", cwd);
|
|
7448
7723
|
if (!helmCmd)
|
|
7449
7724
|
return helmUnavailableResult(cwd);
|
|
7450
|
-
const outputDir = fs12.mkdtempSync(path22.join(
|
|
7725
|
+
const outputDir = fs12.mkdtempSync(path22.join(scannerReportParentDir(), "pi-lens-helm-render-"));
|
|
7451
7726
|
try {
|
|
7452
7727
|
const render = await safeSpawnAsync(helmCmd, ["template", "pi-lens-render", chartRoot, "--output-dir", outputDir], {
|
|
7453
7728
|
cwd,
|
|
@@ -7549,13 +7824,13 @@ var helmRenderRunner = {
|
|
|
7549
7824
|
const cwd = resolveRunnerCwd(ctx, "helm-render");
|
|
7550
7825
|
const workspaceRoot = path22.resolve(ctx.projectRoot ?? cwd);
|
|
7551
7826
|
if (!isHelmRenderEnabled(workspaceRoot))
|
|
7552
|
-
return
|
|
7827
|
+
return NOT_ENABLED;
|
|
7553
7828
|
const startDir = path22.dirname(path22.resolve(ctx.filePath));
|
|
7554
7829
|
const discovered = findNearestDirWithMarker(startDir, "chartYamlPath");
|
|
7555
7830
|
if (!discovered)
|
|
7556
7831
|
return SKIPPED2;
|
|
7557
7832
|
const chartRoot = path22.resolve(discovered);
|
|
7558
|
-
if (!
|
|
7833
|
+
if (!isWithinIdentity(chartRoot, workspaceRoot))
|
|
7559
7834
|
return SKIPPED2;
|
|
7560
7835
|
if (getProjectTrustState() === "untrusted") {
|
|
7561
7836
|
logRenderPass(ctx.filePath, chartRoot, Date.now(), {
|
|
@@ -7919,6 +8194,8 @@ var lspRunner = {
|
|
|
7919
8194
|
let primaryUnavailable;
|
|
7920
8195
|
let unconfirmedServerIds = [];
|
|
7921
8196
|
let deferredServerIds = [];
|
|
8197
|
+
let primaryAnswered = false;
|
|
8198
|
+
let primaryAnswerStale = false;
|
|
7922
8199
|
let usedWarmAttach = false;
|
|
7923
8200
|
let incumbentProjectIdentity;
|
|
7924
8201
|
let failureReason = "";
|
|
@@ -7940,9 +8217,21 @@ var lspRunner = {
|
|
|
7940
8217
|
const answer = attached?.available ? dropExcludedServers(attached.response, configDisabledAuxiliaryLspServerIds((f) => ctx.pi.getFlag(f))) : void 0;
|
|
7941
8218
|
const touched = answer ? {
|
|
7942
8219
|
diags: answer.diagnostics,
|
|
8220
|
+
// #5008: `confirmation` is what says the PRIMARY answered
|
|
8221
|
+
// (`primaryAnswered` below). The incumbent's DTO carries it for
|
|
8222
|
+
// exactly this reason, and dropping it here would read every warm
|
|
8223
|
+
// answer as a primary that never completed its policy — the #1179
|
|
8224
|
+
// side-channel loss class, one field further on.
|
|
8225
|
+
...answer.confirmation !== void 0 && {
|
|
8226
|
+
confirmation: answer.confirmation
|
|
8227
|
+
},
|
|
7943
8228
|
...answer.unconfirmedServerIds !== void 0 && {
|
|
7944
8229
|
unconfirmedServerIds: answer.unconfirmedServerIds
|
|
7945
|
-
}
|
|
8230
|
+
},
|
|
8231
|
+
// #5030: the incumbent's content binding, so a stale-bound answer
|
|
8232
|
+
// takes the same withholding below as a local one. An incumbent
|
|
8233
|
+
// that sends none reads as not current (`warmAnswerBinding`).
|
|
8234
|
+
binding: warmAnswerBinding(answer)
|
|
7946
8235
|
} : await lspService.touchFile(ctx.filePath, content, {
|
|
7947
8236
|
diagnostics: "document",
|
|
7948
8237
|
collectDiagnostics: true,
|
|
@@ -7975,11 +8264,14 @@ var lspRunner = {
|
|
|
7975
8264
|
])
|
|
7976
8265
|
];
|
|
7977
8266
|
deferredServerIds = touched.deferredServerIds ?? [];
|
|
7978
|
-
|
|
8267
|
+
primaryAnswerStale = readBoundToCurrentDisk(touched) === false;
|
|
8268
|
+
primaryAnswered = touchCompletedConfirmationPolicy(touched) && !primaryAnswerStale;
|
|
8269
|
+
if (primaryAnswerStale) {
|
|
8270
|
+
const namesStaleContributor = diagnosticsInconclusive && touched.inconclusiveReason !== "primary-unavailable";
|
|
7979
8271
|
const unconfirmed = new Set(unconfirmedServerIds);
|
|
7980
8272
|
const currentContentDiags = [];
|
|
7981
8273
|
for (const diagnostic of lspDiags) {
|
|
7982
|
-
if (diagnostic.serverId !== void 0 && !unconfirmed.has(diagnostic.serverId)) {
|
|
8274
|
+
if (namesStaleContributor && diagnostic.serverId !== void 0 && !unconfirmed.has(diagnostic.serverId)) {
|
|
7983
8275
|
currentContentDiags.push(diagnostic);
|
|
7984
8276
|
}
|
|
7985
8277
|
}
|
|
@@ -8036,7 +8328,7 @@ var lspRunner = {
|
|
|
8036
8328
|
if (lspDiags.length === 0) {
|
|
8037
8329
|
if (deferredServerIds.length > 0) {
|
|
8038
8330
|
return {
|
|
8039
|
-
status: "deferred",
|
|
8331
|
+
status: primaryAnswered ? "succeeded" : "deferred",
|
|
8040
8332
|
diagnostics: [],
|
|
8041
8333
|
semantic: "none",
|
|
8042
8334
|
unconfirmedServerIds: [...unconfirmedServerIds],
|
|
@@ -8045,12 +8337,19 @@ var lspRunner = {
|
|
|
8045
8337
|
}
|
|
8046
8338
|
if (unconfirmedServerIds.length > 0) {
|
|
8047
8339
|
return {
|
|
8048
|
-
status: "skipped",
|
|
8340
|
+
status: primaryAnswered ? "succeeded" : "skipped",
|
|
8049
8341
|
diagnostics: [],
|
|
8050
8342
|
semantic: "none",
|
|
8051
8343
|
unconfirmedServerIds: [...unconfirmedServerIds]
|
|
8052
8344
|
};
|
|
8053
8345
|
}
|
|
8346
|
+
if (primaryAnswerStale) {
|
|
8347
|
+
return {
|
|
8348
|
+
status: "skipped",
|
|
8349
|
+
diagnostics: [],
|
|
8350
|
+
semantic: "none"
|
|
8351
|
+
};
|
|
8352
|
+
}
|
|
8054
8353
|
return {
|
|
8055
8354
|
status: "succeeded",
|
|
8056
8355
|
diagnostics: [],
|
|
@@ -8115,9 +8414,19 @@ var lspRunner = {
|
|
|
8115
8414
|
// "failed" here means the file has blocking type errors — the check ran
|
|
8116
8415
|
// fine; findingsResult tags it so it never reads as a runner crash.
|
|
8117
8416
|
...findingsResult(keptDiagnostics, {
|
|
8118
|
-
status: hasErrors ? "failed" : deferredServerIds.length > 0 ? "deferred" : "succeeded",
|
|
8417
|
+
status: hasErrors ? "failed" : deferredServerIds.length > 0 && !primaryAnswered ? "deferred" : "succeeded",
|
|
8119
8418
|
semantic: resultSemantic
|
|
8120
8419
|
}),
|
|
8420
|
+
// #5008: findings a run DOES report do not make it a verdict about the
|
|
8421
|
+
// primary's own recorded blockers when the primary did not answer. A
|
|
8422
|
+
// `failed` run with its own findings is `hasUsableResult`, so without
|
|
8423
|
+
// this flag it would retire them (the inverse cell of the state table),
|
|
8424
|
+
// and a settled collect-later run would too. `inconclusive` is the
|
|
8425
|
+
// touch's own positive evidence that a primary deadline lapsed or no
|
|
8426
|
+
// primary was acquired — a touch that says neither keeps the pre-#5008
|
|
8427
|
+
// reading (a diagnostics-unsupported primary, an incumbent built before the
|
|
8428
|
+
// confirmation field), which is today's behaviour.
|
|
8429
|
+
...diagnosticsInconclusive && { inconclusive: true },
|
|
8121
8430
|
...unconfirmedServerIds.length > 0 && {
|
|
8122
8431
|
unconfirmedServerIds: [...unconfirmedServerIds]
|
|
8123
8432
|
},
|
|
@@ -8132,7 +8441,60 @@ var lspRunner = {
|
|
|
8132
8441
|
var lsp_default = lspRunner;
|
|
8133
8442
|
|
|
8134
8443
|
// dist/clients/dispatch/runners/markdownlint.js
|
|
8444
|
+
import * as path27 from "node:path";
|
|
8445
|
+
|
|
8446
|
+
// dist/clients/dispatch/runners/utils/markdownlint-api.js
|
|
8447
|
+
import * as fs13 from "node:fs";
|
|
8135
8448
|
import * as path26 from "node:path";
|
|
8449
|
+
var PACKAGE_NAME = "markdownlint-cli2";
|
|
8450
|
+
function locateCli2Entry(command) {
|
|
8451
|
+
const shim = /[\\/]/.test(command) ? command : findCommandOnPath(command, process.platform === "win32");
|
|
8452
|
+
if (!shim)
|
|
8453
|
+
return null;
|
|
8454
|
+
const shimDir = path26.dirname(shim);
|
|
8455
|
+
const candidates = [
|
|
8456
|
+
path26.join(shimDir, "..", PACKAGE_NAME),
|
|
8457
|
+
path26.join(shimDir, "node_modules", PACKAGE_NAME)
|
|
8458
|
+
];
|
|
8459
|
+
candidates.push(path26.dirname(realpathOrResolve(shim)));
|
|
8460
|
+
for (const dir of candidates) {
|
|
8461
|
+
try {
|
|
8462
|
+
const manifest = JSON.parse(fs13.readFileSync(path26.join(dir, "package.json"), "utf8"));
|
|
8463
|
+
if (manifest.name !== PACKAGE_NAME)
|
|
8464
|
+
continue;
|
|
8465
|
+
const root = manifest.exports && typeof manifest.exports === "object" ? manifest.exports["."] : manifest.exports;
|
|
8466
|
+
if (typeof root !== "string")
|
|
8467
|
+
continue;
|
|
8468
|
+
const entry = path26.resolve(dir, root);
|
|
8469
|
+
if (fs13.statSync(entry).isFile())
|
|
8470
|
+
return entry;
|
|
8471
|
+
} catch {
|
|
8472
|
+
}
|
|
8473
|
+
}
|
|
8474
|
+
return null;
|
|
8475
|
+
}
|
|
8476
|
+
function markdownlintNoFixInvocation(options) {
|
|
8477
|
+
const entry = locateCli2Entry(options.command);
|
|
8478
|
+
if (!entry) {
|
|
8479
|
+
recordDegradationOnce({
|
|
8480
|
+
kind: "markdownlint-api-unavailable",
|
|
8481
|
+
subject: options.command,
|
|
8482
|
+
reason: 'no markdownlint-cli2 package sits beside it; linting by spawn, where a project "fix": true can still rewrite the file'
|
|
8483
|
+
});
|
|
8484
|
+
return { command: options.command, args: options.args };
|
|
8485
|
+
}
|
|
8486
|
+
return {
|
|
8487
|
+
command: process.execPath,
|
|
8488
|
+
args: [
|
|
8489
|
+
resolvePackagePath(import.meta.url, "config/markdownlint/run-no-fix.mjs"),
|
|
8490
|
+
entry,
|
|
8491
|
+
options.cwd,
|
|
8492
|
+
...options.args
|
|
8493
|
+
]
|
|
8494
|
+
};
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
// dist/clients/dispatch/runners/markdownlint.js
|
|
8136
8498
|
var markdownlint = createAvailabilityChecker("markdownlint-cli2", ".cmd", [
|
|
8137
8499
|
"--no-globs",
|
|
8138
8500
|
"-"
|
|
@@ -8172,7 +8534,7 @@ var MARKDOWNLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
|
8172
8534
|
]);
|
|
8173
8535
|
function parseMarkdownlintOutput(raw, filePath, cwd) {
|
|
8174
8536
|
const diagnostics = [];
|
|
8175
|
-
const absTarget =
|
|
8537
|
+
const absTarget = path27.resolve(cwd, filePath);
|
|
8176
8538
|
for (const line of raw.split(/\r?\n/)) {
|
|
8177
8539
|
if (!line.trim())
|
|
8178
8540
|
continue;
|
|
@@ -8180,7 +8542,7 @@ function parseMarkdownlintOutput(raw, filePath, cwd) {
|
|
|
8180
8542
|
if (!match)
|
|
8181
8543
|
continue;
|
|
8182
8544
|
const [, reported, lineNum, col, ruleCode, message] = match;
|
|
8183
|
-
if (reported && !pathsEqual(
|
|
8545
|
+
if (reported && !pathsEqual(path27.resolve(cwd, reported), absTarget))
|
|
8184
8546
|
continue;
|
|
8185
8547
|
const ruleName = ruleCode.split("/")[0];
|
|
8186
8548
|
const fixable = MARKDOWNLINT_FIXABLE_RULES.has(ruleName);
|
|
@@ -8224,7 +8586,9 @@ var markdownlintRunner = {
|
|
|
8224
8586
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8225
8587
|
}
|
|
8226
8588
|
const configArgs = markdownlintConfigArgs(cwd);
|
|
8227
|
-
const
|
|
8589
|
+
const args = [...configArgs, ctx.filePath];
|
|
8590
|
+
const invocation = markdownlintNoFixInvocation({ command: cmd, cwd, args });
|
|
8591
|
+
const result = await safeSpawnAsync(invocation.command, invocation.args, {
|
|
8228
8592
|
timeout: 15e3,
|
|
8229
8593
|
cwd
|
|
8230
8594
|
});
|
|
@@ -8254,7 +8618,7 @@ var markdownlintRunner = {
|
|
|
8254
8618
|
var markdownlint_default = markdownlintRunner;
|
|
8255
8619
|
|
|
8256
8620
|
// dist/clients/dispatch/runners/mypy.js
|
|
8257
|
-
import * as
|
|
8621
|
+
import * as path28 from "node:path";
|
|
8258
8622
|
var mypy = createAvailabilityChecker("mypy", "");
|
|
8259
8623
|
var MYPY_EXIT_CODES = { ran: [1, 2] };
|
|
8260
8624
|
function parseMypyOutput(raw, fallbackPath, cwd) {
|
|
@@ -8268,7 +8632,7 @@ function parseMypyOutput(raw, fallbackPath, cwd) {
|
|
|
8268
8632
|
continue;
|
|
8269
8633
|
const severity = level === "error" ? "error" : "warning";
|
|
8270
8634
|
const rule = errorCode ?? "mypy";
|
|
8271
|
-
const filePath = file && file.trim() ?
|
|
8635
|
+
const filePath = file && file.trim() ? path28.isAbsolute(file) ? file : path28.resolve(cwd, file) : fallbackPath;
|
|
8272
8636
|
diagnostics.push({
|
|
8273
8637
|
id: `mypy-${lineNum}-${rule}`,
|
|
8274
8638
|
message: errorCode ? `[${errorCode}] ${message}` : message,
|
|
@@ -8319,7 +8683,7 @@ var mypyRunner = {
|
|
|
8319
8683
|
var mypy_default = mypyRunner;
|
|
8320
8684
|
|
|
8321
8685
|
// dist/clients/dispatch/runners/oxlint.js
|
|
8322
|
-
import * as
|
|
8686
|
+
import * as path29 from "node:path";
|
|
8323
8687
|
var MAX_OXLINT_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
8324
8688
|
var OXLINT_NO_FILES = /* @__PURE__ */ Symbol("oxlint-no-files");
|
|
8325
8689
|
var OXLINT_NO_FILES_UNCONFIRMED = /* @__PURE__ */ Symbol("oxlint-no-files-unconfirmed");
|
|
@@ -8553,9 +8917,9 @@ function parseOxlintJson(raw, filePath, cwd) {
|
|
|
8553
8917
|
if (!Array.isArray(parsed.diagnostics))
|
|
8554
8918
|
return [];
|
|
8555
8919
|
const diagnostics = [];
|
|
8556
|
-
const absTarget =
|
|
8920
|
+
const absTarget = path29.resolve(cwd, filePath);
|
|
8557
8921
|
for (const d of parsed.diagnostics) {
|
|
8558
|
-
if (!d.filename || !pathsEqual(
|
|
8922
|
+
if (!d.filename || !pathsEqual(path29.resolve(cwd, d.filename), absTarget)) {
|
|
8559
8923
|
continue;
|
|
8560
8924
|
}
|
|
8561
8925
|
const rule = extractOxlintRule(d.code);
|
|
@@ -8585,14 +8949,14 @@ function parseOxlintJson(raw, filePath, cwd) {
|
|
|
8585
8949
|
}
|
|
8586
8950
|
function parseOxlintUnix(raw, filePath, cwd) {
|
|
8587
8951
|
const diagnostics = [];
|
|
8588
|
-
const absTarget =
|
|
8952
|
+
const absTarget = path29.resolve(cwd, filePath);
|
|
8589
8953
|
for (const line of raw.split("\n")) {
|
|
8590
8954
|
const match = line.match(/^(.+):(\d+):(\d+):\s*(.+?)\s*\(([^)]+)\)$/);
|
|
8591
8955
|
if (match) {
|
|
8592
8956
|
const [, reportedPath, lineStr, _col, message, rule] = match;
|
|
8593
8957
|
if (!reportedPath || !lineStr || !message || !rule)
|
|
8594
8958
|
continue;
|
|
8595
|
-
if (!pathsEqual(
|
|
8959
|
+
if (!pathsEqual(path29.resolve(cwd, reportedPath), absTarget))
|
|
8596
8960
|
continue;
|
|
8597
8961
|
diagnostics.push({
|
|
8598
8962
|
id: `oxlint-${rule}-${lineStr}`,
|
|
@@ -8611,7 +8975,7 @@ function parseOxlintUnix(raw, filePath, cwd) {
|
|
|
8611
8975
|
var oxlint_default = oxlintRunner;
|
|
8612
8976
|
|
|
8613
8977
|
// dist/clients/dispatch/runners/php-lint.js
|
|
8614
|
-
import * as
|
|
8978
|
+
import * as path30 from "node:path";
|
|
8615
8979
|
var PHP_LINT_EXIT_CODES = { ran: [1, 255] };
|
|
8616
8980
|
var php = createAvailabilityChecker("php", ".exe");
|
|
8617
8981
|
function parsePhpLintOutput(raw, filePath, cwd) {
|
|
@@ -8621,7 +8985,7 @@ function parsePhpLintOutput(raw, filePath, cwd) {
|
|
|
8621
8985
|
const lineMatch = output.match(/on line (\d+)/i);
|
|
8622
8986
|
const messageMatch = output.match(/PHP Parse error:\s*(.+?)(?:\s+in\s+(.+?)\s+on line \d+)?$/im) ?? output.match(/Parse error:\s*(.+?)(?:\s+in\s+(.+?)\s+on line \d+)?$/im);
|
|
8623
8987
|
const reported = messageMatch?.[2]?.trim();
|
|
8624
|
-
if (reported && !pathsEqual(
|
|
8988
|
+
if (reported && !pathsEqual(path30.resolve(cwd, reported), path30.resolve(cwd, filePath)))
|
|
8625
8989
|
return [];
|
|
8626
8990
|
return [
|
|
8627
8991
|
{
|
|
@@ -8648,7 +9012,7 @@ var phpLintRunner = {
|
|
|
8648
9012
|
const cmd = ctx.analysisRootMode === "adopted" ? resolveAdoptedRootCommand("php", ctx, cwd) : await php.isAvailableAsync(cwd) ? php.getCommand(cwd) : null;
|
|
8649
9013
|
if (!cmd)
|
|
8650
9014
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8651
|
-
const absPath =
|
|
9015
|
+
const absPath = path30.resolve(cwd, ctx.filePath);
|
|
8652
9016
|
const result = await safeSpawnAsync(cmd, ["-l", absPath], {
|
|
8653
9017
|
timeout: 15e3,
|
|
8654
9018
|
cwd
|
|
@@ -8673,7 +9037,7 @@ ${result.stderr ?? ""}`,
|
|
|
8673
9037
|
var php_lint_default = phpLintRunner;
|
|
8674
9038
|
|
|
8675
9039
|
// dist/clients/dispatch/runners/phpstan.js
|
|
8676
|
-
import * as
|
|
9040
|
+
import * as path31 from "node:path";
|
|
8677
9041
|
var PHPSTAN_EXIT_CODES = { ran: [1] };
|
|
8678
9042
|
var phpstan = createAvailabilityChecker("phpstan", ".phar");
|
|
8679
9043
|
function parsePhpstanJson(raw, fallbackPath, cwd) {
|
|
@@ -8681,7 +9045,7 @@ function parsePhpstanJson(raw, fallbackPath, cwd) {
|
|
|
8681
9045
|
const output = JSON.parse(raw);
|
|
8682
9046
|
const diagnostics = [];
|
|
8683
9047
|
for (const [file, fileErrors] of Object.entries(output.files ?? {})) {
|
|
8684
|
-
const filePath = file && file.trim() ?
|
|
9048
|
+
const filePath = file && file.trim() ? path31.isAbsolute(file) ? file : path31.resolve(cwd, file) : fallbackPath;
|
|
8685
9049
|
for (const err of fileErrors?.messages ?? []) {
|
|
8686
9050
|
diagnostics.push({
|
|
8687
9051
|
id: `phpstan:${err.line ?? 1}:${err.message.slice(0, 40)}`,
|
|
@@ -8740,7 +9104,7 @@ var phpstanRunner = {
|
|
|
8740
9104
|
const cmd = await resolvePhpstan(cwd);
|
|
8741
9105
|
if (!cmd)
|
|
8742
9106
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8743
|
-
const absPath =
|
|
9107
|
+
const absPath = path31.resolve(cwd, ctx.filePath);
|
|
8744
9108
|
const result = await safeSpawnAsync(cmd, ["analyse", "--error-format=json", "--no-progress", absPath], { timeout: 3e4, cwd });
|
|
8745
9109
|
const run = parseToolRun("phpstan", { result, exitCodes: PHPSTAN_EXIT_CODES }, (out) => parsePhpstanJson(out, ctx.filePath, cwd), { parseOutput: result.stdout ?? "" });
|
|
8746
9110
|
if (run.skipped)
|
|
@@ -8758,7 +9122,7 @@ var phpstanRunner = {
|
|
|
8758
9122
|
var phpstan_default = phpstanRunner;
|
|
8759
9123
|
|
|
8760
9124
|
// dist/clients/dispatch/runners/prisma-validate.js
|
|
8761
|
-
import * as
|
|
9125
|
+
import * as path32 from "node:path";
|
|
8762
9126
|
var PRISMA_VALIDATION_REPORT = /\bValidation Error Count:\s*\d+/;
|
|
8763
9127
|
function parsePrismaValidateOutput(raw, filePath) {
|
|
8764
9128
|
const output = raw.split("\n").map((line) => line.trim()).filter(Boolean).filter((line) => !line.startsWith("Environment variables loaded")).filter((line) => !line.startsWith("Prisma schema loaded")).join(" ");
|
|
@@ -8789,7 +9153,7 @@ var prismaValidateRunner = {
|
|
|
8789
9153
|
async run(ctx) {
|
|
8790
9154
|
const cwd = resolveRunnerCwd(ctx, "prisma-validate");
|
|
8791
9155
|
const resolved = await resolveLocalFirstAsync("prisma", cwd);
|
|
8792
|
-
const absPath =
|
|
9156
|
+
const absPath = path32.resolve(cwd, ctx.filePath);
|
|
8793
9157
|
const result = await safeSpawnAsync(resolved.cmd, [...resolved.args, "validate", "--schema", absPath], {
|
|
8794
9158
|
timeout: 2e4,
|
|
8795
9159
|
// ONE neutral-cwd seam for npx fallbacks (#4193, #4268 acceptance 3),
|
|
@@ -8826,9 +9190,9 @@ ${result.stderr ?? ""}`;
|
|
|
8826
9190
|
var prisma_validate_default = prismaValidateRunner;
|
|
8827
9191
|
|
|
8828
9192
|
// dist/clients/dispatch/runners/psscriptanalyzer.js
|
|
8829
|
-
import * as
|
|
8830
|
-
import * as
|
|
8831
|
-
import * as
|
|
9193
|
+
import * as fs14 from "node:fs/promises";
|
|
9194
|
+
import * as os from "node:os";
|
|
9195
|
+
import * as path33 from "node:path";
|
|
8832
9196
|
var PS_SCRIPT = `
|
|
8833
9197
|
param([string]$FilePath)
|
|
8834
9198
|
Import-Module PSScriptAnalyzer -ErrorAction Stop
|
|
@@ -9020,9 +9384,9 @@ var psScriptAnalyzerRunner = {
|
|
|
9020
9384
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9021
9385
|
}
|
|
9022
9386
|
const cwd = resolveRunnerCwd(ctx, "psscriptanalyzer");
|
|
9023
|
-
const absPath =
|
|
9024
|
-
const tmpScript =
|
|
9025
|
-
await
|
|
9387
|
+
const absPath = path33.resolve(cwd, ctx.filePath);
|
|
9388
|
+
const tmpScript = path33.join(os.tmpdir(), `pi-lens-psa-${process.pid}.ps1`);
|
|
9389
|
+
await fs14.writeFile(tmpScript, PS_SCRIPT, "utf-8");
|
|
9026
9390
|
try {
|
|
9027
9391
|
const sampler = startHostStallSampler();
|
|
9028
9392
|
const startedAt = Date.now();
|
|
@@ -9122,7 +9486,7 @@ var psScriptAnalyzerRunner = {
|
|
|
9122
9486
|
semantic: hasErrors ? "blocking" : "warning"
|
|
9123
9487
|
});
|
|
9124
9488
|
} finally {
|
|
9125
|
-
await
|
|
9489
|
+
await fs14.unlink(tmpScript).catch(() => {
|
|
9126
9490
|
});
|
|
9127
9491
|
}
|
|
9128
9492
|
}
|
|
@@ -9152,7 +9516,7 @@ var pyrightRunner = {
|
|
|
9152
9516
|
cmd = installedPath;
|
|
9153
9517
|
}
|
|
9154
9518
|
if (!cmd) {
|
|
9155
|
-
const { findCommandAsync } = await import("./chunk-
|
|
9519
|
+
const { findCommandAsync } = await import("./chunk-A5GRLYPZ.js");
|
|
9156
9520
|
const foundCmd = await findCommandAsync("pyright");
|
|
9157
9521
|
if (foundCmd)
|
|
9158
9522
|
cmd = foundCmd;
|
|
@@ -9249,7 +9613,7 @@ function parsePyrightOutput(data, _filePath) {
|
|
|
9249
9613
|
var pyright_default = pyrightRunner;
|
|
9250
9614
|
|
|
9251
9615
|
// dist/clients/dispatch/runners/rubocop.js
|
|
9252
|
-
import * as
|
|
9616
|
+
import * as path34 from "node:path";
|
|
9253
9617
|
var SEVERITY_MAP = {
|
|
9254
9618
|
fatal: "error",
|
|
9255
9619
|
error: "error",
|
|
@@ -9262,9 +9626,9 @@ function parseRubocopJson(raw, filePath, cwd) {
|
|
|
9262
9626
|
const output = JSON.parse(raw);
|
|
9263
9627
|
const autofix = getAutofixCapability("rubocop");
|
|
9264
9628
|
const diagnostics = [];
|
|
9265
|
-
const absTarget =
|
|
9629
|
+
const absTarget = path34.resolve(cwd, filePath);
|
|
9266
9630
|
for (const file of output.files) {
|
|
9267
|
-
if (file.path && !pathsEqual(
|
|
9631
|
+
if (file.path && !pathsEqual(path34.resolve(cwd, file.path), absTarget))
|
|
9268
9632
|
continue;
|
|
9269
9633
|
for (const offense of file.offenses) {
|
|
9270
9634
|
const severity = SEVERITY_MAP[offense.severity] ?? "warning";
|
|
@@ -9370,7 +9734,15 @@ var ruffRunner = {
|
|
|
9370
9734
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9371
9735
|
}
|
|
9372
9736
|
const configArgs = ruffConfigArgs(cwd);
|
|
9373
|
-
const checkResult = await safeSpawnAsync(cmd, [
|
|
9737
|
+
const checkResult = await safeSpawnAsync(cmd, [
|
|
9738
|
+
"check",
|
|
9739
|
+
"--no-fix",
|
|
9740
|
+
"--no-fix-only",
|
|
9741
|
+
"--output-format",
|
|
9742
|
+
"json",
|
|
9743
|
+
...configArgs,
|
|
9744
|
+
ctx.filePath
|
|
9745
|
+
], { cwd, timeout: 3e4 });
|
|
9374
9746
|
const raw = stripAnsi(checkResult.stdout + checkResult.stderr);
|
|
9375
9747
|
const run = parseToolRun("ruff", { result: checkResult, output: raw, exitCodes: { ran: [1, 2] } }, (output) => {
|
|
9376
9748
|
const diagnostics = parseRuffJson(output, ctx.filePath);
|
|
@@ -9389,7 +9761,7 @@ var ruffRunner = {
|
|
|
9389
9761
|
var ruff_default = ruffRunner;
|
|
9390
9762
|
|
|
9391
9763
|
// dist/clients/dispatch/runners/rust-clippy.js
|
|
9392
|
-
import { isAbsolute as
|
|
9764
|
+
import { isAbsolute as isAbsolute4, resolve as resolve32 } from "node:path";
|
|
9393
9765
|
var CLIPPY_PROBE_BUDGET_MS = 8e3;
|
|
9394
9766
|
var clippyProbeRevision = 0;
|
|
9395
9767
|
var makeClippyProbe = (cargoExe, flightKeyComponent = cargoExe) => createCwdCachedProbe((cwd) => safeSpawnAsync(cargoExe, ["clippy", "--version"], {
|
|
@@ -9463,8 +9835,8 @@ var rustClippyRunner = {
|
|
|
9463
9835
|
return false;
|
|
9464
9836
|
}
|
|
9465
9837
|
});
|
|
9466
|
-
const absEdited =
|
|
9467
|
-
const diagnostics = allDiagnostics.filter((d) => pathsEqual(
|
|
9838
|
+
const absEdited = resolve32(ctx.filePath);
|
|
9839
|
+
const diagnostics = allDiagnostics.filter((d) => pathsEqual(resolve32(cargoDir, d.filePath), absEdited));
|
|
9468
9840
|
const hasBlocking = diagnostics.some((d) => d.semantic === "blocking");
|
|
9469
9841
|
const semantic = hasBlocking ? "blocking" : diagnostics.length > 0 ? "warning" : "none";
|
|
9470
9842
|
if (result.error || result.failure) {
|
|
@@ -9523,7 +9895,7 @@ function parseClippyOutput(raw, fallbackPath, cargoDir) {
|
|
|
9523
9895
|
continue;
|
|
9524
9896
|
const fixableSpan = findMachineApplicableSpan(spans);
|
|
9525
9897
|
const rawFile = span.file || span.file_name;
|
|
9526
|
-
const filePath = rawFile ? cargoDir && !
|
|
9898
|
+
const filePath = rawFile ? cargoDir && !isAbsolute4(rawFile) ? resolve32(cargoDir, rawFile) : rawFile : fallbackPath;
|
|
9527
9899
|
const normalizedSeverity = normalizeClippyLevel(message.level);
|
|
9528
9900
|
diagnostics.push({
|
|
9529
9901
|
id: `clippy-${message.code?.code || "unknown"}`,
|
|
@@ -9548,9 +9920,9 @@ var rust_clippy_default = rustClippyRunner;
|
|
|
9548
9920
|
|
|
9549
9921
|
// dist/clients/dispatch/runners/spotbugs.js
|
|
9550
9922
|
import { randomUUID } from "node:crypto";
|
|
9551
|
-
import * as
|
|
9552
|
-
import * as
|
|
9553
|
-
import * as
|
|
9923
|
+
import * as fs15 from "node:fs";
|
|
9924
|
+
import * as os2 from "node:os";
|
|
9925
|
+
import * as path35 from "node:path";
|
|
9554
9926
|
var java = createAvailabilityChecker("java", ".exe", ["-version"]);
|
|
9555
9927
|
var spotbugs = createAvailabilityChecker("spotbugs", ".bat", ["-version"]);
|
|
9556
9928
|
var MAX_DIAGNOSTICS = 50;
|
|
@@ -9566,18 +9938,18 @@ function classesSignature(classesDir) {
|
|
|
9566
9938
|
break;
|
|
9567
9939
|
let entries;
|
|
9568
9940
|
try {
|
|
9569
|
-
entries =
|
|
9941
|
+
entries = fs15.readdirSync(dir, { withFileTypes: true });
|
|
9570
9942
|
} catch {
|
|
9571
9943
|
continue;
|
|
9572
9944
|
}
|
|
9573
9945
|
for (const entry of entries) {
|
|
9574
|
-
const full =
|
|
9946
|
+
const full = path35.join(dir, entry.name);
|
|
9575
9947
|
if (entry.isDirectory()) {
|
|
9576
9948
|
stack.push(full);
|
|
9577
9949
|
} else if (entry.isFile() && entry.name.endsWith(".class")) {
|
|
9578
9950
|
count++;
|
|
9579
9951
|
try {
|
|
9580
|
-
const m =
|
|
9952
|
+
const m = fs15.statSync(full).mtimeMs;
|
|
9581
9953
|
if (m > newest)
|
|
9582
9954
|
newest = m;
|
|
9583
9955
|
} catch {
|
|
@@ -9662,7 +10034,7 @@ function parseSpotbugsXml(raw) {
|
|
|
9662
10034
|
const message = shortMsg || longMsg || type;
|
|
9663
10035
|
const fixSuggestion = longMsg ? firstSentence(longMsg) : void 0;
|
|
9664
10036
|
diagnostics.push({
|
|
9665
|
-
id: `spotbugs:${type}:${
|
|
10037
|
+
id: `spotbugs:${type}:${path35.basename(filePath)}:${line}:${index}`,
|
|
9666
10038
|
message: `[${type}] ${message}`,
|
|
9667
10039
|
filePath,
|
|
9668
10040
|
line,
|
|
@@ -9712,7 +10084,7 @@ var spotbugsRunner = {
|
|
|
9712
10084
|
const cmd = await resolveAvailableOrInstall(spotbugs, "spotbugs", cwd);
|
|
9713
10085
|
if (!cmd)
|
|
9714
10086
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9715
|
-
const tmpXml =
|
|
10087
|
+
const tmpXml = path35.join(os2.tmpdir(), `pi-lens-spotbugs-${process.pid}-${randomUUID()}.xml`);
|
|
9716
10088
|
const result = await safeSpawnAsync(cmd, [
|
|
9717
10089
|
"-textui",
|
|
9718
10090
|
"-xml:withMessages",
|
|
@@ -9724,7 +10096,7 @@ var spotbugsRunner = {
|
|
|
9724
10096
|
], { cwd, timeout: 12e4 });
|
|
9725
10097
|
let xml = "";
|
|
9726
10098
|
try {
|
|
9727
|
-
xml =
|
|
10099
|
+
xml = fs15.readFileSync(tmpXml, "utf8");
|
|
9728
10100
|
} catch {
|
|
9729
10101
|
if (result.error || (result.status ?? 0) > 1) {
|
|
9730
10102
|
return {
|
|
@@ -9737,7 +10109,7 @@ var spotbugsRunner = {
|
|
|
9737
10109
|
return { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
9738
10110
|
} finally {
|
|
9739
10111
|
try {
|
|
9740
|
-
|
|
10112
|
+
fs15.rmSync(tmpXml, { force: true });
|
|
9741
10113
|
} catch {
|
|
9742
10114
|
}
|
|
9743
10115
|
}
|
|
@@ -9753,8 +10125,8 @@ var spotbugsRunner = {
|
|
|
9753
10125
|
var spotbugs_default = spotbugsRunner;
|
|
9754
10126
|
|
|
9755
10127
|
// dist/clients/dispatch/runners/shellcheck.js
|
|
9756
|
-
import * as
|
|
9757
|
-
import * as
|
|
10128
|
+
import * as fs16 from "node:fs";
|
|
10129
|
+
import * as path36 from "node:path";
|
|
9758
10130
|
var shellcheck = createAvailabilityChecker("shellcheck", ".exe");
|
|
9759
10131
|
var SHELLCHECK_EXIT_CODES = { ran: [1] };
|
|
9760
10132
|
var SHELLCHECK_DIALECTS = [
|
|
@@ -9790,13 +10162,13 @@ function parseShellDirective(content) {
|
|
|
9790
10162
|
function resolveShellFileDialect(filePath) {
|
|
9791
10163
|
let content;
|
|
9792
10164
|
try {
|
|
9793
|
-
content =
|
|
10165
|
+
content = fs16.readFileSync(filePath)?.subarray(0, DIALECT_SNIFF_BYTES).toString("utf8");
|
|
9794
10166
|
} catch {
|
|
9795
10167
|
return { shebang: null, directive: null, dialect: "bash" };
|
|
9796
10168
|
}
|
|
9797
10169
|
const directive = parseShellDirective(content);
|
|
9798
10170
|
const shebang = parseShebang(content);
|
|
9799
|
-
const parsed = directive ?? shebang ?? (
|
|
10171
|
+
const parsed = directive ?? shebang ?? (path36.extname(filePath).toLowerCase() === ".zsh" ? "zsh" : null);
|
|
9800
10172
|
return {
|
|
9801
10173
|
shebang,
|
|
9802
10174
|
directive,
|
|
@@ -9808,7 +10180,7 @@ function findShellcheckConfig(cwd) {
|
|
|
9808
10180
|
}
|
|
9809
10181
|
function parseShellcheckOutput(raw, filePath, cwd) {
|
|
9810
10182
|
const diagnostics = [];
|
|
9811
|
-
const absTarget =
|
|
10183
|
+
const absTarget = path36.resolve(cwd, filePath);
|
|
9812
10184
|
if (!raw.trim()) {
|
|
9813
10185
|
return diagnostics;
|
|
9814
10186
|
}
|
|
@@ -9820,7 +10192,7 @@ function parseShellcheckOutput(raw, filePath, cwd) {
|
|
|
9820
10192
|
for (const item of parsed) {
|
|
9821
10193
|
if (!item.message || !item.line)
|
|
9822
10194
|
continue;
|
|
9823
|
-
if (!item.file || !pathsEqual(
|
|
10195
|
+
if (!item.file || !pathsEqual(path36.resolve(cwd, item.file), absTarget))
|
|
9824
10196
|
continue;
|
|
9825
10197
|
const severityMap = {
|
|
9826
10198
|
error: "error",
|
|
@@ -9920,7 +10292,7 @@ var shellcheckRunner = {
|
|
|
9920
10292
|
var shellcheck_default = shellcheckRunner;
|
|
9921
10293
|
|
|
9922
10294
|
// dist/clients/dispatch/runners/fish-indent.js
|
|
9923
|
-
import { resolve as
|
|
10295
|
+
import { resolve as resolve34 } from "node:path";
|
|
9924
10296
|
var fishIndent = createAvailabilityChecker("fish_indent");
|
|
9925
10297
|
var fish = createAvailabilityChecker("fish");
|
|
9926
10298
|
var SYNTAX_STEP = "fish-syntax-check";
|
|
@@ -9930,8 +10302,8 @@ function parseSyntaxErrors(output, filePath, cwd) {
|
|
|
9930
10302
|
const [, reported, lineText, message] = line.match(/^(.+) \(line (\d+)\): (.+)$/) ?? [];
|
|
9931
10303
|
if (!reported || !lineText || !message)
|
|
9932
10304
|
continue;
|
|
9933
|
-
const wanted =
|
|
9934
|
-
if (!pathsEqual(
|
|
10305
|
+
const wanted = resolve34(cwd, filePath);
|
|
10306
|
+
if (!pathsEqual(resolve34(cwd, reported), wanted) && !(reported.startsWith("~/") && wanted.endsWith(reported.slice(1))))
|
|
9935
10307
|
continue;
|
|
9936
10308
|
const lineNumber = Number(lineText);
|
|
9937
10309
|
diagnostics.push({
|
|
@@ -9991,7 +10363,7 @@ var fishIndentRunner = {
|
|
|
9991
10363
|
if (didNotRun)
|
|
9992
10364
|
return didNotRun;
|
|
9993
10365
|
}
|
|
9994
|
-
const stderrLine = (result.stderr ?? "").split("\n").find((l) => l.trim() && !pathsEqual(
|
|
10366
|
+
const stderrLine = (result.stderr ?? "").split("\n").find((l) => l.trim() && !pathsEqual(resolve34(cwd, l.trim()), resolve34(cwd, ctx.filePath)));
|
|
9995
10367
|
if (stderrLine) {
|
|
9996
10368
|
const lineMatch = stderrLine.match(/\(line\s+(\d+)\)/);
|
|
9997
10369
|
const line = lineMatch ? Number(lineMatch[1]) : 1;
|
|
@@ -10118,12 +10490,12 @@ var shfmtRunner = {
|
|
|
10118
10490
|
var shfmt_default = shfmtRunner;
|
|
10119
10491
|
|
|
10120
10492
|
// dist/clients/dispatch/runners/spellcheck.js
|
|
10121
|
-
import * as
|
|
10493
|
+
import * as path37 from "node:path";
|
|
10122
10494
|
var typos = createAvailabilityChecker("typos", ".exe");
|
|
10123
10495
|
var TYPOS_EXIT_CODES = { ran: [2] };
|
|
10124
10496
|
function parseTyposOutput(raw, filePath, cwd) {
|
|
10125
10497
|
const diagnostics = [];
|
|
10126
|
-
const absTarget =
|
|
10498
|
+
const absTarget = path37.resolve(cwd, filePath);
|
|
10127
10499
|
if (!raw.trim()) {
|
|
10128
10500
|
return diagnostics;
|
|
10129
10501
|
}
|
|
@@ -10133,7 +10505,7 @@ function parseTyposOutput(raw, filePath, cwd) {
|
|
|
10133
10505
|
const parsed = JSON.parse(line);
|
|
10134
10506
|
if (!parsed.typo || !parsed.line_num)
|
|
10135
10507
|
continue;
|
|
10136
|
-
if (parsed.path && !pathsEqual(
|
|
10508
|
+
if (parsed.path && !pathsEqual(path37.resolve(cwd, parsed.path), absTarget))
|
|
10137
10509
|
continue;
|
|
10138
10510
|
const corrections = parsed.corrections?.join(", ") || "no suggestions";
|
|
10139
10511
|
const message = `Typo: "${parsed.typo}" \u2192 ${corrections}`;
|
|
@@ -10191,7 +10563,7 @@ var spellcheckRunner = {
|
|
|
10191
10563
|
var spellcheck_default = spellcheckRunner;
|
|
10192
10564
|
|
|
10193
10565
|
// dist/clients/dispatch/runners/sqlfluff.js
|
|
10194
|
-
import * as
|
|
10566
|
+
import * as path38 from "node:path";
|
|
10195
10567
|
var sqlfluff = createAvailabilityChecker("sqlfluff", ".exe");
|
|
10196
10568
|
var SQLFLUFF_EXIT_CODES = { ran: [1] };
|
|
10197
10569
|
var SQLFLUFF_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
@@ -10246,9 +10618,9 @@ function parseSqlfluffOutput(raw, filePath, cwd) {
|
|
|
10246
10618
|
if (!Array.isArray(parsed))
|
|
10247
10619
|
return [];
|
|
10248
10620
|
const diagnostics = [];
|
|
10249
|
-
const absTarget =
|
|
10621
|
+
const absTarget = path38.resolve(cwd, filePath);
|
|
10250
10622
|
for (const item of parsed) {
|
|
10251
|
-
if (item.filepath && !pathsEqual(
|
|
10623
|
+
if (item.filepath && !pathsEqual(path38.resolve(cwd, item.filepath), absTarget))
|
|
10252
10624
|
continue;
|
|
10253
10625
|
for (const v of item.violations ?? []) {
|
|
10254
10626
|
if (!v.description)
|
|
@@ -10323,7 +10695,7 @@ var sqlfluffRunner = {
|
|
|
10323
10695
|
var sqlfluff_default = sqlfluffRunner;
|
|
10324
10696
|
|
|
10325
10697
|
// dist/clients/dispatch/runners/stylelint.js
|
|
10326
|
-
import * as
|
|
10698
|
+
import * as path39 from "node:path";
|
|
10327
10699
|
var stylelint = createAvailabilityChecker("stylelint", ".cmd");
|
|
10328
10700
|
var STYLELINT_EXIT_CODES = { ran: [1, 2] };
|
|
10329
10701
|
function stylelintReport(stdout, stderr) {
|
|
@@ -10368,9 +10740,9 @@ function parseStylelintJson(raw, filePath, cwd) {
|
|
|
10368
10740
|
try {
|
|
10369
10741
|
const results = JSON.parse(raw);
|
|
10370
10742
|
const diagnostics = [];
|
|
10371
|
-
const absTarget =
|
|
10743
|
+
const absTarget = path39.resolve(cwd, filePath);
|
|
10372
10744
|
for (const result of results) {
|
|
10373
|
-
if (result.source && !pathsEqual(
|
|
10745
|
+
if (result.source && !pathsEqual(path39.resolve(cwd, result.source), absTarget))
|
|
10374
10746
|
continue;
|
|
10375
10747
|
for (const w of result.warnings) {
|
|
10376
10748
|
const severity = w.severity === "error" ? "error" : "warning";
|
|
@@ -10406,7 +10778,7 @@ var stylelintRunner = {
|
|
|
10406
10778
|
if (policy && !policy.preferredRunners.includes("stylelint")) {
|
|
10407
10779
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10408
10780
|
}
|
|
10409
|
-
const fileDir =
|
|
10781
|
+
const fileDir = path39.dirname(path39.resolve(cwd, ctx.filePath));
|
|
10410
10782
|
const hasConfig = hasStylelintConfig(fileDir) || hasStylelintConfig(cwd);
|
|
10411
10783
|
if (!hasConfig) {
|
|
10412
10784
|
logRunnerAdvisoryOnce(ctx, "stylelint", cwd, "stylelint: no config detected, running with default rules");
|
|
@@ -10436,7 +10808,7 @@ var stylelintRunner = {
|
|
|
10436
10808
|
var stylelint_default = stylelintRunner;
|
|
10437
10809
|
|
|
10438
10810
|
// dist/clients/dispatch/runners/swiftlint.js
|
|
10439
|
-
import * as
|
|
10811
|
+
import * as path40 from "node:path";
|
|
10440
10812
|
var swiftlint = createAvailabilityChecker("swiftlint", ".exe");
|
|
10441
10813
|
var SWIFTLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
10442
10814
|
"closing_brace",
|
|
@@ -10499,7 +10871,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
|
|
|
10499
10871
|
const diagnostics = [];
|
|
10500
10872
|
if (!raw.trim())
|
|
10501
10873
|
return diagnostics;
|
|
10502
|
-
const absTarget =
|
|
10874
|
+
const absTarget = path40.resolve(cwd, filePath);
|
|
10503
10875
|
try {
|
|
10504
10876
|
const parsed = JSON.parse(raw);
|
|
10505
10877
|
if (!Array.isArray(parsed))
|
|
@@ -10507,7 +10879,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
|
|
|
10507
10879
|
for (const item of parsed) {
|
|
10508
10880
|
if (!item.reason)
|
|
10509
10881
|
continue;
|
|
10510
|
-
if (item.file && !pathsEqual(
|
|
10882
|
+
if (item.file && !pathsEqual(path40.resolve(cwd, item.file), absTarget))
|
|
10511
10883
|
continue;
|
|
10512
10884
|
const severityMap = {
|
|
10513
10885
|
error: "error",
|
|
@@ -10552,7 +10924,7 @@ var swiftlintRunner = {
|
|
|
10552
10924
|
}
|
|
10553
10925
|
if (!cmd)
|
|
10554
10926
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10555
|
-
const result = await safeSpawnAsync(cmd, ["--reporter", "json",
|
|
10927
|
+
const result = await safeSpawnAsync(cmd, ["--reporter", "json", path40.resolve(cwd, ctx.filePath)], { cwd, timeout: 15e3 });
|
|
10556
10928
|
const run = parseToolRun("swiftlint", {
|
|
10557
10929
|
result,
|
|
10558
10930
|
// EXIT TABLE (SwiftLint 0.56 measured fixture): 0 clean; 1 findings; 2 error; other nonzero rejected.
|
|
@@ -10574,7 +10946,7 @@ var swiftlintRunner = {
|
|
|
10574
10946
|
var swiftlint_default = swiftlintRunner;
|
|
10575
10947
|
|
|
10576
10948
|
// dist/clients/dispatch/runners/taplo.js
|
|
10577
|
-
import * as
|
|
10949
|
+
import * as path41 from "node:path";
|
|
10578
10950
|
var taplo = createAvailabilityChecker("taplo", ".exe");
|
|
10579
10951
|
var TAPLO_EXIT_CODES = { ran: [1] };
|
|
10580
10952
|
var HEADER_PATTERN = /^\s*(error|warning):(.*)$/;
|
|
@@ -10582,7 +10954,7 @@ var LOCATION_LEAD = "\u250C\u2500";
|
|
|
10582
10954
|
var LOCATION_PATTERN = /^\s*┌─\s+(.+?):(\d+):(\d+)$/;
|
|
10583
10955
|
function parseTaploOutput(raw, filePath, cwd) {
|
|
10584
10956
|
const diagnostics = [];
|
|
10585
|
-
const absTarget =
|
|
10957
|
+
const absTarget = path41.resolve(cwd, filePath);
|
|
10586
10958
|
const lines = stripAnsi(raw ?? "").split(/\r?\n/);
|
|
10587
10959
|
for (let i = 0; i < lines.length; i++) {
|
|
10588
10960
|
const header = HEADER_PATTERN.exec(lines[i].trimEnd());
|
|
@@ -10600,7 +10972,7 @@ function parseTaploOutput(raw, filePath, cwd) {
|
|
|
10600
10972
|
const location = LOCATION_PATTERN.exec(lines[j].trimEnd());
|
|
10601
10973
|
if (!location)
|
|
10602
10974
|
continue;
|
|
10603
|
-
if (!pathsEqual(
|
|
10975
|
+
if (!pathsEqual(path41.resolve(cwd, location[1].trim()), absTarget))
|
|
10604
10976
|
continue;
|
|
10605
10977
|
line = Number.parseInt(location[2], 10) || 1;
|
|
10606
10978
|
column = Number.parseInt(location[3], 10) || 1;
|
|
@@ -10662,7 +11034,7 @@ var taploRunner = {
|
|
|
10662
11034
|
}
|
|
10663
11035
|
if (!cmd)
|
|
10664
11036
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10665
|
-
const absPath =
|
|
11037
|
+
const absPath = path41.resolve(cwd, ctx.filePath);
|
|
10666
11038
|
const result = await safeSpawnAsync(cmd, ["check", "--colors", "never", absPath], { cwd, timeout: 15e3 });
|
|
10667
11039
|
const raw = result.stderr?.trim() ? result.stderr : result.stdout ?? "";
|
|
10668
11040
|
const run = parseToolRun("taplo", { result, output: raw, exitCodes: TAPLO_EXIT_CODES }, (out) => parseTaploOutput(out, ctx.filePath, cwd), { skipWhenParsedNothing: true });
|
|
@@ -10681,7 +11053,7 @@ var taploRunner = {
|
|
|
10681
11053
|
var taplo_default = taploRunner;
|
|
10682
11054
|
|
|
10683
11055
|
// dist/clients/dispatch/runners/terragrunt.js
|
|
10684
|
-
import * as
|
|
11056
|
+
import * as path42 from "node:path";
|
|
10685
11057
|
var terragrunt = createAvailabilityChecker("terragrunt", ".exe");
|
|
10686
11058
|
function normalizeSeverity(raw) {
|
|
10687
11059
|
if (typeof raw === "number")
|
|
@@ -10700,7 +11072,7 @@ function toRawDiagnostics(parsed) {
|
|
|
10700
11072
|
return [];
|
|
10701
11073
|
return invalidFiles.flatMap((f) => Array.isArray(f?.diagnostics) ? f.diagnostics : []);
|
|
10702
11074
|
}
|
|
10703
|
-
function parseTerragruntOutput(raw, filePath, absPath =
|
|
11075
|
+
function parseTerragruntOutput(raw, filePath, absPath = path42.resolve(filePath)) {
|
|
10704
11076
|
if (!raw.trim())
|
|
10705
11077
|
return [];
|
|
10706
11078
|
let parsed;
|
|
@@ -10709,13 +11081,13 @@ function parseTerragruntOutput(raw, filePath, absPath = path41.resolve(filePath)
|
|
|
10709
11081
|
} catch {
|
|
10710
11082
|
return [];
|
|
10711
11083
|
}
|
|
10712
|
-
const unitDir =
|
|
11084
|
+
const unitDir = path42.dirname(absPath);
|
|
10713
11085
|
const diagnostics = [];
|
|
10714
11086
|
for (const d of toRawDiagnostics(parsed)) {
|
|
10715
11087
|
if (!d || typeof d !== "object")
|
|
10716
11088
|
continue;
|
|
10717
11089
|
const diagFile = d.range?.filename;
|
|
10718
|
-
if (diagFile && !pathsEqual(
|
|
11090
|
+
if (diagFile && !pathsEqual(path42.resolve(unitDir, diagFile), absPath))
|
|
10719
11091
|
continue;
|
|
10720
11092
|
const line = d.range?.start?.line ?? 1;
|
|
10721
11093
|
const column = d.range?.start?.column ?? 1;
|
|
@@ -10761,8 +11133,8 @@ var terragruntRunner = {
|
|
|
10761
11133
|
}
|
|
10762
11134
|
if (!cmd)
|
|
10763
11135
|
return SKIPPED3;
|
|
10764
|
-
const absPath =
|
|
10765
|
-
const fileDir =
|
|
11136
|
+
const absPath = path42.resolve(cwd, ctx.filePath);
|
|
11137
|
+
const fileDir = path42.dirname(absPath);
|
|
10766
11138
|
const result = await safeSpawnAsync(cmd, ["hcl", "validate", "--json", "--non-interactive"], { cwd: fileDir, timeout: 3e4 });
|
|
10767
11139
|
if (spawnFailedWithNoOutput(result))
|
|
10768
11140
|
return faultSkip("did-not-run");
|
|
@@ -10788,22 +11160,22 @@ var terragruntRunner = {
|
|
|
10788
11160
|
var terragrunt_default = terragruntRunner;
|
|
10789
11161
|
|
|
10790
11162
|
// dist/clients/dispatch/runners/tflint.js
|
|
10791
|
-
import * as
|
|
11163
|
+
import * as path43 from "node:path";
|
|
10792
11164
|
var tflint = createAvailabilityChecker("tflint", ".exe");
|
|
10793
11165
|
var TFLINT_CONFIG = ".tflint.hcl";
|
|
10794
11166
|
function findTflintConfig(fileDir) {
|
|
10795
11167
|
if (process.env.TFLINT_CONFIG_FILE)
|
|
10796
11168
|
return null;
|
|
10797
11169
|
const dir = findNearestDirWithAnyBasename(fileDir, [TFLINT_CONFIG]);
|
|
10798
|
-
return dir ?
|
|
11170
|
+
return dir ? path43.join(dir, TFLINT_CONFIG) : null;
|
|
10799
11171
|
}
|
|
10800
11172
|
function parseTflintOutput(raw, filePath, toolCwd) {
|
|
10801
11173
|
try {
|
|
10802
11174
|
const parsed = JSON.parse(raw);
|
|
10803
11175
|
const issues = parsed.issues ?? [];
|
|
10804
|
-
const absTarget =
|
|
11176
|
+
const absTarget = path43.resolve(toolCwd, filePath);
|
|
10805
11177
|
return issues.flatMap((issue) => {
|
|
10806
|
-
if (issue.range?.filename && !pathsEqual(
|
|
11178
|
+
if (issue.range?.filename && !pathsEqual(path43.resolve(toolCwd, issue.range.filename), absTarget))
|
|
10807
11179
|
return [];
|
|
10808
11180
|
const severity = issue.rule.severity === "error" ? "error" : "warning";
|
|
10809
11181
|
return [
|
|
@@ -10846,12 +11218,12 @@ var tflintRunner = {
|
|
|
10846
11218
|
}
|
|
10847
11219
|
if (!cmd)
|
|
10848
11220
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10849
|
-
const absPath =
|
|
10850
|
-
const fileDir =
|
|
11221
|
+
const absPath = path43.resolve(cwd, ctx.filePath);
|
|
11222
|
+
const fileDir = path43.dirname(absPath);
|
|
10851
11223
|
const args = [
|
|
10852
11224
|
"--format=json",
|
|
10853
11225
|
"--no-color",
|
|
10854
|
-
`--filter=${
|
|
11226
|
+
`--filter=${path43.basename(absPath)}`
|
|
10855
11227
|
];
|
|
10856
11228
|
const configPath = findTflintConfig(fileDir);
|
|
10857
11229
|
if (configPath)
|
|
@@ -10886,8 +11258,8 @@ var tflintRunner = {
|
|
|
10886
11258
|
var tflint_default = tflintRunner;
|
|
10887
11259
|
|
|
10888
11260
|
// dist/clients/dispatch/runners/trivy-config.js
|
|
10889
|
-
import * as
|
|
10890
|
-
import * as
|
|
11261
|
+
import * as fs17 from "node:fs";
|
|
11262
|
+
import * as path44 from "node:path";
|
|
10891
11263
|
var trivy2 = createAvailabilityChecker("trivy", ".exe");
|
|
10892
11264
|
function looksLikeKubernetesManifest(content) {
|
|
10893
11265
|
for (const doc of content.split(/^---\s*$/m)) {
|
|
@@ -10924,12 +11296,12 @@ function parseTrivyConfigOutput(raw, filePath, cwd = process.cwd()) {
|
|
|
10924
11296
|
if (!Array.isArray(results))
|
|
10925
11297
|
return [];
|
|
10926
11298
|
const diagnostics = [];
|
|
10927
|
-
const absTarget =
|
|
11299
|
+
const absTarget = path44.resolve(cwd, filePath);
|
|
10928
11300
|
for (const resultEntry of results) {
|
|
10929
11301
|
if (!resultEntry || typeof resultEntry !== "object")
|
|
10930
11302
|
continue;
|
|
10931
11303
|
const target = resultEntry.Target;
|
|
10932
|
-
if (typeof target !== "string" || !pathsEqual(
|
|
11304
|
+
if (typeof target !== "string" || !pathsEqual(path44.resolve(cwd, target), absTarget))
|
|
10933
11305
|
continue;
|
|
10934
11306
|
const rows = resultEntry.Misconfigurations;
|
|
10935
11307
|
if (!Array.isArray(rows))
|
|
@@ -10971,13 +11343,18 @@ var trivyConfigRunner = {
|
|
|
10971
11343
|
async run(ctx) {
|
|
10972
11344
|
const cwd = resolveRunnerCwd(ctx, "trivy-config");
|
|
10973
11345
|
if (!isTrivyEnabled(cwd)) {
|
|
10974
|
-
return {
|
|
11346
|
+
return {
|
|
11347
|
+
status: "skipped",
|
|
11348
|
+
diagnostics: [],
|
|
11349
|
+
semantic: "none",
|
|
11350
|
+
skipReason: "not-enabled"
|
|
11351
|
+
};
|
|
10975
11352
|
}
|
|
10976
|
-
const absPath =
|
|
11353
|
+
const absPath = path44.resolve(cwd, ctx.filePath);
|
|
10977
11354
|
if (ctx.kind === "yaml" || ctx.kind === "json") {
|
|
10978
11355
|
let content = "";
|
|
10979
11356
|
try {
|
|
10980
|
-
content =
|
|
11357
|
+
content = fs17.readFileSync(absPath, "utf-8");
|
|
10981
11358
|
} catch {
|
|
10982
11359
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10983
11360
|
}
|
|
@@ -11045,7 +11422,7 @@ var trivyConfigRunner = {
|
|
|
11045
11422
|
var trivy_config_default = trivyConfigRunner;
|
|
11046
11423
|
|
|
11047
11424
|
// dist/clients/dispatch/runners/vale.js
|
|
11048
|
-
import * as
|
|
11425
|
+
import * as path45 from "node:path";
|
|
11049
11426
|
var vale = createAvailabilityChecker("vale", ".exe");
|
|
11050
11427
|
function findValeConfig(cwd) {
|
|
11051
11428
|
return findLocalToolConfig(cwd, [".vale.ini"]);
|
|
@@ -11054,7 +11431,7 @@ function parseValeOutput(raw, filePath, cwd) {
|
|
|
11054
11431
|
const diagnostics = [];
|
|
11055
11432
|
if (!raw.trim())
|
|
11056
11433
|
return diagnostics;
|
|
11057
|
-
const absTarget =
|
|
11434
|
+
const absTarget = path45.resolve(cwd, filePath);
|
|
11058
11435
|
try {
|
|
11059
11436
|
const parsed = JSON.parse(raw);
|
|
11060
11437
|
if (!parsed || typeof parsed !== "object")
|
|
@@ -11062,7 +11439,7 @@ function parseValeOutput(raw, filePath, cwd) {
|
|
|
11062
11439
|
for (const [reported, alerts] of Object.entries(parsed)) {
|
|
11063
11440
|
if (!Array.isArray(alerts))
|
|
11064
11441
|
continue;
|
|
11065
|
-
if (reported && !pathsEqual(
|
|
11442
|
+
if (reported && !pathsEqual(path45.resolve(cwd, reported), absTarget))
|
|
11066
11443
|
continue;
|
|
11067
11444
|
for (const alert of alerts) {
|
|
11068
11445
|
if (!alert.Message)
|
|
@@ -11133,11 +11510,11 @@ var valeRunner = {
|
|
|
11133
11510
|
var vale_default = valeRunner;
|
|
11134
11511
|
|
|
11135
11512
|
// dist/clients/dispatch/runners/tree-sitter.js
|
|
11136
|
-
import * as
|
|
11513
|
+
import * as path47 from "node:path";
|
|
11137
11514
|
|
|
11138
11515
|
// dist/clients/cache/rule-cache.js
|
|
11139
|
-
import * as
|
|
11140
|
-
import * as
|
|
11516
|
+
import * as fs18 from "node:fs";
|
|
11517
|
+
import * as path46 from "node:path";
|
|
11141
11518
|
var CACHE_VERSION = "v7";
|
|
11142
11519
|
function reportBundledRulesRootHealth() {
|
|
11143
11520
|
reportBundledResourceDirHealth("tree-sitter-queries-dir-missing", BUNDLED_QUERIES_ROOT, getBundledQueriesRootHealth(), "bundled tree-sitter query rules");
|
|
@@ -11149,12 +11526,12 @@ var RuleCache = class {
|
|
|
11149
11526
|
constructor(language, rootDir = process.cwd()) {
|
|
11150
11527
|
this.language = language;
|
|
11151
11528
|
reportBundledRulesRootHealth();
|
|
11152
|
-
this.cacheDir =
|
|
11153
|
-
this.cacheFile =
|
|
11529
|
+
this.cacheDir = path46.join(getProjectDataDir(rootDir), "cache");
|
|
11530
|
+
this.cacheFile = path46.join(this.cacheDir, `${language}-rules-${CACHE_VERSION}.json`);
|
|
11154
11531
|
}
|
|
11155
11532
|
ensureCacheDir() {
|
|
11156
|
-
if (!
|
|
11157
|
-
|
|
11533
|
+
if (!fs18.existsSync(this.cacheDir)) {
|
|
11534
|
+
fs18.mkdirSync(this.cacheDir, { recursive: true });
|
|
11158
11535
|
}
|
|
11159
11536
|
}
|
|
11160
11537
|
computeRuleHash(ruleFiles) {
|
|
@@ -11163,7 +11540,7 @@ var RuleCache = class {
|
|
|
11163
11540
|
get(ruleFiles) {
|
|
11164
11541
|
try {
|
|
11165
11542
|
this.ensureCacheDir();
|
|
11166
|
-
if (!
|
|
11543
|
+
if (!fs18.existsSync(this.cacheFile))
|
|
11167
11544
|
return null;
|
|
11168
11545
|
const currentHash = this.computeRuleHash(ruleFiles);
|
|
11169
11546
|
const cached = readJsonCache(this.cacheFile, (parsed) => {
|
|
@@ -11197,11 +11574,11 @@ var RuleCache = class {
|
|
|
11197
11574
|
// on their own — nothing ever read or removed them again once the version
|
|
11198
11575
|
// bumped. Delete every sibling for this language that isn't the current file.
|
|
11199
11576
|
pruneStaleVersions() {
|
|
11200
|
-
const currentName =
|
|
11577
|
+
const currentName = path46.basename(this.cacheFile);
|
|
11201
11578
|
const pattern = new RegExp(`^${this.language}-rules-v\\d+\\.json$`);
|
|
11202
11579
|
let dirents;
|
|
11203
11580
|
try {
|
|
11204
|
-
dirents =
|
|
11581
|
+
dirents = fs18.readdirSync(this.cacheDir);
|
|
11205
11582
|
} catch {
|
|
11206
11583
|
return;
|
|
11207
11584
|
}
|
|
@@ -11209,15 +11586,15 @@ var RuleCache = class {
|
|
|
11209
11586
|
if (name === currentName || !pattern.test(name))
|
|
11210
11587
|
continue;
|
|
11211
11588
|
try {
|
|
11212
|
-
|
|
11589
|
+
fs18.unlinkSync(path46.join(this.cacheDir, name));
|
|
11213
11590
|
} catch {
|
|
11214
11591
|
}
|
|
11215
11592
|
}
|
|
11216
11593
|
}
|
|
11217
11594
|
clear() {
|
|
11218
11595
|
try {
|
|
11219
|
-
if (
|
|
11220
|
-
|
|
11596
|
+
if (fs18.existsSync(this.cacheFile)) {
|
|
11597
|
+
fs18.unlinkSync(this.cacheFile);
|
|
11221
11598
|
}
|
|
11222
11599
|
} catch {
|
|
11223
11600
|
}
|
|
@@ -11531,7 +11908,7 @@ var treeSitterRunner = {
|
|
|
11531
11908
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
11532
11909
|
}
|
|
11533
11910
|
const filePath = ctx.filePath;
|
|
11534
|
-
const ext =
|
|
11911
|
+
const ext = path47.extname(filePath).toLowerCase();
|
|
11535
11912
|
const languageId = resolveTreeSitterLanguage(filePath);
|
|
11536
11913
|
if (!languageId) {
|
|
11537
11914
|
logTreeSitter({
|
|
@@ -11765,18 +12142,18 @@ var treeSitterRunner = {
|
|
|
11765
12142
|
var tree_sitter_default = treeSitterRunner;
|
|
11766
12143
|
|
|
11767
12144
|
// dist/clients/dispatch/runners/yamllint.js
|
|
11768
|
-
import * as
|
|
12145
|
+
import * as path48 from "node:path";
|
|
11769
12146
|
var yamllint = createAvailabilityChecker("yamllint", ".exe");
|
|
11770
12147
|
function parseYamllintParsable(raw, filePath, cwd) {
|
|
11771
12148
|
const diagnostics = [];
|
|
11772
|
-
const absTarget =
|
|
12149
|
+
const absTarget = path48.resolve(cwd, filePath);
|
|
11773
12150
|
for (const line of raw.split(/\r?\n/)) {
|
|
11774
12151
|
if (!line.trim())
|
|
11775
12152
|
continue;
|
|
11776
12153
|
const match = line.match(/^(.*?):(\d+):(\d+):\s*\[(error|warning)\]\s*(.*?)\s*\(([^)]+)\)\s*$/i);
|
|
11777
12154
|
if (!match)
|
|
11778
12155
|
continue;
|
|
11779
|
-
if (!pathsEqual(
|
|
12156
|
+
if (!pathsEqual(path48.resolve(cwd, match[1]), absTarget))
|
|
11780
12157
|
continue;
|
|
11781
12158
|
const severity = match[4].toLowerCase() === "error" ? "error" : "warning";
|
|
11782
12159
|
diagnostics.push({
|
|
@@ -11841,17 +12218,17 @@ var yamllintRunner = {
|
|
|
11841
12218
|
var yamllint_default = yamllintRunner;
|
|
11842
12219
|
|
|
11843
12220
|
// dist/clients/dispatch/runners/zig-check.js
|
|
11844
|
-
import * as
|
|
12221
|
+
import * as path49 from "node:path";
|
|
11845
12222
|
var zig = createAvailabilityChecker("zig", ".exe", ["version"]);
|
|
11846
12223
|
function parseZigOutput(raw, filePath, cwd) {
|
|
11847
12224
|
const diagnostics = [];
|
|
11848
|
-
const absTarget =
|
|
12225
|
+
const absTarget = path49.resolve(cwd, filePath);
|
|
11849
12226
|
for (const line of raw.split(/\r?\n/)) {
|
|
11850
12227
|
const match = line.match(/^(.*?):(\d+):(\d+):\s*(error|warning|note):\s*(.+)$/);
|
|
11851
12228
|
if (!match)
|
|
11852
12229
|
continue;
|
|
11853
12230
|
const [, rawFile, lineStr, colStr, level, message] = match;
|
|
11854
|
-
if (!pathsEqual(
|
|
12231
|
+
if (!pathsEqual(path49.resolve(cwd, rawFile.trim()), absTarget))
|
|
11855
12232
|
continue;
|
|
11856
12233
|
const severity = level === "error" ? "error" : "warning";
|
|
11857
12234
|
diagnostics.push({
|
|
@@ -11882,7 +12259,7 @@ var zigCheckRunner = {
|
|
|
11882
12259
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
11883
12260
|
}
|
|
11884
12261
|
const cmd = zig.getCommand(cwd);
|
|
11885
|
-
const absPath =
|
|
12262
|
+
const absPath = path49.resolve(cwd, ctx.filePath);
|
|
11886
12263
|
const result = await safeSpawnAsync(cmd, ["build-exe", absPath, "-fno-emit-bin"], { cwd, timeout: 3e4 });
|
|
11887
12264
|
if (result.error && !result.stdout && !result.stderr) {
|
|
11888
12265
|
return faultSkip("did-not-run");
|
|
@@ -12813,7 +13190,8 @@ var CASCADE_GRAPH_KINDS = /* @__PURE__ */ new Set([
|
|
|
12813
13190
|
"go",
|
|
12814
13191
|
"rust",
|
|
12815
13192
|
"ruby",
|
|
12816
|
-
"cxx"
|
|
13193
|
+
"cxx",
|
|
13194
|
+
"java"
|
|
12817
13195
|
]);
|
|
12818
13196
|
var IMPLICIT_SCOPE_NEIGHBOR_CAP = MAX_FILES * 2;
|
|
12819
13197
|
async function dispatchLintWithResult(filePath, cwd, pi, modifiedRanges, logContext, options) {
|
|
@@ -12882,7 +13260,7 @@ async function getAvailableRunners(filePath) {
|
|
|
12882
13260
|
const kind = detectFileKind(filePath);
|
|
12883
13261
|
if (!kind)
|
|
12884
13262
|
return [];
|
|
12885
|
-
const normalizedPath = filePath
|
|
13263
|
+
const normalizedPath = toPosix(filePath);
|
|
12886
13264
|
const pathForFilter = normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`;
|
|
12887
13265
|
const runners = sessionRunnerRegistry.getForKind(kind, pathForFilter);
|
|
12888
13266
|
return runners.map((r) => r.id);
|
|
@@ -12959,7 +13337,7 @@ function usableWarmWordIndex(index) {
|
|
|
12959
13337
|
return index?.forward ? index : void 0;
|
|
12960
13338
|
}
|
|
12961
13339
|
function acquireWarmWordIndex(cwd) {
|
|
12962
|
-
const key2 =
|
|
13340
|
+
const key2 = path50.resolve(cwd);
|
|
12963
13341
|
let entry = warmWordIndexes.get(key2);
|
|
12964
13342
|
if (!entry) {
|
|
12965
13343
|
const snapshot = loadProjectSnapshot(key2);
|
|
@@ -12997,7 +13375,7 @@ function adoptPublishedWarmWordIndex(cwd, published, trigger) {
|
|
|
12997
13375
|
const index = usableWarmWordIndex(published);
|
|
12998
13376
|
if (!index)
|
|
12999
13377
|
return;
|
|
13000
|
-
const key2 =
|
|
13378
|
+
const key2 = path50.resolve(cwd);
|
|
13001
13379
|
const entry = warmWordIndexes.get(key2);
|
|
13002
13380
|
if (!entry || entry.index)
|
|
13003
13381
|
return;
|
|
@@ -13064,7 +13442,7 @@ async function warmLspForFile(absPath, host) {
|
|
|
13064
13442
|
return;
|
|
13065
13443
|
let content;
|
|
13066
13444
|
try {
|
|
13067
|
-
content =
|
|
13445
|
+
content = fs19.readFileSync(absPath, "utf8");
|
|
13068
13446
|
} catch {
|
|
13069
13447
|
return;
|
|
13070
13448
|
}
|
|
@@ -13087,7 +13465,7 @@ async function warmLspForFile(absPath, host) {
|
|
|
13087
13465
|
}
|
|
13088
13466
|
}
|
|
13089
13467
|
async function analyzeFile(filePath, cwd, options = {}) {
|
|
13090
|
-
const absPath =
|
|
13468
|
+
const absPath = path50.isAbsolute(filePath) ? filePath : path50.resolve(cwd, filePath);
|
|
13091
13469
|
const host = createMcpHost({ "no-delta": true, ...options.flags }, cwd);
|
|
13092
13470
|
const observedAt = Date.now();
|
|
13093
13471
|
const analysisRootMode = resolveAnalysisRoot(absPath, cwd);
|
|
@@ -13114,7 +13492,7 @@ async function analyzeFile(filePath, cwd, options = {}) {
|
|
|
13114
13492
|
}
|
|
13115
13493
|
if (options.registerTurnState) {
|
|
13116
13494
|
try {
|
|
13117
|
-
const lineCount =
|
|
13495
|
+
const lineCount = fs19.readFileSync(absPath, "utf8").split("\n").length;
|
|
13118
13496
|
new CacheManager().addModifiedRange(absPath, { start: 1, end: lineCount }, true, cwd, options.ownerId ?? MCP_TURN_STATE_OWNER_ID, "mcp");
|
|
13119
13497
|
} catch {
|
|
13120
13498
|
}
|
|
@@ -13132,7 +13510,7 @@ async function analyzeFile(filePath, cwd, options = {}) {
|
|
|
13132
13510
|
try {
|
|
13133
13511
|
if (warmIndex) {
|
|
13134
13512
|
try {
|
|
13135
|
-
const content =
|
|
13513
|
+
const content = fs19.readFileSync(absPath, "utf8");
|
|
13136
13514
|
if (!canWriteAnalysisRoot(analysisRootMode)) {
|
|
13137
13515
|
emitBounded("adopted_root_writer_skipped", `${absPath}:word-index`, {
|
|
13138
13516
|
filePath: absPath,
|
|
@@ -13219,7 +13597,8 @@ export {
|
|
|
13219
13597
|
applyRulePolicy,
|
|
13220
13598
|
convertLspDiagnostics,
|
|
13221
13599
|
applyFindingPolicy,
|
|
13222
|
-
|
|
13600
|
+
applyFindingPolicyByOwner,
|
|
13601
|
+
loadProjectRulePolicy,
|
|
13223
13602
|
inlineBlockerIdentities,
|
|
13224
13603
|
applyPushedFindingPolicy,
|
|
13225
13604
|
applyPushedFindingPolicyByFile,
|
|
@@ -13235,6 +13614,7 @@ export {
|
|
|
13235
13614
|
resetPendingRunnerFindings,
|
|
13236
13615
|
pendingRunnerFindingsSize,
|
|
13237
13616
|
laneCopyStandsFor,
|
|
13617
|
+
disabledRunnersOf,
|
|
13238
13618
|
DELTA_UNUSED_PROMOTION_NOTE,
|
|
13239
13619
|
formatDiagnostics,
|
|
13240
13620
|
createDispatchContext,
|