@diegopetrucci/pi-extensions 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/LICENSE +21 -0
- package/README.md +81 -0
- package/assets/minimal-footer-preview.png +0 -0
- package/assets/social-preview.png +0 -0
- package/extensions/minimal-footer/README.md +74 -0
- package/extensions/minimal-footer/index.ts +54 -0
- package/extensions/minimal-footer/package.json +29 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diego Petrucci
|
|
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,81 @@
|
|
|
1
|
+
# pi-extensions
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A collection of [pi](https://github.com/badlogic/pi-mono) agent extensions I made.
|
|
6
|
+
|
|
7
|
+
## Included extensions
|
|
8
|
+
|
|
9
|
+
| Extension | Description |
|
|
10
|
+
|---|---|
|
|
11
|
+
| [`minimal-footer`](./extensions/minimal-footer) | Replaces pi's built-in footer with a minimal two-line layout: branch/repo on the first line, context/model on the second. |
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
### GitHub
|
|
16
|
+
|
|
17
|
+
Install the repo as a pi package:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pi install git:github.com/diegopetrucci/pi-extensions
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or pin to a tagged version:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi install git:github.com/diegopetrucci/pi-extensions@v0.1.2
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### npm
|
|
30
|
+
|
|
31
|
+
Install the full collection from npm:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pi install npm:@diegopetrucci/pi-extensions
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then reload pi:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
/reload
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Install only one extension
|
|
44
|
+
|
|
45
|
+
If you only want one extension, you have two options.
|
|
46
|
+
|
|
47
|
+
### Option 1: install the standalone npm package
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pi install npm:@diegopetrucci/pi-minimal-footer
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Option 2: filter the repo package
|
|
54
|
+
|
|
55
|
+
If you prefer the collection package, you can filter it in your pi settings:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"packages": [
|
|
60
|
+
{
|
|
61
|
+
"source": "npm:@diegopetrucci/pi-extensions",
|
|
62
|
+
"extensions": ["extensions/minimal-footer/index.ts"]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## npm publishing
|
|
69
|
+
|
|
70
|
+
The repo is set up to support both:
|
|
71
|
+
|
|
72
|
+
- the collection package: `@diegopetrucci/pi-extensions`
|
|
73
|
+
- standalone extension packages like `@diegopetrucci/pi-minimal-footer`
|
|
74
|
+
|
|
75
|
+
## Repository structure
|
|
76
|
+
|
|
77
|
+
Each extension lives in its own subdirectory under [`extensions/`](./extensions). This keeps the repo easy to grow while still letting each extension carry its own package metadata and documentation.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
[MIT](./LICENSE)
|
|
Binary file
|
|
Binary file
|
|
@@ -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.
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@diegopetrucci/pi-extensions",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "A collection of pi extensions, starting with a minimal custom footer.",
|
|
5
|
+
"keywords": ["pi-package", "pi", "terminal", "agent"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/diegopetrucci/pi-extensions.git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"extensions",
|
|
13
|
+
"assets",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"workspaces": [
|
|
18
|
+
"extensions/*"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
25
|
+
"@mariozechner/pi-tui": "*"
|
|
26
|
+
},
|
|
27
|
+
"pi": {
|
|
28
|
+
"extensions": [
|
|
29
|
+
"./extensions/minimal-footer/index.ts"
|
|
30
|
+
],
|
|
31
|
+
"image": "https://raw.githubusercontent.com/diegopetrucci/pi-extensions/main/assets/minimal-footer-preview.png"
|
|
32
|
+
}
|
|
33
|
+
}
|