pi-fancy-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matthias Vallentin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # ✨ pi-fancy-footer
2
+
3
+ A [pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)
4
+ extension that replaces the default footer with a compact, two-line fancy status
5
+ footer.
6
+
7
+ ## 📊 What it shows
8
+
9
+ - Active model + thinking level
10
+ - Context window capacity and approximate usage
11
+ - Context usage bar with compaction reserve tail
12
+ - Total session cost
13
+ - Repo / path, branch, commit
14
+ - Git diff stats and ahead/behind status
15
+
16
+ ## 📦 Install
17
+
18
+ Install as a pi package:
19
+
20
+ ```bash
21
+ pi install npm:pi-fancy-footer
22
+ ```
23
+
24
+ ## 🎮 Commands
25
+
26
+ - `/fancy-footer` - open interactive footer config editor (small TUI)
27
+ - all widgets are listed directly (with icon prefixes)
28
+ - select a widget and press Enter for detailed settings
29
+ - in widget settings, adjust row/position/align/fill/min-width, visibility,
30
+ icon show/hide, icon color, and text color
31
+ - use Enter/Space to cycle values
32
+
33
+ ## ⚙️ Configuration
34
+
35
+ Create `~/.pi/agent/fancy-footer.json`:
36
+
37
+ ```json
38
+ {
39
+ "refreshMs": 3000,
40
+ "showPiBanner": true,
41
+ "defaultTextColor": "dim",
42
+ "defaultIconColor": "text",
43
+ "widgets": {
44
+ "context-bar": {
45
+ "align": "middle",
46
+ "row": 0,
47
+ "position": 0,
48
+ "fill": "grow",
49
+ "minWidth": 12
50
+ },
51
+ "total-cost": {
52
+ "enabled": false
53
+ },
54
+ "branch": {
55
+ "icon": "show",
56
+ "iconColor": "text",
57
+ "textColor": "muted"
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ Top-level settings:
64
+
65
+ - `refreshMs` (number)
66
+ - `showPiBanner` (boolean)
67
+ - `defaultTextColor` (`text` | `accent` | `muted` | `dim` | `success` | `error` | `warning`)
68
+ - `defaultIconColor` (`text` | `accent` | `muted` | `dim` | `success` | `error` | `warning`)
69
+
70
+ Supported per-widget overrides:
71
+
72
+ - `enabled` (boolean)
73
+ - `row` (number)
74
+ - `position` (number, ordering within an aligned row group)
75
+ - `align` (`left` | `middle` | `right`)
76
+ - `fill` (`none` | `grow`)
77
+ - `minWidth` (number)
78
+ - `icon` (`default` | `show` | `hide`)
79
+ - `iconColor` (`text` | `accent` | `muted` | `dim` | `success` | `error` | `warning`)
80
+ - `textColor` (`text` | `accent` | `muted` | `dim` | `success` | `error` | `warning`)
81
+
82
+ Widget IDs:
83
+
84
+ - `model`
85
+ - `thinking`
86
+ - `context-capacity`
87
+ - `context-bar`
88
+ - `context-usage`
89
+ - `total-cost`
90
+ - `location`
91
+ - `branch`
92
+ - `commit`
93
+ - `diff-added`
94
+ - `diff-removed`
95
+ - `git-status`
96
+
97
+ Notes:
98
+
99
+ - Uses Nerd Font glyphs for best visuals.
100
+ - Reads compaction settings from:
101
+ - `~/.pi/agent/settings.json`
102
+ - `<project>/.pi/settings.json`
103
+
104
+ ## 📄 License
105
+
106
+ [MIT](LICENSE)
@@ -0,0 +1,58 @@
1
+ import type { Theme } from "@mariozechner/pi-coding-agent";
2
+
3
+ const PI_ART = [
4
+ " 3.141592653589793238462643383279",
5
+ " 5028841971693993751058209749445923",
6
+ " 07816406286208998628034825342117067",
7
+ " 9821 48086 5132",
8
+ " 823 06647 09384",
9
+ "46 09550 58223",
10
+ " 1725 3594",
11
+ " 08128 48111",
12
+ " 74502 84102",
13
+ " 70193 85211 05",
14
+ " 5596446 22948954930381",
15
+ " 9644288 10975665933",
16
+ ];
17
+
18
+ function hslToRgb(h: number, s: number, l: number): [number, number, number] {
19
+ h = ((h % 360) + 360) % 360;
20
+ const c = (1 - Math.abs(2 * l - 1)) * s;
21
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
22
+ const m = l - c / 2;
23
+ let r = 0;
24
+ let g = 0;
25
+ let b = 0;
26
+ if (h < 60) [r, g, b] = [c, x, 0];
27
+ else if (h < 120) [r, g, b] = [x, c, 0];
28
+ else if (h < 180) [r, g, b] = [0, c, x];
29
+ else if (h < 240) [r, g, b] = [0, x, c];
30
+ else if (h < 300) [r, g, b] = [x, 0, c];
31
+ else [r, g, b] = [c, 0, x];
32
+ return [Math.round((r + m) * 255), Math.round((g + m) * 255), Math.round((b + m) * 255)];
33
+ }
34
+
35
+ const RESET = "\x1b[0m";
36
+
37
+ function rainbowLine(line: string, rowOffset: number): string {
38
+ const totalChars = 50;
39
+ let result = "";
40
+ for (let i = 0; i < line.length; i++) {
41
+ const ch = line[i]!;
42
+ if (ch === " ") {
43
+ result += " ";
44
+ continue;
45
+ }
46
+ const hue = ((i + rowOffset * 3) / totalChars) * 360;
47
+ const [r, g, b] = hslToRgb(hue, 0.85, 0.65);
48
+ result += `\x1b[38;2;${r};${g};${b}m${ch}`;
49
+ }
50
+ return result + RESET;
51
+ }
52
+
53
+ export function renderBannerLines(_theme: Theme, width: number): string[] {
54
+ const maxLen = Math.max(...PI_ART.map((line) => line.length));
55
+ const pad = Math.max(0, Math.floor((width - maxLen) / 2));
56
+ const prefix = " ".repeat(pad);
57
+ return ["", ...PI_ART.map((line, row) => prefix + rainbowLine(line, row)), ""];
58
+ }