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
fix(install,smoke): carry cbm-integrations.json wherever the binary goes
Martin Vogel365841304c7d
diff --git a/install.ps1 b/install.ps1index 890dfd4f8..9545280cd 100644--- a/install.ps1+++ b/install.ps1@@ -322,6 +322,24 @@ if (Test-Path -LiteralPath $DownloadedInstaller -PathType Leaf) {}}+# Place the integration-template asset beside the installed binary, mirroring+# install.sh. `install` above published a verified copy to ~/.cbm/assets, but a+# later install/uninstall run from $InstallDir resolves the asset next to the+# binary first; without this copy that lookup misses and the run fails closed+# with "integration assets missing".+$DownloadedAsset = Join-Path $TmpDir "cbm-integrations.json"+if (Test-Path -LiteralPath $DownloadedAsset -PathType Leaf) {+ $AssetDest = Join-Path $InstallDir "cbm-integrations.json"+ $AssetTmp = "$AssetDest.new"+ try {+ Copy-Item -LiteralPath $DownloadedAsset -Destination $AssetTmp -Force -ErrorAction Stop+ Move-Item -LiteralPath $AssetTmp -Destination $AssetDest -Force -ErrorAction Stop+ } catch {+ Remove-Item -LiteralPath $AssetTmp -Force -ErrorAction SilentlyContinue+ Write-Host "note: could not place cbm-integrations.json in $InstallDir (asset resolves from ~/.cbm/assets)"+ }+}+# Verifytry {$ver = & $Dest --version 2>&1diff --git a/install.sh b/install.shindex e58a28294..e0551055e 100755--- a/install.sh+++ b/install.sh@@ -294,6 +294,25 @@ if [ -f "$DL_INSTALLER" ]; thenfifi+# Place the integration-template asset beside the installed binary. `install`+# above already published a verified copy to ~/.cbm/assets/<version>/, but a+# later `install`/`uninstall` run from INSTALL_DIR resolves the asset next to+# the binary FIRST — and without this copy that lookup misses, so a re-run or an+# uninstall would fail closed with "integration assets missing" even though a+# valid install just completed. Atomic rename, best effort, same rationale as+# the installer copy above.+DL_ASSET="$DLDIR/cbm-integrations.json"+if [ -f "$DL_ASSET" ]; then+ ASSET_TMP="$INSTALL_DIR/.cbm-integrations.json.$$"+ if cp "$DL_ASSET" "$ASSET_TMP" 2>/dev/null &&+ mv -f "$ASSET_TMP" "$INSTALL_DIR/cbm-integrations.json" 2>/dev/null; then+ :+ else+ rm -f "$ASSET_TMP" 2>/dev/null || true+ echo "note: could not place cbm-integrations.json in $INSTALL_DIR (asset resolves from ~/.cbm/assets)"+ fi+fi+# VerifyVERSION=$("$DEST" --version 2>&1) || {echo "error: installed binary failed to run" >&2diff --git a/scripts/build.sh b/scripts/build.shindex 575477a94..0b44dcbf4 100755--- a/scripts/build.sh+++ b/scripts/build.sh@@ -156,4 +156,14 @@ elseCFLAGS_EXTRA="$CFLAGS_EXTRA" "${EXTRA_MAKE_ARGS[@]+"${EXTRA_MAKE_ARGS[@]}"}"fi+# Stage the integration-template asset next to the binary so the dev/CI build+# mirrors the release archive layout. The binary resolves cbm-integrations.json+# next to itself, in $CBM_ASSETS_DIR, or under ~/.cbm/assets/<version>/; a plain+# build/c binary has none of those, so install/uninstall (which render the+# templates to verify hash and ownership) would fail closed exactly as they do+# for a user who deleted the file. Copying it here keeps `install` working+# straight out of a build tree — smoke, local dev, and the release packaging all+# then see the same adjacency.+cp "$ROOT/assets/cbm-integrations.json" "$BUILD_DIR/cbm-integrations.json"+echo "=== Build complete: ${BUILD_DIR}/codebase-memory-mcp ==="diff --git a/scripts/smoke-local.sh b/scripts/smoke-local.shindex ae617634a..b97292560 100755--- a/scripts/smoke-local.sh+++ b/scripts/smoke-local.sh@@ -72,7 +72,7 @@ esacARTIFACT_DIR="${CBM_SMOKE_ARTIFACT_DIR:-}"if [ -n "$ARTIFACT_DIR" ]; thenARTIFACT_DIR="$(cd "$ARTIFACT_DIR" && pwd)"- for required in LICENSE install.sh THIRD_PARTY_NOTICES.md; do+ for required in cbm-integrations.json LICENSE install.sh THIRD_PARTY_NOTICES.md; do[ -s "$ARTIFACT_DIR/$required" ] || {echo "smoke-local: release artifact is missing $required" >&2exit 2@@ -123,16 +123,20 @@ mkdir -p "$FIXTURE_DIR" "$SMOKE_TEMP_DIR" "$SMOKE_HOME" "$SMOKE_XDG_CONFIG" \"$SMOKE_APPDATA" "$SMOKE_LOCALAPPDATA"cp "$BINARY" "$FIXTURE_DIR/codebase-memory-mcp"if [ -n "$ARTIFACT_DIR" ]; then- cp "$ARTIFACT_DIR/LICENSE" "$ARTIFACT_DIR/install.sh" \- "$ARTIFACT_DIR/THIRD_PARTY_NOTICES.md" "$FIXTURE_DIR/"+ cp "$ARTIFACT_DIR/cbm-integrations.json" "$ARTIFACT_DIR/LICENSE" \+ "$ARTIFACT_DIR/install.sh" "$ARTIFACT_DIR/THIRD_PARTY_NOTICES.md" "$FIXTURE_DIR/"else- cp "$ROOT/LICENSE" "$ROOT/install.sh" "$FIXTURE_DIR/"+ cp "$ROOT/assets/cbm-integrations.json" "$ROOT/LICENSE" "$ROOT/install.sh" "$FIXTURE_DIR/""$ROOT/scripts/gen-third-party-notices.sh" "$FIXTURE_DIR/THIRD_PARTY_NOTICES.md"fi+# The archive must carry cbm-integrations.json — install verifies it against the+# binary's embedded SHA-256 and fails closed without it. Member set and ORDER+# mirror scripts/package-release.sh (the Windows single-binary contract locks+# that order); a fixture that omits it would smoke a release layout we never ship.EXPECTED_ARTIFACT="codebase-memory-mcp${SUFFIX}-${OS}-${ARCH}.tar.gz"tar -czf "$FIXTURE_DIR/$EXPECTED_ARTIFACT" -C "$FIXTURE_DIR" \- codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ codebase-memory-mcp cbm-integrations.json LICENSE install.sh THIRD_PARTY_NOTICES.mdif [ -n "$SUFFIX" ]; thencp "$FIXTURE_DIR/$EXPECTED_ARTIFACT" \"$FIXTURE_DIR/codebase-memory-mcp-${OS}-${ARCH}.tar.gz"diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.shindex 344b00930..f0c680f94 100755--- a/scripts/smoke-test.sh+++ b/scripts/smoke-test.sh@@ -3068,16 +3068,24 @@ if [ -n "${SMOKE_DOWNLOAD_URL:-}" ]; thenfiUPDATE_HOME=$(smoke_mktemp_dir)mkdir -p "$UPDATE_HOME/.claude" "$UPDATE_HOME/.local/bin"+ # This phase stages the binary by hand into a fresh HOME — it does NOT go+ # through install.sh or `install`, so nothing populates ~/.cbm/assets. The+ # integration asset ships next to the binary in every real layout (archive,+ # build tree, installed dir), so stage it next to each staged copy here too;+ # otherwise the uninstall this phase drives fails closed rendering templates.+ BINARY_ASSET="$(dirname "$BINARY")/cbm-integrations.json"if [[ "$BINARY" == *.exe ]]; thencp "$BINARY" "$UPDATE_HOME/.local/bin/codebase-memory-mcp.exe"mkdir -p "$UPDATE_HOME/retired-install"cp "$BINARY" "$UPDATE_HOME/retired-install/codebase-memory-mcp.exe"+ [ -f "$BINARY_ASSET" ] && cp "$BINARY_ASSET" "$UPDATE_HOME/.local/bin/cbm-integrations.json"elsecp "$BINARY" "$UPDATE_HOME/.local/bin/codebase-memory-mcp"chmod 755 "$UPDATE_HOME/.local/bin/codebase-memory-mcp"mkdir -p "$UPDATE_HOME/retired-install"cp "$BINARY" "$UPDATE_HOME/retired-install/codebase-memory-mcp"chmod 755 "$UPDATE_HOME/retired-install/codebase-memory-mcp"+ [ -f "$BINARY_ASSET" ] && cp "$BINARY_ASSET" "$UPDATE_HOME/.local/bin/cbm-integrations.json"if [ "$(uname -s)" = "Darwin" ]; thencodesign --sign - --force "$UPDATE_HOME/.local/bin/codebase-memory-mcp" 2>/dev/null || truecodesign --sign - --force "$UPDATE_HOME/retired-install/codebase-memory-mcp" \