@heyhuynhgiabuu/pi-pretty 0.6.31 → 0.7.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 +15 -0
- package/README.md +21 -0
- package/dist/claude-style.d.ts +45 -0
- package/dist/claude-style.d.ts.map +1 -0
- package/dist/claude-style.js +582 -0
- package/dist/claude-style.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -12
- package/dist/index.js.map +1 -1
- package/dist/prompt-editor.d.ts +4 -1
- package/dist/prompt-editor.d.ts.map +1 -1
- package/dist/prompt-editor.js +27 -12
- package/dist/prompt-editor.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/working-indicator.d.ts +2 -0
- package/dist/working-indicator.d.ts.map +1 -1
- package/dist/working-indicator.js +20 -8
- package/dist/working-indicator.js.map +1 -1
- package/package.json +1 -1
- package/src/claude-style.ts +650 -0
- package/src/config.ts +3 -0
- package/src/index.ts +35 -15
- package/src/prompt-editor.ts +26 -11
- package/src/types.ts +5 -0
- package/src/working-indicator.ts +20 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0] - 2026-10-10
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Opt-in `toolStyle: "claudecode"` (default `default`, no change for existing users): collapsed tools render as `✓ Name (args)` with an `└` result row (line counts, duration, bash `timeout`, `+N -N` for edits), a braille spinner while running, `·` while pending, and `✗` on failure.
|
|
8
|
+
- Fold consecutive tool calls into `Done (…)` / `Running (…)` groups with a `├─`/`└─` tree. Clicking a tool in a group expands it; Ctrl+O expands everything. Tools the style does not cover break a group instead of being flattened into it.
|
|
9
|
+
- Style `write`, `edit`, `apply_patch` (pi-diff), `codemode` (Pi built-in), and `recall` (pikit) without re-registering them, by deciding their renderers per component by tool name. Their full output remains available when expanded.
|
|
10
|
+
- `(ctrl+o to expand)` / `(ctrl+o to collapse)` hints on folded groups and expanded calls, and `thought 3s (ctrl+t to expand)` for hidden thinking, using the user's own key bindings.
|
|
11
|
+
- In this style: flush-left `thinking` / `thought 3s` labels, no `❯` prefix on user messages, and an input box with plain horizontal rules and a flush-left `❯` instead of the rounded border.
|
|
12
|
+
|
|
13
|
+
### Maintenance
|
|
14
|
+
|
|
15
|
+
- Add `vitest.config.ts` so tests never read the developer's real `~/.pi/agent/pi-pretty.json`.
|
|
16
|
+
- Add regression coverage for rows, grouping, click-to-expand, delegated renderers, and the unboxed prompt editor.
|
|
17
|
+
|
|
3
18
|
## [0.6.31] - 2026-10-08
|
|
4
19
|
|
|
5
20
|
### Added
|
package/README.md
CHANGED
|
@@ -175,6 +175,7 @@ Place a JSON file alongside Pi's `settings.json` to customize pi-pretty. Every o
|
|
|
175
175
|
| `cacheLimit` | positive int | `PRETTY_CACHE_LIMIT` | `128` |
|
|
176
176
|
| `fff.enableHomeScanning` | boolean | `PRETTY_FFF_HOME_SCAN` (`1`/`0`) | `false` |
|
|
177
177
|
| `fff.enableRootScanning` | boolean | `PRETTY_FFF_ROOT_SCAN` (`1`/`0`) | `false` |
|
|
178
|
+
| `toolStyle` | `default` \| `claudecode` | — | `default` |
|
|
178
179
|
| `workingIndicator.enabled` | boolean | `PRETTY_WORKING_INDICATOR` (`on`/`off`) | `true` |
|
|
179
180
|
| `workingIndicator.text` | string or string[] (phrases rotated per sweep; env accepts comma-separated) | `PRETTY_WORKING_INDICATOR_TEXT` | `["Working…"]` |
|
|
180
181
|
| `workingIndicator.mode` | `shimmer` \| `kitt` \| `static` | `PRETTY_WORKING_INDICATOR_MODE` | `shimmer` |
|
|
@@ -235,6 +236,26 @@ older rows are never mislabeled. The 30fps ticker runs only while the current me
|
|
|
235
236
|
is thinking, bounding the cost of `setHiddenThinkingLabel(label)` rebuilding chat children. Inherits
|
|
236
237
|
`mode`, `bold`, and the palette/accent from `workingIndicator`.
|
|
237
238
|
|
|
239
|
+
### Claude Code tool style
|
|
240
|
+
|
|
241
|
+
Set `"toolStyle": "claudecode"` for a Claude Code-like transcript (restart pi to apply):
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
✓ Done (3 tool calls · 1 thought) (ctrl+o to expand)
|
|
245
|
+
├─ • Read (src/a.ts)
|
|
246
|
+
│ └ 42 lines · ◷ 0.02s
|
|
247
|
+
├─ • Edit (src/a.ts)
|
|
248
|
+
│ └ +3 -1 · ◷ 0.06s
|
|
249
|
+
└─ • Bash (npm test)
|
|
250
|
+
└ 12 lines · ◷ 3.1s · timeout 300s
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- Collapsed tool calls are one `✓ Name (args)` row plus an `└` result row; a spinner shows while running, `·` while waiting, `✗` on failure. Ctrl+O (or a click) expands to the full pretty output.
|
|
254
|
+
- Two or more consecutive tool calls fold into one `Done (…)` / `Running (…)` group. Click a tool in the group to expand it.
|
|
255
|
+
- Covers `read`, `bash`, `grep`, `find`, `ls`, and — through the host's renderer lookup, without re-registering them — `write`, `edit`, `apply_patch` (pi-diff), `codemode`, and `recall`. `+N` is shown in the success color and `-N` in the error color. Tools it does not style keep their own rendering and break a group.
|
|
256
|
+
- Hidden thinking reads `thought 3s (ctrl+t to expand)`, user messages lose the `❯` prefix, and the input box drops its rounded border for plain rules with a flush-left `❯`.
|
|
257
|
+
- `toolStyle` only changes presentation. It patches Pi's `ToolExecutionComponent` and chat `Container` render lookups, which are not public API; if Pi reshapes them the styling degrades to Pi's own rendering.
|
|
258
|
+
|
|
238
259
|
### Environment variables
|
|
239
260
|
|
|
240
261
|
Optional environment variables:
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi-pretty: opt-in "claudecode" tool style (config `toolStyle: "claudecode"`).
|
|
3
|
+
*
|
|
4
|
+
* ✓ Read (src/a.ts) collapsed call row: status icon (spinner while running), bold name
|
|
5
|
+
* └ 42 lines · ◷ 0.02s collapsed result row hanging from a connector
|
|
6
|
+
* ✓ Done (3 tool calls) consecutive tool calls fold into one group row
|
|
7
|
+
* ├─ • Bash(ls)
|
|
8
|
+
* └─ • Read(a.ts)
|
|
9
|
+
*
|
|
10
|
+
* Collapsed rows replace the pretty output; Ctrl+O (expanded) keeps pi-pretty's
|
|
11
|
+
* full rendering. Grouping is a pure render-time projection of the chat children.
|
|
12
|
+
* Modeled on the look of sting8k/pi-droid-styling's `claudecode` preset.
|
|
13
|
+
*/
|
|
14
|
+
type AnyFn = (...args: any[]) => any;
|
|
15
|
+
export declare function setClaudeStyleTheme(theme: unknown): void;
|
|
16
|
+
/**
|
|
17
|
+
* Wrap a tool definition so collapsed rows use the Claude Code look. Expanded
|
|
18
|
+
* calls keep the call row but defer the result body to the original renderer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function withClaudeToolStyle<T extends {
|
|
21
|
+
name: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
renderCall?: AnyFn;
|
|
24
|
+
renderResult?: AnyFn;
|
|
25
|
+
}>(def: T): T;
|
|
26
|
+
/**
|
|
27
|
+
* Give write/edit/apply_patch the Claude Code rows without owning their registration (pi-diff or Pi's
|
|
28
|
+
* builtins keep their schema, execute and diff renderer). Rendering is decided per component,
|
|
29
|
+
* so the host's lookups are patched by tool name, as pi-droid-styling does. Collapsed: call
|
|
30
|
+
* and `+N -N` rows; expanded: the provider's own result renderer. Pass `false` to restore.
|
|
31
|
+
*/
|
|
32
|
+
export declare function installClaudeExternalToolRenderers(toolExecutionComponent: unknown, enabled?: boolean): void;
|
|
33
|
+
/** Proxy `pi` so tools registered through it get the Claude Code rows. */
|
|
34
|
+
export declare function withClaudeToolStyleApi<P extends {
|
|
35
|
+
registerTool: AnyFn;
|
|
36
|
+
}>(pi: P): P;
|
|
37
|
+
/**
|
|
38
|
+
* Fold consecutive tool calls into `✓ Done (...)` groups by wrapping pi-tui's base
|
|
39
|
+
* `Container.render`. Pi nests its chat container (no stable index to look it up by),
|
|
40
|
+
* but only that container holds tool components as direct children, so the wrapper
|
|
41
|
+
* stays inert for every other container. Pass `false` to restore the original render.
|
|
42
|
+
*/
|
|
43
|
+
export declare function installClaudeChatGrouping(enabled?: boolean): void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=claude-style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-style.d.ts","sourceRoot":"","sources":["../src/claude-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAgBrC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAExD;AAoWD;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,EACnF,GAAG,EAAE,CAAC,GAAG,CAAC,CAGX;AAcD;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,sBAAsB,EAAE,OAAO,EAAE,OAAO,UAAO,GAAG,IAAI,CAqDxG;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAE,YAAY,EAAE,KAAK,CAAA;CAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAQlF;AA6ID;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,UAAO,GAAG,IAAI,CAgB9D"}
|