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

Function install_tiered_agent_profiles

src/cli/cli.c:7509–7566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7507}
7508
7509static void install_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) {
7510 cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles);
7511 for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) {
7512 cbm_graph_tier_t tier = (cbm_graph_tier_t)value;
7513 char path[CLI_BUF_1K];
7514 if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) {
7515 record_agent_config_error(false, profiles.label, "agent_path", profiles.verify_path);
7516 continue;
7517 }
7518 if (g_install_plan) {
7519 plan_record(profiles.label, "agent", path);
7520 continue;
7521 }
7522 if (dry_run) {
7523 printf(" agent: %s\n", path);
7524 continue;
7525 }
7526 char *current =
7527 cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path);
7528 if (!current) {
7529 record_agent_config_error(false, profiles.label, "agent_render", path);
7530 continue;
7531 }
7532 cbm_graph_access_t alternate_access =
7533 access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT;
7534 char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access,
7535 profiles.binary_path);
7536 char *codex_rc1 =
7537 profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT
7538 ? cbm_render_graph_profile_codex_rc1(tier)
7539 : NULL;
7540 const char *released[3];
7541 size_t released_count = 0U;
7542 if (alternate) {
7543 released[released_count++] = alternate;
7544 }
7545 if (codex_rc1) {
7546 released[released_count++] = codex_rc1;
7547 }
7548 if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) {
7549 released[released_count++] = profiles.legacy_verify_content;
7550 }
7551 int result = prepare_config_parent(path)
7552 ? cbm_text_migrate_owned_document(path, current, released, released_count)
7553 : CLI_ERR;
7554 free(codex_rc1);
7555 free(alternate);
7556 free(current);
7557 if (result != CLI_OK) {
7558 if (result > CLI_OK) {
7559 printf(" agent: preserved modified profile %s\n", path);
7560 }
7561 record_agent_config_error(false, profiles.label, "agent_install", path);
7562 continue;
7563 }
7564 printf(" agent: %s\n", path);
7565 }
7566}

Calls 8

cbm_tiered_profile_pathFunction · 0.85
plan_recordFunction · 0.85
cbm_render_graph_profileFunction · 0.85
prepare_config_parentFunction · 0.85

Tested by

no test coverage detected