Commit 0fd7d22c0b

0fd7d22c0b54c4e418fa5e8786cc20a193f61250

parent: c5729c285a

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-31 19:59 UTC

Remove ambient-companions

Layout: unified · split

Formula/ambient-companions.rb deleted −100
@@ -1,100 +0,0 @@
1class AmbientCompanions < Formula
2 desc "Ambient system companions over one privacy-preserving signal daemon"
3 homepage "https://gitbay.org/krz/ambient-companions"
4 url "https://gitbay.org/krz/ambient-companions.git",
5 tag: "v1.2.1",
6 revision: "d04b3e45ef2c3e929ea24273dabfcf7ecdb68715"
7 license "0BSD"
8 head "https://gitbay.org/krz/ambient-companions.git", branch: "main"
9
10 depends_on "rust" => :build
11 # macos-collector is a SwiftPM package; swift-tools-version 5.9 needs Xcode 15.
12 depends_on xcode: ["15.0", :build]
13 depends_on :macos
14
15 def install
16 system "cargo", "install", *std_cargo_args(path: "crates/signald")
17 system "cargo", "install", *std_cargo_args(path: "crates/terminal-garden")
18 system "cargo", "install", *std_cargo_args(path: "crates/terminal-pet")
19 system "cargo", "install", *std_cargo_args(path: "crates/pet-life")
20
21 # The IOKit collector runs out of process as a child of signald.
22 # --disable-sandbox: SwiftPM sandboxes its own manifest compile, and that
23 # sandbox_apply fails inside Homebrew's build sandbox. Homebrew's is still
24 # in force around the whole build.
25 system "swift", "build", "-c", "release", "--disable-sandbox",
26 "--package-path", "macos-collector",
27 "--scratch-path", buildpath/"swift-build"
28 bin.install buildpath/"swift-build/release/macos-collector"
29
30 # The menu-bar face. SwiftPM cannot emit a .app, so the repo's own script
31 # assembles the bundle; installing it into the prefix rather than shipping
32 # a cask keeps this build-from-source, which also means Gatekeeper never
33 # quarantines it.
34 system "swift", "build", "-c", "release", "--disable-sandbox",
35 "--package-path", "menubar-pet",
36 "--scratch-path", buildpath/"menubar-build"
37 system "menubar-pet/scripts/bundle.sh",
38 buildpath/"menubar-build/release/menubar-pet", prefix
39 # pet-life sits beside the app binary so the bundle finds it without PATH.
40 (prefix/"menubar-pet.app/Contents/MacOS").install_symlink bin/"pet-life"
41
42 # Sourced from the user's .zshrc; see the README install section.
43 pkgshare.install "shell-hooks/signald-hooks.zsh"
44 # The launchd template, for a manual install. `brew services` uses the
45 # service block below instead.
46 pkgshare.install "packaging/net.krz.signald.plist"
47 end
48
49 service do
50 # Repositories to watch come from ~/.config/signald/repos — launchd starts
51 # an agent in /, so there is no useful working directory to fall back on.
52 run [opt_bin/"signald", "--collector", opt_bin/"macos-collector"]
53 keep_alive true
54 run_type :immediate
55 log_path var/"log/signald.log"
56 error_log_path var/"log/signald.err.log"
57 end
58
59 def caveats
60 <<~EOS
61 Name the repositories to watch, one path per line:
62 mkdir -p ~/.config/signald
63 echo ~/git/some-repo > ~/.config/signald/repos
64 brew services restart ambient-companions
65
66 Then source the terminal collector hooks from your .zshrc:
67 source "#{opt_pkgshare}/signald-hooks.zsh"
68
69 The menu-bar pet is an app, not a service. Launch it with:
70 open "#{opt_prefix}/menubar-pet.app"
71 and add it under System Settings > General > Login Items to keep it.
72 It has one life: neglect it for a week and it dies for good.
73 EOS
74 end
75
76 test do
77 assert_match version.to_s, shell_output("#{bin}/signald --version")
78 assert_match version.to_s, shell_output("#{bin}/terminal-garden --version")
79 assert_match version.to_s, shell_output("#{bin}/terminal-pet --version")
80 assert_match version.to_s, shell_output("#{bin}/pet-life --version")
81 # The app is only an app if the bundle is intact.
82 assert_path_exists prefix/"menubar-pet.app/Contents/MacOS/menubar-pet"
83 assert_match "true",
84 shell_output("plutil -extract LSUIElement raw " \
85 "#{prefix}/menubar-pet.app/Contents/Info.plist")
86 # Unknown options exit 2 rather than being taken for a repository path.
87 shell_output("#{bin}/signald --nonexistent-option 2>&1", 2)
88 # One real IOKit read, no root. --once writes raw wire frames to stdout and
89 # the human summary to stderr, so capture stderr alone: folding the binary
90 # in with 2>&1 hands Ruby a string that is not valid UTF-8.
91 assert_match "cpu_load", shell_output("#{bin}/macos-collector --once 2>&1 >/dev/null")
92 # --hex is the same tick as ASCII: a 25-byte frame, 21-byte body. The
93 # schema version deliberately is not pinned here — the canonical-frame
94 # tests in the repo pin it on both the Rust and Swift sides, and asserting
95 # it again from the tap only means this formula breaks on every schema
96 # bump, in a different repository, for no extra coverage.
97 hex = shell_output("#{bin}/macos-collector --once --hex 2>/dev/null")
98 assert_match(/^15000000[0-9a-f]{42}$/, hex.lines.first.chomp)
99 end
100end