Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

feat: add Homebrew tap formula and release script

riley022753727c8c112b
diff --git a/README.md b/README.md
index f72a8527..8c1c74e7 100644
--- a/README.md
+++ b/README.md
@@ -38,17 +38,23 @@ The backend is ready when you see:
Ix Memory backend is ready at http://localhost:8090
```
-### 2. Install CLI dependencies
+### 2. Install the CLI
+**Via Homebrew (recommended):**
```bash
-cd ix-cli && npm install
+brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/IX-Memory
+brew install ix
+```
+
+**Or manually:**
+```bash
+cd ix-cli && npm install && npm run build
```
### 3. Initialize Ix in your project
```bash
-cd /path/to/your/project
-npx tsx /path/to/ix-cli/src/cli/main.ts init
+ix init
```
This checks the backend is running, creates `~/.ix/config.yaml`, and adds Ix rules to your `CLAUDE.md`.
diff --git a/homebrew/README.md b/homebrew/README.md
new file mode 100644
index 00000000..f88685d6
--- /dev/null
+++ b/homebrew/README.md
@@ -0,0 +1,43 @@
+# Homebrew Tap for IX-Memory
+
+## Install
+
+```bash
+brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/IX-Memory
+brew install ix
+```
+
+## Upgrade
+
+```bash
+brew upgrade ix
+```
+
+## Uninstall
+
+```bash
+brew uninstall ix
+brew untap ix-infrastructure/ix
+```
+
+## How it works
+
+The formula:
+1. Downloads the IX-Memory source tarball from GitHub releases
+2. Runs `npm install --production` and `npm run build` in `ix-cli/`
+3. Installs compiled JS + node_modules to `$(brew --prefix)/lib/ix/`
+4. Creates a wrapper script at `$(brew --prefix)/bin/ix`
+
+The `ix` CLI connects to an Ix backend server (not managed by Homebrew). Start the backend separately via Docker Compose or other means.
+
+## Publishing a new release
+
+```bash
+./scripts/release.sh 0.2.0
+```
+
+This creates a GitHub release, computes the tarball SHA256, and updates the formula automatically.
+
+## Tap structure
+
+Homebrew looks for formulas in `homebrew/ix.rb` when the tap URL points to the IX-Memory repo directly. For a dedicated tap repo, copy `ix.rb` to `Formula/ix.rb` in a `homebrew-ix` repo.
diff --git a/homebrew/ix.rb b/homebrew/ix.rb
new file mode 100644
index 00000000..ad6f8cf0
--- /dev/null
+++ b/homebrew/ix.rb
@@ -0,0 +1,30 @@
+class Ix < Formula
+ desc "Persistent memory for LLM systems — CLI for the Ix knowledge graph"
+ homepage "https://github.com/ix-infrastructure/IX-Memory"
+ url "https://github.com/ix-infrastructure/IX-Memory/archive/refs/tags/v0.1.0.tar.gz"
+ # sha256 "UPDATE_WITH_ACTUAL_SHA256_AFTER_RELEASE"
+ license "MIT"
+ head "https://github.com/ix-infrastructure/IX-Memory.git", branch: "main"
+
+ depends_on "node@22"
+
+ def install
+ cd "ix-cli" do
+ system "npm", "install", "--production", "--silent"
+ system "npm", "run", "build"
+
+ # Install the compiled CLI and its dependencies
+ libexec.install "dist", "node_modules", "package.json"
+
+ # Create a wrapper script that invokes node with the correct path
+ (bin/"ix").write <<~EOS
+ #!/bin/bash
+ exec "#{Formula["node@22"].opt_bin}/node" "#{libexec}/dist/cli/main.js" "$@"
+ EOS
+ end
+ end
+
+ test do
+ assert_match "Usage:", shell_output("#{bin}/ix --help")
+ end
+end
diff --git a/scripts/release.sh b/scripts/release.sh
new file mode 100755
index 00000000..64b3a133
--- /dev/null
+++ b/scripts/release.sh
@@ -0,0 +1,96 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# ─────────────────────────────────────────────────────────────────────────────
+# IX-Memory — Release Script
+#
+# Creates a GitHub release with a tarball suitable for Homebrew installation.
+#
+# Usage:
+# ./scripts/release.sh 0.1.0 # Create release v0.1.0
+# ./scripts/release.sh 0.2.0 --draft # Create draft release
+#
+# Prerequisites:
+# - gh CLI installed and authenticated
+# - Clean working tree on main branch
+# - CLI builds successfully
+# ─────────────────────────────────────────────────────────────────────────────
+
+IX_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+VERSION="${1:?Usage: ./scripts/release.sh <version> [--draft]}"
+DRAFT_FLAG=""
+
+if [[ "${2:-}" == "--draft" ]]; then
+ DRAFT_FLAG="--draft"
+fi
+
+TAG="v${VERSION}"
+
+# ── Preflight ────────────────────────────────────────────────────────────────
+
+if ! command -v gh &> /dev/null; then
+ echo "Error: gh CLI is required. Install: https://cli.github.com/"
+ exit 1
+fi
+
+# Verify CLI builds
+echo "Verifying CLI build..."
+cd "$IX_DIR/ix-cli"
+npm install --silent
+npm run build
+echo "[ok] CLI builds successfully"
+
+# Update version in package.json
+cd "$IX_DIR/ix-cli"
+npm version "$VERSION" --no-git-tag-version --allow-same-version 2>/dev/null || true
+cd "$IX_DIR"
+
+# ── Create release ───────────────────────────────────────────────────────────
+
+echo ""
+echo "Creating release $TAG..."
+
+# Create and push tag
+git tag -a "$TAG" -m "Release $TAG"
+git push origin "$TAG"
+
+# Create GitHub release
+gh release create "$TAG" \
+ --title "IX-Memory $TAG" \
+ --notes "## IX-Memory $TAG
+
+### Install via Homebrew
+\`\`\`bash
+brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/IX-Memory
+brew install ix
+\`\`\`
+
+### Install manually
+\`\`\`bash
+git clone https://github.com/ix-infrastructure/IX-Memory
+cd IX-Memory && ./scripts/build-cli.sh
+\`\`\`
+" $DRAFT_FLAG
+
+# ── Update Homebrew formula ─────────────────────────────────────────────────
+
+echo ""
+echo "Fetching release tarball SHA..."
+TARBALL_URL="https://github.com/ix-infrastructure/IX-Memory/archive/refs/tags/${TAG}.tar.gz"
+SHA256=$(curl -sL "$TARBALL_URL" | shasum -a 256 | cut -d' ' -f1)
+
+echo "Updating Homebrew formula..."
+sed -i '' "s|url \".*\"|url \"${TARBALL_URL}\"|" "$IX_DIR/homebrew/ix.rb"
+sed -i '' "s|# sha256 .*|sha256 \"${SHA256}\"|" "$IX_DIR/homebrew/ix.rb"
+
+echo ""
+echo "[ok] Release $TAG created"
+echo " Tarball: $TARBALL_URL"
+echo " SHA256: $SHA256"
+echo ""
+echo "Formula updated at: homebrew/ix.rb"
+echo ""
+echo "To publish the tap, push the updated formula:"
+echo " git add homebrew/ix.rb"
+echo " git commit -m \"brew: update formula for $TAG\""
+echo " git push origin main"