@d3ara1n/pi-editor-shell 0.8.1 → 0.8.2
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 +1 -1
- package/package.json +1 -1
- package/src/index.ts +14 -7
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Replaces pi's default editor and status bar with a unified rounded-corner shell
|
|
|
5
5
|
## What shows up where
|
|
6
6
|
|
|
7
7
|
- **Top border** — ` model · thinking-level ` (left) + pinned extension statuses (right, via `pinnedStatus` config)
|
|
8
|
-
- **Bottom border** — ` ctx NN%/NNk|N.NM · ⚡ cacheRead (total) hitRate% ` (left) + ` ~/Projects (main +2 ~1) ` (right, shows git branch
|
|
8
|
+
- **Bottom border** — ` ctx NN%/NNk|N.NM · ⚡ cacheRead (total) hitRate% ` (left) + ` ~/Projects (main +2 ~1 *4) ` (right, shows git branch plus staged, unstaged, and untracked file counts when in a repo). Session hit rate via `/editor-shell:status`.
|
|
9
9
|
- **Below shell** — Auto-wrapping extension status line (all `setStatus` entries not pinned to the top)
|
|
10
10
|
- **Border color** follows pi's thinking-level / bash-mode indicator automatically.
|
|
11
11
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -166,24 +166,30 @@ function formatTokens(n: number): string {
|
|
|
166
166
|
interface GitDirty {
|
|
167
167
|
staged: number;
|
|
168
168
|
unstaged: number;
|
|
169
|
+
untracked: number;
|
|
169
170
|
}
|
|
170
171
|
let _gitDirty: GitDirty | undefined;
|
|
171
172
|
|
|
172
|
-
/** Parse `git status --porcelain` output into staged
|
|
173
|
+
/** Parse `git status --porcelain` output into staged, unstaged, and untracked counts. */
|
|
173
174
|
function parseGitPorcelain(stdout: string): GitDirty {
|
|
174
175
|
const lines = stdout.trim();
|
|
175
|
-
if (!lines) return { staged: 0, unstaged: 0 };
|
|
176
|
+
if (!lines) return { staged: 0, unstaged: 0, untracked: 0 };
|
|
176
177
|
|
|
177
178
|
let staged = 0;
|
|
178
179
|
let unstaged = 0;
|
|
180
|
+
let untracked = 0;
|
|
179
181
|
for (const line of lines.split("\n")) {
|
|
180
182
|
if (line.length < 2) continue;
|
|
181
183
|
const x = line[0];
|
|
182
184
|
const y = line[1];
|
|
183
|
-
if (x
|
|
184
|
-
|
|
185
|
+
if (x === "?" && y === "?") {
|
|
186
|
+
untracked++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (x !== " " && x !== "!") staged++;
|
|
190
|
+
if (y !== " " && y !== "!") unstaged++;
|
|
185
191
|
}
|
|
186
|
-
return { staged, unstaged };
|
|
192
|
+
return { staged, unstaged, untracked };
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
/** Run `git status --porcelain` asynchronously so a slow / hanging git never
|
|
@@ -218,13 +224,14 @@ function refreshGitDirty(cwd: string, onDone?: () => void): void {
|
|
|
218
224
|
child.on("close", (code) => settle(code === 0, stdout));
|
|
219
225
|
}
|
|
220
226
|
|
|
221
|
-
/** Format dirty state as
|
|
222
|
-
* clean / unknown — ready to splice into a "(branch…)" segment. */
|
|
227
|
+
/** Format dirty state as "+staged ~unstaged *untracked" (leading space), or ""
|
|
228
|
+
* if clean / unknown — ready to splice into a "(branch…)" segment. */
|
|
223
229
|
function gitDirtyDisplay(): string {
|
|
224
230
|
if (!_gitDirty) return "";
|
|
225
231
|
const parts: string[] = [];
|
|
226
232
|
if (_gitDirty.staged > 0) parts.push(`+${_gitDirty.staged}`);
|
|
227
233
|
if (_gitDirty.unstaged > 0) parts.push(`~${_gitDirty.unstaged}`);
|
|
234
|
+
if (_gitDirty.untracked > 0) parts.push(`*${_gitDirty.untracked}`);
|
|
228
235
|
return parts.length ? ` ${parts.join(" ")}` : "";
|
|
229
236
|
}
|
|
230
237
|
|