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

Function install_additional_agent_configs

src/cli/cli.c:10006–10328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10004}
10005
10006static void install_additional_agent_configs(const cbm_detected_agents_t *agents, const char *home,
10007 const char *binary_path, bool force, bool dry_run) {
10008 if (agents->hermes) {
10009 char hermes_home[CLI_BUF_1K];
10010 char cp[CLI_BUF_1K];
10011 char skills_dir[CLI_BUF_1K];
10012 cbm_hermes_home_dir(home, hermes_home, sizeof(hermes_home));
10013 snprintf(cp, sizeof(cp), "%s/config.yaml", hermes_home);
10014 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", hermes_home);
10015 install_generic_agent_config("Hermes", binary_path, cp, NULL, dry_run,
10016 cbm_upsert_hermes_mcp);
10017 install_agent_skill("Hermes", skills_dir, force, dry_run);
10018 if (g_install_plan) {
10019 plan_record("Hermes", "hook", cp);
10020 } else {
10021 int hook_result = CBM_YAML_IDENTITY_EDIT_OK;
10022 if (!dry_run) {
10023 hook_result = prepare_config_parent(cp)
10024 ? cbm_upsert_hermes_context_hook(cp, binary_path)
10025 : CBM_YAML_IDENTITY_EDIT_ERROR;
10026 }
10027 if (hook_result == CBM_YAML_IDENTITY_EDIT_FOREIGN) {
10028 record_agent_config_error(false, "Hermes", "pre_llm_hook_foreign", cp);
10029 } else if (hook_result != CBM_YAML_IDENTITY_EDIT_OK) {
10030 record_agent_config_error(false, "Hermes", "pre_llm_hook_install", cp);
10031 } else {
10032 printf(" hook: %s (pre_llm_call)\n", cp);
10033 }
10034 }
10035 }
10036 if (agents->openhands) {
10037 char cp[CLI_BUF_1K];
10038 char skills_dir[CLI_BUF_1K];
10039 char settings_path[CLI_BUF_1K];
10040 char profiles_dir[CLI_BUF_1K];
10041 snprintf(cp, sizeof(cp), "%s/.openhands/mcp.json", home);
10042 snprintf(skills_dir, sizeof(skills_dir), "%s/.agents/skills", home);
10043 snprintf(settings_path, sizeof(settings_path), "%s/.openhands/settings.json", home);
10044 snprintf(profiles_dir, sizeof(profiles_dir), "%s/.openhands/agent-profiles", home);
10045 install_generic_agent_config("OpenHands", binary_path, cp, NULL, dry_run,
10046 cbm_install_editor_mcp);
10047 install_agent_skill("OpenHands", skills_dir, force, dry_run);
10048 /* #1826: the mcpServers-shaped mcp.json above is not enough — OpenHands
10049 * only loads a server registered under settings.json -> mcp_config, and
10050 * only for agent profiles that reference it. agent-profiles/ is never
10051 * invented; a missing directory means nothing to register into yet. */
10052 if (g_install_plan) {
10053 plan_record("OpenHands", "mcp_config", settings_path);
10054 } else {
10055 if (!dry_run) {
10056 if (!prepare_config_parent(settings_path) ||
10057 cbm_upsert_openhands_settings_mcp(binary_path, settings_path) != CLI_OK) {
10058 record_agent_config_error(false, "OpenHands", "settings_mcp_install",
10059 settings_path);
10060 }
10061 }
10062 printf(" settings mcp_config: %s\n", settings_path);
10063 openhands_update_profile_refs(profiles_dir, true, dry_run);

Callers 1

Tested by

no test coverage detected