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
ci(release): build exactly the tagged commit, refuse silent overwrites, ship no tree-sitter-cli
KageBinarye21f00b75d16
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 9d28312c..3e89e767 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -47,6 +47,10 @@ on:description: "Build + package on all platforms only; skip publishing the release and the Homebrew PR"type: booleandefault: false+ overwrite:+ description: "Replace the assets of a release that already exists (otherwise publishing refuses)"+ type: boolean+ default: false# Least privilege at the top; the release job elevates to what it needs.permissions:@@ -163,6 +167,10 @@ jobs:- name: Checkoutuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:+ # The tag being released, not whatever the dispatch ran from: a+ # dispatch with tag vX used to build the default branch's HEAD and+ # publish it as vX.+ ref: ${{ github.event.inputs.tag || github.ref }}fetch-depth: 0persist-credentials: false@@ -179,6 +187,12 @@ jobs:elseTAG="${INPUT_TAG:-$REF_NAME}"echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"+ # What is built must be exactly the tag that names it.+ AT=$(git describe --exact-match --tags HEAD 2>/dev/null || true)+ if [ "$AT" != "$TAG" ]; then+ echo "::error::HEAD is ${AT:-not at a tag}, not $TAG. Refusing to build $TAG from another commit."+ exit 1+ fifi- name: Set up Node.js@@ -227,6 +241,11 @@ jobs:before_ing=$(size core-ingestion/node_modules)(cd ix-cli && npm prune --omit=dev)(cd core-ingestion && npm prune --omit=dev)+ # tree-sitter-cli arrives transitively as a runtime dependency but is+ # grammar-authoring tooling: a native binary nothing at runtime runs,+ # shipped in every tarball and absent from the SBOM. The parse check+ # below proves the CLI still works without it.+ rm -rf core-ingestion/node_modules/tree-sitter-cli core-ingestion/node_modules/.bin/tree-sitterecho "ix-cli/node_modules: ${before_cli:-?} MB -> $(size ix-cli/node_modules) MB"echo "core-ingestion/node_modules: ${before_ing:-?} MB -> $(size core-ingestion/node_modules) MB"@@ -406,7 +425,10 @@ jobs:- name: Generate SBOM (${{ matrix.target }})uses: anchore/sbom-action@3ad7283483fc7af8ff2b4ea19663c2d5ca935e26 # v0.24.2with:- path: ix-cli+ # The staged tree is what the archive contains: cli, core-ingestion+ # and compass. Scanning ix-cli alone left core-ingestion's shipped+ # runtime tree uncatalogued.+ path: ix-${{ steps.version.outputs.version }}-${{ matrix.target }}format: spdx-jsonoutput-file: ix-${{ steps.version.outputs.version }}-${{ matrix.target }}.sbom.spdx.jsonartifact-name: sbom-${{ matrix.target }}.spdx.json@@ -444,6 +466,7 @@ jobs:# branch and opens a PR with this token (see .github/zizmor.yml).uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:+ ref: ${{ github.event.inputs.tag || github.ref }}fetch-depth: 0token: ${{ secrets.GITHUB_TOKEN }}@@ -514,6 +537,21 @@ jobs:with:subject-path: "_artifacts/*.tar.gz,_artifacts/*.zip"+ - name: Refuse to replace an existing release's assets+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ TAG: v${{ steps.version.outputs.version }}+ OVERWRITE: ${{ github.event.inputs.overwrite || 'false' }}+ run: |+ # Publishing uploads assets by name, so re-running it for a tag that+ # is already released silently replaces what users have been+ # downloading. Only an explicit `overwrite` dispatch may do that.+ assets=$(gh release view "$TAG" --json assets --jq '.assets | length' 2>/dev/null || echo 0)+ if [ "$assets" -gt 0 ] && [ "$OVERWRITE" != "true" ]; then+ echo "::error::$TAG is already released with $assets assets. Re-run the dispatch with overwrite=true to replace them."+ exit 1+ fi+- name: Create Releaseuses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3with:diff --git a/homebrew/README.md b/homebrew/README.mddeleted file mode 100644index b813576e..00000000--- a/homebrew/README.md+++ /dev/null@@ -1,43 +0,0 @@-# Homebrew Tap for Ix--## Install--```bash-brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/Ix-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 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 repo directly. For a dedicated tap repo, copy `ix.rb` to `Formula/ix.rb` in a `homebrew-ix` repo.diff --git a/ix-cli/src/cli/__tests__/upgrade-homebrew.test.ts b/ix-cli/src/cli/__tests__/upgrade-homebrew.test.tsnew file mode 100644index 00000000..151751e0--- /dev/null+++ b/ix-cli/src/cli/__tests__/upgrade-homebrew.test.ts@@ -0,0 +1,19 @@+// Copyright 2026 Ix Infrastructure Inc.++import { describe, expect, it } from "vitest";++import { homebrewInstall } from "../commands/upgrade.js";++describe("homebrewInstall", () => {+ it("recognises an entry point inside a Homebrew Cellar", () => {+ expect(homebrewInstall("/opt/homebrew/Cellar/ix/0.12.0/libexec/dist/cli/main.js")).toBe(true);+ expect(homebrewInstall("/usr/local/Cellar/ix/0.11.1/libexec/dist/cli/main.js")).toBe(true);+ expect(homebrewInstall("/home/linuxbrew/.linuxbrew/Cellar/ix/0.12.0/libexec/dist/cli/main.js")).toBe(true);+ });++ it("does not take an installer or source checkout for one", () => {+ expect(homebrewInstall("/home/u/.ix/cli/cli/dist/cli/main.js")).toBe(false);+ expect(homebrewInstall("/home/u/src/Ix/ix-cli/dist/cli/main.js")).toBe(false);+ expect(homebrewInstall("/opt/homebrew/Cellar/other/1.0/bin/main.js")).toBe(false);+ });+});diff --git a/ix-cli/src/cli/commands/upgrade.ts b/ix-cli/src/cli/commands/upgrade.tsindex b0f95b1b..ab8dfbfd 100644--- a/ix-cli/src/cli/commands/upgrade.ts+++ b/ix-cli/src/cli/commands/upgrade.ts@@ -2,7 +2,7 @@import { Command } from "commander";import { execFileSync } from "child_process";-import { readFileSync, writeFileSync, existsSync, mkdirSync, rmSync, mkdtempSync, lstatSync, renameSync, readdirSync } from "fs";+import { readFileSync, writeFileSync, existsSync, mkdirSync, rmSync, mkdtempSync, lstatSync, realpathSync, renameSync, readdirSync } from "fs";import { basename, dirname, join } from "path";import { fileURLToPath } from "url";import { homedir } from "os";@@ -184,6 +184,17 @@ function splitVersion(v: string): [number[], string[]] {* identifiers left to right, numeric ones numerically and below alphanumeric* ones, and a longer identifier list wins when all preceding fields are equal.*/+/** Is the running CLI's entry point inside a Homebrew Cellar? */+export function homebrewInstall(entryPoint: string): boolean {+ let real = entryPoint;+ try {+ real = realpathSync(entryPoint);+ } catch {+ // keep the path as given+ }+ return /[\\/]Cellar[\\/]ix[\\/]/.test(real);+}+export function isNewer(latest: string, current: string): boolean {const [lNums, lPre] = splitVersion(latest);const [cNums, cPre] = splitVersion(current);@@ -1451,7 +1462,11 @@ export function registerUpgradeCommand(program: Command): void {outstanding.push(`CLI ${current} → ${latest}`);console.log(`New CLI version available: ${chalk.green(latest)}`);- if (!opts.check) {+ if (!opts.check && homebrewInstall(process.argv[1] ?? "")) {+ // Unpacking a release over a Homebrew keg would replace files brew+ // owns, and the next `brew upgrade` would undo it. Brew updates it.+ console.log(` This ix was installed with Homebrew. Update it with: ${chalk.cyan("brew upgrade ix")}`);+ } else if (!opts.check) {const platform = detectPlatform();const isWindows = platform.startsWith("windows");const archiveName = isWindowsdiff --git a/scripts/release.sh b/scripts/release.shdeleted file mode 100755index efca59d7..00000000--- a/scripts/release.sh+++ /dev/null@@ -1,98 +0,0 @@-#!/usr/bin/env bash-# Copyright 2026 Ix Infrastructure Inc.--set -euo pipefail--# ─────────────────────────────────────────────────────────────────────────────-# Ix — 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 ci --silent # install exactly from the committed lockfile (pinned/reproducible)-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 $TAG" \- --notes "## Ix $TAG--### Install via Homebrew-\`\`\`bash-brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/Ix-brew install ix-\`\`\`--### Install manually-\`\`\`bash-git clone https://github.com/ix-infrastructure/Ix-cd Ix && ./scripts/build-cli.sh-\`\`\`-" $DRAFT_FLAG--# ── Update Homebrew formula ─────────────────────────────────────────────────--echo ""-echo "Fetching release tarball SHA..."-TARBALL_URL="https://github.com/ix-infrastructure/Ix/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/Formula/ix.rb"-sed -i '' "s|# sha256 .*|sha256 \"${SHA256}\"|" "$IX_DIR/Formula/ix.rb"--echo ""-echo "[ok] Release $TAG created"-echo " Tarball: $TARBALL_URL"-echo " SHA256: $SHA256"-echo ""-echo "Formula updated at: Formula/ix.rb"-echo ""-echo "To publish the tap, push the updated formula:"-echo " git add Formula/ix.rb"-echo " git commit -m \"chore(brew): update formula for $TAG\""-echo " git push origin main"