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:5626–5653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5624}
5625
5626static int cbm_build_cline_context_script(const char *binary_path, const char *event, char *script,
5627 size_t script_size) {
5628 char quoted[CLI_BUF_8K];
5629#ifdef _WIN32
5630 if (cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) {
5631 return CLI_ERR;
5632 }
5633 int written = snprintf(script, script_size,
5634 "# Cline %s context adapter installed by codebase-memory-mcp.\n"
5635 "$bin = %s\n"
5636 "if (-not (Test-Path -LiteralPath $bin -PathType Leaf)) { exit 0 }\n"
5637 "& $bin hook-augment --dialect cline --event %s 2>$null\n"
5638 "exit 0\n",
5639 event, quoted, event);
5640#else
5641 if (cbm_shell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) {
5642 return CLI_ERR;
5643 }
5644 int written = snprintf(script, script_size,
5645 "#!/bin/sh\n"
5646 "# Cline %s context adapter installed by codebase-memory-mcp.\n"
5647 "BIN=%s\n"
5648 "[ -x \"$BIN\" ] || exit 0\n"
5649 "exec \"$BIN\" hook-augment --dialect cline --event %s 2>/dev/null\n",
5650 event, quoted, event);
5651#endif
5652 return written > 0 && (size_t)written < script_size ? CLI_OK : CLI_ERR;
5653}
5654
5655static const char cmm_gate_script_prefix[] =
5656 "#!/usr/bin/env bash\n"

Callers 1

Calls 2

cbm_shell_quote_wordFunction · 0.85

Tested by

no test coverage detected