| 4976 | } |
| 4977 | |
| 4978 | static int cbm_build_augment_coverage_script(const char *binary_path, char *script, |
| 4979 | size_t script_size) { |
| 4980 | if (!binary_path || !script || script_size == 0U) { |
| 4981 | return CLI_ERR; |
| 4982 | } |
| 4983 | char quoted[CLI_BUF_8K]; |
| 4984 | #ifdef _WIN32 |
| 4985 | if (cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 4986 | return CLI_ERR; |
| 4987 | } |
| 4988 | int written = snprintf(script, script_size, |
| 4989 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 4990 | "$bin = %s\n" |
| 4991 | "if (-not (Test-Path -LiteralPath $bin -PathType Leaf)) { exit 0 }\n" |
| 4992 | "& $bin hook-augment --dialect augment 2>$null\n" |
| 4993 | "exit 0\n", |
| 4994 | quoted); |
| 4995 | #else |
| 4996 | if (cbm_shell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 4997 | return CLI_ERR; |
| 4998 | } |
| 4999 | int written = snprintf(script, script_size, |
| 5000 | "#!/bin/sh\n" |
| 5001 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 5002 | "BIN=%s\n" |
| 5003 | "[ -x \"$BIN\" ] || exit 0\n" |
| 5004 | "exec \"$BIN\" hook-augment --dialect augment 2>/dev/null\n", |
| 5005 | quoted); |
| 5006 | #endif |
| 5007 | return written > 0 && (size_t)written < script_size ? CLI_OK : CLI_ERR; |
| 5008 | } |
| 5009 | |
| 5010 | static bool cbm_install_augment_coverage_script(const char *binary_path, const char *script_path) { |
| 5011 | char script[CLI_BUF_8K]; |
no test coverage detected