Skip to content

fix(#814): plain sync preserves CUSTOMIZABLE_FILES (constitution) - #815

Merged
admarble merged 3 commits into
mainfrom
feature/814-fix-sync-plain-sync-overwrites-customizable-files-
Jul 26, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/814-fix-sync-plain-sync-overwrites-customizable-files-

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Plain sequant sync silently overwrote .claude/memory/constitution.md (and any CUSTOMIZABLE_FILES entry) with the rendered template, destroying in-place project edits — no --force required. sync set copyTemplates({ force: true }) unconditionally, and copyDir wrote every template file with no existence/diff/customizable check — it never consulted isCustomizableFile (whose sole consumer was the diff path). #708 fixed this for update but left sync destructive.

  • Separate the two conflated notions of "force": copyTemplates gains overwriteCustomizable, distinct from force. force refreshes the managed skills/agents/hooks trees; overwriteCustomizable gates clobbering user-owned files. Only an explicit sync --force sets it.
  • copyDir preserves an existing, differing customizable file unless opted in, and returns the preserved set. Plain sync reports each preserved file (preserved: … — run \sync --force` to replace); sync --force` announces the overwrite on stdout before writing.
  • --dry-run preview mirrors the preserved/overwritten split so it can't diverge from the apply path (update: --dry-run reports "0 modified" but apply rewrites every SKILL.md (dry-run vs apply divergence) #722).

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Plain sync preserves differing CUSTOMIZABLE_FILES; trees still refresh ✅ templates.ts copyDir guard; test preserves an in-place customized constitution
AC-2 copyTemplates opt-in separate from force ✅ overwriteCustomizable option; test overwrites … only when overwriteCustomizable is set — not force
AC-3 sync --force overwrites and says so on stdout before writing ✅ sync.ts force-announce; test announces customizable overwrites on stdout before copying under --force
AC-4 Plain sync reports each preserved file ✅ sync.ts preserved report; test reports preserved customizable files on stdout under a plain sync
AC-5 Missing customizable file still created on fresh install ✅ test creates a missing constitution on a fresh install
AC-6 Round-trip test: customize → sync survives → sync --force replaces ✅ test pins the round trip: plain copy preserves, opt-in replaces
AC-7 docs/guides/customization.md states real --force semantics ✅ "Edit it in place (safe)" section

Test plan

  • npm run build — passes
  • npm run lint — passes
  • npx vitest run src/lib/templates.test.ts src/commands/sync.test.ts — 57 passed
  • src/lib src/commands suites — pass (one pre-existing, unrelated prompt-wait.test.ts timer flake, fails on base too)

Closes #814

🤖 Generated with Claude Code

…eCustomizable from force

`sync` set copyTemplates({ force: true }) unconditionally, and copyDir wrote
every template with no existence/diff/customizable check — it never consulted
isCustomizableFile. So a plain `sequant sync` silently rewrote the constitution
back to the template, destroying in-place edits with no --force required.

Separate the two conflated notions of "force":
- copyTemplates gains `overwriteCustomizable`, distinct from `force`. `force`
  refreshes the managed skills/agents/hooks trees; overwriteCustomizable gates
  clobbering user-owned CUSTOMIZABLE_FILES. Only an explicit `sync --force` sets it.
- copyDir preserves an existing, differing customizable file unless opted in,
  and returns the preserved set.
- Plain sync reports each preserved file; sync --force announces the overwrite
  on stdout before writing. A missing file is still created on fresh install.
- --dry-run preview mirrors the preserved/overwritten split so it can't diverge
  from the apply path (#722).
- docs/guides/customization.md documents the real --force semantics.

Written against the CUSTOMIZABLE_FILES list, not the single constitution path.

Entire-Checkpoint: d68cad9bd2ac
admarble added 2 commits July 26, 2026 12:15
…plain-sync-overwrites-customizable-files-

# Conflicts:
#	CHANGELOG.md
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.

fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile

1 participant