Module: Brainiac::Plugins::Fizzy

Defined in:
lib/brainiac/plugins/fizzy.rb,
lib/brainiac/plugins/fizzy/hooks.rb,
lib/brainiac/plugins/fizzy/config.rb,
lib/brainiac/plugins/fizzy/helpers.rb,
lib/brainiac/plugins/fizzy/prompts.rb,
lib/brainiac/plugins/fizzy/version.rb,
lib/brainiac/plugins/fizzy/planning.rb

Defined Under Namespace

Modules: Config, Helpers, Hooks, Planning, Prompts

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.handle_publish_or_triage(action, payload) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/brainiac/plugins/fizzy.rb', line 176

def handle_publish_or_triage(action, payload)
  eventable = payload["eventable"] || {}
  card_number = eventable["number"]&.to_s

  if action == "card_triaged" && card_number
    return [200, { status: "ignored", reason: "self_move" }.to_json] if self_move_recent?(card_number)
    return [200, { status: "ignored", reason: "card_merged" }.to_json] if work_item_merged?(card_number)

    card_key = "card-#{card_number}"
    return [200, { status: "ignored", reason: "recently_completed" }.to_json] if recently_completed?(card_key)
  end

  if action == "card_published"
    assignees = eventable["assignees"] || []
    return handle_card_assigned(payload) if assignees.any? { |a| local_agent_names.include?(a["name"]) }
  end

  handle_card_published(payload)
end

.register(app) ⇒ Object

Called by Brainiac plugin system during server startup.

Parameters:

  • app (Sinatra::Application)

    The running Brainiac server



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/brainiac/plugins/fizzy.rb', line 26

def register(app)
  # Load Fizzy config
  Brainiac::Plugins::Fizzy::Config.load!

  # Register channel prompt
  Brainiac.register_channel_prompt(:fizzy,
                                   Brainiac::Plugins::Fizzy::Prompts::CHANNEL,
                                   pre_post_check: Brainiac::Plugins::Fizzy::Prompts::PRE_POST_CHECK)

  # Register lifecycle hooks
  Brainiac::Plugins::Fizzy::Hooks.register_all!

  # Set up webhook route
  setup_routes(app)

  LOG.info "[Fizzy] Plugin registered (webhook: /fizzy)"
end