MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cli_binary_is_externally_managed

Function cli_binary_is_externally_managed

src/cli/cli.c:9711–9730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9709#endif
9710
9711static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact,
9712 const char *bin_dir) {
9713 (void)bin_dir;
9714 if (!self_path_exact || !self_path || !self_path[0]) {
9715 return false;
9716 }
9717 /* POSITIVE evidence only: the path must look like a known package manager's.
9718 *
9719 * The tempting rule — "anything outside the directory we install into"
9720 * is wrong, and the test suite proved it immediately: a test binary runs
9721 * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives
9722 * outside the default. Both would be misread as foreign, and `update` would
9723 * refuse to update an installation we own.
9724 *
9725 * The asymmetry decides it. A false positive REFUSES a legitimate update; a
9726 * false negative just leaves today's behaviour in place for an unrecognised
9727 * manager, which --skip-binary covers explicitly. So we only infer when we
9728 * can name the owner. */
9729 return cli_external_manager_name(self_path) != NULL;
9730}
9731
9732/* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of
9733 * the config / instruction / skill / agent / hook files `install` WOULD write, produced by

Callers 2

cbm_cmd_installFunction · 0.85
cbm_cmd_updateFunction · 0.85

Calls 1

Tested by

no test coverage detected