@narumitw/pi-statusline 0.49.3 → 0.49.4

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 CHANGED
@@ -35,7 +35,7 @@ A representative uncolored layout:
35
35
  pi install npm:@narumitw/pi-statusline
36
36
  ```
37
37
 
38
- Try the published package without installing, or use the build-aware recipe from this repository:
38
+ Try the published package without installing, or load it directly from this repository:
39
39
 
40
40
  ```bash
41
41
  pi -e npm:@narumitw/pi-statusline
@@ -335,11 +335,8 @@ Put transient activity in the value and always clear the same complete key.
335
335
 
336
336
  ```text
337
337
  extensions/pi-statusline/
338
- ├── dist/ # generated split runtime and source maps
339
- ├── scripts/
340
- │ └── build-runtime.mjs # deterministic bundler and eager-import validator
341
338
  ├── src/
342
- │ ├── index.ts # thin entrypoint forwarding to dist
339
+ │ ├── index.ts # thin entrypoint forwarding to the source runtime
343
340
  │ ├── statusline.ts # authoritative lifecycle implementation
344
341
  │ ├── command-contract.ts
345
342
  │ ├── render.ts
@@ -361,8 +358,8 @@ extensions/pi-statusline/
361
358
  └── package.json
362
359
  ```
363
360
 
364
- `src/` remains the authoritative implementation. The package build emits `dist/` before local
365
- loading or packing, while `src/index.ts` remains the sole declared Pi entrypoint.
361
+ `src/` is the authoritative published implementation, and `src/index.ts` remains the sole declared
362
+ Pi entrypoint.
366
363
 
367
364
  ## 🔎 Keywords
368
365
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-statusline",
3
- "version": "0.49.3",
3
+ "version": "0.49.4",
4
4
  "description": "Pi extension that replaces the footer with an information-rich statusline.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -13,8 +13,7 @@
13
13
  "footer"
14
14
  ],
15
15
  "files": [
16
- "src/index.ts",
17
- "dist",
16
+ "src",
18
17
  "README.md",
19
18
  "LICENSE"
20
19
  ],
@@ -24,10 +23,8 @@
24
23
  ]
25
24
  },
26
25
  "scripts": {
27
- "build": "node --test scripts/build-runtime.test.mjs && 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",
26
+ "check": "biome check --vcs-use-ignore-file=false src test package.json tsconfig.json README.md && npm run typecheck",
27
+ "format": "biome check --write --vcs-use-ignore-file=false src test package.json tsconfig.json README.md",
31
28
  "typecheck": "tsc --noEmit"
32
29
  },
33
30
  "peerDependencies": {
@@ -39,7 +36,6 @@
39
36
  "@earendil-works/pi-coding-agent": "0.83.0",
40
37
  "@earendil-works/pi-tui": "0.83.0",
41
38
  "@types/node": "26.1.2",
42
- "esbuild": "0.28.1",
43
39
  "typescript": "7.0.2"
44
40
  },
45
41
  "repository": {
package/src/ansi.ts ADDED
@@ -0,0 +1,26 @@
1
+ export function ansiStyle(text: string, colors: { fg?: string; bg?: string }): string {
2
+ const codes = [
3
+ colors.fg ? truecolorCode("38", colors.fg) : undefined,
4
+ colors.bg ? truecolorCode("48", colors.bg) : 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`;
8
+ }
9
+
10
+ export function ansiFg(hex: string, text: string): string {
11
+ return ansiStyle(text, { fg: hex });
12
+ }
13
+
14
+ function truecolorCode(prefix: "38" | "48", hex: string): string {
15
+ const { red, green, blue } = hexToRgb(hex);
16
+ return `${prefix};2;${red};${green};${blue}`;
17
+ }
18
+
19
+ function hexToRgb(hex: string): { red: number; green: number; blue: number } {
20
+ const normalized = hex.replace(/^#/, "");
21
+ return {
22
+ red: Number.parseInt(normalized.slice(0, 2), 16),
23
+ green: Number.parseInt(normalized.slice(2, 4), 16),
24
+ blue: Number.parseInt(normalized.slice(4, 6), 16),
25
+ };
26
+ }
@@ -0,0 +1,13 @@
1
+ import type { AutocompleteItem } from "@earendil-works/pi-tui";
2
+
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" },
7
+ ];
8
+
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;
13
+ }