pi-task-tracker 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/index.ts +14 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -42,7 +42,7 @@ function gitStatusSet(cwd: string): Map<string, string> {
42
42
  // status field and shifting the path by one. Read stdout raw instead.
43
43
  let out = "";
44
44
  try {
45
- const r = spawnSync("git", ["-c", "core.quotepath=false", "status", "--porcelain", "-uall"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
45
+ const r = spawnSync("git", ["--no-optional-locks", "-c", "core.quotepath=false", "status", "--porcelain", "-uall"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
46
46
  out = r.status === 0 ? r.stdout || "" : "";
47
47
  } catch {
48
48
  return new Map();
@@ -106,14 +106,20 @@ function findEnclosingRepo(dir: string): string | null {
106
106
  }
107
107
  }
108
108
 
109
+ // Repos whose identity was already ensured this process (git config persists,
110
+ // so one check per repo per pi session is enough - saves 2 spawns per repo
111
+ // per task).
112
+ const identityEnsured = new Set<string>();
109
113
  function ensureGitIdentity(cwd: string): void {
110
- // ensure local identity so commits never fail on a fresh machine
111
- if (!git(["config", "user.name"], cwd)) {
112
- gitOk(["config", "user.name", "Pi Agent"], cwd);
113
- }
114
- if (!git(["config", "user.email"], cwd)) {
115
- gitOk(["config", "user.email", "pi-agent@local"], cwd);
116
- }
114
+ if (identityEnsured.has(cwd)) return;
115
+ identityEnsured.add(cwd);
116
+ // ensure local identity so commits never fail on a fresh machine;
117
+ // one `config --list` spawn covers both keys
118
+ const cfg = git(["config", "--list"], cwd);
119
+ const hasName = cfg.split("\n").some((l) => l.startsWith("user.name="));
120
+ const hasEmail = cfg.split("\n").some((l) => l.startsWith("user.email="));
121
+ if (!hasName) gitOk(["config", "user.name", "Pi Agent"], cwd);
122
+ if (!hasEmail) gitOk(["config", "user.email", "pi-agent@local"], cwd);
117
123
  }
118
124
 
119
125
  const GITIGNORE_SEED =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-task-tracker",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Task workflow tracking for the pi coding agent: TODO/README maintenance, per-task git auto-commits as checkpoints, and an interactive /rollback. Hashline-aware, nested-repo aware, subagent-artifact-safe.",
5
5
  "keywords": [
6
6
  "pi-package",