| 8852 | } |
| 8853 | |
| 8854 | static void install_copilot_durable_context(const char *home, const char *binary_path, bool force, |
| 8855 | bool dry_run) { |
| 8856 | char config_dir[CLI_BUF_1K]; |
| 8857 | char hooks_dir[CLI_BUF_1K]; |
| 8858 | char hook_path[CLI_BUF_1K]; |
| 8859 | char skills_dir[CLI_BUF_1K]; |
| 8860 | char agent_path[CLI_BUF_1K]; |
| 8861 | cbm_copilot_config_dir(home, config_dir, sizeof(config_dir)); |
| 8862 | snprintf(hooks_dir, sizeof(hooks_dir), "%s/hooks", config_dir); |
| 8863 | snprintf(hook_path, sizeof(hook_path), "%s/hooks/codebase-memory-mcp.json", config_dir); |
| 8864 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 8865 | snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.agent.md", config_dir); |
| 8866 | install_agent_skill("Copilot", skills_dir, force, dry_run); |
| 8867 | install_tiered_agent_profiles( |
| 8868 | (cbm_tiered_profile_set_t){ |
| 8869 | .label = "Copilot", |
| 8870 | .verify_path = agent_path, |
| 8871 | .binary_path = binary_path, |
| 8872 | .legacy_verify_content = legacy_copilot_verify_agent_content, |
| 8873 | .dialect = CBM_GRAPH_DIALECT_COPILOT, |
| 8874 | }, |
| 8875 | dry_run); |
| 8876 | if (g_install_plan) { |
| 8877 | plan_record("Copilot", "hook", hook_path); |
| 8878 | return; |
| 8879 | } |
| 8880 | bool hook_ok = true; |
| 8881 | if (!dry_run && (!cbm_mkdir_p_ex(hooks_dir, CLI_OCTAL_PERM, CBM_MKDIR_FOLLOW_OWNED) || |
| 8882 | cbm_upsert_copilot_hooks(binary_path, hook_path) != CLI_OK)) { |
| 8883 | hook_ok = false; |
| 8884 | record_agent_config_error(false, "Copilot", "lifecycle_hook_install", hook_path); |
| 8885 | } |
| 8886 | if (hook_ok) { |
| 8887 | printf(" hooks: SessionStart + SubagentStart (dynamic graph context)\n"); |
| 8888 | } |
| 8889 | } |
| 8890 | |
| 8891 | static bool cbm_omp_agent_dir(const char *home_dir, char *out, size_t out_sz) { |
| 8892 | char profile_buf[CLI_BUF_256]; |
no test coverage detected