phpstan-mcp-mx 0.22.0 → 0.24.0
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 +24 -0
- package/README.md +142 -19
- package/dist/baseline.d.ts +10 -0
- package/dist/baseline.js +36 -14
- package/dist/baseline.js.map +1 -1
- package/dist/changed.d.ts +17 -0
- package/dist/changed.js +56 -29
- package/dist/changed.js.map +1 -1
- package/dist/compare.js +12 -6
- package/dist/compare.js.map +1 -1
- package/dist/composer.js +43 -21
- package/dist/composer.js.map +1 -1
- package/dist/config.js +12 -6
- package/dist/config.js.map +1 -1
- package/dist/defaults.js +2 -1
- package/dist/defaults.js.map +1 -1
- package/dist/dumptype.js +16 -8
- package/dist/dumptype.js.map +1 -1
- package/dist/failure.d.ts +1 -1
- package/dist/failure.js.map +1 -1
- package/dist/history.d.ts +61 -0
- package/dist/history.js +275 -0
- package/dist/history.js.map +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/php.js +10 -5
- package/dist/php.js.map +1 -1
- package/dist/phpstan/error.js.map +1 -1
- package/dist/phpstan/output.js +12 -6
- package/dist/phpstan/output.js.map +1 -1
- package/dist/phpstan/parameters.js.map +1 -1
- package/dist/phpstan/process.d.ts +10 -0
- package/dist/phpstan/process.js +35 -9
- package/dist/phpstan/process.js.map +1 -1
- package/dist/phpstan/queue.js +4 -2
- package/dist/phpstan/queue.js.map +1 -1
- package/dist/phpstan.d.ts +14 -0
- package/dist/phpstan.js +94 -25
- package/dist/phpstan.js.map +1 -1
- package/dist/project.d.ts +6 -2
- package/dist/project.js +57 -18
- package/dist/project.js.map +1 -1
- package/dist/prune.d.ts +92 -0
- package/dist/prune.js +387 -0
- package/dist/prune.js.map +1 -0
- package/dist/report.js +38 -19
- package/dist/report.js.map +1 -1
- package/dist/root-source.d.ts +43 -0
- package/dist/root-source.js +124 -0
- package/dist/root-source.js.map +1 -0
- package/dist/roots.d.ts +12 -0
- package/dist/roots.js +23 -6
- package/dist/roots.js.map +1 -1
- package/dist/runner.js +14 -7
- package/dist/runner.js.map +1 -1
- package/dist/runs.js +6 -3
- package/dist/runs.js.map +1 -1
- package/dist/schema-dialect.js +6 -3
- package/dist/schema-dialect.js.map +1 -1
- package/dist/server.d.ts +3 -2
- package/dist/server.js +9 -5
- package/dist/server.js.map +1 -1
- package/dist/tmpdir.js +6 -3
- package/dist/tmpdir.js.map +1 -1
- package/dist/tools/analysis.d.ts +4 -4
- package/dist/tools/analysis.js +4 -2
- package/dist/tools/analysis.js.map +1 -1
- package/dist/tools/inspect.d.ts +9 -7
- package/dist/tools/inspect.js +158 -37
- package/dist/tools/inspect.js.map +1 -1
- package/dist/tools/prompts.d.ts +3 -3
- package/dist/tools/prompts.js +16 -8
- package/dist/tools/prompts.js.map +1 -1
- package/dist/tools/shared.d.ts +2 -2
- package/dist/tools/shared.js +7 -5
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/writes.d.ts +8 -3
- package/dist/tools/writes.js +73 -3
- package/dist/tools/writes.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +6 -3
- package/dist/tools.js.map +1 -1
- package/dist/unmatched.d.ts +66 -0
- package/dist/unmatched.js +194 -44
- package/dist/unmatched.js.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes per version. Generated by semantic-release from the commit
|
|
4
4
|
history since 0.10.0; the versions before that were written by hand.
|
|
5
5
|
|
|
6
|
+
# [0.24.0](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/compare/v0.23.0...v0.24.0) (2026-09-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* keep two roots from the config file apart on Windows ([6afa66c](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/6afa66cd7c257b5e7e231a666a7a7382b9694bd5))
|
|
12
|
+
* read an empty baseline as empty instead of unreadable ([a6f0396](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/a6f0396a84e60cfc3ae766c1decb7c3719695f94))
|
|
13
|
+
* report a configuration PHPStan rejects as config_invalid ([8ed1085](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/8ed1085561219f8d986e037c31064c88d1fc214d))
|
|
14
|
+
* report a timeout or cancellation on Windows as such ([7c2b778](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/7c2b778f4f699aeb210008a3b3cfe68f545fb752))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add baseline_history to show how a baseline changed over time ([6256a80](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/6256a801eeea378dd2484a8e796bbd080888ab6d))
|
|
20
|
+
* add prune_baseline to clean up a baseline without hiding anything ([87049a5](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/87049a56c862cbe1759113dc65d2f95b94fcf979))
|
|
21
|
+
* report stale inline [@phpstan-ignore](https://codeberg.org/phpstan-ignore) comments in unmatched_ignores ([e960d65](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/e960d658ae145a8832550cf2ea75f0f7e60a3406))
|
|
22
|
+
|
|
23
|
+
# [0.23.0](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/compare/v0.22.0...v0.23.0) (2026-09-12)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* accept a project relative to the client's working directory ([e2025d9](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/commit/e2025d990ef4a65658fe5db08f75249a450d0116))
|
|
29
|
+
|
|
6
30
|
# [0.22.0](https://codeberg.org/MartijnSchimmel/phpstan-mcp-mx/compare/v0.21.1...v0.22.0) (2026-09-12)
|
|
7
31
|
|
|
8
32
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@ npm install -g phpstan-mcp-mx
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Below, replace `/path/to/projects` everywhere with the directory that holds your PHP
|
|
17
|
-
projects.
|
|
17
|
+
projects. In Claude Code you can also leave `PHPSTAN_MCP_ROOTS` out: the server then works in
|
|
18
|
+
the directory the session runs in. See [Configuration](#configuration) for why there is always
|
|
19
|
+
a limit.
|
|
18
20
|
|
|
19
21
|
### Claude Code
|
|
20
22
|
|
|
@@ -154,10 +156,10 @@ echo '' | env -i PATH=/usr/bin:/bin \
|
|
|
154
156
|
```
|
|
155
157
|
|
|
156
158
|
```
|
|
157
|
-
phpstan-mcp 0.
|
|
159
|
+
phpstan-mcp 0.23.0 listening on stdio, no roots configured, so the client's directories (MCP roots) are in scope, at most 2 at a time
|
|
158
160
|
```
|
|
159
161
|
|
|
160
|
-
(
|
|
162
|
+
(No roots is correct here: `env -i` also throws away `PHPSTAN_MCP_ROOTS`. All that matters
|
|
161
163
|
is *that* it starts.)
|
|
162
164
|
|
|
163
165
|
### Updating
|
|
@@ -227,10 +229,10 @@ A file that doesn't exist is not an error: then only the environment applies. A
|
|
|
227
229
|
*does* exist but is invalid stops the server from starting someone meant something there
|
|
228
230
|
that would otherwise silently not happen.
|
|
229
231
|
|
|
230
|
-
### `PHPSTAN_MCP_ROOTS` (
|
|
232
|
+
### `PHPSTAN_MCP_ROOTS` (recommended)
|
|
231
233
|
|
|
232
|
-
`PHPSTAN_MCP_ROOTS` is
|
|
233
|
-
|
|
234
|
+
`PHPSTAN_MCP_ROOTS` is a list of absolute paths, separated by a colon (a semicolon on
|
|
235
|
+
Windows). Everything below them may be analysed, nothing outside them.
|
|
234
236
|
|
|
235
237
|
```
|
|
236
238
|
PHPSTAN_MCP_ROOTS=/Users/you/projects:/Users/you/work/client-x
|
|
@@ -241,6 +243,25 @@ directories with a `composer.json`, stops as soon as it finds one, and skips `ve
|
|
|
241
243
|
`node_modules/` and hidden directories. A layout like `~/projects/<client>/<project>` works
|
|
242
244
|
with `~/projects` as the only root.
|
|
243
245
|
|
|
246
|
+
Without `PHPSTAN_MCP_ROOTS`, the directories the client shares through MCP roots are the
|
|
247
|
+
limit instead. Claude Code shares the directory the session runs in, so there the server
|
|
248
|
+
reaches exactly the project you started it in. A client that shares no directories leaves
|
|
249
|
+
nothing in reach: then the server refuses every project and says why. Set the variable when
|
|
250
|
+
one server should reach several projects, or with such a client.
|
|
251
|
+
|
|
252
|
+
### The client's directory and relative paths
|
|
253
|
+
|
|
254
|
+
A `project` may also be relative: `.` is the directory the client shares, and `packages/api`
|
|
255
|
+
starts from there. This uses MCP roots, not the directory the server process happens to run
|
|
256
|
+
in a client that doesn't start the server in your project (Claude Desktop) would otherwise
|
|
257
|
+
silently point `.` somewhere else. It needs exactly one shared directory: with none there is
|
|
258
|
+
nothing to resolve against, and with several (Claude Code after `/add-dir`) it would be a
|
|
259
|
+
guess; both are refused with a message asking for the full path.
|
|
260
|
+
|
|
261
|
+
With `PHPSTAN_MCP_ROOTS` set, that list stays the limit: `.` then only works if the client's
|
|
262
|
+
directory lies within it. `list_projects` and `server_config` show which list applies and
|
|
263
|
+
what `.` resolves to.
|
|
264
|
+
|
|
244
265
|
### `PHPSTAN_MCP_MAX_PARALLEL` (optional)
|
|
245
266
|
|
|
246
267
|
How many analyses may run at the same time, across projects. Two by default.
|
|
@@ -352,13 +373,14 @@ this is something a human sets once: a model only picks a project, and whether a
|
|
|
352
373
|
environment belongs to it is already decided. If a caller could pass in the command, the
|
|
353
374
|
caller would decide what gets executed and the whitelist would be pointless.
|
|
354
375
|
|
|
355
|
-
### Why
|
|
376
|
+
### Why there is always a list
|
|
356
377
|
|
|
357
378
|
PHPStan is not a passive parser. It loads the project's autoloader, executes
|
|
358
379
|
`bootstrapFiles` from the configuration and loads extensions as PHP code. "Analyse directory
|
|
359
380
|
X" therefore means "execute the PHP code that X's configuration points to" and the path
|
|
360
381
|
comes from a language model. The list of roots makes what is in reach explicit and decided
|
|
361
|
-
by a human
|
|
382
|
+
outside the model: by a human in `PHPSTAN_MCP_ROOTS`, or by the client that shares the
|
|
383
|
+
directory it was started in. Neither can come from a tool call.
|
|
362
384
|
|
|
363
385
|
### `PHPSTAN_MCP_MEMORY_LIMIT` (optional)
|
|
364
386
|
|
|
@@ -417,21 +439,25 @@ broken value is listed there as a problem the project list keeps working.
|
|
|
417
439
|
|
|
418
440
|
## Tools
|
|
419
441
|
|
|
420
|
-
Every tool expects an explicit `project
|
|
421
|
-
|
|
422
|
-
|
|
442
|
+
Every tool expects an explicit `project`: an absolute path, or a path relative to the
|
|
443
|
+
directory the client shares (`.` for that directory itself, see
|
|
444
|
+
[above](#the-clients-directory-and-relative-paths)). The server keeps no "current project"
|
|
445
|
+
between calls: that would be state the model doesn't see in its context, with the wrong
|
|
446
|
+
project silently analysed as a result. The model names the project in every call, and every
|
|
447
|
+
answer names its full path.
|
|
423
448
|
|
|
424
449
|
### `list_projects`
|
|
425
450
|
|
|
426
451
|
Lists the projects that are in reach, with for each project whether PHPStan is installed and
|
|
427
452
|
which config file it has. Start here the `path` from the result is what the other tools
|
|
428
|
-
expect as `project`.
|
|
453
|
+
expect as `project`. It also says where the list comes from (`rootsFrom`: `PHPSTAN_MCP_ROOTS`
|
|
454
|
+
or the client) and what `.` resolves to (`workingDirectory`).
|
|
429
455
|
|
|
430
456
|
### `analyse_project`
|
|
431
457
|
|
|
432
458
|
| Argument | Required | Meaning |
|
|
433
459
|
| --- | --- | --- |
|
|
434
|
-
| `project` | yes |
|
|
460
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
435
461
|
| `paths` | no | paths inside the project; empty means: follow `phpstan.neon` |
|
|
436
462
|
| `level` | no | level override, `0` to `10` or `max` |
|
|
437
463
|
| `config` | no | a different config file, e.g. `phpstan-strict.neon`; must lie inside the project |
|
|
@@ -466,7 +492,7 @@ filling up with what has been there for years.
|
|
|
466
492
|
|
|
467
493
|
| Argument | Required | Meaning |
|
|
468
494
|
| --- | --- | --- |
|
|
469
|
-
| `project` | yes |
|
|
495
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
470
496
|
| `base` | no | commit, branch or tag to compare against (`HEAD` by default) |
|
|
471
497
|
| `staged` | no | only what is staged (`git diff --cached`), for a check before a commit |
|
|
472
498
|
| `onlyChangedLines` | no | only findings on lines that were changed |
|
|
@@ -544,7 +570,7 @@ with a cast, `assert()` or an inline `@var`.
|
|
|
544
570
|
|
|
545
571
|
| Argument | Required | Meaning |
|
|
546
572
|
| --- | --- | --- |
|
|
547
|
-
| `project` | yes |
|
|
573
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
548
574
|
| `path` | yes | one PHP file inside the project |
|
|
549
575
|
| `line` | yes | the types are those right before this line runs |
|
|
550
576
|
| `expressions` | yes | 1 to 10 PHP expressions, e.g. `["$user", "$request->input('id')"]` |
|
|
@@ -698,7 +724,7 @@ errors get hidden, next to the baseline and `ignoreErrors` in the config, and th
|
|
|
698
724
|
nothing counted until now:
|
|
699
725
|
|
|
700
726
|
```
|
|
701
|
-
18 inline @phpstan-ignore comment(s) in 14 file(s) counted in all PHP files git knows, also outside the analysed paths. These are hidden too, and a new baseline does not touch them.
|
|
727
|
+
18 inline @phpstan-ignore comment(s) in 14 file(s) counted in all PHP files git knows, also outside the analysed paths. These are hidden too, and a new baseline does not touch them. unmatched_ignores says which of them no longer suppress anything.
|
|
702
728
|
11 have no identifier (@phpstan-ignore-line, -next-line): they ignore every error on their line.
|
|
703
729
|
1 name an identifier but give no reason in parentheses.
|
|
704
730
|
```
|
|
@@ -712,6 +738,38 @@ With `path` (e.g. `"app/Models/User.php"`) you also get the entries for that one
|
|
|
712
738
|
entry the identifier, the count and the pattern. That file doesn't have to exist any more —
|
|
713
739
|
it is precisely a deleted file that the entries doing nothing belong to.
|
|
714
740
|
|
|
741
|
+
### `baseline_history`
|
|
742
|
+
|
|
743
|
+
How the included baseline changed through the git history: per commit that touched it, the
|
|
744
|
+
number of ignored errors, the change against the previous version, and which identifiers grew
|
|
745
|
+
or shrank most. It answers whether a project is paying off its baseline or quietly growing it,
|
|
746
|
+
and which change added a pile. Reads git only; no PHPStan run.
|
|
747
|
+
|
|
748
|
+
| Argument | Required | Meaning |
|
|
749
|
+
| --- | --- | --- |
|
|
750
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
751
|
+
| `limit` | no | how many changes per baseline file (20 by default, at most 100) |
|
|
752
|
+
|
|
753
|
+
```
|
|
754
|
+
phpstan-baseline.neon ignores 496 error(s) in 4 entries now. Over the last 3 change(s): 0 → 496 ignored error(s) (net +496); 2 of them added errors, 1 removed some.
|
|
755
|
+
|
|
756
|
+
2026-08-02 97054f6a0b 496 +45 Merge pull request 'feat: order export' (#41)
|
|
757
|
+
+31 argument.type, +14 property.notFound
|
|
758
|
+
2026-06-18 7c295e96d7 451 -61 refactor: type the order collections
|
|
759
|
+
-59 missingType.iterableValue, -2 argument.type
|
|
760
|
+
2026-05-04 58985bbf96 512 +512 chore: bring the project under PHPStan
|
|
761
|
+
+240 argument.type, +180 missingType.iterableValue, +92 return.type
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
It follows the first-parent line of `HEAD`, so a merged branch is one change: its commits are
|
|
765
|
+
not listed between the others, where each would be compared with a commit that was never its
|
|
766
|
+
parent. A renamed baseline is followed. Uncommitted changes to the baseline come first, as a
|
|
767
|
+
row without a commit; a difference in line endings alone doesn't count. A version that can't
|
|
768
|
+
be read is reported as unknown, not as zero. Author names are deliberately left out.
|
|
769
|
+
|
|
770
|
+
Without git, or outside a repository, the tool fails with `git_missing` or
|
|
771
|
+
`not_a_git_repository`; `baseline_summary` still shows what is in the baseline now.
|
|
772
|
+
|
|
715
773
|
### `unmatched_ignores`
|
|
716
774
|
|
|
717
775
|
Finds the ignore rules that no longer do anything: baseline entries for errors that were
|
|
@@ -721,7 +779,7 @@ the 2116 baseline entries turned out to match nothing any more.
|
|
|
721
779
|
|
|
722
780
|
| Argument | Required | Meaning |
|
|
723
781
|
| --- | --- | --- |
|
|
724
|
-
| `project` | yes |
|
|
782
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
725
783
|
| `memoryLimit` | no | this is a full analysis, so it may need more |
|
|
726
784
|
| `timeoutSeconds` | no | 300 by default |
|
|
727
785
|
| `offset` / `limit` | no | which part of the entries you get back |
|
|
@@ -735,6 +793,25 @@ Each entry says whether it comes from the baseline. Patterns without a path are
|
|
|
735
793
|
separately; they live in `ignoreErrors` of your config or of a config a package brings along,
|
|
736
794
|
and a new baseline doesn't help there.
|
|
737
795
|
|
|
796
|
+
The same run also finds inline `@phpstan-ignore` comments that no longer suppress anything,
|
|
797
|
+
listed per file under `inline`. Those are in the code, so removing them is a code change;
|
|
798
|
+
neither `prune_baseline` nor `generate_baseline` touches them, and PHPStan doesn't put them in
|
|
799
|
+
a baseline. When a comment names several identifiers, only the stale one is listed. The line
|
|
800
|
+
is the one the ignore applies to: for a comment on a line of its own, the comment is on the
|
|
801
|
+
line above.
|
|
802
|
+
|
|
803
|
+
```
|
|
804
|
+
10 inline @phpstan-ignore comment(s) no longer suppress anything (1 without an identifier):
|
|
805
|
+
|
|
806
|
+
app/Filament/Pages/Auth/Login.php
|
|
807
|
+
line 82 no identifier: ignores every error on the line, and there is none
|
|
808
|
+
|
|
809
|
+
app/Filament/Pages/Tenancy/EditCountrySettings.php
|
|
810
|
+
line 132 nothing reported as argument.type
|
|
811
|
+
line 434 nothing reported as argument.type
|
|
812
|
+
…
|
|
813
|
+
```
|
|
814
|
+
|
|
738
815
|
There is deliberately no `level` and no `paths`: on a different level the errors are
|
|
739
816
|
different, and with only part of the project, everything outside it looks stale.
|
|
740
817
|
|
|
@@ -764,7 +841,7 @@ rather than existing and refusing every call. All other tools stay read-only.
|
|
|
764
841
|
|
|
765
842
|
| Argument | Required | Meaning |
|
|
766
843
|
| --- | --- | --- |
|
|
767
|
-
| `project` | yes |
|
|
844
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
768
845
|
| `file` | no | target file inside the project (`phpstan-baseline.neon` by default) |
|
|
769
846
|
| `allowEmpty` | no | write even if there is nothing to ignore |
|
|
770
847
|
|
|
@@ -781,6 +858,48 @@ includes:
|
|
|
781
858
|
- phpstan-baseline.neon
|
|
782
859
|
```
|
|
783
860
|
|
|
861
|
+
### `prune_baseline` (only with write access)
|
|
862
|
+
|
|
863
|
+
Cleans up the baseline without hiding anything new: entries that no longer match anything are
|
|
864
|
+
removed, and a `count` that is too high goes down to what still occurs. Nothing is ever added.
|
|
865
|
+
That is the difference with `generate_baseline`, which cleans up too but also puts every current
|
|
866
|
+
error into the baseline after which the next analysis no longer reports it.
|
|
867
|
+
|
|
868
|
+
| Argument | Required | Meaning |
|
|
869
|
+
| --- | --- | --- |
|
|
870
|
+
| `project` | yes | path to the project root, absolute or relative to the client's directory |
|
|
871
|
+
| `memoryLimit` | no | this is a full analysis, so it may need more |
|
|
872
|
+
| `timeoutSeconds` | no | 300 by default |
|
|
873
|
+
|
|
874
|
+
It runs the same analysis as `unmatched_ignores`, so run that first to see what would go. Only
|
|
875
|
+
the `phpstan-baseline*.neon` files that your config includes are edited, entry by entry; the
|
|
876
|
+
rest of the file stays exactly as it was. Rules in `ignoreErrors` of the config itself, and
|
|
877
|
+
patterns without a path, are left alone and counted in the response, as are stale inline
|
|
878
|
+
`@phpstan-ignore` comments: those are in the code, not in a baseline. An entry that can't be
|
|
879
|
+
matched unambiguously also stays: a mistake here can leave a stale entry behind, but never
|
|
880
|
+
removes one that still does something.
|
|
881
|
+
|
|
882
|
+
Entries for a file that no longer exists are removed before the analysis: with
|
|
883
|
+
`reportUnmatchedIgnoredErrors` on, PHPStan refuses the whole run on such a path. When the
|
|
884
|
+
analysis is incomplete ("Result is incomplete", or an error that isn't about a stale rule),
|
|
885
|
+
nothing else is written, because then entries look stale that aren't.
|
|
886
|
+
|
|
887
|
+
A count only ever goes down. When an error occurs *more* often than its count, that extra
|
|
888
|
+
occurrence is a finding, and raising the count would hide it; it is counted with the current
|
|
889
|
+
findings instead.
|
|
890
|
+
|
|
891
|
+
It exists under the same condition as `generate_baseline`: `PHPSTAN_MCP_ALLOW_WRITES=1`. On a
|
|
892
|
+
real project whose config had `reportUnmatchedIgnoredErrors: false`:
|
|
893
|
+
|
|
894
|
+
```
|
|
895
|
+
phpstan-baseline.neon: removed 293 entries, lowered the count of 3; 1620 → 1169 ignored error(s).
|
|
896
|
+
|
|
897
|
+
Nothing was added: the 32 current finding(s) are still reported. Fix them at the source; generate_baseline would hide them in the baseline.
|
|
898
|
+
|
|
899
|
+
Left alone:
|
|
900
|
+
- 2 pattern(s) without a path: from ignoreErrors of a config, often one a package ships. A baseline change does nothing about them.
|
|
901
|
+
```
|
|
902
|
+
|
|
784
903
|
## Prompts
|
|
785
904
|
|
|
786
905
|
Workflows that only combine existing tools. A prompt rather than a tool, because a tool costs
|
|
@@ -829,7 +948,7 @@ you can act on.
|
|
|
829
948
|
`reason` comes from a closed set, so you can match on it without reading the text:
|
|
830
949
|
`no_roots_configured`, `project_outside_roots`, `project_not_found`, `path_outside_project`,
|
|
831
950
|
`path_not_found`, `invalid_argument`, `nothing_to_analyse`, `phpstan_missing`,
|
|
832
|
-
`config_missing`, `bootstrap_failed`,
|
|
951
|
+
`config_missing`, `config_invalid`, `bootstrap_failed`,
|
|
833
952
|
`baseline_unreadable`, `invalid_setting`, `memory_limit`, `timeout`, `cancelled`,
|
|
834
953
|
`git_missing`, `not_a_git_repository`, `unknown_base`, `unsupported_with_runner`,
|
|
835
954
|
`unusable_output` and `phpstan_failed`.
|
|
@@ -1011,6 +1130,10 @@ The same four steps run in CI on Node 24, and once more on a release. `engines`
|
|
|
1011
1130
|
`>=20`; that lower bound was checked once in Docker when CI was set up and does not run with
|
|
1012
1131
|
every build.
|
|
1013
1132
|
|
|
1133
|
+
The tests also pass on Windows: the fake PHPStan they use is a Node script, and five tests that
|
|
1134
|
+
depend on POSIX behaviour (file permissions, SIGTERM, a runner that runs `sh`) are skipped there.
|
|
1135
|
+
They never read your own `~/.config/phpstan-mcp/config.json`.
|
|
1136
|
+
|
|
1014
1137
|
## License
|
|
1015
1138
|
|
|
1016
1139
|
MIT
|
package/dist/baseline.d.ts
CHANGED
|
@@ -88,6 +88,14 @@ export declare function readIncludedBaselines(project: ResolvedProject): Include
|
|
|
88
88
|
* een regel in het bestand terug te vinden (baseline_summary met een `path`).
|
|
89
89
|
*/
|
|
90
90
|
export declare function parseBaseline(content: string): BaselineEntry[];
|
|
91
|
+
/**
|
|
92
|
+
* Of een baseline `ignoreErrors` noemt maar er geen entry uit te lezen is: een vorm die deze
|
|
93
|
+
* parser niet kent, en dat is iets anders dan nul fouten. Behalve bij `ignoreErrors: []`: dat
|
|
94
|
+
* schrijft PHPStan met `--allow-empty-baseline` en `prune_baseline` als alles weg is, en het is
|
|
95
|
+
* gewoon een lege baseline. Eerst gold elk bestand met het woord erin zonder entries als kapot,
|
|
96
|
+
* en dan weigerde `baseline_summary` precies de baseline die net helemaal opgeruimd was.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isUnreadableBaseline(content: string, entries: readonly BaselineEntry[]): boolean;
|
|
91
99
|
/** Eén baseline-regel voor een bestand, met het baseline-bestand waar hij in staat. */
|
|
92
100
|
export interface BaselineFileEntry {
|
|
93
101
|
readonly file: string;
|
|
@@ -108,3 +116,5 @@ export declare function baselineEntriesFor(project: ResolvedProject, path: strin
|
|
|
108
116
|
export declare function summariseBaseline(project: ResolvedProject): BaselineSummary;
|
|
109
117
|
/** Schrijft een baseline-samenvatting uit als tekst voor het model. */
|
|
110
118
|
export declare function renderBaseline(summary: BaselineSummary): string;
|
|
119
|
+
/** Haalt de quotes van een NEON-string af; binnen enkele quotes is `''` één quote. */
|
|
120
|
+
export declare function unquote(value: string): string;
|
package/dist/baseline.js
CHANGED
|
@@ -39,8 +39,9 @@ export function findBaselineFiles(project) {
|
|
|
39
39
|
*/
|
|
40
40
|
export function describeIncludedBaseline(project) {
|
|
41
41
|
const included = includedBaselineFiles(project);
|
|
42
|
-
if (included.length === 0)
|
|
42
|
+
if (included.length === 0) {
|
|
43
43
|
return null;
|
|
44
|
+
}
|
|
44
45
|
const namen = included.join(', ');
|
|
45
46
|
// Engels vervoegt naar het aantal, en een project kan meer dan één baseline includeren.
|
|
46
47
|
const een = included.length === 1;
|
|
@@ -67,8 +68,9 @@ export function describeIncludedBaseline(project) {
|
|
|
67
68
|
* Leeg als er geen config is of als die niet te lezen is: dan doet er geen mee.
|
|
68
69
|
*/
|
|
69
70
|
export function includedBaselineFiles(project) {
|
|
70
|
-
if (project.config === null)
|
|
71
|
+
if (project.config === null) {
|
|
71
72
|
return [];
|
|
73
|
+
}
|
|
72
74
|
let config;
|
|
73
75
|
try {
|
|
74
76
|
config = readFileSync(resolve(project.path, project.config), 'utf8');
|
|
@@ -98,8 +100,9 @@ export function readIncludedBaselines(project) {
|
|
|
98
100
|
continue;
|
|
99
101
|
}
|
|
100
102
|
const parsed = parseBaseline(content);
|
|
101
|
-
if (parsed
|
|
103
|
+
if (isUnreadableBaseline(content, parsed)) {
|
|
102
104
|
unreadable.push(file);
|
|
105
|
+
}
|
|
103
106
|
entries.push(...parsed);
|
|
104
107
|
}
|
|
105
108
|
return { files, entries, unreadable };
|
|
@@ -121,8 +124,9 @@ export function parseBaseline(content) {
|
|
|
121
124
|
const entries = [];
|
|
122
125
|
let current = null;
|
|
123
126
|
const flush = () => {
|
|
124
|
-
if (current === null)
|
|
127
|
+
if (current === null) {
|
|
125
128
|
return;
|
|
129
|
+
}
|
|
126
130
|
// Een blok zonder path is geen bruikbare entry; identifier ontbreekt bij
|
|
127
131
|
// baselines van vóór PHPStan 1.11 en heet dan expliciet onbekend.
|
|
128
132
|
if (current.path !== undefined) {
|
|
@@ -142,25 +146,41 @@ export function parseBaseline(content) {
|
|
|
142
146
|
current = {};
|
|
143
147
|
continue;
|
|
144
148
|
}
|
|
145
|
-
if (current === null)
|
|
149
|
+
if (current === null) {
|
|
146
150
|
continue;
|
|
151
|
+
}
|
|
147
152
|
const match = /^(identifier|path|count|message|rawMessage):\s*(.*)$/.exec(trimmed);
|
|
148
|
-
if (match === null)
|
|
153
|
+
if (match === null) {
|
|
149
154
|
continue;
|
|
155
|
+
}
|
|
150
156
|
const [, key, raw] = match;
|
|
151
157
|
const value = (raw ?? '').trim();
|
|
152
|
-
if (key === 'identifier')
|
|
158
|
+
if (key === 'identifier') {
|
|
153
159
|
current.identifier = unquote(value);
|
|
154
|
-
|
|
160
|
+
}
|
|
161
|
+
else if (key === 'path') {
|
|
155
162
|
current.path = unquote(value);
|
|
156
|
-
|
|
163
|
+
}
|
|
164
|
+
else if (key === 'count') {
|
|
157
165
|
current.count = Number.parseInt(value, 10) || 1;
|
|
158
|
-
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
159
168
|
current.message = unquote(value);
|
|
169
|
+
}
|
|
160
170
|
}
|
|
161
171
|
flush();
|
|
162
172
|
return entries;
|
|
163
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Of een baseline `ignoreErrors` noemt maar er geen entry uit te lezen is: een vorm die deze
|
|
176
|
+
* parser niet kent, en dat is iets anders dan nul fouten. Behalve bij `ignoreErrors: []`: dat
|
|
177
|
+
* schrijft PHPStan met `--allow-empty-baseline` en `prune_baseline` als alles weg is, en het is
|
|
178
|
+
* gewoon een lege baseline. Eerst gold elk bestand met het woord erin zonder entries als kapot,
|
|
179
|
+
* en dan weigerde `baseline_summary` precies de baseline die net helemaal opgeruimd was.
|
|
180
|
+
*/
|
|
181
|
+
export function isUnreadableBaseline(content, entries) {
|
|
182
|
+
return entries.length === 0 && content.includes('ignoreErrors') && !/^\s*ignoreErrors:\s*\[\s*\]\s*$/m.test(content);
|
|
183
|
+
}
|
|
164
184
|
/**
|
|
165
185
|
* De regels voor één bestand, uit alle baseline-bestanden van het project.
|
|
166
186
|
*
|
|
@@ -205,7 +225,7 @@ export function summariseBaseline(project) {
|
|
|
205
225
|
const entries = parseBaseline(content);
|
|
206
226
|
// Een leeg resultaat uit een bestand dat wél ignoreErrors noemt betekent dat
|
|
207
227
|
// de vorm afwijkt van wat we aankunnen. Dat is iets anders dan "nul fouten".
|
|
208
|
-
if (entries
|
|
228
|
+
if (isUnreadableBaseline(content, entries)) {
|
|
209
229
|
throw new BaselineError(`${file} contains ignoreErrors, but not a single entry could be read from it. ` +
|
|
210
230
|
'Probably a format this server does not know.');
|
|
211
231
|
}
|
|
@@ -246,8 +266,9 @@ export function renderBaseline(summary) {
|
|
|
246
266
|
lines.push(`${summary.totals.errors} ignored error(s) in ${summary.totals.entries} baseline ${summary.totals.entries === 1 ? 'entry' : 'entries'}.`);
|
|
247
267
|
if (summary.files.length > 1) {
|
|
248
268
|
lines.push('', 'Per file:');
|
|
249
|
-
for (const file of summary.files)
|
|
269
|
+
for (const file of summary.files) {
|
|
250
270
|
lines.push(` ${pad(file.errors)} ${file.file}`);
|
|
271
|
+
}
|
|
251
272
|
}
|
|
252
273
|
lines.push('', 'Most ignored:', ...summary.byIdentifier.map((row) => ` ${pad(row.count)} ${row.identifier}`), '', 'Most affected files:', ...summary.byPath.map((row) => ` ${pad(row.count)} ${row.path}`), '', 'This is what PHPStan deliberately ignores. What analyse_project reports is exactly what is NOT in here:', 'a project that includes its baseline only reports what is new.');
|
|
253
274
|
return lines.join('\n');
|
|
@@ -264,10 +285,11 @@ function tally(entries, key) {
|
|
|
264
285
|
.slice(0, SUMMARY_ROWS);
|
|
265
286
|
}
|
|
266
287
|
/** Haalt de quotes van een NEON-string af; binnen enkele quotes is `''` één quote. */
|
|
267
|
-
function unquote(value) {
|
|
288
|
+
export function unquote(value) {
|
|
268
289
|
const enkel = /^'(.*)'$/.exec(value);
|
|
269
|
-
if (enkel?.[1] !== undefined)
|
|
290
|
+
if (enkel?.[1] !== undefined) {
|
|
270
291
|
return enkel[1].replace(/''/g, "'");
|
|
292
|
+
}
|
|
271
293
|
return /^"(.*)"$/.exec(value)?.[1] ?? value;
|
|
272
294
|
}
|
|
273
295
|
function pad(count) {
|
package/dist/baseline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../src/baseline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG3E,8DAA8D;AAC9D,MAAM,YAAY,GAAG,EAAE,CAAC;AA2BxB,+EAA+E;AAC/E,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe,EAAE,SAAwB,qBAAqB,EAAE,UAA0B,EAAE;
|
|
1
|
+
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../src/baseline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG3E,8DAA8D;AAC9D,MAAM,YAAY,GAAG,EAAE,CAAC;AA2BxB,+EAA+E;AAC/E,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe,EAAE,SAAwB,qBAAqB,EAAE,UAA0B,EAAE;QAEtG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAwB;IAExD,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aACtD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,4B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AAa;IAEnC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAErC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;AAC9C,CAAC;AAED,SAAS,GAAG,CAAC,KAAa;IAExB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/changed.d.ts
CHANGED
|
@@ -116,6 +116,12 @@ export interface BaselineChange {
|
|
|
116
116
|
* weg en kwam er niets bij beide kanten zijn dus het vermelden waard.
|
|
117
117
|
*/
|
|
118
118
|
export declare function baselineChanges(project: ResolvedProject, base?: string, staged?: boolean): Promise<BaselineChange[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Een bestand zoals het in een revisie stond, of leeg als het daar nog niet bestond —
|
|
121
|
+
* dat is een uitkomst: dan is alles erin nieuw. Achter `--end-of-options`, net als bij
|
|
122
|
+
* `diff`; `checkBase` heeft een leidend streepje dan al geweigerd.
|
|
123
|
+
*/
|
|
124
|
+
export declare function gitShow(cwd: string, object: string): Promise<string>;
|
|
119
125
|
/**
|
|
120
126
|
* De inhoud van een gewijzigd bestand zoals het bij `base` was, voor het "vóór" van
|
|
121
127
|
* `analyse_changed`. Leeg voor een bestand dat daar nog niet bestond (nieuw, of hernoemd:
|
|
@@ -139,3 +145,14 @@ export declare function isOnChangedLine(changed: ChangedFiles, file: string, lin
|
|
|
139
145
|
* van een bestandskop te onderscheiden. Nagemeten, git zet hem er zo neer.
|
|
140
146
|
*/
|
|
141
147
|
export declare function parseChangedLines(patch: string): Map<string, LineRange[]>;
|
|
148
|
+
/** Gooit de GitError die bij deze uitvoering hoort, of niets als hij geslaagd is. */
|
|
149
|
+
export declare function throwIfFailed(cwd: string, args: readonly string[], { code, stderr, spawnError }: Execution): void;
|
|
150
|
+
/** Hoe één git-aanroep afliep; `execute` gooit niet, zodat een aanroeper zelf bepaalt wat een fout is. */
|
|
151
|
+
export interface Execution {
|
|
152
|
+
readonly code: number | null;
|
|
153
|
+
readonly stdout: string;
|
|
154
|
+
readonly stderr: string;
|
|
155
|
+
readonly spawnError: NodeJS.ErrnoException | null;
|
|
156
|
+
}
|
|
157
|
+
/** Start git met `core.quotePath=false` en de vaste opties hieronder; zie de toelichting. */
|
|
158
|
+
export declare function execute(cwd: string, args: readonly string[]): Promise<Execution>;
|