brainiac-fizzy 0.0.3 → 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: d848363b737703f7d3da85256a02550c97f4f45afad53daae7d0d29c035ce167
4
- data.tar.gz: df5257f73e63964e4cbb7d33974e1057484dc497639c393069738c25111363b0
3
+ metadata.gz: 52b33b796dafe9d47fe9db8f881537d2d66bda2f54f51f1bafb9dd4a4b188a4c
4
+ data.tar.gz: '0260149a3b2daa8439049b9369980f1edf73f65226cb07785f7f0c954e74dc66'
5
5
  SHA512:
6
- metadata.gz: 5e5bcd9d72ed693d4e2e4b0ce096df51238a29782a912650e1a39df9ecba62f439c5b79b6ba6b7814cd4e18ffe310d0cbe4f147f383baca3afd25ea303679362
7
- data.tar.gz: 4bfcef1e519b2fb9738e25d2081cbbc24ba420fc9fac889d6ddbc4e4681665d914d250f150afc85263fa3761534f4617ea21311a3983907ec1bf376a6883004b
6
+ metadata.gz: 2fc7f43f8c505d94fc7f4364cb24d33d9aee11d23e6a73033df82e5fd6ad4b4aa496348df42fcac455ba71d75d7d66b3cea76b458f3cb5b0f544682427e5f4a5
7
+ data.tar.gz: 6bb9c239037adde4e1f371eb7087501ee9233ac32177ca2997aad0a4926b4e9db217d0b06dd49e2384fab3cb4a27de01b7491af32afcf121a536e68e7ab5a773
@@ -63,15 +63,22 @@ module Brainiac
63
63
  end
64
64
 
65
65
  def board_key_for_project(project_config)
66
+ # Priority 1: explicit fizzy_board in project config (board key name from fizzy.json)
67
+ board_key = project_config["fizzy_board"]
68
+ return board_key if board_key && @boards.key?(board_key)
69
+
70
+ # Priority 2: .fizzy.yaml in the repo directory
66
71
  fizzy_yaml = File.join(project_config["repo_path"], ".fizzy.yaml")
67
- return nil unless File.exist?(fizzy_yaml)
72
+ if File.exist?(fizzy_yaml)
73
+ require "yaml"
74
+ data = YAML.safe_load_file(fizzy_yaml)
75
+ board_id = data["board"]
76
+ return board_key_for_id(board_id)
77
+ end
68
78
 
69
- require "yaml"
70
- data = YAML.safe_load_file(fizzy_yaml)
71
- board_id = data["board"]
72
- board_key_for_id(board_id)
79
+ nil
73
80
  rescue StandardError => e
74
- LOG.warn "[Fizzy] Could not read .fizzy.yaml: #{e.message}" if defined?(LOG)
81
+ LOG.warn "[Fizzy] Could not resolve board for project: #{e.message}" if defined?(LOG)
75
82
  nil
76
83
  end
77
84
 
@@ -67,28 +67,34 @@ end
67
67
 
68
68
  def react_to_assignment(card_number, repo_path, agent_name)
69
69
  Thread.new do
70
- # Delete existing reactions from this agent before re-reacting
71
- result = run_cmd("fizzy", "reaction", "list", "--card", card_number.to_s,
72
- "--jq", "[.data[] | {id, reacter_id: .reacter.id}]",
73
- chdir: repo_path, env: fizzy_env_for(agent_name))
74
- reactions = JSON.parse(result)
75
-
76
- identity = run_cmd("fizzy", "identity", "show", "--jq", ".data.accounts[0].user.id",
77
- chdir: repo_path, env: fizzy_env_for(agent_name))
78
- current_user_id = identity.strip.tr('"', "")
79
-
80
- reactions.each do |reaction|
81
- if reaction["reacter_id"] == current_user_id
82
- run_cmd("fizzy", "reaction", "delete", reaction["id"], "--card", card_number.to_s,
83
- chdir: repo_path, env: fizzy_env_for(agent_name))
70
+ env = fizzy_env_for(agent_name)
71
+
72
+ # Best-effort cleanup of existing reactions from this agent
73
+ begin
74
+ result = run_cmd("fizzy", "reaction", "list", "--card", card_number.to_s,
75
+ chdir: repo_path, env: env)
76
+ reactions = JSON.parse(result)["data"] || []
77
+
78
+ identity_output = run_cmd("fizzy", "identity", "show", chdir: repo_path, env: env)
79
+ current_user_id = JSON.parse(identity_output).dig("data", "accounts", 0, "user", "id")
80
+
81
+ if current_user_id
82
+ reactions.each do |reaction|
83
+ if reaction.dig("reacter", "id") == current_user_id
84
+ run_cmd("fizzy", "reaction", "delete", reaction["id"], "--card", card_number.to_s,
85
+ chdir: repo_path, env: env)
86
+ end
87
+ end
84
88
  end
89
+ rescue StandardError => e
90
+ LOG.warn "Could not clean up existing reactions on card ##{card_number}: #{e.message}"
85
91
  end
86
92
 
87
- # Add fresh reaction
93
+ # Always attempt to add the reaction even if cleanup failed
88
94
  run_cmd("fizzy", "reaction", "create", "--card", card_number.to_s,
89
- "--content", "👍", chdir: repo_path, env: fizzy_env_for(agent_name))
95
+ "--content", "👀", chdir: repo_path, env: env)
90
96
  rescue StandardError => e
91
- LOG.warn "Could not add reaction to card: #{e.message}"
97
+ LOG.warn "Could not add reaction to card ##{card_number}: #{e.message}"
92
98
  end
93
99
  end
94
100
 
@@ -488,10 +488,10 @@ def dispatch_followup_comment(ctx, card_key:, card_number:, work_dir:)
488
488
  effort = detect_effort(ctx.project_config, tags: card_tags, text: ctx.plain_text)
489
489
 
490
490
  is_worktree = work_dir != ctx.project_config["repo_path"]
491
- resolved = resolve_project_cli_config(ctx.project_config,
492
- cli_provider_override: ctx.cli_provider_override,
493
- agent_name: ctx.agent_name)
494
- should_resume = is_worktree && resolved["resume_flag"]
491
+ should_resume = is_worktree && resume_viable?(
492
+ project_config: ctx.project_config, cli_provider: ctx.cli_provider_override,
493
+ agent_name: ctx.agent_name, chdir: work_dir
494
+ )
495
495
 
496
496
  prompt = if should_resume
497
497
  LOG.info "[Resume] Using lean prompt for follow-up on card #{card_number || ctx.card_internal_id}"
@@ -508,7 +508,7 @@ def dispatch_followup_comment(ctx, card_key:, card_number:, work_dir:)
508
508
  log_name: "followup-#{card_number || ctx.card_internal_id}",
509
509
  model: ctx.model, effort: effort, agent_name: ctx.agent_name,
510
510
  card_number: card_number, comment_id: ctx.comment_id,
511
- source: :fizzy, cli_provider: ctx.cli_provider_override, resume: is_worktree,
511
+ source: :fizzy, cli_provider: ctx.cli_provider_override, resume: should_resume,
512
512
  source_context: {
513
513
  card_number: card_number, card_internal_id: ctx.card_internal_id,
514
514
  deploy_intent: ctx.deploy_intent
@@ -71,7 +71,10 @@ module Brainiac
71
71
  """
72
72
 
73
73
  Focus your response on the comment above. If you've already addressed this in a previous session, reply confirming it's done.
74
- Otherwise, make the requested changes, commit, push, and update the PR.
74
+ Otherwise, make the requested changes, commit, and push.
75
+
76
+ **Response destination: Post your response as a comment on Fizzy card #{{CARD_NUMBER}}.**
77
+ Do NOT post comments on the GitHub PR — this conversation is happening on the card.
75
78
  PROMPT
76
79
 
77
80
  FOLLOWUP_NO_WORKTREE = <<~PROMPT
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Fizzy
6
- VERSION = "0.0.3"
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-fizzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis