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

Function install_tiered_agent_profiles

src/cli/cli.c:7873–7930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7871}
7872
7873static void install_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) {
7874 cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles);
7875 for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) {
7876 cbm_graph_tier_t tier = (cbm_graph_tier_t)value;
7877 char path[CLI_BUF_1K];
7878 if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) {
7879 record_agent_config_error(false, profiles.label, "agent_path", profiles.verify_path);
7880 continue;
7881 }
7882 if (g_install_plan) {
7883 plan_record(profiles.label, "agent", path);
7884 continue;
7885 }
7886 if (dry_run) {
7887 printf(" agent: %s\n", path);
7888 continue;
7889 }
7890 char *current =
7891 cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path);
7892 if (!current) {
7893 record_agent_config_error(false, profiles.label, "agent_render", path);
7894 continue;
7895 }
7896 cbm_graph_access_t alternate_access =
7897 access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT;
7898 char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access,
7899 profiles.binary_path);
7900 char *codex_rc1 =
7901 profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT
7902 ? cbm_render_graph_profile_codex_rc1(tier)
7903 : NULL;
7904 const char *released[3];
7905 size_t released_count = 0U;
7906 if (alternate) {
7907 released[released_count++] = alternate;
7908 }
7909 if (codex_rc1) {
7910 released[released_count++] = codex_rc1;
7911 }
7912 if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) {
7913 released[released_count++] = profiles.legacy_verify_content;
7914 }
7915 int result = prepare_config_parent(path)
7916 ? cbm_text_migrate_owned_document(path, current, released, released_count)
7917 : CLI_ERR;
7918 free(codex_rc1);
7919 free(alternate);
7920 free(current);
7921 if (result != CLI_OK) {
7922 if (result > CLI_OK) {
7923 printf(" agent: preserved modified profile %s\n", path);
7924 }
7925 record_agent_config_error(false, profiles.label, "agent_install", path);
7926 continue;
7927 }
7928 printf(" agent: %s\n", path);
7929 }
7930}

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