dashboard: remove auto-gitignore — todo.txt stays tracked (versioned progress, visible to collaborators)
This commit is contained in:
@@ -52,44 +52,9 @@ const AUTO_ZELLIJ_NAME = /^[a-z]+-[a-z]+$/;
|
||||
const SUBAGENT_NAME = /^.+?#[0-9a-f]{8}$/i;
|
||||
|
||||
// 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
|
||||
// .gitignore so task churn never pollutes commits or Hunk reviews.
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// so it is visible and discoverable — and tracked in git when the project is
|
||||
// a repo (versioned progress, visible to collaborators).
|
||||
function projectTodotxt(): string {
|
||||
ensureTodoGitignored();
|
||||
return join(cwd(), "todo.txt");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user