Class: Space::Architect::CLI::Architect::Status

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(space: nil, **opts) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/space_architect/cli/architect.rb', line 162

def call(space: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    render(store.find(space)) do |sp|
      project = ArchitectProject.new(space: sp)
      info = project.status
      block = info[:block]

      terminal.say "Project status:     #{block['status'] || '(none)'}"
      terminal.say "Current iteration:  #{block['current_iteration'] || '(none)'}"

      iterations = block["iterations"] || []
      if iterations.empty?
        terminal.say "Iterations:        (none)"
      else
        rows = iterations.map do |s|
          nn = s["ordinal"] ? format("%02d", s["ordinal"]) : "-"
          lane_list = s["lanes"] || []
          lanes_str = lane_list.map do |l|
            h = l["harness"] || "claude-code"
            m = l["model"]   || Harness.default_model_for(h)
            eff = l["effort"] ? "·#{l['effort']}" : ""
            "#{l['name']}(#{l['repo']}·#{h}·#{m}#{eff})"
          end.join(", ")
          lanes = lane_list.any? { |l| l["variant"] } ? "variant: #{lanes_str}" : lanes_str
          lanes = "#{lanes} → winner: #{s['winner']}" if s["winner"]
          verdict_str = if s["verdict"] && s["verdict"] != "pending"
            s["verdict"]
          elsif (s["lanes"] || []).any? { |l| l["integration_branch"] }
            "awaiting-verdict"
          else
            s["verdict"] || "-"
          end
          [nn, s["name"], s["freeze_sha"]&.[](0, 8) || "-", lanes, verdict_str]
        end
        terminal.say terminal.table(%w[II Iteration FreezeSHA Lanes Verdict], rows)
      end

      unless info[:iteration_files].empty?
        terminal.say "Iteration files:   #{info[:iteration_files].join(', ')}"
      end

      CLI.record_outcome(Outcome.new(exit_code: 0))
    end
  end
end