| 8997 | } |
| 8998 | |
| 8999 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 9000 | cbm_graph_profile_dialect_t dialect, |
| 9001 | const char *legacy_verify_content, bool dry_run) { |
| 9002 | cbm_graph_access_t access = cbm_tiered_profile_access(dialect); |
| 9003 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 9004 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 9005 | char path[CLI_BUF_1K]; |
| 9006 | if (cbm_tiered_profile_path(verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 9007 | record_agent_config_error(false, label, "prompt_path", verify_path); |
| 9008 | continue; |
| 9009 | } |
| 9010 | if (g_install_plan) { |
| 9011 | plan_record(label, "prompt", path); |
| 9012 | continue; |
| 9013 | } |
| 9014 | if (dry_run) { |
| 9015 | printf(" prompt: %s\n", path); |
| 9016 | continue; |
| 9017 | } |
| 9018 | char *current = cbm_render_graph_prompt(tier, access); |
| 9019 | if (!current) { |
| 9020 | record_agent_config_error(false, label, "prompt_render", path); |
| 9021 | continue; |
| 9022 | } |
| 9023 | const char *released[] = {legacy_verify_content}; |
| 9024 | size_t released_count = tier == CBM_GRAPH_TIER_VERIFY && legacy_verify_content ? 1U : 0U; |
| 9025 | int result = prepare_config_parent(path) |
| 9026 | ? cbm_text_migrate_owned_document(path, current, released, released_count) |
| 9027 | : CLI_ERR; |
| 9028 | free(current); |
| 9029 | if (result != CLI_OK) { |
| 9030 | if (result > CLI_OK) { |
| 9031 | printf(" prompt: preserved modified profile %s\n", path); |
| 9032 | } |
| 9033 | record_agent_config_error(false, label, "prompt_install", path); |
| 9034 | continue; |
| 9035 | } |
| 9036 | printf(" prompt: %s\n", path); |
| 9037 | } |
| 9038 | } |
| 9039 | |
| 9040 | static void uninstall_tiered_profile_prompts(const char *label, const char *verify_path, |
| 9041 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected