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

Function cbm_replace_binary

src/cli/cli.c:1207–1225  ·  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

1205/* Replace a binary transactionally, retaining the old target until the exact
1206 * staged bytes have been published and validated. */
1207int cbm_replace_binary(const char *path, const unsigned char *data, int len, int mode) {
1208 if (!path || !data || len <= 0) {
1209 return CLI_ERR;
1210 }
1211 cbm_activation_transaction_t *transaction = NULL;
1212 cbm_activation_transaction_status_t status =
1213 cbm_activation_transaction_stage_bytes(path, data, (size_t)len, &transaction);
1214 cli_binary_validator_t validator;
1215 if (status != CBM_ACTIVATION_TRANSACTION_OK || !transaction ||
1216 !cli_activation_transaction_expected_build(transaction, &validator)) {
1217 (void)cli_activation_transaction_abort(&transaction);
1218 return CLI_ERR;
1219 }
1220 if (cli_activation_transaction_commit_validated(transaction, &validator, mode) != CLI_OK) {
1221 (void)cli_activation_transaction_abort(&transaction);
1222 return CLI_ERR;
1223 }
1224 return cli_activation_transaction_finalize_close(&transaction);
1225}
1226
1227/* ── Skill file content (embedded) ────────────────────────────── */
1228

Callers 1

test_cli.cFile · 0.85

Tested by

no test coverage detected