pi-powerline 0.6.2 → 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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ## [0.6.2](https://github.com/jwu/pi-powerline/compare/v0.6.1...v0.6.2) (2026-05-22)
2
9
 
3
10
 
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-powerline",
3
- "version": "0.6.2",
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": {