Skip to content

Extract spawn operation to core/operations/spawn.ts #62

Description

@2witstudios

Epic 1: Core Operations Refactoring — Issue 4/4

Source: 1-agent worktree (wt-a6gki1)

Description

Move worktree creation + agent spawning from commands/spawn.ts into core/operations/spawn.ts. This is the most complex extraction — handles git worktree add, env setup, tmux, prompt files.

Acceptance Criteria

  • core/operations/spawn.ts exports a performSpawn() function with typed options
  • Handles full spawn pipeline: generate IDs → git worktree add → setup env → create tmux window → split panes → write prompt → send-keys → update manifest
  • Template variable rendering
  • Returns worktree + agent IDs + tmux targets
  • commands/spawn.ts simplified to arg parsing + calling performSpawn()
  • Tests: full spawn pipeline with mocked execa

Files to Create/Modify

  • src/core/operations/spawn.ts (new)
  • src/core/operations/spawn.test.ts (new)
  • src/commands/spawn.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