|
1 | | -# Homebrew Formula for Terraphim AI |
| 1 | +# Installing Terraphim AI |
2 | 2 |
|
3 | | -This page provides instructions for installing Terraphim AI using Homebrew on macOS and Linux. |
| 3 | +Terraphim AI is distributed through two supported channels. There is no |
| 4 | +in-repo Homebrew formula — installation is handled by the official Homebrew |
| 5 | +tap or directly from crates.io / source. |
4 | 6 |
|
5 | | -## Installation |
| 7 | +## Option 1: Homebrew tap (recommended) |
6 | 8 |
|
7 | | -### Option 1: Install from Tap (Recommended) |
8 | | - |
9 | | -Once published to a Homebrew tap, you can install with: |
| 9 | +The official tap lives in a dedicated repository and covers the shipped CLI |
| 10 | +tools (`terraphim-grep`, `terraphim-agent`, `terraphim_rlm`): |
10 | 11 |
|
11 | 12 | ```bash |
12 | | -# Add the Terraphim AI tap |
13 | | -brew tap terraphim/terraphim-ai |
14 | | - |
15 | | -# Install Terraphim AI |
| 13 | +brew tap terraphim/terraphim |
16 | 14 | brew install terraphim-ai |
17 | 15 | ``` |
18 | 16 |
|
19 | | -### Option 2: Install from Local Formula |
20 | | - |
21 | | -For development or testing, you can install directly from the formula file: |
22 | | - |
23 | | -```bash |
24 | | -# Clone the repository |
25 | | -git clone https://github.com/terraphim/terraphim-ai.git |
26 | | -cd terraphim-ai |
27 | | - |
28 | | -# Install from local formula |
29 | | -brew install --build-from-source ./terraphim-ai.rb |
30 | | -``` |
31 | | - |
32 | | -## What Gets Installed |
33 | | - |
34 | | -The Homebrew formula installs the following components: |
35 | | - |
36 | | -### Binaries |
37 | | -- **Server**: `terraphim_server` command-line tool |
38 | | -- **TUI**: `terraphim-agent` terminal user interface |
39 | | -- **Desktop App**: "Terraphim Desktop.app" (macOS only) |
40 | | - |
41 | | -### Configuration |
42 | | -- Default configuration files in `/usr/local/etc/terraphim-ai/` |
43 | | -- Includes role configurations for different user profiles |
44 | | - |
45 | | -### Documentation |
46 | | -- README and documentation files in `/usr/local/share/doc/terraphim-ai/` |
47 | | - |
48 | | -## Usage |
49 | | - |
50 | | -### Server Mode |
51 | | -```bash |
52 | | -# Start the server |
53 | | -terraphim_server |
54 | | - |
55 | | -# Start with custom configuration |
56 | | -terraphim_server --config /path/to/config.json |
57 | | - |
58 | | -# View help |
59 | | -terraphim_server --help |
60 | | -``` |
61 | | - |
62 | | -### Terminal UI (TUI) |
63 | | -```bash |
64 | | -# Start the interactive terminal interface |
65 | | -terraphim-agent |
| 17 | +> The earlier in-repo `scripts/terraphim-ai.rb` placeholder (pinned to |
| 18 | +> `v0.1.0` with a zeroed SHA-256 and referencing binaries that have since |
| 19 | +> moved to the polyrepo split) has been removed. Use the tap above, which |
| 20 | +> tracks real releases. See issue #2895. |
66 | 21 |
|
67 | | -# Use REPL mode with full features |
68 | | -terraphim-agent --features repl-full |
| 22 | +## Option 2: cargo install (from crates.io) |
69 | 23 |
|
70 | | -# View available commands |
71 | | -terraphim-agent --help |
72 | | -``` |
| 24 | +The CLI tools are published to crates.io: |
73 | 25 |
|
74 | | -### Desktop App (macOS) |
75 | 26 | ```bash |
76 | | -# Launch desktop application |
77 | | -open "/Applications/Terraphim Desktop.app" |
| 27 | +cargo install terraphim_grep # semantic code search CLI |
| 28 | +cargo install terraphim_agent # agent + REPL binary |
| 29 | +cargo install terraphim_rlm # role/routing language model bridge |
78 | 30 | ``` |
79 | 31 |
|
80 | | -### Service Management |
81 | | -```bash |
82 | | -# Start as background service |
83 | | -brew services start terraphim-ai |
84 | | - |
85 | | -# Stop the service |
86 | | -brew services stop terraphim-ai |
87 | | - |
88 | | -# View service status |
89 | | -brew services list | grep terraphim-ai |
90 | | -``` |
91 | | - |
92 | | -## Configuration |
93 | | - |
94 | | -Default configuration files are installed in `/usr/local/etc/terraphim-ai/`: |
95 | | -- `terraphim_engineer_config.json` - Engineering role configuration |
96 | | -- `system_operator_config.json` - System operator role configuration |
97 | | - |
98 | | -You can customize these files or create your own configurations. |
99 | | - |
100 | | -## Logs |
101 | | - |
102 | | -When running as a service, logs are written to: |
103 | | -- **Standard output**: `/usr/local/var/log/terraphim-ai.log` |
104 | | -- **Error output**: `/usr/local/var/log/terraphim-ai-error.log` |
105 | | - |
106 | | -## Uninstalling |
| 32 | +## Option 3: build from source |
107 | 33 |
|
108 | 34 | ```bash |
109 | | -# Stop the service (if running) |
110 | | -brew services stop terraphim-ai |
111 | | - |
112 | | -# Uninstall the package |
113 | | -brew uninstall terraphim-ai |
114 | | - |
115 | | -# Remove the tap (optional) |
116 | | -brew untap terraphim/terraphim-ai |
117 | | -``` |
118 | | - |
119 | | -## Homebrew Formula |
120 | | - |
121 | | -The complete Homebrew formula (`terraphim-ai.rb`): |
122 | | - |
123 | | -```ruby |
124 | | -class TerraphimAi < Formula |
125 | | - desc "Privacy-first AI assistant with semantic search and knowledge graphs" |
126 | | - homepage "https://github.com/terraphim/terraphim-ai" |
127 | | - url "https://github.com/terraphim/terraphim-ai/archive/refs/tags/v0.1.0.tar.gz" |
128 | | - sha256 "0000000000000000000000000000000000000000000000000000000000000000" # Will need to be updated with actual SHA256 |
129 | | - license "MIT" |
130 | | - head "https://github.com/terraphim/terraphim-ai.git", branch: "main" |
131 | | - |
132 | | - depends_on "rust" => :build |
133 | | - depends_on "node" => :build |
134 | | - depends_on "yarn" => :build |
135 | | - depends_on "pkg-config" => :build |
136 | | - depends_on "openssl@3" |
137 | | - depends_on "sqlite" |
138 | | - |
139 | | - def install |
140 | | - # Build the Rust components |
141 | | - system "cargo", "build", "--release", "--bin", "terraphim_server" |
142 | | - |
143 | | - # Build the desktop app (if on macOS) |
144 | | - if OS.mac? |
145 | | - cd "desktop" do |
146 | | - system "yarn", "install" |
147 | | - system "yarn", "run", "tauri", "build" |
148 | | - end |
149 | | - |
150 | | - # Install the desktop app bundle |
151 | | - app_bundle = "target/release/bundle/macos/Terraphim Desktop.app" |
152 | | - if File.exist?(app_bundle) |
153 | | - prefix.install app_bundle => "Terraphim Desktop.app" |
154 | | - end |
155 | | - end |
156 | | - |
157 | | - # Install the server binary |
158 | | - bin.install "target/release/terraphim_server" |
159 | | - |
160 | | - # Install configuration files |
161 | | - (etc/"terraphim-ai").mkpath |
162 | | - (etc/"terraphim-ai").install Dir["terraphim_server/default/*.json"] |
163 | | - |
164 | | - # Install documentation |
165 | | - doc.install "README.md" |
166 | | - doc.install "docs" if Dir.exist?("docs") |
167 | | - end |
168 | | - |
169 | | - def caveats |
170 | | - <<~EOS |
171 | | - Terraphim AI has been installed with the following components: |
172 | | -
|
173 | | - 1. Server: Run with `terraphim_server` |
174 | | - 2. Desktop App: Available in Applications folder (macOS only) |
175 | | -
|
176 | | - Default configuration files are located in: |
177 | | - #{etc}/terraphim-ai/ |
178 | | -
|
179 | | - For first-time setup: |
180 | | - 1. Run `terraphim_server --help` to see available options |
181 | | - 2. Configuration files can be customized in #{etc}/terraphim-ai/ |
182 | | - 3. The desktop app will create its own config on first run |
183 | | -
|
184 | | - Documentation is available in: |
185 | | - #{doc}/ |
186 | | - EOS |
187 | | - end |
188 | | - |
189 | | - service do |
190 | | - run opt_bin/"terraphim_server" |
191 | | - keep_alive true |
192 | | - error_log_path var/"log/terraphim-ai-error.log" |
193 | | - log_path var/"log/terraphim-ai.log" |
194 | | - working_dir HOMEBREW_PREFIX |
195 | | - end |
196 | | - |
197 | | - test do |
198 | | - # Test that the server binary was installed and shows version info |
199 | | - system "#{bin}/terraphim_server", "--version" |
200 | | - |
201 | | - # Test that config files were installed |
202 | | - assert_predicate etc/"terraphim-ai", :exist? |
203 | | - |
204 | | - # Test basic functionality by checking the help output |
205 | | - help_output = shell_output("#{bin}/terraphim_server --help") |
206 | | - assert_match "Terraphim AI Server", help_output |
207 | | - end |
208 | | -end |
| 35 | +git clone https://github.com/terraphim/terraphim-ai.git |
| 36 | +cd terraphim-ai |
| 37 | +cargo build --release |
209 | 38 | ``` |
210 | 39 |
|
211 | | -## Requirements |
212 | | - |
213 | | -### Build Dependencies |
214 | | -- Rust (latest stable) |
215 | | -- Node.js (v16 or later) |
216 | | -- Yarn package manager |
217 | | -- pkg-config |
218 | | - |
219 | | -### Runtime Dependencies |
220 | | -- OpenSSL 3.x |
221 | | -- SQLite 3.x |
222 | | - |
223 | | -## Troubleshooting |
224 | | - |
225 | | -### Build Issues |
226 | | - |
227 | | -1. **Rust not found**: Ensure Rust is installed via `rustup` or Homebrew |
228 | | -2. **Node.js version**: Requires Node.js v16 or later |
229 | | -3. **Missing dependencies**: Run `brew doctor` to check for system issues |
230 | | - |
231 | | -### Runtime Issues |
232 | | - |
233 | | -1. **Config not found**: Check `/usr/local/etc/terraphim-ai/` for configuration files |
234 | | -2. **Permission errors**: Ensure proper file permissions for log directory |
235 | | -3. **Port conflicts**: Default server port may conflict with other services |
236 | | - |
237 | | -### Getting Help |
238 | | - |
239 | | -- Check the logs in `/usr/local/var/log/terraphim-ai*.log` |
240 | | -- Run `terraphim_server --help` for command-line options |
241 | | -- Refer to the main documentation in `/usr/local/share/doc/terraphim-ai/` |
242 | | - |
243 | | -## Publishing to Homebrew |
| 40 | +Binaries are emitted to `target/release/`. See the workspace `Cargo.toml` |
| 41 | +for the current set of buildable crates. |
244 | 42 |
|
245 | | -To publish this formula to Homebrew: |
| 43 | +## Release channels — source of truth |
246 | 44 |
|
247 | | -1. **Create a release** on GitHub with proper version tagging |
248 | | -2. **Calculate SHA256** of the release archive |
249 | | -3. **Update the formula** with the correct URL and SHA256 |
250 | | -4. **Submit to homebrew-core** or create your own tap |
| 45 | +| Channel | Canonical location | Notes | |
| 46 | +|---------|-------------------|-------| |
| 47 | +| crates.io | `crates.io/crates/terraphim_{grep,agent,rlm}` | Public; the canonical release channel for the CLI tools | |
| 48 | +| GitHub release assets | `github.com/terraphim/terraphim-ai/releases` | Prebuilt signed binaries for `terraphim-grep` and `terraphim-agent` | |
| 49 | +| Homebrew tap | `github.com/terraphim/homebrew-terraphim` | Official tap; replaces the former in-repo placeholder formula | |
| 50 | +| Private Gitea cargo registry | `git.terraphim.cloud/.../cargo/` | Internal mirror; may lag crates.io — prefer crates.io for current versions | |
251 | 51 |
|
252 | | -For detailed instructions on creating Homebrew formulae, see the [Homebrew Formula Cookbook](https://docs.brew.sh/Formula-Cookbook). |
| 52 | +**Note on mirror state:** the GitHub mirror can run *ahead* of the Gitea |
| 53 | +mirror for `terraphim/terraphim-ai` releases. crates.io is the authoritative |
| 54 | +source for the published CLI tool versions. |
0 commit comments