@narumitw/pi-starship 0.29.0 → 0.34.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-starship",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Native Starship-style TOML statusline for the Pi coding agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@earendil-works/pi-tui": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@biomejs/biome": "2.5.
|
|
43
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
44
|
-
"@earendil-works/pi-tui": "0.
|
|
42
|
+
"@biomejs/biome": "2.5.5",
|
|
43
|
+
"@earendil-works/pi-coding-agent": "0.82.1",
|
|
44
|
+
"@earendil-works/pi-tui": "0.82.1",
|
|
45
45
|
"@types/node": "26.1.1",
|
|
46
46
|
"typescript": "7.0.2"
|
|
47
47
|
},
|
|
@@ -75,7 +75,7 @@ function packageNameForSource(source: string, baseDirectory: string): string | u
|
|
|
75
75
|
|
|
76
76
|
function npmPackageName(source: string): string {
|
|
77
77
|
const spec = source.slice("npm:".length);
|
|
78
|
-
if (spec.startsWith("@")) return spec.split("@").slice(0, 2).join("@")
|
|
78
|
+
if (spec.startsWith("@")) return spec.split("@").slice(0, 2).join("@");
|
|
79
79
|
return spec.split("@")[0] ?? spec;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -179,6 +179,6 @@ export function buildExtensionStatusIconAliases(
|
|
|
179
179
|
|
|
180
180
|
function npmPackageName(source: string): string {
|
|
181
181
|
const spec = source.slice("npm:".length);
|
|
182
|
-
if (spec.startsWith("@")) return spec.split("@").slice(0, 2).join("@")
|
|
182
|
+
if (spec.startsWith("@")) return spec.split("@").slice(0, 2).join("@");
|
|
183
183
|
return spec.split("@")[0] ?? spec;
|
|
184
184
|
}
|
|
@@ -198,14 +198,33 @@ export function parseGitStatusPorcelain(output: string): GitStatusSnapshot {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export function parseGitDiffShortstat(output: string): GitMetricsSnapshot {
|
|
201
|
-
const added = /(\d+) insertions?\(\+\)/u.exec(output)?.[1];
|
|
202
|
-
const deleted = /(\d+) deletions?\(-\)/u.exec(output)?.[1];
|
|
203
201
|
return {
|
|
204
|
-
added:
|
|
205
|
-
deleted:
|
|
202
|
+
added: parseShortstatMetric(output, "insertion(+)", "insertions(+)") ?? 0,
|
|
203
|
+
deleted: parseShortstatMetric(output, "deletion(-)", "deletions(-)") ?? 0,
|
|
206
204
|
};
|
|
207
205
|
}
|
|
208
206
|
|
|
207
|
+
function parseShortstatMetric(
|
|
208
|
+
output: string,
|
|
209
|
+
singularLabel: string,
|
|
210
|
+
pluralLabel: string,
|
|
211
|
+
): number | undefined {
|
|
212
|
+
for (const field of output.split(",")) {
|
|
213
|
+
const trimmed = field.trim();
|
|
214
|
+
const separator = trimmed.indexOf(" ");
|
|
215
|
+
if (separator <= 0) continue;
|
|
216
|
+
const label = trimmed.slice(separator + 1).trimStart();
|
|
217
|
+
if (label !== singularLabel && label !== pluralLabel) continue;
|
|
218
|
+
const countText = trimmed.slice(0, separator);
|
|
219
|
+
for (const character of countText) {
|
|
220
|
+
if (character < "0" || character > "9") return undefined;
|
|
221
|
+
}
|
|
222
|
+
const count = Number(countText);
|
|
223
|
+
return Number.isSafeInteger(count) ? count : undefined;
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
209
228
|
export function parseGitState(gitDirectory: string): GitStateSnapshot | undefined {
|
|
210
229
|
const rebaseMerge = join(gitDirectory, "rebase-merge");
|
|
211
230
|
if (existsSync(rebaseMerge))
|