brainiac-fizzy 0.0.22 → 0.0.23

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: 55c60df15ffb87640dfbfce7a3dd64033bdf14a6c551e2269fb252468a96e4bb
4
- data.tar.gz: cc1eb7dad2215000df5fd608f12a54ee0246e5474f19b03dcc3a98716d3d76f8
3
+ metadata.gz: 49fb9f716295e5635310802446ef24b4ab0fc50a0de0e7ed51aa6d8a66229cb3
4
+ data.tar.gz: 877d8bb3380a19038ff7d5783b249e3ef5f8334074985b46bfeba2f82e174be1
5
5
  SHA512:
6
- metadata.gz: 1fa2208a211311ce53f677da3ff14786f154b506c457659ee026afc08f9495d78737282361f737d2fabc3a4474d3f11bc9f8c0e2e8a06aae90b8e8a1b63a9256
7
- data.tar.gz: fb6d51f31357250bd28c0f3d58d6115fc379afafa117316b17095e6576068a45e5a0524232acc997c9eaef5a56c2d762d42b04e57dede7b19e6c813642720ae6
6
+ metadata.gz: cea8aef292a4c13e70d551c666ef541aeb4c017077feff75dbfa47fee6c7cfad65c07050c1360735279120124442c178bae7d7a11cd7b36f71fc2fe597dd6469
7
+ data.tar.gz: f39a533e11ab58b15ac93a360026b660c67b612fa7f6e17b58ebf91ad280e17b4eed65ab3076da76406d8d8207e6d85c7fa54eae32554a354bf1c51081074325
@@ -33,6 +33,22 @@ end
33
33
  DEPLOYMENTS_CONFIG = load_deployments_config
34
34
  DEPLOYMENT_STATE = load_deployment_state
35
35
 
36
+ # Load work items as a card-map-compatible structure for deployment lookups.
37
+ def load_card_map
38
+ map = load_work_item_map
39
+ map.transform_values do |entry|
40
+ {
41
+ "worktree" => entry["worktree"],
42
+ "branch" => entry["branch"],
43
+ "number" => entry.dig("sources", "fizzy", "card_number"),
44
+ "title" => entry.dig("sources", "fizzy", "card_title"),
45
+ "prs" => entry.dig("sources", "github", "prs") || []
46
+ }
47
+ end
48
+ rescue StandardError
49
+ {}
50
+ end
51
+
36
52
  def reload_deployments_config!(force: false)
37
53
  return unless file_changed?(DEPLOYMENTS_CONFIG_FILE, force: force)
38
54
 
@@ -50,7 +50,7 @@ module Brainiac
50
50
 
51
51
  def agent_commented_on_card?(card_number, agent_name, repo_path:, since: nil)
52
52
  env = Helpers.fizzy_env_for(agent_name)
53
- output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, chdir: repo_path, env: env)
53
+ output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, "--all", chdir: repo_path, env: env)
54
54
  comments = JSON.parse(output)["data"] || []
55
55
  agent_display = agent_display_name(agent_name)
56
56
 
@@ -59,7 +59,7 @@ module Brainiac
59
59
  end
60
60
 
61
61
  def fetch_card_comments(card_number, repo_path:, env:)
62
- output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, chdir: repo_path, env: env)
62
+ output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, "--all", chdir: repo_path, env: env)
63
63
  comments = JSON.parse(output)["data"] || []
64
64
  return "" if comments.empty?
65
65
 
@@ -77,7 +77,7 @@ module Brainiac
77
77
  # Returns a simple "author: message" format (last 5 comments).
78
78
  def fetch_intent_context(card_number, repo_path:, agent_name: nil)
79
79
  env = fizzy_env_for(agent_name || AI_AGENT_NAME)
80
- output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, chdir: repo_path, env: env)
80
+ output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, "--all", chdir: repo_path, env: env)
81
81
  comments = JSON.parse(output)["data"] || []
82
82
  return nil if comments.empty?
83
83
 
@@ -106,7 +106,7 @@ module Brainiac
106
106
  repo_path = project_config["repo_path"]
107
107
  env = fizzy_env_for(agent_name || AI_AGENT_NAME)
108
108
 
109
- output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, chdir: repo_path, env: env)
109
+ output = run_cmd("fizzy", "comment", "list", "--card", card_number.to_s, "--all", chdir: repo_path, env: env)
110
110
  comments = JSON.parse(output)["data"] || []
111
111
  agent_display = agent_display_name(agent_name || AI_AGENT_NAME)
112
112
 
@@ -360,20 +360,38 @@ module Brainiac
360
360
  boards = Config.boards
361
361
  return if boards.empty?
362
362
 
363
- env = Helpers.default_fizzy_env
363
+ admin_token = Config.current["admin_token"]
364
+ unless admin_token
365
+ LOG.debug "[Fizzy] Webhook reactivation check skipped (no admin_token in fizzy.json)"
366
+ return
367
+ end
368
+
369
+ env = { "FIZZY_TOKEN" => admin_token }
364
370
  boards.each do |board_key, board_config|
365
371
  board_id = board_config["board_id"]
366
372
  next unless board_id
367
373
 
368
- output = run_cmd("fizzy", "webhook", "list", "--board", board_id, "--all", "--json", env: env)
369
- webhooks = JSON.parse(output)["data"] || []
374
+ stdout, _stderr, status = Open3.capture3(env, "fizzy", "webhook", "list",
375
+ "--board", board_id, "--all", "--json",
376
+ chdir: Dir.home)
377
+ unless status.success?
378
+ parsed = JSON.parse(stdout) rescue nil
379
+ if parsed&.dig("code") == "forbidden"
380
+ LOG.warn "[Fizzy] Webhook check failed for board '#{board_key}' (admin_token lacks permission)"
381
+ else
382
+ LOG.warn "[Fizzy] Could not check webhooks for board '#{board_key}': exit #{status.exitstatus}"
383
+ end
384
+ next
385
+ end
370
386
 
387
+ webhooks = (JSON.parse(stdout)["data"] || [])
371
388
  webhooks.each do |webhook|
372
389
  next unless webhook["name"]&.start_with?("brainiac")
373
390
  next if webhook["active"]
374
391
 
375
392
  LOG.info "[Fizzy] Reactivating webhook '#{webhook["name"]}' on board '#{board_key}' (was inactive)"
376
- run_cmd("fizzy", "webhook", "reactivate", webhook["id"], "--board", board_id, env: env)
393
+ run_cmd("fizzy", "webhook", "reactivate", webhook["id"], "--board", board_id,
394
+ chdir: Dir.home, env: env)
377
395
  end
378
396
  rescue StandardError => e
379
397
  LOG.warn "[Fizzy] Could not check webhooks for board '#{board_key}': #{e.message}"
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Fizzy
6
- VERSION = "0.0.22"
6
+ VERSION = "0.0.23"
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.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis