@@ -7086,9 +7086,9 @@ static void install_claude_code_config(const char *home, const char *binary_path
70867086 printf (" integration: explicit CLI hooks\n" );
70877087 char settings_path [CLI_BUF_1K ];
70887088 snprintf (settings_path , sizeof (settings_path ), "%s/settings.json" , config_dir );
7089- bool gate_ok = dry_run ;
7090- bool session_ok = dry_run ;
7091- bool subagent_ok = dry_run ;
7089+ bool gate_ok ;
7090+ bool session_ok ;
7091+ bool subagent_ok ;
70927092 if (dry_run ) {
70937093 gate_ok = cbm_hook_script_write_would_succeed (home , binary_path , CMM_HOOK_GATE_SCRIPT );
70947094 session_ok =
@@ -7227,107 +7227,10 @@ static void install_agent_skill(const char *label, const char *skills_dir, bool
72277227 printf (" skill: %s (%d installed)\n" , skill_path , installed );
72287228}
72297229
7230- /* Derive tier siblings only from the exact shipped Verify basename. This keeps
7231- * vendor-specific suffixes such as .agent.md, .toml, and .json intact. */
7232- static int cbm_tiered_profile_path(const char *verify_path, cbm_graph_tier_t tier, char *output,
7233- size_t output_size) {
7234- static const char verify_basename[] = "codebase-memory";
7235- if (!verify_path || !verify_path[0] || !output || output_size == 0U) {
7236- return CLI_ERR;
7237- }
7238- const char *basename = strrchr(verify_path, '/');
7239- const char *backslash = strrchr(verify_path, '\\');
7240- if (backslash && (!basename || backslash > basename)) {
7241- basename = backslash;
7242- }
7243- basename = basename ? basename + 1U : verify_path;
7244- size_t verify_len = strlen(verify_basename);
7245- if (strncmp(basename, verify_basename, verify_len) != 0 || basename[verify_len] != '.') {
7246- return CLI_ERR;
7247- }
7248- const char *slug = cbm_graph_tier_slug(tier);
7249- if (!slug) {
7250- return CLI_ERR;
7251- }
7252- const char *suffix = basename + verify_len;
7253- size_t directory_len = (size_t)(basename - verify_path);
7254- size_t slug_len = strlen(slug);
7255- size_t suffix_len = strlen(suffix);
7256- if (directory_len >= output_size || slug_len > output_size - directory_len - 1U ||
7257- suffix_len > output_size - directory_len - slug_len - 1U) {
7258- return CLI_ERR;
7259- }
7260- memcpy(output, verify_path, directory_len);
7261- memcpy(output + directory_len, slug, slug_len);
7262- memcpy(output + directory_len + slug_len, suffix, suffix_len + 1U);
7263- return CLI_OK;
7264- }
7265-
7266- static cbm_graph_access_t cbm_tiered_profile_access(cbm_graph_profile_dialect_t dialect) {
7267- return cbm_graph_dialect_direct_capable(dialect) ? CBM_GRAPH_ACCESS_DIRECT
7268- : CBM_GRAPH_ACCESS_HANDOFF;
7269- }
7270-
7271- static cbm_graph_access_t cbm_tiered_profile_set_access(cbm_tiered_profile_set_t profiles) {
7272- return !profiles.force_handoff && cbm_graph_dialect_direct_capable(profiles.dialect)
7273- ? CBM_GRAPH_ACCESS_DIRECT
7274- : CBM_GRAPH_ACCESS_HANDOFF;
7275- }
7276-
72777230static void uninstall_tiered_agent_profiles (cbm_tiered_profile_set_t profiles , bool dry_run ) {
72787231 /* CP78: pre-CLI profile filenames are shared/ambiguous; never claim them. */
72797232 (void )profiles ;
72807233 (void )dry_run ;
7281- return;
7282- cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles);
7283- for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) {
7284- cbm_graph_tier_t tier = (cbm_graph_tier_t)value;
7285- char path[CLI_BUF_1K];
7286- if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) {
7287- record_agent_config_error(true, profiles.label, "agent_path", profiles.verify_path);
7288- continue;
7289- }
7290- if (dry_run) {
7291- printf(" %s agent: would remove owned profile %s\n", profiles.label, path);
7292- continue;
7293- }
7294- char *current =
7295- cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path);
7296- if (!current) {
7297- record_agent_config_error(true, profiles.label, "agent_render", path);
7298- continue;
7299- }
7300- cbm_graph_access_t alternate_access =
7301- access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT;
7302- char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access,
7303- profiles.binary_path);
7304- char *codex_rc1 =
7305- profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT
7306- ? cbm_render_graph_profile_codex_rc1(tier)
7307- : NULL;
7308- const char *released[3];
7309- size_t released_count = 0U;
7310- if (alternate) {
7311- released[released_count++] = alternate;
7312- }
7313- if (codex_rc1) {
7314- released[released_count++] = codex_rc1;
7315- }
7316- if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) {
7317- released[released_count++] = profiles.legacy_verify_content;
7318- }
7319- int result = cbm_text_remove_owned_document_any(path, current, released, released_count);
7320- free(codex_rc1);
7321- free(alternate);
7322- free(current);
7323- if (result < CLI_OK) {
7324- record_agent_config_error(true, profiles.label, "agent_uninstall", path);
7325- } else if (result > CLI_OK) {
7326- printf(" %s agent: preserved modified profile %s\n", profiles.label, path);
7327- } else {
7328- printf(" %s agent: removed owned profile %s\n", profiles.label, path);
7329- }
7330- }
73317234}
73327235
73337236static void uninstall_tiered_profile_prompts (const char * label , const char * verify_path ,
@@ -7339,36 +7242,6 @@ static void uninstall_tiered_profile_prompts(const char *label, const char *veri
73397242 (void )dialect ;
73407243 (void )legacy_verify_content ;
73417244 (void )dry_run ;
7342- return;
7343- cbm_graph_access_t access = cbm_tiered_profile_access(dialect);
7344- for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) {
7345- cbm_graph_tier_t tier = (cbm_graph_tier_t)value;
7346- char path[CLI_BUF_1K];
7347- if (cbm_tiered_profile_path(verify_path, tier, path, sizeof(path)) != CLI_OK) {
7348- record_agent_config_error(true, label, "prompt_path", verify_path);
7349- continue;
7350- }
7351- if (dry_run) {
7352- printf(" %s prompt: would remove owned profile %s\n", label, path);
7353- continue;
7354- }
7355- char *current = cbm_render_graph_prompt(tier, access);
7356- if (!current) {
7357- record_agent_config_error(true, label, "prompt_render", path);
7358- continue;
7359- }
7360- const char *released[] = {legacy_verify_content};
7361- size_t released_count = tier == CBM_GRAPH_TIER_VERIFY && legacy_verify_content ? 1U : 0U;
7362- int result = cbm_text_remove_owned_document_any(path, current, released, released_count);
7363- free(current);
7364- if (result < CLI_OK) {
7365- record_agent_config_error(true, label, "prompt_uninstall", path);
7366- } else if (result > CLI_OK) {
7367- printf(" %s prompt: preserved modified profile %s\n", label, path);
7368- } else {
7369- printf(" %s prompt: removed owned profile %s\n", label, path);
7370- }
7371- }
73727245}
73737246
73747247static void install_copilot_durable_context (const char * home , const char * binary_path , bool force ,
@@ -8169,11 +8042,8 @@ static void install_editor_agent_configs(const cbm_detected_agents_t *agents, co
81698042 if (!dry_run && !g_install_plan ) {
81708043 cbm_mkdir_p (sd , CLI_OCTAL_PERM );
81718044 }
8172- bool direct_profiles_ready = install_generic_agent_config("Junie", NULL, dry_run);
8045+ install_generic_agent_config ("Junie" , NULL , dry_run );
81738046 install_agent_skill ("Junie" , skills_dir , force , dry_run );
8174- if (!direct_profiles_ready && !g_install_plan) {
8175- printf(" subagents: installed parent-handoff profiles\n");
8176- }
81778047 }
81788048}
81798049
0 commit comments