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

Source from the content-addressed store, hash-verified

10738#endif
10739
10740static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact,
10741 const char *bin_dir) {
10742 (void)bin_dir;
10743 if (!self_path_exact || !self_path || !self_path[0]) {
10744 return false;
10745 }
10746 /* POSITIVE evidence only: the path must look like a known package manager's.
10747 *
10748 * The tempting rule — "anything outside the directory we install into" —
10749 * is wrong, and the test suite proved it immediately: a test binary runs
10750 * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives
10751 * outside the default. Both would be misread as foreign, and `update` would
10752 * refuse to update an installation we own.
10753 *
10754 * The asymmetry decides it. A false positive REFUSES a legitimate update; a
10755 * false negative just leaves today's behaviour in place for an unrecognised
10756 * manager, which --skip-binary covers explicitly. So we only infer when we
10757 * can name the owner. */
10758 return cli_external_manager_name(self_path) != NULL;
10759}
10760
10761/* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of
10762 * 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