pi-powerline 0.6.1 → 0.6.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,174 @@
1
+ ## [0.6.3](https://github.com/jwu/pi-powerline/compare/v0.6.2...v0.6.3) (2026-05-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * show auto-discovered extensions in header ([e2b187f](https://github.com/jwu/pi-powerline/commit/e2b187fdcf840c741be3be3bf8ad4c95612e9fc2))
7
+
8
+ ## [0.6.2](https://github.com/jwu/pi-powerline/compare/v0.6.1...v0.6.2) (2026-05-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * simplify nerd font detection ([52dacaf](https://github.com/jwu/pi-powerline/commit/52dacaf693161456a8acfcc0da5a6abc98330ffc))
14
+
15
+ ## [0.6.1](https://github.com/jwu/pi-powerline/compare/v0.6.0...v0.6.1) (2026-05-15)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **header:** dedupe extension entries ([2b2db6e](https://github.com/jwu/pi-powerline/commit/2b2db6e4ed2973a50d145205a3884726591a2663))
21
+
22
+ # [0.6.0](https://github.com/jwu/pi-powerline/compare/v0.5.1...v0.6.0) (2026-05-15)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **header:** add missing return in resolvePackageDir npm branch, add tests ([823d4eb](https://github.com/jwu/pi-powerline/commit/823d4ebec8d502c5dd3e07cb9a1c954d62b086bc))
28
+ * **header:** check .pi/npm/node_modules for project-scoped npm packages ([ad2d8d6](https://github.com/jwu/pi-powerline/commit/ad2d8d6a5694ff5371813fcf9e9eaa69e12e3bdc))
29
+ * **header:** resolve npm root via pi-coding-agent instead of pi-subagents ([0ba1051](https://github.com/jwu/pi-powerline/commit/0ba1051a231ad98c4a964658ec0c2a45307cc4c9))
30
+ * **header:** use NVM_DIR/env probe instead of createRequire for npm root ([3081f77](https://github.com/jwu/pi-powerline/commit/3081f77dd49117d831433857c7fd91f89fa1e8c1))
31
+
32
+
33
+ ### Features
34
+
35
+ * **header:** add packages and extensions sections, refactor to config-based discovery ([769465d](https://github.com/jwu/pi-powerline/commit/769465d0798548ff7e6098631739c9f5178fc938))
36
+ * **header:** annotate packages with [project]/[global] scope tag ([d451e96](https://github.com/jwu/pi-powerline/commit/d451e96222b1a88f497b07b19fbc386344879417))
37
+
38
+ ## [0.5.1](https://github.com/jwu/pi-powerline/compare/v0.5.0...v0.5.1) (2026-05-12)
39
+
40
+ ### Code Refactoring
41
+
42
+ * migrate peer deps from @mariozechner to @earendil-works scope ([3d7de22](https://github.com/jwu/pi-powerline/commit/3d7de22))
43
+
44
+ # [0.5.0](https://github.com/jwu/pi-powerline/compare/v0.4.2...v0.5.0) (2026-05-12)
45
+
46
+
47
+ ### Features
48
+
49
+ * show active tools in header info ([bcbc9a3](https://github.com/jwu/pi-powerline/commit/bcbc9a3d41b12ff86c252860cd941e4370d20108))
50
+
51
+ ## [0.4.2](https://github.com/jwu/pi-powerline/compare/v0.4.1...v0.4.2) (2026-05-08)
52
+
53
+
54
+ ### Bug Fixes
55
+
56
+ * improve header session status ([58d644d](https://github.com/jwu/pi-powerline/commit/58d644d6dafe0c83e0b83eb6c451705c51a5e2d3))
57
+
58
+ ## [0.4.1](https://github.com/jwu/pi-powerline/compare/v0.4.0...v0.4.1) (2026-05-08)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * enable header info by default ([bc229be](https://github.com/jwu/pi-powerline/commit/bc229befa2f552c89249bc5c110b5dde13c306c3))
64
+
65
+ # [0.4.0](https://github.com/jwu/pi-powerline/compare/v0.3.1...v0.4.0) (2026-05-08)
66
+
67
+
68
+ ### Bug Fixes
69
+
70
+ * respect quiet startup for header info ([fb243f5](https://github.com/jwu/pi-powerline/commit/fb243f5502f3a866ba971a243f7236f02a9cd96a))
71
+
72
+
73
+ ### Features
74
+
75
+ * add optional header info ([40a2a29](https://github.com/jwu/pi-powerline/commit/40a2a29d758459962656f098da254939f537b87f))
76
+ * center header status ([963e6ef](https://github.com/jwu/pi-powerline/commit/963e6ef0b0fc30fe896d6356734fcd23d1ae4ff5))
77
+
78
+ ## [0.3.1](https://github.com/jwu/pi-powerline/compare/v0.3.0...v0.3.1) (2026-05-06)
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * guard prepare script to skip simple-git-hooks outside git repos ([c26bcad](https://github.com/jwu/pi-powerline/commit/c26bcad428ea0a855e9725abb0d269a5f975d09f))
84
+
85
+ # [0.3.0](https://github.com/jwu/pi-powerline/compare/v0.2.3...v0.3.0) (2026-05-06)
86
+
87
+
88
+ ### Bug Fixes
89
+
90
+ * remove npm provenance (requires CI, not supported with --no-ci) ([d9e9005](https://github.com/jwu/pi-powerline/commit/d9e90055df72e9d3b991ba48ecd2acbbd3af998b))
91
+
92
+
93
+ ### Features
94
+
95
+ * switch from git-cliff to semantic-release, add commitlint, strengthen TUI tests ([4cec86e](https://github.com/jwu/pi-powerline/commit/4cec86e61666436ef1cbc0a1cab3426408a0ce70))
96
+
97
+ ## [0.2.3] - 2026-05-06
98
+
99
+ ### 🐛 Bug Fixes
100
+
101
+ - Husky command not found when installed as dependency
102
+
103
+ ### 📚 Documentation
104
+
105
+ - Credit pi-powerline-footer by nicobailon
106
+
107
+ ### ⚙️ Miscellaneous Tasks
108
+
109
+ - Update changelog
110
+ ## [0.2.2] - 2026-05-05
111
+
112
+ ### 🐛 Bug Fixes
113
+
114
+ - Use GitHub raw URL for screenshot in README
115
+
116
+ ### ⚙️ Miscellaneous Tasks
117
+
118
+ - Add homepage and repository fields to package.json
119
+ ## [0.2.1] - 2026-05-05
120
+
121
+ ### ⚙️ Miscellaneous Tasks
122
+
123
+ - Add git-cliff changelog
124
+ - Bump version to 0.2.1
125
+ ## [0.2.0] - 2026-05-05
126
+
127
+ ### 🚀 Features
128
+
129
+ - Add powerline master switch, simplify README, use local assets
130
+
131
+ ### ⚙️ Miscellaneous Tasks
132
+
133
+ - Bump version to 0.2.0
134
+ ## [0.1.0] - 2026-05-03
135
+
136
+ ### 🚀 Features
137
+
138
+ - Powerline UI extensions with auto-format and pre-commit hooks
139
+ - Add /powerline toggle command for editor, footer, header
140
+ - Add powerline status widget above editor
141
+ - /powerline commands take effect immediately via events bus
142
+
143
+ ### 🐛 Bug Fixes
144
+
145
+ - EditorTheme type mismatch, add diagnostics checks
146
+
147
+ ### 💼 Other
148
+
149
+ - Use pi.getThinkingLevel() and pi.on(thinking_level_select) for think level
150
+ - Mirror built-in footer layout with full stats, context usage, thinking level
151
+ - Drop redundant pwd line (already shown by widget)
152
+ - Show only think level on right side, styled like widget
153
+ - Add Nerd Font think icon to right side
154
+ - Real-time token stats via message_update live usage fusion
155
+ - Show (auto) marker when auto-compact is enabled
156
+ - Move context usage to front of stats line, preserve per-segment coloring
157
+ - Restore original dim-wrapping, keep context-first ordering only
158
+ - Remove think level display (now in footer), show only model → folder
159
+ - Truncate with ellipsis instead of wrapping to next line
160
+ - Drop think: prefix from level label in stats line
161
+ - Embed widget info (model + folder) in top border line
162
+
163
+ ### 🚜 Refactor
164
+
165
+ - Unified settings model with breadcrumb/footer/header config keys
166
+ - Extract shared breadcrumb helpers into breadcrumb.ts
167
+
168
+ ### 📚 Documentation
169
+
170
+ - Update README to reflect current features, settings, and commands
171
+
172
+ ### ⚙️ Miscellaneous Tasks
173
+
174
+ - Prepare package.json for pi package publishing
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jwu
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 CHANGED
@@ -40,6 +40,24 @@ Settings are read from both global and project files. Project settings override
40
40
  | `header` | `true` / `false` | `true` | Enable custom gradient-logo header |
41
41
  | `header-info` | `true` / `false` | `true` | Show header diagnostic info on startup/reload |
42
42
 
43
+ ### Nerd Font icons
44
+
45
+ pi-powerline uses Nerd Font icons when it can infer that the terminal supports them.
46
+
47
+ Detection order:
48
+
49
+ 1. `PI_NERD_FONTS=1` forces icons on
50
+ 2. `PI_NERD_FONTS=0` forces icons off
51
+ 3. `GHOSTTY_RESOURCES_DIR` enables icons for Ghostty
52
+ 4. `TERM_PROGRAM` or `TERM` containing `iterm`, `wezterm`, `kitty`, `ghostty`, or `alacritty` enables icons
53
+ 5. Otherwise icons are disabled and plain text fallbacks are used
54
+
55
+ For SSH or terminals that cannot be detected reliably, set it explicitly:
56
+
57
+ ```bash
58
+ export PI_NERD_FONTS=1
59
+ ```
60
+
43
61
  ### Header info
44
62
 
45
63
  `header-info` adds diagnostic sections under the header:
Binary file
@@ -1,23 +1,12 @@
1
1
  /**
2
2
  * Shared breadcrumb display helpers
3
3
  *
4
- * Export nerd font detection, icons, and helper functions used by
5
- * widget.ts and editor.ts to render the model→folder breadcrumb.
4
+ * Exports icons and helper functions used by widget.ts and editor.ts
5
+ * to render the model→folder breadcrumb.
6
6
  */
7
7
  import { basename } from 'node:path';
8
8
  import type { ExtensionContext, Theme } from '@earendil-works/pi-coding-agent';
9
-
10
- // ═══════════════════════════════════════════════════════════════════════════
11
- // nerd font detection
12
- // ═══════════════════════════════════════════════════════════════════════════
13
-
14
- export function hasNerdFonts(): boolean {
15
- if (process.env.POWERLINE_NERD_FONTS === '1') return true;
16
- if (process.env.POWERLINE_NERD_FONTS === '0') return false;
17
- if (process.env.GHOSTTY_RESOURCES_DIR) return true;
18
- const term = (process.env.TERM_PROGRAM || '').toLowerCase();
19
- return ['iterm', 'wezterm', 'kitty', 'ghostty', 'alacritty'].some((t) => term.includes(t));
20
- }
9
+ import { hasNerdFonts, hexFg, withIcon } from './utils.ts';
21
10
 
22
11
  const NERD = hasNerdFonts();
23
12
 
@@ -25,23 +14,6 @@ export const ICON_MODEL = NERD ? '\uF4BC' : '';
25
14
  export const ICON_FOLDER = NERD ? '\uF115' : '';
26
15
  export const SEP = NERD ? '\uf054' : '/';
27
16
 
28
- // ═══════════════════════════════════════════════════════════════════════════
29
- // helpers
30
- // ═══════════════════════════════════════════════════════════════════════════
31
-
32
- export function withIcon(icon: string, text: string): string {
33
- return icon ? `${icon} ${text}` : text;
34
- }
35
-
36
- /** hex → ANSI true color (model/folder use hex, not pi theme tokens) */
37
- export function hexFg(hex: string, text: string): string {
38
- const h = hex.replace('#', '');
39
- const r = parseInt(h.slice(0, 2), 16);
40
- const g = parseInt(h.slice(2, 4), 16);
41
- const b = parseInt(h.slice(4, 6), 16);
42
- return `\x1b[38;2;${r};${g};${b}m${text}`;
43
- }
44
-
45
17
  // ═══════════════════════════════════════════════════════════════════════════
46
18
  // breadcrumb data
47
19
  // ═══════════════════════════════════════════════════════════════════════════
@@ -16,7 +16,7 @@ import { join } from 'node:path';
16
16
  import type { AssistantMessage } from '@earendil-works/pi-ai';
17
17
  import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';
18
18
  import { truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
19
- import { hasNerdFonts, hexFg, withIcon } from './breadcrumb.ts';
19
+ import { hasNerdFonts, hexFg, withIcon } from './utils.ts';
20
20
  import { readPowerlineSettings } from './settings.ts';
21
21
 
22
22
  // ═══════════════════════════════════════════════════════════════════════════
@@ -470,7 +470,7 @@ function getPackages(cwd: string, home = getHomeDir()): string[] {
470
470
  return results.sort((a, b) => a.localeCompare(b));
471
471
  }
472
472
 
473
- // ── getExtensionItems: scan .ts files from settings.json extensions dirs ──
473
+ // ── getExtensionItems: scan configured and auto-discovered extension paths ──
474
474
 
475
475
  function readExtensionSources(cwd: string, home = getHomeDir()): ExtensionSource[] {
476
476
  const projectBaseDir = join(cwd, '.pi');
@@ -490,37 +490,59 @@ function resolveSettingsSource(source: string, baseDir: string, home = getHomeDi
490
490
  : resolve(baseDir, source);
491
491
  }
492
492
 
493
- function getExtensionItems(cwd: string, home = getHomeDir()): string[] {
494
- const results: string[] = [];
495
- const seenFiles = new Set<string>();
493
+ const EXTENSION_INDEX_FILES = ['index.ts', 'index.js'];
496
494
 
497
- function addFile(filePath: string) {
498
- const key = resolve(filePath);
499
- if (seenFiles.has(key)) return;
500
- seenFiles.add(key);
501
- results.push(formatDisplayPath(cwd, filePath));
495
+ function isExtensionFile(filePath: string): boolean {
496
+ return filePath.endsWith('.ts') || filePath.endsWith('.js');
497
+ }
498
+
499
+ function safeStat(path: string) {
500
+ try {
501
+ return statSync(path);
502
+ } catch {
503
+ return undefined;
502
504
  }
505
+ }
503
506
 
504
- for (const { source, baseDir } of readExtensionSources(cwd, home)) {
505
- const resolved = resolveSettingsSource(source, baseDir, home);
507
+ function listExtensionFiles(path: string): string[] {
508
+ const s = safeStat(path);
509
+ if (!s) return [];
510
+ if (s.isFile()) return isExtensionFile(path) ? [path] : [];
511
+ if (!s.isDirectory()) return [];
506
512
 
507
- if (!existsSync(resolved)) continue;
513
+ return readdirSync(path)
514
+ .sort()
515
+ .flatMap((entry) => {
516
+ const entryPath = join(path, entry);
517
+ const entryStat = safeStat(entryPath);
518
+ if (entryStat?.isFile() && isExtensionFile(entry)) return [entryPath];
519
+ if (!entryStat?.isDirectory()) return [];
508
520
 
509
- try {
510
- const s = statSync(resolved);
511
- if (s.isDirectory()) {
512
- for (const f of readdirSync(resolved).sort()) {
513
- if (f.endsWith('.ts')) addFile(join(resolved, f));
514
- }
515
- } else {
516
- addFile(resolved);
517
- }
518
- } catch {
519
- // ignore unreadable paths
520
- }
521
- }
521
+ return EXTENSION_INDEX_FILES.map((file) => join(entryPath, file)).filter((indexPath) =>
522
+ safeStat(indexPath)?.isFile(),
523
+ );
524
+ });
525
+ }
526
+
527
+ function getExtensionItems(cwd: string, home = getHomeDir()): string[] {
528
+ const sources = [
529
+ ...readExtensionSources(cwd, home).map(({ source, baseDir }) =>
530
+ resolveSettingsSource(source, baseDir, home),
531
+ ),
532
+ join(cwd, '.pi', 'extensions'),
533
+ join(home, '.pi', 'agent', 'extensions'),
534
+ ];
535
+ const seen = new Set<string>();
522
536
 
523
- return results;
537
+ return sources
538
+ .flatMap(listExtensionFiles)
539
+ .filter((filePath) => {
540
+ const key = resolve(filePath);
541
+ if (seen.has(key)) return false;
542
+ seen.add(key);
543
+ return true;
544
+ })
545
+ .map((filePath) => formatDisplayPath(cwd, filePath));
524
546
  }
525
547
 
526
548
  function shouldShowHeaderInfo(ctx: ExtensionContext, reason: SessionStartEvent['reason']): boolean {
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Shared utility functions
3
+ *
4
+ * Rendering and font-detection helpers used by breadcrumb, footer, and other extensions.
5
+ */
6
+
7
+ // ═══════════════════════════════════════════════════════════════════════════
8
+ // nerd font detection (cached)
9
+ // ═══════════════════════════════════════════════════════════════════════════
10
+
11
+ let _nerdCache: boolean | null = null;
12
+
13
+ export function hasNerdFonts(): boolean {
14
+ if (_nerdCache !== null) return _nerdCache;
15
+
16
+ if (process.env.PI_NERD_FONTS === '1') return (_nerdCache = true);
17
+ if (process.env.PI_NERD_FONTS === '0') return (_nerdCache = false);
18
+ if (process.env.GHOSTTY_RESOURCES_DIR) return (_nerdCache = true);
19
+
20
+ const terminal = `${process.env.TERM_PROGRAM || ''} ${process.env.TERM || ''}`.toLowerCase();
21
+ if (['iterm', 'wezterm', 'kitty', 'ghostty', 'alacritty'].some((t) => terminal.includes(t))) {
22
+ return (_nerdCache = true);
23
+ }
24
+
25
+ return (_nerdCache = false);
26
+ }
27
+
28
+ // ═══════════════════════════════════════════════════════════════════════════
29
+ // rendering helpers
30
+ // ═══════════════════════════════════════════════════════════════════════════
31
+
32
+ /** Prepend icon with trailing space, or return plain text if icon is empty */
33
+ export function withIcon(icon: string, text: string): string {
34
+ return icon ? `${icon} ${text}` : text;
35
+ }
36
+
37
+ /** hex → ANSI true color escape (no reset appended) */
38
+ export function hexFg(hex: string, text: string): string {
39
+ const h = hex.replace('#', '');
40
+ const r = parseInt(h.slice(0, 2), 16);
41
+ const g = parseInt(h.slice(2, 4), 16);
42
+ const b = parseInt(h.slice(4, 6), 16);
43
+ return `\x1b[38;2;${r};${g};${b}m${text}`;
44
+ }
package/package.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
2
  "name": "pi-powerline",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Powerline-style UI extensions for pi coding agent (custom editor, breadcrumb, footer, header)",
5
5
  "homepage": "https://github.com/jwu/pi-powerline#readme",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/jwu/pi-powerline.git"
9
9
  },
10
+ "bugs": {
11
+ "url": "https://github.com/jwu/pi-powerline/issues"
12
+ },
10
13
  "type": "module",
11
14
  "files": [
12
- "index.ts",
13
- "editor.ts",
14
- "breadcrumb.ts",
15
- "widget.ts",
16
- "footer.ts",
17
- "header.ts",
18
- "settings.ts"
15
+ "extensions/",
16
+ "README.md",
17
+ "package.json",
18
+ "CHANGELOG.md",
19
+ "LICENSE",
20
+ "assets/"
19
21
  ],
20
22
  "keywords": [
21
23
  "pi-package",
@@ -24,11 +26,12 @@
24
26
  "powerline",
25
27
  "extension"
26
28
  ],
27
- "author": "",
29
+ "author": "jwu",
28
30
  "license": "MIT",
29
31
  "scripts": {
30
32
  "test": "bun test",
31
33
  "typecheck": "bun tsc --noEmit --ignoreDeprecations 6.0",
34
+ "lint": "bun run format:check && bun run typecheck",
32
35
  "format": "prettier --write '**/*.ts'",
33
36
  "format:check": "prettier --check '**/*.ts'",
34
37
  "prepare": "[ -d .git ] && simple-git-hooks || true",
@@ -70,9 +73,12 @@
70
73
  "pre-commit": "bun prettier --check '**/*.ts' && bun test",
71
74
  "commit-msg": "bun commitlint --edit \"$1\""
72
75
  },
76
+ "engines": {
77
+ "node": ">=20"
78
+ },
73
79
  "pi": {
74
80
  "extensions": [
75
- "./index.ts"
81
+ "./extensions"
76
82
  ],
77
83
  "image": "https://raw.githubusercontent.com/jwu/pi-powerline/refs/heads/main/assets/pi-powerline.png"
78
84
  },
File without changes
File without changes
File without changes
File without changes