@pify/pretty 0.4.0 → 0.5.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 +22 -0
- package/extensions/pretty.ts +23 -14
- package/package.json +5 -1
- package/themes/token-ultra-dark.json +89 -0
- package/themes/token-ultra-light.json +89 -0
package/README.md
CHANGED
|
@@ -75,6 +75,28 @@ Expanded bodies are capped by `expandedLines`, because a 5,000-line diff or grep
|
|
|
75
75
|
|
|
76
76
|
`summaryClip` is a ceiling, not a target: the effective clip is also bounded by the width of your terminal, re-read on every render. A one-line summary wider than the terminal wraps onto two, and a collapsed row that takes two lines is not collapsed. Resizing mid-session is handled for the same reason.
|
|
77
77
|
|
|
78
|
+
## Themes
|
|
79
|
+
|
|
80
|
+
The renderers read the active pi theme and never their own colours, which is what keeps them consistent with the rest of your terminal — but it also means the word-level diff is only as legible as the theme's diff colours, and pi's builtin themes don't really have any. Measured: in both builtin themes `toolDiffAdded` **is** `success` and `toolDiffRemoved` **is** `error`, with context left as a flat grey. The emphasis works, but it is drawing on a palette that was never designed for it.
|
|
81
|
+
|
|
82
|
+
So this package ships two themes with a diff palette of their own, derived from the [Token](https://github.com/ThorstenRhau/token) colourscheme's Ultra appearance:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
pi --theme token-ultra-dark
|
|
86
|
+
pi --theme token-ultra-light
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Added and removed take Token's git-sign colours — the most separated pair in its palette — while context takes a muted foreground that is distinct from `dim`. Changed words and carried-over words are then genuinely different colours rather than two greys:
|
|
90
|
+
|
|
91
|
+
| | added | removed | context |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `token-ultra-dark` | `#7da47a` | `#c67777` | `#8d8983` |
|
|
94
|
+
| `token-ultra-light` | `#24831f` | `#c82a2a` | `#544e44` |
|
|
95
|
+
|
|
96
|
+
The rest follows Token's own semantics — copper for definitions, ochre for control flow, teal for literals — so syntax-highlighted reads match the scheme you may already be running in Neovim, Ghostty, delta and the rest.
|
|
97
|
+
|
|
98
|
+
Themes only apply in the TUI: `--theme` is ignored under `-p`, for pi's builtin themes as much as for these. `test/live/theme-wire.mjs` therefore drives pi's own theme loader instead of a session, and checks that every colour resolves, that the `vars` indirection really happened, and that the three diff colours are three different colours.
|
|
99
|
+
|
|
78
100
|
## How it works
|
|
79
101
|
|
|
80
102
|
Each tool is re-registered through pi's own `createReadTool()` / `createBashTool()` / … factories with `execute` delegated untouched, overriding only `renderCall` and `renderResult`. Highlighting uses pi's exported `highlightCode` and `getLanguageFromPath`, so colours always match your theme and there are no extra dependencies.
|
package/extensions/pretty.ts
CHANGED
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* (giladbarnea/pi-pretty-bash), per-surface opt-in (pi-zentui).
|
|
15
15
|
*/
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
createBashToolDefinition,
|
|
18
|
+
createEditToolDefinition,
|
|
19
|
+
createFindToolDefinition,
|
|
20
|
+
createGrepToolDefinition,
|
|
21
|
+
createLsToolDefinition,
|
|
22
|
+
createReadToolDefinition,
|
|
23
|
+
createWriteToolDefinition,
|
|
24
24
|
getAgentDir,
|
|
25
25
|
getLanguageFromPath,
|
|
26
26
|
highlightCode,
|
|
@@ -120,14 +120,23 @@ export default function pretty(pi: ExtensionAPI) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function buildOriginals(cwd: string): Record<PrettyTool, AnyTool> {
|
|
123
|
+
// The *ToolDefinition* factories, not the createReadTool wrappers: the
|
|
124
|
+
// wrapper (wrapToolDefinition) copies only name/label/description/
|
|
125
|
+
// parameters/execute and DROPS promptSnippet, promptGuidelines and the
|
|
126
|
+
// built-in renderers. Re-registering the wrapped form removed six of the
|
|
127
|
+
// seven builtins from the system prompt's "Available tools" list —
|
|
128
|
+
// measured: with pretty loaded the list shrank to bash alone, and the
|
|
129
|
+
// Guidelines steered the model to bash for file operations because read,
|
|
130
|
+
// edit and write were no longer named. A renderer package must never
|
|
131
|
+
// change what the model is told it can do.
|
|
123
132
|
return {
|
|
124
|
-
read:
|
|
125
|
-
bash:
|
|
126
|
-
edit:
|
|
127
|
-
write:
|
|
128
|
-
grep:
|
|
129
|
-
find:
|
|
130
|
-
ls:
|
|
133
|
+
read: createReadToolDefinition(cwd) as unknown as AnyTool,
|
|
134
|
+
bash: createBashToolDefinition(cwd) as unknown as AnyTool,
|
|
135
|
+
edit: createEditToolDefinition(cwd) as unknown as AnyTool,
|
|
136
|
+
write: createWriteToolDefinition(cwd) as unknown as AnyTool,
|
|
137
|
+
grep: createGrepToolDefinition(cwd) as unknown as AnyTool,
|
|
138
|
+
find: createFindToolDefinition(cwd) as unknown as AnyTool,
|
|
139
|
+
ls: createLsToolDefinition(cwd) as unknown as AnyTool,
|
|
131
140
|
};
|
|
132
141
|
}
|
|
133
142
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pify/pretty",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Compact, theme-aware rendering for pi's built-in tools: one-line summaries, syntax-highlighted reads, colorized diffs — behavior untouched",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -27,12 +27,16 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"extensions",
|
|
29
29
|
"src",
|
|
30
|
+
"themes",
|
|
30
31
|
"README.md",
|
|
31
32
|
"LICENSE"
|
|
32
33
|
],
|
|
33
34
|
"pi": {
|
|
34
35
|
"extensions": [
|
|
35
36
|
"./extensions/pretty.ts"
|
|
37
|
+
],
|
|
38
|
+
"themes": [
|
|
39
|
+
"./themes"
|
|
36
40
|
]
|
|
37
41
|
},
|
|
38
42
|
"scripts": {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "token-ultra-dark",
|
|
4
|
+
"vars": {
|
|
5
|
+
"accent": "#ed9574",
|
|
6
|
+
"accent2": "#f7c988",
|
|
7
|
+
"bg2": "#212120",
|
|
8
|
+
"bg3": "#272724",
|
|
9
|
+
"bg5": "#383835",
|
|
10
|
+
"blue": "#8aa5bb",
|
|
11
|
+
"bright_blue": "#90b2cc",
|
|
12
|
+
"cyan": "#7ebcbb",
|
|
13
|
+
"diff_add": "#1e3524",
|
|
14
|
+
"diff_del": "#3c2024",
|
|
15
|
+
"fg0": "#c5c1b8",
|
|
16
|
+
"fg1": "#a7a299",
|
|
17
|
+
"fg2": "#a39d94",
|
|
18
|
+
"fg3": "#8d8983",
|
|
19
|
+
"green": "#9ab58e",
|
|
20
|
+
"gsign_add": "#7da47a",
|
|
21
|
+
"gsign_del": "#c67777",
|
|
22
|
+
"indent": "#333330",
|
|
23
|
+
"line_nr": "#585855",
|
|
24
|
+
"match": "#4d4231",
|
|
25
|
+
"olive": "#aab86d",
|
|
26
|
+
"purple": "#b296cb",
|
|
27
|
+
"red": "#dd8384",
|
|
28
|
+
"sel": "#3c3b36",
|
|
29
|
+
"yellow": "#bf9c53"
|
|
30
|
+
},
|
|
31
|
+
"colors": {
|
|
32
|
+
"accent": "accent",
|
|
33
|
+
"border": "blue",
|
|
34
|
+
"borderAccent": "accent",
|
|
35
|
+
"borderMuted": "line_nr",
|
|
36
|
+
"success": "green",
|
|
37
|
+
"error": "red",
|
|
38
|
+
"warning": "yellow",
|
|
39
|
+
"muted": "fg3",
|
|
40
|
+
"dim": "line_nr",
|
|
41
|
+
"text": "fg0",
|
|
42
|
+
"thinkingText": "fg2",
|
|
43
|
+
"selectedBg": "sel",
|
|
44
|
+
"scrollbarTrack": "indent",
|
|
45
|
+
"scrollbarThumb": "fg3",
|
|
46
|
+
"searchMatchBg": "match",
|
|
47
|
+
"searchMatchText": "fg0",
|
|
48
|
+
"userMessageBg": "bg3",
|
|
49
|
+
"userMessageText": "fg0",
|
|
50
|
+
"customMessageBg": "bg2",
|
|
51
|
+
"customMessageText": "fg1",
|
|
52
|
+
"customMessageLabel": "accent2",
|
|
53
|
+
"toolPendingBg": "bg2",
|
|
54
|
+
"toolSuccessBg": "diff_add",
|
|
55
|
+
"toolErrorBg": "diff_del",
|
|
56
|
+
"toolTitle": "accent2",
|
|
57
|
+
"toolOutput": "fg1",
|
|
58
|
+
"mdHeading": "accent",
|
|
59
|
+
"mdLink": "blue",
|
|
60
|
+
"mdLinkUrl": "bright_blue",
|
|
61
|
+
"mdCode": "olive",
|
|
62
|
+
"mdCodeBlock": "fg1",
|
|
63
|
+
"mdCodeBlockBorder": "bg5",
|
|
64
|
+
"mdQuote": "fg2",
|
|
65
|
+
"mdQuoteBorder": "bg5",
|
|
66
|
+
"mdHr": "bg5",
|
|
67
|
+
"mdListBullet": "accent2",
|
|
68
|
+
"toolDiffAdded": "gsign_add",
|
|
69
|
+
"toolDiffRemoved": "gsign_del",
|
|
70
|
+
"toolDiffContext": "fg3",
|
|
71
|
+
"syntaxComment": "fg3",
|
|
72
|
+
"syntaxKeyword": "accent2",
|
|
73
|
+
"syntaxFunction": "accent",
|
|
74
|
+
"syntaxVariable": "fg0",
|
|
75
|
+
"syntaxString": "cyan",
|
|
76
|
+
"syntaxNumber": "purple",
|
|
77
|
+
"syntaxType": "blue",
|
|
78
|
+
"syntaxOperator": "fg1",
|
|
79
|
+
"syntaxPunctuation": "fg3",
|
|
80
|
+
"thinkingOff": "line_nr",
|
|
81
|
+
"thinkingMinimal": "fg3",
|
|
82
|
+
"thinkingLow": "blue",
|
|
83
|
+
"thinkingMedium": "cyan",
|
|
84
|
+
"thinkingHigh": "accent2",
|
|
85
|
+
"thinkingXhigh": "accent",
|
|
86
|
+
"thinkingMax": "red",
|
|
87
|
+
"bashMode": "olive"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "token-ultra-light",
|
|
4
|
+
"vars": {
|
|
5
|
+
"accent": "#893517",
|
|
6
|
+
"accent2": "#6c4800",
|
|
7
|
+
"bg2": "#f6f5f1",
|
|
8
|
+
"bg3": "#fbf9f4",
|
|
9
|
+
"bg5": "#eae9e5",
|
|
10
|
+
"blue": "#37526a",
|
|
11
|
+
"bright_blue": "#335571",
|
|
12
|
+
"cyan": "#185b5b",
|
|
13
|
+
"diff_add": "#daf6d5",
|
|
14
|
+
"diff_del": "#ffdada",
|
|
15
|
+
"fg0": "#31312b",
|
|
16
|
+
"fg1": "#565141",
|
|
17
|
+
"fg2": "#514b44",
|
|
18
|
+
"fg3": "#544e44",
|
|
19
|
+
"green": "#385a35",
|
|
20
|
+
"gsign_add": "#24831f",
|
|
21
|
+
"gsign_del": "#c82a2a",
|
|
22
|
+
"indent": "#e0ddd8",
|
|
23
|
+
"line_nr": "#b5b2ab",
|
|
24
|
+
"match": "#eadab6",
|
|
25
|
+
"olive": "#46550a",
|
|
26
|
+
"purple": "#573c72",
|
|
27
|
+
"red": "#ae5158",
|
|
28
|
+
"sel": "#dedbd3",
|
|
29
|
+
"yellow": "#926e25"
|
|
30
|
+
},
|
|
31
|
+
"colors": {
|
|
32
|
+
"accent": "accent",
|
|
33
|
+
"border": "blue",
|
|
34
|
+
"borderAccent": "accent",
|
|
35
|
+
"borderMuted": "line_nr",
|
|
36
|
+
"success": "green",
|
|
37
|
+
"error": "red",
|
|
38
|
+
"warning": "yellow",
|
|
39
|
+
"muted": "fg3",
|
|
40
|
+
"dim": "line_nr",
|
|
41
|
+
"text": "fg0",
|
|
42
|
+
"thinkingText": "fg2",
|
|
43
|
+
"selectedBg": "sel",
|
|
44
|
+
"scrollbarTrack": "indent",
|
|
45
|
+
"scrollbarThumb": "fg3",
|
|
46
|
+
"searchMatchBg": "match",
|
|
47
|
+
"searchMatchText": "fg0",
|
|
48
|
+
"userMessageBg": "bg3",
|
|
49
|
+
"userMessageText": "fg0",
|
|
50
|
+
"customMessageBg": "bg2",
|
|
51
|
+
"customMessageText": "fg1",
|
|
52
|
+
"customMessageLabel": "accent2",
|
|
53
|
+
"toolPendingBg": "bg2",
|
|
54
|
+
"toolSuccessBg": "diff_add",
|
|
55
|
+
"toolErrorBg": "diff_del",
|
|
56
|
+
"toolTitle": "accent2",
|
|
57
|
+
"toolOutput": "fg1",
|
|
58
|
+
"mdHeading": "accent",
|
|
59
|
+
"mdLink": "blue",
|
|
60
|
+
"mdLinkUrl": "bright_blue",
|
|
61
|
+
"mdCode": "olive",
|
|
62
|
+
"mdCodeBlock": "fg1",
|
|
63
|
+
"mdCodeBlockBorder": "bg5",
|
|
64
|
+
"mdQuote": "fg2",
|
|
65
|
+
"mdQuoteBorder": "bg5",
|
|
66
|
+
"mdHr": "bg5",
|
|
67
|
+
"mdListBullet": "accent2",
|
|
68
|
+
"toolDiffAdded": "gsign_add",
|
|
69
|
+
"toolDiffRemoved": "gsign_del",
|
|
70
|
+
"toolDiffContext": "fg3",
|
|
71
|
+
"syntaxComment": "fg3",
|
|
72
|
+
"syntaxKeyword": "accent2",
|
|
73
|
+
"syntaxFunction": "accent",
|
|
74
|
+
"syntaxVariable": "fg0",
|
|
75
|
+
"syntaxString": "cyan",
|
|
76
|
+
"syntaxNumber": "purple",
|
|
77
|
+
"syntaxType": "blue",
|
|
78
|
+
"syntaxOperator": "fg1",
|
|
79
|
+
"syntaxPunctuation": "fg3",
|
|
80
|
+
"thinkingOff": "line_nr",
|
|
81
|
+
"thinkingMinimal": "fg3",
|
|
82
|
+
"thinkingLow": "blue",
|
|
83
|
+
"thinkingMedium": "cyan",
|
|
84
|
+
"thinkingHigh": "accent2",
|
|
85
|
+
"thinkingXhigh": "accent",
|
|
86
|
+
"thinkingMax": "red",
|
|
87
|
+
"bashMode": "olive"
|
|
88
|
+
}
|
|
89
|
+
}
|