| 4750 | } |
| 4751 | |
| 4752 | static int cbm_build_augment_coverage_script(const char *binary_path, char *script, |
| 4753 | size_t script_size) { |
| 4754 | if (!binary_path || !script || script_size == 0U) { |
| 4755 | return CLI_ERR; |
| 4756 | } |
| 4757 | char quoted[CLI_BUF_8K]; |
| 4758 | #ifdef _WIN32 |
| 4759 | if (cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 4760 | return CLI_ERR; |
| 4761 | } |
| 4762 | int written = snprintf(script, script_size, |
| 4763 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 4764 | "$bin = %s\n" |
| 4765 | "if (-not (Test-Path -LiteralPath $bin -PathType Leaf)) { exit 0 }\n" |
| 4766 | "& $bin hook-augment --dialect augment 2>$null\n" |
| 4767 | "exit 0\n", |
| 4768 | quoted); |
| 4769 | #else |
| 4770 | if (cbm_shell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 4771 | return CLI_ERR; |
| 4772 | } |
| 4773 | int written = snprintf(script, script_size, |
| 4774 | "#!/bin/sh\n" |
| 4775 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 4776 | "BIN=%s\n" |
| 4777 | "[ -x \"$BIN\" ] || exit 0\n" |
| 4778 | "exec \"$BIN\" hook-augment --dialect augment 2>/dev/null\n", |
| 4779 | quoted); |
| 4780 | #endif |
| 4781 | return written > 0 && (size_t)written < script_size ? CLI_OK : CLI_ERR; |
| 4782 | } |
| 4783 | |
| 4784 | static bool cbm_install_augment_coverage_script(const char *binary_path, const char *script_path) { |
| 4785 | char script[CLI_BUF_8K]; |
no test coverage detected