fix(agents-init): fix gitignore duplicate entries, add block comment style

- Strip leading / from pattern before git check-ignore so root-anchored
  patterns like /AGENTS.md are checked as repo-relative paths (AGENTS.md)
  and correctly match existing rules — fixes duplicates on every run
- Rework helper to accept multiple patterns and write them as a single
  labeled block with project-style header/footer comment rather than
  appending bare patterns one at a time
- Move gitignore calls out of per-plug loop in --plugins mode so all
  three docs/ patterns are checked and written in one block
- Remove 5 duplicate bare entries left in .gitignore by the broken runs
This commit is contained in:
2026-06-12 23:30:12 -04:00
parent 3a054021cf
commit 9f9248deb1
2 changed files with 58 additions and 33 deletions
+2 -4
View File
@@ -208,9 +208,7 @@ function agents-init --description 'scaffold AGENTS/ sub-repo with agent spec fi
end
# ── .gitignore ────────────────────────────────────────────────────────
for pattern in "AGENTS/" "/AGENTS.md" "/CLAUDE.md"
_agents_init_ensure_gitignore "$root" "$pattern"
end
_agents_init_ensure_gitignore "$root" "agents-init --agents" "AGENTS/" "/AGENTS.md" "/CLAUDE.md"
end
# ─────────────────────────── --plugins mode ──────────────────────────────
@@ -266,8 +264,8 @@ function agents-init --description 'scaffold AGENTS/ sub-repo with agent spec fi
echo "$c_ok→ Linked docs/$plug → AGENTS/plugins/$plug$c_reset"
end
_agents_init_ensure_gitignore "$root" "docs/$plug"
end
_agents_init_ensure_gitignore "$root" "agents-init --plugins" "docs/superpowers" "docs/plans" "docs/specs"
end
# ──────────────────────── Auto-commit AGENTS/ ────────────────────────────