pi-compact-tools 0.11.0 → 0.11.2
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 +4 -4
- package/extensions/compact-tools-claude.ts +22 -4
- package/extensions/compact-tools.ts +6 -6
- package/package.json +2 -2
- package/release-notes.json +4 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Pick a style. Silent mode works on top of either.
|
|
|
18
18
|
|
|
19
19
|
| | Setting | Shows | How |
|
|
20
20
|
|---|---|---|---|
|
|
21
|
-
| **Compact** | Style | every tool call,
|
|
21
|
+
| **Compact** | Style | every tool call as its own compact, expandable row | `"style": "compact"` (default) |
|
|
22
22
|
| **Claude** | Style | reads and searches folded into one line, like Claude Code | `"style": "claude"` |
|
|
23
23
|
| **Silent** | Mode | only your prompts and the answers | `Ctrl+'` or `/silent` |
|
|
24
24
|
|
|
@@ -26,14 +26,14 @@ Set `"style"` in the config below, then `/reload`. `"style": "off"` restores Pi'
|
|
|
26
26
|
|
|
27
27
|
### Style: Compact
|
|
28
28
|
|
|
29
|
-

|
|
30
30
|
|
|
31
|
-
-
|
|
31
|
+
- Each call: what it ran, then its status, duration, and line count.
|
|
32
32
|
- Edits show a highlighted diff with `(+3 -1)`; reads and writes show numbered code.
|
|
33
33
|
|
|
34
34
|
### Style: Claude
|
|
35
35
|
|
|
36
|
-

|
|
37
37
|
|
|
38
38
|
- Reads, searches, and listings fold into one line: `Searched for 2 patterns, read 3 files`.
|
|
39
39
|
- `Bash`, `Update`, `Write`, and custom tools keep their own rows with short previews.
|
|
@@ -51,10 +51,28 @@ function commandOf(args: ToolArgs): string {
|
|
|
51
51
|
return typeof args.command === "string" ? args.command : "";
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Claude Code shortens a collapsed command only past two lines or 160 characters. */
|
|
55
|
+
export const CLAUDE_COMMAND_LINES = 2;
|
|
56
|
+
export const CLAUDE_COMMAND_CHARS = 160;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A command as Claude Code titles it: whole when opened, and collapsed cut only
|
|
60
|
+
* past its line and character limits, with an ellipsis. Within them it is never
|
|
61
|
+
* cut to fit the row; the title wraps instead.
|
|
62
|
+
*/
|
|
63
|
+
export function claudeCommand(command: string, expanded: boolean): string {
|
|
64
|
+
const text = normalizeLineEndings(stripTerminalSequences(command)).trim();
|
|
65
|
+
if (expanded) return text;
|
|
66
|
+
const lines = text.split("\n");
|
|
67
|
+
let shown = lines.length > CLAUDE_COMMAND_LINES ? lines.slice(0, CLAUDE_COMMAND_LINES).join("\n") : text;
|
|
68
|
+
if (shown.length > CLAUDE_COMMAND_CHARS) shown = shown.slice(0, CLAUDE_COMMAND_CHARS);
|
|
69
|
+
return shown === text ? text : `${shown.trim()}…`;
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
/** What goes between the parentheses: `Bash(npm test)`, `Search(pattern: "x", path: "src")`. */
|
|
55
|
-
export function claudeArgument(name: string, args: ToolArgs): string {
|
|
73
|
+
export function claudeArgument(name: string, args: ToolArgs, expanded = false): string {
|
|
56
74
|
const path = pathOf(args);
|
|
57
|
-
if (name === "bash" || name === "powershell") return
|
|
75
|
+
if (name === "bash" || name === "powershell") return claudeCommand(commandOf(args), expanded);
|
|
58
76
|
if (name === "grep" || name === "find") {
|
|
59
77
|
const pattern = typeof args.pattern === "string" ? oneLine(args.pattern) : "";
|
|
60
78
|
// Arguments stream in; until the pattern arrives there is nothing to name.
|
|
@@ -85,8 +103,8 @@ export function formatArguments(args: ToolArgs): string {
|
|
|
85
103
|
return parts.length > 0 ? parts.join(", ") : summarizeCustomArguments(args);
|
|
86
104
|
}
|
|
87
105
|
|
|
88
|
-
export function claudeTitle(name: string, args: ToolArgs): { label: string; argument: string } {
|
|
89
|
-
return { label: claudeLabel(name), argument: claudeArgument(name, args) };
|
|
106
|
+
export function claudeTitle(name: string, args: ToolArgs, expanded = false): { label: string; argument: string } {
|
|
107
|
+
return { label: claudeLabel(name), argument: claudeArgument(name, args, expanded) };
|
|
90
108
|
}
|
|
91
109
|
|
|
92
110
|
// Claude Code's own lists: a command made only of these only looks around, so it
|
|
@@ -176,11 +176,11 @@ function renderRowCall(name: string, args: ToolArgs, theme: Theme, ctx: RenderCo
|
|
|
176
176
|
const container = new CachedContainer();
|
|
177
177
|
if (isClaude()) {
|
|
178
178
|
// Claude Code's call line: `⦁ Bash(npm test)`, `⦁ Update(src/app.ts)`.
|
|
179
|
-
const { label, argument } = claudeTitle(name, args);
|
|
179
|
+
const { label, argument } = claudeTitle(name, args, state.expanded === true);
|
|
180
180
|
const title = `${renderIndicator(theme, ctx, state)} ${theme.fg("toolTitle", theme.bold(label))}`
|
|
181
|
-
+ (argument ? theme.fg("toolOutput",
|
|
182
|
-
//
|
|
183
|
-
container.addChild(
|
|
181
|
+
+ (argument ? styleMultiline(`(${argument})`, (line) => theme.fg("toolOutput", line)) : "");
|
|
182
|
+
// The title wraps rather than being cut to the row; only a very long command is shortened.
|
|
183
|
+
container.addChild(renderToolCall(title, undefined, theme));
|
|
184
184
|
// The title already lists plain arguments; only nested ones need the full view.
|
|
185
185
|
if (kind === "custom" && state.expanded && hasNestedArguments(args)) container.addChild(renderArguments(args, theme));
|
|
186
186
|
return container;
|
|
@@ -313,8 +313,8 @@ function renderClaudeResult(
|
|
|
313
313
|
): Component {
|
|
314
314
|
const chrome = chromePainter(theme);
|
|
315
315
|
const container = new CachedContainer();
|
|
316
|
-
// One line under the call
|
|
317
|
-
const line = (text: string) => prefixedLines(text, chrome(" └ "), CLAUDE_INDENT,
|
|
316
|
+
// One line under the call, wrapped rather than cut to the row.
|
|
317
|
+
const line = (text: string) => prefixedLines(text, chrome(" └ "), CLAUDE_INDENT, false);
|
|
318
318
|
if (options.isPartial) {
|
|
319
319
|
container.addChild(line(chrome("Running…")));
|
|
320
320
|
return container;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-compact-tools",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"description": "Compact, expandable
|
|
3
|
+
"version": "0.11.2",
|
|
4
|
+
"description": "Compact, expandable tool rows for Pi in its own compact style or Claude Code's, with a silent mode and a GitHub Dark theme.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Dong Hyeong Lee",
|
package/release-notes.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"0.11.2": [
|
|
3
|
+
"Claude style no longer cuts commands to one row; long ones wrap, and only past two lines or 160 characters are shortened"
|
|
4
|
+
],
|
|
5
|
+
"0.11.1": [],
|
|
2
6
|
"0.11.0": [
|
|
3
7
|
"Claude style: set \"style\": \"claude\" to see tool calls the way Claude Code shows them",
|
|
4
8
|
"Reads, searches, and listings fold into one line; Bash, Update, and Write keep their own rows",
|