Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Add install scripts, CI pre-signing, download E2E smoke tests
Martin Vogel006e6dbf201e
diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.ymlindex 4f2682f63..b2ea986c6 100644--- a/.github/workflows/dry-run.yml+++ b/.github/workflows/dry-run.yml@@ -249,6 +249,10 @@ jobs:- name: Build standard binaryrun: scripts/build.sh CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}+ - name: Ad-hoc sign macOS binary+ if: startsWith(matrix.os, 'macos')+ run: codesign --sign - --force build/c/codebase-memory-mcp+- name: Archive standard binaryrun: |cp LICENSE build/c/@@ -258,6 +262,10 @@ jobs:- name: Build UI binaryrun: scripts/build.sh --with-ui CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}+ - name: Ad-hoc sign macOS UI binary+ if: startsWith(matrix.os, 'macos')+ run: codesign --sign - --force build/c/codebase-memory-mcp+- name: Frontend integrity scan (post-build dist/)if: matrix.goos == 'linux' && matrix.goarch == 'amd64'run: scripts/security-ui.sh@@ -358,8 +366,23 @@ jobs:tar -xzf codebase-memory-mcp${SUFFIX}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gzchmod +x codebase-memory-mcp+ - name: Start artifact server for E2E smoke tests+ run: |+ mkdir -p /tmp/smoke-server+ cp codebase-memory-mcp /tmp/smoke-server/+ OS=${{ matrix.goos }}+ ARCH=${{ matrix.goarch }}+ SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}+ tar -czf "/tmp/smoke-server/codebase-memory-mcp${SUFFIX}-${OS}-${ARCH}.tar.gz" \+ -C /tmp/smoke-server codebase-memory-mcp+ cd /tmp/smoke-server+ sha256sum *.tar.gz > checksums.txt 2>/dev/null || shasum -a 256 *.tar.gz > checksums.txt+ python3 -m http.server 18080 -d /tmp/smoke-server &+- name: Smoke test (${{ matrix.variant }}, ${{ matrix.goos }}-${{ matrix.goarch }})run: scripts/smoke-test.sh ./codebase-memory-mcp+ env:+ SMOKE_DOWNLOAD_URL: http://localhost:18080- name: Binary string audit (${{ matrix.goos }}-${{ matrix.goarch }})if: matrix.variant == 'standard'@@ -438,9 +461,22 @@ jobs:unzip -o "codebase-memory-mcp${SUFFIX}-windows-amd64.zip"[ -n "$SUFFIX" ] && cp "codebase-memory-mcp${SUFFIX}.exe" codebase-memory-mcp.exe || true+ - name: Start artifact server for E2E smoke tests+ shell: msys2 {0}+ run: |+ mkdir -p /tmp/smoke-server+ cp codebase-memory-mcp.exe /tmp/smoke-server/codebase-memory-mcp.exe+ SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}+ cd /tmp/smoke-server+ zip -q "codebase-memory-mcp${SUFFIX}-windows-amd64.zip" codebase-memory-mcp.exe+ sha256sum *.zip > checksums.txt+ python3 -m http.server 18080 -d /tmp/smoke-server &+- name: Smoke test (${{ matrix.variant }}, windows-amd64)shell: msys2 {0}run: scripts/smoke-test.sh ./codebase-memory-mcp.exe+ env:+ SMOKE_DOWNLOAD_URL: http://localhost:18080- name: Binary string audit (windows-amd64)if: matrix.variant == 'standard'diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 04dffeca1..7e5960693 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -248,6 +248,10 @@ jobs:- name: Build standard binaryrun: scripts/build.sh --version ${{ inputs.version }} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}+ - name: Ad-hoc sign macOS binary+ if: startsWith(matrix.os, 'macos')+ run: codesign --sign - --force build/c/codebase-memory-mcp+- name: Archive standard binaryrun: |cp LICENSE build/c/@@ -257,6 +261,10 @@ jobs:- name: Build UI binaryrun: scripts/build.sh --with-ui --version ${{ inputs.version }} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}+ - name: Ad-hoc sign macOS UI binary+ if: startsWith(matrix.os, 'macos')+ run: codesign --sign - --force build/c/codebase-memory-mcp+- name: Frontend integrity scan (post-build dist/)if: matrix.goos == 'linux' && matrix.goarch == 'amd64'run: scripts/security-ui.sh@@ -354,8 +362,23 @@ jobs:tar -xzf codebase-memory-mcp${SUFFIX}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gzchmod +x codebase-memory-mcp+ - name: Start artifact server for E2E smoke tests+ run: |+ mkdir -p /tmp/smoke-server+ cp codebase-memory-mcp /tmp/smoke-server/+ OS=${{ matrix.goos }}+ ARCH=${{ matrix.goarch }}+ SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}+ tar -czf "/tmp/smoke-server/codebase-memory-mcp${SUFFIX}-${OS}-${ARCH}.tar.gz" \+ -C /tmp/smoke-server codebase-memory-mcp+ cd /tmp/smoke-server+ sha256sum *.tar.gz > checksums.txt 2>/dev/null || shasum -a 256 *.tar.gz > checksums.txt+ python3 -m http.server 18080 -d /tmp/smoke-server &+- name: Smoke test (${{ matrix.variant }}, ${{ matrix.goos }}-${{ matrix.goarch }})run: scripts/smoke-test.sh ./codebase-memory-mcp+ env:+ SMOKE_DOWNLOAD_URL: http://localhost:18080- name: Binary string audit (${{ matrix.goos }}-${{ matrix.goarch }})if: matrix.variant == 'standard'@@ -435,9 +458,22 @@ jobs:unzip -o "codebase-memory-mcp${SUFFIX}-windows-amd64.zip"[ -n "$SUFFIX" ] && cp "codebase-memory-mcp${SUFFIX}.exe" codebase-memory-mcp.exe || true+ - name: Start artifact server for E2E smoke tests+ shell: msys2 {0}+ run: |+ mkdir -p /tmp/smoke-server+ cp codebase-memory-mcp.exe /tmp/smoke-server/codebase-memory-mcp.exe+ SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}+ cd /tmp/smoke-server+ zip -q "codebase-memory-mcp${SUFFIX}-windows-amd64.zip" codebase-memory-mcp.exe+ sha256sum *.zip > checksums.txt+ python3 -m http.server 18080 -d /tmp/smoke-server &+- name: Smoke test (${{ matrix.variant }}, windows-amd64)shell: msys2 {0}run: scripts/smoke-test.sh ./codebase-memory-mcp.exe+ env:+ SMOKE_DOWNLOAD_URL: http://localhost:18080- name: Binary string audit (windows-amd64)if: matrix.variant == 'standard'diff --git a/README.md b/README.mdindex 4c3c566f3..9390ac86a 100644--- a/README.md+++ b/README.md@@ -33,6 +33,26 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si## Quick Start+**One-line install** (macOS / Linux):+```bash+curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash+```++With graph visualization UI:+```bash+curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui+```++**Windows** (PowerShell):+```powershell+powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 | iex"+```++Restart your coding agent. Say **"Index this project"** — done.++<details>+<summary>Manual install</summary>+1. **Download** the binary for your platform from the [latest release](https://github.com/DeusData/codebase-memory-mcp/releases/latest):- `codebase-memory-mcp-<os>-<arch>.tar.gz` — standard (MCP server only)- `codebase-memory-mcp-ui-<os>-<arch>.tar.gz` — with embedded graph visualization@@ -44,7 +64,14 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-sicodebase-memory-mcp install```-3. **Restart** your coding agent. Say **"Index this project"** — done.+3. **Restart** your coding agent.++On macOS, if the binary is killed on launch, fix code signing:+```bash+xattr -d com.apple.quarantine ~/.local/bin/codebase-memory-mcp+codesign --sign - --force ~/.local/bin/codebase-memory-mcp+```+</details>The `install` command auto-detects all installed coding agents and configures MCP server entries, instruction files, skills, and pre-tool hooks for each.diff --git a/install.ps1 b/install.ps1new file mode 100644index 000000000..702466182--- /dev/null+++ b/install.ps1@@ -0,0 +1,145 @@+# install.ps1 — One-line installer for codebase-memory-mcp (Windows).+#+# Usage:+# powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 | iex"+#+# Environment:+# CBM_DOWNLOAD_URL Override base URL for downloads (for testing)++$ErrorActionPreference = "Stop"++$Repo = "DeusData/codebase-memory-mcp"+$InstallDir = "$env:LOCALAPPDATA\Programs\codebase-memory-mcp"+$BinName = "codebase-memory-mcp.exe"+$BaseUrl = if ($env:CBM_DOWNLOAD_URL) { $env:CBM_DOWNLOAD_URL } else { "https://github.com/$Repo/releases/latest/download" }++# Detect variant from args (--ui or --standard)+$Variant = "standard"+foreach ($arg in $args) {+ if ($arg -eq "--ui") { $Variant = "ui" }+ if ($arg -eq "--standard") { $Variant = "standard" }+ if ($arg -like "--dir=*") { $InstallDir = $arg.Substring(6) }+}++Write-Host "codebase-memory-mcp installer (Windows)"+Write-Host " variant: $Variant"+Write-Host " target: $InstallDir\$BinName"+Write-Host ""++# Build download URL+if ($Variant -eq "ui") {+ $Archive = "codebase-memory-mcp-ui-windows-amd64.zip"+} else {+ $Archive = "codebase-memory-mcp-windows-amd64.zip"+}+$Url = "$BaseUrl/$Archive"++# Download+$TmpDir = Join-Path ([System.IO.Path]::GetTempPath()) "cbm-install-$(Get-Random)"+New-Item -ItemType Directory -Path $TmpDir -Force | Out-Null++Write-Host "Downloading $Archive..."+try {+ Invoke-WebRequest -Uri $Url -OutFile "$TmpDir\$Archive" -UseBasicParsing+} catch {+ Write-Host "error: download failed: $_" -ForegroundColor Red+ Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue+ exit 1+}++# Remove MOTW (prevents SmartScreen popup)+Unblock-File -Path "$TmpDir\$Archive" -ErrorAction SilentlyContinue++# Checksum verification+$ChecksumUrl = "$BaseUrl/checksums.txt"+try {+ Invoke-WebRequest -Uri $ChecksumUrl -OutFile "$TmpDir\checksums.txt" -UseBasicParsing+ $checksumLine = Get-Content "$TmpDir\checksums.txt" | Where-Object { $_ -like "*$Archive*" }+ if ($checksumLine) {+ $expected = ($checksumLine -split '\s+')[0]+ $actual = (Get-FileHash -Path "$TmpDir\$Archive" -Algorithm SHA256).Hash.ToLower()+ if ($expected -ne $actual) {+ Write-Host "error: CHECKSUM MISMATCH!" -ForegroundColor Red+ Write-Host " expected: $expected"+ Write-Host " actual: $actual"+ Remove-Item -Recurse -Force $TmpDir+ exit 1+ }+ Write-Host "Checksum verified."+ }+} catch {+ Write-Host "warning: could not verify checksum (non-fatal)"+}++# Extract+Write-Host "Extracting..."+Expand-Archive -Path "$TmpDir\$Archive" -DestinationPath $TmpDir -Force++$DlBin = Join-Path $TmpDir $BinName+if (-not (Test-Path $DlBin)) {+ # UI variant may have different name in zip+ $UiBin = Join-Path $TmpDir "codebase-memory-mcp-ui.exe"+ if (Test-Path $UiBin) {+ Rename-Item $UiBin $BinName+ $DlBin = Join-Path $TmpDir $BinName+ } else {+ Write-Host "error: binary not found after extraction" -ForegroundColor Red+ Remove-Item -Recurse -Force $TmpDir+ exit 1+ }+}++# Remove MOTW from extracted binary+Unblock-File -Path $DlBin -ErrorAction SilentlyContinue++# Install+New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null+$Dest = Join-Path $InstallDir $BinName++# Handle replace-if-running (rename-aside)+if (Test-Path $Dest) {+ $OldDest = "$Dest.old"+ Remove-Item $OldDest -Force -ErrorAction SilentlyContinue+ try {+ Rename-Item $Dest $OldDest -ErrorAction Stop+ } catch {+ Write-Host "warning: could not rename existing binary (may be in use)"+ }+}++Copy-Item $DlBin $Dest -Force+Unblock-File -Path $Dest -ErrorAction SilentlyContinue++# Verify+try {+ $ver = & $Dest --version 2>&1+ Write-Host "Installed: $ver"+} catch {+ Write-Host "error: installed binary failed to run" -ForegroundColor Red+ Remove-Item -Recurse -Force $TmpDir+ exit 1+}++# Configure agents+Write-Host ""+Write-Host "Configuring coding agents..."+try {+ & $Dest install -y 2>&1 | Write-Host+} catch {+ Write-Host "Agent configuration failed (non-fatal)."+ Write-Host "Run manually: codebase-memory-mcp install"+}++# Add to PATH (user scope, no admin needed)+$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")+if ($UserPath -notlike "*$InstallDir*") {+ [Environment]::SetEnvironmentVariable("PATH", "$UserPath;$InstallDir", "User")+ $env:PATH = "$env:PATH;$InstallDir"+ Write-Host "Added $InstallDir to user PATH"+}++# Cleanup+Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue++Write-Host ""+Write-Host "Done! Restart your terminal and coding agent to start using codebase-memory-mcp."diff --git a/install.sh b/install.shnew file mode 100755index 000000000..12073db9e--- /dev/null+++ b/install.sh@@ -0,0 +1,190 @@+#!/usr/bin/env bash+set -euo pipefail++# install.sh — One-line installer for codebase-memory-mcp.+#+# Usage:+# curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash+# curl -fsSL ... | bash -s -- --ui # Install the UI variant+# curl -fsSL ... | bash -s -- --dir /path # Custom install directory+#+# Environment:+# CBM_DOWNLOAD_URL Override base URL for downloads (for testing)++REPO="DeusData/codebase-memory-mcp"+INSTALL_DIR="$HOME/.local/bin"+VARIANT="standard"+CBM_DOWNLOAD_URL="${CBM_DOWNLOAD_URL:-https://github.com/${REPO}/releases/latest/download}"++for arg in "$@"; do+ case "$arg" in+ --ui) VARIANT="ui" ;;+ --standard) VARIANT="standard" ;;+ --dir=*) INSTALL_DIR="${arg#--dir=}" ;;+ --help|-h)+ echo "Usage: install.sh [--ui] [--dir=<path>]"+ echo " --ui Install the UI variant (with graph visualization)"+ echo " --standard Install the standard variant (default)"+ echo " --dir PATH Install directory (default: ~/.local/bin)"+ exit 0+ ;;+ esac+done+# Handle --dir <path> (space-separated)+prev=""+for arg in "$@"; do+ if [ "$prev" = "--dir" ]; then+ INSTALL_DIR="$arg"+ fi+ prev="$arg"+done++detect_os() {+ case "$(uname -s)" in+ Darwin) echo "darwin" ;;+ Linux) echo "linux" ;;+ MINGW*|MSYS*|CYGWIN*) echo "windows" ;;+ *) echo "error: unsupported OS: $(uname -s)" >&2; exit 1 ;;+ esac+}++detect_arch() {+ local arch+ arch="$(uname -m)"+ case "$arch" in+ arm64|aarch64) echo "arm64" ;;+ x86_64|amd64)+ # Rosetta detection: shell reports x86_64 but hardware is Apple Silicon+ if [ "$(uname -s)" = "Darwin" ] && sysctl -n machdep.cpu.brand_string 2>/dev/null | grep -qi apple; then+ echo "arm64"+ else+ echo "amd64"+ fi+ ;;+ *) echo "error: unsupported architecture: $arch" >&2; exit 1 ;;+ esac+}++OS=$(detect_os)+ARCH=$(detect_arch)++echo "codebase-memory-mcp installer"+echo " os: $OS"+echo " arch: $ARCH"+echo " variant: $VARIANT"+echo " target: $INSTALL_DIR/codebase-memory-mcp"+echo ""++# Build download URL+if [ "$OS" = "windows" ]; then+ EXT="zip"+else+ EXT="tar.gz"+fi++if [ "$VARIANT" = "ui" ]; then+ ARCHIVE="codebase-memory-mcp-ui-${OS}-${ARCH}.${EXT}"+else+ ARCHIVE="codebase-memory-mcp-${OS}-${ARCH}.${EXT}"+fi++URL="${CBM_DOWNLOAD_URL}/${ARCHIVE}"++# Download+DLDIR=$(mktemp -d)+trap 'rm -rf "$DLDIR"' EXIT++echo "Downloading ${ARCHIVE}..."+if command -v curl &>/dev/null; then+ curl -fSL --progress-bar -o "$DLDIR/$ARCHIVE" "$URL"+elif command -v wget &>/dev/null; then+ wget -q --show-progress -O "$DLDIR/$ARCHIVE" "$URL"+else+ echo "error: curl or wget required" >&2+ exit 1+fi++# Checksum verification+CHECKSUM_URL="${CBM_DOWNLOAD_URL}/checksums.txt"+if curl -fsSL -o "$DLDIR/checksums.txt" "$CHECKSUM_URL" 2>/dev/null; then+ EXPECTED=$(grep "$ARCHIVE" "$DLDIR/checksums.txt" | awk '{print $1}')+ if [ -n "$EXPECTED" ]; then+ if command -v sha256sum &>/dev/null; then+ ACTUAL=$(sha256sum "$DLDIR/$ARCHIVE" | awk '{print $1}')+ elif command -v shasum &>/dev/null; then+ ACTUAL=$(shasum -a 256 "$DLDIR/$ARCHIVE" | awk '{print $1}')+ else+ ACTUAL=""+ fi+ if [ -n "$ACTUAL" ] && [ "$EXPECTED" != "$ACTUAL" ]; then+ echo "error: CHECKSUM MISMATCH — download may be corrupted!" >&2+ echo " expected: $EXPECTED" >&2+ echo " actual: $ACTUAL" >&2+ exit 1+ elif [ -n "$ACTUAL" ]; then+ echo "Checksum verified."+ fi+ fi+fi++# Extract+echo "Extracting..."+cd "$DLDIR"+if [ "$EXT" = "zip" ]; then+ unzip -q "$ARCHIVE"+else+ tar -xzf "$ARCHIVE"+fi++DLBIN="$DLDIR/codebase-memory-mcp"+if [ ! -f "$DLBIN" ]; then+ echo "error: binary not found after extraction" >&2+ exit 1+fi++# macOS: fix signing+if [ "$OS" = "darwin" ]; then+ echo "Fixing macOS code signing..."+ xattr -d com.apple.quarantine "$DLBIN" 2>/dev/null || true+ codesign --sign - --force "$DLBIN" 2>/dev/null || true+fi++# Install+mkdir -p "$INSTALL_DIR"+DEST="$INSTALL_DIR/codebase-memory-mcp"+if [ -f "$DEST" ]; then+ rm -f "$DEST"+fi+cp "$DLBIN" "$DEST"+chmod 755 "$DEST"++# Verify+VERSION=$("$DEST" --version 2>&1) || {+ echo "error: installed binary failed to run" >&2+ if [ "$OS" = "darwin" ]; then+ echo " try: xattr -cr $DEST && codesign --force --sign - $DEST" >&2+ fi+ exit 1+}+echo "Installed: $VERSION"++# Configure agents+echo ""+echo "Configuring coding agents..."+"$DEST" install -y 2>&1 || {+ echo ""+ echo "Agent configuration failed (non-fatal)."+ echo "Run manually: codebase-memory-mcp install"+}++# PATH check+if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then+ echo ""+ echo "NOTE: $INSTALL_DIR is not in your PATH."+ echo "Add it to your shell config:"+ echo ""+ echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.zshrc"+fi++echo ""+echo "Done! Restart your coding agent to start using codebase-memory-mcp."diff --git a/scripts/security-allowlist.txt b/scripts/security-allowlist.txtindex 1641ad3d2..b8fd370ef 100644--- a/scripts/security-allowlist.txt+++ b/scripts/security-allowlist.txt@@ -11,8 +11,8 @@ src/foundation/compat_fs.c:fork:cbm_exec_no_shell — fork+execvp for shell-freesrc/foundation/compat_fs.c:execvp:cbm_exec_no_shell — direct exec without shell interpretation# ── CLI: update command (user-initiated, interactive) ──────────────────────-src/cli/cli.c:system:curl download of release binary (update cmd)src/cli/cli.c:cbm_popen:sha256 checksum verification (update cmd)+src/cli/cli.c:cbm_popen:pgrep for kill_other_instances (hardcoded process name)src/cli/cli.c:popen:sha256 checksum computation via shasum# ── Watcher: git status polling (repo paths validated via cbm_validate_shell_arg) ──diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.shindex acf6ba694..8325ed9eb 100755--- a/scripts/smoke-test.sh+++ b/scripts/smoke-test.sh@@ -10,6 +10,7 @@ set -euo pipefail# Usage: smoke-test.sh <binary-path>BINARY="${1:?usage: smoke-test.sh <binary-path>}"+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)"TMPDIR=$(mktemp -d)# On MSYS2/Windows, convert POSIX path to native Windows path for the binaryif command -v cygpath &>/dev/null; then@@ -1032,5 +1033,180 @@ echo "OK 14g-i: read-only replacement + verify"rm -rf "$UPDATE_DIR"+# ── Phase 12 + 13: Download E2E + install script E2E (CI only) ──+# These phases require SMOKE_DOWNLOAD_URL to be set (local HTTP server in CI).+# When unset, they are skipped (local development runs).++if [ -n "${SMOKE_DOWNLOAD_URL:-}" ]; then++echo ""+echo "=== Phase 12: download + checksum + extraction E2E ==="++DL_DIR=$(mktemp -d)++# Detect platform for archive name+DL_OS=$(uname -s | tr 'A-Z' 'a-z')+DL_ARCH=$(uname -m)+case "$DL_ARCH" in+ aarch64) DL_ARCH="arm64" ;;+ x86_64)+ # Rosetta detection+ if [ "$DL_OS" = "darwin" ] && sysctl -n machdep.cpu.brand_string 2>/dev/null | grep -qi apple; then+ DL_ARCH="arm64"+ else+ DL_ARCH="amd64"+ fi+ ;;+esac++if [ "$DL_OS" = "darwin" ] || [ "$DL_OS" = "linux" ]; then+ DL_EXT="tar.gz"+else+ DL_EXT="zip"+fi+DL_ARCHIVE="codebase-memory-mcp-${DL_OS}-${DL_ARCH}.${DL_EXT}"++# 12a: curl download+echo "--- Phase 12a: curl download ---"+if ! curl -fSL -o "$DL_DIR/$DL_ARCHIVE" "$SMOKE_DOWNLOAD_URL/$DL_ARCHIVE"; then+ echo "FAIL 12a: curl download failed"+ exit 1+fi+if [ ! -s "$DL_DIR/$DL_ARCHIVE" ]; then+ echo "FAIL 12a: downloaded archive is empty"+ exit 1+fi+echo "OK 12a: archive downloaded ($(wc -c < "$DL_DIR/$DL_ARCHIVE") bytes)"++# 12b: checksum download+echo "--- Phase 12b: checksum verification ---"+if ! curl -fsSL -o "$DL_DIR/checksums.txt" "$SMOKE_DOWNLOAD_URL/checksums.txt"; then+ echo "FAIL 12b: checksums.txt download failed"+ exit 1+fi++# 12c: verify checksum+EXPECTED=$(grep "$DL_ARCHIVE" "$DL_DIR/checksums.txt" | awk '{print $1}')+if [ -z "$EXPECTED" ]; then+ echo "FAIL 12c: archive not found in checksums.txt"+ exit 1+fi+if command -v sha256sum &>/dev/null; then+ ACTUAL=$(sha256sum "$DL_DIR/$DL_ARCHIVE" | awk '{print $1}')+elif command -v shasum &>/dev/null; then+ ACTUAL=$(shasum -a 256 "$DL_DIR/$DL_ARCHIVE" | awk '{print $1}')+else+ echo "FAIL 12c: no sha256 tool available"+ exit 1+fi+if [ "$EXPECTED" != "$ACTUAL" ]; then+ echo "FAIL 12c: checksum mismatch (expected=$EXPECTED actual=$ACTUAL)"+ exit 1+fi+echo "OK 12c: checksum verified"++# 12d: extract binary+echo "--- Phase 12d: extraction ---"+(cd "$DL_DIR" && if [ "$DL_EXT" = "zip" ]; then unzip -q "$DL_ARCHIVE"; else tar -xzf "$DL_ARCHIVE"; fi)+DL_BIN="$DL_DIR/codebase-memory-mcp"+if [ ! -f "$DL_BIN" ]; then+ echo "FAIL 12d: binary not found after extraction"+ exit 1+fi+chmod +x "$DL_BIN"+echo "OK 12d: binary extracted"++# 12e: extracted binary runs+if ! "$DL_BIN" --version > /dev/null 2>&1; then+ # On macOS arm64, may need signing+ if [ "$DL_OS" = "darwin" ]; then+ xattr -d com.apple.quarantine "$DL_BIN" 2>/dev/null || true+ codesign --sign - --force "$DL_BIN" 2>/dev/null || true+ if ! "$DL_BIN" --version > /dev/null 2>&1; then+ echo "FAIL 12e: extracted binary doesn't run even after signing"+ exit 1+ fi+ else+ echo "FAIL 12e: extracted binary doesn't run"+ exit 1+ fi+fi+echo "OK 12e: extracted binary runs"++# 12f: platform-specific post-extraction verification+if [ "$DL_OS" = "darwin" ]; then+ if codesign -v "$DL_BIN" 2>/dev/null; then+ echo "OK 12f: macOS binary has valid signature (CI pre-signed)"+ else+ echo "OK 12f: macOS binary signed locally (CI pre-sign not yet active)"+ fi+else+ echo "OK 12f: binary runs without signing ($DL_OS)"+fi++rm -rf "$DL_DIR"++echo ""+echo "=== Phase 13: install script E2E ==="++if [ "$DL_OS" != "windows" ] && [ -f "$REPO_ROOT/install.sh" ]; then+ echo "--- Phase 13: install.sh E2E ---"+ INSTALL_TEST_HOME=$(mktemp -d)+ INSTALL_TEST_DIR=$(mktemp -d)+ mkdir -p "$INSTALL_TEST_HOME/.claude"+ mkdir -p "$INSTALL_TEST_HOME/.local/bin"++ # 13a: run install.sh with local URL + isolated HOME+ HOME="$INSTALL_TEST_HOME" CBM_DOWNLOAD_URL="$SMOKE_DOWNLOAD_URL" \+ "$REPO_ROOT/install.sh" --dir="$INSTALL_TEST_DIR" 2>&1 || true++ # 13b: binary placed+ if [ ! -f "$INSTALL_TEST_DIR/codebase-memory-mcp" ]; then+ echo "FAIL 13b: binary not placed by install.sh"+ exit 1+ fi+ echo "OK 13b: binary placed"++ # 13c: binary runs+ # Sign if needed on macOS+ if [ "$DL_OS" = "darwin" ]; then+ codesign --sign - --force "$INSTALL_TEST_DIR/codebase-memory-mcp" 2>/dev/null || true+ fi+ if ! "$INSTALL_TEST_DIR/codebase-memory-mcp" --version > /dev/null 2>&1; then+ echo "FAIL 13c: installed binary doesn't run"+ exit 1+ fi+ echo "OK 13c: binary runs"++ # 13d: macOS signature check+ if [ "$DL_OS" = "darwin" ]; then+ if codesign -v "$INSTALL_TEST_DIR/codebase-memory-mcp" 2>/dev/null; then+ echo "OK 13d: macOS binary signed"+ else+ echo "FAIL 13d: macOS binary not signed after install.sh"+ exit 1+ fi+ else+ echo "OK 13d: no signing needed ($DL_OS)"+ fi++ # 13e: agent configs created (at least Claude Code since we made ~/.claude)+ if [ -f "$INSTALL_TEST_HOME/.claude.json" ] && grep -q 'codebase-memory-mcp' "$INSTALL_TEST_HOME/.claude.json" 2>/dev/null; then+ echo "OK 13e: agent configs created by install.sh"+ else+ echo "FAIL 13e: install.sh did not create agent configs"+ exit 1+ fi++ rm -rf "$INSTALL_TEST_HOME" "$INSTALL_TEST_DIR"+else+ echo "SKIP Phase 13: install script not available for this platform"+fi++else+ echo ""+ echo "=== Phase 12-13: SKIPPED (SMOKE_DOWNLOAD_URL not set) ==="+fi+echo ""echo "=== smoke-test: ALL PASSED ==="diff --git a/src/cli/cli.c b/src/cli/cli.cindex 7c7ee412c..ab880d4c1 100644--- a/src/cli/cli.c+++ b/src/cli/cli.c@@ -2100,7 +2100,7 @@ static int sha256_file(const char *path, char *out, size_t out_size) {return -1;}-/* ── Download helper (replaces system("curl ...")) ────────────── */+/* ── Download helper (shell-free curl via exec) ───────────────── */static int cbm_download_to_file(const char *url, const char *dest) {const char *argv[] = {"curl", "-fSL", "--progress-bar", "-o", dest, url, NULL};