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