module RabbotMetaBuild
Constants
- IRC_BUILD_TAG
- IRC_TAG
- SNIPPET_LIMIT
- STYLE_BANNER
- STYLE_TITLE
- TEST_OUTPUT_PATTERN
Public Instance Methods
Source
# File lib/rabbot_meta_build.rb, line 36 def build_tagged_line(body) tagged_line(body, tag: IRC_BUILD_TAG) end
Source
# File lib/rabbot_meta_build.rb, line 141 def filter_progress_text(text) cleaned = text.to_s.strip return nil if cleaned.empty? return nil if cleaned.match?(TEST_OUTPUT_PATTERN) return nil if cleaned.match?(CursorAgentOutput::MARKER_LINE) return nil if cleaned.include?("```") line = cleaned.lines.map(&:strip).reject(&:empty?).first.to_s return nil if line.empty? || line.match?(TEST_OUTPUT_PATTERN) truncate_snippet(line) end
Source
# File lib/rabbot_meta_build.rb, line 120 def format_agent_done_reply(progress_label:, todos: nil) body = "#{progress_label} โ agent done, running tests..." if todos.is_a?(Array) && todos.any? completed = todos.count { |todo| todo[:status] == :completed } body = "#{body} (#{completed}/#{todos.length} tasks)" end build_tagged_line(body) end
Source
# File lib/rabbot_meta_build.rb, line 110 def format_build_conflict_reply(plugin_name:, reason:) IrcReply.card( tag: IRC_BUILD_TAG, title: "Build conflict โ #{plugin_name}", body_lines: [reason.to_s.strip], footer_parts: ["wait", "!rabbot plugincancel"], heading_style: STYLE_BANNER ) end
Source
# File lib/rabbot_meta_build.rb, line 74 def format_cancel_reply(vetor:, cleared_pending:, cleared_queued:, worker_running:) body = [] body << "Pending build plan cancelled." if cleared_pending if cleared_queued.positive? noun = cleared_queued == 1 ? "build" : "builds" body << "Dropped #{cleared_queued} queued #{noun}." end body << "Current build will finish (in-flight agent cannot be stopped)." if worker_running IrcReply.card( tag: IRC_BUILD_TAG, title: "Build cancelled", body_lines: body, footer_parts: ["cancelled", vetor.to_s], heading_style: STYLE_BANNER ) end
Source
# File lib/rabbot_meta_build.rb, line 52 def format_plan_question_reply(prompt:, options:, title: nil) question = prompt.to_s.strip lines = [] Array(options).each_with_index do |option, index| label = option[:label].to_s.strip label = option[:id].to_s.strip if label.empty? next if label.empty? letter = ("a".."z").to_a[index] || (index + 1).to_s lines << "#{letter}) #{label}" end lines << "Reply: !rabbot plugin a|b|c|1|2|3" if lines.any? IrcReply.card( tag: IRC_BUILD_TAG, title: title || "Build needs input", body_lines: [question].concat(lines).reject(&:empty?), footer_parts: ["plan", "awaiting admin", "!rabbot plugincancel to abort"], heading_style: STYLE_BANNER ) end
Source
# File lib/rabbot_meta_build.rb, line 129 def format_plan_ready_reply(progress_label:) build_tagged_line("#{progress_label} โ plan ready, implementing...") end
Source
# File lib/rabbot_meta_build.rb, line 154 def format_progress_update(text) filter_progress_text(text) end
Source
# File lib/rabbot_meta_build.rb, line 40 def format_start_reply(progress_label:, attempt:, max_attempts:, model:, target: nil) heading = if target.to_s.strip.empty? progress_label.to_s else "#{progress_label} โ #{target}" end [ build_tagged_line(IrcFormat.menu_heading(heading, style: STYLE_BANNER)), "Attempt #{attempt}/#{max_attempts} ยท #{model}" ].join("\n") end
Source
# File lib/rabbot_meta_build.rb, line 92 def format_stop_reply(vetor:, cleared_waiters:, active_plugin:) body = if cleared_waiters.positive? noun = cleared_waiters == 1 ? "reply" : "replies" ["Dropped #{cleared_waiters} queued plugin #{noun}."] else ["No queued replies."] end body << "Current reply will finish." if active_plugin IrcReply.card( tag: IRC_TAG, title: "Output queue cleared", body_lines: body, footer_parts: ["stopped", vetor.to_s], heading_style: STYLE_BANNER ) end
Source
# File lib/rabbot_meta_build.rb, line 133 def format_success_reply(stats_message:, agent_text: nil, undo_hint: nil) main = undo_hint.to_s.strip.empty? ? stats_message.to_s : "#{stats_message} โ #{undo_hint}" summary = CursorAgentOutput.format_summary_text(agent_text) return main if summary.to_s.strip.empty? "#{summary}\n#{main}" end
Source
# File lib/rabbot_meta_build.rb, line 25 def split_reply_lines(text) text.to_s.split("\n").map(&:rstrip).reject(&:empty?) end
Source
# File lib/rabbot_meta_build.rb, line 29 def tagged_line(body, tag: IRC_TAG) text = body.to_s.strip return IrcFormat.tag(tag, style: STYLE_TITLE) if text.empty? "#{IrcFormat.tag(tag, style: STYLE_TITLE)} #{text}" end
Source
# File lib/rabbot_meta_build.rb, line 158 def truncate_snippet(text, limit: SNIPPET_LIMIT) line = text.to_s.strip return nil if line.empty? line.length > limit ? "#{line[0, limit - 3]}..." : line end