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 +7 -0
- package/extensions/header.ts +48 -26
- package/package.json +1 -1
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
|
|
package/extensions/header.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
494
|
-
const results: string[] = [];
|
|
495
|
-
const seenFiles = new Set<string>();
|
|
493
|
+
const EXTENSION_INDEX_FILES = ['index.ts', 'index.js'];
|
|
496
494
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
|
|
505
|
-
|
|
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
|
-
|
|
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
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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
|
|
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