Class: Soba::Commands::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/soba/commands/init.rb

Constant Summary collapse

DEFAULT_CONFIG =
{
  'github' => {
    'token' => '${GITHUB_TOKEN}',
  },
  'workflow' => {
    'interval' => 20,
    'auto_merge_enabled' => true,
    'closed_issue_cleanup_enabled' => true,
    'closed_issue_cleanup_interval' => 300,
    'tmux_command_delay' => 3,
    'phase_labels' => {
      'todo' => 'soba:todo',
      'queued' => 'soba:queued',
      'planning' => 'soba:planning',
      'ready' => 'soba:ready',
      'doing' => 'soba:doing',
      'review_requested' => 'soba:review-requested',
      'reviewing' => 'soba:reviewing',
      'done' => 'soba:done',
      'requires_changes' => 'soba:requires-changes',
      'revising' => 'soba:revising',
      'merged' => 'soba:merged',
    },
  },
  'slack' => {
    'webhook_url' => '${SLACK_WEBHOOK_URL}',
    'notifications_enabled' => false,
  },
}.freeze
LABEL_COLORS =
{
  'todo' => '808080',            # Gray
  'queued' => '9370db',          # Medium Purple
  'planning' => '1e90ff',        # Blue
  'ready' => '228b22',           # Green
  'doing' => 'ffd700',           # Yellow
  'review_requested' => 'ff8c00', # Orange
  'reviewing' => 'ff6347',       # Tomato
  'done' => '32cd32',            # Lime Green
  'requires_changes' => 'dc143c', # Crimson
  'revising' => 'ff1493',        # Deep Pink
  'merged' => '6b8e23',          # Olive Drab
  'lgtm' => '00ff00',            # Pure Green
}.freeze
LABEL_DESCRIPTIONS =
{
  'todo' => 'To-do task waiting to be queued',
  'queued' => 'Queued for processing',
  'planning' => 'Planning phase',
  'ready' => 'Ready for implementation',
  'doing' => 'In progress',
  'review_requested' => 'Review requested',
  'reviewing' => 'Under review',
  'done' => 'Review completed',
  'requires_changes' => 'Changes requested',
  'revising' => 'Revising based on review feedback',
  'merged' => 'PR merged and issue closed',
  'lgtm' => 'PR approved for auto-merge',
}.freeze
DEFAULT_PHASE_CONFIG =
{
  'plan' => {
    'command' => 'claude',
    'options' => ['--dangerously-skip-permissions'],
    'parameter' => '/soba:plan {{issue-number}}',
  },
  'implement' => {
    'command' => 'claude',
    'options' => ['--dangerously-skip-permissions'],
    'parameter' => '/soba:implement {{issue-number}}',
  },
  'review' => {
    'command' => 'claude',
    'options' => ['--dangerously-skip-permissions'],
    'parameter' => '/soba:review {{issue-number}}',
  },
  'revise' => {
    'command' => 'claude',
    'options' => ['--dangerously-skip-permissions'],
    'parameter' => '/soba:revise {{issue-number}}',
  },
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(interactive: false) ⇒ Init

Returns a new instance of Init.



98
99
100
# File 'lib/soba/commands/init.rb', line 98

def initialize(interactive: false)
  @interactive = interactive
end

Instance Method Details

#executeObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/soba/commands/init.rb', line 102

def execute
  puts "šŸš€ Initializing soba configuration..."
  puts ""

  config_path = Pathname.pwd.join('.soba', 'config.yml')

  if config_path.exist?
    puts "āš ļø  Configuration file already exists at: #{config_path}"
    print "Do you want to overwrite it? (y/N): "
    response = $stdin.gets.chomp.downcase
    if response != 'y' && response != 'yes'
      puts "āœ… Configuration unchanged."
      return
    end
  end

  if @interactive
    execute_interactive(config_path)
  else
    execute_non_interactive(config_path)
  end
rescue Interrupt
  puts "\n\nāŒ Setup cancelled."
  raise Soba::CommandError, "Setup cancelled"
rescue StandardError => e
  puts "\nāŒ Error: #{e.message}"
  raise
end