brainiac-basecamp 0.0.4 → 0.0.6

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: a07338e5677f448dd7b2fb15bb345009532fef8669fc375526738a8cf0eaf24d
4
+ data.tar.gz: 8d2aaabe74e5d02a770a3f38366287362aeab07dea91954f3ca54e9ae71ef17d
5
5
  SHA512:
6
- metadata.gz: cb20e71bf28a7a66cd777245b1751ca363c13ac9062e113045c6316b921bc1ed794aa3f856a62d72f988699e452d4f5ef0ec1fb518d6c5b0324f3559ff4e387a
7
- data.tar.gz: f2ef017df5c1b146c31e16fcb030bdb660c13e97d336cb96735d848a278cfc657f9e0cad2d96d12269a79884426835157534f0ad6243fb111d6fa39dc5c68fc8
6
+ metadata.gz: a217e3701939b30771f21eb8696662052eb8abdb99ae78936a9f27b14044c263aff7a3291cf51b04467d24f1c4b4cab993945503b5ca8e63f004348e8ae0409d
7
+ data.tar.gz: 939aeb9b76e0e38bdb2132ea3f5e0ad14096600bab0a1cb844425ec2dd101c8222d79a20da29e2c31abfe850134eb2725b8d9b5820ddd26544d777852f6f0508
@@ -20,7 +20,7 @@ module Brainiac
20
20
  module Epic
21
21
  # Represents a single task within an epic (one todo → one Fizzy card).
22
22
  Task = Struct.new(:todo_id, :title, :fizzy_card, :depends_on, :status, :completed,
23
- :description, :assignees, :due_on, keyword_init: true)
23
+ :description, :assignees, :due_on, :project, keyword_init: true)
24
24
 
25
25
  class << self
26
26
  # Parse todos from a todolist into structured tasks with dependency graph.
@@ -272,7 +272,8 @@ module Brainiac
272
272
  title: t["title"],
273
273
  depends_on: t["depends_on"] || [],
274
274
  status: t["status"].to_sym,
275
- completed: t["status"] == "complete"
275
+ completed: t["status"] == "complete",
276
+ project: t["project"]
276
277
  )
277
278
  end
278
279
 
@@ -295,11 +296,15 @@ module Brainiac
295
296
  end
296
297
 
297
298
  # Dispatch a Fizzy card to the appropriate agent.
299
+ # Uses the project-specific agent if configured, otherwise falls back to the epic's agent.
298
300
  def dispatch_card(epic, task)
299
301
  card_number = task.fizzy_card
300
- agent = epic["agent"]
301
302
 
302
- LOG.info "[Basecamp:Orchestrator] Dispatching Fizzy card ##{card_number} to #{agent}" if defined?(LOG)
303
+ # Resolve agent from project config each project can have its own default agent
304
+ project_key = task.is_a?(Hash) ? task["project"] : task.project
305
+ agent = resolve_agent_for_project(project_key) || epic["agent"]
306
+
307
+ LOG.info "[Basecamp:Orchestrator] Dispatching Fizzy card ##{card_number} to #{agent} (project: #{project_key})" if defined?(LOG)
303
308
 
304
309
  # Mark as in-flight in our state
305
310
  epic_task = epic["tasks"].find { |t| t["fizzy_card"] == card_number }
@@ -464,6 +469,24 @@ module Brainiac
464
469
  @fizzy_users[name.downcase]
465
470
  end
466
471
 
472
+ # Resolve the default agent for a project from projects.json.
473
+ # Returns nil if no project-specific agent is configured.
474
+ #
475
+ # @param project_key [String, nil] Brainiac project key
476
+ # @return [String, nil] Agent name or nil
477
+ def resolve_agent_for_project(project_key)
478
+ return nil unless project_key
479
+
480
+ projects_file = File.join(BRAINIAC_DIR, "projects.json")
481
+ return nil unless File.exist?(projects_file)
482
+
483
+ projects = JSON.parse(File.read(projects_file))
484
+ projects.dig(project_key, "agent_name")
485
+ rescue StandardError => e
486
+ LOG.warn "[Basecamp:Orchestrator] Could not resolve agent for project #{project_key}: #{e.message}" if defined?(LOG)
487
+ nil
488
+ end
489
+
467
490
  # Resolve the brainiac project key for a Fizzy card by querying its tags.
468
491
  # Uses the same logic as brainiac-fizzy: card tags are matched against
469
492
  # 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.6"
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis