@narumitw/pi-starship 0.22.0 → 0.28.0

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
@@ -75,10 +75,21 @@ format = "[ $symbol$branch$pr ]($style)"
75
75
 
76
76
  [extension_status]
77
77
  format = "([$statuses ]($style))"
78
- icons = { "github-pr" = "PR", "@narumitw/pi-goal" = "◎", fallback = "•" }
78
+ icons = { "github-pr" = "PR", "foo:*" = "🧪", "@narumitw/pi-goal" = "◎", fallback = "•" }
79
79
  ```
80
80
 
81
- All module tables support `format`, `symbol`, `style`, and `disabled`. `[extension_status].icons` additionally maps exact status keys or installed package IDs; `fallback` controls unmatched statuses.
81
+ All module tables support `format`, `symbol`, `style`, and `disabled`.
82
+ `[extension_status].icons` accepts arbitrary exact Pi status keys, explicit colon namespace
83
+ wildcards such as `foo:*`, and installed package IDs; `fallback` controls unmatched statuses. Icon
84
+ matching uses exact key, longest `:*` wildcard, unambiguous package alias, leading status emoji,
85
+ built-in icon, then `fallback`/`🔌`. An empty icon suppresses only the icon. `foo:*` matches
86
+ `foo:server` but not `foo`, `foobar`, or `foo/server`.
87
+
88
+ Pi does not expose which package owns a status, so package aliases are best-effort conveniences and
89
+ exact raw keys are the reliable third-party contract. Extension authors may adopt
90
+ `<extension-id>` or `<extension-id>:<stable-slot>` for interoperability, but pi-starship cannot
91
+ require that convention. Canonical built-ins use `sync` and `retry`; compatibility mappings keep
92
+ `pisync` and `unknown-error-retry` settings and older producer versions working.
82
93
 
83
94
  ## 🧩 Format grammar
84
95
 
@@ -151,6 +162,7 @@ Keep `extension_status` last in the catalog so earlier modules can consume exten
151
162
 
152
163
  ## 🗂️ Package layout
153
164
 
165
+ - `src/index.ts` — Pi package entrypoint.
154
166
  - `src/pi-starship.ts` — extension lifecycle and footer.
155
167
  - `src/config.ts` — TOML loading, validation, defaults, and persistence.
156
168
  - `src/format/` — native format/style parser and renderer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-starship",
3
- "version": "0.22.0",
3
+ "version": "0.28.0",
4
4
  "description": "Native Starship-style TOML statusline for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "pi": {
24
24
  "extensions": [
25
- "./src/pi-starship.ts"
25
+ "./src/index.ts"
26
26
  ]
27
27
  },
28
28
  "scripts": {
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./pi-starship.js";
@@ -1,19 +1,31 @@
1
1
  import { defineModule, type ExtensionStatusIconAliasMap } from "./types.js";
2
2
 
3
3
  const DEFAULT_EXTENSION_STATUS_ICONS: Record<string, string> = {
4
+ accounts: "👤",
5
+ caffeinate: "💊",
4
6
  "chrome-devtools": "🌐",
5
7
  "codex-usage": "📊",
6
- caffeinate: "💊",
7
8
  firecrawl: "🔥",
8
9
  "github-pr": "🔎",
9
10
  goal: "🎯",
11
+ "google-genai": "✨",
10
12
  lsp: "🧰",
11
13
  "plan-mode": "📝",
14
+ retry: "🔁",
12
15
  pisync: "🔄",
13
16
  subagents: "🧑‍🤝‍🧑",
17
+ sync: "🔄",
18
+ usage: "📊",
14
19
  "unknown-error-retry": "🔁",
15
20
  };
16
21
 
22
+ const COMPATIBLE_STATUS_ICON_KEYS: Readonly<Record<string, string>> = {
23
+ retry: "unknown-error-retry",
24
+ sync: "pisync",
25
+ "unknown-error-retry": "retry",
26
+ pisync: "sync",
27
+ };
28
+
17
29
  export const extensionStatusModule = defineModule({
18
30
  name: "extension_status",
19
31
  variables: ["symbol", "statuses", "count"],
@@ -64,6 +76,12 @@ function extensionStatusIcon(
64
76
  aliases: ExtensionStatusIconAliasMap,
65
77
  ): string {
66
78
  if (Object.hasOwn(configuredIcons, key)) return configuredIcons[key] ?? "";
79
+ const namespaceIcon = configuredNamespaceIcon(key, configuredIcons);
80
+ if (namespaceIcon !== undefined) return namespaceIcon;
81
+ const compatibleKey = COMPATIBLE_STATUS_ICON_KEYS[key];
82
+ if (compatibleKey && Object.hasOwn(configuredIcons, compatibleKey)) {
83
+ return configuredIcons[compatibleKey] ?? "";
84
+ }
67
85
  for (const alias of extensionStatusAliasesForKey(key, aliases)) {
68
86
  if (Object.hasOwn(configuredIcons, alias)) return configuredIcons[alias] ?? "";
69
87
  }
@@ -76,6 +94,20 @@ function extensionStatusIcon(
76
94
  return leadingIcon ?? defaultIcon ?? fallbackIcon ?? "🔌";
77
95
  }
78
96
 
97
+ function configuredNamespaceIcon(
98
+ key: string,
99
+ configuredIcons: Readonly<Record<string, string>>,
100
+ ): string | undefined {
101
+ let match: { baseLength: number; icon: string } | undefined;
102
+ for (const [selector, icon] of Object.entries(configuredIcons)) {
103
+ if (!selector.endsWith(":*")) continue;
104
+ const base = selector.slice(0, -2);
105
+ if (!base || !key.startsWith(`${base}:`)) continue;
106
+ if (!match || base.length > match.baseLength) match = { baseLength: base.length, icon };
107
+ }
108
+ return match?.icon;
109
+ }
110
+
79
111
  function extensionStatusAliasesForKey(
80
112
  key: string,
81
113
  aliases: ExtensionStatusIconAliasMap,