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:9484–9503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9482#endif
9483
9484static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact,
9485 const char *bin_dir) {
9486 (void)bin_dir;
9487 if (!self_path_exact || !self_path || !self_path[0]) {
9488 return false;
9489 }
9490 /* POSITIVE evidence only: the path must look like a known package manager's.
9491 *
9492 * The tempting rule — "anything outside the directory we install into"
9493 * is wrong, and the test suite proved it immediately: a test binary runs
9494 * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives
9495 * outside the default. Both would be misread as foreign, and `update` would
9496 * refuse to update an installation we own.
9497 *
9498 * The asymmetry decides it. A false positive REFUSES a legitimate update; a
9499 * false negative just leaves today's behaviour in place for an unrecognised
9500 * manager, which --skip-binary covers explicitly. So we only infer when we
9501 * can name the owner. */
9502 return cli_external_manager_name(self_path) != NULL;
9503}
9504
9505/* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of
9506 * 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