Skip to content

fix: prevent merge conflicts by deferring upstream creation to start#11

Merged
robmorgan merged 1 commit intomainfrom
fix/defer-upstream-creation
Feb 10, 2026
Merged

fix: prevent merge conflicts by deferring upstream creation to start#11
robmorgan merged 1 commit intomainfrom
fix/defer-upstream-creation

Conversation

@robmorgan
Copy link
Copy Markdown
Owner

Summary

  • Moved upstream bare repo creation from init to start so users can customize metamorph.toml and AGENT_PROMPT.md before the upstream snapshot is taken. Previously, init created the upstream immediately with stale templates, causing merge conflicts on first sync.
  • start now requires a clean working tree and creates the upstream from the committed project state on first run. Subsequent starts skip upstream creation.
  • SyncToProjectDir now aborts failed merges (git merge --abort) so the repo is never left in a broken merge state — it will retry cleanly on next sync.

Test plan

  • TestInitCreatesAllFiles — updated to no longer expect upstream dir
  • TestStartRejectsDirtyTree — verifies dirty tree is rejected with helpful message
  • TestStartCreatesUpstream — verifies upstream is created on first start --dry-run
  • TestSyncToProjectDir/aborts merge on conflict — verifies merge is aborted and MERGE_HEAD cleaned up
  • Manual: metamorph init → edit config → commit → metamorph start --dry-run → verify upstream created with customized config

🤖 Generated with Claude Code

Move upstream bare repo creation from `init` to `start` so users can
customize metamorph.toml and AGENT_PROMPT.md before the upstream snapshot
is taken. `start` now requires a clean working tree and creates the
upstream from the committed project state on first run.

Also abort failed merges in SyncToProjectDir so the repo is never left
in a broken merge state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@robmorgan robmorgan merged commit 8949746 into main Feb 10, 2026
1 of 2 checks passed
@robmorgan robmorgan deleted the fix/defer-upstream-creation branch February 10, 2026 07:44
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