dashboard: remove auto-gitignore — todo.txt stays tracked (versioned progress, visible to collaborators)

This commit is contained in:
2026-08-04 12:13:08 +10:00
parent 0d153a72b0
commit b13022a6fd

View File

@@ -52,44 +52,9 @@ const AUTO_ZELLIJ_NAME = /^[a-z]+-[a-z]+$/;
const SUBAGENT_NAME = /^.+?#[0-9a-f]{8}$/i; const SUBAGENT_NAME = /^.+?#[0-9a-f]{8}$/i;
// Project task file: lives at the root of the pi project's working directory // Project task file: lives at the root of the pi project's working directory
// so it is visible and discoverable. In git repos it is automatically added to // so it is visible and discoverable — and tracked in git when the project is
// .gitignore so task churn never pollutes commits or Hunk reviews. // a repo (versioned progress, visible to collaborators).
function gitRoot(dir: string): string | null {
let cur = dir;
for (;;) {
if (existsSync(join(cur, ".git"))) return cur;
const parent = join(cur, "..");
if (parent === cur) return null;
cur = parent;
}
}
function ensureTodoGitignored() {
const root = gitRoot(cwd());
if (!root) return; // not a git repo — nothing to ignore
const gi = join(root, ".gitignore");
let content = "";
if (existsSync(gi)) {
try {
content = readFileSync(gi, "utf-8");
} catch {
return;
}
}
const lines = content.split("\n");
if (lines.some((l) => l.trim() === "todo.txt" || l.trim() === "/todo.txt")) {
return;
}
const line = content === "" || content.endsWith("\n") ? "todo.txt\n" : "\ntodo.txt\n";
try {
writeFileSync(gi, content + line, "utf-8");
} catch {
// read-only repo — ignore; tasks still work, they just may show in git
}
}
function projectTodotxt(): string { function projectTodotxt(): string {
ensureTodoGitignored();
return join(cwd(), "todo.txt"); return join(cwd(), "todo.txt");
} }