brainiac-fizzy 0.0.2 → 0.0.3
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: d848363b737703f7d3da85256a02550c97f4f45afad53daae7d0d29c035ce167
|
|
4
|
+
data.tar.gz: df5257f73e63964e4cbb7d33974e1057484dc497639c393069738c25111363b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e5bcd9d72ed693d4e2e4b0ce096df51238a29782a912650e1a39df9ecba62f439c5b79b6ba6b7814cd4e18ffe310d0cbe4f147f383baca3afd25ea303679362
|
|
7
|
+
data.tar.gz: 4bfcef1e519b2fb9738e25d2081cbbc24ba420fc9fac889d6ddbc4e4681665d914d250f150afc85263fa3761534f4617ea21311a3983907ec1bf376a6883004b
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Brainiac
|
|
6
|
+
module Plugins
|
|
7
|
+
module Fizzy
|
|
8
|
+
# CLI subcommands for brainiac-fizzy plugin.
|
|
9
|
+
#
|
|
10
|
+
# Invoked when a user runs `brainiac fizzy <command>`.
|
|
11
|
+
module Cli
|
|
12
|
+
BRAINIAC_DIR = ENV.fetch("BRAINIAC_DIR", File.join(Dir.home, ".brainiac"))
|
|
13
|
+
FIZZY_CONFIG_FILE = File.join(BRAINIAC_DIR, "fizzy.json")
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
def run(args)
|
|
17
|
+
command = args.shift
|
|
18
|
+
|
|
19
|
+
case command
|
|
20
|
+
when "config"
|
|
21
|
+
cmd_config
|
|
22
|
+
when "status"
|
|
23
|
+
cmd_status
|
|
24
|
+
when "setup"
|
|
25
|
+
cmd_setup
|
|
26
|
+
else
|
|
27
|
+
print_help
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def cmd_config
|
|
34
|
+
if File.exist?(FIZZY_CONFIG_FILE)
|
|
35
|
+
puts File.read(FIZZY_CONFIG_FILE)
|
|
36
|
+
else
|
|
37
|
+
puts "No Fizzy config found at #{FIZZY_CONFIG_FILE}"
|
|
38
|
+
puts "Run 'brainiac fizzy setup' to get started."
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def cmd_status
|
|
43
|
+
server_url = detect_server_url
|
|
44
|
+
begin
|
|
45
|
+
uri = URI("#{server_url}/api/fizzy")
|
|
46
|
+
response = Net::HTTP.get_response(uri)
|
|
47
|
+
data = JSON.parse(response.body)
|
|
48
|
+
puts "Fizzy: #{data["enabled"] ? "enabled" : "disabled"}"
|
|
49
|
+
puts "Boards: #{(data["boards"] || []).join(", ")}" if data["boards"]
|
|
50
|
+
puts "Authorized users: #{data["authorized_users"]}" if data["authorized_users"]
|
|
51
|
+
rescue StandardError => e
|
|
52
|
+
puts "Could not reach server at #{server_url}: #{e.message}"
|
|
53
|
+
puts "Is the server running? Check with: brainiac status"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def cmd_setup
|
|
58
|
+
puts "Fizzy Setup"
|
|
59
|
+
puts "==========="
|
|
60
|
+
puts ""
|
|
61
|
+
|
|
62
|
+
if File.exist?(FIZZY_CONFIG_FILE)
|
|
63
|
+
config = JSON.parse(File.read(FIZZY_CONFIG_FILE))
|
|
64
|
+
boards = config["boards"] || {}
|
|
65
|
+
users = config["authorized_users"] || []
|
|
66
|
+
|
|
67
|
+
if boards.any?
|
|
68
|
+
puts "✓ #{boards.size} board(s) configured: #{boards.keys.join(", ")}"
|
|
69
|
+
else
|
|
70
|
+
puts "⚠ No boards configured."
|
|
71
|
+
puts " Edit #{FIZZY_CONFIG_FILE} to add board config."
|
|
72
|
+
end
|
|
73
|
+
puts ""
|
|
74
|
+
|
|
75
|
+
if users.any?
|
|
76
|
+
puts "✓ #{users.size} authorized user(s)"
|
|
77
|
+
else
|
|
78
|
+
puts "⚠ No authorized users configured."
|
|
79
|
+
end
|
|
80
|
+
else
|
|
81
|
+
puts "⚠ No fizzy.json found."
|
|
82
|
+
puts " Create #{FIZZY_CONFIG_FILE} with your board config."
|
|
83
|
+
puts ""
|
|
84
|
+
puts " Minimum config:"
|
|
85
|
+
puts " {"
|
|
86
|
+
puts ' "authorized_users": [{ "id": "user-id", "name": "You", "human": true }],'
|
|
87
|
+
puts ' "boards": {'
|
|
88
|
+
puts ' "development": {'
|
|
89
|
+
puts ' "board_id": "your-board-id",'
|
|
90
|
+
puts ' "webhook_secret": "your-secret",'
|
|
91
|
+
puts ' "columns": { "right_now": "col-id", "needs_review": "col-id" }'
|
|
92
|
+
puts " }"
|
|
93
|
+
puts " }"
|
|
94
|
+
puts " }"
|
|
95
|
+
end
|
|
96
|
+
puts ""
|
|
97
|
+
puts "Webhook URL: https://<your-ngrok>.ngrok-free.app/fizzy/<board-key>"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def print_help
|
|
101
|
+
puts <<~HELP
|
|
102
|
+
Usage: brainiac fizzy <command>
|
|
103
|
+
|
|
104
|
+
Commands:
|
|
105
|
+
config Show Fizzy config
|
|
106
|
+
status Check Fizzy status via server API
|
|
107
|
+
setup Show setup guide
|
|
108
|
+
|
|
109
|
+
Fizzy handles card assignment, comments, @mentions, cross-agent reviews,
|
|
110
|
+
duplicate detection, and planning mode via webhooks.
|
|
111
|
+
|
|
112
|
+
Webhook URL: https://<your-ngrok>/fizzy/<board-key>
|
|
113
|
+
Config file: #{FIZZY_CONFIG_FILE}
|
|
114
|
+
HELP
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def detect_server_url
|
|
118
|
+
config_file = File.join(BRAINIAC_DIR, "brainiac.json")
|
|
119
|
+
if File.exist?(config_file)
|
|
120
|
+
config = JSON.parse(File.read(config_file))
|
|
121
|
+
config["server_url"] || "http://localhost:4567"
|
|
122
|
+
else
|
|
123
|
+
"http://localhost:4567"
|
|
124
|
+
end
|
|
125
|
+
rescue JSON::ParserError
|
|
126
|
+
"http://localhost:4567"
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Plugin CLI entry point — called by brainiac core's plugin delegation.
|
|
132
|
+
def self.cli(args)
|
|
133
|
+
Cli.run(args)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Subcommand names for bash completion.
|
|
137
|
+
def self.completions
|
|
138
|
+
%w[config status setup]
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -69,13 +69,13 @@ def react_to_assignment(card_number, repo_path, agent_name)
|
|
|
69
69
|
Thread.new do
|
|
70
70
|
# Delete existing reactions from this agent before re-reacting
|
|
71
71
|
result = run_cmd("fizzy", "reaction", "list", "--card", card_number.to_s,
|
|
72
|
-
"--jq",
|
|
72
|
+
"--jq", "[.data[] | {id, reacter_id: .reacter.id}]",
|
|
73
73
|
chdir: repo_path, env: fizzy_env_for(agent_name))
|
|
74
74
|
reactions = JSON.parse(result)
|
|
75
75
|
|
|
76
|
-
identity = run_cmd("fizzy", "identity", "show", "--jq",
|
|
76
|
+
identity = run_cmd("fizzy", "identity", "show", "--jq", ".data.accounts[0].user.id",
|
|
77
77
|
chdir: repo_path, env: fizzy_env_for(agent_name))
|
|
78
|
-
current_user_id = identity.strip.tr('"',
|
|
78
|
+
current_user_id = identity.strip.tr('"', "")
|
|
79
79
|
|
|
80
80
|
reactions.each do |reaction|
|
|
81
81
|
if reaction["reacter_id"] == current_user_id
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Lightweight metadata for brainiac-fizzy.
|
|
4
|
+
# Loaded by `brainiac help` without pulling in the full plugin runtime.
|
|
5
|
+
|
|
6
|
+
require_relative "version"
|
|
7
|
+
|
|
8
|
+
module Brainiac
|
|
9
|
+
module Plugins
|
|
10
|
+
module Fizzy
|
|
11
|
+
# Returns true if Fizzy has at least one board configured.
|
|
12
|
+
def self.configured?
|
|
13
|
+
config_file = File.join(ENV.fetch("BRAINIAC_DIR", File.join(Dir.home, ".brainiac")), "fizzy.json")
|
|
14
|
+
return false unless File.exist?(config_file)
|
|
15
|
+
|
|
16
|
+
config = JSON.parse(File.read(config_file))
|
|
17
|
+
!(config["boards"] || {}).empty?
|
|
18
|
+
rescue StandardError
|
|
19
|
+
false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Help text shown in `brainiac help` when the plugin is installed.
|
|
23
|
+
def self.help_text
|
|
24
|
+
" brainiac fizzy <command> Manage Fizzy boards"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
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.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Davis
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- README.md
|
|
91
91
|
- lib/brainiac/plugins/fizzy.rb
|
|
92
|
+
- lib/brainiac/plugins/fizzy/cli.rb
|
|
92
93
|
- lib/brainiac/plugins/fizzy/config.rb
|
|
93
94
|
- lib/brainiac/plugins/fizzy/delegators.rb
|
|
94
95
|
- lib/brainiac/plugins/fizzy/handlers/assignment.rb
|
|
@@ -99,6 +100,7 @@ files:
|
|
|
99
100
|
- lib/brainiac/plugins/fizzy/handlers/deployments.rb
|
|
100
101
|
- lib/brainiac/plugins/fizzy/helpers.rb
|
|
101
102
|
- lib/brainiac/plugins/fizzy/hooks.rb
|
|
103
|
+
- lib/brainiac/plugins/fizzy/metadata.rb
|
|
102
104
|
- lib/brainiac/plugins/fizzy/planning.rb
|
|
103
105
|
- lib/brainiac/plugins/fizzy/prompts.rb
|
|
104
106
|
- lib/brainiac/plugins/fizzy/version.rb
|