| 5572 | } |
| 5573 | |
| 5574 | static int cbm_build_augment_coverage_script(const char *binary_path, char *script, |
| 5575 | size_t script_size) { |
| 5576 | if (!binary_path || !script || script_size == 0U) { |
| 5577 | return CLI_ERR; |
| 5578 | } |
| 5579 | char quoted[CLI_BUF_8K]; |
| 5580 | #ifdef _WIN32 |
| 5581 | if (cbm_powershell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 5582 | return CLI_ERR; |
| 5583 | } |
| 5584 | int written = snprintf(script, script_size, |
| 5585 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 5586 | "$bin = %s\n" |
| 5587 | "if (-not (Test-Path -LiteralPath $bin -PathType Leaf)) { exit 0 }\n" |
| 5588 | "& $bin hook-augment --dialect augment 2>$null\n" |
| 5589 | "exit 0\n", |
| 5590 | quoted); |
| 5591 | #else |
| 5592 | if (cbm_shell_quote_word(binary_path, quoted, sizeof(quoted)) != CLI_OK) { |
| 5593 | return CLI_ERR; |
| 5594 | } |
| 5595 | int written = snprintf(script, script_size, |
| 5596 | "#!/bin/sh\n" |
| 5597 | "# PostToolUse view adapter installed by codebase-memory-mcp.\n" |
| 5598 | "BIN=%s\n" |
| 5599 | "[ -x \"$BIN\" ] || exit 0\n" |
| 5600 | "exec \"$BIN\" hook-augment --dialect augment 2>/dev/null\n", |
| 5601 | quoted); |
| 5602 | #endif |
| 5603 | return written > 0 && (size_t)written < script_size ? CLI_OK : CLI_ERR; |
| 5604 | } |
| 5605 | |
| 5606 | static bool cbm_install_augment_coverage_script(const char *binary_path, const char *script_path) { |
| 5607 | char script[CLI_BUF_8K]; |
no test coverage detected