@narumitw/pi-statusline 0.4.1 → 0.4.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.
- package/package.json +3 -3
- package/presets/classic.ts +2 -2
- package/presets/tokyo-night.ts +2 -2
- package/presets/types.ts +1 -1
- package/src/statusline.ts +11 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-statusline",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Pi extension that replaces the footer with an information-rich statusline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "2.4.14",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
33
|
+
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
34
|
+
"@earendil-works/pi-tui": "0.74.0",
|
|
35
35
|
"@types/node": "25.6.0",
|
|
36
36
|
"typescript": "6.0.3"
|
|
37
37
|
},
|
package/presets/classic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme, ThemeColor } from "@
|
|
2
|
-
import { truncateToWidth } from "@
|
|
1
|
+
import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { RenderSegment, SeparatorName, StatuslineConfig } from "./types.js";
|
|
4
4
|
|
|
5
5
|
export function renderClassicStatusline(
|
package/presets/tokyo-night.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { truncateToWidth } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import { ansiFg, ansiStyle } from "./ansi.js";
|
|
4
4
|
import type { RenderSegment, TokyoNightBlockName } from "./types.js";
|
|
5
5
|
|
package/presets/types.ts
CHANGED
package/src/statusline.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type {
|
|
|
7
7
|
ReadonlyFooterDataProvider,
|
|
8
8
|
Theme,
|
|
9
9
|
ThemeColor,
|
|
10
|
-
} from "@
|
|
11
|
-
import { truncateToWidth } from "@
|
|
10
|
+
} from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
12
12
|
import { classicExtensionSeparator, renderClassicStatusline } from "../presets/classic.js";
|
|
13
13
|
import { renderTokyoNightStatusline, tokyoNightExtensionSeparator } from "../presets/tokyo-night.js";
|
|
14
14
|
import type {
|
|
@@ -320,14 +320,14 @@ function thinkingColor(level: ThinkingLevel): ThemeColor {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
function contextColor(percent: number | null | undefined): ThemeColor {
|
|
323
|
+
export function contextColor(percent: number | null | undefined): ThemeColor {
|
|
324
324
|
if (percent === null || percent === undefined) return "dim";
|
|
325
325
|
if (percent >= 90) return "error";
|
|
326
326
|
if (percent >= 70) return "warning";
|
|
327
327
|
return "success";
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
function formatToolActivity(runtime: RuntimeState): string {
|
|
330
|
+
export function formatToolActivity(runtime: RuntimeState): string {
|
|
331
331
|
const active = [...runtime.activeTools.entries()];
|
|
332
332
|
if (active.length > 0) {
|
|
333
333
|
const [name, count] = active[0] ?? ["tool", 1];
|
|
@@ -373,7 +373,7 @@ function formatDuplicateExtensionStatus(runtime: RuntimeState, theme: Theme): st
|
|
|
373
373
|
return [`${theme.fg("warning", "⚠️")} ${theme.fg("warning", `dup ${names}${suffix}`)}`];
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
function splitExtensionStatusIcon(value: string): { icon: string; text: string } {
|
|
376
|
+
export function splitExtensionStatusIcon(value: string): { icon: string; text: string } {
|
|
377
377
|
const trimmed = value.trim();
|
|
378
378
|
const [firstToken, ...restTokens] = trimmed.split(/\s+/);
|
|
379
379
|
if (firstToken && isEmojiOnlyToken(firstToken)) {
|
|
@@ -388,7 +388,7 @@ function isEmojiOnlyToken(value: string): boolean {
|
|
|
388
388
|
);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
function extensionColor(key: string, value: string): ThemeColor {
|
|
391
|
+
export function extensionColor(key: string, value: string): ThemeColor {
|
|
392
392
|
const normalized = `${key} ${value}`.toLowerCase();
|
|
393
393
|
if (/missing|error|fail|conflict|duplicate|unavailable/.test(normalized)) return "warning";
|
|
394
394
|
if (normalized.includes("codex")) return "accent";
|
|
@@ -396,11 +396,11 @@ function extensionColor(key: string, value: string): ThemeColor {
|
|
|
396
396
|
return "muted";
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
function stripExtensionStatusPrefix(key: string, value: string): string {
|
|
399
|
+
export function stripExtensionStatusPrefix(key: string, value: string): string {
|
|
400
400
|
return value.trim().replace(new RegExp(`^${escapeRegExp(key)}\\s*:\\s*`, "iu"), "");
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
function simplifyExtensionStatusText(value: string): string {
|
|
403
|
+
export function simplifyExtensionStatusText(value: string): string {
|
|
404
404
|
return value
|
|
405
405
|
.trim()
|
|
406
406
|
.replace(/\bready\b/giu, "✓")
|
|
@@ -468,7 +468,7 @@ function packageNameForSource(source: string, baseDirectory: string): string | u
|
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
-
function npmPackageName(source: string): string {
|
|
471
|
+
export function npmPackageName(source: string): string {
|
|
472
472
|
const spec = source.slice("npm:".length);
|
|
473
473
|
if (spec.startsWith("@")) return spec.split("@").slice(0, 2).join("@").replace(/^@/, "@");
|
|
474
474
|
return spec.split("@")[0] ?? spec;
|
|
@@ -505,7 +505,7 @@ function getTokenTotals(ctx: ExtensionContext): TokenTotals {
|
|
|
505
505
|
return totals;
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
function formatCount(value: number): string {
|
|
508
|
+
export function formatCount(value: number): string {
|
|
509
509
|
if (value < 1000) return `${value}`;
|
|
510
510
|
if (value < 1_000_000) return `${(value / 1000).toFixed(value < 10_000 ? 1 : 0)}k`;
|
|
511
511
|
return `${(value / 1_000_000).toFixed(1)}m`;
|
|
@@ -518,7 +518,7 @@ function formatTime(): string {
|
|
|
518
518
|
return `${hours}:${minutes}`;
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
function shortenModel(model: string): string {
|
|
521
|
+
export function shortenModel(model: string): string {
|
|
522
522
|
return model
|
|
523
523
|
.replace(/^claude-/, "")
|
|
524
524
|
.replace(/^gpt-/, "gpt ")
|