pi-lens 4.4.7 → 4.4.9
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-USER.md +31 -0
- package/CHANGELOG.md +327 -0
- package/README.md +13 -2
- package/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/config/markdownlint/run-no-fix.mjs +36 -0
- package/dist/{chunk-4LM3VAZH.js → chunk-2VZ3VN3N.js} +2 -2
- package/dist/{chunk-PUZ3E2J4.js → chunk-3HTZDY3C.js} +8 -6
- package/dist/{chunk-RORGS5II.js → chunk-3NPWO5UO.js} +7 -13
- package/dist/{chunk-MNJIXFX4.js → chunk-47UCC4MM.js} +1 -1
- package/dist/chunk-4ENEJHF4.js +198 -0
- package/dist/chunk-5GEYJJHG.js +22 -0
- package/dist/{chunk-U6VN4NVL.js → chunk-5YSEQHJN.js} +3 -3
- package/dist/{chunk-6IR3ZYIB.js → chunk-6GPB3JLL.js} +3 -3
- package/dist/{chunk-MB6PXBUA.js → chunk-7R5GZIA6.js} +7 -15
- package/dist/{chunk-DH5JPM3K.js → chunk-7UTSNTWM.js} +10 -9
- package/dist/{chunk-24BILSZW.js → chunk-7YTRG6YW.js} +2 -2
- package/dist/{chunk-KW5JQPO5.js → chunk-AACN5GNE.js} +2 -2
- package/dist/{chunk-PKES3ISE.js → chunk-ACRJ2GZ5.js} +2 -2
- package/dist/{chunk-4ZYJHQMB.js → chunk-C3YRO3EU.js} +10 -12
- package/dist/{chunk-PQJFG24Z.js → chunk-CB7PEVOJ.js} +1300 -946
- package/dist/{chunk-ABPKUVA4.js → chunk-CDFJF5YD.js} +1 -1
- package/dist/{chunk-T7A2HK2B.js → chunk-CJS6WE66.js} +17 -18
- package/dist/{chunk-3YY7IXIL.js → chunk-CM6BDY4E.js} +14 -60
- package/dist/{chunk-RZOXUSPC.js → chunk-CZCAZVTD.js} +16 -2
- package/dist/chunk-DGKFWQK4.js +23 -0
- package/dist/{chunk-NA7SEXHE.js → chunk-E65WJVI5.js} +7 -9
- package/dist/{chunk-2TF6RXWB.js → chunk-EKNYSXFB.js} +8 -10
- package/dist/{chunk-RRV3FNNM.js → chunk-EY6LY2HO.js} +27 -30
- package/dist/{chunk-LBLBAFG3.js → chunk-F6BEQWAK.js} +17 -5
- package/dist/{chunk-4L36HG27.js → chunk-FGNSESAC.js} +12 -14
- package/dist/{chunk-3FRLWYBG.js → chunk-FRUBVFXV.js} +39 -42
- package/dist/{chunk-FB5SCCPT.js → chunk-G22UNQID.js} +14 -15
- package/dist/{chunk-LV4UMYVH.js → chunk-GQTQUNCG.js} +26 -27
- package/dist/{chunk-E7HJ56Y7.js → chunk-H3BVMK47.js} +64 -73
- package/dist/chunk-H6FLQ5NW.js +28 -0
- package/dist/{chunk-QHSNL7B2.js → chunk-HEA3EM23.js} +15 -19
- package/dist/{chunk-AWDSEDER.js → chunk-HSOBIN22.js} +2 -2
- package/dist/{chunk-EAOK7MIZ.js → chunk-HYSKJMZK.js} +17 -4
- package/dist/{chunk-VUZWQ7UG.js → chunk-IICERRFF.js} +46 -72
- package/dist/{chunk-OXOI55RU.js → chunk-IILEH3ZC.js} +8 -10
- package/dist/{chunk-ZKXQKGWZ.js → chunk-J3Q2NYJR.js} +4 -3
- package/dist/{chunk-YHC2O2WO.js → chunk-JUZ67QZQ.js} +20 -9
- package/dist/chunk-KR5VGMVT.js +25 -0
- package/dist/{chunk-F7K5IBZG.js → chunk-KV6GQOGN.js} +41 -44
- package/dist/{chunk-SNDXCFRS.js → chunk-KXMJLOZF.js} +25 -23
- package/dist/{chunk-CB4WHS4H.js → chunk-L4Y3ROKQ.js} +3 -3
- package/dist/{chunk-3F6BMY53.js → chunk-L6WBJGQS.js} +1 -1
- package/dist/{chunk-MPKRJBPK.js → chunk-L7O774U7.js} +30 -32
- package/dist/{chunk-URCQWAQ4.js → chunk-LAHHGNAY.js} +21 -21
- package/dist/{chunk-V63BC55Q.js → chunk-LT62P654.js} +1 -1
- package/dist/{chunk-ZMAUPOMG.js → chunk-LWOM6LVS.js} +34 -34
- package/dist/{chunk-HO6LWE2E.js → chunk-MKPDIAZH.js} +21 -1
- package/dist/{chunk-2PHMIAKO.js → chunk-MN635QYA.js} +3 -4
- package/dist/{chunk-KDX35VXP.js → chunk-MQ4PPCJB.js} +166 -149
- package/dist/{chunk-QOE342SU.js → chunk-MRLH4MYU.js} +2 -2
- package/dist/{chunk-CE6VMBCB.js → chunk-N56BNAA6.js} +20 -21
- package/dist/{chunk-L3CMBQMH.js → chunk-N5CEGQPG.js} +14 -17
- package/dist/{chunk-7E2563GA.js → chunk-NCLO6E6N.js} +13 -33
- package/dist/{chunk-J6JP25XU.js → chunk-NL5LSKVD.js} +4 -3
- package/dist/{chunk-U7BD2QL7.js → chunk-NMUSOZ2D.js} +10 -12
- package/dist/{chunk-BZARLRJW.js → chunk-NOWH2VA2.js} +8 -33
- package/dist/{chunk-U2SDMG7C.js → chunk-NUSXS6YB.js} +6 -5
- package/dist/{chunk-ZJTT47IG.js → chunk-OSEKJEUU.js} +2 -2
- package/dist/{chunk-FZKFVUEC.js → chunk-OUYAUXAT.js} +647 -355
- package/dist/{chunk-ZE3KXHS7.js → chunk-PBZNYHMM.js} +84 -4
- package/dist/{chunk-U5HPROLA.js → chunk-PIIUNJIT.js} +2 -4
- package/dist/chunk-PKLB2XJL.js +8 -0
- package/dist/{chunk-RC2Z6K47.js → chunk-PRHYIA6X.js} +15 -6
- package/dist/{chunk-RQS4QQSD.js → chunk-PXQ45SGD.js} +2 -2
- package/dist/chunk-Q6JQKWPK.js +25 -0
- package/dist/{chunk-F6X3YJWD.js → chunk-QB7T2PHK.js} +2 -2
- package/dist/{chunk-TIQJPRDD.js → chunk-QGITU23N.js} +3 -2
- package/dist/chunk-QJJKOHLH.js +57 -0
- package/dist/{chunk-4LOE5R5P.js → chunk-QP33NKYC.js} +18 -15
- package/dist/{chunk-N5WSK2K7.js → chunk-QVBOXT3L.js} +12 -17
- package/dist/{chunk-DPGEAHZT.js → chunk-RNJFRXEN.js} +10 -18
- package/dist/{chunk-EKWX4WD3.js → chunk-RNXOWDM6.js} +10 -10
- package/dist/{chunk-O4BJFESU.js → chunk-RTFMDIKV.js} +1 -1
- package/dist/{chunk-LS3QJRUB.js → chunk-SIQHOB6P.js} +11 -13
- package/dist/{chunk-3K2F6UDZ.js → chunk-SLSMJPEF.js} +43 -42
- package/dist/chunk-T5QSLSMM.js +50 -0
- package/dist/chunk-TGQDAG4B.js +88 -0
- package/dist/{chunk-4YHYPW2G.js → chunk-THYHUIDR.js} +44 -13
- package/dist/{chunk-YVHBNSME.js → chunk-TMNUTMT5.js} +1099 -1100
- package/dist/{chunk-WDBICWH3.js → chunk-TOE2RRCS.js} +1 -1
- package/dist/chunk-TYHPVE5H.js +25 -0
- package/dist/chunk-UAKO2M6B.js +73 -0
- package/dist/chunk-UC5AXW5Z.js +20 -0
- package/dist/chunk-UTJP6WOS.js +28 -0
- package/dist/{chunk-DQZFQSR5.js → chunk-UXTQ3QPD.js} +4 -4
- package/dist/chunk-UYXV5NIS.js +20 -0
- package/dist/{chunk-KKCK636N.js → chunk-V2WDBOLZ.js} +10 -12
- package/dist/{chunk-PR6PO3ES.js → chunk-V67D6TMU.js} +22 -20
- package/dist/{chunk-VSFLRN5Y.js → chunk-VCRVNLE7.js} +135 -2
- package/dist/{chunk-CPSR3AVL.js → chunk-VO4JFPTV.js} +2 -2
- package/dist/{chunk-XT2HTCJ5.js → chunk-VWLSU3XV.js} +6 -5
- package/dist/{chunk-WME2OQST.js → chunk-W5E72HJA.js} +66 -24
- package/dist/{chunk-LLS45EWB.js → chunk-W7TY6HYX.js} +6 -8
- package/dist/{chunk-CCV2EU7T.js → chunk-WSSLVMDA.js} +12 -13
- package/dist/{chunk-YISME6ON.js → chunk-WTB4GKMH.js} +10 -1
- package/dist/{chunk-KPPJTH44.js → chunk-X5BJ3G2P.js} +64 -35
- package/dist/{chunk-JMEKXFOL.js → chunk-XKFO2SZV.js} +39 -34
- package/dist/{chunk-HR3OJ3TH.js → chunk-XLAI7UYY.js} +84 -31
- package/dist/{chunk-H7OR7DFZ.js → chunk-XO756WE5.js} +53 -37
- package/dist/{chunk-F5Z6URKM.js → chunk-XVB3Q2PG.js} +2 -4
- package/dist/{chunk-R5MOQM2H.js → chunk-YOXCCJDF.js} +607 -366
- package/dist/{chunk-ZGSJDWQU.js → chunk-ZCQBNPRH.js} +2 -2
- package/dist/chunk-ZD4KVFXI.js +234 -0
- package/dist/{chunk-WGRJOXED.js → chunk-ZDMFGACN.js} +1295 -966
- package/dist/{chunk-OSTKYB55.js → chunk-ZMMHHXSW.js} +1 -1
- package/dist/{chunk-75GAYVNO.js → chunk-ZPM7ZIFL.js} +6 -6
- package/dist/{chunk-LUBPZN36.js → chunk-ZVCDHYWZ.js} +9 -11
- package/dist/{chunk-Y7F7IEE3.js → chunk-ZZN74OGD.js} +102 -7
- package/dist/{chunk-L5JYIU47.js → chunk-ZZSJAR76.js} +39 -20
- package/dist/index.js +10933 -8644
- package/dist/mcp/analyze-cli.js +12 -17
- package/dist/mcp/cli.js +43 -42
- package/dist/mcp/server.js +3073 -1147
- package/dist/mcp/worker.js +61 -61
- package/dist/probes/installer.js +18 -19
- package/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/docs/agent-tools.md +58 -16
- package/docs/alignment-families.md +29 -0
- package/docs/analysisall.md +1 -1
- package/docs/ast-grep_rules_catalog.md +6 -4
- package/docs/ci-bot-pr-checks.md +128 -0
- package/docs/configuration.md +150 -12
- package/docs/defect-shapes.md +107 -15
- package/docs/engineering-principles.md +27 -2
- package/docs/environment-variables.md +18 -1
- package/docs/features.md +14 -7
- package/docs/globalconfig.md +11 -3
- package/docs/invariants/git-guard-host.md +7 -3
- package/docs/invariants/language-config.md +15 -4
- package/docs/invariants/lsp-trust-exec.md +25 -4
- package/docs/invariants/paths-os.md +4 -2
- package/docs/invariants/session-telemetry.md +2 -2
- package/docs/language-coverage.md +1 -0
- package/docs/lsp-capability-matrix.md +167 -65
- package/docs/lsp-idle-eviction.md +4 -1
- package/docs/merge-queue-rollout.md +10 -8
- package/docs/module-report-read-symbol.md +34 -23
- package/docs/pi-lens-fixer.md +34 -17
- package/docs/pi-lens-investigator.md +3 -0
- package/docs/pi-lens-merge-policy.md +34 -17
- package/docs/pi-lens-monitor.md +9 -0
- package/docs/pi-lens-orchestration.md +4 -1
- package/docs/pi-lens-reviewer.md +6 -6
- package/docs/pi-lens-subagent.md +19 -3
- package/docs/public-api-stability.md +57 -7
- package/docs/release-qa-baseline.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +21 -2
- package/docs/servercapabilities.md +3 -1
- package/docs/settings.md +11 -7
- package/docs/word-index.md +20 -7
- package/package.json +11 -4
- 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/no-sql-in-code-execute-js.yml +1 -2
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- 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/scripts/download-grammars.js +3 -2
- package/skills/pi-lens-lsp-navigation/SKILL.md +5 -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-GNSIWBAT.js +0 -106
- package/dist/chunk-HWDAVBFU.js +0 -49
- package/dist/chunk-JJ2RRESP.js +0 -58
- package/dist/chunk-KXF5R4UN.js +0 -48
- package/dist/chunk-LSC3VADM.js +0 -23
- package/dist/chunk-OE5ZBP7F.js +0 -443
- 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
- package/dist/chunk-Z2XAOKHK.js +0 -136
|
@@ -2,39 +2,44 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
getLazyInstallAttempt,
|
|
4
4
|
tryLazyInstall
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F6BEQWAK.js";
|
|
6
6
|
import {
|
|
7
|
+
computeImpactCascade
|
|
8
|
+
} from "./chunk-HYSKJMZK.js";
|
|
9
|
+
import {
|
|
10
|
+
goClient
|
|
11
|
+
} from "./chunk-2VZ3VN3N.js";
|
|
12
|
+
import {
|
|
13
|
+
isTrivyEnabled,
|
|
14
|
+
resolveSeverityFloor
|
|
15
|
+
} from "./chunk-H3BVMK47.js";
|
|
16
|
+
import {
|
|
17
|
+
IN_FLIGHT_REASON,
|
|
18
|
+
NO_ANALYZER_REASON,
|
|
19
|
+
checkedVerdict,
|
|
20
|
+
emptyDispatchResult,
|
|
7
21
|
faultIfCutShort,
|
|
8
22
|
faultResult,
|
|
9
23
|
faultSkip,
|
|
10
24
|
findingsResult,
|
|
11
25
|
finishParsedRun,
|
|
12
26
|
formatToolFailure,
|
|
13
|
-
|
|
27
|
+
isNotApplicableSkipReason,
|
|
14
28
|
isRunnerClaimSource,
|
|
15
29
|
isRunnerSkipReason,
|
|
30
|
+
noPrimaryCheckerReason,
|
|
16
31
|
parseToolRun,
|
|
32
|
+
processCutShort,
|
|
17
33
|
reachedNoVerdict,
|
|
18
34
|
skipUnlessToolRan,
|
|
19
|
-
spanOverlapsModifiedRanges
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "./chunk-JJ2RRESP.js";
|
|
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";
|
|
35
|
+
spanOverlapsModifiedRanges,
|
|
36
|
+
spawnFailedWithNoOutput,
|
|
37
|
+
unchecked,
|
|
38
|
+
widgetUncheckedReason
|
|
39
|
+
} from "./chunk-ZZN74OGD.js";
|
|
35
40
|
import {
|
|
36
41
|
rustClient
|
|
37
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-PXQ45SGD.js";
|
|
38
43
|
import {
|
|
39
44
|
coveringLaneAvailable,
|
|
40
45
|
createAvailabilityChecker,
|
|
@@ -50,7 +55,7 @@ import {
|
|
|
50
55
|
resolveToolCommand,
|
|
51
56
|
resolveToolCommandWithInstallFallback,
|
|
52
57
|
resolveVendorToolCommand
|
|
53
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-NCLO6E6N.js";
|
|
54
59
|
import {
|
|
55
60
|
biomeConfigArgs,
|
|
56
61
|
findCompiledClassesDir,
|
|
@@ -69,21 +74,21 @@ import {
|
|
|
69
74
|
hasYamllintConfig,
|
|
70
75
|
markdownlintConfigArgs,
|
|
71
76
|
ruffConfigArgs
|
|
72
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-7R5GZIA6.js";
|
|
73
78
|
import {
|
|
74
79
|
importFactProvider
|
|
75
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-UXTQ3QPD.js";
|
|
76
81
|
import {
|
|
77
82
|
functionFactProvider
|
|
78
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-CM6BDY4E.js";
|
|
79
84
|
import {
|
|
80
85
|
extractFactsFromTree
|
|
81
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-TOE2RRCS.js";
|
|
82
87
|
import {
|
|
83
88
|
buildOrUpdateGraph,
|
|
84
89
|
clearReviewGraphWorkspaceCache,
|
|
85
90
|
fileContentProvider
|
|
86
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-XO756WE5.js";
|
|
87
92
|
import {
|
|
88
93
|
MAX_BLOCKING_RULE_COMPLEXITY,
|
|
89
94
|
PRIMARY_UNAVAILABLE_CAUSE,
|
|
@@ -109,18 +114,21 @@ import {
|
|
|
109
114
|
isStructuredRule,
|
|
110
115
|
lineContentHash,
|
|
111
116
|
primaryUnavailableCause,
|
|
117
|
+
readBoundToCurrentDisk,
|
|
112
118
|
recordDiagnostics,
|
|
113
119
|
recordNapiFallbackCoverage,
|
|
114
120
|
recordRunner,
|
|
115
121
|
retagAuxiliaryDiagnostics,
|
|
122
|
+
touchCompletedConfirmationPolicy,
|
|
116
123
|
touchCoverageGap,
|
|
117
124
|
tryWarmAttachedCodeActions,
|
|
118
|
-
tryWarmAttachedDiagnostics
|
|
119
|
-
|
|
125
|
+
tryWarmAttachedDiagnostics,
|
|
126
|
+
warmAnswerBinding
|
|
127
|
+
} from "./chunk-OUYAUXAT.js";
|
|
120
128
|
import {
|
|
121
129
|
ANY_POSITION,
|
|
122
130
|
retainRecordedFindings
|
|
123
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-VWLSU3XV.js";
|
|
124
132
|
import {
|
|
125
133
|
mapWithConcurrency
|
|
126
134
|
} from "./chunk-XIMYZ3JA.js";
|
|
@@ -129,9 +137,14 @@ import {
|
|
|
129
137
|
canWriteAnalysisRoot,
|
|
130
138
|
disabledPrimaries,
|
|
131
139
|
getAstGrepRuleSources,
|
|
140
|
+
isKnownRunnerId,
|
|
141
|
+
isShellcheckDialectSupported,
|
|
132
142
|
registerRunnerId,
|
|
133
|
-
resolveAnalysisRoot
|
|
134
|
-
|
|
143
|
+
resolveAnalysisRoot,
|
|
144
|
+
resolveSessionConfigRoot,
|
|
145
|
+
resolveShellFileDialect,
|
|
146
|
+
runnerIdentityPopulated
|
|
147
|
+
} from "./chunk-YOXCCJDF.js";
|
|
135
148
|
import {
|
|
136
149
|
augmentPythonEnvironment,
|
|
137
150
|
describePythonCompileWithheld,
|
|
@@ -140,22 +153,25 @@ import {
|
|
|
140
153
|
emitBounded,
|
|
141
154
|
partitionOutrankedPythonCompileVerdicts,
|
|
142
155
|
recordPythonCompileVerdictDrop
|
|
143
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-V67D6TMU.js";
|
|
157
|
+
import {
|
|
158
|
+
scannerReportParentDir
|
|
159
|
+
} from "./chunk-LT62P654.js";
|
|
144
160
|
import {
|
|
145
161
|
loadProjectSnapshot,
|
|
146
162
|
readJsonCache,
|
|
147
163
|
readJsonCacheAsync
|
|
148
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-PRHYIA6X.js";
|
|
149
165
|
import {
|
|
150
166
|
RUNTIME_CONFIG,
|
|
151
167
|
exceedsLspSyncLimits,
|
|
152
168
|
getRunnerTimeoutFloorMs,
|
|
153
169
|
loadAstGrepNapi
|
|
154
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-L7O774U7.js";
|
|
155
171
|
import {
|
|
156
172
|
buildModuleGraph,
|
|
157
173
|
clearModuleGraphCache
|
|
158
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-7UTSNTWM.js";
|
|
159
175
|
import {
|
|
160
176
|
BUNDLED_QUERIES_ROOT,
|
|
161
177
|
classifyTreeSitterWasmError,
|
|
@@ -175,7 +191,10 @@ import {
|
|
|
175
191
|
ruleFilesForLanguage,
|
|
176
192
|
ruleSourceLanguages,
|
|
177
193
|
walk
|
|
178
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-ZZSJAR76.js";
|
|
195
|
+
import {
|
|
196
|
+
resolvePackagePath
|
|
197
|
+
} from "./chunk-QGITU23N.js";
|
|
179
198
|
import {
|
|
180
199
|
stripAnsi
|
|
181
200
|
} from "./chunk-6HWVI6MI.js";
|
|
@@ -187,32 +206,36 @@ import {
|
|
|
187
206
|
scheduleWordIndexPersist,
|
|
188
207
|
setWordIndexPublishedListener,
|
|
189
208
|
updateWordIndexDocumentForEdit
|
|
190
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-KXMJLOZF.js";
|
|
191
210
|
import {
|
|
192
211
|
WARM_CODE_ACTION_LOOKUP_LIMIT,
|
|
193
212
|
contentHash
|
|
194
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-HSOBIN22.js";
|
|
195
214
|
import {
|
|
196
215
|
resolveRunnerPath,
|
|
197
216
|
toRunnerDisplayPath
|
|
198
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-W7TY6HYX.js";
|
|
218
|
+
import {
|
|
219
|
+
withBudget
|
|
220
|
+
} from "./chunk-MKPDIAZH.js";
|
|
199
221
|
import {
|
|
222
|
+
findCommandOnPath,
|
|
200
223
|
isSpawnableCommand
|
|
201
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-MQ4PPCJB.js";
|
|
202
225
|
import {
|
|
203
226
|
logRunnerAdvisoryOnce,
|
|
204
227
|
resolveRunnerCwd,
|
|
205
228
|
resolveRunnerCwdWithReason
|
|
206
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-RNJFRXEN.js";
|
|
207
230
|
import {
|
|
208
231
|
findLocalBinUpwards,
|
|
209
232
|
localBinPath
|
|
210
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-E65WJVI5.js";
|
|
211
234
|
import {
|
|
212
235
|
createAvailabilityProbeFlight,
|
|
213
236
|
getIsolatedNpxSpawnOptions,
|
|
214
237
|
probeToolAsync
|
|
215
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-L6WBJGQS.js";
|
|
216
239
|
import {
|
|
217
240
|
classifyProbeFailure,
|
|
218
241
|
createAvailabilityLatch,
|
|
@@ -222,69 +245,73 @@ import {
|
|
|
222
245
|
logAvailabilityDecision,
|
|
223
246
|
startHostStallSampler,
|
|
224
247
|
transientRetryDelayMs
|
|
225
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-AACN5GNE.js";
|
|
226
249
|
import {
|
|
227
250
|
getLspCapableKinds,
|
|
228
251
|
getPrimaryDispatchGroup,
|
|
229
252
|
resolveLanguageRootForFile
|
|
230
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-3HTZDY3C.js";
|
|
231
254
|
import {
|
|
232
255
|
getGlobalPiLensDir,
|
|
233
256
|
getProjectDataDir,
|
|
257
|
+
isIgnoredByGitignoreLines,
|
|
234
258
|
isInSpawnTimeoutCooldown,
|
|
235
259
|
isTestFile,
|
|
236
260
|
loadPiLensGlobalConfig,
|
|
237
261
|
noteSpawnTimeout,
|
|
262
|
+
realIsPidAlive,
|
|
238
263
|
resolvePiLensFlag,
|
|
239
264
|
safeSpawnAsync
|
|
240
|
-
} from "./chunk-
|
|
265
|
+
} from "./chunk-TMNUTMT5.js";
|
|
241
266
|
import {
|
|
242
267
|
DOTNET_CSHARP_PROJECT_MARKERS,
|
|
243
268
|
DOTNET_CSHARP_SOLUTION_MARKERS,
|
|
244
|
-
detectFileKind
|
|
245
|
-
|
|
269
|
+
detectFileKind,
|
|
270
|
+
isJstsFactFile
|
|
271
|
+
} from "./chunk-CZCAZVTD.js";
|
|
246
272
|
import {
|
|
247
273
|
PathKeyedMap,
|
|
274
|
+
boundedKeyLabel,
|
|
248
275
|
classifyGeneratedOrArtifactDetailed,
|
|
249
276
|
detectFileRole,
|
|
277
|
+
finalizeRecords,
|
|
250
278
|
loadPiLensProjectConfig,
|
|
279
|
+
migrationSubject,
|
|
280
|
+
reportPiLensConfigRecords,
|
|
281
|
+
resolveOnePiLensConfigDocument,
|
|
251
282
|
resolvePiLensConfig
|
|
252
|
-
} from "./chunk-
|
|
283
|
+
} from "./chunk-X5BJ3G2P.js";
|
|
253
284
|
import {
|
|
254
285
|
findNearestDirWithAnyBasename,
|
|
255
286
|
findNearestDirWithMarker,
|
|
256
287
|
getPiLensGlobalConfigPath
|
|
257
|
-
} from "./chunk-
|
|
288
|
+
} from "./chunk-NL5LSKVD.js";
|
|
258
289
|
import {
|
|
259
290
|
getProjectTrustState,
|
|
260
291
|
killedForOutputCap,
|
|
261
292
|
projectTrustDenialReason,
|
|
262
293
|
truncatedByOutputCap,
|
|
263
294
|
writeFileAtomic
|
|
264
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-PIIUNJIT.js";
|
|
265
296
|
import {
|
|
297
|
+
createSubsystemLogger,
|
|
266
298
|
incrementDegradationCount,
|
|
299
|
+
logExtension,
|
|
267
300
|
recordDegradationOnce
|
|
268
|
-
} from "./chunk-
|
|
269
|
-
import {
|
|
270
|
-
createSubsystemLogger,
|
|
271
|
-
logExtension
|
|
272
|
-
} from "./chunk-KXF5R4UN.js";
|
|
273
|
-
import {
|
|
274
|
-
logLatency,
|
|
275
|
-
phaseFinished,
|
|
276
|
-
phaseStarted
|
|
277
|
-
} from "./chunk-Z2XAOKHK.js";
|
|
301
|
+
} from "./chunk-W5E72HJA.js";
|
|
278
302
|
import {
|
|
279
303
|
createNdjsonLogger,
|
|
280
304
|
getGlobalPiLensLogDir,
|
|
281
305
|
getMaxLogSizeMB,
|
|
282
|
-
isTestMode
|
|
283
|
-
|
|
306
|
+
isTestMode,
|
|
307
|
+
logLatency,
|
|
308
|
+
phaseFinished,
|
|
309
|
+
phaseStarted
|
|
310
|
+
} from "./chunk-VCRVNLE7.js";
|
|
284
311
|
import {
|
|
285
312
|
FactStore,
|
|
286
313
|
setFactStoreEvictionReporter
|
|
287
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-ZMMHHXSW.js";
|
|
288
315
|
import {
|
|
289
316
|
BoundedFifoMap,
|
|
290
317
|
BoundedLruCache,
|
|
@@ -294,15 +321,20 @@ import {
|
|
|
294
321
|
isAbsoluteFilePath,
|
|
295
322
|
isUnderDir,
|
|
296
323
|
isWindowsPath,
|
|
324
|
+
isWithinIdentity,
|
|
297
325
|
normalizeEphemeralMapKey,
|
|
298
326
|
normalizeLoggedPath,
|
|
299
327
|
normalizeMapKey,
|
|
300
|
-
pathsEqual
|
|
301
|
-
|
|
328
|
+
pathsEqual,
|
|
329
|
+
realpathOrResolve,
|
|
330
|
+
relativeInside,
|
|
331
|
+
toPosix,
|
|
332
|
+
toProjectRelativePath
|
|
333
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
302
334
|
|
|
303
335
|
// dist/clients/mcp/analyze.js
|
|
304
336
|
import * as fs18 from "node:fs";
|
|
305
|
-
import * as
|
|
337
|
+
import * as path50 from "node:path";
|
|
306
338
|
|
|
307
339
|
// dist/clients/cache-manager.js
|
|
308
340
|
import * as fs from "node:fs";
|
|
@@ -340,12 +372,7 @@ var CacheManager = class {
|
|
|
340
372
|
toTurnStateKey(filePath, cwd) {
|
|
341
373
|
const cwdNorm = normalizeMapKey(path.resolve(cwd));
|
|
342
374
|
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;
|
|
375
|
+
return relativeInside(cwdNorm, fileNorm) || fileNorm;
|
|
349
376
|
}
|
|
350
377
|
/**
|
|
351
378
|
* Get turn-state entry for a file path using normalized lookup.
|
|
@@ -737,12 +764,7 @@ var CacheManager = class {
|
|
|
737
764
|
}
|
|
738
765
|
isTurnStateOwnerStale(owner) {
|
|
739
766
|
if (owner.pid > 0 && owner.pid !== process.pid) {
|
|
740
|
-
|
|
741
|
-
process.kill(owner.pid, 0);
|
|
742
|
-
return false;
|
|
743
|
-
} catch {
|
|
744
|
-
return true;
|
|
745
|
-
}
|
|
767
|
+
return !realIsPidAlive(owner.pid);
|
|
746
768
|
}
|
|
747
769
|
const lastSeen = Date.parse(owner.lastSeen);
|
|
748
770
|
return !Number.isFinite(lastSeen) || Date.now() - lastSeen > TURN_OWNER_STALE_MS;
|
|
@@ -952,7 +974,7 @@ function createDiagnosticLogger() {
|
|
|
952
974
|
}
|
|
953
975
|
|
|
954
976
|
// dist/clients/dispatch/dispatcher.js
|
|
955
|
-
import * as
|
|
977
|
+
import * as fs4 from "node:fs";
|
|
956
978
|
import * as path4 from "node:path";
|
|
957
979
|
|
|
958
980
|
// dist/clients/line-alignment.js
|
|
@@ -1118,204 +1140,699 @@ function applyInlineSuppressions(diagnostics, content) {
|
|
|
1118
1140
|
});
|
|
1119
1141
|
}
|
|
1120
1142
|
|
|
1121
|
-
// dist/clients/dispatch/
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1143
|
+
// dist/clients/dispatch/runners/utils.js
|
|
1144
|
+
import * as fs3 from "node:fs";
|
|
1145
|
+
function readFileContent(filePath) {
|
|
1146
|
+
try {
|
|
1147
|
+
return fs3.readFileSync(filePath, "utf-8");
|
|
1148
|
+
} catch {
|
|
1149
|
+
return void 0;
|
|
1126
1150
|
}
|
|
1127
|
-
return group;
|
|
1128
1151
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1152
|
+
|
|
1153
|
+
// dist/clients/dispatch/rule-policy.js
|
|
1154
|
+
import * as nodePath from "node:path";
|
|
1155
|
+
function resolveDispatchPolicyConfig(root) {
|
|
1156
|
+
return resolvePiLensConfig({
|
|
1157
|
+
cwd: root,
|
|
1158
|
+
globalDir: getGlobalPiLensDir(),
|
|
1159
|
+
globalConfigPath: getPiLensGlobalConfigPath()
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
function configOwnerFor(filePath, root) {
|
|
1163
|
+
return resolveSessionConfigRoot(nodePath.resolve(root, filePath), root).register ?? root;
|
|
1164
|
+
}
|
|
1165
|
+
function resolveDispatchPolicyConfigForFile(filePath, root) {
|
|
1166
|
+
return resolveDispatchPolicyConfig(configOwnerFor(filePath, root));
|
|
1167
|
+
}
|
|
1168
|
+
function rulePolicyMapFromResolution(resolution, root) {
|
|
1169
|
+
const rules2 = resolution.value.rules;
|
|
1170
|
+
const map = rulePolicyMapFromConfig(rules2);
|
|
1171
|
+
if (!map || !Object.values(map).some((entry) => entry?.ignorePaths)) {
|
|
1172
|
+
return map;
|
|
1173
|
+
}
|
|
1174
|
+
const anchored = anchoredIgnorePaths(resolution.documents, root);
|
|
1175
|
+
for (const [key2, entry] of Object.entries(map)) {
|
|
1176
|
+
if (!entry?.ignorePaths)
|
|
1177
|
+
continue;
|
|
1178
|
+
const paths = anchored.get(key2);
|
|
1179
|
+
if (paths && paths.length > 0)
|
|
1180
|
+
entry.ignorePaths = paths;
|
|
1181
|
+
}
|
|
1182
|
+
return map;
|
|
1183
|
+
}
|
|
1184
|
+
function anchoredIgnorePaths(documents, root) {
|
|
1185
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1186
|
+
for (const document of documents) {
|
|
1187
|
+
if (document.location.lspScoped)
|
|
1188
|
+
continue;
|
|
1189
|
+
const rules2 = resolveOnePiLensConfigDocument(document).value.rules;
|
|
1190
|
+
if (!rules2 || typeof rules2 !== "object" || Array.isArray(rules2))
|
|
1191
|
+
continue;
|
|
1192
|
+
const prefix = document.tier === "global" ? void 0 : anchorPrefix(document, root);
|
|
1193
|
+
const baseDir = prefix ? nodePath.resolve(root, prefix) : root;
|
|
1194
|
+
for (const [key2, rawEntry] of Object.entries(rules2)) {
|
|
1195
|
+
const ignorePaths = rawEntry?.ignorePaths;
|
|
1196
|
+
if (!Array.isArray(ignorePaths))
|
|
1197
|
+
continue;
|
|
1198
|
+
const patterns = [];
|
|
1199
|
+
for (const pattern of ignorePaths) {
|
|
1200
|
+
if (typeof pattern === "string")
|
|
1201
|
+
patterns.push(pattern);
|
|
1142
1202
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
{
|
|
1295
|
-
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1203
|
+
const scopes = byKey.get(key2) ?? [];
|
|
1204
|
+
scopes.push({ baseDir, patterns });
|
|
1205
|
+
byKey.set(key2, scopes);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
return byKey;
|
|
1209
|
+
}
|
|
1210
|
+
function anchorPrefix(document, root) {
|
|
1211
|
+
const pathApi = isWindowsPath(root) || isWindowsPath(document.file) ? nodePath.win32 : nodePath.posix;
|
|
1212
|
+
let dir = document.file;
|
|
1213
|
+
for (const _segment of document.location.relativePath.split("/")) {
|
|
1214
|
+
dir = pathApi.dirname(dir);
|
|
1215
|
+
}
|
|
1216
|
+
if (pathsEqual(dir, root) || !isUnderDir(dir, root))
|
|
1217
|
+
return void 0;
|
|
1218
|
+
return toProjectRelativePath(dir, root);
|
|
1219
|
+
}
|
|
1220
|
+
function projectRulePolicy(root, known) {
|
|
1221
|
+
const ownerByDir = /* @__PURE__ */ new Map();
|
|
1222
|
+
const mapByOwner = /* @__PURE__ */ new Map();
|
|
1223
|
+
const ownerOf = (filePath) => {
|
|
1224
|
+
const dir = nodePath.dirname(nodePath.resolve(root, filePath));
|
|
1225
|
+
let owner = ownerByDir.get(dir);
|
|
1226
|
+
if (owner === void 0) {
|
|
1227
|
+
owner = configOwnerFor(filePath, root);
|
|
1228
|
+
ownerByDir.set(dir, owner);
|
|
1229
|
+
}
|
|
1230
|
+
return owner;
|
|
1231
|
+
};
|
|
1232
|
+
let unseeded = known;
|
|
1233
|
+
return {
|
|
1234
|
+
root,
|
|
1235
|
+
forFile(filePath) {
|
|
1236
|
+
if (unseeded) {
|
|
1237
|
+
mapByOwner.set(ownerOf(unseeded.filePath), unseeded.map);
|
|
1238
|
+
unseeded = void 0;
|
|
1239
|
+
}
|
|
1240
|
+
const owner = ownerOf(filePath);
|
|
1241
|
+
if (!mapByOwner.has(owner)) {
|
|
1242
|
+
mapByOwner.set(owner, rulePolicyMapFromResolution(resolveDispatchPolicyConfig(owner), root));
|
|
1243
|
+
}
|
|
1244
|
+
return mapByOwner.get(owner);
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
function isProjectRulePolicy(policy) {
|
|
1249
|
+
return typeof policy.forFile === "function";
|
|
1250
|
+
}
|
|
1251
|
+
function ruleIgnoredForPath(ruleId, filePath, root, policyMap) {
|
|
1252
|
+
const normalized = normalizeRuleId(ruleId);
|
|
1253
|
+
const scopes = [];
|
|
1254
|
+
for (const [configuredId, entry] of Object.entries(policyMap ?? {})) {
|
|
1255
|
+
if (normalizeRuleId(configuredId) !== normalized || !entry?.ignorePaths)
|
|
1256
|
+
continue;
|
|
1257
|
+
const rootLines = [];
|
|
1258
|
+
for (const item of entry.ignorePaths) {
|
|
1259
|
+
if (typeof item === "string")
|
|
1260
|
+
rootLines.push(item);
|
|
1261
|
+
else
|
|
1262
|
+
scopes.push(item);
|
|
1263
|
+
}
|
|
1264
|
+
if (rootLines.length > 0)
|
|
1265
|
+
scopes.push({ baseDir: root, patterns: rootLines });
|
|
1266
|
+
}
|
|
1267
|
+
const absolute = nodePath.resolve(root, filePath);
|
|
1268
|
+
return scopes.some((scope) => isIgnoredByGitignoreLines(scope.patterns, scope.baseDir, absolute));
|
|
1269
|
+
}
|
|
1270
|
+
function evaluateRulePolicy(ruleId, policyMap) {
|
|
1271
|
+
if (!policyMap)
|
|
1272
|
+
return { dropped: false };
|
|
1273
|
+
const raw = ruleId || "";
|
|
1274
|
+
const norm = normalizeRuleId(raw);
|
|
1275
|
+
if (scanList(policyMap, (e) => e.disable, raw, norm).matched) {
|
|
1276
|
+
return { dropped: true };
|
|
1277
|
+
}
|
|
1278
|
+
const select = scanList(policyMap, (e) => e.select, raw, norm);
|
|
1279
|
+
return { dropped: select.sawEntry && !select.matched };
|
|
1280
|
+
}
|
|
1281
|
+
function scanList(policyMap, pick, raw, norm) {
|
|
1282
|
+
let sawEntry = false;
|
|
1283
|
+
for (const entry of Object.values(policyMap)) {
|
|
1284
|
+
for (const candidate of (entry && pick(entry)) ?? []) {
|
|
1285
|
+
sawEntry = true;
|
|
1286
|
+
if (matchesRule(candidate, raw, norm))
|
|
1287
|
+
return { matched: true, sawEntry };
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
return { matched: false, sawEntry };
|
|
1291
|
+
}
|
|
1292
|
+
function matchesRule(entry, raw, normalized) {
|
|
1293
|
+
if (entry === raw)
|
|
1294
|
+
return true;
|
|
1295
|
+
return normalizeRuleId(entry) === normalized;
|
|
1296
|
+
}
|
|
1297
|
+
function applyRulePolicy(diagnostics, policy, options) {
|
|
1298
|
+
if (!policy)
|
|
1299
|
+
return diagnostics;
|
|
1300
|
+
const project = isProjectRulePolicy(policy) ? policy : void 0;
|
|
1301
|
+
if (!project && !hasOutputFilter(policy))
|
|
1302
|
+
return diagnostics;
|
|
1303
|
+
const anchored = project ? { ...options, root: project.root } : options;
|
|
1304
|
+
return diagnostics.filter((d) => {
|
|
1305
|
+
const map = project ? project.forFile(d.filePath ?? options.filePath) : policy;
|
|
1306
|
+
return !map || !hasOutputFilter(map) || keptByRulePolicy(d, map, anchored);
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
function hasOutputFilter(policyMap) {
|
|
1310
|
+
for (const rawEntry of Object.values(policyMap)) {
|
|
1311
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1312
|
+
continue;
|
|
1313
|
+
}
|
|
1314
|
+
const entry = rawEntry;
|
|
1315
|
+
if ((entry.disable?.length ?? 0) > 0 || (entry.select?.length ?? 0) > 0 || (entry.ignorePaths?.length ?? 0) > 0) {
|
|
1316
|
+
return true;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return false;
|
|
1320
|
+
}
|
|
1321
|
+
function keptByRulePolicy(d, policyMap, options) {
|
|
1322
|
+
const ruleId = d.rule ?? d.code;
|
|
1323
|
+
if (!ruleId)
|
|
1324
|
+
return true;
|
|
1325
|
+
const filePath = d.filePath ?? options.filePath;
|
|
1326
|
+
if (filePath && ruleIgnoredForPath(ruleId, filePath, options.root, policyMap))
|
|
1327
|
+
return false;
|
|
1328
|
+
const { dropped } = evaluateRulePolicy(ruleId, policyMap);
|
|
1329
|
+
return !dropped;
|
|
1330
|
+
}
|
|
1331
|
+
function rulePolicyMapFromConfig(rules2) {
|
|
1332
|
+
if (!rules2)
|
|
1333
|
+
return void 0;
|
|
1334
|
+
const members = (list) => Array.isArray(list) ? list.flatMap((member) => {
|
|
1335
|
+
const trimmed = typeof member === "string" ? member.trim() : "";
|
|
1336
|
+
return trimmed.length > 0 ? [trimmed] : [];
|
|
1337
|
+
}) : [];
|
|
1338
|
+
let built;
|
|
1339
|
+
for (const [key2, rawEntry] of Object.entries(rules2)) {
|
|
1340
|
+
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
const entry = rawEntry;
|
|
1344
|
+
const disable = members(entry.disable);
|
|
1345
|
+
const select = members(entry.select);
|
|
1346
|
+
const hasIgnorePaths = (entry.ignorePaths?.length ?? 0) > 0;
|
|
1347
|
+
if (disable.length === 0 && select.length === 0 && !hasIgnorePaths) {
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
built ??= {};
|
|
1351
|
+
built[key2] = {
|
|
1352
|
+
...disable.length > 0 ? { disable } : {},
|
|
1353
|
+
...select.length > 0 ? { select } : {},
|
|
1354
|
+
...hasIgnorePaths ? { ignorePaths: entry.ignorePaths } : {}
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
return built;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// dist/clients/dispatch/utils/lsp-diagnostics.js
|
|
1361
|
+
function convertLspDiagnostics(diags, filePath, options = {}) {
|
|
1362
|
+
const tool = options.tool ?? "lsp";
|
|
1363
|
+
return diags.filter((d) => d.range?.start?.line !== void 0).map((d, idx) => {
|
|
1364
|
+
const severityMap = {
|
|
1365
|
+
1: "error",
|
|
1366
|
+
2: "warning",
|
|
1367
|
+
4: "hint"
|
|
1368
|
+
};
|
|
1369
|
+
const severity = severityMap[d.severity] ?? "info";
|
|
1370
|
+
const semantic = d.severity === 1 ? "blocking" : d.severity === 2 ? "warning" : "none";
|
|
1371
|
+
const code = String(d.code ?? "unknown");
|
|
1372
|
+
const source = d.source ?? tool;
|
|
1373
|
+
const hasSuggestion = options.fixSuggestionByIndex?.has(idx) ?? false;
|
|
1374
|
+
return {
|
|
1375
|
+
id: `${tool}:${code}:${d.range.start.line}`,
|
|
1376
|
+
message: d.message,
|
|
1377
|
+
filePath,
|
|
1378
|
+
line: d.range.start.line + 1,
|
|
1379
|
+
column: d.range.start.character + 1,
|
|
1380
|
+
severity,
|
|
1381
|
+
semantic,
|
|
1382
|
+
tool,
|
|
1383
|
+
rule: `${source}:${code}`,
|
|
1384
|
+
fixable: hasSuggestion,
|
|
1385
|
+
autoFixAvailable: false,
|
|
1386
|
+
fixKind: hasSuggestion ? "suggestion" : void 0,
|
|
1387
|
+
fixSuggestion: options.fixSuggestionByIndex?.get(idx),
|
|
1388
|
+
scanOrigin: options.scanOrigin,
|
|
1389
|
+
// #4484 r2: the publishing server, so a run that leaves it
|
|
1390
|
+
// unconfirmed keeps its recorded blockers. Never identity.
|
|
1391
|
+
...d.serverId !== void 0 && { serverId: d.serverId }
|
|
1392
|
+
};
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// dist/clients/dispatch/finding-policy.js
|
|
1397
|
+
function applyFindingPolicy(diagnostics, options) {
|
|
1398
|
+
const inlineKept = applyInlineSuppressions(diagnostics, options.content);
|
|
1399
|
+
const disposed = filterDisposed(inlineKept, options);
|
|
1400
|
+
return {
|
|
1401
|
+
kept: applyRulePolicy(disposed, options.policyMap, {
|
|
1402
|
+
root: options.cwd,
|
|
1403
|
+
filePath: options.filePath
|
|
1404
|
+
}),
|
|
1405
|
+
inlineKept,
|
|
1406
|
+
disposed
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function applyFindingPolicyByOwner(diagnostics, options) {
|
|
1410
|
+
const own = [];
|
|
1411
|
+
const byOwner = /* @__PURE__ */ new Map();
|
|
1412
|
+
for (const d of diagnostics) {
|
|
1413
|
+
const owner = d.filePath;
|
|
1414
|
+
if (!owner || owner === options.filePath) {
|
|
1415
|
+
own.push(d);
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1418
|
+
const group = byOwner.get(owner);
|
|
1419
|
+
if (group)
|
|
1420
|
+
group.push(d);
|
|
1421
|
+
else
|
|
1422
|
+
byOwner.set(owner, [d]);
|
|
1423
|
+
}
|
|
1424
|
+
for (const [owner, group] of byOwner) {
|
|
1425
|
+
if (!pathsEqual(owner, options.filePath))
|
|
1426
|
+
continue;
|
|
1427
|
+
own.push(...group);
|
|
1428
|
+
byOwner.delete(owner);
|
|
1429
|
+
}
|
|
1430
|
+
if (byOwner.size === 0)
|
|
1431
|
+
return applyFindingPolicy(diagnostics, options);
|
|
1432
|
+
const inlineKept = /* @__PURE__ */ new Set();
|
|
1433
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1434
|
+
const kept = /* @__PURE__ */ new Set();
|
|
1435
|
+
const collect = (result) => {
|
|
1436
|
+
for (const d of result.inlineKept)
|
|
1437
|
+
inlineKept.add(d);
|
|
1438
|
+
for (const d of result.disposed)
|
|
1439
|
+
disposed.add(d);
|
|
1440
|
+
for (const d of result.kept)
|
|
1441
|
+
kept.add(d);
|
|
1442
|
+
};
|
|
1443
|
+
collect(applyFindingPolicy(own, options));
|
|
1444
|
+
for (const [owner, group] of byOwner) {
|
|
1445
|
+
const content = isWithinIdentity(owner, options.cwd) ? readFileContent(owner) : void 0;
|
|
1446
|
+
if (content === void 0) {
|
|
1447
|
+
collect({
|
|
1448
|
+
kept: applyRulePolicy(group, options.policyMap, {
|
|
1449
|
+
root: options.cwd,
|
|
1450
|
+
filePath: owner
|
|
1451
|
+
}),
|
|
1452
|
+
inlineKept: group,
|
|
1453
|
+
disposed: group
|
|
1454
|
+
});
|
|
1455
|
+
continue;
|
|
1456
|
+
}
|
|
1457
|
+
collect(applyFindingPolicy(group, { ...options, filePath: owner, content }));
|
|
1458
|
+
}
|
|
1459
|
+
const inOrder = (survivors) => diagnostics.flatMap((d) => survivors.has(d) ? [d] : []);
|
|
1460
|
+
return {
|
|
1461
|
+
kept: inOrder(kept),
|
|
1462
|
+
inlineKept: inOrder(inlineKept),
|
|
1463
|
+
disposed: inOrder(disposed)
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function loadProjectRulePolicy(cwd) {
|
|
1467
|
+
return projectRulePolicy(cwd);
|
|
1468
|
+
}
|
|
1469
|
+
function filterDisposed(diagnostics, options) {
|
|
1470
|
+
const identities = options.identities;
|
|
1471
|
+
if (!identities) {
|
|
1472
|
+
return applyDispositions(diagnostics, options.cwd, options.filePath, options.content);
|
|
1473
|
+
}
|
|
1474
|
+
if (!diagnostics.length || !hasAnyDispositionMarks(options.cwd)) {
|
|
1475
|
+
return diagnostics;
|
|
1476
|
+
}
|
|
1477
|
+
const expanded = diagnostics.flatMap((diagnostic) => identities(diagnostic).map((identity) => ({
|
|
1478
|
+
diagnostic,
|
|
1479
|
+
candidate: {
|
|
1480
|
+
...identity,
|
|
1481
|
+
message: diagnostic.message,
|
|
1482
|
+
...diagnostic.line !== void 0 && { line: diagnostic.line },
|
|
1483
|
+
...diagnostic.semantic !== void 0 && {
|
|
1484
|
+
semantic: diagnostic.semantic
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
})));
|
|
1488
|
+
const survivors = new Set(applyDispositions(expanded.map((entry) => entry.candidate), options.cwd, options.filePath, options.content));
|
|
1489
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1490
|
+
for (const entry of expanded) {
|
|
1491
|
+
if (!survivors.has(entry.candidate))
|
|
1492
|
+
disposed.add(entry.diagnostic);
|
|
1493
|
+
}
|
|
1494
|
+
return disposed.size === 0 ? diagnostics : diagnostics.filter((diagnostic) => !disposed.has(diagnostic));
|
|
1495
|
+
}
|
|
1496
|
+
function probeIdentities(canonical, raw) {
|
|
1497
|
+
const rendered = [
|
|
1498
|
+
[canonical.tool, canonical.rule]
|
|
1499
|
+
];
|
|
1500
|
+
if (raw !== void 0 && (raw.source !== void 0 || raw.code !== void 0)) {
|
|
1501
|
+
rendered.push([
|
|
1502
|
+
raw.source,
|
|
1503
|
+
raw.code === void 0 ? void 0 : String(raw.code)
|
|
1504
|
+
]);
|
|
1505
|
+
}
|
|
1506
|
+
return expandRenderedIdentities(rendered);
|
|
1507
|
+
}
|
|
1508
|
+
function renderedRuleIdentities(diagnostic) {
|
|
1509
|
+
return expandRenderedIdentities([[diagnostic.tool, diagnostic.rule]]);
|
|
1510
|
+
}
|
|
1511
|
+
function inlineBlockerIdentities(diagnostic) {
|
|
1512
|
+
return expandRenderedIdentities([
|
|
1513
|
+
[diagnostic.tool, diagnostic.rule],
|
|
1514
|
+
[void 0, void 0]
|
|
1515
|
+
]);
|
|
1516
|
+
}
|
|
1517
|
+
function applyPushedFindingPolicy(findings, options) {
|
|
1518
|
+
const { kept } = applyFindingPolicyByOwner(findings, {
|
|
1519
|
+
cwd: options.cwd,
|
|
1520
|
+
filePath: options.filePath,
|
|
1521
|
+
content: options.content ?? "",
|
|
1522
|
+
// The file's own config owner decides, so a nested `.pi-lens.json` applies.
|
|
1523
|
+
policyMap: loadProjectRulePolicy(options.cwd),
|
|
1524
|
+
identities: renderedRuleIdentities
|
|
1525
|
+
});
|
|
1526
|
+
return { kept, suppressed: findings.length - kept.length };
|
|
1527
|
+
}
|
|
1528
|
+
function applyPushedFindingPolicyByFile(findings, cwd) {
|
|
1529
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
1530
|
+
for (const finding of findings) {
|
|
1531
|
+
const group = byFile.get(finding.filePath);
|
|
1532
|
+
if (group)
|
|
1533
|
+
group.push(finding);
|
|
1534
|
+
else
|
|
1535
|
+
byFile.set(finding.filePath, [finding]);
|
|
1536
|
+
}
|
|
1537
|
+
const kept = [];
|
|
1538
|
+
let suppressed = 0;
|
|
1539
|
+
for (const [filePath, group] of byFile) {
|
|
1540
|
+
const policy = applyPushedFindingPolicy(group, {
|
|
1541
|
+
cwd,
|
|
1542
|
+
filePath,
|
|
1543
|
+
content: readFileContent(filePath)
|
|
1544
|
+
});
|
|
1545
|
+
kept.push(...policy.kept);
|
|
1546
|
+
suppressed += policy.suppressed;
|
|
1547
|
+
}
|
|
1548
|
+
return { kept, suppressed };
|
|
1549
|
+
}
|
|
1550
|
+
function expandRenderedIdentities(rendered) {
|
|
1551
|
+
const out = [];
|
|
1552
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1553
|
+
for (const [tool, rule] of rendered) {
|
|
1554
|
+
for (const candidateTool of [tool, void 0]) {
|
|
1555
|
+
const key2 = `${candidateTool ?? ""}\0${rule ?? ""}`;
|
|
1556
|
+
if (seen.has(key2))
|
|
1557
|
+
continue;
|
|
1558
|
+
seen.add(key2);
|
|
1559
|
+
out.push({
|
|
1560
|
+
...candidateTool !== void 0 && { tool: candidateTool },
|
|
1561
|
+
...rule !== void 0 && { rule }
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return out;
|
|
1566
|
+
}
|
|
1567
|
+
function applyLspFindingPolicy(diagnostics, options) {
|
|
1568
|
+
if (!diagnostics.length)
|
|
1569
|
+
return { kept: diagnostics, inlineKept: diagnostics };
|
|
1570
|
+
const content = options.content ?? "";
|
|
1571
|
+
const anchored = [];
|
|
1572
|
+
for (const diagnostic of diagnostics) {
|
|
1573
|
+
if (diagnostic.range?.start?.line !== void 0)
|
|
1574
|
+
anchored.push(diagnostic);
|
|
1575
|
+
}
|
|
1576
|
+
if (!anchored.length)
|
|
1577
|
+
return { kept: diagnostics, inlineKept: diagnostics };
|
|
1578
|
+
const converted = convertLspDiagnostics(anchored, options.filePath);
|
|
1579
|
+
retagAuxiliaryDiagnostics(converted, anchored, content, {
|
|
1580
|
+
cwd: options.cwd,
|
|
1581
|
+
fileRole: options.fileRole
|
|
1582
|
+
});
|
|
1583
|
+
const rawByConverted = /* @__PURE__ */ new Map();
|
|
1584
|
+
for (const [index, diagnostic] of converted.entries()) {
|
|
1585
|
+
const raw = anchored[index];
|
|
1586
|
+
if (raw !== void 0)
|
|
1587
|
+
rawByConverted.set(diagnostic, raw);
|
|
1588
|
+
}
|
|
1589
|
+
const { kept, inlineKept } = applyFindingPolicy(converted, {
|
|
1590
|
+
cwd: options.cwd,
|
|
1591
|
+
filePath: options.filePath,
|
|
1592
|
+
content,
|
|
1593
|
+
policyMap: options.policyMap,
|
|
1594
|
+
identities: (diagnostic) => probeIdentities(diagnostic, rawByConverted.get(diagnostic))
|
|
1595
|
+
});
|
|
1596
|
+
const survivorsOf = (survivors) => {
|
|
1597
|
+
if (survivors.length === converted.length)
|
|
1598
|
+
return diagnostics;
|
|
1599
|
+
const keptConverted = new Set(survivors);
|
|
1600
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
1601
|
+
for (const [diagnostic, raw] of rawByConverted) {
|
|
1602
|
+
if (!keptConverted.has(diagnostic))
|
|
1603
|
+
dropped.add(raw);
|
|
1604
|
+
}
|
|
1605
|
+
return diagnostics.filter((d) => !dropped.has(d));
|
|
1606
|
+
};
|
|
1607
|
+
return { kept: survivorsOf(kept), inlineKept: survivorsOf(inlineKept) };
|
|
1608
|
+
}
|
|
1609
|
+
function filterFindingsByDisposition(findings, cwd, toDiagnostic3) {
|
|
1610
|
+
if (findings.length === 0)
|
|
1611
|
+
return { kept: findings, suppressed: 0 };
|
|
1612
|
+
const candidates = findings.flatMap((finding) => {
|
|
1613
|
+
const diagnostic = toDiagnostic3(finding);
|
|
1614
|
+
return renderedRuleIdentities(diagnostic).map((identity) => ({
|
|
1615
|
+
finding,
|
|
1616
|
+
candidate: {
|
|
1617
|
+
filePath: diagnostic.filePath,
|
|
1618
|
+
message: diagnostic.message,
|
|
1619
|
+
...diagnostic.line !== void 0 && { line: diagnostic.line },
|
|
1620
|
+
...diagnostic.semantic !== void 0 && {
|
|
1621
|
+
semantic: diagnostic.semantic
|
|
1622
|
+
},
|
|
1623
|
+
...identity.tool !== void 0 && { tool: identity.tool },
|
|
1624
|
+
...identity.rule !== void 0 && { rule: identity.rule }
|
|
1625
|
+
}
|
|
1626
|
+
}));
|
|
1627
|
+
});
|
|
1628
|
+
const survivors = new Set(applyDispositionsMultiFile(candidates.map((c) => c.candidate), cwd, (d) => d.filePath));
|
|
1629
|
+
const disposed = /* @__PURE__ */ new Set();
|
|
1630
|
+
for (const candidate of candidates) {
|
|
1631
|
+
if (!survivors.has(candidate.candidate))
|
|
1632
|
+
disposed.add(candidate.finding);
|
|
1633
|
+
}
|
|
1634
|
+
const kept = disposed.size === 0 ? findings : findings.filter((finding) => !disposed.has(finding));
|
|
1635
|
+
return { kept, suppressed: findings.length - kept.length };
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
// dist/clients/dispatch/plan.js
|
|
1639
|
+
function primary(kind) {
|
|
1640
|
+
const group = getPrimaryDispatchGroup(kind, true);
|
|
1641
|
+
if (!group) {
|
|
1642
|
+
throw new Error(`Missing primary dispatch group for ${kind}`);
|
|
1643
|
+
}
|
|
1644
|
+
return group;
|
|
1645
|
+
}
|
|
1646
|
+
var LANGUAGE_CAPABILITY_MATRIX = {
|
|
1647
|
+
jsts: {
|
|
1648
|
+
name: "JavaScript/TypeScript Linting",
|
|
1649
|
+
capabilities: ["types", "security", "smells", "format", "lint"],
|
|
1650
|
+
writeGroups: [
|
|
1651
|
+
primary("jsts"),
|
|
1652
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["jsts"] },
|
|
1653
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["jsts"] },
|
|
1654
|
+
{ mode: "all", runnerIds: ["ast-grep-napi"], filterKinds: ["jsts"] },
|
|
1655
|
+
{
|
|
1656
|
+
mode: "fallback",
|
|
1657
|
+
runnerIds: ["eslint", "oxlint", "biome-check-json"],
|
|
1658
|
+
filterKinds: ["jsts"]
|
|
1659
|
+
}
|
|
1660
|
+
]
|
|
1661
|
+
},
|
|
1662
|
+
python: {
|
|
1663
|
+
name: "Python Linting",
|
|
1664
|
+
capabilities: ["types", "lint", "smells"],
|
|
1665
|
+
writeGroups: [
|
|
1666
|
+
primary("python"),
|
|
1667
|
+
{ mode: "fallback", runnerIds: ["ruff-lint"], filterKinds: ["python"] },
|
|
1668
|
+
{ mode: "fallback", runnerIds: ["mypy"], filterKinds: ["python"] },
|
|
1669
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["python"] },
|
|
1670
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["python"] }
|
|
1671
|
+
]
|
|
1672
|
+
},
|
|
1673
|
+
go: {
|
|
1674
|
+
name: "Go Linting",
|
|
1675
|
+
capabilities: ["types", "lint", "smells"],
|
|
1676
|
+
writeGroups: [
|
|
1677
|
+
primary("go"),
|
|
1678
|
+
{ mode: "fallback", runnerIds: ["golangci-lint"], filterKinds: ["go"] },
|
|
1679
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["go"] },
|
|
1680
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["go"] }
|
|
1681
|
+
]
|
|
1682
|
+
},
|
|
1683
|
+
rust: {
|
|
1684
|
+
name: "Rust Linting",
|
|
1685
|
+
capabilities: ["types", "lint", "smells"],
|
|
1686
|
+
writeGroups: [
|
|
1687
|
+
primary("rust"),
|
|
1688
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["rust"] },
|
|
1689
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["rust"] }
|
|
1690
|
+
]
|
|
1691
|
+
},
|
|
1692
|
+
ruby: {
|
|
1693
|
+
name: "Ruby Linting",
|
|
1694
|
+
capabilities: ["types", "lint", "smells"],
|
|
1695
|
+
writeGroups: [
|
|
1696
|
+
primary("ruby"),
|
|
1697
|
+
{ mode: "fallback", runnerIds: ["rubocop"], filterKinds: ["ruby"] },
|
|
1698
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["ruby"] },
|
|
1699
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["ruby"] }
|
|
1700
|
+
]
|
|
1701
|
+
},
|
|
1702
|
+
cxx: {
|
|
1703
|
+
name: "C/C++ Linting",
|
|
1704
|
+
capabilities: ["types", "lint", "smells"],
|
|
1705
|
+
writeGroups: [
|
|
1706
|
+
primary("cxx"),
|
|
1707
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["cxx"] }
|
|
1708
|
+
]
|
|
1709
|
+
},
|
|
1710
|
+
cmake: {
|
|
1711
|
+
name: "CMake Processing",
|
|
1712
|
+
capabilities: ["lint"],
|
|
1713
|
+
writeGroups: [
|
|
1714
|
+
primary("cmake"),
|
|
1715
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["cmake"] }
|
|
1716
|
+
]
|
|
1717
|
+
},
|
|
1718
|
+
fish: {
|
|
1719
|
+
name: "Fish Script Formatting",
|
|
1720
|
+
capabilities: ["format"],
|
|
1721
|
+
writeGroups: [primary("fish")]
|
|
1722
|
+
},
|
|
1723
|
+
shell: {
|
|
1724
|
+
name: "Shell Script Linting",
|
|
1725
|
+
capabilities: ["lint", "security", "format"],
|
|
1726
|
+
writeGroups: [
|
|
1727
|
+
primary("shell"),
|
|
1728
|
+
{ mode: "all", runnerIds: ["shfmt"], filterKinds: ["shell"] },
|
|
1729
|
+
{ mode: "all", runnerIds: ["fact-rules"], filterKinds: ["shell"] }
|
|
1730
|
+
]
|
|
1731
|
+
},
|
|
1732
|
+
json: {
|
|
1733
|
+
name: "JSON Processing",
|
|
1734
|
+
capabilities: ["format", "lint"],
|
|
1735
|
+
writeGroups: [
|
|
1736
|
+
primary("json"),
|
|
1737
|
+
{ mode: "all", runnerIds: ["trivy-config"], filterKinds: ["json"] }
|
|
1738
|
+
]
|
|
1739
|
+
},
|
|
1740
|
+
markdown: {
|
|
1741
|
+
name: "Markdown Processing",
|
|
1742
|
+
capabilities: ["docs", "format", "lint"],
|
|
1743
|
+
writeGroups: [
|
|
1744
|
+
primary("markdown"),
|
|
1745
|
+
{ mode: "all", runnerIds: ["markdownlint"], filterKinds: ["markdown"] }
|
|
1746
|
+
]
|
|
1747
|
+
},
|
|
1748
|
+
css: {
|
|
1749
|
+
name: "CSS Processing",
|
|
1750
|
+
capabilities: ["format", "lint"],
|
|
1751
|
+
writeGroups: [
|
|
1752
|
+
primary("css"),
|
|
1753
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["css"] },
|
|
1754
|
+
{ mode: "all", runnerIds: ["ast-grep-napi"], filterKinds: ["css"] }
|
|
1755
|
+
]
|
|
1756
|
+
},
|
|
1757
|
+
yaml: {
|
|
1758
|
+
name: "YAML Processing",
|
|
1759
|
+
capabilities: ["format", "lint"],
|
|
1760
|
+
writeGroups: [
|
|
1761
|
+
primary("yaml"),
|
|
1762
|
+
{ mode: "all", runnerIds: ["actionlint"], filterKinds: ["yaml"] }
|
|
1763
|
+
]
|
|
1764
|
+
},
|
|
1765
|
+
"helm-template": {
|
|
1766
|
+
name: "Helm Template Linting",
|
|
1767
|
+
capabilities: ["lint"],
|
|
1768
|
+
writeGroups: [primary("helm-template")]
|
|
1769
|
+
},
|
|
1770
|
+
sql: {
|
|
1771
|
+
name: "SQL Processing",
|
|
1772
|
+
capabilities: ["format", "lint"],
|
|
1773
|
+
writeGroups: [primary("sql")]
|
|
1774
|
+
},
|
|
1775
|
+
html: {
|
|
1776
|
+
name: "HTML Linting",
|
|
1777
|
+
capabilities: ["lint"],
|
|
1778
|
+
writeGroups: [
|
|
1779
|
+
primary("html"),
|
|
1780
|
+
{ mode: "all", runnerIds: ["ast-grep-napi"], filterKinds: ["html"] }
|
|
1781
|
+
]
|
|
1782
|
+
},
|
|
1783
|
+
docker: {
|
|
1784
|
+
name: "Dockerfile Linting",
|
|
1785
|
+
capabilities: ["lint"],
|
|
1786
|
+
writeGroups: [primary("docker")]
|
|
1787
|
+
},
|
|
1788
|
+
php: {
|
|
1789
|
+
name: "PHP Linting",
|
|
1790
|
+
capabilities: ["types", "lint"],
|
|
1791
|
+
writeGroups: [
|
|
1792
|
+
primary("php"),
|
|
1793
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["php"] }
|
|
1794
|
+
]
|
|
1795
|
+
},
|
|
1796
|
+
powershell: {
|
|
1797
|
+
name: "PowerShell Linting",
|
|
1798
|
+
capabilities: ["lint"],
|
|
1799
|
+
writeGroups: [primary("powershell")]
|
|
1800
|
+
},
|
|
1801
|
+
prisma: {
|
|
1802
|
+
name: "Prisma Schema Linting",
|
|
1803
|
+
capabilities: ["types", "lint"],
|
|
1804
|
+
writeGroups: [primary("prisma")]
|
|
1805
|
+
},
|
|
1806
|
+
csharp: {
|
|
1807
|
+
name: "C# Linting",
|
|
1808
|
+
capabilities: ["types", "lint"],
|
|
1809
|
+
writeGroups: [
|
|
1810
|
+
primary("csharp"),
|
|
1811
|
+
{ mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["csharp"] }
|
|
1812
|
+
]
|
|
1813
|
+
},
|
|
1814
|
+
fsharp: {
|
|
1815
|
+
name: "F# Linting",
|
|
1816
|
+
capabilities: ["types", "lint"],
|
|
1817
|
+
writeGroups: [primary("fsharp")]
|
|
1818
|
+
},
|
|
1819
|
+
java: {
|
|
1820
|
+
name: "Java Linting",
|
|
1821
|
+
capabilities: ["types", "lint"],
|
|
1822
|
+
writeGroups: [primary("java")]
|
|
1823
|
+
},
|
|
1824
|
+
kotlin: {
|
|
1825
|
+
name: "Kotlin Linting",
|
|
1826
|
+
capabilities: ["types", "lint", "format", "smells"],
|
|
1827
|
+
writeGroups: [
|
|
1828
|
+
primary("kotlin"),
|
|
1829
|
+
{ mode: "fallback", runnerIds: ["detekt"], filterKinds: ["kotlin"] }
|
|
1830
|
+
]
|
|
1831
|
+
},
|
|
1832
|
+
lean: {
|
|
1833
|
+
name: "Lean 4 Diagnostics",
|
|
1834
|
+
capabilities: ["types", "lint"],
|
|
1835
|
+
writeGroups: [primary("lean")]
|
|
1319
1836
|
},
|
|
1320
1837
|
swift: {
|
|
1321
1838
|
name: "Swift Linting",
|
|
@@ -1342,6 +1859,13 @@ var LANGUAGE_CAPABILITY_MATRIX = {
|
|
|
1342
1859
|
capabilities: ["types", "lint"],
|
|
1343
1860
|
writeGroups: [primary("haskell")]
|
|
1344
1861
|
},
|
|
1862
|
+
groovy: {
|
|
1863
|
+
name: "Groovy Diagnostics",
|
|
1864
|
+
// groovy-language-server publishes syntax and unresolved-class errors,
|
|
1865
|
+
// never type errors (#5235), so the row does not claim "types".
|
|
1866
|
+
capabilities: ["lint"],
|
|
1867
|
+
writeGroups: [primary("groovy")]
|
|
1868
|
+
},
|
|
1345
1869
|
elixir: {
|
|
1346
1870
|
name: "Elixir Linting",
|
|
1347
1871
|
capabilities: ["types", "lint"],
|
|
@@ -1443,6 +1967,7 @@ function settledSnapshot(entry) {
|
|
|
1443
1967
|
// the scope that owned it, and the gate's peek can fence with it.
|
|
1444
1968
|
session: entry.session,
|
|
1445
1969
|
sessionId: entry.sessionId,
|
|
1970
|
+
carriedFromTurnKey: entry.carriedFromTurnKey,
|
|
1446
1971
|
result: entry.result
|
|
1447
1972
|
};
|
|
1448
1973
|
}
|
|
@@ -1503,7 +2028,7 @@ function track(tracked) {
|
|
|
1503
2028
|
}
|
|
1504
2029
|
}
|
|
1505
2030
|
}
|
|
1506
|
-
async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, currentSessionId) {
|
|
2031
|
+
async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, currentSessionId, turnKey) {
|
|
1507
2032
|
if (pending.length === 0)
|
|
1508
2033
|
return [];
|
|
1509
2034
|
const current = pending.splice(0, pending.length);
|
|
@@ -1511,8 +2036,8 @@ async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, curre
|
|
|
1511
2036
|
if (maxWaitMs === 0)
|
|
1512
2037
|
await Promise.resolve();
|
|
1513
2038
|
if (maxWaitMs > 0 && current.some((entry) => !entry.settled)) {
|
|
1514
|
-
await new Promise((
|
|
1515
|
-
const timer = setTimeout(
|
|
2039
|
+
await new Promise((resolve47) => {
|
|
2040
|
+
const timer = setTimeout(resolve47, maxWaitMs);
|
|
1516
2041
|
timer.unref?.();
|
|
1517
2042
|
});
|
|
1518
2043
|
}
|
|
@@ -1530,6 +2055,8 @@ async function drainPendingRunnerFindings(maxWaitMs = 2e3, currentSession, curre
|
|
|
1530
2055
|
if (entry.settled && entry.result) {
|
|
1531
2056
|
results.push(settledSnapshot(entry));
|
|
1532
2057
|
} else {
|
|
2058
|
+
if (turnKey !== void 0 && entry.carriedFromTurnKey === void 0)
|
|
2059
|
+
entry.carriedFromTurnKey = turnKey;
|
|
1533
2060
|
pending.push(entry);
|
|
1534
2061
|
}
|
|
1535
2062
|
}
|
|
@@ -1599,103 +2126,60 @@ function laneCopyStandsFor(lane) {
|
|
|
1599
2126
|
return (d) => (rankByKey.get(laneKey(d)) ?? -1) >= semanticRank(d.semantic);
|
|
1600
2127
|
}
|
|
1601
2128
|
|
|
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;
|
|
2129
|
+
// dist/clients/dispatch/disabled-runners.js
|
|
2130
|
+
var DISABLED_BY_CONFIG_SKIP_REASON = "disabled-by-config";
|
|
2131
|
+
var DISABLED_RUNNERS_POINTER = "/dispatch/disabledRunners";
|
|
2132
|
+
function memberPointer(index) {
|
|
2133
|
+
return `${DISABLED_RUNNERS_POINTER}/${index}`;
|
|
2134
|
+
}
|
|
2135
|
+
function memberProvenance(resolution, index) {
|
|
2136
|
+
return resolution.provenance.get(memberPointer(index)) ?? resolution.provenance.get(DISABLED_RUNNERS_POINTER);
|
|
2137
|
+
}
|
|
2138
|
+
function dispatchSection(value) {
|
|
2139
|
+
const section = value.dispatch;
|
|
2140
|
+
return section && typeof section === "object" && !Array.isArray(section) ? section : {};
|
|
2141
|
+
}
|
|
2142
|
+
function disabledRunnersOf(resolution) {
|
|
2143
|
+
const members = dispatchSection(resolution.value).disabledRunners;
|
|
2144
|
+
if (!Array.isArray(members))
|
|
2145
|
+
return { runners: [], records: [] };
|
|
2146
|
+
const validate = runnerIdentityPopulated();
|
|
2147
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2148
|
+
const runners = [];
|
|
2149
|
+
const records = [];
|
|
2150
|
+
members.forEach((member, index) => {
|
|
2151
|
+
if (typeof member !== "string" || seen.has(member))
|
|
2152
|
+
return;
|
|
2153
|
+
const decidedBy = memberProvenance(resolution, index);
|
|
2154
|
+
if (validate && !isKnownRunnerId(member)) {
|
|
2155
|
+
const pointer = memberPointer(index);
|
|
2156
|
+
const file = decidedBy?.file ?? resolution.documents.at(-1)?.file ?? "";
|
|
2157
|
+
records.push({
|
|
2158
|
+
code: "PILENS_CFG_0005",
|
|
2159
|
+
file,
|
|
2160
|
+
key: pointer,
|
|
2161
|
+
subject: migrationSubject(file, pointer),
|
|
2162
|
+
reason: `dispatch.disabledRunners entry "${boundedKeyLabel(member)}" is not a recognized dispatch runner id; dropped`,
|
|
2163
|
+
...decidedBy?.tier ? { tier: decidedBy.tier } : {}
|
|
2164
|
+
});
|
|
2165
|
+
return;
|
|
1662
2166
|
}
|
|
1663
|
-
|
|
1664
|
-
|
|
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;
|
|
2167
|
+
seen.add(member);
|
|
2168
|
+
runners.push({ id: member, ...decidedBy ? { decidedBy } : {} });
|
|
1675
2169
|
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
const hasSelect = (entry.select?.length ?? 0) > 0;
|
|
1688
|
-
const hasIgnorePaths = (entry.ignorePaths?.length ?? 0) > 0;
|
|
1689
|
-
if (!hasDisable && !hasSelect && !hasIgnorePaths)
|
|
1690
|
-
continue;
|
|
1691
|
-
built ??= {};
|
|
1692
|
-
built[key2] = {
|
|
1693
|
-
...hasDisable ? { disable: entry.disable } : {},
|
|
1694
|
-
...hasSelect ? { select: entry.select } : {},
|
|
1695
|
-
...hasIgnorePaths ? { ignorePaths: entry.ignorePaths } : {}
|
|
1696
|
-
};
|
|
2170
|
+
return { runners, records };
|
|
2171
|
+
}
|
|
2172
|
+
function disabledRunnerIdsFor(resolution) {
|
|
2173
|
+
const resolved = disabledRunnersOf(resolution);
|
|
2174
|
+
if (resolved.records.length > 0) {
|
|
2175
|
+
const anchor = resolved.records.at(-1);
|
|
2176
|
+
const file = anchor?.file ?? resolution.documents.at(-1)?.file ?? "";
|
|
2177
|
+
reportPiLensConfigRecords(finalizeRecords(resolved.records, {
|
|
2178
|
+
file,
|
|
2179
|
+
...anchor?.tier ? { tier: anchor.tier } : {}
|
|
2180
|
+
}));
|
|
1697
2181
|
}
|
|
1698
|
-
return
|
|
2182
|
+
return resolved.runners.length === 0 ? void 0 : new Set(resolved.runners.map((runner) => runner.id));
|
|
1699
2183
|
}
|
|
1700
2184
|
|
|
1701
2185
|
// dist/clients/dispatch/tool-profile.js
|
|
@@ -1969,16 +2453,16 @@ async function checkToolAvailability(command, facts) {
|
|
|
1969
2453
|
function readFilePrefix(filePath, maxBytes = 4096) {
|
|
1970
2454
|
let fd;
|
|
1971
2455
|
try {
|
|
1972
|
-
fd =
|
|
2456
|
+
fd = fs4.openSync(filePath, "r");
|
|
1973
2457
|
const buffer = Buffer.alloc(maxBytes);
|
|
1974
|
-
const bytesRead =
|
|
2458
|
+
const bytesRead = fs4.readSync(fd, buffer, 0, maxBytes, 0);
|
|
1975
2459
|
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
1976
2460
|
} catch {
|
|
1977
2461
|
return void 0;
|
|
1978
2462
|
} finally {
|
|
1979
2463
|
if (fd !== void 0) {
|
|
1980
2464
|
try {
|
|
1981
|
-
|
|
2465
|
+
fs4.closeSync(fd);
|
|
1982
2466
|
} catch {
|
|
1983
2467
|
}
|
|
1984
2468
|
}
|
|
@@ -1998,7 +2482,9 @@ function createDispatchContext(filePath, cwd, pi, facts, blockingOnly, modifiedR
|
|
|
1998
2482
|
includeDeclarations: false
|
|
1999
2483
|
}) : void 0;
|
|
2000
2484
|
const projectConfig = loadPiLensProjectConfig(normalizedCwd);
|
|
2001
|
-
const
|
|
2485
|
+
const policyConfig = resolveDispatchPolicyConfigForFile(absoluteFilePath, normalizedProjectRoot);
|
|
2486
|
+
const rulePolicy = rulePolicyMapFromResolution(policyConfig, normalizedProjectRoot);
|
|
2487
|
+
const disabledRunnerIds = disabledRunnerIdsFor(policyConfig);
|
|
2002
2488
|
return {
|
|
2003
2489
|
filePath: normalizedFilePath,
|
|
2004
2490
|
projectRoot: normalizedProjectRoot,
|
|
@@ -2014,6 +2500,7 @@ function createDispatchContext(filePath, cwd, pi, facts, blockingOnly, modifiedR
|
|
|
2014
2500
|
facts,
|
|
2015
2501
|
projectConfig,
|
|
2016
2502
|
rulePolicy,
|
|
2503
|
+
...disabledRunnerIds !== void 0 && { disabledRunnerIds },
|
|
2017
2504
|
blockingOnly,
|
|
2018
2505
|
modifiedRanges,
|
|
2019
2506
|
writeIndex,
|
|
@@ -2169,14 +2656,19 @@ function promoteDeltaUnusedToBlockers(diagnostics) {
|
|
|
2169
2656
|
}
|
|
2170
2657
|
function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
2171
2658
|
if (!ctx.kind)
|
|
2172
|
-
return {};
|
|
2659
|
+
return { verdict: unchecked(NO_ANALYZER_REASON, { inapplicable: true }) };
|
|
2173
2660
|
const lspEnabled = !ctx.pi.getFlag("no-lsp");
|
|
2174
2661
|
const primary2 = getPrimaryDispatchGroup(ctx.kind, lspEnabled);
|
|
2175
2662
|
if (!primary2 || primary2.runnerIds.length === 0)
|
|
2176
|
-
return {
|
|
2663
|
+
return {
|
|
2664
|
+
verdict: unchecked(noPrimaryCheckerReason(lspEnabled)),
|
|
2665
|
+
coverage: "unconfigured"
|
|
2666
|
+
};
|
|
2177
2667
|
const relevant = runnerLatencies.filter((r) => primary2.runnerIds.includes(r.runnerId));
|
|
2178
2668
|
if (relevant.length === 0)
|
|
2179
|
-
return {
|
|
2669
|
+
return {
|
|
2670
|
+
verdict: unchecked("no primary runner ran for this file")
|
|
2671
|
+
};
|
|
2180
2672
|
const unconfirmedServerIds = [
|
|
2181
2673
|
...new Set(relevant.flatMap((r) => r.unconfirmedServerIds ?? []))
|
|
2182
2674
|
];
|
|
@@ -2191,9 +2683,15 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2191
2683
|
const silentServerIds = unconfirmedServerIds.filter((id) => !deferredIds.has(id));
|
|
2192
2684
|
const dedupeSet = (ids) => [...new Set(ids)].map(normalizeEphemeralMapKey).sort((a, b) => Number(a > b) - Number(a < b)).join(",");
|
|
2193
2685
|
const onceKey2 = `${ctx.kind}:${ctx.filePath}:${dedupeSet(silentServerIds)}|${dedupeSet(deferredServerIds)}`;
|
|
2686
|
+
const statusParts = [];
|
|
2687
|
+
if (deferredServerIds.length > 0)
|
|
2688
|
+
statusParts.push(`${markerFor(deferredServerIds)} deferred`);
|
|
2689
|
+
if (silentServerIds.length > 0)
|
|
2690
|
+
statusParts.push(`${markerFor(silentServerIds)} silent`);
|
|
2691
|
+
const verdict2 = unchecked(`${statusParts.join(", ")} (diagnostics are incomplete)`);
|
|
2194
2692
|
if (dedupe) {
|
|
2195
2693
|
if (coverageNoticeSeen.has(onceKey2))
|
|
2196
|
-
return {};
|
|
2694
|
+
return { verdict: verdict2 };
|
|
2197
2695
|
coverageNoticeSeen.add(onceKey2);
|
|
2198
2696
|
}
|
|
2199
2697
|
const coverageParts = [];
|
|
@@ -2211,21 +2709,24 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2211
2709
|
severity: "warning",
|
|
2212
2710
|
semantic: "warning",
|
|
2213
2711
|
tool: "pi-lens"
|
|
2214
|
-
}
|
|
2712
|
+
},
|
|
2713
|
+
verdict: verdict2
|
|
2215
2714
|
};
|
|
2216
2715
|
}
|
|
2217
|
-
const
|
|
2218
|
-
if (
|
|
2716
|
+
const primaryChecked = checkedVerdict("primary", relevant);
|
|
2717
|
+
if (primaryChecked)
|
|
2718
|
+
return { verdict: primaryChecked, coverage: "primary" };
|
|
2719
|
+
const primaryStillInFlight = relevant.some((r) => r.status === "pending" || r.status === "deferred");
|
|
2720
|
+
if (primaryStillInFlight) {
|
|
2721
|
+
const inFlightKey = `in-flight:${ctx.kind}:${ctx.filePath}`;
|
|
2722
|
+
const repeat = dedupe && coverageNoticeSeen.has(inFlightKey);
|
|
2723
|
+
if (dedupe)
|
|
2724
|
+
coverageNoticeSeen.add(inFlightKey);
|
|
2219
2725
|
return {
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
primaryLspChecked: true
|
|
2223
|
-
}
|
|
2726
|
+
verdict: unchecked(IN_FLIGHT_REASON, repeat ? { repeat: true } : {}),
|
|
2727
|
+
coverage: "in_flight"
|
|
2224
2728
|
};
|
|
2225
2729
|
}
|
|
2226
|
-
const primaryStillInFlight = relevant.some((r) => r.status === "pending" || r.status === "deferred");
|
|
2227
|
-
if (primaryStillInFlight)
|
|
2228
|
-
return { coverage: "in_flight" };
|
|
2229
2730
|
const plan = getToolPlan(ctx.kind);
|
|
2230
2731
|
const fallbackRunnerIds = new Set((plan?.groups ?? []).filter((group) => !group.runnerIds.every((runnerId) => primary2.runnerIds.includes(runnerId))).flatMap((group) => group.runnerIds).filter((runnerId) => !primary2.runnerIds.includes(runnerId)));
|
|
2231
2732
|
const STRUCTURAL_RUNNERS = /* @__PURE__ */ new Set([
|
|
@@ -2236,50 +2737,60 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
|
|
|
2236
2737
|
"opengrep"
|
|
2237
2738
|
]);
|
|
2238
2739
|
const TYPE_CAPABLE_FALLBACK_RUNNERS = /* @__PURE__ */ new Set(["mypy"]);
|
|
2239
|
-
const
|
|
2240
|
-
if (
|
|
2241
|
-
return { coverage: "fallback" };
|
|
2740
|
+
const fallbackChecked = checkedVerdict("fallback", runnerLatencies.filter((r) => fallbackRunnerIds.has(r.runnerId) && !STRUCTURAL_RUNNERS.has(r.runnerId) && (!plan?.capabilities.includes("types") || TYPE_CAPABLE_FALLBACK_RUNNERS.has(r.runnerId))));
|
|
2741
|
+
if (fallbackChecked)
|
|
2742
|
+
return { verdict: fallbackChecked, coverage: "fallback" };
|
|
2743
|
+
if (relevant.every((r) => r.runnerId === "lsp" && r.skipReason === "no-files-matched"))
|
|
2744
|
+
return {
|
|
2745
|
+
verdict: unchecked("not analyzed (no language server handles this file)")
|
|
2746
|
+
};
|
|
2242
2747
|
const cause = combinePrimaryUnavailableCauses(relevant.flatMap((r) => r.primaryUnavailableCause ?? []));
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2748
|
+
const deniedRunnerIds = relevant.filter((r) => r.skipReason === DISABLED_BY_CONFIG_SKIP_REASON).map((r) => r.runnerId);
|
|
2749
|
+
const deniedNote = `${deniedRunnerIds.join(", ")} disabled in config by dispatch.disabledRunners`;
|
|
2750
|
+
const onlySwitchedOff = relevant.every((r) => r.skipReason === DISABLED_BY_CONFIG_SKIP_REASON || isNotApplicableSkipReason(r.skipReason) || r.primaryUnavailableCause === "disabled" || r.primaryUnavailableCause === "disabledFallback");
|
|
2751
|
+
const verdict = unchecked(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)");
|
|
2752
|
+
if (onlySwitchedOff && (cause === "disabled" || cause === "disabledFallback" || cause === void 0 && deniedRunnerIds.length > 0)) {
|
|
2245
2753
|
const disabledIds = [
|
|
2246
2754
|
...new Set(relevant.flatMap((r) => r.disabledPrimaryServerIds ?? []))
|
|
2247
2755
|
].sort((a, b) => Number(a > b) - Number(a < b));
|
|
2248
|
-
const onceKeys =
|
|
2756
|
+
const onceKeys = [
|
|
2757
|
+
...disabledIds.map((id) => `disabled-primary:${id}`),
|
|
2758
|
+
...deniedRunnerIds.map((id) => `disabled-runner:${id}`)
|
|
2759
|
+
];
|
|
2249
2760
|
if (dedupe) {
|
|
2250
2761
|
if (onceKeys.every((key2) => coverageNoticeSeen.has(key2)))
|
|
2251
|
-
return {
|
|
2762
|
+
return { verdict };
|
|
2252
2763
|
for (const key2 of onceKeys)
|
|
2253
2764
|
coverageNoticeSeen.add(key2);
|
|
2254
2765
|
}
|
|
2255
2766
|
return {
|
|
2256
2767
|
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).`,
|
|
2768
|
+
id: `coverage-disabled:${ctx.kind}:${[...disabledIds, ...deniedRunnerIds].join(",")}`,
|
|
2769
|
+
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
2770
|
filePath: ctx.filePath,
|
|
2260
2771
|
severity: "warning",
|
|
2261
2772
|
semantic: "warning",
|
|
2262
2773
|
tool: "pi-lens"
|
|
2263
2774
|
},
|
|
2264
|
-
|
|
2775
|
+
verdict
|
|
2265
2776
|
};
|
|
2266
2777
|
}
|
|
2267
2778
|
const onceKey = `${ctx.kind}:${ctx.filePath}`;
|
|
2268
2779
|
if (dedupe) {
|
|
2269
2780
|
if (coverageNoticeSeen.has(onceKey))
|
|
2270
|
-
return {
|
|
2781
|
+
return { verdict };
|
|
2271
2782
|
coverageNoticeSeen.add(onceKey);
|
|
2272
2783
|
}
|
|
2273
2784
|
return {
|
|
2274
2785
|
notice: {
|
|
2275
2786
|
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)
|
|
2787
|
+
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
2788
|
filePath: ctx.filePath,
|
|
2278
2789
|
severity: "warning",
|
|
2279
2790
|
semantic: "warning",
|
|
2280
2791
|
tool: "pi-lens"
|
|
2281
2792
|
},
|
|
2282
|
-
|
|
2793
|
+
verdict
|
|
2283
2794
|
};
|
|
2284
2795
|
}
|
|
2285
2796
|
var latencyReports = [];
|
|
@@ -2352,21 +2863,44 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2352
2863
|
durationMs: Date.now() - runnerStart,
|
|
2353
2864
|
status: "test_file_skipped",
|
|
2354
2865
|
diagnosticCount: 0,
|
|
2355
|
-
semantic: "none"
|
|
2866
|
+
semantic: "none"
|
|
2867
|
+
});
|
|
2868
|
+
logLatency({
|
|
2869
|
+
type: "runner",
|
|
2870
|
+
filePath: ctx.filePath,
|
|
2871
|
+
runnerId,
|
|
2872
|
+
durationMs: 0,
|
|
2873
|
+
status: "test_file_skipped",
|
|
2874
|
+
diagnosticCount: 0,
|
|
2875
|
+
semantic: "none"
|
|
2876
|
+
});
|
|
2877
|
+
continue;
|
|
2878
|
+
}
|
|
2879
|
+
const appliesToCurrentKind = runnerAppliesToKind(runner, ctx.kind);
|
|
2880
|
+
if (!appliesToCurrentKind) {
|
|
2881
|
+
const runnerEnd2 = Date.now();
|
|
2882
|
+
latencies.push({
|
|
2883
|
+
runnerId,
|
|
2884
|
+
startTime: runnerStart,
|
|
2885
|
+
endTime: runnerEnd2,
|
|
2886
|
+
durationMs: 0,
|
|
2887
|
+
status: "skipped",
|
|
2888
|
+
diagnosticCount: 0,
|
|
2889
|
+
semantic: "unknown"
|
|
2356
2890
|
});
|
|
2357
2891
|
logLatency({
|
|
2358
2892
|
type: "runner",
|
|
2359
2893
|
filePath: ctx.filePath,
|
|
2360
2894
|
runnerId,
|
|
2361
2895
|
durationMs: 0,
|
|
2362
|
-
status: "
|
|
2896
|
+
status: "skipped",
|
|
2363
2897
|
diagnosticCount: 0,
|
|
2364
|
-
semantic: "
|
|
2898
|
+
semantic: "unknown",
|
|
2899
|
+
metadata: { reason: "applies_to", kind: ctx.kind }
|
|
2365
2900
|
});
|
|
2366
2901
|
continue;
|
|
2367
2902
|
}
|
|
2368
|
-
|
|
2369
|
-
if (!appliesToCurrentKind) {
|
|
2903
|
+
if (ctx.disabledRunnerIds?.has(runnerId)) {
|
|
2370
2904
|
const runnerEnd2 = Date.now();
|
|
2371
2905
|
latencies.push({
|
|
2372
2906
|
runnerId,
|
|
@@ -2375,7 +2909,8 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2375
2909
|
durationMs: 0,
|
|
2376
2910
|
status: "skipped",
|
|
2377
2911
|
diagnosticCount: 0,
|
|
2378
|
-
semantic: "
|
|
2912
|
+
semantic: "none",
|
|
2913
|
+
skipReason: DISABLED_BY_CONFIG_SKIP_REASON
|
|
2379
2914
|
});
|
|
2380
2915
|
logLatency({
|
|
2381
2916
|
type: "runner",
|
|
@@ -2384,8 +2919,8 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2384
2919
|
durationMs: 0,
|
|
2385
2920
|
status: "skipped",
|
|
2386
2921
|
diagnosticCount: 0,
|
|
2387
|
-
semantic: "
|
|
2388
|
-
metadata: {
|
|
2922
|
+
semantic: "none",
|
|
2923
|
+
metadata: { skipReason: DISABLED_BY_CONFIG_SKIP_REASON }
|
|
2389
2924
|
});
|
|
2390
2925
|
continue;
|
|
2391
2926
|
}
|
|
@@ -2550,6 +3085,7 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2550
3085
|
...result.failureKind !== void 0 && {
|
|
2551
3086
|
failureKind: result.failureKind
|
|
2552
3087
|
},
|
|
3088
|
+
...result.inconclusive === true && { inconclusive: true },
|
|
2553
3089
|
...skipReason !== void 0 && {
|
|
2554
3090
|
skipReason
|
|
2555
3091
|
},
|
|
@@ -2633,8 +3169,31 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
|
|
|
2633
3169
|
coveredRunners
|
|
2634
3170
|
};
|
|
2635
3171
|
}
|
|
3172
|
+
function skipGeneratedFile(ctx) {
|
|
3173
|
+
if (ctx.fileRole !== "generated")
|
|
3174
|
+
return void 0;
|
|
3175
|
+
const evidence = ctx.generatedEvidence;
|
|
3176
|
+
const lineShapeMean = ctx.generatedLineShapeMean;
|
|
3177
|
+
if (!generatedSkipRecorded.has(ctx.filePath)) {
|
|
3178
|
+
generatedSkipRecorded.add(ctx.filePath);
|
|
3179
|
+
logLatency({
|
|
3180
|
+
type: "phase",
|
|
3181
|
+
filePath: ctx.filePath,
|
|
3182
|
+
phase: "dispatch_skipped_generated",
|
|
3183
|
+
durationMs: 0,
|
|
3184
|
+
metadata: {
|
|
3185
|
+
evidence: evidence ?? "unknown",
|
|
3186
|
+
...lineShapeMean !== void 0 && { lineShapeMean }
|
|
3187
|
+
}
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
return emptyDispatchResult(unchecked("generated file (not analyzed)", { inapplicable: true }));
|
|
3191
|
+
}
|
|
2636
3192
|
async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
2637
3193
|
const _overallStart = Date.now();
|
|
3194
|
+
const generated = skipGeneratedFile(ctx);
|
|
3195
|
+
if (generated)
|
|
3196
|
+
return generated;
|
|
2638
3197
|
if (ctx.analysisRootMode === "adopted") {
|
|
2639
3198
|
const planned = groups.flatMap((g) => g.runnerIds);
|
|
2640
3199
|
groups = filterGroupsForAdoptedRoot(groups);
|
|
@@ -2652,46 +3211,8 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2652
3211
|
}
|
|
2653
3212
|
});
|
|
2654
3213
|
if (groups.length === 0) {
|
|
2655
|
-
return
|
|
2656
|
-
diagnostics: [],
|
|
2657
|
-
blockers: [],
|
|
2658
|
-
warnings: [],
|
|
2659
|
-
baselineWarningCount: 0,
|
|
2660
|
-
fixed: [],
|
|
2661
|
-
resolvedCount: 0,
|
|
2662
|
-
output: "",
|
|
2663
|
-
blockerOutput: "",
|
|
2664
|
-
hasBlockers: false
|
|
2665
|
-
};
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
if (ctx.fileRole === "generated") {
|
|
2669
|
-
const evidence = ctx.generatedEvidence;
|
|
2670
|
-
const lineShapeMean = ctx.generatedLineShapeMean;
|
|
2671
|
-
if (!generatedSkipRecorded.has(ctx.filePath)) {
|
|
2672
|
-
generatedSkipRecorded.add(ctx.filePath);
|
|
2673
|
-
logLatency({
|
|
2674
|
-
type: "phase",
|
|
2675
|
-
filePath: ctx.filePath,
|
|
2676
|
-
phase: "dispatch_skipped_generated",
|
|
2677
|
-
durationMs: 0,
|
|
2678
|
-
metadata: {
|
|
2679
|
-
evidence: evidence ?? "unknown",
|
|
2680
|
-
...lineShapeMean !== void 0 && { lineShapeMean }
|
|
2681
|
-
}
|
|
2682
|
-
});
|
|
3214
|
+
return emptyDispatchResult(unchecked(planned.length > 0 ? "not analyzed (adopted analysis root: no runner is admitted for it)" : "no runner is planned for this file"));
|
|
2683
3215
|
}
|
|
2684
|
-
return {
|
|
2685
|
-
diagnostics: [],
|
|
2686
|
-
blockers: [],
|
|
2687
|
-
warnings: [],
|
|
2688
|
-
baselineWarningCount: 0,
|
|
2689
|
-
fixed: [],
|
|
2690
|
-
resolvedCount: 0,
|
|
2691
|
-
output: "",
|
|
2692
|
-
blockerOutput: "",
|
|
2693
|
-
hasBlockers: false
|
|
2694
|
-
};
|
|
2695
3216
|
}
|
|
2696
3217
|
const allDiagnostics = [];
|
|
2697
3218
|
let stopped = false;
|
|
@@ -2764,14 +3285,19 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2764
3285
|
const deliveredDiagnostics = laneCopyByRunner.size === 0 ? allDiagnostics : allDiagnostics.flatMap((d) => laneCopyByRunner.get(d.runnerId ?? "")?.(d) ? [] : [d]);
|
|
2765
3286
|
const dedupedDiagnostics = dedupeOverlappingDiagnostics(deliveredDiagnostics);
|
|
2766
3287
|
const fileContent = ctx.facts.getFileFact(ctx.filePath, "file.content") ?? "";
|
|
2767
|
-
const
|
|
3288
|
+
const rulePolicyRoot = ctx.projectRoot ?? ctx.cwd;
|
|
3289
|
+
const rulePolicy = projectRulePolicy(rulePolicyRoot, "rulePolicy" in ctx ? { filePath: ctx.filePath, map: ctx.rulePolicy } : void 0);
|
|
2768
3290
|
const applyOutputFilters = (diags) => {
|
|
2769
3291
|
const dockerOverlap = suppressTrivyConfigDockerOverlap(diags);
|
|
2770
3292
|
const overlap = suppressLintOverlapsWithLsp(dockerOverlap);
|
|
2771
|
-
const
|
|
2772
|
-
|
|
3293
|
+
const { disposed: disposition } = applyFindingPolicyByOwner(overlap, {
|
|
3294
|
+
cwd: rulePolicyRoot,
|
|
3295
|
+
filePath: ctx.filePath,
|
|
3296
|
+
content: fileContent,
|
|
3297
|
+
policyMap: void 0
|
|
3298
|
+
});
|
|
2773
3299
|
return applyRulePolicy(disposition, rulePolicy, {
|
|
2774
|
-
root:
|
|
3300
|
+
root: rulePolicyRoot,
|
|
2775
3301
|
filePath: ctx.filePath
|
|
2776
3302
|
});
|
|
2777
3303
|
};
|
|
@@ -2815,21 +3341,21 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2815
3341
|
provider: ctx.telemetryProvider
|
|
2816
3342
|
};
|
|
2817
3343
|
if (fixedItems.length > 0) {
|
|
2818
|
-
import("./chunk-
|
|
3344
|
+
import("./chunk-NOWH2VA2.js").then(({ appendToWorklog }) => {
|
|
2819
3345
|
appendToWorklog(ctx.cwd, fixedItems, true, worklogIdentity);
|
|
2820
3346
|
}).catch(() => {
|
|
2821
3347
|
});
|
|
2822
3348
|
}
|
|
2823
3349
|
const fixableWarnings = warnings.filter((d) => d.fixable);
|
|
2824
3350
|
if (fixableWarnings.length > 0) {
|
|
2825
|
-
import("./chunk-
|
|
3351
|
+
import("./chunk-NOWH2VA2.js").then(({ appendToWorklog }) => {
|
|
2826
3352
|
appendToWorklog(ctx.cwd, fixableWarnings, false, worklogIdentity);
|
|
2827
3353
|
}).catch(() => {
|
|
2828
3354
|
});
|
|
2829
3355
|
}
|
|
2830
3356
|
const inlineBlockers = blockers;
|
|
2831
3357
|
const inlineFixed = fixedItems;
|
|
2832
|
-
const { notice: coverageNotice,
|
|
3358
|
+
const { notice: coverageNotice, verdict, coverage } = buildCoverageNotice(ctx, runnerLatencies, options?.dedupeCoverageNotice ?? true);
|
|
2833
3359
|
const blockerOutput = formatDiagnostics(inlineBlockers, "blocking");
|
|
2834
3360
|
let output = blockerOutput;
|
|
2835
3361
|
output += formatDiagnostics(inlineFixed, "fixed");
|
|
@@ -2939,9 +3465,8 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
|
|
|
2939
3465
|
collectLaterRunnerIds: [...collectLaterRunnerIds]
|
|
2940
3466
|
}
|
|
2941
3467
|
},
|
|
2942
|
-
|
|
2943
|
-
...coverage !== void 0 && { coverage }
|
|
2944
|
-
...primaryLspChecked && { primaryLspChecked }
|
|
3468
|
+
verdict,
|
|
3469
|
+
...coverage !== void 0 && { coverage }
|
|
2945
3470
|
};
|
|
2946
3471
|
}
|
|
2947
3472
|
var RUNNER_TIMEOUT_MS = RUNTIME_CONFIG.dispatch.runnerTimeoutMs;
|
|
@@ -2961,303 +3486,69 @@ function looksLikeDiagnosticCodePath(value) {
|
|
|
2961
3486
|
if (/^[a-z-]+:\d+(?::\d+)?$/i.test(text) || /^[a-z-]+:\d+(?::\d+)?$/i.test(base)) {
|
|
2962
3487
|
return true;
|
|
2963
3488
|
}
|
|
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
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
return out;
|
|
3489
|
+
return false;
|
|
3189
3490
|
}
|
|
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);
|
|
3491
|
+
function normalizeDiagnosticFilePath(ctx, rawPath) {
|
|
3492
|
+
if (typeof rawPath === "string" && looksLikeDiagnosticCodePath(rawPath)) {
|
|
3493
|
+
ctx.log(`runner path normalization: ignored diagnostic code-like path '${rawPath}', using current file`);
|
|
3494
|
+
return resolveRunnerPath(ctx.cwd, ctx.filePath);
|
|
3198
3495
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
if (raw !== void 0)
|
|
3210
|
-
rawByConverted.set(diagnostic, raw);
|
|
3496
|
+
return resolveRunnerPath(ctx.cwd, rawPath || ctx.filePath);
|
|
3497
|
+
}
|
|
3498
|
+
function failureRowMetadata(result) {
|
|
3499
|
+
const inconclusive = result.inconclusive === true ? { inconclusive: true } : {};
|
|
3500
|
+
if (result.status === "failed" && result.failureKind) {
|
|
3501
|
+
return {
|
|
3502
|
+
failureKind: result.failureKind,
|
|
3503
|
+
failureMessage: result.failureMessage,
|
|
3504
|
+
...inconclusive
|
|
3505
|
+
};
|
|
3211
3506
|
}
|
|
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) };
|
|
3507
|
+
return result.inconclusive === true ? inconclusive : void 0;
|
|
3231
3508
|
}
|
|
3232
|
-
function
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
const
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
semantic: diagnostic.semantic
|
|
3245
|
-
},
|
|
3246
|
-
...identity.tool !== void 0 && { tool: identity.tool },
|
|
3247
|
-
...identity.rule !== void 0 && { rule: identity.rule }
|
|
3248
|
-
}
|
|
3509
|
+
async function runRunner(ctx, runner, defaultSemantic) {
|
|
3510
|
+
const timeoutMs = Math.max(runner.timeoutMs ?? RUNNER_TIMEOUT_MS, getRunnerTimeoutFloorMs());
|
|
3511
|
+
const phaseToken = phaseStarted(runner.id);
|
|
3512
|
+
try {
|
|
3513
|
+
const outcome = await withBudget(runner.run(ctx).then((value) => ({ value })), timeoutMs);
|
|
3514
|
+
if (outcome === void 0) {
|
|
3515
|
+
throw new Error(`Runner ${runner.id} timed out after ${timeoutMs}ms`);
|
|
3516
|
+
}
|
|
3517
|
+
const result = outcome.value;
|
|
3518
|
+
const diagnostics = result.diagnostics.map((d) => ({
|
|
3519
|
+
...d,
|
|
3520
|
+
filePath: normalizeDiagnosticFilePath(ctx, d.filePath)
|
|
3249
3521
|
}));
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3522
|
+
return {
|
|
3523
|
+
...result,
|
|
3524
|
+
diagnostics,
|
|
3525
|
+
semantic: result.semantic ?? defaultSemantic
|
|
3526
|
+
};
|
|
3527
|
+
} catch (error) {
|
|
3528
|
+
ctx.log(`Runner ${runner.id} failed: ${error}`);
|
|
3529
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3530
|
+
return {
|
|
3531
|
+
status: "failed",
|
|
3532
|
+
diagnostics: [],
|
|
3533
|
+
semantic: defaultSemantic,
|
|
3534
|
+
failureKind: message.includes("timed out") ? "timeout" : "exception",
|
|
3535
|
+
failureMessage: message.slice(0, 200)
|
|
3536
|
+
};
|
|
3537
|
+
} finally {
|
|
3538
|
+
phaseFinished(phaseToken);
|
|
3256
3539
|
}
|
|
3257
|
-
const kept = disposed.size === 0 ? findings : findings.filter((finding) => !disposed.has(finding));
|
|
3258
|
-
return { kept, suppressed: findings.length - kept.length };
|
|
3259
3540
|
}
|
|
3260
3541
|
|
|
3542
|
+
// dist/clients/cascade-budget.js
|
|
3543
|
+
function cascadeSettleWaitMs() {
|
|
3544
|
+
const raw = Number(process.env.PI_LENS_CASCADE_SETTLE_WAIT_MS);
|
|
3545
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : 5e3;
|
|
3546
|
+
}
|
|
3547
|
+
var MIN_NEIGHBOUR_BUDGET = RUNTIME_CONFIG.pipeline.cascadeMaxFiles;
|
|
3548
|
+
var DEFAULT_NEIGHBOUR_BUDGET = 40;
|
|
3549
|
+
var CASCADE_NEIGHBOUR_BUDGET = Math.max(MIN_NEIGHBOUR_BUDGET, Number.parseInt(process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET ?? "40", 10) || DEFAULT_NEIGHBOUR_BUDGET);
|
|
3550
|
+
var NEIGHBOUR_BUDGET_OVERRIDDEN = process.env.PI_LENS_CASCADE_NEIGHBOUR_BUDGET !== void 0 && CASCADE_NEIGHBOUR_BUDGET !== DEFAULT_NEIGHBOUR_BUDGET;
|
|
3551
|
+
|
|
3261
3552
|
// dist/clients/finding-delivery-gate.js
|
|
3262
3553
|
var MS_PER_MINUTE = 6e4;
|
|
3263
3554
|
function markUnreconciledFindings(findings) {
|
|
@@ -3348,7 +3639,7 @@ var DELIVERY_SURFACES = {
|
|
|
3348
3639
|
// interpolation — proves the label is actually rendered, not merely
|
|
3349
3640
|
// computed and discarded (review round F1's "deleted the age
|
|
3350
3641
|
// 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
|
|
3642
|
+
"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
3643
|
"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
3644
|
"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
3645
|
"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 +5298,7 @@ var tryCatchFactProvider = {
|
|
|
5007
5298
|
import path7 from "node:path";
|
|
5008
5299
|
var actionlint = createAvailabilityChecker("actionlint", ".exe");
|
|
5009
5300
|
function isGitHubWorkflowFile(filePath) {
|
|
5010
|
-
const normalized = filePath
|
|
5301
|
+
const normalized = toPosix(filePath);
|
|
5011
5302
|
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(normalized);
|
|
5012
5303
|
}
|
|
5013
5304
|
function toDiagnostic(issue, filePath) {
|
|
@@ -6557,7 +6848,7 @@ ${result.stdout || ""}`, ctx.filePath, cwd);
|
|
|
6557
6848
|
var gleam_check_default = gleamCheckRunner;
|
|
6558
6849
|
|
|
6559
6850
|
// dist/clients/dispatch/runners/go-vet.js
|
|
6560
|
-
import {
|
|
6851
|
+
import { resolve as resolve15 } from "node:path";
|
|
6561
6852
|
|
|
6562
6853
|
// dist/clients/dispatch/runners/utils/diagnostic-parsers.js
|
|
6563
6854
|
import * as path18 from "node:path";
|
|
@@ -6633,8 +6924,8 @@ var goVetRunner = {
|
|
|
6633
6924
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
6634
6925
|
}
|
|
6635
6926
|
const cwd = resolveRunnerCwd(ctx, "go-vet");
|
|
6636
|
-
const fileRel =
|
|
6637
|
-
const pkgPath = fileRel
|
|
6927
|
+
const fileRel = relativeInside(cwd, ctx.filePath);
|
|
6928
|
+
const pkgPath = fileRel === void 0 ? (
|
|
6638
6929
|
// File isn't under ctx.cwd (unexpected — ctx.cwd is the go.mod root).
|
|
6639
6930
|
// Vet the root package as a safe fallback rather than emit `./../x`;
|
|
6640
6931
|
// the filename filter below still prevents mis-attribution.
|
|
@@ -6655,10 +6946,10 @@ var goVetRunner = {
|
|
|
6655
6946
|
if (result.status === 0 && !raw.trim()) {
|
|
6656
6947
|
return { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
6657
6948
|
}
|
|
6658
|
-
const absTarget =
|
|
6949
|
+
const absTarget = resolve15(ctx.filePath);
|
|
6659
6950
|
const relevant = raw.split("\n").filter((line) => {
|
|
6660
6951
|
const m = line.match(GO_VET_LINE);
|
|
6661
|
-
return m != null && pathsEqual(
|
|
6952
|
+
return m != null && pathsEqual(resolve15(cwd, m[1].trim()), absTarget);
|
|
6662
6953
|
}).join("\n");
|
|
6663
6954
|
const diagnostics = parseGoVetOutput(relevant, ctx.filePath, cwd);
|
|
6664
6955
|
return diagnostics.length > 0 ? findingsResult(diagnostics, { status: "failed", semantic: "warning" }) : { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
@@ -6741,6 +7032,7 @@ var golangciRunner = {
|
|
|
6741
7032
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
6742
7033
|
const result = await safeSpawnAsync(cmd, [
|
|
6743
7034
|
"run",
|
|
7035
|
+
"--fix=false",
|
|
6744
7036
|
"--output.json.path=stdout",
|
|
6745
7037
|
...OTHER_OUTPUT_FORMATS.map((format) => `--output.${format}.path=`),
|
|
6746
7038
|
"--show-stats=false",
|
|
@@ -6854,10 +7146,6 @@ var SKIPPED = {
|
|
|
6854
7146
|
diagnostics: [],
|
|
6855
7147
|
semantic: "none"
|
|
6856
7148
|
};
|
|
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
7149
|
function diagnosticLocation(message, chartRoot) {
|
|
6862
7150
|
const location = message.match(/(?:^|[\s(])((?:[^\s:()\r\n]*\/[^:()\r\n"]*?|[^\s:()\r\n]+)\.(?:ya?ml|tpl|json))(?::(\d+))?(?=[:\s)]|$)/i);
|
|
6863
7151
|
const [, found, rawLine] = location ?? [];
|
|
@@ -6865,10 +7153,10 @@ function diagnosticLocation(message, chartRoot) {
|
|
|
6865
7153
|
return { filePath: path21.join(chartRoot, "Chart.yaml"), message };
|
|
6866
7154
|
}
|
|
6867
7155
|
const embedded = !message.startsWith(found);
|
|
6868
|
-
const
|
|
6869
|
-
const candidate = path21.resolve(chartRoot,
|
|
7156
|
+
const relative2 = embedded ? found.slice(found.indexOf("/") + 1) : found;
|
|
7157
|
+
const candidate = path21.resolve(chartRoot, relative2);
|
|
6870
7158
|
return {
|
|
6871
|
-
filePath:
|
|
7159
|
+
filePath: isWithinIdentity(candidate, chartRoot) ? candidate : path21.join(chartRoot, "Chart.yaml"),
|
|
6872
7160
|
line: rawLine ? Number(rawLine) : void 0,
|
|
6873
7161
|
message
|
|
6874
7162
|
};
|
|
@@ -6968,7 +7256,7 @@ var helmLintRunner = {
|
|
|
6968
7256
|
if (!discovered)
|
|
6969
7257
|
return SKIPPED;
|
|
6970
7258
|
const chartRoot = path21.resolve(discovered);
|
|
6971
|
-
if (!
|
|
7259
|
+
if (!isWithinIdentity(chartRoot, workspaceRoot))
|
|
6972
7260
|
return SKIPPED;
|
|
6973
7261
|
const existing = inFlightByChartRoot.get(chartRoot);
|
|
6974
7262
|
if (existing)
|
|
@@ -6985,7 +7273,6 @@ var helm_lint_default = helmLintRunner;
|
|
|
6985
7273
|
|
|
6986
7274
|
// dist/clients/dispatch/runners/helm-render.js
|
|
6987
7275
|
import * as fs12 from "node:fs";
|
|
6988
|
-
import * as os from "node:os";
|
|
6989
7276
|
import * as path22 from "node:path";
|
|
6990
7277
|
var helm2 = createAvailabilityChecker("helm", ".exe", ["version", "--short"]);
|
|
6991
7278
|
var trivy = createAvailabilityChecker("trivy", ".exe");
|
|
@@ -7000,10 +7287,7 @@ var SKIPPED2 = {
|
|
|
7000
7287
|
diagnostics: [],
|
|
7001
7288
|
semantic: "none"
|
|
7002
7289
|
};
|
|
7003
|
-
|
|
7004
|
-
const relative5 = path22.relative(normalizeMapKey(root), normalizeMapKey(candidate));
|
|
7005
|
-
return relative5 === "" || !relative5.startsWith(`..${path22.sep}`) && relative5 !== ".." && !path22.isAbsolute(relative5);
|
|
7006
|
-
}
|
|
7290
|
+
var NOT_ENABLED = { ...SKIPPED2, skipReason: "not-enabled" };
|
|
7007
7291
|
function isHelmRenderEnabled(workspaceRoot) {
|
|
7008
7292
|
try {
|
|
7009
7293
|
const config = loadPiLensProjectConfig(workspaceRoot);
|
|
@@ -7018,13 +7302,13 @@ function resolveTemplateSource(sourceRef, chartRoot, realChartRoot) {
|
|
|
7018
7302
|
if (segments.length < 2)
|
|
7019
7303
|
return null;
|
|
7020
7304
|
const candidate = path22.resolve(chartRoot, ...segments.slice(1));
|
|
7021
|
-
if (!
|
|
7305
|
+
if (!isWithinIdentity(candidate, chartRoot))
|
|
7022
7306
|
return null;
|
|
7023
7307
|
try {
|
|
7024
7308
|
if (!fs12.lstatSync(candidate).isFile())
|
|
7025
7309
|
return null;
|
|
7026
7310
|
const root = realChartRoot ?? fs12.realpathSync(chartRoot);
|
|
7027
|
-
if (!
|
|
7311
|
+
if (!isWithinIdentity(fs12.realpathSync(candidate), root))
|
|
7028
7312
|
return null;
|
|
7029
7313
|
} catch {
|
|
7030
7314
|
return null;
|
|
@@ -7066,9 +7350,9 @@ function mapRenderedToSource(options) {
|
|
|
7066
7350
|
if (resolved)
|
|
7067
7351
|
return { filePath: resolved, mapped: true };
|
|
7068
7352
|
}
|
|
7069
|
-
const
|
|
7070
|
-
if (
|
|
7071
|
-
const resolved = resolveTemplateSource(
|
|
7353
|
+
const relative2 = toProjectRelativePath(options.renderedPath, options.outputDir);
|
|
7354
|
+
if (!isAbsoluteFilePath(relative2)) {
|
|
7355
|
+
const resolved = resolveTemplateSource(relative2, chartRoot, realChartRoot);
|
|
7072
7356
|
if (resolved)
|
|
7073
7357
|
return { filePath: resolved, mapped: true };
|
|
7074
7358
|
}
|
|
@@ -7447,7 +7731,7 @@ async function renderAndValidate(chartRoot, cwd, filePath) {
|
|
|
7447
7731
|
const helmCmd = await resolveAvailableOrInstall(helm2, "helm", cwd);
|
|
7448
7732
|
if (!helmCmd)
|
|
7449
7733
|
return helmUnavailableResult(cwd);
|
|
7450
|
-
const outputDir = fs12.mkdtempSync(path22.join(
|
|
7734
|
+
const outputDir = fs12.mkdtempSync(path22.join(scannerReportParentDir(), "pi-lens-helm-render-"));
|
|
7451
7735
|
try {
|
|
7452
7736
|
const render = await safeSpawnAsync(helmCmd, ["template", "pi-lens-render", chartRoot, "--output-dir", outputDir], {
|
|
7453
7737
|
cwd,
|
|
@@ -7549,13 +7833,13 @@ var helmRenderRunner = {
|
|
|
7549
7833
|
const cwd = resolveRunnerCwd(ctx, "helm-render");
|
|
7550
7834
|
const workspaceRoot = path22.resolve(ctx.projectRoot ?? cwd);
|
|
7551
7835
|
if (!isHelmRenderEnabled(workspaceRoot))
|
|
7552
|
-
return
|
|
7836
|
+
return NOT_ENABLED;
|
|
7553
7837
|
const startDir = path22.dirname(path22.resolve(ctx.filePath));
|
|
7554
7838
|
const discovered = findNearestDirWithMarker(startDir, "chartYamlPath");
|
|
7555
7839
|
if (!discovered)
|
|
7556
7840
|
return SKIPPED2;
|
|
7557
7841
|
const chartRoot = path22.resolve(discovered);
|
|
7558
|
-
if (!
|
|
7842
|
+
if (!isWithinIdentity(chartRoot, workspaceRoot))
|
|
7559
7843
|
return SKIPPED2;
|
|
7560
7844
|
if (getProjectTrustState() === "untrusted") {
|
|
7561
7845
|
logRenderPass(ctx.filePath, chartRoot, Date.now(), {
|
|
@@ -7905,10 +8189,10 @@ var lspRunner = {
|
|
|
7905
8189
|
status: "skipped",
|
|
7906
8190
|
diagnostics: [],
|
|
7907
8191
|
semantic: "none",
|
|
7908
|
-
...disabledPrimaryServerIds.length > 0
|
|
8192
|
+
...disabledPrimaryServerIds.length > 0 ? {
|
|
7909
8193
|
primaryUnavailableCause: "disabled",
|
|
7910
8194
|
disabledPrimaryServerIds
|
|
7911
|
-
}
|
|
8195
|
+
} : { skipReason: "no-files-matched" }
|
|
7912
8196
|
};
|
|
7913
8197
|
}
|
|
7914
8198
|
let lspDiags = [];
|
|
@@ -7919,6 +8203,8 @@ var lspRunner = {
|
|
|
7919
8203
|
let primaryUnavailable;
|
|
7920
8204
|
let unconfirmedServerIds = [];
|
|
7921
8205
|
let deferredServerIds = [];
|
|
8206
|
+
let primaryAnswered = false;
|
|
8207
|
+
let primaryAnswerStale = false;
|
|
7922
8208
|
let usedWarmAttach = false;
|
|
7923
8209
|
let incumbentProjectIdentity;
|
|
7924
8210
|
let failureReason = "";
|
|
@@ -7940,9 +8226,21 @@ var lspRunner = {
|
|
|
7940
8226
|
const answer = attached?.available ? dropExcludedServers(attached.response, configDisabledAuxiliaryLspServerIds((f) => ctx.pi.getFlag(f))) : void 0;
|
|
7941
8227
|
const touched = answer ? {
|
|
7942
8228
|
diags: answer.diagnostics,
|
|
8229
|
+
// #5008: `confirmation` is what says the PRIMARY answered
|
|
8230
|
+
// (`primaryAnswered` below). The incumbent's DTO carries it for
|
|
8231
|
+
// exactly this reason, and dropping it here would read every warm
|
|
8232
|
+
// answer as a primary that never completed its policy — the #1179
|
|
8233
|
+
// side-channel loss class, one field further on.
|
|
8234
|
+
...answer.confirmation !== void 0 && {
|
|
8235
|
+
confirmation: answer.confirmation
|
|
8236
|
+
},
|
|
7943
8237
|
...answer.unconfirmedServerIds !== void 0 && {
|
|
7944
8238
|
unconfirmedServerIds: answer.unconfirmedServerIds
|
|
7945
|
-
}
|
|
8239
|
+
},
|
|
8240
|
+
// #5030: the incumbent's content binding, so a stale-bound answer
|
|
8241
|
+
// takes the same withholding below as a local one. An incumbent
|
|
8242
|
+
// that sends none reads as not current (`warmAnswerBinding`).
|
|
8243
|
+
binding: warmAnswerBinding(answer)
|
|
7946
8244
|
} : await lspService.touchFile(ctx.filePath, content, {
|
|
7947
8245
|
diagnostics: "document",
|
|
7948
8246
|
collectDiagnostics: true,
|
|
@@ -7975,11 +8273,14 @@ var lspRunner = {
|
|
|
7975
8273
|
])
|
|
7976
8274
|
];
|
|
7977
8275
|
deferredServerIds = touched.deferredServerIds ?? [];
|
|
7978
|
-
|
|
8276
|
+
primaryAnswerStale = readBoundToCurrentDisk(touched) === false;
|
|
8277
|
+
primaryAnswered = touchCompletedConfirmationPolicy(touched) && !primaryAnswerStale;
|
|
8278
|
+
if (primaryAnswerStale) {
|
|
8279
|
+
const namesStaleContributor = diagnosticsInconclusive && touched.inconclusiveReason !== "primary-unavailable";
|
|
7979
8280
|
const unconfirmed = new Set(unconfirmedServerIds);
|
|
7980
8281
|
const currentContentDiags = [];
|
|
7981
8282
|
for (const diagnostic of lspDiags) {
|
|
7982
|
-
if (diagnostic.serverId !== void 0 && !unconfirmed.has(diagnostic.serverId)) {
|
|
8283
|
+
if (namesStaleContributor && diagnostic.serverId !== void 0 && !unconfirmed.has(diagnostic.serverId)) {
|
|
7983
8284
|
currentContentDiags.push(diagnostic);
|
|
7984
8285
|
}
|
|
7985
8286
|
}
|
|
@@ -8036,7 +8337,7 @@ var lspRunner = {
|
|
|
8036
8337
|
if (lspDiags.length === 0) {
|
|
8037
8338
|
if (deferredServerIds.length > 0) {
|
|
8038
8339
|
return {
|
|
8039
|
-
status: "deferred",
|
|
8340
|
+
status: primaryAnswered ? "succeeded" : "deferred",
|
|
8040
8341
|
diagnostics: [],
|
|
8041
8342
|
semantic: "none",
|
|
8042
8343
|
unconfirmedServerIds: [...unconfirmedServerIds],
|
|
@@ -8045,12 +8346,19 @@ var lspRunner = {
|
|
|
8045
8346
|
}
|
|
8046
8347
|
if (unconfirmedServerIds.length > 0) {
|
|
8047
8348
|
return {
|
|
8048
|
-
status: "skipped",
|
|
8349
|
+
status: primaryAnswered ? "succeeded" : "skipped",
|
|
8049
8350
|
diagnostics: [],
|
|
8050
8351
|
semantic: "none",
|
|
8051
8352
|
unconfirmedServerIds: [...unconfirmedServerIds]
|
|
8052
8353
|
};
|
|
8053
8354
|
}
|
|
8355
|
+
if (primaryAnswerStale) {
|
|
8356
|
+
return {
|
|
8357
|
+
status: "skipped",
|
|
8358
|
+
diagnostics: [],
|
|
8359
|
+
semantic: "none"
|
|
8360
|
+
};
|
|
8361
|
+
}
|
|
8054
8362
|
return {
|
|
8055
8363
|
status: "succeeded",
|
|
8056
8364
|
diagnostics: [],
|
|
@@ -8115,9 +8423,19 @@ var lspRunner = {
|
|
|
8115
8423
|
// "failed" here means the file has blocking type errors — the check ran
|
|
8116
8424
|
// fine; findingsResult tags it so it never reads as a runner crash.
|
|
8117
8425
|
...findingsResult(keptDiagnostics, {
|
|
8118
|
-
status: hasErrors ? "failed" : deferredServerIds.length > 0 ? "deferred" : "succeeded",
|
|
8426
|
+
status: hasErrors ? "failed" : deferredServerIds.length > 0 && !primaryAnswered ? "deferred" : "succeeded",
|
|
8119
8427
|
semantic: resultSemantic
|
|
8120
8428
|
}),
|
|
8429
|
+
// #5008: findings a run DOES report do not make it a verdict about the
|
|
8430
|
+
// primary's own recorded blockers when the primary did not answer. A
|
|
8431
|
+
// `failed` run with its own findings is `hasUsableResult`, so without
|
|
8432
|
+
// this flag it would retire them (the inverse cell of the state table),
|
|
8433
|
+
// and a settled collect-later run would too. `inconclusive` is the
|
|
8434
|
+
// touch's own positive evidence that a primary deadline lapsed or no
|
|
8435
|
+
// primary was acquired — a touch that says neither keeps the pre-#5008
|
|
8436
|
+
// reading (a diagnostics-unsupported primary, an incumbent built before the
|
|
8437
|
+
// confirmation field), which is today's behaviour.
|
|
8438
|
+
...diagnosticsInconclusive && { inconclusive: true },
|
|
8121
8439
|
...unconfirmedServerIds.length > 0 && {
|
|
8122
8440
|
unconfirmedServerIds: [...unconfirmedServerIds]
|
|
8123
8441
|
},
|
|
@@ -8132,7 +8450,60 @@ var lspRunner = {
|
|
|
8132
8450
|
var lsp_default = lspRunner;
|
|
8133
8451
|
|
|
8134
8452
|
// dist/clients/dispatch/runners/markdownlint.js
|
|
8453
|
+
import * as path27 from "node:path";
|
|
8454
|
+
|
|
8455
|
+
// dist/clients/dispatch/runners/utils/markdownlint-api.js
|
|
8456
|
+
import * as fs13 from "node:fs";
|
|
8135
8457
|
import * as path26 from "node:path";
|
|
8458
|
+
var PACKAGE_NAME = "markdownlint-cli2";
|
|
8459
|
+
function locateCli2Entry(command) {
|
|
8460
|
+
const shim = /[\\/]/.test(command) ? command : findCommandOnPath(command, process.platform === "win32");
|
|
8461
|
+
if (!shim)
|
|
8462
|
+
return null;
|
|
8463
|
+
const shimDir = path26.dirname(shim);
|
|
8464
|
+
const candidates = [
|
|
8465
|
+
path26.join(shimDir, "..", PACKAGE_NAME),
|
|
8466
|
+
path26.join(shimDir, "node_modules", PACKAGE_NAME)
|
|
8467
|
+
];
|
|
8468
|
+
candidates.push(path26.dirname(realpathOrResolve(shim)));
|
|
8469
|
+
for (const dir of candidates) {
|
|
8470
|
+
try {
|
|
8471
|
+
const manifest = JSON.parse(fs13.readFileSync(path26.join(dir, "package.json"), "utf8"));
|
|
8472
|
+
if (manifest.name !== PACKAGE_NAME)
|
|
8473
|
+
continue;
|
|
8474
|
+
const root = manifest.exports && typeof manifest.exports === "object" ? manifest.exports["."] : manifest.exports;
|
|
8475
|
+
if (typeof root !== "string")
|
|
8476
|
+
continue;
|
|
8477
|
+
const entry = path26.resolve(dir, root);
|
|
8478
|
+
if (fs13.statSync(entry).isFile())
|
|
8479
|
+
return entry;
|
|
8480
|
+
} catch {
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
return null;
|
|
8484
|
+
}
|
|
8485
|
+
function markdownlintNoFixInvocation(options) {
|
|
8486
|
+
const entry = locateCli2Entry(options.command);
|
|
8487
|
+
if (!entry) {
|
|
8488
|
+
recordDegradationOnce({
|
|
8489
|
+
kind: "markdownlint-api-unavailable",
|
|
8490
|
+
subject: options.command,
|
|
8491
|
+
reason: 'no markdownlint-cli2 package sits beside it; linting by spawn, where a project "fix": true can still rewrite the file'
|
|
8492
|
+
});
|
|
8493
|
+
return { command: options.command, args: options.args };
|
|
8494
|
+
}
|
|
8495
|
+
return {
|
|
8496
|
+
command: process.execPath,
|
|
8497
|
+
args: [
|
|
8498
|
+
resolvePackagePath(import.meta.url, "config/markdownlint/run-no-fix.mjs"),
|
|
8499
|
+
entry,
|
|
8500
|
+
options.cwd,
|
|
8501
|
+
...options.args
|
|
8502
|
+
]
|
|
8503
|
+
};
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8506
|
+
// dist/clients/dispatch/runners/markdownlint.js
|
|
8136
8507
|
var markdownlint = createAvailabilityChecker("markdownlint-cli2", ".cmd", [
|
|
8137
8508
|
"--no-globs",
|
|
8138
8509
|
"-"
|
|
@@ -8172,7 +8543,7 @@ var MARKDOWNLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
|
8172
8543
|
]);
|
|
8173
8544
|
function parseMarkdownlintOutput(raw, filePath, cwd) {
|
|
8174
8545
|
const diagnostics = [];
|
|
8175
|
-
const absTarget =
|
|
8546
|
+
const absTarget = path27.resolve(cwd, filePath);
|
|
8176
8547
|
for (const line of raw.split(/\r?\n/)) {
|
|
8177
8548
|
if (!line.trim())
|
|
8178
8549
|
continue;
|
|
@@ -8180,7 +8551,7 @@ function parseMarkdownlintOutput(raw, filePath, cwd) {
|
|
|
8180
8551
|
if (!match)
|
|
8181
8552
|
continue;
|
|
8182
8553
|
const [, reported, lineNum, col, ruleCode, message] = match;
|
|
8183
|
-
if (reported && !pathsEqual(
|
|
8554
|
+
if (reported && !pathsEqual(path27.resolve(cwd, reported), absTarget))
|
|
8184
8555
|
continue;
|
|
8185
8556
|
const ruleName = ruleCode.split("/")[0];
|
|
8186
8557
|
const fixable = MARKDOWNLINT_FIXABLE_RULES.has(ruleName);
|
|
@@ -8224,7 +8595,9 @@ var markdownlintRunner = {
|
|
|
8224
8595
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8225
8596
|
}
|
|
8226
8597
|
const configArgs = markdownlintConfigArgs(cwd);
|
|
8227
|
-
const
|
|
8598
|
+
const args = [...configArgs, ctx.filePath];
|
|
8599
|
+
const invocation = markdownlintNoFixInvocation({ command: cmd, cwd, args });
|
|
8600
|
+
const result = await safeSpawnAsync(invocation.command, invocation.args, {
|
|
8228
8601
|
timeout: 15e3,
|
|
8229
8602
|
cwd
|
|
8230
8603
|
});
|
|
@@ -8254,7 +8627,7 @@ var markdownlintRunner = {
|
|
|
8254
8627
|
var markdownlint_default = markdownlintRunner;
|
|
8255
8628
|
|
|
8256
8629
|
// dist/clients/dispatch/runners/mypy.js
|
|
8257
|
-
import * as
|
|
8630
|
+
import * as path28 from "node:path";
|
|
8258
8631
|
var mypy = createAvailabilityChecker("mypy", "");
|
|
8259
8632
|
var MYPY_EXIT_CODES = { ran: [1, 2] };
|
|
8260
8633
|
function parseMypyOutput(raw, fallbackPath, cwd) {
|
|
@@ -8268,7 +8641,7 @@ function parseMypyOutput(raw, fallbackPath, cwd) {
|
|
|
8268
8641
|
continue;
|
|
8269
8642
|
const severity = level === "error" ? "error" : "warning";
|
|
8270
8643
|
const rule = errorCode ?? "mypy";
|
|
8271
|
-
const filePath = file && file.trim() ?
|
|
8644
|
+
const filePath = file && file.trim() ? path28.isAbsolute(file) ? file : path28.resolve(cwd, file) : fallbackPath;
|
|
8272
8645
|
diagnostics.push({
|
|
8273
8646
|
id: `mypy-${lineNum}-${rule}`,
|
|
8274
8647
|
message: errorCode ? `[${errorCode}] ${message}` : message,
|
|
@@ -8319,7 +8692,7 @@ var mypyRunner = {
|
|
|
8319
8692
|
var mypy_default = mypyRunner;
|
|
8320
8693
|
|
|
8321
8694
|
// dist/clients/dispatch/runners/oxlint.js
|
|
8322
|
-
import * as
|
|
8695
|
+
import * as path29 from "node:path";
|
|
8323
8696
|
var MAX_OXLINT_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
8324
8697
|
var OXLINT_NO_FILES = /* @__PURE__ */ Symbol("oxlint-no-files");
|
|
8325
8698
|
var OXLINT_NO_FILES_UNCONFIRMED = /* @__PURE__ */ Symbol("oxlint-no-files-unconfirmed");
|
|
@@ -8553,9 +8926,9 @@ function parseOxlintJson(raw, filePath, cwd) {
|
|
|
8553
8926
|
if (!Array.isArray(parsed.diagnostics))
|
|
8554
8927
|
return [];
|
|
8555
8928
|
const diagnostics = [];
|
|
8556
|
-
const absTarget =
|
|
8929
|
+
const absTarget = path29.resolve(cwd, filePath);
|
|
8557
8930
|
for (const d of parsed.diagnostics) {
|
|
8558
|
-
if (!d.filename || !pathsEqual(
|
|
8931
|
+
if (!d.filename || !pathsEqual(path29.resolve(cwd, d.filename), absTarget)) {
|
|
8559
8932
|
continue;
|
|
8560
8933
|
}
|
|
8561
8934
|
const rule = extractOxlintRule(d.code);
|
|
@@ -8585,14 +8958,14 @@ function parseOxlintJson(raw, filePath, cwd) {
|
|
|
8585
8958
|
}
|
|
8586
8959
|
function parseOxlintUnix(raw, filePath, cwd) {
|
|
8587
8960
|
const diagnostics = [];
|
|
8588
|
-
const absTarget =
|
|
8961
|
+
const absTarget = path29.resolve(cwd, filePath);
|
|
8589
8962
|
for (const line of raw.split("\n")) {
|
|
8590
8963
|
const match = line.match(/^(.+):(\d+):(\d+):\s*(.+?)\s*\(([^)]+)\)$/);
|
|
8591
8964
|
if (match) {
|
|
8592
8965
|
const [, reportedPath, lineStr, _col, message, rule] = match;
|
|
8593
8966
|
if (!reportedPath || !lineStr || !message || !rule)
|
|
8594
8967
|
continue;
|
|
8595
|
-
if (!pathsEqual(
|
|
8968
|
+
if (!pathsEqual(path29.resolve(cwd, reportedPath), absTarget))
|
|
8596
8969
|
continue;
|
|
8597
8970
|
diagnostics.push({
|
|
8598
8971
|
id: `oxlint-${rule}-${lineStr}`,
|
|
@@ -8611,7 +8984,7 @@ function parseOxlintUnix(raw, filePath, cwd) {
|
|
|
8611
8984
|
var oxlint_default = oxlintRunner;
|
|
8612
8985
|
|
|
8613
8986
|
// dist/clients/dispatch/runners/php-lint.js
|
|
8614
|
-
import * as
|
|
8987
|
+
import * as path30 from "node:path";
|
|
8615
8988
|
var PHP_LINT_EXIT_CODES = { ran: [1, 255] };
|
|
8616
8989
|
var php = createAvailabilityChecker("php", ".exe");
|
|
8617
8990
|
function parsePhpLintOutput(raw, filePath, cwd) {
|
|
@@ -8621,7 +8994,7 @@ function parsePhpLintOutput(raw, filePath, cwd) {
|
|
|
8621
8994
|
const lineMatch = output.match(/on line (\d+)/i);
|
|
8622
8995
|
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
8996
|
const reported = messageMatch?.[2]?.trim();
|
|
8624
|
-
if (reported && !pathsEqual(
|
|
8997
|
+
if (reported && !pathsEqual(path30.resolve(cwd, reported), path30.resolve(cwd, filePath)))
|
|
8625
8998
|
return [];
|
|
8626
8999
|
return [
|
|
8627
9000
|
{
|
|
@@ -8648,7 +9021,7 @@ var phpLintRunner = {
|
|
|
8648
9021
|
const cmd = ctx.analysisRootMode === "adopted" ? resolveAdoptedRootCommand("php", ctx, cwd) : await php.isAvailableAsync(cwd) ? php.getCommand(cwd) : null;
|
|
8649
9022
|
if (!cmd)
|
|
8650
9023
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8651
|
-
const absPath =
|
|
9024
|
+
const absPath = path30.resolve(cwd, ctx.filePath);
|
|
8652
9025
|
const result = await safeSpawnAsync(cmd, ["-l", absPath], {
|
|
8653
9026
|
timeout: 15e3,
|
|
8654
9027
|
cwd
|
|
@@ -8673,7 +9046,7 @@ ${result.stderr ?? ""}`,
|
|
|
8673
9046
|
var php_lint_default = phpLintRunner;
|
|
8674
9047
|
|
|
8675
9048
|
// dist/clients/dispatch/runners/phpstan.js
|
|
8676
|
-
import * as
|
|
9049
|
+
import * as path31 from "node:path";
|
|
8677
9050
|
var PHPSTAN_EXIT_CODES = { ran: [1] };
|
|
8678
9051
|
var phpstan = createAvailabilityChecker("phpstan", ".phar");
|
|
8679
9052
|
function parsePhpstanJson(raw, fallbackPath, cwd) {
|
|
@@ -8681,7 +9054,7 @@ function parsePhpstanJson(raw, fallbackPath, cwd) {
|
|
|
8681
9054
|
const output = JSON.parse(raw);
|
|
8682
9055
|
const diagnostics = [];
|
|
8683
9056
|
for (const [file, fileErrors] of Object.entries(output.files ?? {})) {
|
|
8684
|
-
const filePath = file && file.trim() ?
|
|
9057
|
+
const filePath = file && file.trim() ? path31.isAbsolute(file) ? file : path31.resolve(cwd, file) : fallbackPath;
|
|
8685
9058
|
for (const err of fileErrors?.messages ?? []) {
|
|
8686
9059
|
diagnostics.push({
|
|
8687
9060
|
id: `phpstan:${err.line ?? 1}:${err.message.slice(0, 40)}`,
|
|
@@ -8740,7 +9113,7 @@ var phpstanRunner = {
|
|
|
8740
9113
|
const cmd = await resolvePhpstan(cwd);
|
|
8741
9114
|
if (!cmd)
|
|
8742
9115
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
8743
|
-
const absPath =
|
|
9116
|
+
const absPath = path31.resolve(cwd, ctx.filePath);
|
|
8744
9117
|
const result = await safeSpawnAsync(cmd, ["analyse", "--error-format=json", "--no-progress", absPath], { timeout: 3e4, cwd });
|
|
8745
9118
|
const run = parseToolRun("phpstan", { result, exitCodes: PHPSTAN_EXIT_CODES }, (out) => parsePhpstanJson(out, ctx.filePath, cwd), { parseOutput: result.stdout ?? "" });
|
|
8746
9119
|
if (run.skipped)
|
|
@@ -8758,7 +9131,7 @@ var phpstanRunner = {
|
|
|
8758
9131
|
var phpstan_default = phpstanRunner;
|
|
8759
9132
|
|
|
8760
9133
|
// dist/clients/dispatch/runners/prisma-validate.js
|
|
8761
|
-
import * as
|
|
9134
|
+
import * as path32 from "node:path";
|
|
8762
9135
|
var PRISMA_VALIDATION_REPORT = /\bValidation Error Count:\s*\d+/;
|
|
8763
9136
|
function parsePrismaValidateOutput(raw, filePath) {
|
|
8764
9137
|
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 +9162,7 @@ var prismaValidateRunner = {
|
|
|
8789
9162
|
async run(ctx) {
|
|
8790
9163
|
const cwd = resolveRunnerCwd(ctx, "prisma-validate");
|
|
8791
9164
|
const resolved = await resolveLocalFirstAsync("prisma", cwd);
|
|
8792
|
-
const absPath =
|
|
9165
|
+
const absPath = path32.resolve(cwd, ctx.filePath);
|
|
8793
9166
|
const result = await safeSpawnAsync(resolved.cmd, [...resolved.args, "validate", "--schema", absPath], {
|
|
8794
9167
|
timeout: 2e4,
|
|
8795
9168
|
// ONE neutral-cwd seam for npx fallbacks (#4193, #4268 acceptance 3),
|
|
@@ -8826,9 +9199,8 @@ ${result.stderr ?? ""}`;
|
|
|
8826
9199
|
var prisma_validate_default = prismaValidateRunner;
|
|
8827
9200
|
|
|
8828
9201
|
// dist/clients/dispatch/runners/psscriptanalyzer.js
|
|
8829
|
-
import * as
|
|
8830
|
-
import * as
|
|
8831
|
-
import * as path32 from "node:path";
|
|
9202
|
+
import * as fs14 from "node:fs/promises";
|
|
9203
|
+
import * as path33 from "node:path";
|
|
8832
9204
|
var PS_SCRIPT = `
|
|
8833
9205
|
param([string]$FilePath)
|
|
8834
9206
|
Import-Module PSScriptAnalyzer -ErrorAction Stop
|
|
@@ -9020,9 +9392,9 @@ var psScriptAnalyzerRunner = {
|
|
|
9020
9392
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9021
9393
|
}
|
|
9022
9394
|
const cwd = resolveRunnerCwd(ctx, "psscriptanalyzer");
|
|
9023
|
-
const absPath =
|
|
9024
|
-
const tmpScript =
|
|
9025
|
-
await
|
|
9395
|
+
const absPath = path33.resolve(cwd, ctx.filePath);
|
|
9396
|
+
const tmpScript = path33.join(scannerReportParentDir(), `pi-lens-psa-${process.pid}.ps1`);
|
|
9397
|
+
await fs14.writeFile(tmpScript, PS_SCRIPT, "utf-8");
|
|
9026
9398
|
try {
|
|
9027
9399
|
const sampler = startHostStallSampler();
|
|
9028
9400
|
const startedAt = Date.now();
|
|
@@ -9122,7 +9494,7 @@ var psScriptAnalyzerRunner = {
|
|
|
9122
9494
|
semantic: hasErrors ? "blocking" : "warning"
|
|
9123
9495
|
});
|
|
9124
9496
|
} finally {
|
|
9125
|
-
await
|
|
9497
|
+
await fs14.unlink(tmpScript).catch(() => {
|
|
9126
9498
|
});
|
|
9127
9499
|
}
|
|
9128
9500
|
}
|
|
@@ -9152,7 +9524,7 @@ var pyrightRunner = {
|
|
|
9152
9524
|
cmd = installedPath;
|
|
9153
9525
|
}
|
|
9154
9526
|
if (!cmd) {
|
|
9155
|
-
const { findCommandAsync } = await import("./chunk-
|
|
9527
|
+
const { findCommandAsync } = await import("./chunk-3NPWO5UO.js");
|
|
9156
9528
|
const foundCmd = await findCommandAsync("pyright");
|
|
9157
9529
|
if (foundCmd)
|
|
9158
9530
|
cmd = foundCmd;
|
|
@@ -9249,7 +9621,7 @@ function parsePyrightOutput(data, _filePath) {
|
|
|
9249
9621
|
var pyright_default = pyrightRunner;
|
|
9250
9622
|
|
|
9251
9623
|
// dist/clients/dispatch/runners/rubocop.js
|
|
9252
|
-
import * as
|
|
9624
|
+
import * as path34 from "node:path";
|
|
9253
9625
|
var SEVERITY_MAP = {
|
|
9254
9626
|
fatal: "error",
|
|
9255
9627
|
error: "error",
|
|
@@ -9262,9 +9634,9 @@ function parseRubocopJson(raw, filePath, cwd) {
|
|
|
9262
9634
|
const output = JSON.parse(raw);
|
|
9263
9635
|
const autofix = getAutofixCapability("rubocop");
|
|
9264
9636
|
const diagnostics = [];
|
|
9265
|
-
const absTarget =
|
|
9637
|
+
const absTarget = path34.resolve(cwd, filePath);
|
|
9266
9638
|
for (const file of output.files) {
|
|
9267
|
-
if (file.path && !pathsEqual(
|
|
9639
|
+
if (file.path && !pathsEqual(path34.resolve(cwd, file.path), absTarget))
|
|
9268
9640
|
continue;
|
|
9269
9641
|
for (const offense of file.offenses) {
|
|
9270
9642
|
const severity = SEVERITY_MAP[offense.severity] ?? "warning";
|
|
@@ -9370,7 +9742,15 @@ var ruffRunner = {
|
|
|
9370
9742
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9371
9743
|
}
|
|
9372
9744
|
const configArgs = ruffConfigArgs(cwd);
|
|
9373
|
-
const checkResult = await safeSpawnAsync(cmd, [
|
|
9745
|
+
const checkResult = await safeSpawnAsync(cmd, [
|
|
9746
|
+
"check",
|
|
9747
|
+
"--no-fix",
|
|
9748
|
+
"--no-fix-only",
|
|
9749
|
+
"--output-format",
|
|
9750
|
+
"json",
|
|
9751
|
+
...configArgs,
|
|
9752
|
+
ctx.filePath
|
|
9753
|
+
], { cwd, timeout: 3e4 });
|
|
9374
9754
|
const raw = stripAnsi(checkResult.stdout + checkResult.stderr);
|
|
9375
9755
|
const run = parseToolRun("ruff", { result: checkResult, output: raw, exitCodes: { ran: [1, 2] } }, (output) => {
|
|
9376
9756
|
const diagnostics = parseRuffJson(output, ctx.filePath);
|
|
@@ -9389,7 +9769,7 @@ var ruffRunner = {
|
|
|
9389
9769
|
var ruff_default = ruffRunner;
|
|
9390
9770
|
|
|
9391
9771
|
// dist/clients/dispatch/runners/rust-clippy.js
|
|
9392
|
-
import { isAbsolute as
|
|
9772
|
+
import { isAbsolute as isAbsolute4, resolve as resolve32 } from "node:path";
|
|
9393
9773
|
var CLIPPY_PROBE_BUDGET_MS = 8e3;
|
|
9394
9774
|
var clippyProbeRevision = 0;
|
|
9395
9775
|
var makeClippyProbe = (cargoExe, flightKeyComponent = cargoExe) => createCwdCachedProbe((cwd) => safeSpawnAsync(cargoExe, ["clippy", "--version"], {
|
|
@@ -9463,8 +9843,8 @@ var rustClippyRunner = {
|
|
|
9463
9843
|
return false;
|
|
9464
9844
|
}
|
|
9465
9845
|
});
|
|
9466
|
-
const absEdited =
|
|
9467
|
-
const diagnostics = allDiagnostics.filter((d) => pathsEqual(
|
|
9846
|
+
const absEdited = resolve32(ctx.filePath);
|
|
9847
|
+
const diagnostics = allDiagnostics.filter((d) => pathsEqual(resolve32(cargoDir, d.filePath), absEdited));
|
|
9468
9848
|
const hasBlocking = diagnostics.some((d) => d.semantic === "blocking");
|
|
9469
9849
|
const semantic = hasBlocking ? "blocking" : diagnostics.length > 0 ? "warning" : "none";
|
|
9470
9850
|
if (result.error || result.failure) {
|
|
@@ -9523,7 +9903,7 @@ function parseClippyOutput(raw, fallbackPath, cargoDir) {
|
|
|
9523
9903
|
continue;
|
|
9524
9904
|
const fixableSpan = findMachineApplicableSpan(spans);
|
|
9525
9905
|
const rawFile = span.file || span.file_name;
|
|
9526
|
-
const filePath = rawFile ? cargoDir && !
|
|
9906
|
+
const filePath = rawFile ? cargoDir && !isAbsolute4(rawFile) ? resolve32(cargoDir, rawFile) : rawFile : fallbackPath;
|
|
9527
9907
|
const normalizedSeverity = normalizeClippyLevel(message.level);
|
|
9528
9908
|
diagnostics.push({
|
|
9529
9909
|
id: `clippy-${message.code?.code || "unknown"}`,
|
|
@@ -9548,9 +9928,8 @@ var rust_clippy_default = rustClippyRunner;
|
|
|
9548
9928
|
|
|
9549
9929
|
// dist/clients/dispatch/runners/spotbugs.js
|
|
9550
9930
|
import { randomUUID } from "node:crypto";
|
|
9551
|
-
import * as
|
|
9552
|
-
import * as
|
|
9553
|
-
import * as path34 from "node:path";
|
|
9931
|
+
import * as fs15 from "node:fs";
|
|
9932
|
+
import * as path35 from "node:path";
|
|
9554
9933
|
var java = createAvailabilityChecker("java", ".exe", ["-version"]);
|
|
9555
9934
|
var spotbugs = createAvailabilityChecker("spotbugs", ".bat", ["-version"]);
|
|
9556
9935
|
var MAX_DIAGNOSTICS = 50;
|
|
@@ -9566,18 +9945,18 @@ function classesSignature(classesDir) {
|
|
|
9566
9945
|
break;
|
|
9567
9946
|
let entries;
|
|
9568
9947
|
try {
|
|
9569
|
-
entries =
|
|
9948
|
+
entries = fs15.readdirSync(dir, { withFileTypes: true });
|
|
9570
9949
|
} catch {
|
|
9571
9950
|
continue;
|
|
9572
9951
|
}
|
|
9573
9952
|
for (const entry of entries) {
|
|
9574
|
-
const full =
|
|
9953
|
+
const full = path35.join(dir, entry.name);
|
|
9575
9954
|
if (entry.isDirectory()) {
|
|
9576
9955
|
stack.push(full);
|
|
9577
9956
|
} else if (entry.isFile() && entry.name.endsWith(".class")) {
|
|
9578
9957
|
count++;
|
|
9579
9958
|
try {
|
|
9580
|
-
const m =
|
|
9959
|
+
const m = fs15.statSync(full).mtimeMs;
|
|
9581
9960
|
if (m > newest)
|
|
9582
9961
|
newest = m;
|
|
9583
9962
|
} catch {
|
|
@@ -9662,7 +10041,7 @@ function parseSpotbugsXml(raw) {
|
|
|
9662
10041
|
const message = shortMsg || longMsg || type;
|
|
9663
10042
|
const fixSuggestion = longMsg ? firstSentence(longMsg) : void 0;
|
|
9664
10043
|
diagnostics.push({
|
|
9665
|
-
id: `spotbugs:${type}:${
|
|
10044
|
+
id: `spotbugs:${type}:${path35.basename(filePath)}:${line}:${index}`,
|
|
9666
10045
|
message: `[${type}] ${message}`,
|
|
9667
10046
|
filePath,
|
|
9668
10047
|
line,
|
|
@@ -9712,7 +10091,7 @@ var spotbugsRunner = {
|
|
|
9712
10091
|
const cmd = await resolveAvailableOrInstall(spotbugs, "spotbugs", cwd);
|
|
9713
10092
|
if (!cmd)
|
|
9714
10093
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
9715
|
-
const tmpXml =
|
|
10094
|
+
const tmpXml = path35.join(scannerReportParentDir(), `pi-lens-spotbugs-${process.pid}-${randomUUID()}.xml`);
|
|
9716
10095
|
const result = await safeSpawnAsync(cmd, [
|
|
9717
10096
|
"-textui",
|
|
9718
10097
|
"-xml:withMessages",
|
|
@@ -9724,7 +10103,7 @@ var spotbugsRunner = {
|
|
|
9724
10103
|
], { cwd, timeout: 12e4 });
|
|
9725
10104
|
let xml = "";
|
|
9726
10105
|
try {
|
|
9727
|
-
xml =
|
|
10106
|
+
xml = fs15.readFileSync(tmpXml, "utf8");
|
|
9728
10107
|
} catch {
|
|
9729
10108
|
if (result.error || (result.status ?? 0) > 1) {
|
|
9730
10109
|
return {
|
|
@@ -9737,7 +10116,7 @@ var spotbugsRunner = {
|
|
|
9737
10116
|
return { status: "succeeded", diagnostics: [], semantic: "none" };
|
|
9738
10117
|
} finally {
|
|
9739
10118
|
try {
|
|
9740
|
-
|
|
10119
|
+
fs15.rmSync(tmpXml, { force: true });
|
|
9741
10120
|
} catch {
|
|
9742
10121
|
}
|
|
9743
10122
|
}
|
|
@@ -9753,62 +10132,15 @@ var spotbugsRunner = {
|
|
|
9753
10132
|
var spotbugs_default = spotbugsRunner;
|
|
9754
10133
|
|
|
9755
10134
|
// dist/clients/dispatch/runners/shellcheck.js
|
|
9756
|
-
import * as
|
|
9757
|
-
import * as path35 from "node:path";
|
|
10135
|
+
import * as path36 from "node:path";
|
|
9758
10136
|
var shellcheck = createAvailabilityChecker("shellcheck", ".exe");
|
|
9759
10137
|
var SHELLCHECK_EXIT_CODES = { ran: [1] };
|
|
9760
|
-
var SHELLCHECK_DIALECTS = [
|
|
9761
|
-
"sh",
|
|
9762
|
-
"bash",
|
|
9763
|
-
"dash",
|
|
9764
|
-
"ksh",
|
|
9765
|
-
"busybox"
|
|
9766
|
-
];
|
|
9767
|
-
var SHEBANG_REGEXP = /^#!(.+)/;
|
|
9768
|
-
var SHEBANG_INTERPRETER_REGEXP = /^[/](?:[^ /]+[/])*(?:env +(?:-S +)?)?([^ /]+)/;
|
|
9769
|
-
var SHELLCHECK_SHELL_OR_EMPTY_REGEXP = /^\s*(?:#\s*shellcheck\s+(?:\S+\s+)*shell=(\w+)|#|$)/;
|
|
9770
|
-
var DIALECT_SNIFF_BYTES = 4096;
|
|
9771
|
-
function parseShebang(content) {
|
|
9772
|
-
const match = SHEBANG_REGEXP.exec(content);
|
|
9773
|
-
if (!match || !match[1])
|
|
9774
|
-
return null;
|
|
9775
|
-
const interpreter = SHEBANG_INTERPRETER_REGEXP.exec(match[1].trim());
|
|
9776
|
-
if (!interpreter || !interpreter[1])
|
|
9777
|
-
return null;
|
|
9778
|
-
return interpreter[1].trim();
|
|
9779
|
-
}
|
|
9780
|
-
function parseShellDirective(content) {
|
|
9781
|
-
for (const line of content.split("\n")) {
|
|
9782
|
-
const match = SHELLCHECK_SHELL_OR_EMPTY_REGEXP.exec(line);
|
|
9783
|
-
if (match === null)
|
|
9784
|
-
break;
|
|
9785
|
-
if (match[1])
|
|
9786
|
-
return match[1].trim();
|
|
9787
|
-
}
|
|
9788
|
-
return null;
|
|
9789
|
-
}
|
|
9790
|
-
function resolveShellFileDialect(filePath) {
|
|
9791
|
-
let content;
|
|
9792
|
-
try {
|
|
9793
|
-
content = fs15.readFileSync(filePath)?.subarray(0, DIALECT_SNIFF_BYTES).toString("utf8");
|
|
9794
|
-
} catch {
|
|
9795
|
-
return { shebang: null, directive: null, dialect: "bash" };
|
|
9796
|
-
}
|
|
9797
|
-
const directive = parseShellDirective(content);
|
|
9798
|
-
const shebang = parseShebang(content);
|
|
9799
|
-
const parsed = directive ?? shebang ?? (path35.extname(filePath).toLowerCase() === ".zsh" ? "zsh" : null);
|
|
9800
|
-
return {
|
|
9801
|
-
shebang,
|
|
9802
|
-
directive,
|
|
9803
|
-
dialect: parsed ?? "bash"
|
|
9804
|
-
};
|
|
9805
|
-
}
|
|
9806
10138
|
function findShellcheckConfig(cwd) {
|
|
9807
10139
|
return findLocalToolConfig(cwd, [".shellcheckrc"]);
|
|
9808
10140
|
}
|
|
9809
10141
|
function parseShellcheckOutput(raw, filePath, cwd) {
|
|
9810
10142
|
const diagnostics = [];
|
|
9811
|
-
const absTarget =
|
|
10143
|
+
const absTarget = path36.resolve(cwd, filePath);
|
|
9812
10144
|
if (!raw.trim()) {
|
|
9813
10145
|
return diagnostics;
|
|
9814
10146
|
}
|
|
@@ -9820,7 +10152,7 @@ function parseShellcheckOutput(raw, filePath, cwd) {
|
|
|
9820
10152
|
for (const item of parsed) {
|
|
9821
10153
|
if (!item.message || !item.line)
|
|
9822
10154
|
continue;
|
|
9823
|
-
if (!item.file || !pathsEqual(
|
|
10155
|
+
if (!item.file || !pathsEqual(path36.resolve(cwd, item.file), absTarget))
|
|
9824
10156
|
continue;
|
|
9825
10157
|
const severityMap = {
|
|
9826
10158
|
error: "error",
|
|
@@ -9874,7 +10206,7 @@ var shellcheckRunner = {
|
|
|
9874
10206
|
};
|
|
9875
10207
|
}
|
|
9876
10208
|
const dialectInfo = resolveShellFileDialect(ctx.filePath);
|
|
9877
|
-
if (!
|
|
10209
|
+
if (!isShellcheckDialectSupported(dialectInfo.dialect)) {
|
|
9878
10210
|
return {
|
|
9879
10211
|
status: "skipped",
|
|
9880
10212
|
diagnostics: [],
|
|
@@ -9920,7 +10252,7 @@ var shellcheckRunner = {
|
|
|
9920
10252
|
var shellcheck_default = shellcheckRunner;
|
|
9921
10253
|
|
|
9922
10254
|
// dist/clients/dispatch/runners/fish-indent.js
|
|
9923
|
-
import { resolve as
|
|
10255
|
+
import { resolve as resolve34 } from "node:path";
|
|
9924
10256
|
var fishIndent = createAvailabilityChecker("fish_indent");
|
|
9925
10257
|
var fish = createAvailabilityChecker("fish");
|
|
9926
10258
|
var SYNTAX_STEP = "fish-syntax-check";
|
|
@@ -9930,8 +10262,8 @@ function parseSyntaxErrors(output, filePath, cwd) {
|
|
|
9930
10262
|
const [, reported, lineText, message] = line.match(/^(.+) \(line (\d+)\): (.+)$/) ?? [];
|
|
9931
10263
|
if (!reported || !lineText || !message)
|
|
9932
10264
|
continue;
|
|
9933
|
-
const wanted =
|
|
9934
|
-
if (!pathsEqual(
|
|
10265
|
+
const wanted = resolve34(cwd, filePath);
|
|
10266
|
+
if (!pathsEqual(resolve34(cwd, reported), wanted) && !(reported.startsWith("~/") && wanted.endsWith(reported.slice(1))))
|
|
9935
10267
|
continue;
|
|
9936
10268
|
const lineNumber = Number(lineText);
|
|
9937
10269
|
diagnostics.push({
|
|
@@ -9991,7 +10323,7 @@ var fishIndentRunner = {
|
|
|
9991
10323
|
if (didNotRun)
|
|
9992
10324
|
return didNotRun;
|
|
9993
10325
|
}
|
|
9994
|
-
const stderrLine = (result.stderr ?? "").split("\n").find((l) => l.trim() && !pathsEqual(
|
|
10326
|
+
const stderrLine = (result.stderr ?? "").split("\n").find((l) => l.trim() && !pathsEqual(resolve34(cwd, l.trim()), resolve34(cwd, ctx.filePath)));
|
|
9995
10327
|
if (stderrLine) {
|
|
9996
10328
|
const lineMatch = stderrLine.match(/\(line\s+(\d+)\)/);
|
|
9997
10329
|
const line = lineMatch ? Number(lineMatch[1]) : 1;
|
|
@@ -10118,12 +10450,12 @@ var shfmtRunner = {
|
|
|
10118
10450
|
var shfmt_default = shfmtRunner;
|
|
10119
10451
|
|
|
10120
10452
|
// dist/clients/dispatch/runners/spellcheck.js
|
|
10121
|
-
import * as
|
|
10453
|
+
import * as path37 from "node:path";
|
|
10122
10454
|
var typos = createAvailabilityChecker("typos", ".exe");
|
|
10123
10455
|
var TYPOS_EXIT_CODES = { ran: [2] };
|
|
10124
10456
|
function parseTyposOutput(raw, filePath, cwd) {
|
|
10125
10457
|
const diagnostics = [];
|
|
10126
|
-
const absTarget =
|
|
10458
|
+
const absTarget = path37.resolve(cwd, filePath);
|
|
10127
10459
|
if (!raw.trim()) {
|
|
10128
10460
|
return diagnostics;
|
|
10129
10461
|
}
|
|
@@ -10133,7 +10465,7 @@ function parseTyposOutput(raw, filePath, cwd) {
|
|
|
10133
10465
|
const parsed = JSON.parse(line);
|
|
10134
10466
|
if (!parsed.typo || !parsed.line_num)
|
|
10135
10467
|
continue;
|
|
10136
|
-
if (parsed.path && !pathsEqual(
|
|
10468
|
+
if (parsed.path && !pathsEqual(path37.resolve(cwd, parsed.path), absTarget))
|
|
10137
10469
|
continue;
|
|
10138
10470
|
const corrections = parsed.corrections?.join(", ") || "no suggestions";
|
|
10139
10471
|
const message = `Typo: "${parsed.typo}" \u2192 ${corrections}`;
|
|
@@ -10191,7 +10523,7 @@ var spellcheckRunner = {
|
|
|
10191
10523
|
var spellcheck_default = spellcheckRunner;
|
|
10192
10524
|
|
|
10193
10525
|
// dist/clients/dispatch/runners/sqlfluff.js
|
|
10194
|
-
import * as
|
|
10526
|
+
import * as path38 from "node:path";
|
|
10195
10527
|
var sqlfluff = createAvailabilityChecker("sqlfluff", ".exe");
|
|
10196
10528
|
var SQLFLUFF_EXIT_CODES = { ran: [1] };
|
|
10197
10529
|
var SQLFLUFF_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
@@ -10246,9 +10578,9 @@ function parseSqlfluffOutput(raw, filePath, cwd) {
|
|
|
10246
10578
|
if (!Array.isArray(parsed))
|
|
10247
10579
|
return [];
|
|
10248
10580
|
const diagnostics = [];
|
|
10249
|
-
const absTarget =
|
|
10581
|
+
const absTarget = path38.resolve(cwd, filePath);
|
|
10250
10582
|
for (const item of parsed) {
|
|
10251
|
-
if (item.filepath && !pathsEqual(
|
|
10583
|
+
if (item.filepath && !pathsEqual(path38.resolve(cwd, item.filepath), absTarget))
|
|
10252
10584
|
continue;
|
|
10253
10585
|
for (const v of item.violations ?? []) {
|
|
10254
10586
|
if (!v.description)
|
|
@@ -10323,7 +10655,7 @@ var sqlfluffRunner = {
|
|
|
10323
10655
|
var sqlfluff_default = sqlfluffRunner;
|
|
10324
10656
|
|
|
10325
10657
|
// dist/clients/dispatch/runners/stylelint.js
|
|
10326
|
-
import * as
|
|
10658
|
+
import * as path39 from "node:path";
|
|
10327
10659
|
var stylelint = createAvailabilityChecker("stylelint", ".cmd");
|
|
10328
10660
|
var STYLELINT_EXIT_CODES = { ran: [1, 2] };
|
|
10329
10661
|
function stylelintReport(stdout, stderr) {
|
|
@@ -10368,9 +10700,9 @@ function parseStylelintJson(raw, filePath, cwd) {
|
|
|
10368
10700
|
try {
|
|
10369
10701
|
const results = JSON.parse(raw);
|
|
10370
10702
|
const diagnostics = [];
|
|
10371
|
-
const absTarget =
|
|
10703
|
+
const absTarget = path39.resolve(cwd, filePath);
|
|
10372
10704
|
for (const result of results) {
|
|
10373
|
-
if (result.source && !pathsEqual(
|
|
10705
|
+
if (result.source && !pathsEqual(path39.resolve(cwd, result.source), absTarget))
|
|
10374
10706
|
continue;
|
|
10375
10707
|
for (const w of result.warnings) {
|
|
10376
10708
|
const severity = w.severity === "error" ? "error" : "warning";
|
|
@@ -10406,7 +10738,7 @@ var stylelintRunner = {
|
|
|
10406
10738
|
if (policy && !policy.preferredRunners.includes("stylelint")) {
|
|
10407
10739
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10408
10740
|
}
|
|
10409
|
-
const fileDir =
|
|
10741
|
+
const fileDir = path39.dirname(path39.resolve(cwd, ctx.filePath));
|
|
10410
10742
|
const hasConfig = hasStylelintConfig(fileDir) || hasStylelintConfig(cwd);
|
|
10411
10743
|
if (!hasConfig) {
|
|
10412
10744
|
logRunnerAdvisoryOnce(ctx, "stylelint", cwd, "stylelint: no config detected, running with default rules");
|
|
@@ -10436,7 +10768,7 @@ var stylelintRunner = {
|
|
|
10436
10768
|
var stylelint_default = stylelintRunner;
|
|
10437
10769
|
|
|
10438
10770
|
// dist/clients/dispatch/runners/swiftlint.js
|
|
10439
|
-
import * as
|
|
10771
|
+
import * as path40 from "node:path";
|
|
10440
10772
|
var swiftlint = createAvailabilityChecker("swiftlint", ".exe");
|
|
10441
10773
|
var SWIFTLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
|
|
10442
10774
|
"closing_brace",
|
|
@@ -10499,7 +10831,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
|
|
|
10499
10831
|
const diagnostics = [];
|
|
10500
10832
|
if (!raw.trim())
|
|
10501
10833
|
return diagnostics;
|
|
10502
|
-
const absTarget =
|
|
10834
|
+
const absTarget = path40.resolve(cwd, filePath);
|
|
10503
10835
|
try {
|
|
10504
10836
|
const parsed = JSON.parse(raw);
|
|
10505
10837
|
if (!Array.isArray(parsed))
|
|
@@ -10507,7 +10839,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
|
|
|
10507
10839
|
for (const item of parsed) {
|
|
10508
10840
|
if (!item.reason)
|
|
10509
10841
|
continue;
|
|
10510
|
-
if (item.file && !pathsEqual(
|
|
10842
|
+
if (item.file && !pathsEqual(path40.resolve(cwd, item.file), absTarget))
|
|
10511
10843
|
continue;
|
|
10512
10844
|
const severityMap = {
|
|
10513
10845
|
error: "error",
|
|
@@ -10552,7 +10884,7 @@ var swiftlintRunner = {
|
|
|
10552
10884
|
}
|
|
10553
10885
|
if (!cmd)
|
|
10554
10886
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10555
|
-
const result = await safeSpawnAsync(cmd, ["--reporter", "json",
|
|
10887
|
+
const result = await safeSpawnAsync(cmd, ["--reporter", "json", path40.resolve(cwd, ctx.filePath)], { cwd, timeout: 15e3 });
|
|
10556
10888
|
const run = parseToolRun("swiftlint", {
|
|
10557
10889
|
result,
|
|
10558
10890
|
// EXIT TABLE (SwiftLint 0.56 measured fixture): 0 clean; 1 findings; 2 error; other nonzero rejected.
|
|
@@ -10574,7 +10906,7 @@ var swiftlintRunner = {
|
|
|
10574
10906
|
var swiftlint_default = swiftlintRunner;
|
|
10575
10907
|
|
|
10576
10908
|
// dist/clients/dispatch/runners/taplo.js
|
|
10577
|
-
import * as
|
|
10909
|
+
import * as path41 from "node:path";
|
|
10578
10910
|
var taplo = createAvailabilityChecker("taplo", ".exe");
|
|
10579
10911
|
var TAPLO_EXIT_CODES = { ran: [1] };
|
|
10580
10912
|
var HEADER_PATTERN = /^\s*(error|warning):(.*)$/;
|
|
@@ -10582,7 +10914,7 @@ var LOCATION_LEAD = "\u250C\u2500";
|
|
|
10582
10914
|
var LOCATION_PATTERN = /^\s*┌─\s+(.+?):(\d+):(\d+)$/;
|
|
10583
10915
|
function parseTaploOutput(raw, filePath, cwd) {
|
|
10584
10916
|
const diagnostics = [];
|
|
10585
|
-
const absTarget =
|
|
10917
|
+
const absTarget = path41.resolve(cwd, filePath);
|
|
10586
10918
|
const lines = stripAnsi(raw ?? "").split(/\r?\n/);
|
|
10587
10919
|
for (let i = 0; i < lines.length; i++) {
|
|
10588
10920
|
const header = HEADER_PATTERN.exec(lines[i].trimEnd());
|
|
@@ -10600,7 +10932,7 @@ function parseTaploOutput(raw, filePath, cwd) {
|
|
|
10600
10932
|
const location = LOCATION_PATTERN.exec(lines[j].trimEnd());
|
|
10601
10933
|
if (!location)
|
|
10602
10934
|
continue;
|
|
10603
|
-
if (!pathsEqual(
|
|
10935
|
+
if (!pathsEqual(path41.resolve(cwd, location[1].trim()), absTarget))
|
|
10604
10936
|
continue;
|
|
10605
10937
|
line = Number.parseInt(location[2], 10) || 1;
|
|
10606
10938
|
column = Number.parseInt(location[3], 10) || 1;
|
|
@@ -10662,7 +10994,7 @@ var taploRunner = {
|
|
|
10662
10994
|
}
|
|
10663
10995
|
if (!cmd)
|
|
10664
10996
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10665
|
-
const absPath =
|
|
10997
|
+
const absPath = path41.resolve(cwd, ctx.filePath);
|
|
10666
10998
|
const result = await safeSpawnAsync(cmd, ["check", "--colors", "never", absPath], { cwd, timeout: 15e3 });
|
|
10667
10999
|
const raw = result.stderr?.trim() ? result.stderr : result.stdout ?? "";
|
|
10668
11000
|
const run = parseToolRun("taplo", { result, output: raw, exitCodes: TAPLO_EXIT_CODES }, (out) => parseTaploOutput(out, ctx.filePath, cwd), { skipWhenParsedNothing: true });
|
|
@@ -10681,7 +11013,7 @@ var taploRunner = {
|
|
|
10681
11013
|
var taplo_default = taploRunner;
|
|
10682
11014
|
|
|
10683
11015
|
// dist/clients/dispatch/runners/terragrunt.js
|
|
10684
|
-
import * as
|
|
11016
|
+
import * as path42 from "node:path";
|
|
10685
11017
|
var terragrunt = createAvailabilityChecker("terragrunt", ".exe");
|
|
10686
11018
|
function normalizeSeverity(raw) {
|
|
10687
11019
|
if (typeof raw === "number")
|
|
@@ -10700,7 +11032,7 @@ function toRawDiagnostics(parsed) {
|
|
|
10700
11032
|
return [];
|
|
10701
11033
|
return invalidFiles.flatMap((f) => Array.isArray(f?.diagnostics) ? f.diagnostics : []);
|
|
10702
11034
|
}
|
|
10703
|
-
function parseTerragruntOutput(raw, filePath, absPath =
|
|
11035
|
+
function parseTerragruntOutput(raw, filePath, absPath = path42.resolve(filePath)) {
|
|
10704
11036
|
if (!raw.trim())
|
|
10705
11037
|
return [];
|
|
10706
11038
|
let parsed;
|
|
@@ -10709,13 +11041,13 @@ function parseTerragruntOutput(raw, filePath, absPath = path41.resolve(filePath)
|
|
|
10709
11041
|
} catch {
|
|
10710
11042
|
return [];
|
|
10711
11043
|
}
|
|
10712
|
-
const unitDir =
|
|
11044
|
+
const unitDir = path42.dirname(absPath);
|
|
10713
11045
|
const diagnostics = [];
|
|
10714
11046
|
for (const d of toRawDiagnostics(parsed)) {
|
|
10715
11047
|
if (!d || typeof d !== "object")
|
|
10716
11048
|
continue;
|
|
10717
11049
|
const diagFile = d.range?.filename;
|
|
10718
|
-
if (diagFile && !pathsEqual(
|
|
11050
|
+
if (diagFile && !pathsEqual(path42.resolve(unitDir, diagFile), absPath))
|
|
10719
11051
|
continue;
|
|
10720
11052
|
const line = d.range?.start?.line ?? 1;
|
|
10721
11053
|
const column = d.range?.start?.column ?? 1;
|
|
@@ -10761,8 +11093,8 @@ var terragruntRunner = {
|
|
|
10761
11093
|
}
|
|
10762
11094
|
if (!cmd)
|
|
10763
11095
|
return SKIPPED3;
|
|
10764
|
-
const absPath =
|
|
10765
|
-
const fileDir =
|
|
11096
|
+
const absPath = path42.resolve(cwd, ctx.filePath);
|
|
11097
|
+
const fileDir = path42.dirname(absPath);
|
|
10766
11098
|
const result = await safeSpawnAsync(cmd, ["hcl", "validate", "--json", "--non-interactive"], { cwd: fileDir, timeout: 3e4 });
|
|
10767
11099
|
if (spawnFailedWithNoOutput(result))
|
|
10768
11100
|
return faultSkip("did-not-run");
|
|
@@ -10788,22 +11120,22 @@ var terragruntRunner = {
|
|
|
10788
11120
|
var terragrunt_default = terragruntRunner;
|
|
10789
11121
|
|
|
10790
11122
|
// dist/clients/dispatch/runners/tflint.js
|
|
10791
|
-
import * as
|
|
11123
|
+
import * as path43 from "node:path";
|
|
10792
11124
|
var tflint = createAvailabilityChecker("tflint", ".exe");
|
|
10793
11125
|
var TFLINT_CONFIG = ".tflint.hcl";
|
|
10794
11126
|
function findTflintConfig(fileDir) {
|
|
10795
11127
|
if (process.env.TFLINT_CONFIG_FILE)
|
|
10796
11128
|
return null;
|
|
10797
11129
|
const dir = findNearestDirWithAnyBasename(fileDir, [TFLINT_CONFIG]);
|
|
10798
|
-
return dir ?
|
|
11130
|
+
return dir ? path43.join(dir, TFLINT_CONFIG) : null;
|
|
10799
11131
|
}
|
|
10800
11132
|
function parseTflintOutput(raw, filePath, toolCwd) {
|
|
10801
11133
|
try {
|
|
10802
11134
|
const parsed = JSON.parse(raw);
|
|
10803
11135
|
const issues = parsed.issues ?? [];
|
|
10804
|
-
const absTarget =
|
|
11136
|
+
const absTarget = path43.resolve(toolCwd, filePath);
|
|
10805
11137
|
return issues.flatMap((issue) => {
|
|
10806
|
-
if (issue.range?.filename && !pathsEqual(
|
|
11138
|
+
if (issue.range?.filename && !pathsEqual(path43.resolve(toolCwd, issue.range.filename), absTarget))
|
|
10807
11139
|
return [];
|
|
10808
11140
|
const severity = issue.rule.severity === "error" ? "error" : "warning";
|
|
10809
11141
|
return [
|
|
@@ -10846,12 +11178,12 @@ var tflintRunner = {
|
|
|
10846
11178
|
}
|
|
10847
11179
|
if (!cmd)
|
|
10848
11180
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
10849
|
-
const absPath =
|
|
10850
|
-
const fileDir =
|
|
11181
|
+
const absPath = path43.resolve(cwd, ctx.filePath);
|
|
11182
|
+
const fileDir = path43.dirname(absPath);
|
|
10851
11183
|
const args = [
|
|
10852
11184
|
"--format=json",
|
|
10853
11185
|
"--no-color",
|
|
10854
|
-
`--filter=${
|
|
11186
|
+
`--filter=${path43.basename(absPath)}`
|
|
10855
11187
|
];
|
|
10856
11188
|
const configPath = findTflintConfig(fileDir);
|
|
10857
11189
|
if (configPath)
|
|
@@ -10887,7 +11219,7 @@ var tflint_default = tflintRunner;
|
|
|
10887
11219
|
|
|
10888
11220
|
// dist/clients/dispatch/runners/trivy-config.js
|
|
10889
11221
|
import * as fs16 from "node:fs";
|
|
10890
|
-
import * as
|
|
11222
|
+
import * as path44 from "node:path";
|
|
10891
11223
|
var trivy2 = createAvailabilityChecker("trivy", ".exe");
|
|
10892
11224
|
function looksLikeKubernetesManifest(content) {
|
|
10893
11225
|
for (const doc of content.split(/^---\s*$/m)) {
|
|
@@ -10924,12 +11256,12 @@ function parseTrivyConfigOutput(raw, filePath, cwd = process.cwd()) {
|
|
|
10924
11256
|
if (!Array.isArray(results))
|
|
10925
11257
|
return [];
|
|
10926
11258
|
const diagnostics = [];
|
|
10927
|
-
const absTarget =
|
|
11259
|
+
const absTarget = path44.resolve(cwd, filePath);
|
|
10928
11260
|
for (const resultEntry of results) {
|
|
10929
11261
|
if (!resultEntry || typeof resultEntry !== "object")
|
|
10930
11262
|
continue;
|
|
10931
11263
|
const target = resultEntry.Target;
|
|
10932
|
-
if (typeof target !== "string" || !pathsEqual(
|
|
11264
|
+
if (typeof target !== "string" || !pathsEqual(path44.resolve(cwd, target), absTarget))
|
|
10933
11265
|
continue;
|
|
10934
11266
|
const rows = resultEntry.Misconfigurations;
|
|
10935
11267
|
if (!Array.isArray(rows))
|
|
@@ -10971,9 +11303,14 @@ var trivyConfigRunner = {
|
|
|
10971
11303
|
async run(ctx) {
|
|
10972
11304
|
const cwd = resolveRunnerCwd(ctx, "trivy-config");
|
|
10973
11305
|
if (!isTrivyEnabled(cwd)) {
|
|
10974
|
-
return {
|
|
11306
|
+
return {
|
|
11307
|
+
status: "skipped",
|
|
11308
|
+
diagnostics: [],
|
|
11309
|
+
semantic: "none",
|
|
11310
|
+
skipReason: "not-enabled"
|
|
11311
|
+
};
|
|
10975
11312
|
}
|
|
10976
|
-
const absPath =
|
|
11313
|
+
const absPath = path44.resolve(cwd, ctx.filePath);
|
|
10977
11314
|
if (ctx.kind === "yaml" || ctx.kind === "json") {
|
|
10978
11315
|
let content = "";
|
|
10979
11316
|
try {
|
|
@@ -11045,7 +11382,7 @@ var trivyConfigRunner = {
|
|
|
11045
11382
|
var trivy_config_default = trivyConfigRunner;
|
|
11046
11383
|
|
|
11047
11384
|
// dist/clients/dispatch/runners/vale.js
|
|
11048
|
-
import * as
|
|
11385
|
+
import * as path45 from "node:path";
|
|
11049
11386
|
var vale = createAvailabilityChecker("vale", ".exe");
|
|
11050
11387
|
function findValeConfig(cwd) {
|
|
11051
11388
|
return findLocalToolConfig(cwd, [".vale.ini"]);
|
|
@@ -11054,7 +11391,7 @@ function parseValeOutput(raw, filePath, cwd) {
|
|
|
11054
11391
|
const diagnostics = [];
|
|
11055
11392
|
if (!raw.trim())
|
|
11056
11393
|
return diagnostics;
|
|
11057
|
-
const absTarget =
|
|
11394
|
+
const absTarget = path45.resolve(cwd, filePath);
|
|
11058
11395
|
try {
|
|
11059
11396
|
const parsed = JSON.parse(raw);
|
|
11060
11397
|
if (!parsed || typeof parsed !== "object")
|
|
@@ -11062,7 +11399,7 @@ function parseValeOutput(raw, filePath, cwd) {
|
|
|
11062
11399
|
for (const [reported, alerts] of Object.entries(parsed)) {
|
|
11063
11400
|
if (!Array.isArray(alerts))
|
|
11064
11401
|
continue;
|
|
11065
|
-
if (reported && !pathsEqual(
|
|
11402
|
+
if (reported && !pathsEqual(path45.resolve(cwd, reported), absTarget))
|
|
11066
11403
|
continue;
|
|
11067
11404
|
for (const alert of alerts) {
|
|
11068
11405
|
if (!alert.Message)
|
|
@@ -11133,11 +11470,11 @@ var valeRunner = {
|
|
|
11133
11470
|
var vale_default = valeRunner;
|
|
11134
11471
|
|
|
11135
11472
|
// dist/clients/dispatch/runners/tree-sitter.js
|
|
11136
|
-
import * as
|
|
11473
|
+
import * as path47 from "node:path";
|
|
11137
11474
|
|
|
11138
11475
|
// dist/clients/cache/rule-cache.js
|
|
11139
11476
|
import * as fs17 from "node:fs";
|
|
11140
|
-
import * as
|
|
11477
|
+
import * as path46 from "node:path";
|
|
11141
11478
|
var CACHE_VERSION = "v7";
|
|
11142
11479
|
function reportBundledRulesRootHealth() {
|
|
11143
11480
|
reportBundledResourceDirHealth("tree-sitter-queries-dir-missing", BUNDLED_QUERIES_ROOT, getBundledQueriesRootHealth(), "bundled tree-sitter query rules");
|
|
@@ -11149,8 +11486,8 @@ var RuleCache = class {
|
|
|
11149
11486
|
constructor(language, rootDir = process.cwd()) {
|
|
11150
11487
|
this.language = language;
|
|
11151
11488
|
reportBundledRulesRootHealth();
|
|
11152
|
-
this.cacheDir =
|
|
11153
|
-
this.cacheFile =
|
|
11489
|
+
this.cacheDir = path46.join(getProjectDataDir(rootDir), "cache");
|
|
11490
|
+
this.cacheFile = path46.join(this.cacheDir, `${language}-rules-${CACHE_VERSION}.json`);
|
|
11154
11491
|
}
|
|
11155
11492
|
ensureCacheDir() {
|
|
11156
11493
|
if (!fs17.existsSync(this.cacheDir)) {
|
|
@@ -11197,7 +11534,7 @@ var RuleCache = class {
|
|
|
11197
11534
|
// on their own — nothing ever read or removed them again once the version
|
|
11198
11535
|
// bumped. Delete every sibling for this language that isn't the current file.
|
|
11199
11536
|
pruneStaleVersions() {
|
|
11200
|
-
const currentName =
|
|
11537
|
+
const currentName = path46.basename(this.cacheFile);
|
|
11201
11538
|
const pattern = new RegExp(`^${this.language}-rules-v\\d+\\.json$`);
|
|
11202
11539
|
let dirents;
|
|
11203
11540
|
try {
|
|
@@ -11209,7 +11546,7 @@ var RuleCache = class {
|
|
|
11209
11546
|
if (name === currentName || !pattern.test(name))
|
|
11210
11547
|
continue;
|
|
11211
11548
|
try {
|
|
11212
|
-
fs17.unlinkSync(
|
|
11549
|
+
fs17.unlinkSync(path46.join(this.cacheDir, name));
|
|
11213
11550
|
} catch {
|
|
11214
11551
|
}
|
|
11215
11552
|
}
|
|
@@ -11531,7 +11868,7 @@ var treeSitterRunner = {
|
|
|
11531
11868
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
11532
11869
|
}
|
|
11533
11870
|
const filePath = ctx.filePath;
|
|
11534
|
-
const ext =
|
|
11871
|
+
const ext = path47.extname(filePath).toLowerCase();
|
|
11535
11872
|
const languageId = resolveTreeSitterLanguage(filePath);
|
|
11536
11873
|
if (!languageId) {
|
|
11537
11874
|
logTreeSitter({
|
|
@@ -11765,18 +12102,18 @@ var treeSitterRunner = {
|
|
|
11765
12102
|
var tree_sitter_default = treeSitterRunner;
|
|
11766
12103
|
|
|
11767
12104
|
// dist/clients/dispatch/runners/yamllint.js
|
|
11768
|
-
import * as
|
|
12105
|
+
import * as path48 from "node:path";
|
|
11769
12106
|
var yamllint = createAvailabilityChecker("yamllint", ".exe");
|
|
11770
12107
|
function parseYamllintParsable(raw, filePath, cwd) {
|
|
11771
12108
|
const diagnostics = [];
|
|
11772
|
-
const absTarget =
|
|
12109
|
+
const absTarget = path48.resolve(cwd, filePath);
|
|
11773
12110
|
for (const line of raw.split(/\r?\n/)) {
|
|
11774
12111
|
if (!line.trim())
|
|
11775
12112
|
continue;
|
|
11776
12113
|
const match = line.match(/^(.*?):(\d+):(\d+):\s*\[(error|warning)\]\s*(.*?)\s*\(([^)]+)\)\s*$/i);
|
|
11777
12114
|
if (!match)
|
|
11778
12115
|
continue;
|
|
11779
|
-
if (!pathsEqual(
|
|
12116
|
+
if (!pathsEqual(path48.resolve(cwd, match[1]), absTarget))
|
|
11780
12117
|
continue;
|
|
11781
12118
|
const severity = match[4].toLowerCase() === "error" ? "error" : "warning";
|
|
11782
12119
|
diagnostics.push({
|
|
@@ -11841,17 +12178,17 @@ var yamllintRunner = {
|
|
|
11841
12178
|
var yamllint_default = yamllintRunner;
|
|
11842
12179
|
|
|
11843
12180
|
// dist/clients/dispatch/runners/zig-check.js
|
|
11844
|
-
import * as
|
|
12181
|
+
import * as path49 from "node:path";
|
|
11845
12182
|
var zig = createAvailabilityChecker("zig", ".exe", ["version"]);
|
|
11846
12183
|
function parseZigOutput(raw, filePath, cwd) {
|
|
11847
12184
|
const diagnostics = [];
|
|
11848
|
-
const absTarget =
|
|
12185
|
+
const absTarget = path49.resolve(cwd, filePath);
|
|
11849
12186
|
for (const line of raw.split(/\r?\n/)) {
|
|
11850
12187
|
const match = line.match(/^(.*?):(\d+):(\d+):\s*(error|warning|note):\s*(.+)$/);
|
|
11851
12188
|
if (!match)
|
|
11852
12189
|
continue;
|
|
11853
12190
|
const [, rawFile, lineStr, colStr, level, message] = match;
|
|
11854
|
-
if (!pathsEqual(
|
|
12191
|
+
if (!pathsEqual(path49.resolve(cwd, rawFile.trim()), absTarget))
|
|
11855
12192
|
continue;
|
|
11856
12193
|
const severity = level === "error" ? "error" : "warning";
|
|
11857
12194
|
diagnostics.push({
|
|
@@ -11882,7 +12219,7 @@ var zigCheckRunner = {
|
|
|
11882
12219
|
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
11883
12220
|
}
|
|
11884
12221
|
const cmd = zig.getCommand(cwd);
|
|
11885
|
-
const absPath =
|
|
12222
|
+
const absPath = path49.resolve(cwd, ctx.filePath);
|
|
11886
12223
|
const result = await safeSpawnAsync(cmd, ["build-exe", absPath, "-fno-emit-bin"], { cwd, timeout: 3e4 });
|
|
11887
12224
|
if (result.error && !result.stdout && !result.stderr) {
|
|
11888
12225
|
return faultSkip("did-not-run");
|
|
@@ -12173,8 +12510,10 @@ var DEFAULT_HIGH_COMPLEXITY_DEPTH_THRESHOLD = 6;
|
|
|
12173
12510
|
var highComplexityRule = {
|
|
12174
12511
|
id: "high-complexity",
|
|
12175
12512
|
requires: ["file.functionSummaries"],
|
|
12513
|
+
// The function-facts population. Python, Go and Rust wait for the
|
|
12514
|
+
// per-language thresholds (#5089).
|
|
12176
12515
|
appliesTo(ctx) {
|
|
12177
|
-
return
|
|
12516
|
+
return isJstsFactFile(ctx.filePath);
|
|
12178
12517
|
},
|
|
12179
12518
|
evaluate(ctx, store) {
|
|
12180
12519
|
const fns = store.getFileFact(ctx.filePath, "file.functionSummaries") ?? [];
|
|
@@ -12813,7 +13152,8 @@ var CASCADE_GRAPH_KINDS = /* @__PURE__ */ new Set([
|
|
|
12813
13152
|
"go",
|
|
12814
13153
|
"rust",
|
|
12815
13154
|
"ruby",
|
|
12816
|
-
"cxx"
|
|
13155
|
+
"cxx",
|
|
13156
|
+
"java"
|
|
12817
13157
|
]);
|
|
12818
13158
|
var IMPLICIT_SCOPE_NEIGHBOR_CAP = MAX_FILES * 2;
|
|
12819
13159
|
async function dispatchLintWithResult(filePath, cwd, pi, modifiedRanges, logContext, options) {
|
|
@@ -12829,31 +13169,11 @@ async function dispatchLintWithResult(filePath, cwd, pi, modifiedRanges, logCont
|
|
|
12829
13169
|
try {
|
|
12830
13170
|
const kind = ctx.kind;
|
|
12831
13171
|
if (!kind) {
|
|
12832
|
-
return {
|
|
12833
|
-
diagnostics: [],
|
|
12834
|
-
blockers: [],
|
|
12835
|
-
warnings: [],
|
|
12836
|
-
baselineWarningCount: 0,
|
|
12837
|
-
fixed: [],
|
|
12838
|
-
resolvedCount: 0,
|
|
12839
|
-
output: "",
|
|
12840
|
-
blockerOutput: "",
|
|
12841
|
-
hasBlockers: false
|
|
12842
|
-
};
|
|
13172
|
+
return emptyDispatchResult(unchecked(NO_ANALYZER_REASON, { inapplicable: true }));
|
|
12843
13173
|
}
|
|
12844
13174
|
const groups = withSpotbugsGroup(kind, getDispatchGroupsForKind(kind, pi), ctx);
|
|
12845
13175
|
if (groups.length === 0) {
|
|
12846
|
-
return
|
|
12847
|
-
diagnostics: [],
|
|
12848
|
-
blockers: [],
|
|
12849
|
-
warnings: [],
|
|
12850
|
-
baselineWarningCount: 0,
|
|
12851
|
-
fixed: [],
|
|
12852
|
-
resolvedCount: 0,
|
|
12853
|
-
output: "",
|
|
12854
|
-
blockerOutput: "",
|
|
12855
|
-
hasBlockers: false
|
|
12856
|
-
};
|
|
13176
|
+
return skipGeneratedFile(ctx) ?? emptyDispatchResult(unchecked(noPrimaryCheckerReason(!pi.getFlag("no-lsp"))));
|
|
12857
13177
|
}
|
|
12858
13178
|
await runProviders(ctx);
|
|
12859
13179
|
const result = await dispatchForFile(
|
|
@@ -12882,7 +13202,7 @@ async function getAvailableRunners(filePath) {
|
|
|
12882
13202
|
const kind = detectFileKind(filePath);
|
|
12883
13203
|
if (!kind)
|
|
12884
13204
|
return [];
|
|
12885
|
-
const normalizedPath = filePath
|
|
13205
|
+
const normalizedPath = toPosix(filePath);
|
|
12886
13206
|
const pathForFilter = normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`;
|
|
12887
13207
|
const runners = sessionRunnerRegistry.getForKind(kind, pathForFilter);
|
|
12888
13208
|
return runners.map((r) => r.id);
|
|
@@ -12959,7 +13279,7 @@ function usableWarmWordIndex(index) {
|
|
|
12959
13279
|
return index?.forward ? index : void 0;
|
|
12960
13280
|
}
|
|
12961
13281
|
function acquireWarmWordIndex(cwd) {
|
|
12962
|
-
const key2 =
|
|
13282
|
+
const key2 = path50.resolve(cwd);
|
|
12963
13283
|
let entry = warmWordIndexes.get(key2);
|
|
12964
13284
|
if (!entry) {
|
|
12965
13285
|
const snapshot = loadProjectSnapshot(key2);
|
|
@@ -12997,7 +13317,7 @@ function adoptPublishedWarmWordIndex(cwd, published, trigger) {
|
|
|
12997
13317
|
const index = usableWarmWordIndex(published);
|
|
12998
13318
|
if (!index)
|
|
12999
13319
|
return;
|
|
13000
|
-
const key2 =
|
|
13320
|
+
const key2 = path50.resolve(cwd);
|
|
13001
13321
|
const entry = warmWordIndexes.get(key2);
|
|
13002
13322
|
if (!entry || entry.index)
|
|
13003
13323
|
return;
|
|
@@ -13087,7 +13407,7 @@ async function warmLspForFile(absPath, host) {
|
|
|
13087
13407
|
}
|
|
13088
13408
|
}
|
|
13089
13409
|
async function analyzeFile(filePath, cwd, options = {}) {
|
|
13090
|
-
const absPath =
|
|
13410
|
+
const absPath = path50.isAbsolute(filePath) ? filePath : path50.resolve(cwd, filePath);
|
|
13091
13411
|
const host = createMcpHost({ "no-delta": true, ...options.flags }, cwd);
|
|
13092
13412
|
const observedAt = Date.now();
|
|
13093
13413
|
const analysisRootMode = resolveAnalysisRoot(absPath, cwd);
|
|
@@ -13107,7 +13427,14 @@ async function analyzeFile(filePath, cwd, options = {}) {
|
|
|
13107
13427
|
});
|
|
13108
13428
|
const durationMs = Date.now() - start;
|
|
13109
13429
|
if (options.record !== false) {
|
|
13110
|
-
recordDiagnostics(
|
|
13430
|
+
recordDiagnostics(
|
|
13431
|
+
normalizeMapKey(absPath),
|
|
13432
|
+
result.diagnostics,
|
|
13433
|
+
void 0,
|
|
13434
|
+
observedAt,
|
|
13435
|
+
// #5258: the footer reads the same verdict the dispatch gave.
|
|
13436
|
+
widgetUncheckedReason(result.verdict)
|
|
13437
|
+
);
|
|
13111
13438
|
if (result.diagnostics.length > 0) {
|
|
13112
13439
|
getDiagnosticTracker().trackShown(result.diagnostics);
|
|
13113
13440
|
}
|
|
@@ -13219,7 +13546,8 @@ export {
|
|
|
13219
13546
|
applyRulePolicy,
|
|
13220
13547
|
convertLspDiagnostics,
|
|
13221
13548
|
applyFindingPolicy,
|
|
13222
|
-
|
|
13549
|
+
applyFindingPolicyByOwner,
|
|
13550
|
+
loadProjectRulePolicy,
|
|
13223
13551
|
inlineBlockerIdentities,
|
|
13224
13552
|
applyPushedFindingPolicy,
|
|
13225
13553
|
applyPushedFindingPolicyByFile,
|
|
@@ -13235,6 +13563,7 @@ export {
|
|
|
13235
13563
|
resetPendingRunnerFindings,
|
|
13236
13564
|
pendingRunnerFindingsSize,
|
|
13237
13565
|
laneCopyStandsFor,
|
|
13566
|
+
disabledRunnersOf,
|
|
13238
13567
|
DELTA_UNUSED_PROMOTION_NOTE,
|
|
13239
13568
|
formatDiagnostics,
|
|
13240
13569
|
createDispatchContext,
|