mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
* fix(cli): copy and sign the built binary on install instead of re-signing the stale target `install` (especially with --force) only ad-hoc-signed whatever already sat at ~/.local/bin/codebase-memory-mcp and never copied the binary the operator ran install from. An operator who built from source and ran `install -y --force` was silently left with the OLD binary at the target — running stale code while believing they had upgraded (#472). Install now mirrors `update`: detect the running binary, copy it to the canonical target (skipping the copy when we already ARE the target, which would otherwise truncate the running file), make it executable, ad-hoc sign the TARGET, and point all agent configs at the target. A different pre-existing binary is only replaced with --force or interactive confirmation; --dry-run reports the intended swap without touching anything. The copy+sign also resolves the secondary report: a hand-copied clang build is linker-signed (flags=0x20002) and gets Killed:9 when spawned by an MCP host — re-signing ad-hoc (flags=0x2) makes it launchable, which install now does for the placed binary. Adds cbm_copy_binary_to_target() (with a same-file guard) plus regression tests covering the binary swap and the self-copy guard. Closes #472 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Shane McCarron <shane.mccarron@corvexconnect.com> * fix(cli): address QA round 1 Extend cli_install_same_file_guard_issue472 with a symlink case: two distinct path strings resolving to the same inode (which a non-canonical cbm_detect_self_path vs the hardcoded target can produce) must also be detected as same-file and skipped, not truncated. POSIX-only (#ifndef _WIN32). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Shane McCarron <shane.mccarron@corvexconnect.com> * test(cli): guard install copy exec-bit assertion to POSIX cli_install_copies_binary_to_target_issue472 asserted the executable bit on the copied target, but cbm_copy_binary_to_target only chmods on POSIX (the exec bit is not meaningful on Windows, and MinGW stat() derives it from the file extension). Wrap the stat/S_IXUSR assertion in #ifndef _WIN32 so test-windows passes; the content and creation assertions still run on all platforms. Refs #472 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Shane McCarron <shane.mccarron@corvexconnect.com> --------- Signed-off-by: Shane McCarron <shane.mccarron@corvexconnect.com> Co-authored-by: Shane McCarron <shane.mccarron@corvexconnect.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>