@diegopetrucci/pi-minimal-footer 0.1.2
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 +74 -0
- package/index.ts +54 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# minimal-footer
|
|
2
|
+
|
|
3
|
+
A minimal custom footer for pi.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
It replaces pi's built-in footer with a cleaner two-line layout that focuses on the information I care about most:
|
|
8
|
+
|
|
9
|
+
- current git branch
|
|
10
|
+
- current repo name
|
|
11
|
+
- current context percentage
|
|
12
|
+
- current model and thinking level
|
|
13
|
+
|
|
14
|
+
## Layout
|
|
15
|
+
|
|
16
|
+
On wide terminals it renders two lines:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
<git-branch> <repo-name>
|
|
20
|
+
<context-%> <model> • <thinking>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
fix/remove-detached-image-tasks SendItToMy
|
|
27
|
+
44.1% gpt-5.4 • high
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
On narrow terminals it falls back to one item per line.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
### Standalone npm package
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pi install npm:@diegopetrucci/pi-minimal-footer
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Collection package
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pi install npm:@diegopetrucci/pi-extensions
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### GitHub package
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pi install git:github.com/diegopetrucci/pi-extensions
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then reload pi:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
/reload
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## What it shows
|
|
59
|
+
|
|
60
|
+
- **Top left:** current git branch
|
|
61
|
+
- **Top right:** current repo directory name
|
|
62
|
+
- **Bottom left:** current context usage percentage
|
|
63
|
+
- **Bottom right:** model id and thinking level
|
|
64
|
+
|
|
65
|
+
## Publishing notes
|
|
66
|
+
|
|
67
|
+
This extension also lives inside the broader [`pi-extensions`](../../README.md) collection, but it is set up to be publishable as its own npm package too.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
- Replaces pi's built-in footer entirely.
|
|
72
|
+
- Uses pi footer data for git branch updates.
|
|
73
|
+
- Shows only context percentage, not context window size.
|
|
74
|
+
- Shows the model id rather than a provider-specific display label.
|
package/index.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
3
|
+
import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
4
|
+
|
|
5
|
+
export default function (pi: ExtensionAPI) {
|
|
6
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
7
|
+
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
8
|
+
const unsub = footerData.onBranchChange(() => tui.requestRender());
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
dispose: unsub,
|
|
12
|
+
invalidate() {},
|
|
13
|
+
render(width: number): string[] {
|
|
14
|
+
const repo = basename(ctx.cwd);
|
|
15
|
+
const branch = footerData.getGitBranch() ?? "";
|
|
16
|
+
|
|
17
|
+
const usage = ctx.getContextUsage();
|
|
18
|
+
const context = usage?.percent == null ? "?" : `${usage.percent.toFixed(1)}%`;
|
|
19
|
+
|
|
20
|
+
const model = ctx.model?.id ?? "no-model";
|
|
21
|
+
const thinking = pi.getThinkingLevel();
|
|
22
|
+
const modelText = thinking === "off" ? model : `${model} • ${thinking}`;
|
|
23
|
+
|
|
24
|
+
const branchStyled = theme.fg("dim", branch);
|
|
25
|
+
const repoStyled = theme.fg("dim", repo);
|
|
26
|
+
const contextStyled = theme.fg("dim", context);
|
|
27
|
+
const modelStyled = theme.fg("dim", modelText);
|
|
28
|
+
|
|
29
|
+
const renderSplitLine = (left: string, right: string): string => {
|
|
30
|
+
const gap = " ".repeat(Math.max(2, width - visibleWidth(left) - visibleWidth(right)));
|
|
31
|
+
return truncateToWidth(left + gap + right, width);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const line1Fits = visibleWidth(branchStyled) + visibleWidth(repoStyled) + 2 <= width;
|
|
35
|
+
const line2Fits = visibleWidth(contextStyled) + visibleWidth(modelStyled) + 2 <= width;
|
|
36
|
+
|
|
37
|
+
if (line1Fits && line2Fits) {
|
|
38
|
+
return [
|
|
39
|
+
renderSplitLine(branchStyled, repoStyled),
|
|
40
|
+
renderSplitLine(contextStyled, modelStyled),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return [
|
|
45
|
+
truncateToWidth(branchStyled, width),
|
|
46
|
+
truncateToWidth(repoStyled, width),
|
|
47
|
+
truncateToWidth(contextStyled, width),
|
|
48
|
+
truncateToWidth(modelStyled, width),
|
|
49
|
+
];
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@diegopetrucci/pi-minimal-footer",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "A minimal custom footer for pi.",
|
|
5
|
+
"keywords": ["pi-package", "pi", "terminal", "footer"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/diegopetrucci/pi-extensions.git",
|
|
10
|
+
"directory": "extensions/minimal-footer"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.ts",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"pi": {
|
|
20
|
+
"extensions": [
|
|
21
|
+
"index.ts"
|
|
22
|
+
],
|
|
23
|
+
"image": "https://raw.githubusercontent.com/diegopetrucci/pi-extensions/main/assets/minimal-footer-preview.png"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
27
|
+
"@mariozechner/pi-tui": "*"
|
|
28
|
+
}
|
|
29
|
+
}
|