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

Function cbm_build_cline_context_script

src/cli/cli.c:4866–4893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4864}
4865
4866static int cbm_build_cline_context_script(const char *binary_path, const char *event, char *script,
4867 size_t script_size) {
4868 char quoted[CLI_BUF_8K];
4869#ifdef _WIN32
4870 if (cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) {
4871 return CLI_ERR;
4872 }
4873 int written = snprintf(script, script_size,
4874 "# Cline %s context adapter installed by codebase-memory-mcp.\n"
4875 "$bin = %s\n"
4876 "if (-not (Test-Path -LiteralPath $bin -PathType Leaf)) { exit 0 }\n"
4877 "& $bin hook-augment --dialect cline --event %s 2>$null\n"
4878 "exit 0\n",
4879 event, quoted, event);
4880#else
4881 if (cbm_shell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) {
4882 return CLI_ERR;
4883 }
4884 int written = snprintf(script, script_size,
4885 "#!/bin/sh\n"
4886 "# Cline %s context adapter installed by codebase-memory-mcp.\n"
4887 "BIN=%s\n"
4888 "[ -x \"$BIN\" ] || exit 0\n"
4889 "exec \"$BIN\" hook-augment --dialect cline --event %s 2>/dev/null\n",
4890 event, quoted, event);
4891#endif
4892 return written > 0 && (size_t)written < script_size ? CLI_OK : CLI_ERR;
4893}
4894
4895static const char cmm_gate_script_prefix[] =
4896 "#!/usr/bin/env bash\n"

Callers 1

Calls 2

cbm_shell_quote_wordFunction · 0.85

Tested by

no test coverage detected