@robhowley/pi-structured-return 1.2.0 → 1.2.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.
package/README.md CHANGED
@@ -15,9 +15,9 @@ Linters: 1 unused variable warning in a single file.
15
15
 
16
16
  | Parser | Raw (tokens) | Structured (tokens) | Reduction | Notes |
17
17
  |---|---|---|---|---|
18
- | `junit-xml` (go) | 446 | 58 | **87%** | verbose output with full stack trace per failure |
19
- | `junit-xml` (pytest) | 446 | 71 | **84%** | verbose output with source snippets and summary footer |
18
+ | `junit-xml` (go) | 400 | 58 | **86%** | verbose output with full stack trace per failure |
20
19
  | `vitest-json` | 348 | 75 | **78%** | source diff with inline arrows and ANSI color codes per failure |
20
+ | `junit-xml` (pytest) | 289 | 71 | **75%** | verbose output with source snippets and summary footer |
21
21
  | `rspec-json` | 212 | 55 | **74%** | default output with backtrace |
22
22
  | `junit-xml` (gradle) | 263 | 81 | **69%** | gradle console output with build lifecycle noise |
23
23
  | `minitest-text` | 168 | 59 | **65%** | default output with backtrace |
@@ -37,7 +37,7 @@ Tokens counted with `cl100k_base` (tiktoken). Linter output is more compact than
37
37
 
38
38
  ## Before / after
39
39
 
40
- **Raw pytest output (446 tokens):** *(pytest does have a JSON mode — but piping raw `--json-report` output to the model is noisier than the default formatter, not cleaner. The parser reads the JSON and extracts only what matters.)*
40
+ **Raw pytest output (262 tokens):**
41
41
  ```
42
42
  ============================= test session starts ==============================
43
43
  platform darwin -- Python 3.14.2, pytest-9.0.2
@@ -69,12 +69,12 @@ FAILED test_math.py::test_does_not_divide_by_zero - ZeroDivisionError: ...
69
69
  ========================= 2 failed, 1 passed in 0.01s ==========================
70
70
  ```
71
71
 
72
- **Structured result returned to the model (59 tokens):**
72
+ **Structured result returned to the model (56 tokens):**
73
73
  ```
74
- pytest test_math.py --json-report ... → cwd: project
74
+ pytest test_math.py --junitxml=.tmp/report.xml → cwd: project
75
75
  2 failed, 1 passed
76
- test_math.py AssertionError: assert (3 * 4) == 99
77
- test_math.py ZeroDivisionError: division by zero
76
+ test_math.py:5 assert (3 * 4) == 99
77
+ test_math.py:8 ZeroDivisionError: division by zero
78
78
  ```
79
79
 
80
80
  ## Installation
@@ -203,6 +203,7 @@ tests/test_math.py:5: AssertionError</failure>
203
203
  const result = await parser.parse(makeCtx(xml, "/project"));
204
204
  expect(result.failures![0].file).toBe("tests/test_math.py");
205
205
  expect(result.failures![0].line).toBe(5);
206
+ expect(result.failures![0].message).toBe("assert (3 * 4) == 99");
206
207
  });
207
208
  });
208
209
 
@@ -122,7 +122,12 @@ const parser: ParserModule = {
122
122
  file,
123
123
  line: Number.isNaN(line) ? undefined : line,
124
124
  message:
125
- bodyLocation?.message ?? panicInfo?.message ?? problem.message ?? problem["#text"]?.trim().split("\n")[0],
125
+ problem.message && problem.message.toLowerCase() !== "failed"
126
+ ? problem.message
127
+ : (bodyLocation?.message ??
128
+ panicInfo?.message ??
129
+ problem.message ??
130
+ problem["#text"]?.trim().split("\n")[0]),
126
131
  rule: problem.type,
127
132
  });
128
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robhowley/pi-structured-return",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Structured command execution for Pi agents: compact results for the model, full logs for humans.",
5
5
  "license": "MIT",
6
6
  "repository": {