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

Function install_tiered_agent_profiles

src/cli/cli.c:7515–7572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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