@owlburtoe/pi-cc-tools 1.0.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/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # pi-cc-tools
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ pi install npm:@owlburtoe/pi-cc-tools
7
+ ```
8
+
9
+ Run `/reload` or restart Pi after installation.
10
+
11
+
12
+ Claude Code inspired tool rendering for Pi — Shiki-powered diffs, status dots, branch connectors, file icons, and configurable output modes.
13
+
14
+ ## Features
15
+
16
+ - **Compact built-in tool rendering** for `read`, `bash`, `grep`, `find`, `ls`, `edit`, and `write`
17
+ - **Claude-style OpenAI tool rendering** for `apply_patch` plus common Pi/OpenAI-style tools like `webfetch`, `web_search`, `fetch_content`, task tools, and context tools
18
+ - **`apply_patch` diff previews** that render parsed file patches in the call phase, similar to `edit`/`write`
19
+ - **Adaptive edit/write diffs** with split or unified layouts, syntax highlighting, and inline word-level emphasis
20
+ - **Diff stat bar** with colored add/remove summary and hunk metadata
21
+ - **Progressive collapsed diff hints** that shorten on narrow terminals
22
+ - **Thinking labels** during streaming and final messages, with context sanitization
23
+ - **MCP-aware rendering** with hidden, summary, and preview modes
24
+ - **Configurable output modes** for read, search, bash, and MCP results
25
+ - **Transparent tool backgrounds** in `transparent` or `border` mode
26
+ - **Theme-adaptive palette** — borders, branch connectors, dim text, spinner accent, and diff backgrounds automatically follow the active pi theme (set `themeAdaptive: false` to keep the fixed Claude-style palette)
27
+ - **Transparent edit/write diffs** with universal red/green diff colors
28
+ - **Global border patch** for all tool rows, including unknown/custom tools
29
+
30
+ ## Configuration
31
+
32
+ Set in `.pi/settings.json` or `~/.pi/settings.json`:
33
+
34
+ ```json
35
+ {
36
+ "toolBackground": "border",
37
+ "readOutputMode": "preview",
38
+ "searchOutputMode": "preview",
39
+ "mcpOutputMode": "preview",
40
+ "previewLines": 8,
41
+ "bashOutputMode": "opencode",
42
+ "bashCollapsedLines": 10,
43
+ "diffCollapsedLines": 24,
44
+ "themeAdaptive": true,
45
+ "diffTheme": "github-dark",
46
+ "spinnerColor": "borderAccent",
47
+ "spinnerVerbs": ["Reviewing", "Polishing"],
48
+ "spinnerVerbMode": "append"
49
+ }
50
+ ```
51
+
52
+ ### Theme integration
53
+
54
+ When `themeAdaptive` is `true` (default), the following colors are derived from the active pi theme on every render and re-derived whenever the theme changes:
55
+
56
+ | Element | Derived from |
57
+ |---------|--------------|
58
+ | Tool outline borders (top/bottom rules) | `borderMuted` |
59
+ | Branch connectors (`├─`, `└─`, `│`) | `dim` (fallback: `muted`) |
60
+ | "✻ Worked for Ns" line | `muted` |
61
+ | Thinking-block italic gray | `muted` |
62
+ | Diff add/remove accents | `toolDiffAdded` / `toolDiffRemoved` |
63
+ | Diff background tints | mixed against `toolSuccessBg` base |
64
+ | Spinner glyph + verb text (`✻ Working…`) | `borderAccent` (fallback: `accent`) |
65
+ | Spinner status text | `muted` |
66
+
67
+ User-supplied `diffTheme` presets and `diffColors` overrides always win over theme-derived defaults. File-type icons (e.g. `ts`, `py`, `rs`) keep their language-identity colors and are not theme-derived.
68
+
69
+ Set `themeAdaptive: false` to keep the original fixed Claude-style palette regardless of the active pi theme.
70
+
71
+ #### Toggle at runtime with `/cc-theme`
72
+
73
+ ```text
74
+ /cc-theme # show current setting + theme name
75
+ /cc-theme status # show current setting + color preview (incl. spinner)
76
+ /cc-theme on # follow pi theme
77
+ /cc-theme off # keep fixed Claude palette
78
+ /cc-theme toggle # flip the current value
79
+ ```
80
+
81
+ The selection is persisted to `~/.pi/settings.json` and applied to the next rendered tool row. No restart required.
82
+
83
+ #### Repaint the spinner with `/cc-spinner`
84
+
85
+ The spinner glyph and verb text (e.g. `✻ Cooking…`) share `borderAccent` by default so the working indicator reads as one unit. The status suffix (e.g. `(thinking · ↓ 10 tokens · 2s)`) follows `muted`. Use `/cc-spinner` to bind either text element to any other theme color key:
86
+
87
+ ```text
88
+ /cc-spinner preview # list every common theme key with a colored sample
89
+ /cc-spinner color <key> # change glyph + verb color together (e.g. thinkingHigh)
90
+ /cc-spinner verb <key> # alias for color, kept for older muscle memory
91
+ /cc-spinner status <key> # change the status suffix color
92
+ /cc-spinner reset # restore color defaults (spinner=borderAccent, status=muted)
93
+ /cc-spinner verbs list # show custom spinner verbs and append/replace mode
94
+ /cc-spinner verbs add Reviewing # add a custom verb or phrase
95
+ /cc-spinner verbs remove Reviewing # remove a custom verb or phrase
96
+ /cc-spinner verbs mode append # append custom verbs to the defaults
97
+ /cc-spinner verbs mode replace # use only custom verbs, with safe fallback to defaults
98
+ /cc-spinner verbs reset # remove user custom verbs and mode
99
+ ```
100
+
101
+ Color selections are persisted as `spinnerColor` / `spinnerStatusColor` in `~/.pi/settings.json` and applied on the next spinner tick. Older `spinnerVerbColor` settings still work as a backward-compatible alias. Custom verbs are persisted as `spinnerVerbs` and `spinnerVerbMode`; they are picked at the next turn start. `/cc-spinner verbs ...` writes user settings in `~/.pi/settings.json`; project-level custom verbs can be set manually in `.pi/settings.json`. When both project and user spinner settings exist, the spinner reader applies project settings first and user settings second.
102
+
103
+ ### Tool background modes
104
+
105
+ | Value | Behavior |
106
+ |-------|----------|
107
+ | `default` | Standard Pi tool backgrounds |
108
+ | `transparent` | Transparent tool backgrounds |
109
+ | `border` | Transparent backgrounds with top/bottom border lines |
110
+
111
+ ### Output modes
112
+
113
+ | Setting | Values | Default |
114
+ |---------|--------|---------|
115
+ | `readOutputMode` | `hidden`, `summary`, `preview` | `preview` |
116
+ | `searchOutputMode` | `hidden`, `count`, `preview` | `preview` |
117
+ | `mcpOutputMode` | `hidden`, `summary`, `preview` | `preview` |
118
+ | `bashOutputMode` | `opencode`, `summary`, `preview` | `opencode` |
119
+
120
+ ### Numeric settings
121
+
122
+ | Setting | Default | Description |
123
+ |---------|---------|-------------|
124
+ | `previewLines` | `8` | Lines shown in collapsed preview mode |
125
+ | `expandedPreviewMaxLines` | `4000` | Max lines when fully expanded |
126
+ | `bashCollapsedLines` | `10` | Lines for collapsed bash output |
127
+ | `diffCollapsedLines` | `24` | Diff lines before collapsing |
128
+
129
+ ## Notes
130
+
131
+ This package targets recent Pi versions where tool renderers use:
132
+
133
+ - `renderCall(args, theme, context)`
134
+ - `renderResult(result, { expanded, isPartial }, theme, context)`
135
+
136
+ Unknown/custom tools do not have a public global renderer hook in Pi, so this package patches container rendering to add top/bottom borders for all tool executions in border mode.
137
+
138
+ ## Credits
139
+
140
+ This project builds upon and was inspired by the excellent work of:
141
+
142
+ - **[@heyhuynhgiabuu/pi-pretty](https://github.com/buddingnewinsights/pi-pretty)** by [huynhgiabuu](https://github.com/buddingnewinsights) — Pretty terminal output with syntax-highlighted file reads, colored bash output, and tree-view directory listings
143
+ - **[@heyhuynhgiabuu/pi-diff](https://github.com/buddingnewinsights/pi-diff)** by [huynhgiabuu](https://github.com/buddingnewinsights) — Shiki-powered terminal diff renderer with word-level diffs in split and unified views
144
+ - **[pi-tool-display](https://github.com/MasuRii/pi-tool-display)** by [MasuRii](https://github.com/MasuRii) — Compact tool call rendering, diff visualization, and output truncation
@@ -0,0 +1,18 @@
1
+ {
2
+ "toolBackground": "transparent",
3
+ "readOutputMode": "preview",
4
+ "searchOutputMode": "preview",
5
+ "mcpOutputMode": "preview",
6
+ "previewLines": 8,
7
+ "expandedPreviewMaxLines": 4000,
8
+ "bashOutputMode": "opencode",
9
+ "bashCollapsedLines": 10,
10
+ "diffCollapsedLines": 24,
11
+ "showTruncationHints": false,
12
+ "themeAdaptive": true,
13
+ "diffTheme": "github-dark",
14
+ "diffColors": {},
15
+ "spinnerColor": "borderAccent",
16
+ "spinnerVerbs": ["Reviewing", "Polishing"],
17
+ "spinnerVerbMode": "append"
18
+ }