Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat: add cross-platform installer and GitHub Actions release pipeline
kagebinaryc843e1972808
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 00000000..46e85e0a--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,228 @@+name: Release++on:+ push:+ tags:+ - "v*"++permissions:+ contents: write++jobs:+ build:+ strategy:+ matrix:+ include:+ - platform: linux-amd64+ os: ubuntu-latest+ - platform: linux-arm64+ os: ubuntu-latest+ - platform: darwin-amd64+ os: macos-13+ - platform: darwin-arm64+ os: macos-14++ runs-on: ${{ matrix.os }}+ name: Build (${{ matrix.platform }})++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Set up JDK 21+ uses: actions/setup-java@v4+ with:+ distribution: temurin+ java-version: "21"++ - name: Set up Node.js 22+ uses: actions/setup-node@v4+ with:+ node-version: "22"+ cache: npm+ cache-dependency-path: ix-cli/package-lock.json++ - name: Set up sbt+ uses: sbt/setup-sbt@v1++ - name: Extract version from tag+ id: version+ run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"++ - name: Build fat JAR+ if: matrix.platform != 'linux-arm64'+ run: sbt "memoryLayer/assembly"++ - name: Build fat JAR (ARM64 cross-build)+ if: matrix.platform == 'linux-arm64'+ uses: uraimo/run-on-arch-action@v2+ with:+ arch: aarch64+ distro: ubuntu22.04+ install: |+ apt-get update -q+ apt-get install -yq curl gnupg+ curl -fsSL https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /usr/share/keyrings/adoptium.gpg+ echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(. /etc/os-release && echo $VERSION_CODENAME) main" \+ > /etc/apt/sources.list.d/adoptium.list+ apt-get update -q+ apt-get install -yq temurin-21-jdk+ curl -fsSL https://www.scala-sbt.org/sbt-rpm.repo > /etc/yum.repos.d/sbt-rpm.repo 2>/dev/null || true+ echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" > /etc/apt/sources.list.d/sbt.list+ curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --dearmor -o /usr/share/keyrings/scalasbt-archive-keyring.gpg+ echo "deb [signed-by=/usr/share/keyrings/scalasbt-archive-keyring.gpg] https://repo.scala-sbt.org/scalasbt/debian all main" \+ > /etc/apt/sources.list.d/sbt.list+ apt-get update -q+ apt-get install -yq sbt+ run: sbt "memoryLayer/assembly"++ - name: Build CLI+ run: |+ cd ix-cli+ npm ci+ npm run build++ - name: Package distribution+ run: |+ VERSION="${{ steps.version.outputs.version }}"+ PLATFORM="${{ matrix.platform }}"+ DIST_NAME="ix-${VERSION}-${PLATFORM}"+ DIST_DIR="dist/${DIST_NAME}"+ NODE_VERSION="22.14.0"++ # Parse OS and ARCH from platform+ OS="${PLATFORM%%-*}"+ ARCH="${PLATFORM##*-}"++ # Map arch for download URLs+ case "$ARCH" in+ amd64) NODE_ARCH="x64"; ADOPTIUM_ARCH="x64" ;;+ arm64) NODE_ARCH="arm64"; ADOPTIUM_ARCH="aarch64" ;;+ esac++ # Adoptium uses "mac" not "darwin"+ case "$OS" in+ darwin) ADOPTIUM_OS="mac" ;;+ *) ADOPTIUM_OS="$OS" ;;+ esac++ mkdir -p "${DIST_DIR}/server" "${DIST_DIR}/cli" "${DIST_DIR}/runtime/node" "${DIST_DIR}/runtime/jre"++ # Copy build artifacts+ cp memory-layer/target/scala-2.13/ix-memory-layer.jar "${DIST_DIR}/server/"+ cp -r ix-cli/dist "${DIST_DIR}/cli/"+ cp ix-cli/package.json "${DIST_DIR}/cli/"+ cd "${DIST_DIR}/cli"+ npm install --omit=dev --ignore-scripts --no-audit --no-fund+ cd -++ # Download and extract Node.js+ echo "Downloading Node.js ${NODE_VERSION}..."+ NODE_ARCHIVE="node-v${NODE_VERSION}-${OS}-${NODE_ARCH}.tar.gz"+ curl -fSL -o "/tmp/${NODE_ARCHIVE}" "https://nodejs.org/dist/v${NODE_VERSION}/${NODE_ARCHIVE}"+ tar -xzf "/tmp/${NODE_ARCHIVE}" --strip-components=1 -C "${DIST_DIR}/runtime/node"++ # Download and extract Adoptium JRE+ echo "Downloading Adoptium JRE 21..."+ curl -fSL -o /tmp/jre.tar.gz -L "https://api.adoptium.net/v3/binary/latest/21/ga/${ADOPTIUM_OS}/${ADOPTIUM_ARCH}/jre/hotspot/normal/eclipse?project=jdk"+ tar -xzf /tmp/jre.tar.gz --strip-components=1 -C "${DIST_DIR}/runtime/jre"+ # Handle macOS Contents/Home structure+ if [ -d "${DIST_DIR}/runtime/jre/Contents/Home" ]; then+ cp -r "${DIST_DIR}/runtime/jre/Contents/Home"/* "${DIST_DIR}/runtime/jre/"+ rm -rf "${DIST_DIR}/runtime/jre/Contents"+ fi++ # Create wrapper script using bundled runtimes+ cat > "${DIST_DIR}/ix" <<'WRAPPER'+#!/bin/sh+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"+export PATH="${SCRIPT_DIR}/runtime/node/bin:${SCRIPT_DIR}/runtime/jre/bin:${PATH}"+exec "${SCRIPT_DIR}/runtime/node/bin/node" "${SCRIPT_DIR}/cli/dist/cli/main.js" "$@"+WRAPPER+ chmod +x "${DIST_DIR}/ix"++ # Create archive+ cd dist+ tar czf "${DIST_NAME}.tar.gz" "${DIST_NAME}"+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "${DIST_NAME}.tar.gz" > "${DIST_NAME}.tar.gz.sha256"+ else+ shasum -a 256 "${DIST_NAME}.tar.gz" > "${DIST_NAME}.tar.gz.sha256"+ fi++ - name: Upload artifact+ uses: actions/upload-artifact@v4+ with:+ name: ix-${{ steps.version.outputs.version }}-${{ matrix.platform }}+ path: |+ dist/ix-${{ steps.version.outputs.version }}-${{ matrix.platform }}.tar.gz+ dist/ix-${{ steps.version.outputs.version }}-${{ matrix.platform }}.tar.gz.sha256+ retention-days: 5++ release:+ needs: build+ runs-on: ubuntu-latest+ name: Create Release++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Extract version from tag+ id: version+ run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"++ - name: Download all artifacts+ uses: actions/download-artifact@v4+ with:+ path: artifacts+ merge-multiple: true++ - name: Generate manifest+ run: |+ VERSION="${{ steps.version.outputs.version }}"+ cd artifacts++ echo '{' > manifest.json+ echo ' "version": "'"${VERSION}"'",' >> manifest.json+ echo ' "platforms": {' >> manifest.json++ FIRST=true+ for archive in ix-${VERSION}-*.tar.gz; do+ [ -f "$archive" ] || continue+ PLATFORM="${archive#ix-${VERSION}-}"+ PLATFORM="${PLATFORM%.tar.gz}"+ SHA256=$(shasum -a 256 "$archive" | cut -d' ' -f1)++ if [ "$FIRST" = true ]; then+ FIRST=false+ else+ echo ',' >> manifest.json+ fi++ printf ' "%s": {\n' "$PLATFORM" >> manifest.json+ printf ' "archive": "%s",\n' "$archive" >> manifest.json+ printf ' "sha256": "%s"\n' "$SHA256" >> manifest.json+ printf ' }' >> manifest.json+ done++ echo '' >> manifest.json+ echo ' }' >> manifest.json+ echo '}' >> manifest.json++ echo "Generated manifest.json:"+ cat manifest.json++ - name: Create GitHub Release+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ VERSION="${{ steps.version.outputs.version }}"+ TAG="${GITHUB_REF_NAME}"++ gh release create "$TAG" \+ --title "IX-Memory v${VERSION}" \+ --generate-notes \+ artifacts/ix-${VERSION}-*.tar.gz \+ artifacts/ix-${VERSION}-*.tar.gz.sha256 \+ artifacts/manifest.jsondiff --git a/install.cmd b/install.cmdnew file mode 100644index 00000000..a6e8e466--- /dev/null+++ b/install.cmd@@ -0,0 +1,2 @@+@echo off+powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ix-infrastructure/IX-Memory/main/install.ps1'))"diff --git a/install.ps1 b/install.ps1new file mode 100644index 00000000..b4aacdc8--- /dev/null+++ b/install.ps1@@ -0,0 +1,149 @@+#!/usr/bin/env pwsh+# install.ps1 — Windows installer for ix CLI+# Usage:+# irm https://raw.githubusercontent.com/ix-infrastructure/IX-Memory/main/install.ps1 | iex+# .\install.ps1 -Version 0.5.0 -NoModifyPath++param(+ [string]$Version = "",+ [switch]$NoModifyPath+)++$ErrorActionPreference = 'Stop'++# --- Detect architecture ---------------------------------------------------++function Get-Arch {+ switch ($env:PROCESSOR_ARCHITECTURE) {+ "AMD64" { return "x64" }+ "ARM64" { return "arm64" }+ default { throw "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE" }+ }+}++# --- Resolve latest version from GitHub ------------------------------------++function Get-LatestVersion {+ $apiUrl = "https://api.github.com/repos/ix-infrastructure/IX-Memory/releases/latest"+ try {+ $release = Invoke-RestMethod -Uri $apiUrl -Headers @{ "User-Agent" = "ix-installer" }+ $tag = $release.tag_name -replace '^v', ''+ return $tag+ }+ catch {+ throw "Failed to fetch latest release from GitHub: $_"+ }+}++# --- Main ------------------------------------------------------------------++Write-Host ""+Write-Host " ix memory installer" -ForegroundColor Cyan+Write-Host " ====================" -ForegroundColor Cyan+Write-Host ""++$arch = Get-Arch+Write-Host " Detected architecture: $arch" -ForegroundColor Gray++# Resolve version+if ([string]::IsNullOrWhiteSpace($Version)) {+ Write-Host " Fetching latest version..." -ForegroundColor Gray+ $Version = Get-LatestVersion+}+Write-Host " Version: $Version" -ForegroundColor Gray++# Paths+$installDir = Join-Path $env:LOCALAPPDATA "ix"+$binPath = Join-Path $installDir "ix.exe"+$tarball = "ix-${Version}-windows-${arch}.tar.gz"+$downloadUrl = "https://github.com/ix-infrastructure/IX-Memory/releases/download/v${Version}/${tarball}"+$checksumUrl = "${downloadUrl}.sha256"+$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "ix-install-$([System.Guid]::NewGuid().ToString('N'))"++# Create temp directory+New-Item -ItemType Directory -Path $tempDir -Force | Out-Null++try {+ # Download tarball+ $tarballPath = Join-Path $tempDir $tarball+ Write-Host " Downloading $tarball..." -ForegroundColor Yellow+ Invoke-WebRequest -Uri $downloadUrl -OutFile $tarballPath -UseBasicParsing++ # Download and verify checksum+ $checksumPath = Join-Path $tempDir "${tarball}.sha256"+ Write-Host " Verifying checksum..." -ForegroundColor Yellow+ Invoke-WebRequest -Uri $checksumUrl -OutFile $checksumPath -UseBasicParsing++ $expectedHash = (Get-Content $checksumPath -Raw).Trim().Split(" ")[0].ToUpper()+ $actualHash = (Get-FileHash -Path $tarballPath -Algorithm SHA256).Hash.ToUpper()++ if ($expectedHash -ne $actualHash) {+ throw "Checksum mismatch!`n Expected: $expectedHash`n Actual: $actualHash"+ }+ Write-Host " Checksum verified." -ForegroundColor Green++ # Create install directory+ if (!(Test-Path $installDir)) {+ New-Item -ItemType Directory -Path $installDir -Force | Out-Null+ }++ # Extract tarball+ Write-Host " Extracting to $installDir..." -ForegroundColor Yellow+ tar -xzf $tarballPath -C $installDir++ # Add to PATH+ if (-not $NoModifyPath) {+ $userPath = [Environment]::GetEnvironmentVariable("Path", "User")+ if ($userPath -notlike "*$installDir*") {+ [Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User")+ Write-Host " Added $installDir to user PATH." -ForegroundColor Green+ }+ else {+ Write-Host " Install directory already in PATH." -ForegroundColor Gray+ }+ # Update current session PATH as well+ $env:Path = "$env:Path;$installDir"+ }+ else {+ Write-Host " Skipped PATH modification (--NoModifyPath)." -ForegroundColor Gray+ }++ # Write manifest+ $manifest = @{+ version = $Version+ platform = "windows"+ arch = $arch+ installDir = $installDir+ installDate = (Get-Date -Format "o")+ } | ConvertTo-Json -Depth 2++ $manifestPath = Join-Path $installDir "manifest.json"+ Set-Content -Path $manifestPath -Value $manifest -Encoding UTF8+ Write-Host " Wrote manifest to $manifestPath" -ForegroundColor Gray++ # Verify installation+ Write-Host ""+ Write-Host " Verifying installation..." -ForegroundColor Yellow+ $verifyOutput = & $binPath --version 2>&1+ Write-Host " ix $verifyOutput" -ForegroundColor Green++ # Success+ Write-Host ""+ Write-Host " Installation complete!" -ForegroundColor Green+ Write-Host " Binary: $binPath" -ForegroundColor Gray+ Write-Host " Version: $Version" -ForegroundColor Gray+ Write-Host ""+ if (-not $NoModifyPath) {+ Write-Host " Restart your terminal, then run: ix --help" -ForegroundColor Cyan+ }+ else {+ Write-Host " Add $installDir to your PATH, then run: ix --help" -ForegroundColor Cyan+ }+ Write-Host ""+}+finally {+ # Clean up temp directory+ if (Test-Path $tempDir) {+ Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue+ }+}diff --git a/install.sh b/install.shnew file mode 100644index 00000000..2f1e2566--- /dev/null+++ b/install.sh@@ -0,0 +1,327 @@+#!/bin/sh+set -eu++# IX Memory installer — cross-platform for macOS / Linux / WSL+# Usage: curl -fsSL https://raw.githubusercontent.com/ix-infrastructure/IX-Memory/main/install.sh | sh++GITHUB_ORG="ix-infrastructure"+GITHUB_REPO="IX-Memory"+DEFAULT_INSTALL_DIR="$HOME/.local/share/ix"+BIN_DIR="$HOME/.local/bin"++# ── Colour helpers (disabled when not a terminal) ──────────────────────────++if [ -t 1 ] && command -v tput >/dev/null 2>&1 && [ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]; then+ BOLD="$(tput bold)"+ GREEN="$(tput setaf 2)"+ YELLOW="$(tput setaf 3)"+ RED="$(tput setaf 1)"+ CYAN="$(tput setaf 6)"+ RESET="$(tput sgr0)"+else+ BOLD="" GREEN="" YELLOW="" RED="" CYAN="" RESET=""+fi++info() { printf '%s[info]%s %s\n' "$CYAN" "$RESET" "$1"; }+ok() { printf '%s[ ok ]%s %s\n' "$GREEN" "$RESET" "$1"; }+warn() { printf '%s[warn]%s %s\n' "$YELLOW" "$RESET" "$1"; }+err() { printf '%s[err ]%s %s\n' "$RED" "$RESET" "$1" >&2; }+die() { err "$1"; exit 1; }++# ── Usage ──────────────────────────────────────────────────────────────────++usage() {+ cat <<EOF+${BOLD}ix install${RESET} — install IX Memory CLI++USAGE+ install.sh [OPTIONS]++OPTIONS+ --version VERSION Install a specific version (default: latest)+ --no-modify-path Skip automatic PATH modification+ --help Show this help message++ENVIRONMENT+ IX_INSTALL_DIR Override install directory+ (default: \$HOME/.local/share/ix)++EXAMPLES+ curl -fsSL https://raw.githubusercontent.com/$GITHUB_ORG/$GITHUB_REPO/main/install.sh | sh+ ./install.sh --version 0.4.1+ IX_INSTALL_DIR=/opt/ix ./install.sh --no-modify-path+EOF+ exit 0+}++# ── Argument parsing ───────────────────────────────────────────────────────++REQUESTED_VERSION=""+MODIFY_PATH=1++while [ $# -gt 0 ]; do+ case "$1" in+ --version)+ [ $# -ge 2 ] || die "--version requires a value"+ REQUESTED_VERSION="$2"+ shift 2+ ;;+ --no-modify-path)+ MODIFY_PATH=0+ shift+ ;;+ --help|-h)+ usage+ ;;+ *)+ die "Unknown option: $1 (try --help)"+ ;;+ esac+done++# ── Platform detection ─────────────────────────────────────────────────────++detect_platform() {+ OS_RAW="$(uname -s)"+ ARCH_RAW="$(uname -m)"++ case "$OS_RAW" in+ Darwin) OS="darwin" ;;+ Linux) OS="linux" ;;+ *) die "Unsupported operating system: $OS_RAW (only macOS and Linux/WSL are supported)" ;;+ esac++ case "$ARCH_RAW" in+ x86_64|amd64) ARCH="amd64" ;;+ aarch64|arm64) ARCH="arm64" ;;+ *) die "Unsupported architecture: $ARCH_RAW (only amd64 and arm64 are supported)" ;;+ esac++ info "Detected platform: ${OS}/${ARCH}"+}++# ── Dependency checks ─────────────────────────────────────────────────────++require_cmd() {+ command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"+}++check_deps() {+ require_cmd curl+ require_cmd tar+ # checksum tool checked later per-platform+}++# ── Fetch latest version from GitHub API ───────────────────────────────────++fetch_latest_version() {+ info "Fetching latest release from GitHub..."+ LATEST_URL="https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/releases/latest"++ HTTP_RESPONSE="$(curl -fsSL "$LATEST_URL" 2>/dev/null)" \+ || die "Failed to fetch latest release from GitHub. Check your internet connection."++ # Extract tag_name without jq (POSIX-friendly)+ TAG="$(printf '%s' "$HTTP_RESPONSE" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)"+ [ -n "$TAG" ] || die "Could not determine latest version from GitHub API response."++ # Strip leading "v" if present+ VERSION="$(printf '%s' "$TAG" | sed 's/^v//')"+ info "Latest version: ${VERSION}"+}++# ── Download & verify ──────────────────────────────────────────────────────++download_and_verify() {+ ARCHIVE_NAME="ix-${VERSION}-${OS}-${ARCH}.tar.gz"+ CHECKSUM_NAME="${ARCHIVE_NAME}.sha256"+ DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/v${VERSION}"++ TMPDIR_DL="$(mktemp -d)"+ trap 'rm -rf "$TMPDIR_DL"' EXIT++ ARCHIVE_PATH="${TMPDIR_DL}/${ARCHIVE_NAME}"+ CHECKSUM_PATH="${TMPDIR_DL}/${CHECKSUM_NAME}"++ info "Downloading ${ARCHIVE_NAME}..."+ curl -fSL --progress-bar -o "$ARCHIVE_PATH" "${DOWNLOAD_BASE}/${ARCHIVE_NAME}" \+ || die "Failed to download ${ARCHIVE_NAME}. Does version ${VERSION} have a release for ${OS}/${ARCH}?"++ info "Downloading checksum file..."+ curl -fsSL -o "$CHECKSUM_PATH" "${DOWNLOAD_BASE}/${CHECKSUM_NAME}" \+ || die "Failed to download checksum file ${CHECKSUM_NAME}."++ info "Verifying SHA-256 checksum..."+ verify_checksum "$ARCHIVE_PATH" "$CHECKSUM_PATH"+ ok "Checksum verified"+}++verify_checksum() {+ _file="$1"+ _checksum_file="$2"++ _expected="$(awk '{print $1}' "$_checksum_file")"+ [ -n "$_expected" ] || die "Checksum file is empty or malformed."++ case "$OS" in+ darwin)+ require_cmd shasum+ _actual="$(shasum -a 256 "$_file" | awk '{print $1}')"+ ;;+ linux)+ require_cmd sha256sum+ _actual="$(sha256sum "$_file" | awk '{print $1}')"+ ;;+ esac++ [ "$_actual" = "$_expected" ] \+ || die "Checksum mismatch!\n Expected: ${_expected}\n Got: ${_actual}\nThe download may be corrupt. Please try again."+}++# ── Install ────────────────────────────────────────────────────────────────++install_binary() {+ INSTALL_DIR="${IX_INSTALL_DIR:-$DEFAULT_INSTALL_DIR}"+ PLATFORM_DIR="ix-${VERSION}-${OS}-${ARCH}"++ info "Installing to ${INSTALL_DIR}/${PLATFORM_DIR}..."+ mkdir -p "$INSTALL_DIR"+ mkdir -p "$BIN_DIR"++ # Extract archive into install dir+ tar -xzf "$ARCHIVE_PATH" -C "$INSTALL_DIR"++ # Verify the expected binary exists+ IX_BINARY="${INSTALL_DIR}/${PLATFORM_DIR}/ix"+ [ -f "$IX_BINARY" ] || die "Expected binary not found at ${IX_BINARY} after extraction."+ chmod +x "$IX_BINARY"++ # Create/update symlink+ SYMLINK_PATH="${BIN_DIR}/ix"+ if [ -L "$SYMLINK_PATH" ] || [ -e "$SYMLINK_PATH" ]; then+ rm -f "$SYMLINK_PATH"+ fi+ ln -s "$IX_BINARY" "$SYMLINK_PATH"+ ok "Symlinked ${SYMLINK_PATH} -> ${IX_BINARY}"+}++# ── PATH modification ─────────────────────────────────────────────────────++modify_path() {+ if [ "$MODIFY_PATH" -eq 0 ]; then+ info "Skipping PATH modification (--no-modify-path)"+ return+ fi++ PATH_LINE="export PATH=\"\$HOME/.local/bin:\$PATH\""++ _modified=0++ for RC_FILE in "$HOME/.bashrc" "$HOME/.zshrc"; do+ if [ -f "$RC_FILE" ]; then+ if ! grep -qF '.local/bin' "$RC_FILE" 2>/dev/null; then+ printf '\n# Added by IX Memory installer\n%s\n' "$PATH_LINE" >> "$RC_FILE"+ ok "Added PATH entry to $(basename "$RC_FILE")"+ _modified=1+ fi+ else+ # Create the file if the shell is installed+ case "$RC_FILE" in+ *bashrc)+ if command -v bash >/dev/null 2>&1; then+ printf '# Added by IX Memory installer\n%s\n' "$PATH_LINE" > "$RC_FILE"+ ok "Created $(basename "$RC_FILE") with PATH entry"+ _modified=1+ fi+ ;;+ *zshrc)+ if command -v zsh >/dev/null 2>&1; then+ printf '# Added by IX Memory installer\n%s\n' "$PATH_LINE" > "$RC_FILE"+ ok "Created $(basename "$RC_FILE") with PATH entry"+ _modified=1+ fi+ ;;+ esac+ fi+ done++ if [ "$_modified" -eq 0 ]; then+ info "PATH already contains \$HOME/.local/bin — no changes needed"+ fi+}++# ── Manifest ───────────────────────────────────────────────────────────────++write_manifest() {+ INSTALL_DIR="${IX_INSTALL_DIR:-$DEFAULT_INSTALL_DIR}"+ MANIFEST="${INSTALL_DIR}/manifest.json"+ INSTALL_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"++ cat > "$MANIFEST" <<MANIFEST_EOF+{+ "version": "${VERSION}",+ "platform": "${OS}/${ARCH}",+ "install_dir": "${INSTALL_DIR}",+ "bin_symlink": "${BIN_DIR}/ix",+ "installed_at": "${INSTALL_DATE}"+}+MANIFEST_EOF++ ok "Wrote manifest to ${MANIFEST}"+}++# ── Verify ─────────────────────────────────────────────────────────────────++verify_installation() {+ # Ensure the bin dir is on PATH for this check+ export PATH="${BIN_DIR}:${PATH}"++ if command -v ix >/dev/null 2>&1; then+ INSTALLED_VERSION="$(ix --version 2>/dev/null || echo "unknown")"+ ok "Verified: ix ${INSTALLED_VERSION}"+ else+ warn "ix binary is installed but not yet on your PATH."+ warn "Restart your shell or run: export PATH=\"\$HOME/.local/bin:\$PATH\""+ fi+}++# ── Success message ────────────────────────────────────────────────────────++print_success() {+ printf '\n%s%s══════════════════════════════════════════%s\n' "$BOLD" "$GREEN" "$RESET"+ printf '%s%s IX Memory CLI installed successfully! %s\n' "$BOLD" "$GREEN" "$RESET"+ printf '%s%s══════════════════════════════════════════%s\n\n' "$BOLD" "$GREEN" "$RESET"++ printf '%sNext steps:%s\n' "$BOLD" "$RESET"+ printf ' 1. Restart your terminal (or run: %sexport PATH="$HOME/.local/bin:$PATH"%s)\n' "$CYAN" "$RESET"+ printf ' 2. Start the backend (requires Docker): %six status%s\n' "$CYAN" "$RESET"+ printf ' If not running: %sdocker compose up -d%s (from the IX-Memory repo)\n' "$CYAN" "$RESET"+ printf ' 3. Ingest your project: %six ingest ./src --recursive%s\n' "$CYAN" "$RESET"+ printf ' 4. Try it out: %six search MyClass --kind class%s\n\n' "$CYAN" "$RESET"+ printf ' Documentation: %shttps://github.com/%s/%s#readme%s\n\n' "$CYAN" "$GITHUB_ORG" "$GITHUB_REPO" "$RESET"+}++# ── Main ───────────────────────────────────────────────────────────────────++main() {+ printf '\n%s%sIX Memory Installer%s\n\n' "$BOLD" "$CYAN" "$RESET"++ detect_platform+ check_deps++ if [ -n "$REQUESTED_VERSION" ]; then+ VERSION="$REQUESTED_VERSION"+ info "Using requested version: ${VERSION}"+ else+ fetch_latest_version+ fi++ download_and_verify+ install_binary+ modify_path+ write_manifest+ verify_installation+ print_success+}++main