Skip to content

fix: stop adding agent context files to .gitignore - #84

Open
claytoncollie wants to merge 1 commit into
mainfrom
fix/keep-agent-context-files-tracked
Open

claytoncollie wants to merge 1 commit into
mainfrom
fix/keep-agent-context-files-tracked

Conversation

@claytoncollie

@claytoncollie claytoncollie commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Problem

When Agent Tools is enabled, the add-on adds each agent's context file to the project .gitignore, next to the MCP config:

  • claude.mcp.json, CLAUDE.md
  • cursor.cursorrules
  • windsurf.windsurfrules

Those context files are human-authored. Projects usually commit them (a shared CLAUDE.md, a team .cursorrules). The add-on only writes a marked <!-- >>> Agent Tools --> section into the file. It does not own the whole file. Two problems follow:

  1. If the file is already tracked, the .gitignore line does nothing. Git keeps tracking the file, so the entry is misleading.
  2. It invites someone to run git rm --cached CLAUDE.md, which drops a shared project doc.

I hit this on a WordPress project whose tracked CLAUDE.md landed under the add-on's ignore block after an upgrade.

Fix

Only the machine-generated MCP config files stay in .gitignore. Context files leave gitignoreEntries:

  • claude['.mcp.json']
  • cursor[]
  • windsurf[]
  • vscode → unchanged ([])

I also tightened the gitignoreEntries doc comment so the intent is explicit.

Tests

typecheck, eslint, prettier --check, and test:unit (135 passing) are green. No test asserted the context-file ignore, so none needed changing.

CLAUDE.md, .cursorrules, and .windsurfrules are human-authored context
files that projects usually commit. The add-on only writes a marked
section into them, so listing them in .gitignore is misleading and does
nothing for a file that is already tracked. Keep only the machine-
generated MCP config files ignored.
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 53.39% (🎯 40%) 299 / 560
🟢 Statements 53.25% (🎯 40%) 311 / 584
🟢 Functions 63.73% (🎯 40%) 58 / 91
🟢 Branches 46.06% (🎯 25%) 164 / 356
File CoverageNo changed files found.
Generated in workflow #34 for commit 1342106 by the Vitest Coverage Report Action

@claytoncollie

Copy link
Copy Markdown
Contributor Author

@christianc1 Do you remember why we git ignoreed these rule files in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant