@narumitw/pi-statusline 0.49.10 → 0.49.12

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 CHANGED
@@ -1,9 +1,8 @@
1
- # ✨ pi-statusline — A Beautiful, Practical Footer for Pi
1
+ # ✨ pi-statusline — Add a Ready-to-Use Powerline Footer to Pi
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@narumitw/pi-statusline)](https://www.npmjs.com/package/@narumitw/pi-statusline) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
4
 
5
- `@narumitw/pi-statusline` gives [Pi](https://pi.dev) an opinionated powerline footer that looks good
6
- without setup and keeps useful context visible as the terminal narrows.
5
+ Add an opinionated Powerline-style footer that works without setup and keeps the most useful Pi, workspace, Git, usage, and time context visible as the terminal narrows.
7
6
 
8
7
  A representative uncolored layout:
9
8
 
@@ -13,19 +12,19 @@ A representative uncolored layout:
13
12
 
14
13
  ## ✨ Features
15
14
 
16
- - **Zero-config default:** model, thinking, workspace, Git/PR state, context use, and local time.
17
- - **Responsive:** removes lower-priority segments before important information gets clipped.
18
- - **Quiet when idle:** activity appears only while Pi is streaming or running tools.
19
- - **Native-aligned usage:** optional token, prompt-cache, subscription, and cost details.
20
- - **Easy choices:** three information levels and seven previewable color presets.
21
- - **Still flexible:** custom layouts, multiline rows, colors, labels, separators, and status icons stay
22
- available under **Advanced**.
23
-
24
- > **Need more customization?** See
25
- > [`pi-starship`](https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship)
26
- > ([npm](https://www.npmjs.com/package/@narumitw/pi-starship)). It uses a
27
- > [Starship-inspired](https://starship.rs/) TOML format and style syntax for deeper control over
28
- > layout, modules, and colors. Choose `pi-statusline` for practical defaults and quick setup.
15
+ - Works immediately with a balanced default for model, thinking, workspace, Git, context, activity, and time.
16
+ - Removes lower-priority segments before important information is clipped.
17
+ - Shows activity only while Pi is streaming or running tools.
18
+ - Adds optional token, prompt-cache, provider usage, and cost details.
19
+ - Offers three information levels, seven previewable palettes, and advanced custom layouts.
20
+ - Loads a generated split runtime to reduce Pi package startup work.
21
+
22
+ > **Need more customization?**
23
+ > See
24
+ > [`pi-starship`](https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship) ([npm](https://www.npmjs.com/package/@narumitw/pi-starship)).
25
+ > It uses a
26
+ > [Starship-inspired](https://starship.rs/) TOML format and style syntax for deeper control over layout, modules, and colors.
27
+ > Choose `pi-statusline` for practical defaults and quick setup.
29
28
  >
30
29
  > Do not enable both extensions at the same time because both own Pi's footer.
31
30
 
@@ -35,21 +34,29 @@ A representative uncolored layout:
35
34
  pi install npm:@narumitw/pi-statusline
36
35
  ```
37
36
 
38
- Try the published package without installing, or load it directly from this repository:
37
+ Try the published package without installing it permanently:
39
38
 
40
39
  ```bash
41
40
  pi -e npm:@narumitw/pi-statusline
42
- just try statusline
43
41
  ```
44
42
 
43
+ Build the generated runtime and try the local package from this repository:
44
+
45
+ ```bash
46
+ npm --workspace @narumitw/pi-statusline run build
47
+ pi -e ./packages/pi-statusline
48
+ ```
49
+
50
+ The package declares `dist/index.ts`, so an unbuilt local checkout must run the build before Pi loads the package directory.
51
+
45
52
  For the best result, use a terminal font that includes Powerline glyphs and emoji.
46
53
 
47
54
  ## 🚀 Quick start
48
55
 
49
- 1. Install the extension and start Pi.
50
- 2. Run `/statusline`.
51
- 3. Use the standard Main/Advanced navigation, then choose an appearance or information level;
52
- appearance previews update the extension-owned footer before you apply a choice.
56
+ Install the extension and start Pi to use the balanced default immediately.
57
+ Run `/statusline` to preview and apply an appearance or information level.
58
+
59
+ ## 🎛️ Menu and information levels
53
60
 
54
61
  ```text
55
62
  Appearance (tokyo-night)
@@ -69,8 +76,8 @@ Help
69
76
 
70
77
  ### Information levels
71
78
 
72
- Selecting a level replaces only the `segments` array. Unknown and unrelated JSON fields are
73
- preserved.
79
+ Selecting a level replaces only the `segments` array.
80
+ Unknown and unrelated JSON fields are preserved.
74
81
 
75
82
  | Level | Included segments |
76
83
  | --- | --- |
@@ -79,8 +86,8 @@ preserved.
79
86
  | **Detailed** | `provider model thinking cwd branch tools context tokens cache cost time` |
80
87
  | **Custom** | Any other segment order, including explicit line breaks |
81
88
 
82
- The `tools` segment takes no space while idle. `cache` takes no space when Pi has reported no cache
83
- reads or writes.
89
+ The `tools` segment takes no space while idle.
90
+ `cache` takes no space when Pi has reported no cache reads or writes.
84
91
 
85
92
  ## 💬 Commands
86
93
 
@@ -91,34 +98,33 @@ reads or writes.
91
98
  | `/statusline status` | Show the effective settings and diagnostics |
92
99
  | `/statusline help` | Show command and schema guidance |
93
100
 
94
- The direct `settings`, `status`, and `help` routes remain for compatibility. The root standard menu
95
- is TUI-only; Escape returns from Advanced or closes Main. RPC receives observable notifications
96
- instead of TUI-only controls. Unknown subcommands and trailing arguments are rejected. The standard
97
- palette picker owns navigation and cleanup while pi-statusline still owns footer previews, settings,
98
- and rollback. The width-aware layout editor and JSON editor remain specialized UI.
101
+ The direct `settings`, `status`, and `help` routes remain for compatibility.
102
+ The root standard menu is TUI-only; Escape returns from Advanced or closes Main.
103
+ RPC receives observable notifications instead of TUI-only controls.
104
+ Unknown subcommands and trailing arguments are rejected.
105
+ The standard palette picker owns navigation and cleanup while pi-statusline still owns footer previews, settings, and rollback.
106
+ The width-aware layout editor and JSON editor remain specialized UI.
99
107
 
100
108
  ## 📐 Runtime behavior
101
109
 
102
110
  ### Responsive fitting
103
111
 
104
- Each row keeps its configured segment order. If it is too wide, pi-statusline removes the
105
- lowest-priority segment, recomputes the powerline transitions, and repeats until the row fits.
112
+ Each row keeps its configured segment order.
113
+ If it is too wide, pi-statusline removes the lowest-priority segment, recomputes the powerline transitions, and repeats until the row fits.
106
114
  Retention priority is highest to lowest:
107
115
 
108
116
  ```text
109
117
  context model branch tools cwd thinking cost provider cache tokens time turn brand
110
118
  ```
111
119
 
112
- Explicit `line_break` entries remain row boundaries. If the last remaining segment is itself wider
113
- than the row, that row renders empty rather than emitting an over-width line.
120
+ Explicit `line_break` entries remain row boundaries.
121
+ If the last remaining segment is itself wider than the row, that row renders empty rather than emitting an over-width line.
114
122
 
115
123
  ### Directory, activity, Git, and PR state
116
124
 
117
- - `cwd` uses Starship's directory presentation defaults: contract the home directory to `~`, contract
118
- to the Git repository root when available, then retain at most the last three path components. This
119
- changes display only; the configured segment list and Pi working directory are untouched.
120
- - Repository-root discovery is cached with Git status outside footer rendering; a failed root query
121
- falls back to home/path-component contraction without hiding the segment.
125
+ - `cwd` uses Starship's directory presentation defaults: contract the home directory to `~`, contract to the Git repository root when available, then retain at most the last three path components.
126
+ This changes display only; the configured segment list and Pi working directory are untouched.
127
+ - Repository-root discovery is cached with Git status outside footer rendering; a failed root query falls back to home/path-component contraction without hiding the segment.
122
128
  - During active work, `tools` shows `💭 thinking` or `⚙ <tool>` with parallel counts.
123
129
  - Activity disappears after the agent settles and resets across session replacement or shutdown.
124
130
  - Clean repositories show no Git counters.
@@ -130,17 +136,15 @@ than the row, that row renders empty rather than emitting an over-width line.
130
136
 
131
137
  ### Usage and context
132
138
 
133
- - `context` renders one-decimal current usage and the model window, such as `2.4%/272k`. After
134
- compaction it can temporarily render `?/272k` until the next valid assistant response.
135
- - `tokens`, `cache`, and `cost` total every usage-bearing session entry, matching Pi's native footer:
136
- assistant messages, nested-LLM tool results, compactions, and branch summaries, including abandoned
137
- branches retained in the session.
138
- - Cache tokens are `R<read>`, `W<write>`, and `CH<rate>`. `R` and `W` are cumulative; `CH` uses only
139
- the latest assistant prompt: `cacheRead / (input + cacheRead + cacheWrite) * 100`.
140
- - Subscription-backed OAuth models and `kimi-coding` append `(sub)` to cost. The dollar value is
141
- usage cost, not proof of an amount billed under a subscription.
142
- - Pi's public extension API does not expose the current auto-compaction toggle, so this footer cannot
143
- reliably show the native `(auto)` marker.
139
+ - `context` renders one-decimal current usage and the model window, such as `2.4%/272k`.
140
+ After compaction it can temporarily render `?/272k` until the next valid assistant response.
141
+ - `tokens`, `cache`, and `cost` total every usage-bearing session entry, matching Pi's native footer.
142
+ This includes assistant messages, nested-LLM tool results, compactions, and branch summaries, including abandoned branches retained in the session.
143
+ - Cache tokens are `R<read>`, `W<write>`, and `CH<rate>`.
144
+ `R` and `W` are cumulative; `CH` uses only the latest assistant prompt: `cacheRead / (input + cacheRead + cacheWrite) * 100`.
145
+ - Subscription-backed OAuth models and `kimi-coding` append `(sub)` to cost.
146
+ The dollar value is usage cost, not proof of an amount billed under a subscription.
147
+ - Pi's public extension API does not expose the current auto-compaction toggle, so this footer cannot reliably show the native `(auto)` marker.
144
148
 
145
149
  ## ⚙️ Settings
146
150
 
@@ -150,13 +154,14 @@ The extension uses one user-level file:
150
154
  <getAgentDir()>/pi-statusline.json
151
155
  ```
152
156
 
153
- There are no project or environment overrides. When the file is absent, pi-statusline uses its
154
- built-in defaults without creating the file or parent directory. The first successful settings save
155
- creates a complete editable document atomically. Malformed or unreadable settings are never
156
- overwritten. Settings reload on startup, `/reload`, and session replacement.
157
+ There are no project or environment overrides.
158
+ When the file is absent, pi-statusline uses its built-in defaults without creating the file or parent directory.
159
+ The first successful settings save creates a complete editable document atomically.
160
+ Malformed or unreadable settings are never overwritten.
161
+ Settings reload on startup, `/reload`, and session replacement.
157
162
 
158
- A valid legacy `pi-statusline-settings.json` remains readable with a warning and is never modified
159
- automatically; rename it to `pi-statusline.json`. If both files exist, `pi-statusline.json` wins.
163
+ A valid legacy `pi-statusline-settings.json` remains readable with a warning and is never modified automatically; rename it to `pi-statusline.json`.
164
+ If both files exist, `pi-statusline.json` wins.
160
165
 
161
166
  ### Settings reference
162
167
 
@@ -170,9 +175,10 @@ automatically; rename it to `pi-statusline.json`. If both files exist, `pi-statu
170
175
  | `segmentText` | Per-segment `prefix` and `suffix`; model truncation fields | Format Pi-owned dynamic values |
171
176
  | `extensionStatusIcons` | Raw status key or `namespace:*` to icon string | Customize extension status icons |
172
177
 
173
- All fields are optional in an existing document. Missing fields use defaults. Unknown fields produce a
174
- warning but are preserved by menu saves. Invalid recognized values block saving, leaving the previous
175
- file and live footer unchanged.
178
+ All fields are optional in an existing document.
179
+ Missing fields use defaults.
180
+ Unknown fields produce a warning but are preserved by menu saves.
181
+ Invalid recognized values block saving, leaving the previous file and live footer unchanged.
176
182
 
177
183
  A compact customization example:
178
184
 
@@ -197,13 +203,12 @@ A compact customization example:
197
203
  }
198
204
  ```
199
205
 
200
- Use **Advanced → Edit settings JSON** or `/statusline settings` to edit, validate, atomically save, and
201
- apply the file.
206
+ Use **Advanced → Edit settings JSON** or `/statusline settings` to edit, validate, atomically save, and apply the file.
202
207
 
203
208
  ## 🎨 Appearance
204
209
 
205
- Named palettes provide contrast-checked color ramps. Appearance previews update while the picker
206
- moves, but save only when Enter is pressed; Escape restores the saved palette.
210
+ Named palettes provide contrast-checked color ramps.
211
+ Appearance previews update while the picker moves, but save only when Enter is pressed; Escape restores the saved palette.
207
212
 
208
213
  When `palettePreset` is `custom`, `palette` maps segment names to foreground/background colors:
209
214
 
@@ -225,8 +230,8 @@ When `palettePreset` is `custom`, `palette` maps segment names to foreground/bac
225
230
  - Missing custom colors remain unstyled instead of inheriting Tokyo Night.
226
231
  - Adjacent segments with identical colors share one block; transitions use ``.
227
232
 
228
- `segmentText` values must be single-line text without terminal control characters. Use `line_break`
229
- for another row rather than inserting a newline into a prefix or suffix.
233
+ `segmentText` values must be single-line text without terminal control characters.
234
+ Use `line_break` for another row rather than inserting a newline into a prefix or suffix.
230
235
 
231
236
  ### Model truncation
232
237
 
@@ -244,20 +249,19 @@ Long model IDs are truncated out of the box so the balanced footer can retain us
244
249
  }
245
250
  ```
246
251
 
247
- `truncationLength` counts model grapheme clusters retained before the symbol. The built-in value is
248
- `36`; set it to `0` to display the complete ID. The direction names the removed portion:
252
+ `truncationLength` counts model grapheme clusters retained before the symbol.
253
+ The built-in value is `36`; set it to `0` to display the complete ID.
254
+ The direction names the removed portion:
249
255
 
250
- - `start` retains the suffix and is the default, which is useful for long llama.cpp paths and model
251
- variants.
256
+ - `start` retains the suffix and is the default, which is useful for long llama.cpp paths and model variants.
252
257
  - `middle` retains both ends.
253
258
  - `end` retains the prefix.
254
259
 
255
- Truncation runs after the built-in Claude/GPT shortening rules but before the configured model prefix
256
- and suffix. It changes display only—the provider model ID is untouched. Terminal control sequences
257
- in model IDs are removed at render time, and unsafe configured symbols are rejected. An empty
258
- `truncationSymbol` truncates without a marker. pi-statusline treats model IDs as opaque strings and
259
- does not parse paths, repositories, GGUF suffixes, or quantization names. At very narrow widths, the
260
- existing responsive priorities may still omit the model rather than overflow the terminal.
260
+ Truncation runs after the built-in Claude/GPT shortening rules but before the configured model prefix and suffix.
261
+ It changes display only—the provider model ID is untouched.
262
+ Terminal control sequences in model IDs are removed at render time, and unsafe configured symbols are rejected.
263
+ An empty `truncationSymbol` truncates without a marker. pi-statusline treats model IDs as opaque strings and does not parse paths, repositories, GGUF suffixes, or quantization names.
264
+ At very narrow widths, the existing responsive priorities may still omit the model rather than overflow the terminal.
261
265
 
262
266
  ## 🧩 Advanced layout
263
267
 
@@ -282,10 +286,11 @@ Available data segments:
282
286
  brand provider model thinking cwd branch tools context tokens cache cost time turn
283
287
  ```
284
288
 
285
- Data segments must be unique. `line_break` may repeat when data segments separate occurrences, but
286
- consecutive breaks are invalid. It has no `segmentText` entry. The menu cleans up leading, trailing,
287
- and newly consecutive breaks after visibility changes. Manually authored leading/trailing breaks
288
- represent empty rows.
289
+ Data segments must be unique.
290
+ `line_break` may repeat when data segments separate occurrences, but consecutive breaks are invalid.
291
+ It has no `segmentText` entry.
292
+ The menu cleans up leading, trailing, and newly consecutive breaks after visibility changes.
293
+ Manually authored leading/trailing breaks represent empty rows.
289
294
 
290
295
  ```json
291
296
  {
@@ -293,13 +298,13 @@ represent empty rows.
293
298
  }
294
299
  ```
295
300
 
296
- An empty `segments` array hides the main powerline while extension statuses can still render. The
297
- extension intentionally has no variable or format language; use `pi-starship` when you need one.
301
+ An empty `segments` array hides the main powerline while extension statuses can still render.
302
+ The extension intentionally has no variable or format language; use `pi-starship` when you need one.
298
303
 
299
304
  ## 🔌 Extension statuses and icons
300
305
 
301
- Other extension statuses appear below the main powerline, wrap to terminal width, and are limited to
302
- five items. Icons resolve in this order:
306
+ Other extension statuses appear below the main powerline, wrap to terminal width, and are limited to five items.
307
+ Icons resolve in this order:
303
308
 
304
309
  1. Exact configured raw key, such as `goal` or `foo:server`.
305
310
  2. Longest configured colon wildcard, such as `foo:*` or `foo:server:*`.
@@ -308,9 +313,10 @@ five items. Icons resolve in this order:
308
313
  5. Built-in icon.
309
314
  6. Generic `🔌` fallback.
310
315
 
311
- Set an icon to `""` to hide only the icon. Wildcards match colon namespaces, not slash-delimited keys;
312
- configure slash keys exactly. Compatibility fallbacks retain `codex-usage`, `pisync`, and
313
- `unknown-error-retry`; an explicit canonical key wins.
316
+ Set an icon to `""` to hide only the icon.
317
+ Wildcards match colon namespaces, not slash-delimited keys.
318
+ Configure slash keys exactly.
319
+ Compatibility fallbacks retain `codex-usage`, `pisync`, and `unknown-error-retry`; an explicit canonical key wins.
314
320
 
315
321
  For interoperable extensions, prefer one aggregated key or a stable coexistence slot:
316
322
 
@@ -324,17 +330,17 @@ Put transient activity in the value and always clear the same complete key.
324
330
  ## 🛠️ Troubleshooting
325
331
 
326
332
  - **Powerline symbols look wrong:** use a font with Powerline glyphs; emoji support is also recommended.
327
- - **The footer reports settings warnings:** run `/statusline status`, then `/statusline settings` to fix
328
- invalid recognized fields.
329
- - **The footer appears to be replaced:** disable `pi-starship` or another extension that also calls
330
- Pi's `setFooter()`.
331
- - **A custom segment disappears on a narrow terminal:** check the responsive priority above or add an
332
- explicit `line_break`.
333
+ - **The footer reports settings warnings:** run `/statusline status`, then `/statusline settings` to fix invalid recognized fields.
334
+ - **The footer appears to be replaced:** disable `pi-starship` or another extension that also calls Pi's `setFooter()`.
335
+ - **A custom segment disappears on a narrow terminal:** check the responsive priority above or add an explicit `line_break`.
333
336
 
334
337
  ## 🗂️ Package layout
335
338
 
336
339
  ```text
337
340
  packages/pi-statusline/
341
+ ├── dist/ # generated split TypeScript runtime loaded by Jiti
342
+ ├── scripts/
343
+ │ └── build-runtime.mjs # deterministic runtime bundler and eager-boundary validator
338
344
  ├── src/
339
345
  │ ├── index.ts # thin entrypoint forwarding to the source runtime
340
346
  │ ├── statusline.ts # authoritative lifecycle implementation
@@ -358,14 +364,14 @@ packages/pi-statusline/
358
364
  └── package.json
359
365
  ```
360
366
 
361
- `src/` is the authoritative published implementation, and `src/index.ts` remains the sole declared
362
- Pi entrypoint.
367
+ `src/` is the authoritative implementation, and `src/index.ts` remains its thin source forwarder.
368
+ The package build emits the sole declared Pi entrypoint at `dist/index.ts` without forwarding back into `src`.
363
369
 
364
370
  ## 🔎 Keywords
365
371
 
366
- Pi extension, Pi coding agent, statusline, Tokyo Night, powerline, responsive terminal footer,
367
- context usage, prompt cache, cache hit rate, model status.
372
+ Pi extension, Pi coding agent, statusline, Tokyo Night, powerline, responsive terminal footer, context usage, prompt cache, cache hit rate, model status.
368
373
 
369
374
  ## 📄 License
370
375
 
371
- MIT. See [`LICENSE`](./LICENSE).
376
+ MIT.
377
+ See [`LICENSE`](./LICENSE).