@robhowley/pi-structured-return 1.5.0 → 1.6.1

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.
Files changed (34) hide show
  1. package/README.md +86 -63
  2. package/extensions/structured-return/src/config/registry.ts +92 -0
  3. package/extensions/structured-return/src/parsers/bandit-json.test.ts +90 -0
  4. package/extensions/structured-return/src/parsers/bandit-json.ts +78 -0
  5. package/extensions/structured-return/src/parsers/black-text.test.ts +67 -0
  6. package/extensions/structured-return/src/parsers/black-text.ts +74 -0
  7. package/extensions/structured-return/src/parsers/clang-text.test.ts +61 -0
  8. package/extensions/structured-return/src/parsers/clang-text.ts +59 -0
  9. package/extensions/structured-return/src/parsers/dotnet-build-text.test.ts +85 -0
  10. package/extensions/structured-return/src/parsers/dotnet-build-text.ts +48 -0
  11. package/extensions/structured-return/src/parsers/htmlhint-json.test.ts +72 -0
  12. package/extensions/structured-return/src/parsers/htmlhint-json.ts +72 -0
  13. package/extensions/structured-return/src/parsers/isort-text.test.ts +58 -0
  14. package/extensions/structured-return/src/parsers/isort-text.ts +64 -0
  15. package/extensions/structured-return/src/parsers/javac-text.test.ts +75 -0
  16. package/extensions/structured-return/src/parsers/javac-text.ts +81 -0
  17. package/extensions/structured-return/src/parsers/jsonlint-text.test.ts +52 -0
  18. package/extensions/structured-return/src/parsers/jsonlint-text.ts +64 -0
  19. package/extensions/structured-return/src/parsers/markdownlint-json.test.ts +76 -0
  20. package/extensions/structured-return/src/parsers/markdownlint-json.ts +73 -0
  21. package/extensions/structured-return/src/parsers/node-test-text.test.ts +117 -0
  22. package/extensions/structured-return/src/parsers/node-test-text.ts +90 -0
  23. package/extensions/structured-return/src/parsers/npm-audit-json.test.ts +83 -0
  24. package/extensions/structured-return/src/parsers/npm-audit-json.ts +88 -0
  25. package/extensions/structured-return/src/parsers/prettier-text.test.ts +76 -0
  26. package/extensions/structured-return/src/parsers/prettier-text.ts +63 -0
  27. package/extensions/structured-return/src/parsers/pyright-json.test.ts +112 -0
  28. package/extensions/structured-return/src/parsers/pyright-json.ts +81 -0
  29. package/extensions/structured-return/src/parsers/tidy-text.test.ts +74 -0
  30. package/extensions/structured-return/src/parsers/tidy-text.ts +67 -0
  31. package/extensions/structured-return/src/parsers/vale-json.test.ts +84 -0
  32. package/extensions/structured-return/src/parsers/vale-json.ts +80 -0
  33. package/package.json +8 -3
  34. package/skills/structured-return/SKILL.md +58 -6
@@ -30,12 +30,51 @@ Prefer better output at the source.
30
30
  ### ruff check
31
31
  - `structured_return({ command: "ruff check [any ruff args] --output-format=json", parseAs: "ruff-json" })` — scope, selects, ignores, etc. go in `[any ruff args]`
32
32
 
33
- ### ruff format
34
- - `ruff format --check .` (no structured_return — json output not supported)
35
-
36
33
  ### mypy
37
34
  - `structured_return({ command: "mypy [any mypy args] --output json", parseAs: "mypy-json" })` — `--output json` is built into mypy (1.0+); outputs NDJSON to stderr with file, line, column, message, error code, and severity; notes are folded into their parent error's message
38
35
 
36
+ ### htmlhint
37
+ - `structured_return({ command: "npx htmlhint --format json [any htmlhint args]", parseAs: "htmlhint-json" })` — `--format json` outputs structured array; strips ANSI codes, source evidence, rule descriptions, and URLs
38
+
39
+ ### isort
40
+ - `structured_return({ command: "isort --check --diff [any isort args]", parseAs: "isort-text" })` — parses `--check` output; strips diff hunks, absolute paths, timestamps; lists files with unsorted imports
41
+
42
+ ### npm audit
43
+ - `structured_return({ command: "npm audit --json", parseAs: "npm-audit-json" })` — `--json` is built into npm; strips advisory URLs, CVSS vectors, fix instructions; advisory titles joined per package; severity breakdown in summary
44
+
45
+ ### jsonlint
46
+ - `structured_return({ command: "npx jsonlint [file]", parseAs: "jsonlint-text" })` — strips stack trace and source pointer; extracts line number and "Expecting X, got Y" message
47
+
48
+ ### tidy (HTML Tidy)
49
+ - `structured_return({ command: "tidy -errors [any tidy args]", parseAs: "tidy-text" })` — parses `line N column N - Warning/Error: message` from stderr; strips remediation advice, accessibility tips, reformatted HTML output, and Info lines
50
+
51
+ ### vale
52
+ - `structured_return({ command: "vale --output JSON [any vale args]", parseAs: "vale-json" })` — `--output JSON` is built into vale; strips ANSI codes, Action/Span metadata, column-aligned formatting; severity breakdown in summary
53
+
54
+ ### prettier
55
+ - `structured_return({ command: "prettier --check [any prettier args]", parseAs: "prettier-text" })` — parses `--check` output; strips "Checking formatting..." preamble, [warn] prefixes, and "Run Prettier with --write to fix" footer
56
+
57
+ ### markdownlint
58
+ - `structured_return({ command: "markdownlint --json [any markdownlint args]", parseAs: "markdownlint-json" })` — `--json` outputs structured array; strips context quotes, rule info URLs, fix info, and error ranges; error details folded into description
59
+
60
+ ### black
61
+ - `structured_return({ command: "black --check [any black args]", parseAs: "black-text" })` — parses `--check` output; strips diff hunks, emoji banners, timestamps; lists files needing reformatting; also handles `--check --diff` mode
62
+
63
+ ### bandit
64
+ - `structured_return({ command: "bandit -f json [any bandit args]", parseAs: "bandit-json" })` — `-f json` is built into bandit; strips source snippets, CWE URLs, run metrics, and confidence labels; severity breakdown in summary
65
+
66
+ ### gcc / clang
67
+ - `structured_return({ command: "gcc -c [any gcc args]", parseAs: "clang-text" })` — works with gcc, g++, clang, clang++; parses `file:line:col: error: message` from stderr; source snippets and caret indicators stripped; warning flags preserved as rule
68
+
69
+ ### dotnet build
70
+ - `structured_return({ command: "dotnet build [any dotnet args]", parseAs: "dotnet-build-text" })` — parses MSBuild `file(line,col): error CODE: message` format; strips restore/timing noise; deduplicates the inline+summary error repetition; absolute paths relativized
71
+
72
+ ### javac
73
+ - `structured_return({ command: "javac [any javac args]", parseAs: "javac-text" })` — parses `file:line: error: message` from stderr; source snippets and caret indicators stripped; `cannot find symbol` errors fold the symbol continuation line into the message
74
+
75
+ ### pyright
76
+ - `structured_return({ command: "pyright --outputjson [any pyright args]", parseAs: "pyright-json" })` — `--outputjson` is built into pyright; JSON output includes file, line, message, and rule code; multi-line detail messages collapsed; warnings excluded from failures
77
+
39
78
  ### tsc
40
79
  - `structured_return({ command: "tsc --noEmit --pretty false [any tsc args]", parseAs: "tsc-text" })` — `--pretty false` suppresses source snippets and ANSI codes; parser extracts file, line, TS error code, and message from the compact `file(line,col): error TSXXXX: message` format
41
80
 
@@ -48,9 +87,6 @@ Prefer better output at the source.
48
87
  ### rubocop
49
88
  - `structured_return({ command: "rubocop [any rubocop args] --format json", parseAs: "rubocop-json" })` — `--format json` is built into rubocop; cop name prefix stripped from messages; source snippets and caret indicators removed
50
89
 
51
- ### flake8
52
- - `flake8 [any flake8 args]` (no structured_return — default output is already compact `file:line:col: CODE message`; no JSON without a plugin; use `bash` directly)
53
-
54
90
  ### swiftc
55
91
  - `structured_return({ command: "swiftc -typecheck [any swiftc args]", parseAs: "swiftc-text" })` — parses `file:line:col: error: message` from stderr; source annotations and duplicate error lines deduplicated; warnings filtered out
56
92
 
@@ -60,6 +96,9 @@ Prefer better output at the source.
60
96
  ### stylelint
61
97
  - `structured_return({ command: "stylelint [any stylelint args] --formatter json", parseAs: "stylelint-json" })` — `--formatter json` is built into stylelint; rule name suffix stripped from message text; requires a `.stylelintrc` config
62
98
 
99
+ ### node --test
100
+ - `structured_return({ command: "node --test [any node test args]", parseAs: "node-test-text" })` — parses the default spec reporter output; strips full stack traces, assertion error internals, timing data; preserves expected/actual values from assertion failures
101
+
63
102
  ### ava
64
103
  - `structured_return({ command: "npx ava [any ava args] --no-color", parseAs: "ava-text" })` — parses default text output from stderr; assertion failures extract expected/actual from diff lines and file:line; runtime errors extract message and file:line from stack trace
65
104
 
@@ -134,3 +173,16 @@ Jest requires the `jest-junit` reporter (`npm install --save-dev jest-junit`). P
134
173
  `xcodebuild` output is high-volume and not directly parseable. Pipe through `xcbeautify` (install with `brew install xcbeautify`) to get JUnit XML:
135
174
 
136
175
  - `structured_return({ command: "xcodebuild test -scheme [scheme] -destination '[destination]' 2>&1 | xcbeautify --report junit --output .tmp", parseAs: "junit-xml", artifactPaths: [".tmp/report.junit.xml"] })` — xcbeautify writes `report.junit.xml` into the `--output` directory; run `xcodebuild -showdestinations -scheme [scheme]` first to find the correct `[destination]` string for the project
176
+
177
+ ## Already compact — use `bash` directly
178
+
179
+ These tools were evaluated for structured parsing but their output is already compact enough that a parser adds no token reduction. Use `bash` instead of `structured_return`.
180
+
181
+ - `flake8 [any flake8 args]` — `file:line:col: CODE message`, one line per violation
182
+ - `ruff format --check .` — just lists files needing formatting
183
+ - `go build [any go build args]` — `file:line:col: message`, one line per error
184
+ - `go vet [any go vet args]` — same format as go build
185
+ - `golangci-lint run [any golangci-lint args]` — `file:line:col: message (linter)`, already minimal
186
+ - `yamllint [any yamllint args]` — `file:line:col level message (rule)`, one line per issue
187
+ - `pydocstyle [any pydocstyle args]` — `file:line context + CODE: message`, two lines per issue
188
+ - `vulture [any vulture args]` — `file:line: message (confidence%)`, one line per finding