Skip to content

Commit df84a00

Browse files
fix: create homebrew tap, update install script with auto-PATH
1 parent b0c5e1d commit df84a00

5 files changed

Lines changed: 136 additions & 80 deletions

File tree

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Orca  [![Version](https://img.shields.io/badge/version-1.1.0-blue)](https://github.com/christopherkarani/Orca/releases) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) [![Zig](https://img.shields.io/badge/built%20with-Zig-orange)](https://ziglang.org) [![Build](https://img.shields.io/github/actions/workflow/status/christopherkarani/Orca/build.yml?branch=main&label=build)](https://github.com/christopherkarani/Orca/actions/workflows/build.yml) [![Stars](https://img.shields.io/github/stars/christopherkarani/Orca?style=social)](https://github.com/christopherkarani/Orca)
1+
# Orca  [![Version](https://img.shields.io/badge/version-1.1.0-blue)](https://github.com/christopherkarani/Orca/releases) [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE) [![Zig](https://img.shields.io/badge/built%20with-Zig-orange)](https://ziglang.org) [![Build](https://img.shields.io/github/actions/workflow/status/christopherkarani/Orca/build.yml?branch=main&label=build)](https://github.com/christopherkarani/Orca/actions/workflows/build.yml) [![Stars](https://img.shields.io/github/stars/christopherkarani/Orca?style=social)](https://github.com/christopherkarani/Orca)
22

33
**Unleash AI agents with confidence.**
44

@@ -10,7 +10,7 @@ Orca wraps the AI tools you already use—Codex, Claude Code, OpenCode, OpenClaw
1010

1111
```bash
1212
# Install (macOS/Linux)
13-
brew tap christopherkarani/orca && brew install orca
13+
brew tap christopherkarani/orca && brew install --formula orca
1414

1515
# Or install with the official script
1616
curl -fsSL https://raw.githubusercontent.com/christopherkarani/Orca/main/scripts/install.sh | sh
@@ -114,17 +114,22 @@ AI agents can run shell commands, read files, and make network requests on your
114114
```bash
115115
# macOS
116116
brew tap christopherkarani/orca
117-
brew install orca
117+
brew install --formula orca
118118

119119
# Linux (amd64 / arm64)
120120
curl -fsSL https://raw.githubusercontent.com/christopherkarani/Orca/main/scripts/install.sh | sh
121-
122-
# Verify
123-
orca doctor
124121
```
125122

123+
> The script installs to `~/.local/bin` and automatically adds it to your shell's `PATH`. Open a new terminal (or run `source ~/.zshrc` / `.bashrc`) to use `orca` right away.
124+
>
126125
> **Prefer to build?** See [docs/install.md](docs/install.md) for source builds, Windows installers, and Docker.
127126
127+
After installing, verify:
128+
129+
```bash
130+
orca doctor
131+
```
132+
128133
### 1. Create your first policy
129134

130135
```bash

packaging/homebrew/Formula/orca.rb

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,28 @@ class Orca < Formula
77
on_macos do
88
if Hardware::CPU.arm?
99
url "https://github.com/christopherkarani/Orca/releases/download/v#{version}/orca-v#{version}-darwin-arm64.tar.gz"
10-
sha256 "81cf09553da5032cb07fbaefe63022e267f66671793676c234fffc7d2b3de807"
10+
sha256 "b93a7f5fa5d94700f7f990d06e705bfddfcc67bc4b49c0687a630fdab800bc3d"
1111
else
1212
url "https://github.com/christopherkarani/Orca/releases/download/v#{version}/orca-v#{version}-darwin-amd64.tar.gz"
13-
sha256 "299ebf4dd1fae496e7916dca99b4b215bbd4a4d5c6becffb2d5de3dc1e7086f9"
13+
sha256 "fda91b91bff5ef5e5f2c7549b074e7400918c3010d3ec72cf253ce01eff45178"
1414
end
1515
end
1616

1717
on_linux do
1818
if Hardware::CPU.arm?
1919
url "https://github.com/christopherkarani/Orca/releases/download/v#{version}/orca-v#{version}-linux-arm64.tar.gz"
20-
sha256 "ac3ae9cdc7b778183e50d6d77a5c1a412d32381bcc0c12abacf49551605bd41d"
20+
sha256 "dabd4f89a49c03d7c3c1a9e96bbfeb828b39903d68b666de9c2ae194c78abecf"
2121
else
2222
url "https://github.com/christopherkarani/Orca/releases/download/v#{version}/orca-v#{version}-linux-amd64.tar.gz"
23-
sha256 "4a793bc1209540a15fff1d6984907c6829b661f0a746f549cc17967661cc4247"
23+
sha256 "ace518c72134b8deee5816819f31781ebf92bfa64a76a20051181a46cf7cf852"
2424
end
2525
end
2626

2727
def install
28-
libexec.install "bin/orca" if File.exist?("bin/orca")
29-
pkgshare.install "docs" if Dir.exist?("docs")
30-
pkgshare.install "examples" if Dir.exist?("examples")
31-
pkgshare.install "fixtures" if Dir.exist?("fixtures")
32-
pkgshare.install "integrations" if Dir.exist?("integrations")
33-
pkgshare.install "policies" if Dir.exist?("policies")
34-
pkgshare.install "schemas" if Dir.exist?("schemas")
35-
36-
(bin/"orca").write <<~EOS
37-
#!/bin/sh
38-
export ORCA_RESOURCE_ROOT="#{pkgshare}"
39-
exec "#{libexec}/orca" "$@"
40-
EOS
41-
chmod 0755, bin/"orca"
28+
bin.install "bin/orca"
4229
end
4330

4431
test do
45-
assert_match version.to_s, shell_output("#{bin}/orca version")
46-
hermes_manifest = shell_output("#{bin}/orca plugin manifest hermes")
47-
assert_match "Hermes plugin manifest", hermes_manifest
48-
assert_match "manifest status: exists", hermes_manifest
49-
assert_match "(exists)", hermes_manifest
32+
assert_match version.to_s, shell_output("#{bin}/orca --version")
5033
end
5134
end

packaging/homebrew/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22

33
This directory is the source for the `christopherkarani/homebrew-orca` tap.
44

5-
Release flow:
5+
## Release flow
66

77
```sh
88
./scripts/build-release.sh
9+
# Ensure release assets are uploaded to GitHub before updating the formula
910
./scripts/update-homebrew-formula.sh
1011
brew audit --strict --online packaging/homebrew/Formula/orca.rb
11-
brew install --build-from-source packaging/homebrew/Formula/orca.rb
12+
brew install --formula packaging/homebrew/Formula/orca.rb
1213
brew test packaging/homebrew/Formula/orca.rb
1314
```
1415

15-
Publish flow:
16+
## Publish flow
1617

1718
1. Create or update `https://github.com/christopherkarani/homebrew-orca`.
1819
2. Copy `packaging/homebrew/Formula/orca.rb` to `Formula/orca.rb` in that tap.
19-
3. Commit the formula update after the matching GitHub Release assets are uploaded.
20+
3. Copy `packaging/homebrew/README.md` to `README.md` in that tap.
21+
4. Commit and push after the matching GitHub Release assets are uploaded.
2022

21-
The formula uses release archive SHA-256 checksum values from `dist/checksums.txt`.
22-
23-
User install after the tap exists:
23+
## User install
2424

2525
```sh
2626
brew tap christopherkarani/orca
2727
brew install orca
28-
orca plugin install hermes --yes
28+
orca --version
29+
orca doctor
2930
```

scripts/install.sh

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,45 @@ safe_install() {
9191
chmod 0755 "$destination"
9292
}
9393

94+
rc_file_for_shell() {
95+
shell_name="$1"
96+
case "$shell_name" in
97+
*/zsh) printf '%s' "${ZDOTDIR:-$HOME}/.zshrc" ;;
98+
*/bash)
99+
if [ -f "$HOME/.bashrc" ]; then
100+
printf '%s' "$HOME/.bashrc"
101+
elif [ -f "$HOME/.bash_profile" ]; then
102+
printf '%s' "$HOME/.bash_profile"
103+
else
104+
printf '%s' "$HOME/.bashrc"
105+
fi
106+
;;
107+
*/fish) printf '%s' "$HOME/.config/fish/config.fish" ;;
108+
*) printf '%s' "$HOME/.profile" ;;
109+
esac
110+
}
111+
112+
ensure_path_entry() {
113+
dir="$1"
114+
shell_path="${SHELL:-/bin/sh}"
115+
shell_name="$(basename "$shell_path")"
116+
rc_file="$(rc_file_for_shell "$shell_path")"
117+
118+
if [ ! -d "$(dirname "$rc_file")" ] && [ "$(dirname "$rc_file")" != "$HOME" ]; then
119+
mkdir -p "$(dirname "$rc_file")"
120+
fi
121+
122+
if [ -f "$rc_file" ]; then
123+
if grep -qF "export PATH=\"$dir" "$rc_file" 2>/dev/null || grep -qF "export PATH=\"\$HOME/.local/bin" "$rc_file" 2>/dev/null; then
124+
return 0
125+
fi
126+
fi
127+
128+
printf '\n# Added by Orca installer\nexport PATH="%s:$PATH"\n' "$dir" >> "$rc_file"
129+
printf 'Added %s to PATH in %s\n' "$dir" "$rc_file"
130+
printf 'Run: source %s (or open a new terminal)\n' "$rc_file"
131+
}
132+
94133
OS="$(detect_os)"
95134
ARCH="$(detect_arch)"
96135
ARTIFACT="orca-v${VERSION}-${OS}-${ARCH}.tar.gz"
@@ -114,8 +153,11 @@ FOUND_BIN="$(find "$TMP_DIR" -type f -name orca -perm -111 | head -n 1)"
114153
DESTINATION="$INSTALL_DIR/orca"
115154
safe_install "$FOUND_BIN" "$DESTINATION"
116155

117-
printf 'Installed Orca to %s\n' "$DESTINATION"
118-
printf 'Next steps:\n'
119-
printf ' %s version\n' "$DESTINATION"
120-
printf ' %s doctor\n' "$DESTINATION"
121-
printf ' %s init --preset generic-agent\n' "$DESTINATION"
156+
printf '\nInstalled Orca to %s\n' "$DESTINATION"
157+
158+
ensure_path_entry "$INSTALL_DIR"
159+
160+
printf '\nNext steps:\n'
161+
printf ' orca --version\n'
162+
printf ' orca doctor\n'
163+
printf ' orca init --preset generic-agent\n'

scripts/update-homebrew-formula.sh

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,63 @@
11
#!/usr/bin/env sh
22
set -eu
33

4-
VERSION="${ORCA_VERSION:-1.1.0}"
5-
DIST_DIR="${ORCA_DIST_DIR:-dist}"
6-
FORMULA="${ORCA_HOMEBREW_FORMULA:-packaging/homebrew/Formula/orca.rb}"
7-
CHECKSUMS="${DIST_DIR}/checksums.txt"
4+
VERSION="${1:-${ORCA_VERSION:-}}"
5+
HOMEBREW_TAP_DIR="${ORCA_HOMEBREW_TAP_DIR:-${HOME}/code/homebrew-orca}"
6+
FORMULA_OUT="${ORCA_HOMEBREW_FORMULA:-${HOMEBREW_TAP_DIR}/Formula/orca.rb}"
7+
TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/orca-homebrew.XXXXXX")"
8+
9+
cleanup() {
10+
rm -rf "$TMP_DIR"
11+
}
12+
trap cleanup EXIT INT TERM
813

914
fail() {
1015
printf 'update-homebrew-formula: %s\n' "$1" >&2
1116
exit 1
1217
}
1318

14-
checksum_for() {
15-
name="$1"
16-
awk -v name="$name" '$2 == name {print $1}' "$CHECKSUMS"
19+
[ -n "$VERSION" ] || fail "usage: $0 <version> (or set ORCA_VERSION)"
20+
21+
BASE_URL="https://github.com/christopherkarani/Orca/releases/download/v${VERSION}"
22+
23+
printf 'Downloading release assets for Orca %s...\n' "$VERSION"
24+
25+
for plat in darwin-arm64 darwin-amd64 linux-arm64 linux-amd64; do
26+
artifact="orca-v${VERSION}-${plat}.tar.gz"
27+
url="${BASE_URL}/${artifact}"
28+
output="${TMP_DIR}/${artifact}"
29+
30+
printf ' → %s\n' "$artifact"
31+
if command -v curl >/dev/null 2>&1; then
32+
curl -fsSL -o "$output" "$url" || fail "failed to download $url"
33+
elif command -v wget >/dev/null 2>&1; then
34+
wget -q -O "$output" "$url" || fail "failed to download $url"
35+
else
36+
fail "curl or wget is required"
37+
fi
38+
done
39+
40+
sha256_file() {
41+
file="$1"
42+
if command -v sha256sum >/dev/null 2>&1; then
43+
sha256sum "$file" | awk '{print $1}'
44+
elif command -v shasum >/dev/null 2>&1; then
45+
shasum -a 256 "$file" | awk '{print $1}'
46+
else
47+
fail "sha256sum or shasum is required"
48+
fi
1749
}
1850

19-
[ -f "$FORMULA" ] || fail "formula not found: $FORMULA"
20-
[ -f "$CHECKSUMS" ] || fail "checksums not found: $CHECKSUMS"
51+
darwin_arm64="$(sha256_file "${TMP_DIR}/orca-v${VERSION}-darwin-arm64.tar.gz")"
52+
darwin_amd64="$(sha256_file "${TMP_DIR}/orca-v${VERSION}-darwin-amd64.tar.gz")"
53+
linux_arm64="$(sha256_file "${TMP_DIR}/orca-v${VERSION}-linux-arm64.tar.gz")"
54+
linux_amd64="$(sha256_file "${TMP_DIR}/orca-v${VERSION}-linux-amd64.tar.gz")"
2155

22-
darwin_amd64="$(checksum_for "orca-v${VERSION}-darwin-amd64.tar.gz")"
23-
darwin_arm64="$(checksum_for "orca-v${VERSION}-darwin-arm64.tar.gz")"
24-
linux_amd64="$(checksum_for "orca-v${VERSION}-linux-amd64.tar.gz")"
25-
linux_arm64="$(checksum_for "orca-v${VERSION}-linux-arm64.tar.gz")"
56+
printf 'Generating formula...\n'
2657

27-
[ -n "$darwin_amd64" ] || fail "missing darwin amd64 checksum"
28-
[ -n "$darwin_arm64" ] || fail "missing darwin arm64 checksum"
29-
[ -n "$linux_amd64" ] || fail "missing linux amd64 checksum"
30-
[ -n "$linux_arm64" ] || fail "missing linux arm64 checksum"
58+
mkdir -p "$(dirname "$FORMULA_OUT")"
3159

32-
cat > "$FORMULA" <<EOF
60+
cat > "$FORMULA_OUT" <<EOF
3361
class Orca < Formula
3462
desc "Local runtime firewall for AI agents"
3563
homepage "https://github.com/christopherkarani/Orca"
@@ -57,30 +85,27 @@ class Orca < Formula
5785
end
5886
5987
def install
60-
libexec.install "bin/orca" if File.exist?("bin/orca")
61-
pkgshare.install "docs" if Dir.exist?("docs")
62-
pkgshare.install "examples" if Dir.exist?("examples")
63-
pkgshare.install "fixtures" if Dir.exist?("fixtures")
64-
pkgshare.install "integrations" if Dir.exist?("integrations")
65-
pkgshare.install "policies" if Dir.exist?("policies")
66-
pkgshare.install "schemas" if Dir.exist?("schemas")
67-
68-
(bin/"orca").write <<~EOS
69-
#!/bin/sh
70-
export ORCA_RESOURCE_ROOT="#{pkgshare}"
71-
exec "#{libexec}/orca" "\$@"
72-
EOS
73-
chmod 0755, bin/"orca"
88+
bin.install "bin/orca"
7489
end
7590
7691
test do
77-
assert_match version.to_s, shell_output("#{bin}/orca version")
78-
hermes_manifest = shell_output("#{bin}/orca plugin manifest hermes")
79-
assert_match "Hermes plugin manifest", hermes_manifest
80-
assert_match "manifest status: exists", hermes_manifest
81-
assert_match "(exists)", hermes_manifest
92+
assert_match version.to_s, shell_output("#{bin}/orca --version")
8293
end
8394
end
8495
EOF
8596

86-
printf 'Updated %s for Orca %s\n' "$FORMULA" "$VERSION"
97+
printf 'Formula written to %s\n' "$FORMULA_OUT"
98+
99+
# Optionally commit and push to the tap repo
100+
if [ -d "${HOMEBREW_TAP_DIR}/.git" ]; then
101+
cd "$HOMEBREW_TAP_DIR"
102+
git add Formula/orca.rb
103+
if git diff --cached --quiet; then
104+
printf 'No changes to commit.\n'
105+
else
106+
git commit -m "Update orca to ${VERSION}"
107+
printf 'Committed. Run `git push` to publish.\n'
108+
fi
109+
else
110+
printf 'Note: %s is not a git repo. Skipping commit.\n' "$HOMEBREW_TAP_DIR"
111+
fi

0 commit comments

Comments
 (0)