# Generated from the exact release source and verified release archives. Review before publishing.
class AgentFloatTerm < Formula
desc "Persistent F7 shell beside your unwrapped AI CLI"
homepage "https://github.com/vuongvm812/agent-float-term"
version "@VERSION@"
license "MIT"
depends_on "tmux"
on_macos do
on_arm do
depends_on macos: :sonoma
url "https://github.com/vuongvm812/agent-float-term/releases/download/@TAG@/agent-float-term-@TAG@-aarch64-apple-darwin.tar.gz"
sha256 "@AARCH64_APPLE_DARWIN_SHA256@"
end
on_intel do
depends_on macos: :sequoia
url "https://github.com/vuongvm812/agent-float-term/releases/download/@TAG@/agent-float-term-@TAG@-x86_64-apple-darwin.tar.gz"
sha256 "@X86_64_APPLE_DARWIN_SHA256@"
end
end
on_linux do
depends_on arch: :x86_64
url "https://github.com/vuongvm812/agent-float-term/releases/download/@TAG@/agent-float-term-@TAG@-x86_64-unknown-linux-gnu.tar.gz"
sha256 "@X86_64_UNKNOWN_LINUX_GNU_SHA256@"
end
def install
if OS.linux?
unless Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
odie "Linux ARM64 is unsupported; only x86_64 GNU/Linux archives are provided."
end
libc = begin
Utils.safe_popen_read("/usr/bin/getconf", "GNU_LIBC_VERSION").strip
rescue ErrorDuringExecution
""
end
unless libc.start_with?("glibc ") && Version.new(libc.split.last) >= Version.new("2.35")
odie "musl Linux is unsupported; this archive requires glibc 2.35 or newer."
end
end
bin.install "agent-float-term"
end
def caveats
<<~EOS
Homebrew owns the binary; this formula does not run the application's installer
or modify your shell/tmux configuration.
No separate application installation is needed. Inside an existing tmux server, run:
agent-float-term bind
Or open a dedicated tmux shell from an interactive terminal:
agent-float-term start
First bind/start registers #{opt_bin}/agent-float-term and generates user-local
integration templates and a manifest. No binary is copied into your home, and no
startup configuration is edited. Existing installations require explicit migration.
Help, version, and doctor do not register integrations.
Optional startup configuration edits still require explicit flags. After first use:
agent-float-term install --tmux-config "$HOME/.tmux.conf"
Review the preview, then repeat with --yes. Shell startup likewise requires an
explicit --shell-config PATH and --shell-kind bash (or zsh).
Preview integration removal with `agent-float-term uninstall`, then add --yes.
Remove integration before `brew uninstall agent-float-term`; Homebrew alone owns upgrades
and binary removal. The application's update/rollback commands are not used in this mode.
EOS
end
test do
home = testpath/"home"
home.mkpath
ENV["HOME"] = home.to_s
%w[CONFIG DATA STATE CACHE RUNTIME].each do |kind|
directory = home/"xdg-#{kind.downcase}"
directory.mkpath
ENV["XDG_#{kind}_HOME"] = directory.to_s unless kind == "RUNTIME"
ENV["XDG_RUNTIME_DIR"] = directory.to_s if kind == "RUNTIME"
end
ENV["XDG_CONFIG_DIRS"] = (home/"config-dirs").to_s
ENV["XDG_DATA_DIRS"] = (home/"data-dirs").to_s
ENV["SHELL"] = "/bin/bash"
ENV.delete("TMUX")
ENV.delete("TMUX_PANE")
ENV.delete("AFT_TMUX_BINARY")
binary = opt_bin/"agent-float-term"
original = Digest::SHA256.file(binary).hexdigest
tmux_config = home/"tmux.conf"
shell_config = home/"bashrc"
tmux_config.write "# original tmux config\n"
shell_config.write "# original shell config\n"
manifest = home/"xdg-state/agent-float-term/install.json"
socket = testpath/"tmux.sock"
begin
system "tmux", "-S", socket, "-f", "/dev/null", "new-session", "-d", "-s", "test", "sleep 120"
system binary, "--help"
system binary, "--version"
system binary, "doctor", "--socket", socket
refute_path_exists manifest
system binary, "bind", "--socket", socket
assert_path_exists manifest
assert_match '"format": 3', manifest.read
assert_match binary.to_s, manifest.read
assert_equal "# original tmux config\n", tmux_config.read
assert_equal "# original shell config\n", shell_config.read
before = manifest.read
system binary, "bind", "--socket", socket
assert_equal before, manifest.read
args = ["install", "--tmux-config", tmux_config.to_s, "--shell-config", shell_config.to_s,
"--shell-kind", "bash"]
system binary, *args
assert_equal before, manifest.read
assert_equal "# original tmux config\n", tmux_config.read
assert_equal "# original shell config\n", shell_config.read
system binary, *args, "--yes"
assert_path_exists home/"xdg-state/agent-float-term/install.json"
assert_match binary.to_s, (home/"xdg-data/agent-float-term/integration.tmux").read
assert_match "# BEGIN agent-float-term managed v1", tmux_config.read
assert_match "# BEGIN agent-float-term managed v1", shell_config.read
refute_path_exists home/".local/bin/agent-float-term"
refute_path_exists home/"xdg-data/agent-float-term/current"
refute_path_exists home/"xdg-data/agent-float-term/releases"
system binary, "uninstall"
assert_path_exists home/"xdg-state/agent-float-term/install.json"
system binary, "uninstall", "--yes"
refute_path_exists home/"xdg-state/agent-float-term/install.json"
refute_path_exists home/"xdg-data/agent-float-term/integration.tmux"
refute_path_exists home/"xdg-data/agent-float-term/integration.sh"
assert_equal "# original tmux config\n", tmux_config.read
assert_equal "# original shell config\n", shell_config.read
assert_path_exists binary
assert_equal original, Digest::SHA256.file(binary).hexdigest
system binary, "--version"
ensure
system "tmux", "-S", socket, "kill-server"
end
end
end