@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/package.json CHANGED
@@ -1,53 +1,53 @@
1
1
  {
2
- "name": "@narumitw/pi-statusline",
3
- "version": "0.50.0",
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
- "README.md",
19
- "LICENSE"
20
- ],
21
- "pi": {
22
- "extensions": [
23
- "./dist/index.ts"
24
- ]
25
- },
26
- "scripts": {
27
- "build": "node scripts/build-runtime.mjs",
28
- "check": "npm run build && biome check --vcs-use-ignore-file=false src test scripts package.json tsconfig.json README.md && npm run typecheck",
29
- "format": "biome check --write --vcs-use-ignore-file=false src test scripts package.json tsconfig.json README.md",
30
- "prepack": "npm run build",
31
- "typecheck": "tsc --noEmit"
32
- },
33
- "peerDependencies": {
34
- "@earendil-works/pi-coding-agent": "*",
35
- "@earendil-works/pi-tui": "*"
36
- },
37
- "devDependencies": {
38
- "@biomejs/biome": "2.5.11",
39
- "@earendil-works/pi-coding-agent": "0.84.4",
40
- "@earendil-works/pi-tui": "0.84.4",
41
- "@types/node": "26.4.0",
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
- }
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
- text: string,
3
- colors: { fg?: string; bg?: string },
4
- trueColor = true,
5
- ): string {
6
- const codes = [
7
- colors.fg ? colorCode("38", colors.fg, trueColor) : undefined,
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
- return ansiStyle(text, { fg: hex }, trueColor);
11
+ return ansiStyle(text, { fg: hex }, trueColor);
16
12
  }
17
13
 
18
14
  function colorCode(prefix: "38" | "48", hex: string, trueColor: boolean): string {
19
- const { red, green, blue } = hexToRgb(hex);
20
- return trueColor
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
- const channels = [red, green, blue].map((value) => Math.round((value / 255) * 5));
27
- return 16 + 36 * (channels[0] ?? 0) + 6 * (channels[1] ?? 0) + (channels[2] ?? 0);
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
- const normalized = hex.replace(/^#/, "");
32
- return {
33
- red: Number.parseInt(normalized.slice(0, 2), 16),
34
- green: Number.parseInt(normalized.slice(2, 4), 16),
35
- blue: Number.parseInt(normalized.slice(4, 6), 16),
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
  }
@@ -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
- { 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" },
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
- const normalized = prefix.trim().toLowerCase();
11
- const matches = STATUSLINE_SUBCOMMANDS.filter((item) => item.value.startsWith(normalized));
12
- return matches.length > 0 ? [...matches] : null;
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
  }