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

Function config_index_policy_write

src/cli/cli.c:7636–7654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7634}
7635
7636static int config_index_policy_write(cbm_config_t *config, const char *key, const char *value) {
7637 cbm_index_resource_policy_t candidate;
7638 cbm_index_policy_init(&candidate);
7639 char error[CLI_BUF_256];
7640 if (!cbm_index_policy_set(&candidate, key, value, error, sizeof(error))) {
7641 (void)fprintf(stderr, "error: %s\n", error);
7642 return CLI_ERR;
7643 }
7644 int rc = cbm_config_set(config, key, value);
7645 if (rc != 0) {
7646 /* The caller suppresses its own message for policy keys because this
7647 * helper names the precise reason. That is only true if the helper
7648 * speaks on every failure it can return: a validated value whose write
7649 * then fails -- a locked or read-only _config.db -- used to exit
7650 * non-zero having printed nothing at all. */
7651 (void)fprintf(stderr, "error: failed to set %s\n", key);
7652 }
7653 return rc;
7654}
7655
7656static void config_ui_read(const char *key, char *out, size_t out_sz) {
7657 cbm_ui_config_t ui;

Callers 1

cbm_cmd_configFunction · 0.85

Calls 3

cbm_index_policy_initFunction · 0.85
cbm_index_policy_setFunction · 0.85
cbm_config_setFunction · 0.85

Tested by

no test coverage detected