@neilurk12/pi-clean-footer 0.1.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 +140 -0
- package/docs/superpowers/plans/2026-05-09-clean-footer-extension.md +546 -0
- package/docs/superpowers/specs/2026-05-09-clean-footer-extension-design.md +149 -0
- package/example.png +0 -0
- package/package.json +23 -0
- package/src/index.ts +595 -0
- package/tok +1 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Clean Footer Extension Design
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Create a project-local pi footer extension that replaces the built-in footer with a cleaner, adaptive footer focused on model identity, reasoning effort, project context, git state, context usage, and cumulative token/cache telemetry.
|
|
6
|
+
|
|
7
|
+
## Placement
|
|
8
|
+
|
|
9
|
+
Use a project-local extension:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
.pi/extensions/clean-footer/index.ts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This keeps development local to the current repo and supports hot reload through `/reload`. The extension should have no runtime dependencies beyond pi's extension/TUI APIs unless implementation proves a helper is necessary.
|
|
16
|
+
|
|
17
|
+
## Footer Layout
|
|
18
|
+
|
|
19
|
+
The footer is split into left and right regions with adaptive spacing.
|
|
20
|
+
|
|
21
|
+
Left side:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
model • effort | dir | branch ●N
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Right side:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
ctx used/max | ↑input ↓output Σtotal ↯cacheRead ↥cacheWrite
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Example full-width render:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
sonnet-4.5 • high | footer | main ●3 ctx 84k/200k | ↑12.4k ↓3.1k Σ15.5k ↯8.2k ↥1.0k
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Field Semantics
|
|
40
|
+
|
|
41
|
+
### Model and effort
|
|
42
|
+
|
|
43
|
+
- Display a smart-short model name when known, with pattern-based shortening for common model IDs.
|
|
44
|
+
- Fallback to truncated exact model ID when no smart rule matches.
|
|
45
|
+
- Display reasoning effort directly beside model name as `low`, `med`, `high`, or `xhigh`.
|
|
46
|
+
- Format: `model • effort`.
|
|
47
|
+
|
|
48
|
+
### Directory
|
|
49
|
+
|
|
50
|
+
- Display only the basename of `ctx.cwd`.
|
|
51
|
+
- Do not show parent path or full path.
|
|
52
|
+
|
|
53
|
+
### Git
|
|
54
|
+
|
|
55
|
+
- Hide git segment entirely outside a git repository.
|
|
56
|
+
- Inside a repo, display branch plus dirty count.
|
|
57
|
+
- Dirty count is the number of lines from `git status --porcelain`, including untracked files.
|
|
58
|
+
- Format: `branch ●N` when dirty, `branch` when clean.
|
|
59
|
+
- Git refresh is event-driven and debounced, not run on every render.
|
|
60
|
+
|
|
61
|
+
### Context usage
|
|
62
|
+
|
|
63
|
+
- Display used/max tokens: `ctx 84k/200k`.
|
|
64
|
+
- If max context is unknown, display `ctx 84k/--`.
|
|
65
|
+
- Color thresholds:
|
|
66
|
+
- below 70%: normal
|
|
67
|
+
- 70% through 84%: warning/yellow
|
|
68
|
+
- 85% and above: danger/red
|
|
69
|
+
- unknown max: dim/neutral
|
|
70
|
+
|
|
71
|
+
### Token and cache telemetry
|
|
72
|
+
|
|
73
|
+
- Use cumulative totals across the active session branch.
|
|
74
|
+
- Display input, output, total, cache read, and cache write.
|
|
75
|
+
- Format: `↑12k ↓3k Σ15k ↯8k ↥1k`.
|
|
76
|
+
|
|
77
|
+
## Adaptive Width Tiers
|
|
78
|
+
|
|
79
|
+
The footer must degrade gracefully as terminal width shrinks.
|
|
80
|
+
|
|
81
|
+
1. Full: model/effort, directory, git, context used/max, input/output/total/cache read/cache write.
|
|
82
|
+
2. Medium: hide cache read/write.
|
|
83
|
+
3. Small: hide input/output breakdown and show total only.
|
|
84
|
+
4. Tiny: show left side plus context only.
|
|
85
|
+
5. Minimum: show model and context only.
|
|
86
|
+
|
|
87
|
+
Truncation should prefer preserving meaningful whole segments rather than cramming all fields.
|
|
88
|
+
|
|
89
|
+
## Refresh and Invalidation
|
|
90
|
+
|
|
91
|
+
- Install footer on `session_start` when `ctx.hasUI` is true.
|
|
92
|
+
- Request render on relevant events, without a periodic timer.
|
|
93
|
+
- Refresh git state:
|
|
94
|
+
- at startup/reload
|
|
95
|
+
- after tool executions that may affect files: `bash`, `edit`, `write`
|
|
96
|
+
- after user `!`/`!!` bash commands
|
|
97
|
+
- Debounce git refresh by roughly 500 ms.
|
|
98
|
+
- Do not execute git commands from footer `render()`.
|
|
99
|
+
|
|
100
|
+
## Commands
|
|
101
|
+
|
|
102
|
+
Register `/footer` command behavior:
|
|
103
|
+
|
|
104
|
+
- `/footer`: toggle custom footer on/off.
|
|
105
|
+
- `/footer refresh`: force git refresh and re-render.
|
|
106
|
+
|
|
107
|
+
The footer should be enabled by default when the extension loads in an interactive UI.
|
|
108
|
+
|
|
109
|
+
## Non-Interactive Behavior
|
|
110
|
+
|
|
111
|
+
If `ctx.hasUI` is false, the extension should silently no-op for footer setup and avoid throwing. Commands should also avoid crashing in non-interactive, RPC, print, or JSON contexts.
|
|
112
|
+
|
|
113
|
+
## Style
|
|
114
|
+
|
|
115
|
+
Use color-coded segments, but keep colors restrained and theme-driven:
|
|
116
|
+
|
|
117
|
+
- model/effort: accent-like color
|
|
118
|
+
- directory: dim/muted
|
|
119
|
+
- git branch: success/green-ish; dirty marker/count: warning/accent
|
|
120
|
+
- context: threshold-based normal/warning/danger
|
|
121
|
+
- tokens/cache: muted/info style
|
|
122
|
+
|
|
123
|
+
## Error Handling
|
|
124
|
+
|
|
125
|
+
- Git command failures should clear/hide git state rather than displaying errors in footer.
|
|
126
|
+
- Missing model/context metadata should use documented fallbacks.
|
|
127
|
+
- Extension reload should restore built-in footer when disabled or on cleanup if necessary.
|
|
128
|
+
|
|
129
|
+
## Testing Strategy
|
|
130
|
+
|
|
131
|
+
Manual checks:
|
|
132
|
+
|
|
133
|
+
1. Load extension with `/reload` and verify footer replaces built-in footer.
|
|
134
|
+
2. Toggle with `/footer`.
|
|
135
|
+
3. Force refresh with `/footer refresh`.
|
|
136
|
+
4. Verify basename directory display.
|
|
137
|
+
5. Verify git branch and dirty count update after file edits and bash changes.
|
|
138
|
+
6. Verify git segment hides outside a repo.
|
|
139
|
+
7. Verify context/token fields update after assistant responses.
|
|
140
|
+
8. Resize terminal to exercise all width tiers.
|
|
141
|
+
9. Run in non-interactive mode or no-UI context if available and confirm no crash.
|
|
142
|
+
|
|
143
|
+
## Out of Scope
|
|
144
|
+
|
|
145
|
+
- Persistent user config file.
|
|
146
|
+
- NPM package publishing.
|
|
147
|
+
- Provider-specific exhaustive model alias registry.
|
|
148
|
+
- Polling-based live refresh.
|
|
149
|
+
- Full git status counts or untracked split counts.
|
package/example.png
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neilurk12/pi-clean-footer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Clean adaptive footer extension for pi coding agent.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi-extension",
|
|
9
|
+
"footer",
|
|
10
|
+
"terminal"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"pi": {
|
|
14
|
+
"extensions": [
|
|
15
|
+
"./src/index.ts"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@earendil-works/pi-ai": "*",
|
|
20
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
21
|
+
"@earendil-works/pi-tui": "*"
|
|
22
|
+
}
|
|
23
|
+
}
|