@vanillagreen/pi-tool-renderer

extensionmaintained

Compact Claude/opencode-style renderers for Pi tools with rich diffs, apply_patch, generic/MCP rendering, and optional global chrome.

by · v1.7.1 · published 2w ago

$ pi install npm:@vanillagreen/pi-tool-renderer
downloads/mo
769
stars
55
last push
8h ago
open issues
7

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

No downloads in the last 12 weeks.

README

pi-tool-renderer

tool_batch composite result with Read/grep/Bash rows Edit tool with side-by-side diff renderer

Compact renderers for Pi tools. Optional tool_batch composite tool. Optional rich diff UI for edits, writes, and bash patches.

Highlights

  • Compact one-line tool rows for read, bash, grep, find, ls; file paths in compact rows use OSC 8 file:// hyperlinks when the terminal supports them.
  • Delayed live bash tails avoid fast-command output flashes; long-running commands show/preserve the last few lines flush-left so copied output has no gutter characters.
  • Pi-compatible terminal normalization handles CRLF/lone-CR line endings and expands visible tabs to three columns.
  • tool_batch runs multiple independent read/search/list/diagnostic bash calls and renders one combined result.
  • Optional rich Shiki diffs for edit/write with side-by-side previews, hunk counts, and inline word highlights.
  • Compact user-message cards with a green border and red π marker.
  • Compaction summaries and skill invocations render with the same compact chrome.
  • Generic renderers for OpenAI-style tools (web_search, webfetch, Agent, Task*) and MCP tools.
  • apply_patch call/result preview when the tool is present.

Defaults leave edit/write on Pi's built-in renderers. Enable Render edits/writes compactly to opt in.

Install

Via npm:

pi install npm:@vanillagreen/pi-tool-renderer

Via vstack:

cargo install --git https://github.com/vanillagreencom/vstack.git vstack
vstack add vanillagreencom/vstack --pi-extension pi-tool-renderer --harness pi -y

Restart Pi after installation.

tool_batch

{
  "calls": [
    { "tool": "read", "path": "README.md" },
    { "tool": "grep", "pattern": "registerCommand", "path": "pi-extensions" }
  ]
}

Accepts read, grep, find, ls, and diagnostic bash. Per-call arguments can be flat or wrapped in args.

Prefer it for independent inspection calls. Don't use it for mutating commands, order-dependent commands, streaming output, or anything you want to inspect separately.

If the combined output would exceed Pi's normal tool-result budget, child outputs are capped to fit (head + tail preserved). Use separate calls or read offset/limit for the full budget per call.

Settings

Open /extensions:settings; settings appear under the Tool Renderer tab.

Project settings in .pi/settings.json apply only after Pi marks the workspace trusted; before trust, vstack Pi extensions read user/global settings only.

Glyph style: each package exposes glyphStyle (unicode default, ascii for terminal-safe chrome). @vanillagreen/pi-tool-renderer.globalGlyphStyleOverride=ascii forces ASCII chrome across vstack Pi extensions while leaving tool/model/user content unchanged.

General

SettingWhat it does
Enable compact renderersOverride built-in read/bash/search renderers.
Tree connector styleunicode or ascii.
Stack separate native tool callsLegacy renderer for consecutive native tool calls. Prefer tool_batch.
Stack child displayrows, headline, or anchor-list when stacking is on.

Batch tool

SettingWhat it does
Register tool_batchAdd the composite tool.
Batch max callsMax calls per tool_batch invocation.
Batch per-call timeout (ms)Max time any one child call may run before tool_batch reports that child as timed out.

Messages

SettingWhat it does
Compact user messagesGreen border + red π marker instead of filled background; preserves Pi's prompt-zone markers around the full framed card.
User message trailing blank lineExtra blank line after user messages.
Compact compaction summariesCompact bullet style instead of Pi's padded box.
Compact skill invocation messagesCompact /skill:name rows.
Align assistant messagesRemove Pi's one-column left padding from assistant text.
Styled markdown code blocksRender fenced code blocks with syntax highlighting and background, flush-left with no copy gutter/prefix.

Read / Search / Bash output

SettingWhat it does
Read output modepreview, summary, or hidden.
Read image displayoff, always, or on (expanded-only); requires Pi terminal.showImages=false.
Search output modepreview, count, or hidden.
Bash output modeopencode, preview, summary, or hidden.
Live bash output delay (ms)Wait this long before showing a running bash output tail.
Live bash tail linesTail lines shown for long-running bash output and kept after completion.
Expanded read/search/bash preview linesPer-tool expand-time line caps.
Command preview charactersMax command chars in collapsed bash rows.
Collapsed bash preview linesTail lines shown when bashOutputMode=preview.

Bash diffs

SettingWhat it does
Render bash diffsDetect diff output from read-only bash and render rich diff UI. Off by default.
Render git diff command diffsShow rich diff UI for explicit git diff commands. Off by default.

Mutation (edit/write)

SettingWhat it does
Render edits/writes compactlyOverride Pi's built-in edit/write renderers. Off by default.
Split diff viewSide-by-side rich diffs on wide terminals.
Collapsed / expanded diff preview linesLine budgets for collapsed and expanded rows.
Edit/write call previewShow safe call-phase diff previews before execution completes.
Edit/write call preview linesLine budget for call-phase previews.
Syntax-highlight diffsUse Shiki when a language can be detected.
Inline word diff highlightsHighlight changed words in paired removed/added lines.
Diff line backgroundsFill added/removed lines with success/error backgrounds.
Show diff hunk metadataInclude hunk counts and truncation hints.

Generic tools

SettingWhat it does
Generic external tool renderersRender web_search, webfetch, Agent, Task* and similar.
Render apply_patchInstall apply_patch call/result renderers without changing execution.
apply_patch call previewParse arguments and render diff previews during the call phase.
apply_patch preview linesLine budget for collapsed apply_patch diffs.
MCP output modepreview, summary, or hidden.
MCP preview linesLine budget for MCP/generic tool previews.

Chrome

SettingWhat it does
Global tool chromeoff, transparent, or outlines (muted horizontal rules above/below), including tools that render their own shell.
Guard terminal right marginRender one column short to avoid auto-wrap flashes in tmux.
Animate pending tool statusBlink pending bullets. Off for stable streaming.
Working indicatordefault, pulse, or hidden.

Safety

SettingWhat it does
Max renderer line widthHard cap for single rendered lines.

Notes

This package mostly changes rendering, not tool execution. tool_batch is one tool result, so it caps combined child output if needed; individual built-in tools still apply their own truncation first.