pi-compact-tools 0.10.0 → 0.10.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
@@ -1,8 +1,6 @@
1
1
  # pi-compact-tools
2
2
 
3
- Compact, expandable rendering for Pi's built-in tools and for custom tools from other packages, with a GitHub Dark theme.
4
-
5
- ![Compact rows for built-in and custom tools, including a web search and an edit with its diff and line counts](https://raw.githubusercontent.com/nedleeds/pi-compact-tools/main/assets/compact-workflow.gif)
3
+ Compact, expandable tool rows for Pi, including custom tools from other packages, with a GitHub Dark theme.
6
4
 
7
5
  ![Syntax-highlighted edit diff with lines added and removed](https://raw.githubusercontent.com/nedleeds/pi-compact-tools/main/assets/edit-diff.gif)
8
6
 
@@ -11,12 +9,11 @@ Compact, expandable rendering for Pi's built-in tools and for custom tools from
11
9
  ## Features
12
10
 
13
11
  - Compact rows for `read`, `write`, `edit`, `bash`, `powershell`, `grep`, `find`, and `ls`, with status, duration, and line count
14
- - The same compact rows for custom tools registered by other packages, such as web search or MCP tools, with no setup
15
- - Syntax-highlighted edit diffs and numbered `read`/`write` code views, including Markdown code fences
16
- - Edits report what they changed on their status line, lines added and removed in the diff colors: `(+3 -1)`
17
- - Animated working label above the prompt, lit in the session's own thinking-level color, and a `Ctrl+T` thinking summary/detail cycle
18
- - Theme-agnostic chrome: rails, the tool indicator, and the working label are derived from the active theme and stay legible on light and dark backgrounds
19
- - No Nerd Font required
12
+ - The same rows for custom tools from other packages, with no setup
13
+ - Syntax-highlighted edit diffs, with lines added and removed: `(+3 -1)`
14
+ - Numbered code views for `read` and `write`
15
+ - Silent mode: only prompts and final answers
16
+ - Works with any theme; no Nerd Font required
20
17
 
21
18
  ## Install
22
19
 
@@ -24,71 +21,65 @@ Compact, expandable rendering for Pi's built-in tools and for custom tools from
24
21
  pi install npm:pi-compact-tools
25
22
  ```
26
23
 
27
- Then restart Pi or run `/reload`. For the bundled theme, set `"theme": "github-dark-pro"` in `~/.pi/agent/settings.json`.
24
+ Restart Pi or run `/reload`. For the bundled theme, set `"theme": "github-dark-pro"` in `~/.pi/agent/settings.json`.
28
25
 
29
26
  ## Configuration
30
27
 
31
- Optional. Put it in `~/.pi/agent/compact-tools.json` or `<project>/.pi/compact-tools.json`:
28
+ All settings go in one optional file: `~/.pi/agent/compact-tools.json`, or `<project>/.pi/compact-tools.json` for one project. Every key is optional.
32
29
 
33
30
  ```json
34
31
  {
35
32
  "tools": ["read", "write", "edit", "bash"],
36
33
  "previewLines": 10,
37
- "auto_compact": { "read": true, "write": true, "edit": false, "bash": true }
34
+ "auto_compact": { "read": true, "write": true, "edit": false, "bash": true },
35
+ "mode": "normal",
36
+ "custom_tools": { "enabled": true, "auto_compact": true, "exclude": [] }
38
37
  }
39
38
  ```
40
39
 
41
- - `tools`: tools to render compactly. Also available: `grep`, `find`, `ls`, `powershell`.
42
- - `auto_compact`: `true` starts hidden, `false` starts with a preview of up to `previewLines` rows (`1`–`100`). Custom tools can be listed by name too, such as `"web_search": false`.
43
- - `mode`: `"normal"` (default) or `"silent"`. See [Silent mode](#silent-mode).
44
- - `custom_tools`: compact rendering for tools from other packages. See [Custom tools](#custom-tools).
40
+ - `tools`: built-in tools to compact. Also available: `grep`, `find`, `ls`, `powershell`.
41
+ - `auto_compact`: `true` starts a row hidden, `false` shows a preview of up to `previewLines` rows. Custom tool names work too.
42
+ - `mode`: `"normal"` or `"silent"`. See [Silent mode](#silent-mode).
43
+ - `custom_tools`: see [Custom tools](#custom-tools).
45
44
 
46
45
  ## Custom tools
47
46
 
48
- Tools registered by other packages get the same row as the built-ins: a status indicator, the tool name, a one-line summary of the call, then duration and line count once it finishes. It works for any tool, whichever package registered it, with nothing to configure.
47
+ ![Compact rows for built-in and custom tools, including a web search and an edit with its diff and line counts](https://raw.githubusercontent.com/nedleeds/pi-compact-tools/main/assets/compact-workflow.gif)
48
+
49
+ Tools from other packages get compact rows automatically. Expanding a row shows the tool's own result view.
49
50
 
50
- Expanding a row shows the call's arguments and then the result as the tool's own package renders it, so a package's custom result view is kept. Tools without a result renderer show their text output.
51
+ Set them with the `custom_tools` key in the same `compact-tools.json`:
51
52
 
52
53
  ```json
53
54
  {
55
+ "auto_compact": { "web_search": false },
54
56
  "custom_tools": { "enabled": true, "auto_compact": true, "exclude": ["my_tool"] }
55
57
  }
56
58
  ```
57
59
 
58
- - `enabled`: `false` leaves every custom tool with its own renderer. `"custom_tools": false` is shorthand.
59
- - `auto_compact`: like the built-in setting, `true` starts rows hidden and `false` starts with a preview. A tool named in the top-level `auto_compact` uses its own setting instead.
60
- - `exclude`: tool names that keep their own renderer.
61
-
62
- Built-in tools follow `tools` above: a built-in left out of that list keeps Pi's default renderer.
63
-
64
- Pi has no public API for changing how another package's tool is drawn, so this wraps the renderer lookup of Pi's tool row component. Nothing in Pi's installation is modified, and it only applies while this extension is loaded. If a Pi release changes that component, custom tools fall back to their own renderers and Pi shows a warning once.
60
+ - `enabled`: `false` turns this off for every custom tool.
61
+ - `auto_compact`: the default for every custom tool. Override one tool in the top-level `auto_compact`, like `web_search` above.
62
+ - `exclude`: tools that keep their original look.
65
63
 
66
64
  ## Silent mode
67
65
 
68
66
  ![Silent mode switched on mid-run: the tool rows fold away into a moving light, the answer stays, and every row comes back when it is off](https://raw.githubusercontent.com/nedleeds/pi-compact-tools/main/assets/silent-mode.gif)
69
67
 
70
- Silent mode shows only your prompts and the final answers. Tool calls (including custom tools from other packages), the assistant's in-between turns, thinking, error and abort notices, extension notices such as web-search progress, and Pi's own status lines are hidden while the animated working label shows what is running.
68
+ Shows only your prompts and the final answers. Tool calls, thinking, and notices are hidden while a light under the prompt shows the agent is working.
71
69
 
72
- - While the agent works, a light runs back and forth along a short line beneath your latest prompt, above the working label and just as long, leaving a fading afterimage in the thinking level's color. It steps aside once the answer starts.
73
- - `Ctrl+'` or `/silent` toggles it for the current session; `/silent on` and `/silent off` set it explicitly.
74
- - `Ctrl+'` needs a terminal that reports it as its own key (the Kitty keyboard protocol: Ghostty, Kitty, WezTerm, and others). Where it only types `'`, use `/silent`.
75
- - Set `"mode": "silent"` in `compact-tools.json` to start every session silent.
76
- - Turning it off brings back every hidden row. Nothing is removed from the session or the model's context.
77
- - Errors are hidden too, so a run that fails ends without an answer. Turn silent mode off to see what went wrong.
78
-
79
- Pi has no public API for hiding other extensions' tool rows, so silent mode wraps Pi's transcript components. If a future Pi release changes them, `/silent` reports that it is unavailable and the transcript renders normally.
70
+ - Toggle with `Ctrl+'` or `/silent` (`/silent on`, `/silent off`). `Ctrl+'` needs a terminal with the Kitty keyboard protocol, such as Ghostty, Kitty, or WezTerm.
71
+ - Start every session silent with `"mode": "silent"`.
72
+ - Turning it off brings every hidden row back.
73
+ - Errors are hidden too. If a run ends without an answer, turn silent mode off to see why.
80
74
 
81
75
  ## Controls
82
76
 
77
+ ![Ctrl+O expands every tool row, then collapses them again](https://raw.githubusercontent.com/nedleeds/pi-compact-tools/main/assets/expand-collapse.gif)
78
+
83
79
  - Click a row or press `Ctrl+O` to expand or collapse results.
84
- - In fullscreen mode, expanding or collapsing every row, cycling thinking, and toggling silent mode keep the text you were reading in place instead of jumping.
85
80
  - `Ctrl+T` cycles thinking: summary → detail → summary → hidden.
86
81
  - `Ctrl+'` or `/silent` toggles silent mode.
87
82
 
88
- ## Release notes
89
-
90
- After an update, the next new conversation opens with a bordered "What's new" block, the way Pi shows its own changelog: once, listing every release since the last one shown. A resumed session keeps it for the next new one, and so does silent mode. The block lives only in the TUI; it is never saved to the session or sent to the model. When publishing a new version, add its changes to `release-notes.json`; `npm run check` requires an entry matching `package.json`.
91
-
92
83
  ## Development
93
84
 
94
85
  ```bash
@@ -97,6 +88,8 @@ npm run check
97
88
  pi -e .
98
89
  ```
99
90
 
91
+ Before publishing, add the new version's notes to `release-notes.json`. Pi shows them once after users update. Use `[]` for a release with nothing to announce.
92
+
100
93
  ## License
101
94
 
102
95
  MIT
@@ -39,25 +39,27 @@ export function compareVersions(left: string, right: string): number {
39
39
 
40
40
  /**
41
41
  * The notes to show, newest first: every version with notes after the last one
42
- * shown, up to the installed one. With nothing shown before, only the installed
43
- * version's notes appear: that is either a new install or an update from a
44
- * version that predates these notices, and there is no telling which.
42
+ * shown, up to the installed one. An empty list marks a quiet release, such as a
43
+ * documentation update, that shows nothing. With nothing shown before, only the
44
+ * newest notes up to the installed version appear: that is either a new install
45
+ * or an update from a version that predates these notices, and there is no
46
+ * telling which.
45
47
  */
46
48
  export function releasesToShow(
47
49
  installed: string,
48
50
  notes: ReleaseNotes,
49
51
  lastShown: string | undefined,
50
52
  ): Array<{ version: string; notes: readonly string[] }> {
51
- const versions = lastShown === undefined
52
- ? (notes[installed]?.length ? [installed] : [])
53
- : Object.keys(notes).filter((version) =>
53
+ const withNotes = Object.keys(notes)
54
+ .filter((version) =>
54
55
  VERSION.test(version)
55
- && compareVersions(version, lastShown) > 0
56
56
  && compareVersions(version, installed) <= 0
57
- && notes[version]!.length > 0);
58
- return versions
59
- .sort((left, right) => compareVersions(right, left))
60
- .map((version) => ({ version, notes: notes[version]! }));
57
+ && notes[version]!.length > 0)
58
+ .sort((left, right) => compareVersions(right, left));
59
+ const versions = lastShown === undefined
60
+ ? withNotes.slice(0, 1)
61
+ : withNotes.filter((version) => compareVersions(version, lastShown) > 0);
62
+ return versions.map((version) => ({ version, notes: notes[version]! }));
61
63
  }
62
64
 
63
65
  function lastShownVersion(directory: string): string | undefined {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-compact-tools",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Compact, expandable UI for pi's built-in and custom tools, bundled with a polished GitHub Dark theme.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "0.10.1": [],
2
3
  "0.10.0": [
3
4
  "Silent mode shows only prompts and final answers (Ctrl+' or /silent)",
4
5
  "Tools from other packages get the same compact rows as the built-ins",
@@ -73,9 +73,10 @@ if (schema.properties?.previewLines?.default !== 10) {
73
73
 
74
74
  const manifest = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
75
75
  const releaseNotes = JSON.parse(await readFile(new URL("../release-notes.json", import.meta.url), "utf8"));
76
- if (!Array.isArray(releaseNotes[manifest.version]) || releaseNotes[manifest.version].length === 0 ||
76
+ // Every published version needs an entry. An empty list is a quiet release that shows no notice.
77
+ if (!Array.isArray(releaseNotes[manifest.version]) ||
77
78
  releaseNotes[manifest.version].some((note) => typeof note !== "string" || !note.trim())) {
78
- throw new Error(`release-notes.json must describe v${manifest.version} before publishing`);
79
+ throw new Error(`release-notes.json must have an entry for v${manifest.version} before publishing; use [] for no notice`);
79
80
  }
80
81
 
81
82
  console.log("Resource checks passed");