| 7574 | } |
| 7575 | |
| 7576 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7577 | cbm_graph_profile_dialect_t dialect, |
| 7578 | const char *legacy_verify_content, bool dry_run) { |
| 7579 | cbm_graph_access_t access = cbm_tiered_profile_access(dialect); |
| 7580 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7581 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7582 | char path[CLI_BUF_1K]; |
| 7583 | if (cbm_tiered_profile_path(verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7584 | record_agent_config_error(false, label, "prompt_path", verify_path); |
| 7585 | continue; |
| 7586 | } |
| 7587 | if (g_install_plan) { |
| 7588 | plan_record(label, "prompt", path); |
| 7589 | continue; |
| 7590 | } |
| 7591 | if (dry_run) { |
| 7592 | printf(" prompt: %s\n", path); |
| 7593 | continue; |
| 7594 | } |
| 7595 | char *current = cbm_render_graph_prompt(tier, access); |
| 7596 | if (!current) { |
| 7597 | record_agent_config_error(false, label, "prompt_render", path); |
| 7598 | continue; |
| 7599 | } |
| 7600 | const char *released[] = {legacy_verify_content}; |
| 7601 | size_t released_count = tier == CBM_GRAPH_TIER_VERIFY && legacy_verify_content ? 1U : 0U; |
| 7602 | int result = prepare_config_parent(path) |
| 7603 | ? cbm_text_migrate_owned_document(path, current, released, released_count) |
| 7604 | : CLI_ERR; |
| 7605 | free(current); |
| 7606 | if (result != CLI_OK) { |
| 7607 | if (result > CLI_OK) { |
| 7608 | printf(" prompt: preserved modified profile %s\n", path); |
| 7609 | } |
| 7610 | record_agent_config_error(false, label, "prompt_install", path); |
| 7611 | continue; |
| 7612 | } |
| 7613 | printf(" prompt: %s\n", path); |
| 7614 | } |
| 7615 | } |
| 7616 | |
| 7617 | static void uninstall_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7618 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected