@d3ara1n/pi-editor-shell 0.8.0 → 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 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 + dirty state when in a repo). Session hit rate via `/editor-shell:status`.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-editor-shell",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "description": "Replaces pi's default editor and status bar with a unified rounded-corner shell embedding status info in the border",
6
6
  "keywords": [
package/src/config.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  * "project wins" design, no field-level merging.
7
7
  */
8
8
 
9
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
9
10
  import * as fs from "node:fs";
10
- import * as os from "node:os";
11
11
  import * as path from "node:path";
12
12
 
13
13
  /** Border icon slots that users can override. Each holds a single glyph
@@ -72,12 +72,6 @@ export const DEFAULT_CONFIG: EditorShellConfig = {
72
72
  modelDisplay: "name",
73
73
  };
74
74
 
75
- function getAgentDir(): string {
76
- const envDir = process.env.PI_AGENT_DIR;
77
- if (envDir) return envDir;
78
- return path.join(os.homedir(), ".pi", "agent");
79
- }
80
-
81
75
  /** Read the `editorShell` block from a settings file.
82
76
  * Returns undefined on missing file / parse error / non-object value —
83
77
  * pi surfaces its own settings errors, this loader stays lenient. */
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 / unstaged counts. */
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 !== " " && x !== "?" && x !== "!") staged++;
184
- if (y !== " ") unstaged++;
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 pi-style "+2 ~1" string (leading space), or "" if
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