Skip to content

Add apply --on-conflict, covering replace and update in tests - #11

Merged
donnes merged 1 commit into
mainfrom
conflict-flags
Oct 22, 2026
Merged

donnes merged 1 commit into
mainfrom
conflict-flags

Conversation

@donnes

@donnes donnes commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Problem

Outside a terminal, syncode can only keep a differing local file. Scripts and agents running syncode (over SSH, in CI, from a coding agent) have no way to settle conflicts. The same limit meant tests could never reach the replace and update paths, which are the riskiest file changes syncode makes. The review bug where "Replace" moved a symlink's target out of a dotfiles repo was only verified by hand in a pseudo-terminal.

Solution

apply and pull take --on-conflict keep|replace|update. With the flag, every conflict is settled that way without a prompt. Without it, behavior is unchanged: prompt in a terminal, keep otherwise. update on composed instructions falls back to keep, because those must be edited in instructions/. The prompt and the flag share one code path, so the tests cover what the prompt does.

This adds a user-facing option, so it's stacked last (on #10) and can be dropped on its own.

Verification

  • New tests: replace backs up a local file and moves a stow-style link to a file elsewhere as a link, leaving that file in place. update copies the local file into the repo. An invalid value exits 1.
  • With the review bug restored (move(current, …)), the replace test fails.
  • bun run check passes (12 tests).

🤖 Generated with Claude Code

Base automatically changed from release-scripts to main October 22, 2026 07:39
Conflicts outside a terminal could only be kept, so scripts and agents
running syncode had no way to settle them, and tests could never reach
the replace and update paths, the riskiest file changes syncode makes.
apply and pull now take --on-conflict keep|replace|update; prompts are
unchanged when the flag is omitted.

New tests cover replace backing up a local file and moving a link to a
file elsewhere as a link (they fail with the bug fixed in review), and
update copying the local file into the repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@donnes
donnes merged commit 58e922c into main Oct 22, 2026
4 checks passed
@donnes
donnes deleted the conflict-flags branch October 22, 2026 07:40
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