| 7680 | } |
| 7681 | |
| 7682 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7683 | cbm_graph_profile_dialect_t dialect, |
| 7684 | const char *legacy_verify_content, bool dry_run) { |
| 7685 | cbm_graph_access_t access = cbm_tiered_profile_access(dialect); |
| 7686 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7687 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7688 | char path[CLI_BUF_1K]; |
| 7689 | if (cbm_tiered_profile_path(verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7690 | record_agent_config_error(false, label, "prompt_path", verify_path); |
| 7691 | continue; |
| 7692 | } |
| 7693 | if (g_install_plan) { |
| 7694 | plan_record(label, "prompt", path); |
| 7695 | continue; |
| 7696 | } |
| 7697 | if (dry_run) { |
| 7698 | printf(" prompt: %s\n", path); |
| 7699 | continue; |
| 7700 | } |
| 7701 | char *current = cbm_render_graph_prompt(tier, access); |
| 7702 | if (!current) { |
| 7703 | record_agent_config_error(false, label, "prompt_render", path); |
| 7704 | continue; |
| 7705 | } |
| 7706 | const char *released[] = {legacy_verify_content}; |
| 7707 | size_t released_count = tier == CBM_GRAPH_TIER_VERIFY && legacy_verify_content ? 1U : 0U; |
| 7708 | int result = prepare_config_parent(path) |
| 7709 | ? cbm_text_migrate_owned_document(path, current, released, released_count) |
| 7710 | : CLI_ERR; |
| 7711 | free(current); |
| 7712 | if (result != CLI_OK) { |
| 7713 | if (result > CLI_OK) { |
| 7714 | printf(" prompt: preserved modified profile %s\n", path); |
| 7715 | } |
| 7716 | record_agent_config_error(false, label, "prompt_install", path); |
| 7717 | continue; |
| 7718 | } |
| 7719 | printf(" prompt: %s\n", path); |
| 7720 | } |
| 7721 | } |
| 7722 | |
| 7723 | static void uninstall_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7724 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected