brainiac-fizzy 0.0.23 → 0.0.24

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: 49fb9f716295e5635310802446ef24b4ab0fc50a0de0e7ed51aa6d8a66229cb3
4
- data.tar.gz: 877d8bb3380a19038ff7d5783b249e3ef5f8334074985b46bfeba2f82e174be1
3
+ metadata.gz: 5458df6821434350e3814c4002b36bf7c24449fec0375304004d96f34381c413
4
+ data.tar.gz: 6fe4ea5f51574cca99f6e90cada9480d6ff7a2c69008837f1e98259e1249abeb
5
5
  SHA512:
6
- metadata.gz: cea8aef292a4c13e70d551c666ef541aeb4c017077feff75dbfa47fee6c7cfad65c07050c1360735279120124442c178bae7d7a11cd7b36f71fc2fe597dd6469
7
- data.tar.gz: f39a533e11ab58b15ac93a360026b660c67b612fa7f6e17b58ebf91ad280e17b4eed65ab3076da76406d8d8207e6d85c7fa54eae32554a354bf1c51081074325
6
+ metadata.gz: 6c9657c7470c20a0d288917a92d15d10823dd4ec3d113c7acf48f1b1263291106947ff0e8ecdbc675c49db1f928affc1050e9405820d11cd00e21aae329e4747
7
+ data.tar.gz: 0c03004274a798059eaa5f46025fba1e69e4b084ee99acf4a3185802a0eb6af58fed9ee23a87b7de74635c3080426a9a2aa226ae48646d9247b4afcdb8d3bec2
@@ -30,7 +30,8 @@ def fetch_intent_context(card_number, repo_path:, agent_name: nil)
30
30
  end
31
31
 
32
32
  def move_card_to_column(card_number, column_name, project_config:, agent_name: nil, board_key: nil)
33
- Brainiac::Plugins::Fizzy::Helpers.move_card_to_column(card_number, column_name, project_config: project_config, agent_name: agent_name, board_key: board_key)
33
+ Brainiac::Plugins::Fizzy::Helpers.move_card_to_column(card_number, column_name, project_config: project_config, agent_name: agent_name,
34
+ board_key: board_key)
34
35
  end
35
36
 
36
37
  def append_fizzy_comment_footer(card_number, project_config:, agent_name: nil, since: nil)
@@ -113,7 +113,13 @@ end
113
113
  def setup_assigned_worktree(repo_path, branch, card_internal_id, card_number, project_key, agent_name, board_key: nil)
114
114
  debounced_repo_fetch(repo_path)
115
115
  worktree_path = File.join(File.dirname(repo_path), "#{File.basename(repo_path)}--#{branch}")
116
- worktree_path = create_or_reuse_worktree(repo_path: repo_path, branch: branch, worktree_path: worktree_path)
116
+
117
+ # Allow plugins (e.g., brainiac-basecamp) to override the base branch for epic workflows.
118
+ base_ref = if defined?(resolve_base_branch)
119
+ resolve_base_branch(repo_path: repo_path, card_number: card_number, project_key: project_key)
120
+ end
121
+
122
+ worktree_path = create_or_reuse_worktree(repo_path: repo_path, branch: branch, base_ref: base_ref, worktree_path: worktree_path)
117
123
 
118
124
  source_data = { "card_internal_id" => card_internal_id, "card_number" => card_number }
119
125
  source_data["board_key"] = board_key if board_key
@@ -134,6 +140,17 @@ def dispatch_assigned_card(card_number:, card_internal_id:, title:, tags:, branc
134
140
  "CARD_NUMBER" => card_number, "CARD_TITLE" => title,
135
141
  "BRANCH" => branch, "COMMENT_CREATOR" => agent_name
136
142
  }
143
+
144
+ # Resolve custom PR target (for epic branch workflows)
145
+ pr_target = if defined?(resolve_pr_target)
146
+ resolve_pr_target(repo_path: project_config["repo_path"], card_number: card_number, project_key: project_key)
147
+ end
148
+ template_vars["PR_TARGET_INSTRUCTION"] = if pr_target
149
+ "**IMPORTANT: Open the PR targeting the `#{pr_target}` branch " \
150
+ "(not main).** Use: `gh pr create --base #{pr_target}`"
151
+ else
152
+ ""
153
+ end
137
154
  brain_ctx = build_brain_context(
138
155
  agent_name: agent_name, card_title: title,
139
156
  card_number: card_number, project_key: project_key, source: :fizzy
@@ -565,7 +565,9 @@ def dispatch_followup_comment(ctx, card_key:, card_number:, work_dir:)
565
565
 
566
566
  register_session(card_key, pid, log_file: log_file, supersede_key: card_key, agent_name: ctx.agent_name)
567
567
 
568
- Thread.new { move_card_to_column(card_number, "right_now", project_config: ctx.project_config, agent_name: ctx.agent_name, board_key: ctx.board_key) }
568
+ Thread.new do
569
+ move_card_to_column(card_number, "right_now", project_config: ctx.project_config, agent_name: ctx.agent_name, board_key: ctx.board_key)
570
+ end
569
571
 
570
572
  { status: "follow_up", card: card_number, card_internal_id: ctx.card_internal_id,
571
573
  worktree: work_dir, project: ctx.project_key }
@@ -51,7 +51,7 @@ module Brainiac
51
51
  # Retry once after a short delay to account for Fizzy API propagation.
52
52
  # The agent may have posted its comment just before exiting, and the API
53
53
  # might not return it immediately in a list call.
54
- if !found_comment
54
+ unless found_comment
55
55
  sleep 5
56
56
  found_comment = Helpers.append_fizzy_comment_footer(card_number,
57
57
  project_config: ctx[:project_config],
@@ -375,7 +375,11 @@ module Brainiac
375
375
  "--board", board_id, "--all", "--json",
376
376
  chdir: Dir.home)
377
377
  unless status.success?
378
- parsed = JSON.parse(stdout) rescue nil
378
+ parsed = begin
379
+ JSON.parse(stdout)
380
+ rescue StandardError
381
+ nil
382
+ end
379
383
  if parsed&.dig("code") == "forbidden"
380
384
  LOG.warn "[Fizzy] Webhook check failed for board '#{board_key}' (admin_token lacks permission)"
381
385
  else
@@ -384,7 +388,7 @@ module Brainiac
384
388
  next
385
389
  end
386
390
 
387
- webhooks = (JSON.parse(stdout)["data"] || [])
391
+ webhooks = JSON.parse(stdout)["data"] || []
388
392
  webhooks.each do |webhook|
389
393
  next unless webhook["name"]&.start_with?("brainiac")
390
394
  next if webhook["active"]
@@ -59,6 +59,7 @@ module Brainiac
59
59
  You have been assigned Fizzy card #{{CARD_NUMBER}}: "{{CARD_TITLE}}".
60
60
  You are on branch "{{BRANCH}}" in a fresh worktree.
61
61
  Implement the task, commit, push, and open a PR (link back to Fizzy).
62
+ {{PR_TARGET_INSTRUCTION}}
62
63
 
63
64
  **Response destination: Post your response as a comment on Fizzy card #{{CARD_NUMBER}}.**
64
65
  Your comment MUST include a concise summary of what you did, a PR link, and the branch name.
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Fizzy
6
- VERSION = "0.0.23"
6
+ VERSION = "0.0.24"
7
7
  end
8
8
  end
9
9
  end
@@ -178,7 +178,7 @@ module Brainiac
178
178
  config = DEPLOYMENTS_CONFIG["environments"] || {}
179
179
  halt 404, { error: "Unknown environment: #{env_key}" }.to_json unless config.key?(env_key)
180
180
  request.body.rewind
181
- payload = begin
181
+ begin
182
182
  JSON.parse(request.body.read)
183
183
  rescue StandardError
184
184
  {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-fizzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis