| 7982 | } |
| 7983 | |
| 7984 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7985 | cbm_graph_profile_dialect_t dialect, |
| 7986 | const char *legacy_verify_content, bool dry_run) { |
| 7987 | cbm_graph_access_t access = cbm_tiered_profile_access(dialect); |
| 7988 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7989 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7990 | char path[CLI_BUF_1K]; |
| 7991 | if (cbm_tiered_profile_path(verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7992 | record_agent_config_error(false, label, "prompt_path", verify_path); |
| 7993 | continue; |
| 7994 | } |
| 7995 | if (g_install_plan) { |
| 7996 | plan_record(label, "prompt", path); |
| 7997 | continue; |
| 7998 | } |
| 7999 | if (dry_run) { |
| 8000 | printf(" prompt: %s\n", path); |
| 8001 | continue; |
| 8002 | } |
| 8003 | char *current = cbm_render_graph_prompt(tier, access); |
| 8004 | if (!current) { |
| 8005 | record_agent_config_error(false, label, "prompt_render", path); |
| 8006 | continue; |
| 8007 | } |
| 8008 | const char *released[] = {legacy_verify_content}; |
| 8009 | size_t released_count = tier == CBM_GRAPH_TIER_VERIFY && legacy_verify_content ? 1U : 0U; |
| 8010 | int result = prepare_config_parent(path) |
| 8011 | ? cbm_text_migrate_owned_document(path, current, released, released_count) |
| 8012 | : CLI_ERR; |
| 8013 | free(current); |
| 8014 | if (result != CLI_OK) { |
| 8015 | if (result > CLI_OK) { |
| 8016 | printf(" prompt: preserved modified profile %s\n", path); |
| 8017 | } |
| 8018 | record_agent_config_error(false, label, "prompt_install", path); |
| 8019 | continue; |
| 8020 | } |
| 8021 | printf(" prompt: %s\n", path); |
| 8022 | } |
| 8023 | } |
| 8024 | |
| 8025 | static void uninstall_tiered_profile_prompts(const char *label, const char *verify_path, |
| 8026 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected