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:
@@ -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/ ────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user