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

Function cbm_replace_binary

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

1250/* Replace a binary transactionally, retaining the old target until the exact
1251 * staged bytes have been published and validated. */
1252int cbm_replace_binary(const char *path, const unsigned char *data, int len, int mode) {
1253 if (!path || !data || len <= 0) {
1254 return CLI_ERR;
1255 }
1256 cbm_activation_transaction_t *transaction = NULL;
1257 cbm_activation_transaction_status_t status =
1258 cbm_activation_transaction_stage_bytes(path, data, (size_t)len, &transaction);
1259 cli_binary_validator_t validator;
1260 if (status != CBM_ACTIVATION_TRANSACTION_OK || !transaction ||
1261 !cli_activation_transaction_expected_build(transaction, &validator)) {
1262 (void)cli_activation_transaction_abort(&transaction);
1263 return CLI_ERR;
1264 }
1265 if (cli_activation_transaction_commit_validated(transaction, &validator, mode) != CLI_OK) {
1266 (void)cli_activation_transaction_abort(&transaction);
1267 return CLI_ERR;
1268 }
1269 return cli_activation_transaction_finalize_close(&transaction);
1270}
1271
1272/* ── Skill file content (embedded) ────────────────────────────── */
1273

Callers 1

test_cli.cFile · 0.85

Tested by

no test coverage detected