@henryqw/pi-footer 5.1.0 → 5.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.
Files changed (2) hide show
  1. package/README.md +54 -86
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@henryqw/pi-footer`
2
2
 
3
- Keep footer identity, model usage, agent-work time, and extension status visible while you work in Pi. Use `/open` to open the current working directory with VS Code or another configured command. You can enable the footer and the open commands independently.
3
+ Keep footer identity, model usage, agent-work time, and extension status visible in Pi. Enable the footer and open commands independently.
4
4
 
5
5
  ![Pi footer showing repository, pull request, quota, usage, model, and extension status](./example.png)
6
6
 
@@ -10,16 +10,7 @@ Keep footer identity, model usage, agent-work time, and extension status visible
10
10
  pi install npm:@henryqw/pi-footer
11
11
  ```
12
12
 
13
- This package replaces `@henryqw/pi-open-in`. If it is installed, remove it before you upgrade. This prevents duplicate `/open` and `/set-open-in` commands:
14
-
15
- ```bash
16
- pi remove npm:@henryqw/pi-open-in
17
- pi install npm:@henryqw/pi-footer
18
- ```
19
-
20
- For project-local installations, use `--local` on both commands. Also remove manually configured paths to the old package. Then restart Pi. The existing open command configuration stays at `config/pi-open-in/config.json`. Do not move it.
21
-
22
- Both entry points load by default. To use `/open` without the custom footer, use Pi's native package resource filter in `settings.json`:
13
+ Both entry points load by default. To select only the open commands, use Pi's resource filter in `settings.json`:
23
14
 
24
15
  ```json
25
16
  {
@@ -32,7 +23,7 @@ Both entry points load by default. To use `/open` without the custom footer, use
32
23
  }
33
24
  ```
34
25
 
35
- To use only the footer, select `extensions/footer.ts` instead. You can also use `pi config` to toggle either resource. You do not need package activation config.
26
+ Select `extensions/footer.ts` for only the footer, or use `pi config` to toggle either resource.
36
27
 
37
28
  ## Works with
38
29
 
@@ -45,77 +36,64 @@ To use only the footer, select `extensions/footer.ts` instead. You can also use
45
36
 
46
37
  ## Use
47
38
 
48
- After installation, start a Pi TUI session. The footer shows footer identity, usage, model, thinking, and extension statuses. Run `/open` to open the current working directory in VS Code by default. `/open` also works while the agent is busy.
39
+ Start a Pi TUI session to see the footer. Run `/open` to open the current directory in VS Code, even while the agent is busy.
49
40
 
50
41
  | Surface | Type | Purpose |
51
42
  | --- | --- | --- |
52
- | Footer | ui | Shows footer identity, usage, model, agent-work time, and extension statuses. |
53
- | `/open` | command | Opens the current working directory with the configured command. |
54
- | `/set-open-in <command>` | command | Sets the command used by `/open`. |
43
+ | Footer | ui | Shows footer identity, usage, model, agent-work time, and extension statuses to the user. |
44
+ | `/open` | command | Opens the current directory for the user with the configured command. |
45
+ | `/set-open-in <command>` | command | Sets the user's open command, such as `cursor --reuse-window`. |
55
46
 
56
- Run `/set-open-in <command>` to choose another command, such as `cursor --reuse-window`. `/open` runs `<command> <current-working-directory>`.
57
-
58
- ```text
59
- pi-harness · clear-field-f8d2 [+2 ~3 ?1 ↑2] · PR #123 · approved Codex #1 · 50% · 7d 1d 1h 22m
60
- ↑ 12.4k · ↓ 2.1k · ↺ 84.3% · ⚡ 87.4 t/s · $ 0.127 · ◔ 36.8% gpt-5.6-luna • high
61
- ✓ CG · ● 🐴 ponytail: ⚡ FULL ◷ 12m 34s
62
- ```
47
+ `/open` runs `<command> <current-working-directory>`.
63
48
 
64
49
  ### Footer lines
65
50
 
66
- The first line shows the repository, branch, and Git state as footer identity, with the `pi-pr` pull request status beside it. The family status shows the non-empty `pi-multi-codex` quota status on the right. Linked-worktree branches omit the generated `worktree/` prefix.
51
+ | Line | Left | Right |
52
+ | --- | --- | --- |
53
+ | First | Repository, branch, Git state, and `pi-pr` pull-request status. Linked-worktree branches omit the generated `worktree/` prefix. | Non-empty `pi-multi-codex` family status. |
54
+ | Second: usage line | Input and output token totals, latest cache-hit rate, response throughput, estimated cost, and context use. | Active model and thinking level. |
55
+ | Third | CodeGraph first, then other extension statuses sorted by key, including Ponytail and `pi-rewind`. | Cumulative agent-work time. |
56
+
57
+ Token and cost totals include reported tool usage and completed `pi-subagent` background workflows. Response throughput measures output tokens per second from first to last streamed content. It excludes request latency, time to first token, and later provider work, including Claude bridge shutdown. Non-streamed or instantaneous responses show `—`. Other unavailable values show `—` without a percent sign.
67
58
 
68
- The usage line is the second line. It shows cumulative input tokens, output tokens, latest cache-hit rate, and tokens per second for the most recent assistant response. The footer measures the rate from the first streamed content of the response to the last. This excludes request latency, time to first token, and provider work after the stream ends. Such work includes the Claude bridge shutdown of Claude Code. A response that arrives without streamed content, or all at once, shows `—`.
59
+ Virtual models show the latest successful physical model and thinking level after an arrow: `auto • high → gpt-5.6-luna • medium`.
69
60
 
70
- The usage line also shows estimated cost and context usage. Totals include reported tool usage and finished `pi-subagent` background workflows. The active model and thinking level align to the right. With a virtual model, an arrow precedes the physical model and thinking level from the latest successful response. For example: `auto • high → gpt-5.6-luna • medium`. This matches Pi's built-in footer.
61
+ Thinking colors are dim grey for `off` and the model name, then green `minimal`, yellow-green `low`, lime `medium`, yellow `high`, orange `xhigh`, and red `max`. Active levels use ANSI-256 colors. `ultra` uses a rainbow only when the runtime supports it; unsupported levels do not appear.
71
62
 
72
- The third line shows CodeGraph's icon and `CG` first. It shows `✓ CG` with an index, or `○ CG` when a Git repository has no index. During setup, it shows a dim spinner and elapsed time, such as `⠋ CG · indexing 8s`. Non-Git directories show no index badge. Other extension statuses follow, such as `⠋ deps · installing 12s`. Dependency preparation statuses disappear when work completes.
63
+ For CodeGraph badges, see [`@henryqw/pi-codegraph`](https://pi.henry.wang/extensions/pi-codegraph).
73
64
 
74
- Persistent CodeGraph failures keep their theme-colored `!` icon and meaningful text. During direct `codegraph_explore` calls, `● CG` temporarily replaces the CodeGraph status. The status returns when the call finishes. A middle dot separates statuses. Cumulative agent-work time stays on the right, below the active model.
65
+ Other dependency statuses, such as `⠋ deps · installing 12s`, disappear after completion. Middle dots separate statuses. The footer preserves colors, links, glyphs, and interior spacing, trims outer whitespace, replaces line breaks with spaces, and shortens long statuses.
75
66
 
76
67
  ### Git state
77
68
 
78
- Git badges appear only when action is needed:
69
+ Badges appear only when action is necessary:
79
70
 
80
71
  | Badge | Meaning |
81
72
  | --- | --- |
82
73
  | `+2` | Two staged paths |
83
74
  | `~3` | Three unstaged tracked paths |
84
- | `?N` | `N` untracked porcelain status entries |
75
+ | `?N` | `N` untracked porcelain status entries; Git can collapse an untracked directory into one entry. |
85
76
  | `!1` | One unresolved path |
86
- | `↑2` | Two commits ahead of the upstream branch |
87
- | `↓1` | One commit behind the upstream branch |
88
-
89
- `?N` counts porcelain status entries. In `--untracked-files=normal` mode, Git can collapse a whole untracked directory to one entry.
90
-
91
- Active operations appear first, such as `REBASE 3/7`, `MERGING`, or `CHERRY-PICKING`. Detached HEAD uses the short commit form `@a1b2c3d`.
92
-
93
- The extension reads local Git data with `git status --porcelain=v2 --branch --untracked-files=normal`. It refreshes after each agent run and branch change. It does not make an LLM call or fetch a remote. Ahead and behind counts use the last fetched upstream state.
77
+ | `↑2` | Two commits ahead of upstream |
78
+ | `↓1` | One commit behind upstream |
94
79
 
95
- Unavailable values render as `—` without a misleading percent sign.
80
+ Active operations appear first: `REBASE 3/7`, `MERGING`, or `CHERRY-PICKING`. Detached HEAD shows a short commit, such as `@a1b2c3d`.
96
81
 
97
- `off` uses the same dim grey as the model name. Active levels use an ANSI-256 gradient: green `minimal`, yellow-green `low`, lime `medium`, yellow `high`, orange `xhigh`, and red `max`.
98
-
99
- `ultra` renders as a rainbow when the active Pi runtime supplies that thinking level. Unsupported levels never appear.
100
-
101
- Only the non-empty `pi-multi-codex` quota status occupies the right side of the first line. The `pi-pr` pull-request status stays beside footer identity. CodeGraph index status, setup progress, or tool activity appears separately on the third line.
102
-
103
- Statuses from other extensions, including Ponytail and `pi-rewind`, share the left side of the third line. The footer sorts these statuses by key. It preserves colors, links, glyphs, and interior spacing. It removes leading and trailing whitespace and changes line breaks to spaces. It can shorten long statuses to fit the footer.
104
-
105
- Only direct `codegraph_explore` tool calls trigger the `● CG` badge. The footer does not show CodeGraph queries from inside scripted tools.
82
+ Local Git data comes from `git status --porcelain=v2 --branch --untracked-files=normal` and refreshes after agent runs and branch changes. No model call or remote fetch occurs. Ahead and behind counts use the last fetched upstream state.
106
83
 
107
84
  ## Config
108
85
 
109
- Package-owned: `~/.pi/agent/config/pi-footer/config.json` for footer color configuration and `~/.pi/agent/config/pi-open-in/config.json` for open command configuration. Both paths are under `getAgentDir()` when you override it. The retained `pi-open-in` home belongs to the open commands now supplied with this package.
86
+ Package-owned paths under `getAgentDir()` (normally `~/.pi/agent`):
87
+
88
+ - `~/.pi/agent/config/pi-footer/config.json`: footer colors.
89
+ - `~/.pi/agent/config/pi-open-in/config.json`: open command.
110
90
 
111
91
  | Name | Description | Values | Default |
112
92
  | --- | --- | --- | --- |
113
- | `colors` | Colors for footer-owned text by role. | Object that maps color roles to theme tokens, `#RGB`, `#RRGGBB`, `oklch(...)`, `okhsl(...)`, or an ANSI index from `0` to `255`. | Built-in colors. |
114
- | `command` | Command that `/open` runs. | Non-empty string. | `"code"` |
115
-
116
- The footer reads `colors` once at session start. Run `/reload` after you edit it. The footer never rewrites the file. A missing file or a missing role keeps the built-in color.
93
+ | `colors` | Footer-owned colors by role. | Object mapping roles to theme tokens, `#RGB`, `#RRGGBB`, `oklch(...)`, `okhsl(...)`, or ANSI indices `0` to `255`. | Built-in colors. |
94
+ | `command` | Command for `/open`. | Non-empty string. | `"code"` |
117
95
 
118
- At each session start, the footer warns about unknown keys, unknown roles, and invalid colors. The warning gives the path and the reason. Only the invalid role uses its built-in color. The other roles keep their configured colors. A malformed file uses the built-in colors for all roles.
96
+ Colors load at session start; run `/reload` after edits. Missing files or roles keep built-in colors. Unknown keys, unknown roles, and invalid colors produce warnings with the path and reason. Invalid roles use built-in colors independently; malformed files use all built-in colors. The footer never rewrites the file.
119
97
 
120
98
  ### Footer color roles
121
99
 
@@ -123,14 +101,16 @@ Every role is optional:
123
101
 
124
102
  | Role | Surface |
125
103
  | --- | --- |
126
- | `repository` | Repository name on the first line. |
127
- | `branch` | Branch or checkout name, still hyperlink-wrapped when the terminal supports it. |
128
- | `gitStatus` | Git badges such as `[+2 ~3 ↑1]`. |
129
- | `input`, `output`, `cache`, `throughput`, `cost`, `context` | The six usage metrics on the second line. |
130
- | `model` | Active model and routed physical model. |
131
- | `runtime` | Cumulative agent-work time on the third line. |
132
- | `codegraphActive` | The `● CG` badge during a direct `codegraph_explore` call. |
133
- | `separator` | Middle dots, bullets, arrows, and the truncation ellipsis. |
104
+ | `repository` | Repository name. |
105
+ | `branch` | Branch name, with a hyperlink where supported. |
106
+ | `gitStatus` | Git badges. |
107
+ | `input`, `output`, `cache`, `throughput`, `cost`, `context` | The six usage metrics. |
108
+ | `model` | Active and physical models. |
109
+ | `runtime` | Agent-work time. |
110
+ | `codegraphActive` | Direct-call `● CG` badge. |
111
+ | `separator` | Middle dots, bullets, arrows, and truncation ellipsis. |
112
+
113
+ Theme tokens: `accent`, `dim`, `muted`, `text`, `success`, `warning`, `error`, and `thinkingText`. Colors do not change the thinking gradient or other extensions' status colors.
134
114
 
135
115
  ```json
136
116
  {
@@ -152,17 +132,9 @@ Every role is optional:
152
132
  }
153
133
  ```
154
134
 
155
- Theme tokens are `accent`, `dim`, `muted`, `text`, `success`, `warning`, `error`, and `thinkingText`. Thinking levels keep their built-in gradient. Statuses from other extensions keep the colors from those extensions. The `colors` object controls neither.
156
-
157
- ### Open command
158
-
159
- A missing file silently uses the default command, `code`. An invalid existing file shows a warning and uses `code`. The file stays unchanged. See Limits and recovery.
160
-
161
- `/open` reads the config on every run. Only `/set-open-in` writes the file, atomically. Reads do not create or write the config home.
162
-
163
135
  ## API
164
136
 
165
- Consumers: use the owner API. Do not read the config file directly. Replace imports from `@henryqw/pi-open-in/open-uri` with `@henryqw/pi-footer/open-uri`:
137
+ Consumers must use the owner API, not read config directly:
166
138
 
167
139
  ```ts
168
140
  import { loadOpenInConfig } from "@henryqw/pi-footer/open-uri";
@@ -171,29 +143,25 @@ const loaded = loadOpenInConfig();
171
143
  if (loaded.status === "ok") console.log(loaded.value.command, loaded.issues);
172
144
  ```
173
145
 
174
- These exports are for package consumers. The commands in Use are the Pi interfaces.
175
-
176
146
  | Surface | Type | Purpose |
177
147
  | --- | --- | --- |
178
- | `default` (`openInExtension(pi)`) | function | Registers the open commands with Pi, without the footer. |
179
- | `OpenInConfig` | type | Describes the configured command. |
180
- | `loadOpenInConfig(agentDir?)` | function | Reads and validates the owner config. |
181
- | `configuredOpenUri(path)` | function | Returns a safe VS Code URI for a supported command. |
182
-
183
- `loadOpenInConfig` returns a `@henryqw/pi-config-store` `ConfigLoad` result: `status`, `source` (`"missing"` or `"file"`), `issues`, and, when `status` is `"ok"`, `value`. The function validates `value.command`. An invalid `command` gives `"code"` and an issue. The function does not show issues. Pass an agent directory when needed.
148
+ | `default` (`openInExtension(pi)`) | function | Registers open commands without the footer. |
149
+ | `OpenInConfig` | type | Describes the command. |
150
+ | `loadOpenInConfig(agentDir?)` | function | Reads and validates owner config; accepts an optional agent directory. |
151
+ | `configuredOpenUri(path)` | function | Returns a safe VS Code URI for `code`, or `undefined` for other commands. |
184
152
 
185
- `configuredOpenUri(path)` works when the executable is `code`. With `code -n` or `code --new-window`, it adds `windowId=_blank` so the link opens in a new window. It returns `undefined` for other commands. An invalid config uses `code`. The function never shows a notification, because the footer calls it on each render. `@henryqw/pi-config-store` owns the config home and storage.
153
+ `loadOpenInConfig` returns a `@henryqw/pi-config-store` `ConfigLoad`: `status`, `source` (`"missing"` or `"file"`), `issues`, and `value` when `status` is `"ok"`. Invalid `value.command` gives `"code"` and an issue. Neither function shows notifications. `configuredOpenUri(path)` uses `code` for invalid config; `code -n` and `code --new-window` add `windowId=_blank`.
186
154
 
187
155
  ## Limits and recovery
188
156
 
189
- The open command splits on whitespace into an executable and arguments. Tokens cannot contain spaces, and quoting is unsupported. Use a wrapper script for executables in paths that contain spaces.
157
+ Open commands split on whitespace. Quoting and tokens with spaces are unsupported; use a wrapper script for executable paths with spaces.
190
158
 
191
- An existing config file must be a JSON object with one non-empty string `command` property. An unknown key, an invalid `command`, or a malformed file shows a warning at session start, or at the next `/open`. The warning also shows when only the footer is active, because the footer link uses this config. Each issue shows one time in each session, even when the footer and `/open` are both active. The footer never shows a warning while it renders.
159
+ `/open` reads config on each run. Missing config silently uses `code`. Only `/set-open-in` writes the file, atomically.
192
160
 
193
- For these config problems, `/open` and the footer link use `code`, and the file stays unchanged. Fix the file or run `/set-open-in <command>` to replace it. `/set-open-in` first shows each new problem in the file that it replaces. If the configured command exits with an error, Pi reports its error output or exit code. Fix the command. Then run `/open` again.
161
+ Open config must be a JSON object with one non-empty string `command`. Unknown keys, invalid commands, or malformed files produce warnings at session start or the next `/open`, including footer-only installations. Each issue shows once per session, never during rendering. Invalid commands and malformed files use `code` without changing the file.
194
162
 
195
- When the configured executable is `code` and Pi reports hyperlink support, the accent-colored checkout name links to the current path. The link opens a new window for `code -n` or `code --new-window`. A missing config silently uses `code`. Other executables and terminals with hyperlinks disabled render plain text.
163
+ Fix config or run `/set-open-in <command>` to replace it; the command reports new issues before replacement. If the command fails, Pi reports its error output or exit code. Fix the command and retry `/open`.
196
164
 
197
- Pi handles the custom URI in its default fullscreen TUI. Use normal primary click. Regular TUI (`"tuiMode": "regular"` or `--tui-mode regular`) uses the terminal to activate OSC 8 links. The link works only where the terminal opens custom URI schemes.
165
+ With `code` and Pi hyperlink support, the accent-colored branch name links to the current path. `code -n` and `code --new-window` open a new window. Other executables or disabled hyperlinks give plain text.
198
166
 
199
- Ghostty uses `Cmd+click`, but it possibly does not open custom URI schemes.
167
+ Use primary click in Pi's default fullscreen TUI. Regular TUI (`"tuiMode": "regular"` or `--tui-mode regular`) needs terminal support for OSC 8 links and custom URI schemes. Ghostty uses `Cmd+click`, but might not open custom URI schemes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-footer",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Show repository and usage details in the Pi footer and open the current working directory.",
5
5
  "keywords": [
6
6
  "pi-package",