@narumitw/pi-statusline 0.50.0 → 0.50.1
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 +29 -209
- package/dist/chunks/{chunk-74QZGJ7L.js → chunk-J2ZSGEDQ.js} +18 -97
- package/dist/chunks/chunk-J2ZSGEDQ.js.map +7 -0
- package/dist/chunks/{commands-C2G2G7C6.js → commands-PPT3AJTL.js} +14 -58
- package/dist/chunks/commands-PPT3AJTL.js.map +7 -0
- package/dist/index.ts +21 -76
- package/dist/index.ts.map +2 -2
- package/docs/configuration.md +194 -0
- package/package.json +51 -51
- package/src/ansi.ts +18 -24
- package/src/command-contract.ts +6 -6
- package/src/commands.ts +759 -818
- package/src/directory.ts +27 -31
- package/src/extension-status.ts +186 -219
- package/src/git-status.ts +103 -111
- package/src/information-profiles.ts +12 -31
- package/src/powerline.ts +120 -127
- package/src/presets/candy.ts +1 -7
- package/src/presets/create-ramp.ts +21 -23
- package/src/presets/custom.ts +7 -7
- package/src/presets/forest.ts +1 -7
- package/src/presets/index.ts +30 -32
- package/src/presets/mono.ts +1 -7
- package/src/presets/neon.ts +1 -7
- package/src/presets/ocean.ts +1 -7
- package/src/presets/sunset.ts +1 -7
- package/src/presets/tokyo-night.ts +9 -9
- package/src/presets/types.ts +5 -5
- package/src/render.ts +277 -306
- package/src/settings.ts +516 -568
- package/src/statusline.ts +347 -372
- package/src/types.ts +34 -42
- package/src/usage.ts +40 -40
- package/dist/chunks/chunk-74QZGJ7L.js.map +0 -7
- package/dist/chunks/commands-C2G2G7C6.js.map +0 -7
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
2
|
+
"name": "@narumitw/pi-statusline",
|
|
3
|
+
"version": "0.50.1",
|
|
4
|
+
"description": "Pi extension that replaces the footer with an information-rich statusline.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"private": false,
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package",
|
|
10
|
+
"pi-extension",
|
|
11
|
+
"pi",
|
|
12
|
+
"statusline",
|
|
13
|
+
"footer"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"dist",
|
|
18
|
+
"docs",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"pi": {
|
|
23
|
+
"extensions": [
|
|
24
|
+
"./dist/index.ts"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "node scripts/build-runtime.mjs",
|
|
29
|
+
"check": "npm run build && biome check --vcs-use-ignore-file=false src test scripts package.json tsconfig.json README.md && npm run typecheck",
|
|
30
|
+
"format": "biome check --write --vcs-use-ignore-file=false src test scripts package.json tsconfig.json README.md",
|
|
31
|
+
"prepack": "npm run build",
|
|
32
|
+
"typecheck": "tsc --noEmit"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
36
|
+
"@earendil-works/pi-tui": "*"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@earendil-works/pi-coding-agent": "0.86.0",
|
|
40
|
+
"@earendil-works/pi-tui": "0.86.0",
|
|
41
|
+
"@types/node": "26.6.2",
|
|
42
|
+
"esbuild": "0.28.2",
|
|
43
|
+
"typescript": "7.0.2"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/narumiruna/pi-extensions",
|
|
48
|
+
"directory": "packages/pi-statusline"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@narumitw/pi-tui-kit": "^0.59.0"
|
|
52
|
+
}
|
|
53
53
|
}
|
package/src/ansi.ts
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
|
-
export function ansiStyle(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
): string
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
colors.bg ? colorCode("48", colors.bg, trueColor) : undefined,
|
|
9
|
-
].filter((code): code is string => code !== undefined);
|
|
10
|
-
if (codes.length === 0) return text;
|
|
11
|
-
return `\u001b[${codes.join(";")}m${text}\u001b[0m`;
|
|
1
|
+
export function ansiStyle(text: string, colors: { fg?: string; bg?: string }, trueColor = true): string {
|
|
2
|
+
const codes = [
|
|
3
|
+
colors.fg ? colorCode("38", colors.fg, trueColor) : undefined,
|
|
4
|
+
colors.bg ? colorCode("48", colors.bg, trueColor) : undefined,
|
|
5
|
+
].filter((code): code is string => code !== undefined);
|
|
6
|
+
if (codes.length === 0) return text;
|
|
7
|
+
return `\u001b[${codes.join(";")}m${text}\u001b[0m`;
|
|
12
8
|
}
|
|
13
9
|
|
|
14
10
|
export function ansiFg(hex: string, text: string, trueColor = true): string {
|
|
15
|
-
|
|
11
|
+
return ansiStyle(text, { fg: hex }, trueColor);
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
function colorCode(prefix: "38" | "48", hex: string, trueColor: boolean): string {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
? `${prefix};2;${red};${green};${blue}`
|
|
22
|
-
: `${prefix};5;${rgbToAnsi256(red, green, blue)}`;
|
|
15
|
+
const { red, green, blue } = hexToRgb(hex);
|
|
16
|
+
return trueColor ? `${prefix};2;${red};${green};${blue}` : `${prefix};5;${rgbToAnsi256(red, green, blue)}`;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
function rgbToAnsi256(red: number, green: number, blue: number): number {
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const channels = [red, green, blue].map((value) => Math.round((value / 255) * 5));
|
|
21
|
+
return 16 + 36 * (channels[0] ?? 0) + 6 * (channels[1] ?? 0) + (channels[2] ?? 0);
|
|
28
22
|
}
|
|
29
23
|
|
|
30
24
|
function hexToRgb(hex: string): { red: number; green: number; blue: number } {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const normalized = hex.replace(/^#/, "");
|
|
26
|
+
return {
|
|
27
|
+
red: Number.parseInt(normalized.slice(0, 2), 16),
|
|
28
|
+
green: Number.parseInt(normalized.slice(2, 4), 16),
|
|
29
|
+
blue: Number.parseInt(normalized.slice(4, 6), 16),
|
|
30
|
+
};
|
|
37
31
|
}
|
package/src/command-contract.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AutocompleteItem } from "@earendil-works/pi-tui";
|
|
2
2
|
|
|
3
3
|
export const STATUSLINE_SUBCOMMANDS: readonly AutocompleteItem[] = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
{ value: "settings", label: "settings", description: "Edit pi-statusline.json" },
|
|
5
|
+
{ value: "status", label: "status", description: "Show effective statusline settings" },
|
|
6
|
+
{ value: "help", label: "help", description: "Show configuration help" },
|
|
7
7
|
];
|
|
8
8
|
|
|
9
9
|
export function completeStatuslineArguments(prefix: string): AutocompleteItem[] | null {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const normalized = prefix.trim().toLowerCase();
|
|
11
|
+
const matches = STATUSLINE_SUBCOMMANDS.filter((item) => item.value.startsWith(normalized));
|
|
12
|
+
return matches.length > 0 ? [...matches] : null;
|
|
13
13
|
}
|