@robhowley/pi-structured-return 2.0.0 → 2.0.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 +6 -2
- package/extensions/structured-return/config/registry.ts +0 -6
- package/extensions/structured-return/index.ts +1 -15
- package/native/Cargo.lock +1 -1
- package/native/Cargo.toml +1 -1
- package/native/bin/darwin-arm64/build.json +3 -3
- package/native/bin/darwin-arm64/structured-return-native +0 -0
- package/native/bin/darwin-x64/build.json +3 -3
- package/native/bin/darwin-x64/structured-return-native +0 -0
- package/native/bin/linux-arm64-musl/build.json +3 -3
- package/native/bin/linux-arm64-musl/structured-return-native +0 -0
- package/native/bin/linux-x64-musl/build.json +3 -3
- package/native/bin/linux-x64-musl/structured-return-native +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-structured-return
|
|
2
2
|
|
|
3
|
-
A Rust-powered [Pi](https://pi.dev/) extension that cuts
|
|
3
|
+
A Rust-powered [Pi](https://pi.dev/) extension that cuts command-output tokens by up to 95% while preserving diagnostics and full logs. Adds the `structured_return` tool.
|
|
4
4
|
|
|
5
5
|
A failing test run, before and after:
|
|
6
6
|
|
|
@@ -67,7 +67,11 @@ Supports macOS 11+ and Linux on x64/arm64. Windows is not supported.
|
|
|
67
67
|
3. A parser converts noisy CLI output into a compact structured result. If no parser matches, a successful command returns only `command completed; no parser matched`, with the log path in tool details. An unsuccessful unmatched command returns the last 200 log lines and the log path in the text.
|
|
68
68
|
4. The agent receives the structured result in context — signal only, no noise.
|
|
69
69
|
|
|
70
|
-
Full logs remain on disk for the agent and humans to inspect. Run `/sr-
|
|
70
|
+
Full logs remain on disk for the agent and humans to inspect. Run `/sr-stats` to see token savings for the current session, cwd lifetime, and lifetime.
|
|
71
|
+
|
|
72
|
+
## Supported parsers
|
|
73
|
+
|
|
74
|
+
See the shipped skill's [command recipes](skills/structured-return/SKILL.md#command-recipes) for supported output formats and built-in `parseAs` IDs, and [JUnit reports](skills/structured-return/SKILL.md#junit-reports) for report-file commands and `artifactPaths`.
|
|
71
75
|
|
|
72
76
|
## Token reduction
|
|
73
77
|
|
|
@@ -264,12 +264,6 @@ const AUTO_DETECT: Array<{ parserId: string; detect: (argv: string[]) => boolean
|
|
|
264
264
|
},
|
|
265
265
|
];
|
|
266
266
|
|
|
267
|
-
export function listParsers(): { id: string; autoDetect: boolean }[] {
|
|
268
|
-
const builtInIds = Object.keys(builtIns).filter((id) => id !== 'tail-fallback');
|
|
269
|
-
const autoDetectIds = new Set(AUTO_DETECT.map((d) => d.parserId));
|
|
270
|
-
return builtInIds.map((id) => ({ id, autoDetect: autoDetectIds.has(id) }));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
267
|
export function resolveParser(opts: { parseAs?: string; argv: string[] }): ParserModule {
|
|
274
268
|
if (opts.parseAs && Object.hasOwn(builtIns, opts.parseAs)) return builtIns[opts.parseAs];
|
|
275
269
|
|
|
@@ -8,7 +8,7 @@ import { Text } from '@mariozechner/pi-tui';
|
|
|
8
8
|
import type { ObservedRunArgs, ParsedResult, RunContext } from './types';
|
|
9
9
|
import { ensureRunDir } from './storage/log-store';
|
|
10
10
|
import { runNative } from './native';
|
|
11
|
-
import { resolveParser
|
|
11
|
+
import { resolveParser } from './config/registry';
|
|
12
12
|
import { readTail } from './parsers/utils';
|
|
13
13
|
import tailFallback from './parsers/tail-fallback';
|
|
14
14
|
import {
|
|
@@ -19,20 +19,6 @@ import {
|
|
|
19
19
|
} from './storage/session-stats';
|
|
20
20
|
|
|
21
21
|
export default function structuredReturn(pi: ExtensionAPI) {
|
|
22
|
-
pi.registerCommand('sr-parsers', {
|
|
23
|
-
description: 'List built-in structured-return parsers',
|
|
24
|
-
handler: async (_args, ctx) => {
|
|
25
|
-
const lines: string[] = ['structured-return parsers', ''];
|
|
26
|
-
|
|
27
|
-
lines.push('built-in:');
|
|
28
|
-
for (const { id, autoDetect } of listParsers()) {
|
|
29
|
-
lines.push(` ${id}${autoDetect ? ' (auto-detect)' : ''}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ctx.ui.notify(lines.join('\n'), 'info');
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
22
|
pi.registerCommand('sr-stats', {
|
|
37
23
|
description:
|
|
38
24
|
'Show token savings from structured-return (current session + cwd lifetime + lifetime)',
|
package/native/Cargo.lock
CHANGED
|
@@ -59,7 +59,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
|
59
59
|
|
|
60
60
|
[[package]]
|
|
61
61
|
name = "pi-structured-return-native"
|
|
62
|
-
version = "2.0.
|
|
62
|
+
version = "2.0.1" # x-release-please-version
|
|
63
63
|
dependencies = [
|
|
64
64
|
"libc",
|
|
65
65
|
"quick-xml",
|
package/native/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"target": "aarch64-apple-darwin",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"sourceHash": "
|
|
5
|
-
"sha256": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"sourceHash": "0177f1f8e5ed3e6a0f013cb9be7ab4aa27100a6507d99826ac54fb8af302b392",
|
|
5
|
+
"sha256": "6a28a48a4716111a1087022460bbe4e3c0a36bedf2acc6cda38707a37baf3243",
|
|
6
6
|
"rust": "1.88.0"
|
|
7
7
|
}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"target": "x86_64-apple-darwin",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"sourceHash": "
|
|
5
|
-
"sha256": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"sourceHash": "0177f1f8e5ed3e6a0f013cb9be7ab4aa27100a6507d99826ac54fb8af302b392",
|
|
5
|
+
"sha256": "33d45401748085d6d56aabee055b74ea58a33aeff0b5be91ec7ad778b274828d",
|
|
6
6
|
"rust": "1.88.0"
|
|
7
7
|
}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"target": "aarch64-unknown-linux-musl",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"sourceHash": "
|
|
5
|
-
"sha256": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"sourceHash": "0177f1f8e5ed3e6a0f013cb9be7ab4aa27100a6507d99826ac54fb8af302b392",
|
|
5
|
+
"sha256": "15d4bbe8b5f8a81e7d50b9109d7945d096ac03a7b1ce244c4747a5ed6922f86d",
|
|
6
6
|
"rust": "1.88.0"
|
|
7
7
|
}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"target": "x86_64-unknown-linux-musl",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"sourceHash": "
|
|
5
|
-
"sha256": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"sourceHash": "0177f1f8e5ed3e6a0f013cb9be7ab4aa27100a6507d99826ac54fb8af302b392",
|
|
5
|
+
"sha256": "aa6f941f11be5f21067ba67159d2ee06a5aea4fd2e1c9db2bf2a6ad16d18628f",
|
|
6
6
|
"rust": "1.88.0"
|
|
7
7
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robhowley/pi-structured-return",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Turn noisy CLI output into compact structured results (fewer tokens), full logs
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Turn noisy CLI output into compact structured results (up to 95% fewer tokens), preserving diagnostics and full logs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"extensions",
|