@narumitw/pi-starship 0.57.0 → 0.59.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 +26 -2
- package/dist/chunks/{chunk-W2IYFPT4.ts → chunk-MTFSZ63Q.ts} +43 -21
- package/dist/chunks/chunk-MTFSZ63Q.ts.map +7 -0
- package/dist/chunks/{commands-TW2O3UVA.ts → commands-M6GHLJIR.ts} +326 -16
- package/dist/chunks/commands-M6GHLJIR.ts.map +7 -0
- package/dist/index.ts +2 -2
- package/package.json +5 -5
- package/skills/configuring-pi-starship/references/configuration.md +10 -3
- package/skills/configuring-pi-starship/references/module-catalog.md +1 -0
- package/src/command-configuration.ts +12 -0
- package/src/command-gist.ts +208 -0
- package/src/commands.ts +44 -6
- package/src/config.ts +18 -1
- package/src/effective-config.ts +1 -0
- package/src/gist.ts +133 -0
- package/src/modules/extension-status.ts +27 -17
- package/src/modules/render.ts +16 -5
- package/src/modules/types.ts +5 -3
- package/dist/chunks/chunk-W2IYFPT4.ts.map +0 -7
- package/dist/chunks/commands-TW2O3UVA.ts.map +0 -7
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ The extension parses and renders the footer itself, so it does not need the `sta
|
|
|
17
17
|
- Wraps native multiline layouts to terminal width instead of truncating them.
|
|
18
18
|
- Keeps rendering pure while refreshing filesystem, process, and network-derived data through bounded caches.
|
|
19
19
|
- Uses `/starship` for presets, preview, configuration health, searchable module details, customization, and recovery.
|
|
20
|
+
- Shares settings through unlisted GitHub Gists and reviews imported settings before replacement.
|
|
20
21
|
- Bundles the authoritative configuration skill and references for editing `pi-starship.toml` or answering setup questions.
|
|
21
22
|
- Loads a generated split runtime to reduce Pi package startup work.
|
|
22
23
|
|
|
@@ -70,7 +71,7 @@ It does not cover general TOML, shell Starship configuration, extension source d
|
|
|
70
71
|
|
|
71
72
|
All routes support TUI and RPC with the exceptions above and reject unknown or trailing arguments.
|
|
72
73
|
Print and JSON modes produce no command output; the footer runs only in TUI mode.
|
|
73
|
-
Preset selection, module inspection, and recovery are menu-only, not extra subcommands.
|
|
74
|
+
Preset selection, module inspection, Gist sharing and import, and recovery are menu-only, not extra subcommands.
|
|
74
75
|
Restoring built-in configuration requires an existing settings document to replace; see [Settings](#-settings).
|
|
75
76
|
|
|
76
77
|
## ⚙️ Settings
|
|
@@ -96,10 +97,33 @@ format = "$model$directory$git_branch"
|
|
|
96
97
|
style = "bold blue"
|
|
97
98
|
```
|
|
98
99
|
|
|
99
|
-
Provider, model, and thinking modules also accept ordered exact-match `style_rules
|
|
100
|
+
Provider, model, and thinking modules also accept ordered exact-match `style_rules`.
|
|
101
|
+
For per-extension status colors, add `[extension_status.styles]` entries using raw Pi status keys (or `namespace:*`); unmatched statuses keep the module style.
|
|
102
|
+
See [Configuration and format](./skills/configuring-pi-starship/references/configuration.md) for examples and matching rules.
|
|
100
103
|
Use `/starship` for interactive configuration, preview, diagnostics, presets, and recovery.
|
|
101
104
|
Manual file edits load at the next `session_start`, including `/reload`.
|
|
102
105
|
|
|
106
|
+
## 🔗 Share and import settings
|
|
107
|
+
|
|
108
|
+
In TUI mode, open `/starship` → **Configuration** and select **Share settings as Gist…** or **Import settings from Gist…**.
|
|
109
|
+
Install GitHub CLI (`gh`) and run `gh auth login` for github.com with Gist access first; pi-starship uses that authentication and stores no GitHub credentials.
|
|
110
|
+
|
|
111
|
+
Sharing reviews the exact loaded TOML, including comments and unknown fields, then asks permission to upload a new unlisted Gist with a `pi-starship.toml` file.
|
|
112
|
+
With no settings file, it shares the built-in example without creating a local file.
|
|
113
|
+
**Unlisted is not private: anyone with the link can read it. Remove secrets and local paths before sharing.**
|
|
114
|
+
The result is a shareable Gist URL; existing Gists are never updated.
|
|
115
|
+
|
|
116
|
+
Import accepts a Gist ID or an `https://gist.github.com/<owner>/<id>` link and reads only `pi-starship.toml`.
|
|
117
|
+
It validates the TOML, shows the full document for review, then previews the footer and asks permission to replace the entire local settings document.
|
|
118
|
+
Review untrusted settings carefully: they can enable command execution and network requests.
|
|
119
|
+
A successful import applies immediately, preserves the imported bytes, and keeps no backup; application failure attempts to restore the previous document and footer.
|
|
120
|
+
Concurrent in-process settings changes or disk changes during review block the import; this is not a cross-process lock.
|
|
121
|
+
|
|
122
|
+
Only github.com Gists are supported, with a 64 KiB document limit, a 512 KiB API response limit, and a 30-second request timeout.
|
|
123
|
+
Incomplete or truncated files are rejected without following raw-file URLs.
|
|
124
|
+
Escape or Ctrl+C cancels a request, and session replacement or shutdown stops owned work.
|
|
125
|
+
Cancelling or losing an upload response cannot undo a Gist already created on GitHub: check your Gists before retrying.
|
|
126
|
+
|
|
103
127
|
## 🔒 Security and privacy
|
|
104
128
|
|
|
105
129
|
Some opt-in modules read local development, deployment, cloud, host, or user metadata, run bounded local commands, or query GitHub through `gh`.
|
|
@@ -1068,13 +1068,19 @@ var extensionStatusModule = defineModule({
|
|
|
1068
1068
|
style: "dimmed white",
|
|
1069
1069
|
disabled: false
|
|
1070
1070
|
},
|
|
1071
|
-
values: ({ runtime, extensionStatus }) => {
|
|
1072
|
-
const statuses = [...runtime.extensionStatuses.entries()].filter(([key, value]) => key !== "starship" && value.trim()).map(([key, value]) => formatExtensionStatus(key, value, extensionStatus.icons)
|
|
1071
|
+
values: ({ runtime, extensionStatus, palette }) => {
|
|
1072
|
+
const statuses = [...runtime.extensionStatuses.entries()].filter(([key, value]) => key !== "starship" && value.trim()).slice(0, extensionStatus.maxStatuses).map(([key, value]) => ({ key, text: formatExtensionStatus(key, value, extensionStatus.icons) }));
|
|
1073
1073
|
if (statuses.length === 0) return void 0;
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1074
|
+
const { separator, styles } = extensionStatus;
|
|
1075
|
+
const content = Object.keys(styles).length === 0 ? statuses.map(({ text }) => text).join(separator) : statuses.flatMap(({ key, text }, index) => {
|
|
1076
|
+
const configured = configuredStatusValue(key, styles);
|
|
1077
|
+
const style = configured ?? (Object.hasOwn(styles, "fallback") ? styles.fallback : void 0);
|
|
1078
|
+
return [
|
|
1079
|
+
...index > 0 ? [{ text: separator }] : [],
|
|
1080
|
+
{ text, style: style === void 0 ? void 0 : parseStyle(style, palette) ?? {} }
|
|
1081
|
+
];
|
|
1082
|
+
});
|
|
1083
|
+
return { statuses: content, count: `${statuses.length}` };
|
|
1078
1084
|
}
|
|
1079
1085
|
});
|
|
1080
1086
|
function formatExtensionStatus(key, value, configuredIcons) {
|
|
@@ -1084,21 +1090,21 @@ function formatExtensionStatus(key, value, configuredIcons) {
|
|
|
1084
1090
|
return icon ? `${icon} ${text}` : text;
|
|
1085
1091
|
}
|
|
1086
1092
|
function extensionStatusIcon(key, leadingIcon, configuredIcons) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
return leadingIcon ?? fallbackIcon ?? "\u{1F50C}";
|
|
1093
|
+
const configured = configuredStatusValue(key, configuredIcons);
|
|
1094
|
+
if (configured !== void 0) return configured;
|
|
1095
|
+
const fallback = Object.hasOwn(configuredIcons, "fallback") ? configuredIcons.fallback : void 0;
|
|
1096
|
+
return leadingIcon ?? fallback ?? "\u{1F50C}";
|
|
1092
1097
|
}
|
|
1093
|
-
function
|
|
1098
|
+
function configuredStatusValue(key, configured) {
|
|
1099
|
+
if (Object.hasOwn(configured, key)) return configured[key];
|
|
1094
1100
|
let match;
|
|
1095
|
-
for (const [selector,
|
|
1101
|
+
for (const [selector, value] of Object.entries(configured)) {
|
|
1096
1102
|
if (!selector.endsWith(":*")) continue;
|
|
1097
1103
|
const base = selector.slice(0, -2);
|
|
1098
1104
|
if (!base || !key.startsWith(`${base}:`)) continue;
|
|
1099
|
-
if (!match || base.length > match.baseLength) match = { baseLength: base.length,
|
|
1105
|
+
if (!match || base.length > match.baseLength) match = { baseLength: base.length, value };
|
|
1100
1106
|
}
|
|
1101
|
-
return match?.
|
|
1107
|
+
return match?.value;
|
|
1102
1108
|
}
|
|
1103
1109
|
function splitExtensionStatusIcon(value) {
|
|
1104
1110
|
const trimmed = value.trim();
|
|
@@ -1733,7 +1739,7 @@ var BUILT_IN_CONFIG = {
|
|
|
1733
1739
|
palette: void 0,
|
|
1734
1740
|
palettes: {},
|
|
1735
1741
|
modules: BUILT_IN_MODULES,
|
|
1736
|
-
extensionStatus: { separator: " \u2022 ", maxStatuses: 5, icons: {} }
|
|
1742
|
+
extensionStatus: { separator: " \u2022 ", maxStatuses: 5, icons: {}, styles: {} }
|
|
1737
1743
|
};
|
|
1738
1744
|
var BUILT_IN_EXAMPLE = `# Native Pi modules with Starship-compatible format and style syntax.
|
|
1739
1745
|
${BUILT_IN_FORMAT_DOCUMENT}
|
|
@@ -1894,6 +1900,7 @@ function normalizeModule(name, value, config, diagnostics) {
|
|
|
1894
1900
|
known.add("separator");
|
|
1895
1901
|
known.add("max_statuses");
|
|
1896
1902
|
known.add("icons");
|
|
1903
|
+
known.add("styles");
|
|
1897
1904
|
}
|
|
1898
1905
|
for (const key of Object.keys(value)) {
|
|
1899
1906
|
if (!known.has(key)) diagnostics.push(unknownDiagnostic(`${name}.${key}`));
|
|
@@ -1988,6 +1995,20 @@ function normalizeModule(name, value, config, diagnostics) {
|
|
|
1988
1995
|
);
|
|
1989
1996
|
}
|
|
1990
1997
|
}
|
|
1998
|
+
if (value.styles !== void 0) {
|
|
1999
|
+
if (!isRecord(value.styles)) diagnostics.push(typeDiagnostic("extension_status.styles", "table"));
|
|
2000
|
+
else {
|
|
2001
|
+
config.extensionStatus.styles = Object.fromEntries(
|
|
2002
|
+
Object.entries(value.styles).flatMap(([key, style]) => {
|
|
2003
|
+
if (typeof style === "string" && isValidStyle(style, activePalette(config))) return [[key, style]];
|
|
2004
|
+
diagnostics.push(
|
|
2005
|
+
diagnostic("warning", `extension_status.styles.${key}`, "Expected a valid Starship style string; ignored")
|
|
2006
|
+
);
|
|
2007
|
+
return [];
|
|
2008
|
+
})
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
1991
2012
|
}
|
|
1992
2013
|
function validateConfigDocument(settingsPath, rawDocument) {
|
|
1993
2014
|
let parsed;
|
|
@@ -2080,7 +2101,8 @@ function cloneBuiltInConfig() {
|
|
|
2080
2101
|
),
|
|
2081
2102
|
extensionStatus: {
|
|
2082
2103
|
...BUILT_IN_CONFIG.extensionStatus,
|
|
2083
|
-
icons: { ...BUILT_IN_CONFIG.extensionStatus.icons }
|
|
2104
|
+
icons: { ...BUILT_IN_CONFIG.extensionStatus.icons },
|
|
2105
|
+
styles: { ...BUILT_IN_CONFIG.extensionStatus.styles }
|
|
2084
2106
|
}
|
|
2085
2107
|
};
|
|
2086
2108
|
}
|
|
@@ -2318,11 +2340,10 @@ function renderStatusline(config, runtime, width = 80, trueColor = true) {
|
|
|
2318
2340
|
for (const definition of MODULE_DEFINITIONS) {
|
|
2319
2341
|
const name = definition.name;
|
|
2320
2342
|
const module = config.modules[name];
|
|
2321
|
-
const values = definition.values(valueContext(config, name, runtime));
|
|
2343
|
+
const values = definition.values(valueContext(config, name, runtime, palette));
|
|
2322
2344
|
if (!values) continue;
|
|
2323
2345
|
const styleContext = {
|
|
2324
2346
|
runtime,
|
|
2325
|
-
values,
|
|
2326
2347
|
style: module.style,
|
|
2327
2348
|
styles: module.styles,
|
|
2328
2349
|
display: module.display
|
|
@@ -2354,9 +2375,10 @@ function renderStatusline(config, runtime, width = 80, trueColor = true) {
|
|
|
2354
2375
|
modules
|
|
2355
2376
|
};
|
|
2356
2377
|
}
|
|
2357
|
-
function valueContext(config, name, runtime) {
|
|
2378
|
+
function valueContext(config, name, runtime, palette) {
|
|
2358
2379
|
return {
|
|
2359
2380
|
runtime,
|
|
2381
|
+
palette,
|
|
2360
2382
|
symbol: config.modules[name].symbol,
|
|
2361
2383
|
options: config.modules[name].options,
|
|
2362
2384
|
extensionStatus: config.extensionStatus
|
|
@@ -2538,4 +2560,4 @@ export {
|
|
|
2538
2560
|
inspectStatuslineModules,
|
|
2539
2561
|
inspectUnavailableModules
|
|
2540
2562
|
};
|
|
2541
|
-
//# sourceMappingURL=chunk-
|
|
2563
|
+
//# sourceMappingURL=chunk-MTFSZ63Q.ts.map
|