MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_replace_binary

Function cbm_replace_binary

src/cli/cli.c:1448–1466  ·  view source on GitHub ↗

Replace a binary transactionally, retaining the old target until the exact * staged bytes have been published and validated. */

Source from the content-addressed store, hash-verified

1446/* Replace a binary transactionally, retaining the old target until the exact
1447 * staged bytes have been published and validated. */
1448int cbm_replace_binary(const char *path, const unsigned char *data, int len, int mode) {
1449 if (!path || !data || len <= 0) {
1450 return CLI_ERR;
1451 }
1452 cbm_activation_transaction_t *transaction = NULL;
1453 cbm_activation_transaction_status_t status =
1454 cbm_activation_transaction_stage_bytes(path, data, (size_t)len, &transaction);
1455 cli_binary_validator_t validator;
1456 if (status != CBM_ACTIVATION_TRANSACTION_OK || !transaction ||
1457 !cli_activation_transaction_expected_build(transaction, &validator)) {
1458 (void)cli_activation_transaction_abort(&transaction);
1459 return CLI_ERR;
1460 }
1461 if (cli_activation_transaction_commit_validated(transaction, &validator, mode) != CLI_OK) {
1462 (void)cli_activation_transaction_abort(&transaction);
1463 return CLI_ERR;
1464 }
1465 return cli_activation_transaction_finalize_close(&transaction);
1466}
1467
1468/* ── Skill file content (embedded) ────────────────────────────── */
1469

Callers 1

test_cli.cFile · 0.85

Tested by

no test coverage detected