Skip to content

feat: marker-aware merge for export-rules#32

Open
eyeondrive wants to merge 1 commit intovinilana:mainfrom
eyeondrive:feat/marker-aware-merge
Open

feat: marker-aware merge for export-rules#32
eyeondrive wants to merge 1 commit intovinilana:mainfrom
eyeondrive:feat/marker-aware-merge

Conversation

@eyeondrive
Copy link
Copy Markdown
Contributor

Summary

  • exportRules now detects <!-- GENERATED:AI-CONTEXT:START/END --> markers in existing target files and replaces only the generated section
  • Hand-written content outside the markers is preserved across re-exports
  • New files are automatically wrapped in markers so future exports merge safely
  • Adds generated tool export directories (.deepagent-desktop/, .agent/, .antigravity/) to .gitignore as these are per-user artifacts

Problem

exportRules used fs.writeFile to overwrite single-format targets (CLAUDE.md, AGENTS.md, .cursorrules, etc.), destroying any hand-written content. Users who maintained both hand-written rules and generated documentation in the same file had to manually re-add their content after every export.

The <!-- GENERATED:AI-CONTEXT:START/END --> marker convention existed as a documented workaround but the tool itself didn't honor it.

Test plan

  • Export rules to a CLAUDE.md that has hand-written content above/below markers — hand-written content preserved
  • Export rules to a new file with no markers — file gets wrapped in markers automatically
  • Re-export to the same file — only generated section updated, markers and surrounding content intact

🤖 Generated with Claude Code

exportRules previously used fs.writeFile to overwrite single-format
targets (CLAUDE.md, AGENTS.md, .cursorrules, etc.), destroying any
hand-written content. The <!-- GENERATED:AI-CONTEXT:START/END -->
marker convention existed as a manual workaround but the tool didn't
honor it.

Now: single-format exports detect markers in existing files and replace
only the generated section. Hand-written content outside markers is
preserved. New files are automatically wrapped in markers so future
exports merge safely.

Also adds generated tool export directories to .gitignore — these are
per-user artifacts from export-rules --preset all, not project source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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