pi-lens 4.4.7 → 4.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +149 -0
- package/README.md +12 -2
- package/config/markdownlint/run-no-fix.mjs +36 -0
- package/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
- package/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
- package/dist/chunk-2TS4GLOJ.js +31 -0
- package/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
- package/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
- package/dist/chunk-3JAHQBSY.js +27 -0
- package/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
- package/dist/chunk-447YZL4S.js +25 -0
- package/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
- package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
- package/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
- package/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
- package/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
- package/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
- package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
- package/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
- package/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
- package/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
- package/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
- package/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
- package/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
- package/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
- package/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
- package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
- package/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
- package/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
- package/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
- package/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
- package/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
- package/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
- package/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
- package/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
- package/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
- package/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
- package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
- package/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
- package/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
- package/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
- package/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
- package/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
- package/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
- package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
- package/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
- package/dist/chunk-GGYOZWHW.js +27 -0
- package/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
- package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
- package/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
- package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
- package/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
- package/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
- package/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
- package/dist/chunk-IE5D3RA5.js +58 -0
- package/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
- package/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
- package/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
- package/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
- package/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
- package/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
- package/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
- package/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
- package/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
- package/dist/chunk-LPYTPNOJ.js +22 -0
- package/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
- package/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
- package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
- package/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
- package/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
- package/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
- package/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
- package/dist/chunk-OFNMHPBT.js +89 -0
- package/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
- package/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
- package/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
- package/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
- package/dist/chunk-PKLB2XJL.js +8 -0
- package/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
- package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
- package/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
- package/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
- package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
- package/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
- package/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
- package/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
- package/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
- package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
- package/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
- package/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
- package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
- package/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
- package/dist/chunk-UYXV5NIS.js +20 -0
- package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
- package/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
- package/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
- package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
- package/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
- package/dist/chunk-W3BGKBBK.js +27 -0
- package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
- package/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
- package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
- package/dist/chunk-WXUDRAG6.js +24 -0
- package/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
- package/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
- package/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
- package/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
- package/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
- package/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
- package/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
- package/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
- package/dist/chunk-ZONZ6YY3.js +74 -0
- package/dist/chunk-ZSM35JF4.js +30 -0
- package/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
- package/dist/index.js +6993 -5396
- package/dist/mcp/analyze-cli.js +10 -10
- package/dist/mcp/cli.js +44 -42
- package/dist/mcp/server.js +1627 -504
- package/dist/mcp/worker.js +62 -61
- package/dist/probes/installer.js +20 -19
- package/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/docs/agent-tools.md +18 -8
- package/docs/alignment-families.md +29 -0
- package/docs/ast-grep_rules_catalog.md +6 -4
- package/docs/ci-bot-pr-checks.md +126 -0
- package/docs/configuration.md +99 -3
- package/docs/defect-shapes.md +55 -12
- package/docs/engineering-principles.md +27 -2
- package/docs/features.md +2 -2
- package/docs/invariants/git-guard-host.md +7 -3
- package/docs/invariants/language-config.md +15 -4
- package/docs/invariants/lsp-trust-exec.md +16 -2
- package/docs/invariants/paths-os.md +4 -2
- package/docs/lsp-capability-matrix.md +119 -39
- package/docs/merge-queue-rollout.md +1 -1
- package/docs/pi-lens-fixer.md +24 -17
- package/docs/pi-lens-merge-policy.md +20 -11
- package/docs/pi-lens-monitor.md +9 -0
- package/docs/pi-lens-orchestration.md +4 -1
- package/docs/pi-lens-reviewer.md +5 -5
- package/docs/pi-lens-subagent.md +6 -3
- package/docs/public-api-stability.md +18 -2
- package/docs/schema/pi-lens-config-v1.json +10 -0
- package/docs/settings.md +10 -6
- package/docs/word-index.md +17 -5
- package/package.json +5 -3
- package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
- package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
- package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
- package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
- package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
- package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
- package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
- package/dist/chunk-46TNM7XZ.js +0 -88
- package/dist/chunk-72OKUXSD.js +0 -31
- package/dist/chunk-7GLOLOSH.js +0 -57
- package/dist/chunk-AKUUMGD5.js +0 -26
- package/dist/chunk-ASUXV767.js +0 -22
- package/dist/chunk-CTADOKYM.js +0 -25
- package/dist/chunk-JJ2RRESP.js +0 -58
- package/dist/chunk-LSC3VADM.js +0 -23
- package/dist/chunk-SHLDT3OI.js +0 -27
- package/dist/chunk-UF7RTZSO.js +0 -27
- package/dist/chunk-W4WP2ERB.js +0 -30
- package/dist/chunk-YES5CACN.js +0 -73
|
@@ -19,11 +19,14 @@ acceptance surface quoted from that run's log. Any self-bound inside the lane
|
|
|
19
19
|
must sit below the job cap by a stated margin so the loud-failure path is
|
|
20
20
|
reachable.
|
|
21
21
|
|
|
22
|
-
Every PR body
|
|
23
|
-
`##
|
|
24
|
-
`##
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
Every PR body has `## Summary` (at most three sentences),
|
|
23
|
+
`## Notes for the reviewer` (at most five bullets), `## Change outline`, and
|
|
24
|
+
`## Proof and checks`, which holds `### Tests`, `### Class sweep`,
|
|
25
|
+
`### Observability`, and `### Fold check`, plus the conditional sections the
|
|
26
|
+
template lists. The change outline is the changed symbol's caller/callee tree
|
|
27
|
+
with `+`/`-` on moved lines; include only structural views that changed.
|
|
28
|
+
`scripts/check-pr-body.mjs` caps visible text at 5000 characters and each code
|
|
29
|
+
fence at 20 lines (#5003).
|
|
27
30
|
|
|
28
31
|
## The loop, per PR
|
|
29
32
|
|
|
@@ -209,7 +212,7 @@ issue filed without one is a triage defect, not a shortcut.
|
|
|
209
212
|
**Merge bar (user, 2026-10-18).** A PR merges when no HIGH finding is open and
|
|
210
213
|
every gating check is green on the exact head. Each MEDIUM or LOW finding
|
|
211
214
|
either folds into the same PR or becomes an accepted residual: the PR body
|
|
212
|
-
lists it under
|
|
215
|
+
lists it under `### Accepted residuals`, named `p3` with its severity and live
|
|
213
216
|
population (for example `p3 (MEDIUM, live 0): <the gap>`), so the gap keeps a
|
|
214
217
|
priority without an issue.
|
|
215
218
|
A residual never becomes a follow-up issue. File an issue only for p2 or
|
|
@@ -221,10 +224,16 @@ reopen the round.
|
|
|
221
224
|
**Known gaps (user, 2026-10-19).** An open p3 issue is an accepted known gap,
|
|
222
225
|
not backlog. The orchestrator closes it as not planned with the `known-gap`
|
|
223
226
|
label and lists it under its seam on the pinned tracker #4626. When a PR
|
|
224
|
-
merges, its
|
|
227
|
+
merges, its `### Accepted residuals` lines join the same tracker under their
|
|
225
228
|
seam. A known gap reopens as p2 when it turns material: a live wrong result,
|
|
226
229
|
data loss, a hang, or a leak with no bound.
|
|
227
230
|
|
|
231
|
+
**Ideas go on the tracker (user, 2026-10-31).** A rule candidate, research idea
|
|
232
|
+
or optional slice that no lane will start is never filed as a p3 issue. It goes
|
|
233
|
+
straight onto the pinned known-gaps tracker under its seam. On 2026-10-31 five
|
|
234
|
+
such issues were filed from research passes (#5083, #5091, #5093, #5094,
|
|
235
|
+
#5096); three were closed onto #4835.
|
|
236
|
+
|
|
228
237
|
Every reviewer **follow-up issue** generalization verdict that meets that bar is
|
|
229
238
|
filed and assigned to a seam group on the tracking queue in the same turn. At each regroup, scan
|
|
230
239
|
merged PRs for subset-shaped changes that lack a generalization verdict.
|
|
@@ -312,7 +321,7 @@ operator's private notes, so a different orchestrator can run the same train.
|
|
|
312
321
|
| a change that touches identifier uses of a glossary-retired synonym | run `tests/config/glossary-synonym-sweep.test.ts` on the head AND on the merge with `origin/master`, then re-pin in the PR from the sweep's own `UNPINNED`/`STALE` output — #3279, #3283, #3284, #3288 |
|
|
313
322
|
| a new `vi.mock` in a test file | run `tests/config/vi-mock-export-sweep.test.ts`; whole-module mocks of a production module must spread `importOriginal` — PR #3268's CI red, fixed by trailing commit `621d61c5c` |
|
|
314
323
|
| a changelog fragment | front matter `section: <Section>` plus `audience: user` or `audience: internal` and exactly one top-level entry; new user entries open with a bold lead of at most 100 characters (refs excluded), never `CHANGELOG.md`, validated by `node scripts/check-changelog-fragments.mjs` — PR #3268 r1 shipped `category:` and a paragraph |
|
|
315
|
-
| a PR body | the header gate:
|
|
324
|
+
| a PR body | the header gate: `## Summary`, `## Notes for the reviewer`, `## Change outline`, plus Tests / Class sweep / Fold check / Observability, inside the caps; run `node scripts/check-pr-body.mjs --lint-local` before pushing — three PRs this week needed orchestrator body edits |
|
|
316
325
|
| a whole-tree docs restructure of `AGENTS.md` | every governance test that reads `AGENTS.md`, with markers on their own lines — PR #3265 r1 |
|
|
317
326
|
| a raw poll in a test | the flake-shape ratchet; the fix is the governed wait, never a header admission — #2781 r1 |
|
|
318
327
|
| a new, renamed or deleted rule file under `rules/` | `npm run docs:rule-catalogs` and commit the generated catalog; `tests/scripts/rule-catalogs.test.ts` is a strict consumer of every rule file, not of rule ids — #3214 r1 |
|
|
@@ -554,7 +563,7 @@ operator's private notes, so a different orchestrator can run the same train.
|
|
|
554
563
|
DETECTION lesson in one line: which verification layer caught it and which
|
|
555
564
|
layer SHOULD have caught it earlier and at what cost. The accepted layer
|
|
556
565
|
words are the `DETECTION_LAYERS` list exported by `scripts/check-pr-body.mjs`,
|
|
557
|
-
which the
|
|
566
|
+
which the `### Detection` body check reads; the prose does not restate them.
|
|
558
567
|
`nightly` may carry its workflow as `nightly:<workflow>`. A PR that only
|
|
559
568
|
references a `bug` or `nightly-drift` issue, in its body or its title, owes
|
|
560
569
|
the section too (#4968: the 2026-10-29 audit found 24 bug-linked PRs merged
|
|
@@ -723,7 +732,7 @@ Each row cost a lane at least once; the prose above carries the record.
|
|
|
723
732
|
| Reviewing a branch head that no longer carries master | Reviewer merges origin/master into the scratch checkout first; CONFLICTING is not reviewable (#2808 vs #2795) |
|
|
724
733
|
| Pushing docs, config or data straight to master without preflight | `npm run preflight` on the exact tree first; three master reds on 2026-09-09 |
|
|
725
734
|
| Nudging a capped small-model lane more than once | One continuation, then reassign to the strongest model (GLM lanes, 2026-09-09) |
|
|
726
|
-
| Waiting on CI for a bot-authored PR (github-actions nightly refresh) | A GITHUB_TOKEN push fires no `pull_request` run
|
|
735
|
+
| Waiting on CI for a bot-authored PR (github-actions nightly refresh) | A GITHUB_TOKEN push fires no `pull_request` run. Since #5062 the opening job dispatches `ci.yml` and `lint.yml` on the bot branch (`docs/ci-bot-pr-checks.md`); a bot PR still BLOCKED with every check absent means that dispatch step failed or did not run: read the nightly's `Open refresh PRs` job, then close/reopen to fire the checks (#2801, 2026-09-09) |
|
|
727
736
|
| Leaving a design question to the fixer (where evidence comes from, which identity rule) | Decide it in the brief; #2900 oscillated three rounds (walker → findings → walker again) until round 4's brief fixed the evidence source (2026-09-10) |
|
|
728
737
|
| Guessing a lane's branch name when writing a brief | Read `gh pr view N --json headRefName` in the same command that builds the brief; plegma refused two dispatches on invented refs (#2908, #2898; 2026-09-10) |
|
|
729
738
|
| `git add -A -- . ':!<ignored file>'` in a chained command | The exclude pathspec on an IGNORED path makes `git add` exit 1 and the chain stops before the commit; use plain `git add -A` (ignored files never stage) and verify the index afterwards (2026-09-10, twice) |
|
|
@@ -849,7 +858,7 @@ Each row cost a lane at least once; the prose above carries the record.
|
|
|
849
858
|
| Pushing to a PR branch while a fix round is queued against its old head | Merging master into #4594 staled the queued round's lease; the worker pushed a diverged copy to its handle branch (plegma #723). The orchestrator's push-verify refuses while a round still publishes to that branch. |
|
|
850
859
|
| Resuming a reviewer without naming the deliverable | The resumed verifies of #4575 and #4593 inherited report names that did not match the brief, so the hand-back missed the report. Every resumed round names its `deliverables` explicitly. |
|
|
851
860
|
| Calling an issue "blocked on a release" without reproducing it on master | #4554 waited on a release; 58 runs on master did not reproduce it, and it closed crediting #4563. Reproduce on master before naming a blocker. |
|
|
852
|
-
| Bolding a residual bullet (`- **p3 (LOW, live 0):**`) under
|
|
861
|
+
| Bolding a residual bullet (`- **p3 (LOW, live 0):**`) under `### Accepted residuals` | The tracker parser read only a bare `p3`, so #4832's three residuals were recorded as "none" (2026-10-25). `known-gap-add.sh` now reads the bold form, pinned by its test case (g) |
|
|
853
862
|
| Planning a tracker layout before measuring the platform's limits | An 11-issue pinned split was proposed and dispatched; GitHub pins 3 issues per repository, and the assumed 65k body cap was already exceeded by #4626 at 91k (2026-10-25). Measure the limit first, then plan |
|
|
854
863
|
| Pasting the `claude-lane.sh` header into a brief | The header began `Worktree (created, ...):`, the brief guard wants `Worktree:`, and two dispatches were refused (2026-10-25). The header now starts with `Worktree:`, pinned by `test-claude-lane-header.sh` |
|
|
855
864
|
| Linting a PR body in the main checkout | The main checkout sits on another branch, so citations resolved against the wrong tree; three edits needed a hand-built head tree (2026-10-25). `pr-body.sh edit` without `--tree` now builds a temp tree at the PR head |
|
package/docs/pi-lens-monitor.md
CHANGED
|
@@ -135,6 +135,15 @@ the requested window.
|
|
|
135
135
|
`filePath` even for a formatter that never settles or an Escape; a chained
|
|
136
136
|
file with no later `*_format_late_resync` row on the same `filePath` is the
|
|
137
137
|
anti-join to report.
|
|
138
|
+
`withheld_blocker_late_advisory` (#5108) is the same hand-off for a
|
|
139
|
+
tool_result handler the host bound abandoned while a run without authorship
|
|
140
|
+
withheld blockers: one row per abandoned call that queued its disclosure
|
|
141
|
+
for the calling session's next context call, with `metadata.notices` (the
|
|
142
|
+
withheld lines; the advisory shows five) and `metadata.budgetMs`, and the
|
|
143
|
+
tool name as `filePath`. The row is written even when the advisory never
|
|
144
|
+
reaches the agent: a full queue or a session that ended before its next
|
|
145
|
+
context call drops it as the `agent-advisory-dropped` degradation (`cap`
|
|
146
|
+
or `scope-retired`), so report the pair.
|
|
138
147
|
**Session decisions** (#3873; each row is one lifecycle event, none is per
|
|
139
148
|
occurrence in a loop): `session_handoff_slot` (`op`: `stashed`, `replaced`,
|
|
140
149
|
`taken`, `key-mismatch-left` (once per stale slot), `forwarded`,
|
|
@@ -31,9 +31,12 @@ per-PR loop itself is `docs/pi-lens-merge-policy.md`.
|
|
|
31
31
|
each candidate as folded into this PR (one `Closes #…` per folded issue) or
|
|
32
32
|
not folded, with the reason (two hazards in one review, a maintainer decision,
|
|
33
33
|
a blocked dependency, a different seam). The brief carries the candidate list
|
|
34
|
-
and its decisions, and the PR body records them under
|
|
34
|
+
and its decisions, and the PR body records them under `### Fold check`.
|
|
35
35
|
Planning precedes filing: a new issue is the answer for p2+ work no lane can
|
|
36
36
|
carry, never for a p3 the lane could fold (history: `HISTORY.md`, 2026-10-20).
|
|
37
|
+
- A PR body's `### Class sweep` ends with one `Alignment:` line naming the
|
|
38
|
+
families of `docs/alignment-families.md` the change touches, or `none:
|
|
39
|
+
<reason>`; the body lint refuses a body without it.
|
|
37
40
|
- The per-PR loop (review, verify, auto-merge on green), round routing, the
|
|
38
41
|
merge gate and the Common mistakes table live in `docs/pi-lens-merge-policy.md`.
|
|
39
42
|
- Read CI with `node scripts/ci-verdict.mjs <pr|sha>` (exact head, all pages).
|
package/docs/pi-lens-reviewer.md
CHANGED
|
@@ -145,21 +145,21 @@ real seam. Check that every gate the diff adds is exercised through that path.
|
|
|
145
145
|
the exception to the one-spot-check cap above.
|
|
146
146
|
- Repeat the pattern and population sweeps. Check blast radius, bounded
|
|
147
147
|
observability, changelog, commit, and PR-body requirements.
|
|
148
|
-
- Re-run the PR's
|
|
148
|
+
- Re-run the PR's `### Class sweep` search yourself and widen it when the
|
|
149
149
|
named shape is broader than the touched seam (#4273, #4268).
|
|
150
|
-
- Read the
|
|
150
|
+
- Read the `### Fold check` against the open issues and pull requests the PR's
|
|
151
151
|
mechanism has: the lint checks the form (candidate, decision, reason), not
|
|
152
152
|
that every candidate was found, so decide whether the section's search was
|
|
153
153
|
wide enough and whether each `not folded` reason holds (#4711). Open each
|
|
154
154
|
candidate's diff (`gh pr diff <n>`) or the files its issue names: a
|
|
155
155
|
`not folded` line is a finding when the candidate edits the same hunk or
|
|
156
156
|
symbol, or owns a rule this PR re-derives, and a member your own search finds
|
|
157
|
-
that the
|
|
157
|
+
that the `### Class sweep` missed is a finding too. The gates check form only
|
|
158
158
|
and the author writes these lines, so this read is the only judgment they
|
|
159
159
|
get. Recurrence: #4713 wrote "shares no clients/ file" beside #4712, and the
|
|
160
160
|
review then re-derived a `clients/analysis-root.ts` rule #4712 edits, while
|
|
161
161
|
the class sweep missed a single-scan-root member.
|
|
162
|
-
- On a bug-closing PR, check the
|
|
162
|
+
- On a bug-closing PR, check the `### Detection` lesson: the layer named under
|
|
163
163
|
`Should have been caught by:` must be one that would actually have caught
|
|
164
164
|
the bug, and `Gap:` must be a real issue, test, or reason (#4288). Judge
|
|
165
165
|
`Shape:` and `Enforcer:` too: the lint checks the catalog number and that the
|
|
@@ -380,6 +380,6 @@ Use short, active, plain prose.
|
|
|
380
380
|
|
|
381
381
|
Apply this standard to PR and issue bodies, review comments, commit messages, documentation, and changelog entries. Lead with the outcome. Remove words that do no work. Use active voice and present tense. Use second person for instructions, and use the imperative for steps. Keep one idea per sentence, with about 20–25 words and no more than 30 words. Use consistent terminology and sentence-case headings. Define acronyms on first use. Prefer plain words over jargon. Avoid `please`, filler, noun piles, nested parentheticals, and em-dash chains. Use the Oxford comma.
|
|
382
382
|
|
|
383
|
-
The mechanical rules are checked by `scripts/check-prose.mjs`. The checker ignores fenced code, inline code, URLs, quoted log lines, blockquotes, and tables. It
|
|
383
|
+
The mechanical rules are checked by `scripts/check-prose.mjs`. The checker ignores fenced code, inline code, URLs, quoted log lines, blockquotes, and tables. It warns on long sentences, filler, and passive voice, and it blocks title-case headings (#5110). The CLI accepts a body file or standard input and supports `--json`.
|
|
384
384
|
|
|
385
385
|
Reviewers judge clarity, terminology, active voice, sentence structure, and whether each list uses parallel grammar. Treat a mechanically clean result as necessary, not sufficient. Report prose that obscures the outcome or makes a user infer the action.
|
package/docs/pi-lens-subagent.md
CHANGED
|
@@ -81,8 +81,11 @@ the brief gives.
|
|
|
81
81
|
checkout the shell happens to sit in, and agent shells reset their working
|
|
82
82
|
directory between calls. Never edit the main checkout: other lanes and the
|
|
83
83
|
orchestrator read it, and its branch must not move under them.
|
|
84
|
-
- **Teardown.** `
|
|
85
|
-
|
|
84
|
+
- **Teardown.** Run `node scripts/worktree-remove.mjs <path>`: it unlinks a
|
|
85
|
+
symlinked `node_modules`, refuses a real directory, then runs `git worktree
|
|
86
|
+
remove` (#5111). By hand: `rm` a symlinked `node_modules` before `git
|
|
87
|
+
worktree remove` (`ls -ld node_modules` first; unlink the link, never `rm -r`
|
|
88
|
+
it). Removing the worktree over the link follows it
|
|
86
89
|
and deletes the main checkout's install (#3173; the hook denies the removal
|
|
87
90
|
and `AGENTS.md` "Commands and gates" says how `pr-worktree.mjs close` does
|
|
88
91
|
it). A real `node_modules` directory is removed only after confirming the
|
|
@@ -251,7 +254,7 @@ Fold a review follow-up into the same PR when it shares the seam or files, is
|
|
|
251
254
|
about one commit, and needs no maintainer decision. Contract-only folds (body,
|
|
252
255
|
comments, wording) are trailing commits; small code folds carry a red-first
|
|
253
256
|
test and are routed per principles §3 "Round routing". A MEDIUM or LOW that
|
|
254
|
-
does not fold is an accepted residual: list it under
|
|
257
|
+
does not fold is an accepted residual: list it under `### Accepted residuals`,
|
|
255
258
|
named `p3` with its severity and live population, and file nothing. File only p2 or
|
|
256
259
|
higher work that cannot ride the PR (a HIGH outside its scope, or a MEDIUM
|
|
257
260
|
with a live population), as one consolidated issue per PR. The merge bar is in
|
|
@@ -375,7 +375,7 @@ are part of the contract, so the predicate is named here** (`refusalMatches` in
|
|
|
375
375
|
|
|
376
376
|
Everything else stays a warning and the tool runs, exactly as it did before: a
|
|
377
377
|
misspelled mode name, an abbreviation (`max`), a substring or reverse containment
|
|
378
|
-
(`files` for `maxLspFiles`, `
|
|
378
|
+
(`files` for `maxLspFiles`, `pth` for `path`), a leading or middle word
|
|
379
379
|
(`sourcePath` is not `source`), a key whose qualifier retargets the head noun
|
|
380
380
|
(`maxFiles`). Such keys still get the `did you mean` hint, except that a
|
|
381
381
|
retargeted head noun is never the hint (`maxFiles` gets none, `cwdPath` gets
|
|
@@ -391,6 +391,22 @@ JSON-RPC `-32602` error; `arguments` absent, `null` or `[]` means no arguments.
|
|
|
391
391
|
pass extra keys today would break, so it needs a major, through the removal
|
|
392
392
|
checklist in section 4.
|
|
393
393
|
|
|
394
|
+
### The single-file tool parameter is `path`
|
|
395
|
+
|
|
396
|
+
Every pi-lens tool that acts on one named file takes it as **`path`** (#5041).
|
|
397
|
+
That is the canonical spelling: new tools declare it, and the description a
|
|
398
|
+
model reads names it. It is also what keeps a call from being answered for the
|
|
399
|
+
wrong scope — a tool that only declares an older name refuses or ignores the
|
|
400
|
+
canonical one, and an ignored file parameter leaves the call running on its
|
|
401
|
+
default scope, whose answer then reads as if it were about the named file.
|
|
402
|
+
|
|
403
|
+
The MCP tools keep accepting **`file`**, and `lens_diagnostic_mark` keeps
|
|
404
|
+
accepting **`filePath`**, as declared aliases of `path`, so no caller written
|
|
405
|
+
against an older spelling breaks. A call may send any one of them; a call that
|
|
406
|
+
sends two spellings naming different files is refused rather than guessed at.
|
|
407
|
+
Adding a fourth spelling, or dropping one of these, changes this contract
|
|
408
|
+
through section 4.
|
|
409
|
+
|
|
394
410
|
## 6. File I/O Lifecycle Bridge (v2)
|
|
395
411
|
|
|
396
412
|
`PiLensIOBridge` is public API from day one ([RFC 3654](rfcs/3654-unified-io-bridge-v2.md)).
|
|
@@ -406,7 +422,7 @@ The compatibility policy and migration path from legacy v1 symbols are documente
|
|
|
406
422
|
| 2. Append-only `PILENS_CFG_*` codes | `CONFIG_DIAGNOSTIC_CODES` | `tests/clients/config-diagnostic-codes.test.ts` |
|
|
407
423
|
| 3. Reserved `$schema` identity anchor | `CONFIG_SCHEMA_ID`, `CONFIG_SCHEMA_ANCHOR_KEY` | `assertSchemaIdentityAnchor` |
|
|
408
424
|
| 4. Deprecation window + removal checklist | `DEPRECATED_CONFIG_SURFACES` | `tests/clients/config-deprecation-registry.test.ts` |
|
|
409
|
-
| 5. Config core: tiers, deny precedence, ProcessSpec trust | `clients/config-core/` | `tests/clients/config-core/*.test.ts
|
|
425
|
+
| 5. Config core: tiers, deny precedence, ProcessSpec trust | `clients/config-core/` | `tests/clients/config-core/*.test.ts` |
|
|
410
426
|
|
|
411
427
|
## Related
|
|
412
428
|
|
|
@@ -502,6 +502,16 @@
|
|
|
502
502
|
"x-stability": "stable"
|
|
503
503
|
},
|
|
504
504
|
"dispatch": {
|
|
505
|
+
"type": "object",
|
|
506
|
+
"additionalProperties": true,
|
|
507
|
+
"properties": {
|
|
508
|
+
"disabledRunners": {
|
|
509
|
+
"type": "array",
|
|
510
|
+
"items": { "type": "string", "x-stability": "experimental" },
|
|
511
|
+
"x-deny": "array-union",
|
|
512
|
+
"x-stability": "experimental"
|
|
513
|
+
}
|
|
514
|
+
},
|
|
505
515
|
"x-stability": "stable"
|
|
506
516
|
},
|
|
507
517
|
"widget": {
|
package/docs/settings.md
CHANGED
|
@@ -150,13 +150,14 @@ field docs.
|
|
|
150
150
|
| `ignore` | global + project | `[]` | Gitignore-style globs excluded from every scan |
|
|
151
151
|
| `widget.visible` | global | `true` | Whether the diagnostics widget shows at session start |
|
|
152
152
|
| `dispatch.runnerTimeoutFloorMs` | global | none (no floor) | Minimum wall-clock budget per dispatch runner |
|
|
153
|
+
| `dispatch.disabledRunners` | global + project | `[]` | Dispatch runner ids that never run (for example `["dotnet-build"]`). A denial: the union of every tier, so a project can add but never re-enable. Unknown ids are dropped with a warning. See [configuration](configuration.md#dispatchdisabledrunners--turning-a-dispatch-runner-off) |
|
|
153
154
|
| `format.mode` | global | `"deferred"` | `"deferred"` (at `agent_end`) or `"immediate"` |
|
|
154
155
|
| `actionableWarnings.autoFix.maxFixes` | global | `5` | Cap on quickfixes applied per turn (`0` = report only) |
|
|
155
156
|
| `rules.high-complexity.threshold` | project | `15` | Cyclomatic-complexity threshold |
|
|
156
157
|
| `rules.high-fan-out.threshold` | project | `20` | Distinct-function-call threshold |
|
|
157
|
-
| `rules.<id>.disable` | global + project | absent | Disable diagnostics for a rule (output-only filter, project-wide; same normalization as `pi-lens-ignore`) |
|
|
158
|
+
| `rules.<id>.disable` | global + project | absent | Disable diagnostics for a rule (output-only filter, project-wide; same normalization as `pi-lens-ignore`). Read per file from its nearest `.pi-lens.json`, so a nested file governs the files under it. See [configuration](configuration.md#rulesid--read-from-each-files-own-config) |
|
|
158
159
|
| `rules.<id>.select` | project | absent | Allowlist of rule ids (output-only filter, project-wide across every key; disable wins over select) |
|
|
159
|
-
| `rules.<id>.ignorePaths` | global + project | `[]` | Experimental rule-scoped
|
|
160
|
+
| `rules.<id>.ignorePaths` | global + project | `[]` | Experimental rule-scoped path entries matched like the `ignore` field: gitignore rules, relative to the directory of the file that declares them (the project root for a global entry). A later entry beats an earlier one, `!` re-includes, a leading `/` roots the entry at that directory, a trailing `/` names a directory, and an entry with no slash matches at any depth below it. Matching files skip that rule's scan and output. Entries are monotonic across files: a `!` re-includes only against the entries of its own file, and a nearer file never lifts another file's carve-out. Changed from earlier releases, which matched each entry as a plain glob: a `!` entry used to hide every path its glob did not name, and a leading `/` or trailing `/` matched nothing; they now follow gitignore. An entry with a slash keeps its meaning, and a slashless entry such as `*.gen.ts` now also matches below the root. See the [configuration reference](./configuration.md#rulesid--read-from-each-files-own-config). |
|
|
160
161
|
| `maxProjectFiles` | project | `2000` | Base scale knob; derives five subsystem size budgets |
|
|
161
162
|
| `reviewGraph.maxFiles` | project | derived (clamped `100`–`20000`) | Explicit review-graph file budget |
|
|
162
163
|
| `trivy.enabled` / `trivy.minSeverity` | project | off | Opt-in Trivy vulnerability scanning |
|
|
@@ -169,7 +170,7 @@ field docs.
|
|
|
169
170
|
User-level. The file is selected by the [global-location table](configuration.md#global-config-location)
|
|
170
171
|
and applies to **every** project. It honors **all** flag keys from the
|
|
171
172
|
table above plus the non-flag global knobs (`ignore`, `widget.visible`,
|
|
172
|
-
`dispatch.runnerTimeoutFloorMs`, `format.mode`,
|
|
173
|
+
`dispatch.runnerTimeoutFloorMs`, `dispatch.disabledRunners`, `format.mode`,
|
|
173
174
|
`actionableWarnings.autoFix.maxFixes`). On Windows the path is
|
|
174
175
|
`%USERPROFILE%\.pi-lens\config.json`.
|
|
175
176
|
|
|
@@ -219,9 +220,12 @@ Most toggles are **global-only**. Putting a global-only key such as
|
|
|
219
220
|
`"lsp": { "enabled": false }` in a `.pi-lens.json` is **not** honored at project
|
|
220
221
|
scope — pi-lens logs a one-time warning saying so (rather than silently doing
|
|
221
222
|
nothing) and you should set it in `~/.pi-lens/config.json` or pass the CLI flag
|
|
222
|
-
instead.
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
instead. `dispatch` is mixed-scope: `dispatch.disabledRunners` is honored in a
|
|
224
|
+
project file, while `dispatch.runnerTimeoutFloorMs` stays global-only and is
|
|
225
|
+
reported as such. Foreign LSP-loader namespaces that a shared file legitimately
|
|
226
|
+
carries (`servers`, `serverOverrides`, `disabledServers`, `warmFiles`) and
|
|
227
|
+
`$schema` are tolerated without warning; anything else is logged once as a
|
|
228
|
+
likely typo.
|
|
225
229
|
|
|
226
230
|
```json
|
|
227
231
|
{
|
package/docs/word-index.md
CHANGED
|
@@ -137,11 +137,23 @@ rebuild:
|
|
|
137
137
|
files by identifier → `module_report` explains one → `read_symbol` reads
|
|
138
138
|
the exact body. See [docs/module-report-read-symbol.md](module-report-read-symbol.md)
|
|
139
139
|
for the second half of that chain.
|
|
140
|
-
- **
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
`file
|
|
140
|
+
- **One rendered table (#5104)**: both surfaces print a header, one row per
|
|
141
|
+
hit, and a footer, rendered by `renderCompactSymbolSearch()` in
|
|
142
|
+
`clients/lens-engine.ts` — neither appends a JSON payload or a fenced
|
|
143
|
+
block. A row is
|
|
144
|
+
` 1. <file> <startLine> (score 0.82, 3 hit(s)[, fanIn 4][, complexity 7])`:
|
|
145
|
+
the path relative to the query's `cwd`, the hit's single best-matching line,
|
|
146
|
+
the BM25 score and hit count, then the graph annotations when the cached
|
|
147
|
+
review graph is warm (`fanIn 0` means no known importers, so it prints).
|
|
148
|
+
`startLine` and `endLine` are that one line — no synthesized whole-file
|
|
149
|
+
span — so read it with `offset=startLine, limit=1`, or call `module_report`
|
|
150
|
+
on `file` for the real outline. The footer carries index coverage
|
|
151
|
+
(`capped — results may be incomplete` on a truncated index), the MCP-only
|
|
152
|
+
staleness note below, and one next-step line naming the top-ranked hit
|
|
153
|
+
(`module_report <file>` on pi, `pilens_module_report <file>` on MCP). On pi, `details`
|
|
154
|
+
keeps `{ available, query, count, coverage }` (MCP has no `details`); the rows carry everything the
|
|
155
|
+
dropped JSON did (annotations, and the next step that replaces
|
|
156
|
+
`suggestedNext`).
|
|
145
157
|
- **Staleness hint (MCP only, #536)**: `symbolSearch()` returns
|
|
146
158
|
`snapshotGeneratedAt` (the backing project snapshot's `generatedAt`); the
|
|
147
159
|
MCP handler turns an old timestamp into a human staleness note
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lens",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
"audit:tree-sitter": "node scripts/audit-tree-sitter-rules.mjs",
|
|
50
50
|
"audit:rule-catalog": "node scripts/validate-rule-catalog.mjs",
|
|
51
51
|
"audit:astgrep-rule-pairs": "node scripts/audit-astgrep-rule-pairs.mjs",
|
|
52
|
-
"astgrep:self-scan": "node scripts/run-astgrep-pi-lens.mjs",
|
|
52
|
+
"astgrep:self-scan": "node scripts/run-astgrep-pi-lens.mjs && node scripts/run-astgrep-pi-lens.mjs --suite governance",
|
|
53
|
+
"astgrep:governance": "node scripts/run-astgrep-pi-lens.mjs --suite governance",
|
|
54
|
+
"astgrep:governance:update-baseline": "node scripts/run-astgrep-pi-lens.mjs --suite governance --update-baseline",
|
|
53
55
|
"lane:check": "node scripts/lane-check.mjs",
|
|
54
56
|
"astgrep:self-scan:update-baseline": "node scripts/run-astgrep-pi-lens.mjs --update-baseline",
|
|
55
57
|
"audit:playground": "node scripts/playground-verify-rule.mjs",
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
"@ast-grep/cli": "0.51.0",
|
|
132
134
|
"@ast-grep/napi": "^0.51.0",
|
|
133
135
|
"js-yaml": "^5.2.2",
|
|
134
|
-
"minimatch": "^
|
|
136
|
+
"minimatch": "^11.0.1",
|
|
135
137
|
"pidusage": "^4.0.1",
|
|
136
138
|
"vscode-jsonrpc": "^9.0.0"
|
|
137
139
|
},
|
|
@@ -2,7 +2,44 @@ id: no-accumulating-spread-js
|
|
|
2
2
|
valid:
|
|
3
3
|
- 'arr.reduce((acc, item) => { acc.push(item); return acc }, [])'
|
|
4
4
|
- 'arr.flatMap(item => [item])'
|
|
5
|
+
# #5093: a copy made once, outside a reduce callback, is not a per-pass copy.
|
|
6
|
+
- 'const copy = Object.assign({}, acc)'
|
|
7
|
+
- 'const copy = Array.from(acc)'
|
|
8
|
+
- 'const copy = acc.slice()'
|
|
9
|
+
# #5093: mutating the accumulator is not a copy.
|
|
10
|
+
- 'arr.reduce((acc, item) => Object.assign(acc, item), {})'
|
|
11
|
+
- 'arr.reduce((acc, item) => { acc.concat(item); return acc }, [])'
|
|
12
|
+
# #5093 binding guard: the copied value must be the accumulator itself.
|
|
13
|
+
- 'arr.reduce((acc, item) => Array.from(item), [])'
|
|
14
|
+
- 'arr.reduce((acc, item) => [].concat(item), [])'
|
|
15
|
+
- 'arr.reduce((acc, item) => item.slice(), [])'
|
|
16
|
+
- 'arr.reduce((acc, item) => Object.assign({}, item, { k: 1 }), {})'
|
|
5
17
|
invalid:
|
|
6
18
|
- 'arr.reduce((acc, item) => [...acc, item], [])'
|
|
7
19
|
- 'arr.reduce((acc, item) => [...acc, ...item], [])'
|
|
8
20
|
- 'arr.reduce(function (acc, item) { return [...acc, item] }, [])'
|
|
21
|
+
# #5093: non-spread copies of the accumulator, expression bodies.
|
|
22
|
+
- 'arr.reduce((acc, item) => Object.assign({}, acc, { [item.k]: item.v }), {})'
|
|
23
|
+
- 'arr.reduce((acc, item) => Object.assign({}, acc), {})'
|
|
24
|
+
- 'arr.reduce((acc, item) => Array.from(acc), [])'
|
|
25
|
+
- 'arr.reduce((acc, item) => [].concat(acc, item), [])'
|
|
26
|
+
- 'arr.reduce((acc, item) => [].concat(acc), [])'
|
|
27
|
+
- 'arr.reduce((acc, item) => acc.concat(item), [])'
|
|
28
|
+
- 'arr.reduce((acc, item) => acc.concat(item.children), [])'
|
|
29
|
+
- 'arr.reduce((acc, item) => acc.slice(), [])'
|
|
30
|
+
# #5093: the same copies as the only statement of an arrow block body.
|
|
31
|
+
- 'arr.reduce((acc, item) => { return Object.assign({}, acc, { [item.k]: item.v }) }, {})'
|
|
32
|
+
- 'arr.reduce((acc, item) => { return Object.assign({}, acc) }, {})'
|
|
33
|
+
- 'arr.reduce((acc, item) => { return Array.from(acc) }, [])'
|
|
34
|
+
- 'arr.reduce((acc, item) => { return [].concat(acc, item) }, [])'
|
|
35
|
+
- 'arr.reduce((acc, item) => { return [].concat(acc) }, [])'
|
|
36
|
+
- 'arr.reduce((acc, item) => { return acc.concat(item) }, [])'
|
|
37
|
+
- 'arr.reduce((acc, item) => { return acc.slice() }, [])'
|
|
38
|
+
# #5093: the same copies as the only statement of a function body.
|
|
39
|
+
- 'arr.reduce(function (acc, item) { return Object.assign({}, acc, { k: item }) }, {})'
|
|
40
|
+
- 'arr.reduce(function (acc, item) { return Object.assign({}, acc) }, {})'
|
|
41
|
+
- 'arr.reduce(function (acc, item) { return Array.from(acc) }, [])'
|
|
42
|
+
- 'arr.reduce(function (acc, item) { return [].concat(acc, item) }, [])'
|
|
43
|
+
- 'arr.reduce(function (acc, item) { return [].concat(acc) }, [])'
|
|
44
|
+
- 'arr.reduce(function (acc, item) { return acc.concat(item) }, [])'
|
|
45
|
+
- 'arr.reduce(function (acc, item) { return acc.slice() }, [])'
|
|
@@ -3,6 +3,17 @@ valid:
|
|
|
3
3
|
- 'arr.filter(fn)'
|
|
4
4
|
- 'arr.map(fn)'
|
|
5
5
|
- 'arr.flatMap(fn)'
|
|
6
|
+
# #5094: this rule is the identity filter only. A generic filter().map()
|
|
7
|
+
# chain is the filter-then-map hint (warning here was over-matching).
|
|
8
|
+
- 'arr.filter(onlyPositive).map(double)'
|
|
9
|
+
- 'arr.filter(x => y).map(f)'
|
|
10
|
+
- 'arr.filter((x: Foo): x is Bar => x !== null).map(g)'
|
|
11
|
+
# #5093: a typed arrow that is not an identity (it reads a field) keeps the chain.
|
|
12
|
+
- 'arr.filter((x: Foo) => x.ok).map(g)'
|
|
6
13
|
invalid:
|
|
7
14
|
- 'arr.filter(x => x).map(fn)'
|
|
8
|
-
- 'arr.filter(
|
|
15
|
+
- 'arr.filter((x) => x).map(fn)'
|
|
16
|
+
- 'arr.filter(Boolean).map(fn)'
|
|
17
|
+
# #5093: a typed identity arrow is the same identity filter.
|
|
18
|
+
- 'arr.filter((x: string | undefined) => x).map(fn)'
|
|
19
|
+
- 'arr.filter((x: Array<string> | null) => x).map(fn)'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
id: filter-then-map-js
|
|
2
|
+
valid:
|
|
3
|
+
- 'arr.filter(fn)'
|
|
4
|
+
- 'arr.map(fn)'
|
|
5
|
+
- 'arr.flatMap(fn)'
|
|
6
|
+
# Not adjacent: the chain is not filter() directly followed by map().
|
|
7
|
+
- 'arr.filter(onlyPositive).slice(0).map(double)'
|
|
8
|
+
invalid:
|
|
9
|
+
- 'arr.filter(onlyPositive).map(double)'
|
|
10
|
+
# JavaScript has no identity-filter warning rule, so the hint covers it too.
|
|
11
|
+
- 'arr.filter(x => x).map(fn)'
|
|
12
|
+
- 'arr.filter((x) => x > 0).map(double)'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
id: filter-then-map
|
|
2
|
+
valid:
|
|
3
|
+
- 'arr.filter(fn)'
|
|
4
|
+
- 'arr.map(fn)'
|
|
5
|
+
- 'arr.flatMap(fn)'
|
|
6
|
+
# Not adjacent: the chain is not filter() directly followed by map().
|
|
7
|
+
- 'arr.filter(onlyPositive).slice(0).map(double)'
|
|
8
|
+
# Identity filters belong to ts-redundant-filter-map (warning), not this hint.
|
|
9
|
+
- 'arr.filter(x => x).map(fn)'
|
|
10
|
+
- 'arr.filter((x) => x).map(fn)'
|
|
11
|
+
- 'arr.filter(Boolean).map(fn)'
|
|
12
|
+
# Type-guard filters narrow the element type; a rewrite would lose that.
|
|
13
|
+
- 'arr.filter((x): x is Foo => x !== null).map(g)'
|
|
14
|
+
- 'arr.filter((x: Foo): x is Bar => x !== null).map(g)'
|
|
15
|
+
- 'arr.filter(async (x): x is Foo => true).map(g)'
|
|
16
|
+
- 'arr.filter(function (x): x is Foo { return x !== null }).map(g)'
|
|
17
|
+
invalid:
|
|
18
|
+
- 'arr.filter(onlyPositive).map(double)'
|
|
19
|
+
- 'arr.filter((x) => x > 0).map(double)'
|
|
20
|
+
# Binding guard: the filter's parameter is not the value it returns.
|
|
21
|
+
- 'arr.filter(x => y).map(f)'
|
|
22
|
+
- 'arr.filter(x => x !== null).map(f)'
|
|
23
|
+
# Binding guard: an annotation alone is not a type predicate.
|
|
24
|
+
- 'arr.filter((x): boolean => x > 0).map(f)'
|
|
25
|
+
- 'arr.filter((x: number) => x > 0).map(f)'
|
|
@@ -1,11 +1,59 @@
|
|
|
1
1
|
id: no-accumulating-spread-js
|
|
2
2
|
language: JavaScript
|
|
3
|
-
message: "
|
|
3
|
+
message: "Copying the reduce accumulator each pass can be O(n^2) when it grows (spread, concat, slice, Array.from, Object.assign); build the result with push/flatMap, or mutate only an accumulator the reduce owns"
|
|
4
4
|
severity: warning
|
|
5
5
|
metadata:
|
|
6
6
|
category: performance
|
|
7
|
+
note: |
|
|
8
|
+
A reduce callback that returns a fresh copy of its own accumulator does the
|
|
9
|
+
copy on every pass. Each copy costs as much as the accumulator is long, so the
|
|
10
|
+
loop is O(n^2) when the accumulator grows with the input. A fixed-size
|
|
11
|
+
accumulator, such as `items.reduce((acc, item) => acc.slice(), [0])`, costs
|
|
12
|
+
constant work per copy, so that loop is linear. The shape is still flagged,
|
|
13
|
+
because the copy is wasted work on every pass. Flags the spread copies, and
|
|
14
|
+
the non-spread copies `Object.assign({}, acc, ...)`, `Array.from(acc)`,
|
|
15
|
+
`[].concat(acc, ...)`, `acc.concat(...)` and `acc.slice()`.
|
|
16
|
+
|
|
17
|
+
Mutating the accumulator also changes the initial value passed to reduce and
|
|
18
|
+
any intermediate snapshot a caller holds. Mutate it only when it is a fresh
|
|
19
|
+
value the reduce owns. When the initial value or a snapshot comes from outside,
|
|
20
|
+
keep the copy, or preserve both when you choose an alternative such as flatMap.
|
|
21
|
+
|
|
22
|
+
Matched only where the callback's single result is the copy (an expression
|
|
23
|
+
body, or a block or function body whose only statement is that `return`), and
|
|
24
|
+
only when the copied value is the accumulator parameter itself. A copy made
|
|
25
|
+
once outside the callback, a mutation such as `acc.push`, and a copy of the
|
|
26
|
+
item are not flagged. A callback with more than one statement is a known miss.
|
|
27
|
+
|
|
28
|
+
The non-spread arms follow dmmulroy/anti-slop's `no-reduce-accumulator-copy`
|
|
29
|
+
(MIT). The text here is written for this catalog, not copied.
|
|
7
30
|
rule:
|
|
8
31
|
any:
|
|
9
32
|
- pattern: $ARR.reduce(($ACC, $ITEM) => [...$ACC, $ITEM], $$$INIT)
|
|
10
33
|
- pattern: $ARR.reduce(($ACC, $ITEM) => [...$ACC, ...$ITEM], $$$INIT)
|
|
11
34
|
- pattern: $ARR.reduce(function($ACC, $ITEM) { return [...$ACC, $ITEM] }, $$$INIT)
|
|
35
|
+
# #5093: non-spread copies of the accumulator, expression body. The comma
|
|
36
|
+
# arms need a zero-rest twin: `, $$$REST` does not match a bare `(acc)`.
|
|
37
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => Object.assign({}, $ACC, $$$REST), $$$INIT)
|
|
38
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => Object.assign({}, $ACC), $$$INIT)
|
|
39
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => Array.from($ACC), $$$INIT)
|
|
40
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => [].concat($ACC, $$$REST), $$$INIT)
|
|
41
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => [].concat($ACC), $$$INIT)
|
|
42
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => $ACC.concat($$$REST), $$$INIT)
|
|
43
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => $ACC.slice(), $$$INIT)
|
|
44
|
+
# #5093: the same copies as the only statement of an arrow block body.
|
|
45
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return Object.assign({}, $ACC, $$$REST) }, $$$INIT)
|
|
46
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return Object.assign({}, $ACC) }, $$$INIT)
|
|
47
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return Array.from($ACC) }, $$$INIT)
|
|
48
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return [].concat($ACC, $$$REST) }, $$$INIT)
|
|
49
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return [].concat($ACC) }, $$$INIT)
|
|
50
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return $ACC.concat($$$REST) }, $$$INIT)
|
|
51
|
+
- pattern: $ARR.reduce(($ACC, $ITEM) => { return $ACC.slice() }, $$$INIT)
|
|
52
|
+
# #5093: the same copies as the only statement of a function body.
|
|
53
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return Object.assign({}, $ACC, $$$REST) }, $$$INIT)
|
|
54
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return Object.assign({}, $ACC) }, $$$INIT)
|
|
55
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return Array.from($ACC) }, $$$INIT)
|
|
56
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return [].concat($ACC, $$$REST) }, $$$INIT)
|
|
57
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return [].concat($ACC) }, $$$INIT)
|
|
58
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return $ACC.concat($$$REST) }, $$$INIT)
|
|
59
|
+
- pattern: $ARR.reduce(function($ACC, $ITEM) { return $ACC.slice() }, $$$INIT)
|
|
@@ -2,9 +2,17 @@ id: ts-redundant-filter-map
|
|
|
2
2
|
language: typescript
|
|
3
3
|
severity: warning
|
|
4
4
|
message: arr.filter(x => x).map(...) - use flatMap or a single pass
|
|
5
|
+
note: |
|
|
6
|
+
Identity filter only: `arr.filter(x => x).map(f)` and `arr.filter(Boolean).map(f)`.
|
|
7
|
+
A generic `filter(f).map(g)` chain is not flagged: `filter-then-map` ships disabled (#5094).
|
|
5
8
|
metadata:
|
|
6
9
|
weight: 3
|
|
7
10
|
category: slop
|
|
8
11
|
rule:
|
|
9
12
|
kind: call_expression
|
|
10
|
-
|
|
13
|
+
any:
|
|
14
|
+
- pattern: "$ARR.filter(($X) => $X).map($G)"
|
|
15
|
+
# #5093: a typed identity arrow. $T matches any type node; $X must be the returned binding.
|
|
16
|
+
- pattern: "$ARR.filter(($X: $T) => $X).map($G)"
|
|
17
|
+
- pattern: "$ARR.filter($X => $X).map($G)"
|
|
18
|
+
- pattern: "$ARR.filter(Boolean).map($G)"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
id: filter-then-map-js
|
|
2
|
+
language: JavaScript
|
|
3
|
+
severity: hint
|
|
4
|
+
message: "use flatMap or one loop; keep callback order, indexes and filter semantics"
|
|
5
|
+
metadata:
|
|
6
|
+
category: performance
|
|
7
|
+
note: |
|
|
8
|
+
JavaScript twin of `filter-then-map`. Flags every adjacent `filter(f).map(g)`,
|
|
9
|
+
identity filters included, because no JavaScript identity-filter rule exists.
|
|
10
|
+
JavaScript has no type predicates, so the type-guard exclusion is not needed.
|
|
11
|
+
|
|
12
|
+
Shipped disabled (#5094). A reviewer sample of 58 hits (24 of all 524 TypeScript
|
|
13
|
+
hits, 20 of the 92 outside tests, 14 of 87 JavaScript) found 0 clearly worth a
|
|
14
|
+
rewrite and 6 marginal, below the 70% bar. Enable by moving back into `rules/`
|
|
15
|
+
with its fixture.
|
|
16
|
+
rule:
|
|
17
|
+
pattern: "$ARR.filter($F).map($G)"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
id: filter-then-map
|
|
2
|
+
language: TypeScript
|
|
3
|
+
severity: hint
|
|
4
|
+
message: "use flatMap or one loop; keep callback order, indexes and filter semantics"
|
|
5
|
+
metadata:
|
|
6
|
+
category: performance
|
|
7
|
+
note: |
|
|
8
|
+
`filter(f).map(g)` walks the array twice and builds a throwaway array in
|
|
9
|
+
between. `flatMap`, or one loop, does both in one pass. Eager versus lazy is
|
|
10
|
+
partly taste, so this is a hint and never blocks.
|
|
11
|
+
|
|
12
|
+
Shipped disabled (#5094). A reviewer sample of 58 hits (24 of all 524 TypeScript
|
|
13
|
+
hits, 20 of the 92 outside tests, 14 of 87 JavaScript) found 0 clearly worth a
|
|
14
|
+
rewrite and 6 marginal, below the 70% bar. Enable by moving back into `rules/`
|
|
15
|
+
with its fixture.
|
|
16
|
+
|
|
17
|
+
Known gaps: receiver-blind (lodash, jQuery and iterator-helper chains fire), and
|
|
18
|
+
two-parameter or generic type guards are not excluded.
|
|
19
|
+
|
|
20
|
+
Not flagged: an identity filter (`filter(x => x)`, `filter(Boolean)`), which
|
|
21
|
+
`ts-redundant-filter-map` owns at warning; and a type-guard filter (an
|
|
22
|
+
`x is T` predicate), which narrows the element type for the map.
|
|
23
|
+
|
|
24
|
+
The shape follows dmmulroy/anti-slop's `no-array-filter-map` (MIT). The text
|
|
25
|
+
here is written for this catalog, not copied.
|
|
26
|
+
rule:
|
|
27
|
+
pattern: "$ARR.filter($F).map($G)"
|
|
28
|
+
not:
|
|
29
|
+
any:
|
|
30
|
+
- pattern: "$ARR.filter(($X) => $X).map($G)"
|
|
31
|
+
- pattern: "$ARR.filter($X => $X).map($G)"
|
|
32
|
+
- pattern: "$ARR.filter(Boolean).map($G)"
|
|
33
|
+
- pattern: "$ARR.filter(($X): $X is $T => $$$BODY).map($G)"
|
|
34
|
+
- pattern: "$ARR.filter(($X: $TY): $X is $T => $$$BODY).map($G)"
|
|
35
|
+
- pattern: "$ARR.filter(function ($X): $X is $T { $$$BODY }).map($G)"
|
|
36
|
+
- pattern: "$ARR.filter(async ($X): $X is $T => $$$BODY).map($G)"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Regenerate with `npm run astgrep:self-scan
|
|
2
|
+
"_comment": "Regenerate with `npm run astgrep:self-scan:update-baseline` (this suite only; the governance suite has `npm run astgrep:governance:update-baseline`) AFTER triaging every new entry (fix the underlying finding, or confirm it's a legitimate exception and document why in the same PR). Never regenerate to silently swallow an unreviewed hit.",
|
|
3
3
|
"generatedAt": "2026-08-19T20:44:05.206Z",
|
|
4
4
|
"allowed": []
|
|
5
5
|
}
|