| 7842 | } |
| 7843 | |
| 7844 | static void install_copilot_durable_context(const char *home, const char *binary_path, bool force, |
| 7845 | bool dry_run) { |
| 7846 | char config_dir[CLI_BUF_1K]; |
| 7847 | char hooks_dir[CLI_BUF_1K]; |
| 7848 | char hook_path[CLI_BUF_1K]; |
| 7849 | char skills_dir[CLI_BUF_1K]; |
| 7850 | char agent_path[CLI_BUF_1K]; |
| 7851 | cbm_copilot_config_dir(home, config_dir, sizeof(config_dir)); |
| 7852 | snprintf(hooks_dir, sizeof(hooks_dir), "%s/hooks", config_dir); |
| 7853 | snprintf(hook_path, sizeof(hook_path), "%s/hooks/codebase-memory-mcp.json", config_dir); |
| 7854 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 7855 | snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.agent.md", config_dir); |
| 7856 | install_agent_skill("Copilot", skills_dir, force, dry_run); |
| 7857 | install_tiered_agent_profiles( |
| 7858 | (cbm_tiered_profile_set_t){ |
| 7859 | .label = "Copilot", |
| 7860 | .verify_path = agent_path, |
| 7861 | .binary_path = binary_path, |
| 7862 | .legacy_verify_content = legacy_copilot_verify_agent_content, |
| 7863 | .dialect = CBM_GRAPH_DIALECT_COPILOT, |
| 7864 | }, |
| 7865 | dry_run); |
| 7866 | if (g_install_plan) { |
| 7867 | plan_record("Copilot", "hook", hook_path); |
| 7868 | return; |
| 7869 | } |
| 7870 | bool hook_ok = true; |
| 7871 | if (!dry_run && (!cbm_mkdir_p(hooks_dir, CLI_OCTAL_PERM) || |
| 7872 | cbm_upsert_copilot_hooks(binary_path, hook_path) != CLI_OK)) { |
| 7873 | hook_ok = false; |
| 7874 | record_agent_config_error(false, "Copilot", "lifecycle_hook_install", hook_path); |
| 7875 | } |
| 7876 | if (hook_ok) { |
| 7877 | printf(" hooks: SessionStart + SubagentStart (dynamic graph context)\n"); |
| 7878 | } |
| 7879 | } |
| 7880 | |
| 7881 | typedef struct { |
| 7882 | cbm_agent_client_resolve_options_t options; |
no test coverage detected