MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / handleWorktreeStepResult

Method handleWorktreeStepResult

internal/tui/app.go:1656–1688  ·  view source on GitHub ↗

handleWorktreeStepResult handles the result of a worktree setup step.

(msg worktreeStepResultMsg)

Source from the content-addressed store, hash-verified

1654
1655// handleWorktreeStepResult handles the result of a worktree setup step.
1656func (a App) handleWorktreeStepResult(msg worktreeStepResultMsg) (tea.Model, tea.Cmd) {
1657 // Ignore results if we've already cancelled or left the spinner view
1658 if a.viewMode != ViewWorktreeSpinner || a.worktreeSpinner.IsCancelled() {
1659 return a, nil
1660 }
1661
1662 if msg.err != nil {
1663 a.worktreeSpinner.SetError(msg.err.Error())
1664 return a, nil
1665 }
1666
1667 switch msg.step {
1668 case SpinnerStepCreateBranch:
1669 // Branch creation completed - advance through both branch and worktree steps
1670 // (CreateWorktree does both in one call)
1671 a.worktreeSpinner.AdvanceStep() // Complete "Creating branch"
1672 a.worktreeSpinner.AdvanceStep() // Complete "Creating worktree"
1673
1674 // Check if we need to run setup
1675 if a.worktreeSpinner.HasSetupCommand() {
1676 return a, a.runWorktreeStep(SpinnerStepRunSetup, a.baseDir, a.pendingWorktreePath, "")
1677 }
1678
1679 // No setup - we're done, transition to loop
1680 return a.finishWorktreeSetup()
1681
1682 case SpinnerStepRunSetup:
1683 a.worktreeSpinner.AdvanceStep() // Complete "Running setup"
1684 return a.finishWorktreeSetup()
1685 }
1686
1687 return a, nil
1688}
1689
1690// finishWorktreeSetup completes the worktree setup and starts the loop.
1691func (a App) finishWorktreeSetup() (tea.Model, tea.Cmd) {

Callers 1

UpdateMethod · 0.95

Calls 6

runWorktreeStepMethod · 0.95
finishWorktreeSetupMethod · 0.95
IsCancelledMethod · 0.80
SetErrorMethod · 0.80
AdvanceStepMethod · 0.80
HasSetupCommandMethod · 0.80

Tested by

no test coverage detected