brainiac 0.4.2 → 0.4.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 +4 -4
- data/README.md +3 -0
- data/bin/brainiac +70 -5
- data/docs/waybar-config.md +13 -0
- data/lib/brainiac/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a563d46d55d8eb7534c68583a1518f89dc5f5d2685ea1d9c55f43f7015861ab
|
|
4
|
+
data.tar.gz: c714c9da68680106d183fab643a2c3dc9589ad21d5b96cdd97dd89945dd64c23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d36fbb11a493c2545554f3a6a244060f6bd13e49c9790b3d65c01959cbf271ac43c2fea62b795f98fde60c42a36b2b0f8117e29dd7a9853d583271715d8468c0
|
|
7
|
+
data.tar.gz: 6a4f88dd9b432d306442172fd15e42eece2424c5436ef8b7cb713673323b029e7b12f6842140fb701aae550dc8352f332b3b627f9bb4054a095c49e0eca92d34
|
data/README.md
CHANGED
|
@@ -932,6 +932,9 @@ Configure how agents appear in the status bar via `~/.brainiac/waybar.json`:
|
|
|
932
932
|
}
|
|
933
933
|
```
|
|
934
934
|
|
|
935
|
+
`brainiac agent create` asks for each new agent's icon (or pass `--icon ⚖️`).
|
|
936
|
+
Change one later with `brainiac agent setup <name> --icon <emoji>`.
|
|
937
|
+
|
|
935
938
|
### macOS (xbar)
|
|
936
939
|
|
|
937
940
|
Requires [xbar](https://xbarapp.com) (free, formerly BitBar).
|
data/bin/brainiac
CHANGED
|
@@ -418,6 +418,48 @@ def prompt_for_agent_role(agent_key, display_name)
|
|
|
418
418
|
picked & existing
|
|
419
419
|
end
|
|
420
420
|
|
|
421
|
+
# Status bar icons (Omarchy bar, waybar, xbar) live in ~/.brainiac/waybar.json,
|
|
422
|
+
# keyed by display name (matched case-insensitively). Unlisted agents show ❓.
|
|
423
|
+
def bar_config_file
|
|
424
|
+
File.join(BRAINIAC_DIR, "waybar.json")
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
def read_bar_config
|
|
428
|
+
File.exist?(bar_config_file) ? JSON.parse(File.read(bar_config_file, encoding: "utf-8")) : {}
|
|
429
|
+
rescue JSON::ParserError
|
|
430
|
+
{}
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
def bar_icon(display_name)
|
|
434
|
+
(read_bar_config["agents"] || []).find { |a| a["name"].to_s.casecmp?(display_name) }&.dig("emoji")
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
# Add or update the agent's bar icon, keeping its color and the other agents.
|
|
438
|
+
# A nil icon removes the agent from the file.
|
|
439
|
+
def write_bar_icon(display_name, icon)
|
|
440
|
+
config = read_bar_config
|
|
441
|
+
agents = config["agents"] || []
|
|
442
|
+
existing = agents.find { |a| a["name"].to_s.casecmp?(display_name) }
|
|
443
|
+
if icon.nil?
|
|
444
|
+
agents.delete(existing)
|
|
445
|
+
elsif existing
|
|
446
|
+
existing["emoji"] = icon
|
|
447
|
+
else
|
|
448
|
+
agents << { "name" => display_name, "emoji" => icon }
|
|
449
|
+
end
|
|
450
|
+
config["agents"] = agents
|
|
451
|
+
config["default_emoji"] ||= "❓"
|
|
452
|
+
config["schema_version"] ||= "1.0"
|
|
453
|
+
config["last_updated"] = Time.now.iso8601
|
|
454
|
+
File.write(bar_config_file, "#{JSON.pretty_generate(config)}\n")
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
def prompt_for_bar_icon(display_name)
|
|
458
|
+
print "Status bar icon for #{display_name} (an emoji, blank to skip): "
|
|
459
|
+
icon = $stdin.gets.to_s.strip
|
|
460
|
+
icon.empty? ? nil : icon
|
|
461
|
+
end
|
|
462
|
+
|
|
421
463
|
# Payload handed to plugins' on_agent_created: the registry entry plus the
|
|
422
464
|
# setup inputs plugins need to provision accounts (avatar, description, email).
|
|
423
465
|
# "open_browser" tells plugins whether they may launch a browser for their
|
|
@@ -2543,6 +2585,7 @@ when "agent"
|
|
|
2543
2585
|
puts ""
|
|
2544
2586
|
puts "Options:"
|
|
2545
2587
|
puts " --avatar <path> Profile picture (png/jpg/gif/webp), used by plugins (Discord, Fizzy)"
|
|
2588
|
+
puts " --icon <emoji> Status bar icon (Omarchy bar, waybar, xbar), e.g. --icon ⚖️"
|
|
2546
2589
|
puts " --description <text> Persona description (\"-\" reads stdin, \"@file\" reads a file)"
|
|
2547
2590
|
puts " --description-file <path> Read the persona description from a file"
|
|
2548
2591
|
puts " --email <address> Email for the agent's accounts (default: agent_email_template)"
|
|
@@ -2557,7 +2600,8 @@ when "agent"
|
|
|
2557
2600
|
puts ""
|
|
2558
2601
|
puts "With no flags and a terminal, interactive mode is used. If no description is"
|
|
2559
2602
|
puts "given on a terminal, $EDITOR opens so you can write a full persona. Without"
|
|
2560
|
-
puts "--role/--role-file you're asked to pick an existing role or write a new one
|
|
2603
|
+
puts "--role/--role-file you're asked to pick an existing role or write a new one,"
|
|
2604
|
+
puts "and without --icon you're asked for a status bar emoji."
|
|
2561
2605
|
puts "After the brainiac files are written, each installed plugin sets up its part"
|
|
2562
2606
|
puts "(Discord bot, Fizzy user, Basecamp person), asking first unless --skip/--only"
|
|
2563
2607
|
puts "is given. Re-run with: brainiac agent setup <name>"
|
|
@@ -2567,7 +2611,7 @@ when "agent"
|
|
|
2567
2611
|
puts " brainiac agent create Quill --local --avatar quill.png --description @quill.md"
|
|
2568
2612
|
puts " brainiac agent create MyAgent # interactive"
|
|
2569
2613
|
puts " brainiac agent create SecurityBot --local --role code-reviewer"
|
|
2570
|
-
puts " brainiac agent create \"Judge Dredd\" --local --avatar dredd.png \\"
|
|
2614
|
+
puts " brainiac agent create \"Judge Dredd\" --local --avatar dredd.png --icon ⚖️ \\"
|
|
2571
2615
|
puts " --description-file dredd-style.md --role-file dredd-role.md"
|
|
2572
2616
|
exit 1
|
|
2573
2617
|
end
|
|
@@ -2587,6 +2631,7 @@ when "agent"
|
|
|
2587
2631
|
cli_provider = nil
|
|
2588
2632
|
persona_text = nil
|
|
2589
2633
|
avatar = nil
|
|
2634
|
+
icon = nil
|
|
2590
2635
|
email = nil
|
|
2591
2636
|
skip_plugins = []
|
|
2592
2637
|
only_plugins = nil
|
|
@@ -2617,6 +2662,9 @@ when "agent"
|
|
|
2617
2662
|
when "--avatar"
|
|
2618
2663
|
ARGV.shift
|
|
2619
2664
|
avatar = ARGV.shift
|
|
2665
|
+
when "--icon"
|
|
2666
|
+
ARGV.shift
|
|
2667
|
+
icon = ARGV.shift.to_s.strip
|
|
2620
2668
|
when "--email"
|
|
2621
2669
|
ARGV.shift
|
|
2622
2670
|
email = ARGV.shift
|
|
@@ -2682,6 +2730,7 @@ when "agent"
|
|
|
2682
2730
|
elsif roles.empty? && $stdin.tty?
|
|
2683
2731
|
roles = prompt_for_agent_role(agent_key, name)
|
|
2684
2732
|
end
|
|
2733
|
+
icon = prompt_for_bar_icon(name) if icon.nil? && $stdin.tty?
|
|
2685
2734
|
|
|
2686
2735
|
missing_roles = roles - available_roles - [new_role]
|
|
2687
2736
|
if missing_roles.any?
|
|
@@ -2718,6 +2767,10 @@ when "agent"
|
|
|
2718
2767
|
puts " CLI: #{cli_provider}" if cli_provider
|
|
2719
2768
|
puts " Email: #{email}" if email
|
|
2720
2769
|
puts " Avatar: #{entry["avatar"]}" if entry["avatar"]
|
|
2770
|
+
if icon && !icon.empty?
|
|
2771
|
+
write_bar_icon(name, icon)
|
|
2772
|
+
puts " Bar icon: #{icon}"
|
|
2773
|
+
end
|
|
2721
2774
|
|
|
2722
2775
|
# Create persona directory and style file if requested
|
|
2723
2776
|
if persona_text
|
|
@@ -2772,14 +2825,16 @@ when "agent"
|
|
|
2772
2825
|
when "setup"
|
|
2773
2826
|
name = ARGV.shift
|
|
2774
2827
|
unless name
|
|
2775
|
-
puts "Usage: brainiac agent setup <name> [--avatar <path>] [--
|
|
2776
|
-
puts " [--skip <plugins>] [--only <plugins>] [--no-browser]"
|
|
2828
|
+
puts "Usage: brainiac agent setup <name> [--avatar <path>] [--icon <emoji>] [--email <address>] [--role <role>]"
|
|
2829
|
+
puts " [--role-file <path>] [--skip <plugins>] [--only <plugins>] [--no-browser]"
|
|
2777
2830
|
puts ""
|
|
2778
2831
|
puts "Re-runs every plugin's agent setup (Discord bot, Fizzy user, Basecamp person)."
|
|
2779
2832
|
puts "Steps that are already done are skipped, so it's safe to run after an"
|
|
2780
2833
|
puts "interrupted 'agent create' or to set up a newly installed plugin."
|
|
2781
|
-
puts "An agent without a role is asked to pick or write one
|
|
2834
|
+
puts "An agent without a role is asked to pick or write one, and one without a"
|
|
2835
|
+
puts "status bar icon is asked for an emoji."
|
|
2782
2836
|
puts ""
|
|
2837
|
+
puts " --icon e Set the status bar icon (Omarchy bar, waybar, xbar)"
|
|
2783
2838
|
puts " --role r Assign an existing role"
|
|
2784
2839
|
puts " --role-file f Create a role from a markdown file (named after the agent) and assign it"
|
|
2785
2840
|
puts " --skip a,b Never set up these plugins for this agent (saved)"
|
|
@@ -2800,8 +2855,11 @@ when "agent"
|
|
|
2800
2855
|
open_browser = true
|
|
2801
2856
|
new_roles = []
|
|
2802
2857
|
role_file = nil
|
|
2858
|
+
icon = nil
|
|
2803
2859
|
while ARGV.any?
|
|
2804
2860
|
case ARGV.shift
|
|
2861
|
+
when "--icon"
|
|
2862
|
+
icon = ARGV.shift.to_s.strip
|
|
2805
2863
|
when "--role"
|
|
2806
2864
|
new_roles << role_name_arg(ARGV.shift)
|
|
2807
2865
|
when "--role-file"
|
|
@@ -2855,6 +2913,12 @@ when "agent"
|
|
|
2855
2913
|
end
|
|
2856
2914
|
puts "✓ Role: #{assign_roles(entry, new_roles).join(", ")}" if new_roles.any?
|
|
2857
2915
|
|
|
2916
|
+
icon = prompt_for_bar_icon(display) if icon.nil? && bar_icon(display).nil? && $stdin.tty?
|
|
2917
|
+
if icon && !icon.empty?
|
|
2918
|
+
write_bar_icon(display, icon)
|
|
2919
|
+
puts "✓ Bar icon: #{icon}"
|
|
2920
|
+
end
|
|
2921
|
+
|
|
2858
2922
|
registry[agent_key] = entry
|
|
2859
2923
|
File.write(agent_registry_file, JSON.pretty_generate(registry))
|
|
2860
2924
|
|
|
@@ -2883,6 +2947,7 @@ when "agent"
|
|
|
2883
2947
|
File.write(agent_registry_file, JSON.pretty_generate(registry))
|
|
2884
2948
|
puts "✓ Removed agent '#{display}' (#{agent_key}) from registry"
|
|
2885
2949
|
puts " Note: Persona files at ~/.brainiac/brain/persona/#{agent_key}/ were not deleted."
|
|
2950
|
+
write_bar_icon(display, nil) if bar_icon(display)
|
|
2886
2951
|
|
|
2887
2952
|
# Let plugins clean up their config
|
|
2888
2953
|
notify_plugins_agent_removed(agent_key, display)
|
data/docs/waybar-config.md
CHANGED
|
@@ -30,6 +30,19 @@ This file configures how agents appear in the status bar — waybar on Linux, xb
|
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
## Setting an agent's icon
|
|
34
|
+
|
|
35
|
+
You don't need to edit this file by hand. `brainiac agent create` asks for an
|
|
36
|
+
icon (or takes `--icon`), and `brainiac agent setup` asks for one if the agent
|
|
37
|
+
has none. To change one later:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
brainiac agent setup "Judge Dredd" --icon ⚖️
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The Omarchy bar plugin, waybar and xbar all read this file, so one entry covers
|
|
44
|
+
every bar. Agents without an entry show `default_emoji`.
|
|
45
|
+
|
|
33
46
|
## Fields
|
|
34
47
|
|
|
35
48
|
- **name**: Agent name (must match agent registry)
|
data/lib/brainiac/version.rb
CHANGED