Skip to content

Extract merge operation to core/operations/merge.ts #59

Description

@2witstudios

Epic 1: Core Operations Refactoring — Issue 1/4

Source: 1-agent worktree (wt-a6gki1)

Description

Move merge orchestration (state transitions, git merge, cleanup) from commands/merge.ts into core/operations/merge.ts. The CLI command becomes a thin wrapper that parses args and calls the core operation.

Acceptance Criteria

  • core/operations/merge.ts exports a performMerge() function with typed options
  • State machine: active → merging → merged → cleaned
  • Supports both --squash and --no-ff merge strategies
  • commands/merge.ts simplified to arg parsing + calling performMerge()
  • Both CLI and future REST routes can call the same function
  • Tests: mock execa/manifest, verify state transitions, error handling for each state

Context

This is the single most important architectural contribution from the worktree review. The 1-agent worktree demonstrated that extracting shared business logic from CLI commands into core/operations/ enables both CLI and REST API to reuse the same orchestration without duplication.

Files to Create/Modify

  • src/core/operations/merge.ts (new)
  • src/core/operations/merge.test.ts (new)
  • src/commands/merge.ts (simplify)

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:core-operationsEpic 1: Core Operations RefactoringmobilePPG Mobile project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions