MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_build_copilot_hook_command

Function cbm_build_copilot_hook_command

src/cli/cli.c:3693–3710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3691enum { COPILOT_HOOK_TIMEOUT_SEC = 5 };
3692
3693static int cbm_build_copilot_hook_command(const char *binary_path, const char *event,
3694 bool powershell, char *out, size_t out_size) {
3695 if (!binary_path || !event || !out ||
3696 (strcmp(event, "SessionStart") != 0 && strcmp(event, "SubagentStart") != 0)) {
3697 return CLI_ERR;
3698 }
3699 char quoted[CLI_BUF_8K];
3700 int quote_rc = powershell ? cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted))
3701 : cbm_shell_quote_word(binary_path, quoted, sizeof(quoted));
3702 if (quote_rc != CLI_OK) {
3703 return CLI_ERR;
3704 }
3705 int written = snprintf(out, out_size,
3706 powershell ? "& %s hook-augment --event %s --dialect copilot"
3707 : "%s hook-augment --event %s --dialect copilot",
3708 quoted, event);
3709 return written > 0 && (size_t)written < out_size ? CLI_OK : CLI_ERR;
3710}
3711
3712static bool cbm_copilot_add_hook_event(yyjson_mut_doc *doc, yyjson_mut_val *hooks,
3713 const char *event_key, const char *bash_command,

Callers 1

Calls 2

cbm_shell_quote_wordFunction · 0.85

Tested by

no test coverage detected