@robhowley/pi-structured-return 1.4.0 → 1.6.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/README.md +108 -74
- package/extensions/structured-return/src/config/registry.test.ts +171 -0
- package/extensions/structured-return/src/config/registry.ts +183 -14
- package/extensions/structured-return/src/index.test.ts +54 -0
- package/extensions/structured-return/src/index.ts +20 -9
- package/extensions/structured-return/src/parsers/ava-text.test.ts +116 -0
- package/extensions/structured-return/src/parsers/ava-text.ts +161 -0
- package/extensions/structured-return/src/parsers/bandit-json.test.ts +90 -0
- package/extensions/structured-return/src/parsers/bandit-json.ts +78 -0
- package/extensions/structured-return/src/parsers/black-text.test.ts +67 -0
- package/extensions/structured-return/src/parsers/black-text.ts +74 -0
- package/extensions/structured-return/src/parsers/cargo-build.ts +2 -2
- package/extensions/structured-return/src/parsers/cargo-test.ts +2 -2
- package/extensions/structured-return/src/parsers/clang-text.test.ts +61 -0
- package/extensions/structured-return/src/parsers/clang-text.ts +59 -0
- package/extensions/structured-return/src/parsers/dbt-json.ts +2 -2
- package/extensions/structured-return/src/parsers/dotnet-build-text.test.ts +85 -0
- package/extensions/structured-return/src/parsers/dotnet-build-text.ts +48 -0
- package/extensions/structured-return/src/parsers/eslint-json.ts +2 -2
- package/extensions/structured-return/src/parsers/go-test-json.test.ts +119 -0
- package/extensions/structured-return/src/parsers/go-test-json.ts +137 -0
- package/extensions/structured-return/src/parsers/hadolint-json.test.ts +73 -0
- package/extensions/structured-return/src/parsers/hadolint-json.ts +55 -0
- package/extensions/structured-return/src/parsers/htmlhint-json.test.ts +72 -0
- package/extensions/structured-return/src/parsers/htmlhint-json.ts +72 -0
- package/extensions/structured-return/src/parsers/isort-text.test.ts +58 -0
- package/extensions/structured-return/src/parsers/isort-text.ts +64 -0
- package/extensions/structured-return/src/parsers/javac-text.test.ts +75 -0
- package/extensions/structured-return/src/parsers/javac-text.ts +81 -0
- package/extensions/structured-return/src/parsers/jsonlint-text.test.ts +52 -0
- package/extensions/structured-return/src/parsers/jsonlint-text.ts +64 -0
- package/extensions/structured-return/src/parsers/junit-xml.ts +2 -2
- package/extensions/structured-return/src/parsers/markdownlint-json.test.ts +76 -0
- package/extensions/structured-return/src/parsers/markdownlint-json.ts +73 -0
- package/extensions/structured-return/src/parsers/minitest-text.ts +2 -2
- package/extensions/structured-return/src/parsers/mocha-json.test.ts +108 -0
- package/extensions/structured-return/src/parsers/mocha-json.ts +77 -0
- package/extensions/structured-return/src/parsers/mypy-json.test.ts +101 -0
- package/extensions/structured-return/src/parsers/mypy-json.ts +80 -0
- package/extensions/structured-return/src/parsers/node-test-text.test.ts +117 -0
- package/extensions/structured-return/src/parsers/node-test-text.ts +90 -0
- package/extensions/structured-return/src/parsers/npm-audit-json.test.ts +83 -0
- package/extensions/structured-return/src/parsers/npm-audit-json.ts +88 -0
- package/extensions/structured-return/src/parsers/prettier-text.test.ts +76 -0
- package/extensions/structured-return/src/parsers/prettier-text.ts +63 -0
- package/extensions/structured-return/src/parsers/pylint-json.test.ts +120 -0
- package/extensions/structured-return/src/parsers/pylint-json.ts +64 -0
- package/extensions/structured-return/src/parsers/pyright-json.test.ts +112 -0
- package/extensions/structured-return/src/parsers/pyright-json.ts +81 -0
- package/extensions/structured-return/src/parsers/rspec-json.ts +2 -2
- package/extensions/structured-return/src/parsers/rubocop-json.test.ts +118 -0
- package/extensions/structured-return/src/parsers/rubocop-json.ts +65 -0
- package/extensions/structured-return/src/parsers/ruff-json.ts +2 -2
- package/extensions/structured-return/src/parsers/shellcheck-json.test.ts +110 -0
- package/extensions/structured-return/src/parsers/shellcheck-json.ts +61 -0
- package/extensions/structured-return/src/parsers/stylelint-json.test.ts +120 -0
- package/extensions/structured-return/src/parsers/stylelint-json.ts +68 -0
- package/extensions/structured-return/src/parsers/swiftc-text.test.ts +73 -0
- package/extensions/structured-return/src/parsers/swiftc-text.ts +47 -0
- package/extensions/structured-return/src/parsers/tail-fallback.ts +2 -2
- package/extensions/structured-return/src/parsers/tidy-text.test.ts +74 -0
- package/extensions/structured-return/src/parsers/tidy-text.ts +67 -0
- package/extensions/structured-return/src/parsers/tsc-text.test.ts +81 -0
- package/extensions/structured-return/src/parsers/tsc-text.ts +47 -0
- package/extensions/structured-return/src/parsers/unittest-text.test.ts +126 -0
- package/extensions/structured-return/src/parsers/unittest-text.ts +116 -0
- package/extensions/structured-return/src/parsers/utils.ts +43 -0
- package/extensions/structured-return/src/parsers/vale-json.test.ts +84 -0
- package/extensions/structured-return/src/parsers/vale-json.ts +80 -0
- package/extensions/structured-return/src/parsers/vitest-json.ts +2 -2
- package/package.json +1 -1
- package/skills/structured-return/SKILL.md +93 -2
package/README.md
CHANGED
|
@@ -1,50 +1,118 @@
|
|
|
1
1
|
# pi-structured-return
|
|
2
2
|
|
|
3
|
-
Structured command execution for
|
|
3
|
+
Structured command execution for Pi agents: compact results for the model, full logs for humans.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Tool output is designed for humans: source diffs, line annotations, timing breakdowns, absolute paths repeated on every line. Useful on a terminal. Expensive in a model context, especially on failure when output is most verbose and the model needs to act fast.
|
|
6
|
+
|
|
7
|
+
This Pi package adds a `structured_return` tool alongside `bash`. A bundled skill teaches the model when to reach for it — test suites, linters, build tools, data pipelines — anywhere verbose output burns tokens. It captures full logs, applies a parser, and returns a compact structured result. The full output stays on disk.
|
|
8
|
+
|
|
9
|
+
**Raw pytest output (262 tokens):**
|
|
10
|
+
```
|
|
11
|
+
============================= test session starts ==============================
|
|
12
|
+
platform darwin -- Python 3.14.2, pytest-9.0.2
|
|
13
|
+
collecting ... collected 3 items
|
|
14
|
+
|
|
15
|
+
test_math.py::test_adds_two_numbers_correctly PASSED [ 33%]
|
|
16
|
+
test_math.py::test_multiplies_two_numbers_correctly FAILED [ 66%]
|
|
17
|
+
test_math.py::test_does_not_divide_by_zero FAILED [100%]
|
|
18
|
+
|
|
19
|
+
=================================== FAILURES ===================================
|
|
20
|
+
____________________ test_multiplies_two_numbers_correctly _____________________
|
|
21
|
+
|
|
22
|
+
def test_multiplies_two_numbers_correctly():
|
|
23
|
+
> assert 3 * 4 == 99
|
|
24
|
+
E assert (3 * 4) == 99
|
|
25
|
+
|
|
26
|
+
test_math.py:5: AssertionError
|
|
27
|
+
_________________________ test_does_not_divide_by_zero _________________________
|
|
28
|
+
|
|
29
|
+
def test_does_not_divide_by_zero():
|
|
30
|
+
> result = 1 / 0
|
|
31
|
+
^^^^^
|
|
32
|
+
E ZeroDivisionError: division by zero
|
|
8
33
|
|
|
9
|
-
|
|
10
|
-
|
|
34
|
+
test_math.py:8: ZeroDivisionError
|
|
35
|
+
=========================== short test summary info ============================
|
|
36
|
+
FAILED test_math.py::test_multiplies_two_numbers_correctly
|
|
37
|
+
FAILED test_math.py::test_does_not_divide_by_zero - ZeroDivisionError: ...
|
|
38
|
+
========================= 2 failed, 1 passed in 0.01s ==========================
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Structured result returned to the model (56 tokens):**
|
|
42
|
+
```
|
|
43
|
+
pytest test_math.py --junitxml=.tmp/report.xml → cwd: project
|
|
44
|
+
2 failed, 1 passed
|
|
45
|
+
test_math.py:5 assert (3 * 4) == 99
|
|
46
|
+
test_math.py:8 ZeroDivisionError: division by zero
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
262 → 56 tokens. The model knows which tests failed, where, and why. No platform line, no progress bar, no source snippets, no banner separators, no short summary repeating the same info. And that's a single run — in an agentic loop the cost compounds. Every tool result accumulates in context for the life of the task. Over 15 red-green iterations, the difference isn't 262 vs 56 — it's 3,930 vs 840 tokens for one command in one task.
|
|
11
50
|
|
|
12
51
|
## Token reduction
|
|
13
52
|
|
|
14
|
-
|
|
53
|
+
Measured with `cl100k_base` (tiktoken). All benchmarks use tiny fixtures — reduction grows with real-world output.
|
|
54
|
+
|
|
55
|
+
### Test runners
|
|
15
56
|
|
|
16
|
-
|
|
17
|
-
- Linters: 1 unused variable warning in a single file.
|
|
57
|
+
Benchmark: 3 tests — 1 passing, 1 assertion failure, 1 unexpected error.
|
|
18
58
|
|
|
19
|
-
| Parser | Raw
|
|
59
|
+
| Parser | Raw | Structured | Reduction | Notes |
|
|
20
60
|
|---|---|---|---|---|
|
|
61
|
+
| `go-test-json` | 1819 | 48 | **97%** | NDJSON event stream with stack traces; file:line + expected/actual preserved |
|
|
21
62
|
| `junit-xml` (maven) | 1063 | 86 | **92%** | build lifecycle noise with surefire stack traces per failure |
|
|
63
|
+
| `node-test-text` | 629 | 64 | **90%** | strips full stack traces, assertion internals, timing; preserves expected/actual |
|
|
64
|
+
| `ava-text` | 483 | 56 | **88%** | source snippets, diffs, full stack traces stripped; expected/actual preserved |
|
|
22
65
|
| `junit-xml` (go) | 400 | 58 | **86%** | verbose output with full stack trace per failure |
|
|
23
66
|
| `junit-xml` (dotnet) | 487 | 107 | **78%** | build header and VSTest output with per-failure stack traces |
|
|
24
67
|
| `vitest-json` | 348 | 75 | **78%** | source diff with inline arrows and ANSI color codes per failure |
|
|
68
|
+
| `unittest-text` | 231 | 52 | **78%** | full tracebacks with source annotations; expected/actual from AssertionError |
|
|
25
69
|
| `cargo-test` | 285 | 68 | **76%** | cargo progress + test binary output with panic traces per failure |
|
|
26
70
|
| `junit-xml` (pytest) | 289 | 71 | **75%** | verbose output with source snippets and summary footer |
|
|
27
71
|
| `rspec-json` | 212 | 55 | **74%** | default output with backtrace |
|
|
28
72
|
| `junit-xml` (gradle) | 263 | 81 | **69%** | gradle console output with build lifecycle noise |
|
|
73
|
+
| `mocha-json` | 180 | 55 | **69%** | stack traces + assertion diff formatting; expected/actual preserved |
|
|
29
74
|
| `junit-xml` (jest) | 309 | 99 | **68%** | source annotations with deep jest-circus stack traces per failure |
|
|
30
|
-
| `cargo-build` | 225 | 77 | **66%** | rustc error annotations with code spans and help text per error |
|
|
31
75
|
| `minitest-text` | 168 | 59 | **65%** | default output with backtrace |
|
|
76
|
+
|
|
77
|
+
### Linters, type checkers, and build tools
|
|
78
|
+
|
|
79
|
+
Benchmark: 1 file, 1–2 violations. Reduction is a conservative lower bound — scales with file and error count since raw output repeats paths, source snippets, and annotations per violation.
|
|
80
|
+
|
|
81
|
+
| Parser | Raw | Structured | Reduction | Notes |
|
|
82
|
+
|---|---|---|---|---|
|
|
83
|
+
| `dotnet-build-text` | 383 | 53 | **86%** | strips restore/timing noise, deduplicates repeated error lines, absolute paths relativized |
|
|
84
|
+
| `cargo-build` | 225 | 77 | **66%** | rustc error annotations with code spans and help text per error |
|
|
85
|
+
| `swiftc-text` | 161 | 58 | **64%** | source annotations with backtick markers deduplicated |
|
|
32
86
|
| `ruff-json` | 107 | 52 | **51%** | source context + help text per error |
|
|
87
|
+
| `shellcheck-json` | 224 | 117 | **48%** | strips source snippets, carets, suggestions, wiki URLs |
|
|
88
|
+
| `rubocop-json` | 149 | 90 | **40%** | strips source snippets, caret indicators, summary line |
|
|
89
|
+
| `tsc-text` | 107 | 72 | **33%** | vs `--pretty true` default; source snippets and underlines stripped |
|
|
90
|
+
| `stylelint-json` | 70 | 51 | **27%** | strips summary footer and fix hint |
|
|
91
|
+
| `pylint-json` | 141 | 120 | **15%** | strips header, score line, separator; scales with error count |
|
|
92
|
+
| `hadolint-json` | 178 | 156 | **12%** | strips ANSI color codes and level labels; measured vs colored output |
|
|
93
|
+
| `prettier-text` | 38 | 33 | **13%** | strips preamble, [warn] prefixes, footer hint; scales with file count |
|
|
33
94
|
| `eslint-json` | 64 | 59 | **8%** | already compact formatter |
|
|
34
|
-
|
|
35
|
-
|
|
95
|
+
| `jsonlint-text` | 148 | 28 | **81%** | strips stack trace, source pointer line; preserves line number and expecting message |
|
|
96
|
+
| `npm-audit-json` | 158 | 50 | **68%** | strips advisory URLs, fix instructions, CVSS vectors; advisory titles joined per package |
|
|
97
|
+
| `isort-text` | 143 | 29 | **80%** | strips diff hunks, absolute paths, timestamps; lists files with unsorted imports |
|
|
98
|
+
| `htmlhint-json` | 174 | 92 | **47%** | strips ANSI codes, source evidence, rule descriptions, URLs |
|
|
99
|
+
| `tidy-text` | 233 | 51 | **78%** | strips remediation advice, accessibility tips, HTML output, Info lines |
|
|
100
|
+
| `bandit-json` | 402 | 99 | **75%** | strips source snippets, CWE URLs, run metrics, confidence labels |
|
|
101
|
+
| `markdownlint-json` | 199 | 117 | **41%** | strips context quotes, URLs, fix info, error ranges |
|
|
102
|
+
| `vale-json` | 141 | 79 | **44%** | strips ANSI codes, Action/Span/Description fields, column-aligned formatting |
|
|
103
|
+
| `pyright-json` | 100 | 59 | **41%** | strips version, timing, absolute paths; detail lines collapsed |
|
|
104
|
+
| `clang-text` | 109 | 77 | **29%** | strips source snippets, caret indicators, line numbers from gutter |
|
|
105
|
+
| `javac-text` | 79 | 66 | **16%** | strips source snippets, caret indicators; folds symbol/location into message |
|
|
106
|
+
| `mypy-json` | 75 | 72 | **4%** | mypy text is already compact; notes folded into parent errors |
|
|
107
|
+
| `black-text` | 155 | 31 | **80%** | strips diff hunks, emoji, timestamps; lists files needing reformatting |
|
|
36
108
|
|
|
37
109
|
### Pipeline tools
|
|
38
110
|
|
|
39
|
-
dbt output is the noisiest tool in this repo relative to useful signal. Every run prints version info, adapter registration, project stats, concurrency settings, and per-node start/finish lines — all before any result.
|
|
111
|
+
dbt output is the noisiest tool in this repo relative to useful signal. Every run prints version info, adapter registration, project stats, concurrency settings, and per-node start/finish lines — all before any result.
|
|
40
112
|
|
|
41
113
|
The numbers below use 3–4 model toy examples; real projects run hundreds of models where the noise scales linearly and reduction compounds.
|
|
42
114
|
|
|
43
|
-
|
|
44
|
-
- dbt test: 3 tests, 1 passing, 1 uniqueness failure, 1 unit test diff.
|
|
45
|
-
- dbt compile: 3 models compiled to SQL.
|
|
46
|
-
|
|
47
|
-
| Parser | Raw (tokens) | Structured (tokens) | Reduction | Notes |
|
|
115
|
+
| Parser | Raw | Structured | Reduction | Notes |
|
|
48
116
|
|---|---|---|---|---|
|
|
49
117
|
| `dbt-json` (run, success) | 428 | 20 | **95%** | version, adapter, concurrency, per-model start/finish — all noise on success |
|
|
50
118
|
| `dbt-json` (run, failure) | 618 | 198 | **68%** | error messages, model paths, compiled code paths preserved |
|
|
@@ -53,82 +121,51 @@ The numbers below use 3–4 model toy examples; real projects run hundreds of mo
|
|
|
53
121
|
|
|
54
122
|
At 12 models, run failures hit 85% reduction. An 18-model DAG success: 1,645 → 20 tokens (99%).
|
|
55
123
|
|
|
56
|
-
|
|
57
|
-
- `junit-xml` (JUnit XML — covers pytest `--junitxml`, Gradle, Maven, Jest with `jest-junit`, Go with `go-junit-report`, and any other tool that emits the JUnit XML schema)
|
|
58
|
-
- `vitest-json`
|
|
59
|
-
- `rspec-json`
|
|
60
|
-
- `minitest-text` (parses default minitest output — no flags or reporters needed)
|
|
61
|
-
- `dbt-json` (`dbt run/test/compile --log-format json` — errors, warnings, and unit test diffs from JSONL; compiled SQL returned for compile; success runs reduced to a one-line summary)
|
|
62
|
-
- `cargo-build` (`cargo build --message-format=json` — errors with file, line, error code, and primary span label; warnings filtered out)
|
|
63
|
-
- `cargo-test` (`cargo test` — assertion left/right values, panic messages, and file:line per failure; detects compilation failures and directs to `cargo build --message-format=json`)
|
|
64
|
-
- `ruff-json` (`ruff check` only — `ruff format` has no json support)
|
|
65
|
-
- `eslint-json`
|
|
124
|
+
### Already compact — use `bash` directly
|
|
66
125
|
|
|
126
|
+
Evaluated for structured parsing but raw output is already compact enough that a parser adds no reduction (or goes negative). Use `bash` instead of `structured_return` for these tools.
|
|
67
127
|
|
|
68
|
-
|
|
128
|
+
| Tool | Raw tokens | Format | Why no parser |
|
|
129
|
+
|---|---|---|---|
|
|
130
|
+
| `go build` | 85 | `file:line:col: message` | one line per error, no decoration |
|
|
131
|
+
| `flake8` | 75 | `file:line:col: CODE message` | no JSON without a plugin; text is already one line per violation |
|
|
132
|
+
| `yamllint` | 72 | `file:line:col level message (rule)` | filename printed once; one line per issue |
|
|
133
|
+
| `golangci-lint` | 59 | `file:line:col: message (linter)` | text output already minimal; JSON includes massive linter report |
|
|
134
|
+
| `go vet` | ~60 | `file:line:col: message` | same format as go build |
|
|
135
|
+
| `vulture` | 58 | `file:line: message (confidence%)` | single line per finding |
|
|
136
|
+
| `pydocstyle` | 48 | `file:line context + CODE: message` | two lines per issue; structured format would repeat file paths |
|
|
69
137
|
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
============================= test session starts ==============================
|
|
73
|
-
platform darwin -- Python 3.14.2, pytest-9.0.2
|
|
74
|
-
collecting ... collected 3 items
|
|
138
|
+
## Built-in parsers
|
|
75
139
|
|
|
76
|
-
|
|
77
|
-
test_math.py::test_multiplies_two_numbers_correctly FAILED [ 66%]
|
|
78
|
-
test_math.py::test_does_not_divide_by_zero FAILED [100%]
|
|
140
|
+
**Test runners:** `junit-xml` (pytest, Gradle, Maven, Jest, Go, .NET — anything that emits JUnit XML), `vitest-json`, `rspec-json`, `minitest-text`, `cargo-test`, `go-test-json`, `mocha-json`, `ava-text`, `unittest-text`, `node-test-text`
|
|
79
141
|
|
|
80
|
-
|
|
81
|
-
____________________ test_multiplies_two_numbers_correctly _____________________
|
|
142
|
+
**Linters & type checkers:** `ruff-json`, `eslint-json`, `mypy-json`, `pyright-json`, `tsc-text`, `pylint-json`, `shellcheck-json`, `rubocop-json`, `swiftc-text`, `hadolint-json`, `stylelint-json`, `black-text`, `markdownlint-json`, `prettier-text`, `vale-json`, `tidy-text`, `jsonlint-text`, `isort-text`, `htmlhint-json`
|
|
82
143
|
|
|
83
|
-
|
|
84
|
-
> assert 3 * 4 == 99
|
|
85
|
-
E assert (3 * 4) == 99
|
|
144
|
+
**Build tools:** `cargo-build`, `javac-text`, `dotnet-build-text`, `clang-text`
|
|
86
145
|
|
|
87
|
-
|
|
88
|
-
_________________________ test_does_not_divide_by_zero _________________________
|
|
146
|
+
**Security & audit:** `bandit-json`, `npm-audit-json`
|
|
89
147
|
|
|
90
|
-
|
|
91
|
-
> result = 1 / 0
|
|
92
|
-
^^^^^
|
|
93
|
-
E ZeroDivisionError: division by zero
|
|
148
|
+
**Pipeline tools:** `dbt-json` (run, test, compile)
|
|
94
149
|
|
|
95
|
-
|
|
96
|
-
=========================== short test summary info ============================
|
|
97
|
-
FAILED test_math.py::test_multiplies_two_numbers_correctly
|
|
98
|
-
FAILED test_math.py::test_does_not_divide_by_zero - ZeroDivisionError: ...
|
|
99
|
-
========================= 2 failed, 1 passed in 0.01s ==========================
|
|
100
|
-
```
|
|
150
|
+
Run `/sr-parsers` in a pi session to see all registered parsers with their match rules.
|
|
101
151
|
|
|
102
|
-
**Structured result returned to the model (56 tokens):**
|
|
103
|
-
```
|
|
104
|
-
pytest test_math.py --junitxml=.tmp/report.xml → cwd: project
|
|
105
|
-
2 failed, 1 passed
|
|
106
|
-
test_math.py:5 assert (3 * 4) == 99
|
|
107
|
-
test_math.py:8 ZeroDivisionError: division by zero
|
|
108
|
-
```
|
|
109
152
|
|
|
110
153
|
## Installation
|
|
111
154
|
|
|
155
|
+
Install the skill and extension:
|
|
156
|
+
|
|
112
157
|
```bash
|
|
113
158
|
pi install npm:@robhowley/pi-structured-return
|
|
114
159
|
```
|
|
115
160
|
|
|
116
161
|
## How it works
|
|
117
162
|
|
|
118
|
-
1. The agent runs commands through `structured_return`
|
|
163
|
+
1. The agent runs commands through `structured_return` when it would reduce noise and token usage.
|
|
119
164
|
2. Full output is captured and stored as a log.
|
|
120
165
|
3. A parser converts noisy CLI output into a compact structured result. If no parser matches, the last 200 lines and the log path are returned as a fallback.
|
|
121
166
|
4. The agent receives the structured result in context — signal only, no noise.
|
|
122
167
|
5. The full log is always available on disk for both the agent and humans to inspect.
|
|
123
168
|
|
|
124
|
-
## Agentic loops
|
|
125
|
-
|
|
126
|
-
The token table above measures a single run. In an agentic loop the cost compounds — every tool result accumulates in context for the life of the task.
|
|
127
|
-
|
|
128
|
-
This applies to any loop: fixing a failing test suite, implementing a feature end-to-end, working through a migration, performance tuning execution times. The agent runs a command, reads the result, makes a change, runs it again. Each iteration adds another tool result to the context window. With a noisy CLI that means paying for the same verbose boilerplate every time.
|
|
129
|
-
|
|
130
|
-
A parser reduces each run to a one- or two-line signal. Over 15 iterations the difference isn't 80 tokens vs 15 tokens — it's 1,200 tokens vs 225 for a single command in a single task.
|
|
131
|
-
|
|
132
169
|
## Extending with project-local parsers
|
|
133
170
|
|
|
134
171
|
Built-in parsers cover common tools. For everything else — internal CLIs, custom test runners, proprietary lint tools — add a `.pi/structured-return.json` to your project root.
|
|
@@ -193,9 +230,6 @@ export default {
|
|
|
193
230
|
|
|
194
231
|
The parser receives a `RunContext` (command, argv, cwd, stdout/stderr paths, artifact paths, log path) and returns a `ParsedResult`. Match rules support `argvIncludes` (array of required tokens) or `regex` (tested against the full argv string).
|
|
195
232
|
|
|
196
|
-
## Slash commands
|
|
197
|
-
- `/sr-parsers` — list all registered parsers (built-in and project-local) with their match rules and targets
|
|
198
|
-
|
|
199
233
|
## Structured result schema
|
|
200
234
|
|
|
201
235
|
Every parser returns the same shape. The model always knows where to look.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { resolveParser } from "./registry";
|
|
3
|
+
|
|
4
|
+
/** Resolve a parser from argv with no explicit parseAs or project registrations. */
|
|
5
|
+
async function detect(argv: string[]) {
|
|
6
|
+
const parser = await resolveParser({ cwd: "/project", argv, registrations: [] });
|
|
7
|
+
return parser.id;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe("resolveParser priority", () => {
|
|
11
|
+
it("explicit parseAs wins over auto-detect", async () => {
|
|
12
|
+
// argv would auto-detect as ruff-json, but parseAs overrides
|
|
13
|
+
const parser = await resolveParser({
|
|
14
|
+
cwd: "/project",
|
|
15
|
+
parseAs: "eslint-json",
|
|
16
|
+
argv: ["ruff", "check", "--output-format=json"],
|
|
17
|
+
registrations: [],
|
|
18
|
+
});
|
|
19
|
+
expect(parser.id).toBe("eslint-json");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("project registration wins over auto-detect", async () => {
|
|
23
|
+
const parser = await resolveParser({
|
|
24
|
+
cwd: "/project",
|
|
25
|
+
argv: ["ruff", "check", "--output-format=json"],
|
|
26
|
+
registrations: [{ id: "custom", match: { argvIncludes: ["ruff"] }, parseAs: "eslint-json" }],
|
|
27
|
+
});
|
|
28
|
+
expect(parser.id).toBe("eslint-json");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("falls back to tail-fallback when nothing matches", async () => {
|
|
32
|
+
const parser = await resolveParser({ cwd: "/project", argv: ["unknown-tool"], registrations: [] });
|
|
33
|
+
expect(parser.id).toBe("tail-fallback");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("AUTO_DETECT", () => {
|
|
38
|
+
describe("hasFlag correctness — no false positives from bare value tokens", () => {
|
|
39
|
+
it("eslint -f json matches", async () => {
|
|
40
|
+
expect(await detect(["eslint", "src/", "-f", "json"])).toBe("eslint-json");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("eslint without -f json does not match", async () => {
|
|
44
|
+
expect(await detect(["eslint", "src/"])).toBe("tail-fallback");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("ruff --output-format=json (joined) matches", async () => {
|
|
48
|
+
expect(await detect(["ruff", "check", "--output-format=json"])).toBe("ruff-json");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("ruff --output-format json (split) matches", async () => {
|
|
52
|
+
expect(await detect(["ruff", "check", "--output-format", "json"])).toBe("ruff-json");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("ruff without --output-format does not match", async () => {
|
|
56
|
+
expect(await detect(["ruff", "check"])).toBe("tail-fallback");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("mocha --reporter=json matches", async () => {
|
|
60
|
+
expect(await detect(["mocha", "--reporter=json"])).toBe("mocha-json");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("mocha --reporter json (split) matches", async () => {
|
|
64
|
+
expect(await detect(["mocha", "--reporter", "json"])).toBe("mocha-json");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("mocha with json in path does NOT false-positive", async () => {
|
|
68
|
+
expect(await detect(["mocha", "test/json/"])).toBe("tail-fallback");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("rubocop --format=json matches", async () => {
|
|
72
|
+
expect(await detect(["rubocop", "--format=json"])).toBe("rubocop-json");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("rubocop --format progress does NOT false-positive", async () => {
|
|
76
|
+
expect(await detect(["rubocop", "--format", "progress"])).toBe("tail-fallback");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("hadolint --format json (split) matches", async () => {
|
|
80
|
+
expect(await detect(["hadolint", "--format", "json", "Dockerfile"])).toBe("hadolint-json");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("hadolint without --format does NOT match", async () => {
|
|
84
|
+
expect(await detect(["hadolint", "Dockerfile"])).toBe("tail-fallback");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("tsc --pretty false (split) matches", async () => {
|
|
88
|
+
expect(await detect(["tsc", "--pretty", "false"])).toBe("tsc-text");
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("tsc --pretty=false (joined) matches", async () => {
|
|
92
|
+
expect(await detect(["tsc", "--pretty=false"])).toBe("tsc-text");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("tsc without --pretty does NOT match", async () => {
|
|
96
|
+
expect(await detect(["tsc"])).toBe("tail-fallback");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("mypy --output=json matches", async () => {
|
|
100
|
+
expect(await detect(["mypy", "--output=json", "src/"])).toBe("mypy-json");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("mypy --output html does NOT false-positive", async () => {
|
|
104
|
+
expect(await detect(["mypy", "--output", "html", "src/"])).toBe("tail-fallback");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("pylint --output-format=json matches", async () => {
|
|
108
|
+
expect(await detect(["pylint", "--output-format=json", "src/"])).toBe("pylint-json");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("shellcheck --format=json matches", async () => {
|
|
112
|
+
expect(await detect(["shellcheck", "--format=json", "script.sh"])).toBe("shellcheck-json");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("stylelint --formatter=json matches", async () => {
|
|
116
|
+
expect(await detect(["stylelint", "--formatter=json", "src/"])).toBe("stylelint-json");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("dbt run --log-format=json matches", async () => {
|
|
120
|
+
expect(await detect(["dbt", "run", "--log-format=json"])).toBe("dbt-json");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("dbt run --log-format json (split) matches", async () => {
|
|
124
|
+
expect(await detect(["dbt", "run", "--log-format", "json"])).toBe("dbt-json");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("dbt run without --log-format does NOT match", async () => {
|
|
128
|
+
expect(await detect(["dbt", "run"])).toBe("tail-fallback");
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("remaining flag-based detectors", () => {
|
|
133
|
+
it("rspec --format=json matches", async () => {
|
|
134
|
+
expect(await detect(["rspec", "--format=json"])).toBe("rspec-json");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("cargo build --message-format=json matches", async () => {
|
|
138
|
+
expect(await detect(["cargo", "build", "--message-format=json"])).toBe("cargo-build");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("pytest --junitxml matches junit-xml", async () => {
|
|
142
|
+
expect(await detect(["pytest", "--junitxml=report.xml"])).toBe("junit-xml");
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe("non-flag-based detectors still work", () => {
|
|
147
|
+
it("cargo test matches", async () => {
|
|
148
|
+
expect(await detect(["cargo", "test"])).toBe("cargo-test");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("go test -json matches", async () => {
|
|
152
|
+
expect(await detect(["go", "test", "-json", "./..."])).toBe("go-test-json");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("ava matches", async () => {
|
|
156
|
+
expect(await detect(["ava"])).toBe("ava-text");
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("swiftc -typecheck matches", async () => {
|
|
160
|
+
expect(await detect(["swiftc", "-typecheck", "main.swift"])).toBe("swiftc-text");
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("python3 -m unittest matches", async () => {
|
|
164
|
+
expect(await detect(["python3", "-m", "unittest"])).toBe("unittest-text");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("vitest --reporter=json matches", async () => {
|
|
168
|
+
expect(await detect(["vitest", "run", "--reporter=json"])).toBe("vitest-json");
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -9,6 +9,33 @@ import junitXml from "../parsers/junit-xml";
|
|
|
9
9
|
import cargoBuild from "../parsers/cargo-build";
|
|
10
10
|
import cargoTest from "../parsers/cargo-test";
|
|
11
11
|
import dbtJson from "../parsers/dbt-json";
|
|
12
|
+
import mypyJson from "../parsers/mypy-json";
|
|
13
|
+
import tscText from "../parsers/tsc-text";
|
|
14
|
+
import pylintJson from "../parsers/pylint-json";
|
|
15
|
+
import shellcheckJson from "../parsers/shellcheck-json";
|
|
16
|
+
import rubocopJson from "../parsers/rubocop-json";
|
|
17
|
+
import swiftcText from "../parsers/swiftc-text";
|
|
18
|
+
import hadolintJson from "../parsers/hadolint-json";
|
|
19
|
+
import stylelintJson from "../parsers/stylelint-json";
|
|
20
|
+
import mochaJson from "../parsers/mocha-json";
|
|
21
|
+
import unittestText from "../parsers/unittest-text";
|
|
22
|
+
import goTestJson from "../parsers/go-test-json";
|
|
23
|
+
import avaText from "../parsers/ava-text";
|
|
24
|
+
import pyrightJson from "../parsers/pyright-json";
|
|
25
|
+
import banditJson from "../parsers/bandit-json";
|
|
26
|
+
import javacText from "../parsers/javac-text";
|
|
27
|
+
import dotnetBuildText from "../parsers/dotnet-build-text";
|
|
28
|
+
import clangText from "../parsers/clang-text";
|
|
29
|
+
import nodeTestText from "../parsers/node-test-text";
|
|
30
|
+
import blackText from "../parsers/black-text";
|
|
31
|
+
import markdownlintJson from "../parsers/markdownlint-json";
|
|
32
|
+
import prettierText from "../parsers/prettier-text";
|
|
33
|
+
import valeJson from "../parsers/vale-json";
|
|
34
|
+
import tidyText from "../parsers/tidy-text";
|
|
35
|
+
import jsonlintText from "../parsers/jsonlint-text";
|
|
36
|
+
import npmAuditJson from "../parsers/npm-audit-json";
|
|
37
|
+
import isortText from "../parsers/isort-text";
|
|
38
|
+
import htmlhintJson from "../parsers/htmlhint-json";
|
|
12
39
|
import tailFallback from "../parsers/tail-fallback";
|
|
13
40
|
|
|
14
41
|
const builtIns: Record<string, ParserModule> = {
|
|
@@ -21,31 +48,65 @@ const builtIns: Record<string, ParserModule> = {
|
|
|
21
48
|
"cargo-build": cargoBuild,
|
|
22
49
|
"cargo-test": cargoTest,
|
|
23
50
|
"dbt-json": dbtJson,
|
|
51
|
+
"mypy-json": mypyJson,
|
|
52
|
+
"tsc-text": tscText,
|
|
53
|
+
"pylint-json": pylintJson,
|
|
54
|
+
"shellcheck-json": shellcheckJson,
|
|
55
|
+
"rubocop-json": rubocopJson,
|
|
56
|
+
"swiftc-text": swiftcText,
|
|
57
|
+
"hadolint-json": hadolintJson,
|
|
58
|
+
"stylelint-json": stylelintJson,
|
|
59
|
+
"mocha-json": mochaJson,
|
|
60
|
+
"unittest-text": unittestText,
|
|
61
|
+
"go-test-json": goTestJson,
|
|
62
|
+
"ava-text": avaText,
|
|
63
|
+
"pyright-json": pyrightJson,
|
|
64
|
+
"bandit-json": banditJson,
|
|
65
|
+
"javac-text": javacText,
|
|
66
|
+
"dotnet-build-text": dotnetBuildText,
|
|
67
|
+
"clang-text": clangText,
|
|
68
|
+
"node-test-text": nodeTestText,
|
|
69
|
+
"black-text": blackText,
|
|
70
|
+
"markdownlint-json": markdownlintJson,
|
|
71
|
+
"prettier-text": prettierText,
|
|
72
|
+
"vale-json": valeJson,
|
|
73
|
+
"tidy-text": tidyText,
|
|
74
|
+
"jsonlint-text": jsonlintText,
|
|
75
|
+
"npm-audit-json": npmAuditJson,
|
|
76
|
+
"isort-text": isortText,
|
|
77
|
+
"htmlhint-json": htmlhintJson,
|
|
24
78
|
"tail-fallback": tailFallback,
|
|
25
79
|
};
|
|
26
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Check whether argv contains `--flag=value` (joined) or `--flag value` (adjacent).
|
|
83
|
+
* Avoids false positives from bare `value` tokens appearing elsewhere in argv.
|
|
84
|
+
*/
|
|
85
|
+
function hasFlag(argv: string[], flag: string, value: string): boolean {
|
|
86
|
+
if (argv.includes(`${flag}=${value}`)) return true;
|
|
87
|
+
for (let i = 0; i < argv.length - 1; i++) {
|
|
88
|
+
if (argv[i] === flag && argv[i + 1] === value) return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
|
|
27
93
|
/** Built-in detection patterns — fire when no explicit parseAs or project registration matched. */
|
|
28
94
|
const AUTO_DETECT: Array<{ parserId: string; detect: (argv: string[]) => boolean }> = [
|
|
29
95
|
{
|
|
30
96
|
parserId: "eslint-json",
|
|
31
|
-
detect: (argv) => argv.includes("eslint") && argv
|
|
97
|
+
detect: (argv) => argv.includes("eslint") && hasFlag(argv, "-f", "json"),
|
|
32
98
|
},
|
|
33
99
|
{
|
|
34
100
|
parserId: "ruff-json",
|
|
35
|
-
detect: (argv) =>
|
|
36
|
-
argv.includes("ruff") &&
|
|
37
|
-
argv.some((a) => a === "--output-format=json" || a === "json") &&
|
|
38
|
-
(argv.includes("--output-format=json") || argv.includes("--output-format")),
|
|
101
|
+
detect: (argv) => argv.includes("ruff") && hasFlag(argv, "--output-format", "json"),
|
|
39
102
|
},
|
|
40
103
|
{
|
|
41
104
|
parserId: "vitest-json",
|
|
42
|
-
detect: (argv) => argv.includes("vitest") && argv
|
|
105
|
+
detect: (argv) => argv.includes("vitest") && hasFlag(argv, "--reporter", "json"),
|
|
43
106
|
},
|
|
44
107
|
{
|
|
45
108
|
parserId: "rspec-json",
|
|
46
|
-
detect: (argv) =>
|
|
47
|
-
argv.includes("rspec") &&
|
|
48
|
-
(argv.includes("--format=json") || (argv.includes("--format") && argv.includes("json"))),
|
|
109
|
+
detect: (argv) => argv.includes("rspec") && hasFlag(argv, "--format", "json"),
|
|
49
110
|
},
|
|
50
111
|
{
|
|
51
112
|
parserId: "junit-xml",
|
|
@@ -54,10 +115,7 @@ const AUTO_DETECT: Array<{ parserId: string; detect: (argv: string[]) => boolean
|
|
|
54
115
|
},
|
|
55
116
|
{
|
|
56
117
|
parserId: "cargo-build",
|
|
57
|
-
detect: (argv) =>
|
|
58
|
-
argv.includes("cargo") &&
|
|
59
|
-
argv.includes("build") &&
|
|
60
|
-
argv.some((a) => a.startsWith("--message-format=json") || a === "json"),
|
|
118
|
+
detect: (argv) => argv.includes("cargo") && argv.includes("build") && hasFlag(argv, "--message-format", "json"),
|
|
61
119
|
},
|
|
62
120
|
{
|
|
63
121
|
parserId: "cargo-test",
|
|
@@ -68,7 +126,118 @@ const AUTO_DETECT: Array<{ parserId: string; detect: (argv: string[]) => boolean
|
|
|
68
126
|
detect: (argv) =>
|
|
69
127
|
argv.includes("dbt") &&
|
|
70
128
|
(argv.includes("run") || argv.includes("test") || argv.includes("compile")) &&
|
|
71
|
-
argv
|
|
129
|
+
hasFlag(argv, "--log-format", "json"),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
parserId: "mypy-json",
|
|
133
|
+
detect: (argv) => argv.includes("mypy") && hasFlag(argv, "--output", "json"),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
parserId: "tsc-text",
|
|
137
|
+
detect: (argv) => argv.includes("tsc") && hasFlag(argv, "--pretty", "false"),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
parserId: "pylint-json",
|
|
141
|
+
detect: (argv) => argv.includes("pylint") && hasFlag(argv, "--output-format", "json"),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
parserId: "shellcheck-json",
|
|
145
|
+
detect: (argv) => argv.includes("shellcheck") && hasFlag(argv, "--format", "json"),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
parserId: "rubocop-json",
|
|
149
|
+
detect: (argv) => argv.includes("rubocop") && hasFlag(argv, "--format", "json"),
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
parserId: "swiftc-text",
|
|
153
|
+
detect: (argv) => argv.includes("swiftc") && argv.includes("-typecheck"),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
parserId: "hadolint-json",
|
|
157
|
+
detect: (argv) => argv.includes("hadolint") && hasFlag(argv, "--format", "json"),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
parserId: "stylelint-json",
|
|
161
|
+
detect: (argv) => argv.includes("stylelint") && hasFlag(argv, "--formatter", "json"),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
parserId: "mocha-json",
|
|
165
|
+
detect: (argv) => argv.includes("mocha") && hasFlag(argv, "--reporter", "json"),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
parserId: "unittest-text",
|
|
169
|
+
detect: (argv) =>
|
|
170
|
+
argv.includes("unittest") || (argv.includes("python3") && argv.includes("-m") && argv.includes("unittest")),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
parserId: "go-test-json",
|
|
174
|
+
detect: (argv) => argv.includes("go") && argv.includes("test") && argv.includes("-json"),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
parserId: "ava-text",
|
|
178
|
+
detect: (argv) => argv.includes("ava"),
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
parserId: "pyright-json",
|
|
182
|
+
detect: (argv) => argv.includes("pyright") && argv.includes("--outputjson"),
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
parserId: "bandit-json",
|
|
186
|
+
detect: (argv) => argv.includes("bandit") && hasFlag(argv, "-f", "json"),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
parserId: "javac-text",
|
|
190
|
+
detect: (argv) => argv.includes("javac") && !argv.includes("-version"),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
parserId: "dotnet-build-text",
|
|
194
|
+
detect: (argv) => argv.includes("dotnet") && argv.includes("build"),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
parserId: "node-test-text",
|
|
198
|
+
detect: (argv) => argv.includes("node") && argv.includes("--test"),
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
parserId: "black-text",
|
|
202
|
+
detect: (argv) => argv.includes("black") && argv.includes("--check"),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
parserId: "markdownlint-json",
|
|
206
|
+
detect: (argv) => argv.includes("markdownlint") && argv.includes("--json"),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
parserId: "prettier-text",
|
|
210
|
+
detect: (argv) => argv.includes("prettier") && argv.includes("--check"),
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
parserId: "tidy-text",
|
|
214
|
+
detect: (argv) => argv.includes("tidy"),
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
parserId: "jsonlint-text",
|
|
218
|
+
detect: (argv) => argv.includes("jsonlint"),
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
parserId: "htmlhint-json",
|
|
222
|
+
detect: (argv) => argv.includes("htmlhint") && hasFlag(argv, "--format", "json"),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
parserId: "isort-text",
|
|
226
|
+
detect: (argv) => argv.includes("isort") && argv.includes("--check"),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
parserId: "npm-audit-json",
|
|
230
|
+
detect: (argv) => argv.includes("npm") && argv.includes("audit") && argv.includes("--json"),
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
parserId: "vale-json",
|
|
234
|
+
detect: (argv) => argv.includes("vale") && hasFlag(argv, "--output", "JSON"),
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
parserId: "clang-text",
|
|
238
|
+
detect: (argv) =>
|
|
239
|
+
(argv.includes("gcc") || argv.includes("g++") || argv.includes("clang") || argv.includes("clang++")) &&
|
|
240
|
+
(argv.includes("-c") || argv.includes("-o")),
|
|
72
241
|
},
|
|
73
242
|
];
|
|
74
243
|
|