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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a07338e5677f448dd7b2fb15bb345009532fef8669fc375526738a8cf0eaf24d
|
|
4
|
+
data.tar.gz: 8d2aaabe74e5d02a770a3f38366287362aeab07dea91954f3ca54e9ae71ef17d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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.
|