Class: Space::Architect::CLI::Architect::Worktree::Add

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_architect/cli/architect.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

commit_message_options, phase

Instance Method Details

#call(repo:, iteration:, lane:, space: nil, base: nil, harness: nil, model: nil, effort: nil, thinking: nil, reasoning: nil, quiet: false, touch: nil, force: false, **opts) ⇒ Object



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
# File 'lib/space_architect/cli/architect.rb', line 842

def call(repo:, iteration:, lane:, space: nil, base: nil, harness: nil, model: nil,
         effort: nil, thinking: nil, reasoning: nil, quiet: false, touch: nil, force: false, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    level = resolve_thinking_alias(effort: effort, thinking: thinking, reasoning: reasoning)
    render(store.find(space)) do |sp|
      project = ArchitectProject.new(space: sp)
      touch_set = touch ? touch.split(",").map(&:strip).reject(&:empty?) : nil
      err = quiet ? File.open(File::NULL, "w") : $stderr
      result = project.worktree_add(repo, iteration, lane, base: base, harness: harness, model: model,
                                   effort: level, touch: touch_set, force: force, err: err)
      terminal.say "Worktree: #{terminal.path(result[:worktree])}"
      terminal.say "Base SHA: #{result[:base_sha]}"
      terminal.say "Discarded #{result[:discarded]} uncommitted change(s), --force was given" if result[:discarded]
      CLI.record_outcome(Outcome.new(exit_code: 0))
    end
  end
end