brainiac-basecamp 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 630e96430ff517dde6be1c3766ad6f984bb86a4e0b876d55b5d2f205050fbc19
4
- data.tar.gz: b6711ef8f8fd3aec32b3f09aea604dee8c7d138f25f4cd03b94096a9787f218a
3
+ metadata.gz: 7fc3e97a3831ea52b8b8ed95e479cf1dcc04b8031d186d591cba88c04108b643
4
+ data.tar.gz: 8766b1a4a63878042b465994bff6665b02004a4ad0a1296d60ecfdc84673643f
5
5
  SHA512:
6
- metadata.gz: cb20e71bf28a7a66cd777245b1751ca363c13ac9062e113045c6316b921bc1ed794aa3f856a62d72f988699e452d4f5ef0ec1fb518d6c5b0324f3559ff4e387a
7
- data.tar.gz: f2ef017df5c1b146c31e16fcb030bdb660c13e97d336cb96735d848a278cfc657f9e0cad2d96d12269a79884426835157534f0ad6243fb111d6fa39dc5c68fc8
6
+ metadata.gz: f4a8e2e10898afd01360bed9d56316590288017be8003348ca3b9c85d561d58b22fe6afbc424fe10e1bbf7ab92aa67c674464d3e1ba402697873cd2ebb2beb03
7
+ data.tar.gz: 1964a896b5c3442bb0308c8f363a14dfd813e707086bb31bcea081cf7687b0ec26b3fbea4ddc9130c0f230e4d472e4d3a7dec2036e9f2721e09aaf0ea6864144
@@ -295,11 +295,15 @@ module Brainiac
295
295
  end
296
296
 
297
297
  # Dispatch a Fizzy card to the appropriate agent.
298
+ # Uses the project-specific agent if configured, otherwise falls back to the epic's agent.
298
299
  def dispatch_card(epic, task)
299
300
  card_number = task.fizzy_card
300
- agent = epic["agent"]
301
301
 
302
- LOG.info "[Basecamp:Orchestrator] Dispatching Fizzy card ##{card_number} to #{agent}" if defined?(LOG)
302
+ # Resolve agent from project config each project can have its own default agent
303
+ project_key = task.is_a?(Hash) ? task["project"] : task.project
304
+ agent = resolve_agent_for_project(project_key) || epic["agent"]
305
+
306
+ LOG.info "[Basecamp:Orchestrator] Dispatching Fizzy card ##{card_number} to #{agent} (project: #{project_key})" if defined?(LOG)
303
307
 
304
308
  # Mark as in-flight in our state
305
309
  epic_task = epic["tasks"].find { |t| t["fizzy_card"] == card_number }
@@ -464,6 +468,24 @@ module Brainiac
464
468
  @fizzy_users[name.downcase]
465
469
  end
466
470
 
471
+ # Resolve the default agent for a project from projects.json.
472
+ # Returns nil if no project-specific agent is configured.
473
+ #
474
+ # @param project_key [String, nil] Brainiac project key
475
+ # @return [String, nil] Agent name or nil
476
+ def resolve_agent_for_project(project_key)
477
+ return nil unless project_key
478
+
479
+ projects_file = File.join(BRAINIAC_DIR, "projects.json")
480
+ return nil unless File.exist?(projects_file)
481
+
482
+ projects = JSON.parse(File.read(projects_file))
483
+ projects.dig(project_key, "agent_name")
484
+ rescue StandardError => e
485
+ LOG.warn "[Basecamp:Orchestrator] Could not resolve agent for project #{project_key}: #{e.message}" if defined?(LOG)
486
+ nil
487
+ end
488
+
467
489
  # Resolve the brainiac project key for a Fizzy card by querying its tags.
468
490
  # Uses the same logic as brainiac-fizzy: card tags are matched against
469
491
  # each project's fizzy_tags configuration.
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Basecamp
6
- VERSION = "0.0.4"
6
+ VERSION = "0.0.5"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-basecamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis