Skip to content

Preserve user content in marker-less CLAUDE files during sync#353

Merged
bguidolim merged 1 commit into
mainfrom
bruno/preserve-markerless-claude-content
Jul 13, 2026
Merged

Preserve user content in marker-less CLAUDE files during sync#353
bguidolim merged 1 commit into
mainfrom
bruno/preserve-markerless-claude-content

Conversation

@bguidolim

Copy link
Copy Markdown
Collaborator

Summary

Syncing a tech pack into a pre-existing CLAUDE.md (global) or CLAUDE.local.md (project) that held hand-written rules but no mcs markers overwrote the whole file, keeping only the pack sections. A timestamped backup was written, but the live file lost the user's content. Both scopes now preserve that content the same way an already-managed file does.

Changes

  • A non-empty CLAUDE file without mcs markers is now preserved on sync: its existing content is kept and managed sections are appended below it, wrapped in markers. Re-syncing is idempotent.
  • Only an absent or whitespace-only file is composed from scratch.

Test plan

  • swift test passes locally
  • swiftformat --lint . and swiftlint pass without violations
  • Verified via integration coverage (pre-seeded marker-less file preserved through sync; single-pack swap that strips all markers keeps user prose) rather than a live pack.
Checklist for engine changes
  • Integration tests updated for new features (LifecycleIntegrationTests)

- Route a non-empty CLAUDE file without mcs markers through the update path so hand-written rules survive instead of being overwritten
- Append managed sections below preserved content; only nil/whitespace files fresh-compose
- Cover marker-less preservation, idempotency, and single-pack swap in unit + lifecycle tests
@bguidolim
bguidolim enabled auto-merge (squash) July 13, 2026 20:18
@bguidolim
bguidolim merged commit a0a3397 into main Jul 13, 2026
4 checks passed
@bguidolim
bguidolim deleted the bruno/preserve-markerless-claude-content branch July 13, 2026 20:20
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