useful-pi-extensions 0.1.0 → 1.0.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 +35 -18
- package/README_CN.md +33 -17
- package/package.json +8 -9
- package/packages/statusline/LICENSE +21 -0
- package/{extensions → packages}/statusline/README.md +5 -1
- package/{extensions → packages}/statusline/README_CN.md +5 -1
- /package/{extensions → packages/statusline/extensions}/statusline/index.ts +0 -0
- /package/{extensions → packages/statusline/extensions}/statusline/render.ts +0 -0
package/README.md
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README_CN.md)
|
|
4
4
|
|
|
5
|
-
A small collection of [pi](https://pi.dev) extensions, installed with one command.
|
|
5
|
+
A small collection of [pi](https://pi.dev) extensions, installed with one command. Every extension
|
|
6
|
+
in it is also published on its own, so you can take the collection or just the piece you want.
|
|
6
7
|
|
|
7
8
|
```sh
|
|
8
|
-
pi install
|
|
9
|
+
pi install npm:useful-pi-extensions
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
## What is in here
|
|
12
13
|
|
|
13
|
-
| Extension
|
|
14
|
-
|
|
|
15
|
-
| [
|
|
14
|
+
| Extension | What it does |
|
|
15
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| [`@reedchan/statusline`](packages/statusline/README.md) | Replaces pi's footer with a labelled two-row one: context pressure as a fixed-size meter, cache and cost, the model and effort level, and the latest turn's TTFT and decode throughput in tokens/second |
|
|
16
17
|
|
|
17
18
|
Only one extension owns the footer, so `statusline` is a complete replacement rather than an
|
|
18
19
|
addition. If you want pi's stock footer back, remove this package and `/reload`.
|
|
@@ -26,11 +27,14 @@ addition. If you want pi's stock footer back, remove this package and `/reload`.
|
|
|
26
27
|
## Install
|
|
27
28
|
|
|
28
29
|
```sh
|
|
29
|
-
#
|
|
30
|
-
pi install
|
|
30
|
+
# the collection: every extension in this repository
|
|
31
|
+
pi install npm:useful-pi-extensions
|
|
31
32
|
|
|
32
|
-
#
|
|
33
|
-
pi install
|
|
33
|
+
# one extension on its own
|
|
34
|
+
pi install npm:@reedchan/statusline
|
|
35
|
+
|
|
36
|
+
# from the repository, pinned to a tag
|
|
37
|
+
pi install git:github.com/reedchan7/useful-pi-extensions@v1.0.0
|
|
34
38
|
|
|
35
39
|
# from a local checkout (development)
|
|
36
40
|
pi install /absolute/path/to/useful-pi-extensions
|
|
@@ -38,6 +42,10 @@ pi install /absolute/path/to/useful-pi-extensions
|
|
|
38
42
|
|
|
39
43
|
Then reload pi in the running session with `/reload`, or start a new one.
|
|
40
44
|
|
|
45
|
+
> **Install one surface, not both.** The collection and the individual package ship the same
|
|
46
|
+
> extension file, so installing `useful-pi-extensions` _and_ `@reedchan/statusline` loads it twice.
|
|
47
|
+
> Nothing breaks, but there is nothing to gain either.
|
|
48
|
+
|
|
41
49
|
> **Removing a loose copy first.** If you were running the extension as a single file in
|
|
42
50
|
> `~/.pi/agent/extensions/`, delete that file before installing this package. Both would load, and
|
|
43
51
|
> two footers race for the same slot — the later one wins, which decides nothing useful.
|
|
@@ -50,17 +58,26 @@ Then reload pi in the running session with `/reload`, or start a new one.
|
|
|
50
58
|
|
|
51
59
|
## Layout
|
|
52
60
|
|
|
61
|
+
Two things are published from this repository: the collection, which is the repository root, and
|
|
62
|
+
each extension under `packages/`, on its own.
|
|
63
|
+
|
|
53
64
|
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
package.json # the collection package, published as useful-pi-extensions
|
|
66
|
+
packages/
|
|
67
|
+
statusline/ # published as @reedchan/statusline
|
|
68
|
+
package.json
|
|
69
|
+
extensions/statusline/
|
|
70
|
+
index.ts # pi entry point: events and footer wiring
|
|
71
|
+
render.ts # pure helpers: number formatting, the meter, row layout
|
|
72
|
+
render.test.ts # unit tests for render.ts
|
|
73
|
+
tools/ # repository tooling: docs pairing, commit lint, publishing
|
|
59
74
|
```
|
|
60
75
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
The collection declares `"pi": { "extensions": ["packages/*/extensions"] }` and the individual
|
|
77
|
+
package declares `"./extensions"`. pi resolves the glob, finds every `extensions/<name>/index.ts`
|
|
78
|
+
and loads it — no build step, no bundling. Adding an extension is therefore adding a directory under
|
|
79
|
+
`packages/`: no manifest needs editing, because the collection's glob picks the new package up on
|
|
80
|
+
its own, and `make publish` discovers it the same way.
|
|
64
81
|
|
|
65
82
|
## Development
|
|
66
83
|
|
|
@@ -79,7 +96,7 @@ make help # list every target
|
|
|
79
96
|
| Lint | `bun run lint` | oxlint in type-aware mode with `--deny-warnings`, so a warning fails the run |
|
|
80
97
|
| Types | `bun run typecheck` | `--strict` plus `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes` and `verbatimModuleSyntax`, which is what keeps every file loadable by pi without a transform |
|
|
81
98
|
| Docs | `bun run docs:check` | every `README.md` has a `README_CN.md` with the same heading sequence and a working language switcher |
|
|
82
|
-
| Tests | `bun test` | the unit tests under `
|
|
99
|
+
| Tests | `bun test` | the unit tests under `packages/*/` |
|
|
83
100
|
|
|
84
101
|
Commits follow [Conventional Commits](https://www.conventionalcommits.org/): the `commit-msg` hook
|
|
85
102
|
rejects a subject that is not `type(scope): summary`, and the pre-commit hook formats and lints only
|
package/README_CN.md
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
一组 [pi](https://pi.dev)
|
|
5
|
+
一组 [pi](https://pi.dev) 扩展,一行命令即可安装。其中的每个扩展也会单独发布,
|
|
6
|
+
所以你要么整套装,要么只取其中一件。
|
|
6
7
|
|
|
7
8
|
```sh
|
|
8
|
-
pi install
|
|
9
|
+
pi install npm:useful-pi-extensions
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
## 包含什么
|
|
12
13
|
|
|
13
|
-
| 扩展
|
|
14
|
-
|
|
|
15
|
-
| [
|
|
14
|
+
| 扩展 | 作用 |
|
|
15
|
+
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| [`@reedchan/statusline`](packages/statusline/README_CN.md) | 替换 pi 的 footer,改成带文字标签的两行:上下文压力用固定宽度仪表显示,外加缓存与花费、模型与思考等级,以及最近一轮的 TTFT 和解码速度(tok/s) |
|
|
16
17
|
|
|
17
18
|
footer 只能有一个扩展占用,所以 `statusline` 是**替换**而不是叠加。想回到 pi 原生 footer,移除本包再 `/reload`。
|
|
18
19
|
|
|
@@ -25,11 +26,14 @@ footer 只能有一个扩展占用,所以 `statusline` 是**替换**而不是
|
|
|
25
26
|
## 安装
|
|
26
27
|
|
|
27
28
|
```sh
|
|
28
|
-
#
|
|
29
|
-
pi install
|
|
29
|
+
# 合集:本仓库的全部扩展
|
|
30
|
+
pi install npm:useful-pi-extensions
|
|
30
31
|
|
|
31
|
-
#
|
|
32
|
-
pi install
|
|
32
|
+
# 只要其中一个扩展
|
|
33
|
+
pi install npm:@reedchan/statusline
|
|
34
|
+
|
|
35
|
+
# 从仓库安装并锁定标签
|
|
36
|
+
pi install git:github.com/reedchan7/useful-pi-extensions@v1.0.0
|
|
33
37
|
|
|
34
38
|
# 从本地检出安装(开发用)
|
|
35
39
|
pi install /absolute/path/to/useful-pi-extensions
|
|
@@ -37,6 +41,10 @@ pi install /absolute/path/to/useful-pi-extensions
|
|
|
37
41
|
|
|
38
42
|
然后在运行中的会话里执行 `/reload`,或直接新开一个会话。
|
|
39
43
|
|
|
44
|
+
> **只装一个入口,不要两个都装。** 合集与单独包包含的是同一个扩展文件,
|
|
45
|
+
> 同时安装 `useful-pi-extensions` 与 `@reedchan/statusline` 会让它被加载两次。
|
|
46
|
+
> 这不会出错,但也没有任何好处。
|
|
47
|
+
|
|
40
48
|
> **先删掉散装的那份。** 如果你之前把扩展作为单文件放在 `~/.pi/agent/extensions/`,
|
|
41
49
|
> 安装本包之前请先删掉那个文件。两份会同时加载,两个 footer 抢同一个位置——
|
|
42
50
|
> 后加载的赢,而谁后加载没有意义。
|
|
@@ -49,16 +57,24 @@ pi install /absolute/path/to/useful-pi-extensions
|
|
|
49
57
|
|
|
50
58
|
## 目录结构
|
|
51
59
|
|
|
60
|
+
本仓库发布两样东西:合集,即仓库根目录;以及 `packages/` 下每个扩展各自成包。
|
|
61
|
+
|
|
52
62
|
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
package.json # 合集包,发布为 useful-pi-extensions
|
|
64
|
+
packages/
|
|
65
|
+
statusline/ # 发布为 @reedchan/statusline
|
|
66
|
+
package.json
|
|
67
|
+
extensions/statusline/
|
|
68
|
+
index.ts # pi 入口:事件与 footer 接线
|
|
69
|
+
render.ts # 纯函数:数字格式化、仪表、行布局
|
|
70
|
+
render.test.ts # render.ts 的单元测试
|
|
71
|
+
tools/ # 仓库工具:文档配对、提交信息校验、发布
|
|
58
72
|
```
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
pi
|
|
74
|
+
合集声明 `"pi": { "extensions": ["packages/*/extensions"] }`,单独包声明 `"./extensions"`。
|
|
75
|
+
pi 解析该 glob,找到每个 `extensions/<name>/index.ts` 并加载——无构建、无打包。
|
|
76
|
+
因此新增一个扩展就是新增一个 `packages/` 下的目录:**两个清单都不用改**,
|
|
77
|
+
合集的 glob 会自动发现新包,`make publish` 也用同一套发现逻辑。
|
|
62
78
|
|
|
63
79
|
## 开发
|
|
64
80
|
|
|
@@ -77,7 +93,7 @@ make help # 列出所有目标
|
|
|
77
93
|
| Lint | `bun run lint` | oxlint 类型感知模式 + `--deny-warnings`,即 **warning 也判失败** |
|
|
78
94
|
| 类型 | `bun run typecheck` | `--strict` 以及 `noUncheckedIndexedAccess`、`exactOptionalPropertyTypes`、`verbatimModuleSyntax`,这正是保证每个文件无需转译就能被 pi 直接加载的原因 |
|
|
79
95
|
| 文档 | `bun run docs:check` | 每个 `README.md` 都有 `README_CN.md`,标题层级序列一致且语言切换链接可用 |
|
|
80
|
-
| 单测 | `bun test` | `
|
|
96
|
+
| 单测 | `bun test` | `packages/*/` 下的单元测试 |
|
|
81
97
|
|
|
82
98
|
提交遵循 [Conventional Commits](https://www.conventionalcommits.org/):`commit-msg` 钩子会拒绝不符合
|
|
83
99
|
`type(scope): summary` 的标题,pre-commit 钩子只对暂存文件做格式化与 lint。工具链在 `package.json`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "useful-pi-extensions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A small collection of pi extensions, installed with one command — a labelled status line with context pressure, cache, cost, effort, TTFT and tokens/sec.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "git+https://github.com/reedchan7/useful-pi-extensions.git"
|
|
25
25
|
},
|
|
26
|
+
"workspaces": [
|
|
27
|
+
"packages/*"
|
|
28
|
+
],
|
|
26
29
|
"files": [
|
|
27
|
-
"extensions",
|
|
28
|
-
"!extensions/**/*.test.ts",
|
|
30
|
+
"packages/*/extensions/**",
|
|
31
|
+
"!packages/*/extensions/**/*.test.ts",
|
|
29
32
|
"README.md",
|
|
30
33
|
"README_CN.md",
|
|
31
34
|
"LICENSE"
|
|
@@ -38,7 +41,7 @@
|
|
|
38
41
|
"fmt:check": "oxfmt --check .",
|
|
39
42
|
"lint": "oxlint --deny-warnings .",
|
|
40
43
|
"lint:fix": "oxlint --fix .",
|
|
41
|
-
"
|
|
44
|
+
"publish:changed": "bun tools/publish-changed/src/index.ts",
|
|
42
45
|
"test": "bun test",
|
|
43
46
|
"test:changed": "git rev-parse --verify --quiet origin/main >/dev/null && bun test --changed=origin/main || bun test",
|
|
44
47
|
"typecheck": "tsc -p tsconfig.json"
|
|
@@ -53,16 +56,12 @@
|
|
|
53
56
|
"oxlint-tsgolint": "7.0.2002",
|
|
54
57
|
"typescript": "7.0.2"
|
|
55
58
|
},
|
|
56
|
-
"peerDependencies": {
|
|
57
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
58
|
-
"@earendil-works/pi-tui": "*"
|
|
59
|
-
},
|
|
60
59
|
"engines": {
|
|
61
60
|
"bun": ">=1.4.0"
|
|
62
61
|
},
|
|
63
62
|
"pi": {
|
|
64
63
|
"extensions": [
|
|
65
|
-
"
|
|
64
|
+
"packages/*/extensions"
|
|
66
65
|
],
|
|
67
66
|
"image": "https://github.com/user-attachments/assets/7ae64213-cb05-4440-835e-a633796a87f9"
|
|
68
67
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 reedchan7
|
|
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.
|
|
@@ -81,7 +81,11 @@ So the rate excludes prefill and time-to-first-token, which is the industry-stan
|
|
|
81
81
|
## Install
|
|
82
82
|
|
|
83
83
|
```sh
|
|
84
|
-
|
|
84
|
+
# on its own
|
|
85
|
+
pi install npm:@reedchan/statusline
|
|
86
|
+
|
|
87
|
+
# or as part of the collection, which installs every extension in the repository
|
|
88
|
+
pi install npm:useful-pi-extensions
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
Then `/reload`.
|
|
@@ -71,7 +71,11 @@ tok/s = usage.output / (decodeMs / 1000)
|
|
|
71
71
|
## 安装
|
|
72
72
|
|
|
73
73
|
```sh
|
|
74
|
-
|
|
74
|
+
# 单独安装
|
|
75
|
+
pi install npm:@reedchan/statusline
|
|
76
|
+
|
|
77
|
+
# 或作为合集的一部分安装,会装上本仓库的全部扩展
|
|
78
|
+
pi install npm:useful-pi-extensions
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
然后 `/reload`。
|
|
File without changes
|
|
File without changes
|