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

Function cbm_install_prepare_existing_indexes

src/cli/cli.c:9072–9104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9070 */
9071int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run);
9072static int cbm_install_prepare_existing_indexes(const char *home, bool reset, bool dry_run,
9073 bool *delete_indexes_out) {
9074 if (delete_indexes_out) {
9075 *delete_indexes_out = false;
9076 }
9077 int index_count = count_db_indexes(home);
9078 if (index_count <= 0) {
9079 return 1; /* nothing to handle, proceed */
9080 }
9081
9082 if (!reset) {
9083 /* Default: preserve. Be honest — keep the indexes, advise re-index. */
9084 printf("Found %d existing index(es). Keeping them. After install, "
9085 "re-index to pick up this version's improvements:\n",
9086 index_count);
9087 cbm_list_indexes(home);
9088 printf("\n");
9089 return 1; /* proceed without deleting */
9090 }
9091
9092 /* Opt-in reset (--reset-indexes): the original prompt-and-delete path. */
9093 printf("Found %d existing index(es):\n", index_count);
9094 cbm_list_indexes(home);
9095 printf("\n");
9096 if (!prompt_yn("Delete these indexes and continue with install?")) {
9097 printf("Install cancelled.\n");
9098 return 0; /* abort */
9099 }
9100 if (!dry_run && delete_indexes_out) {
9101 *delete_indexes_out = true;
9102 }
9103 return 1; /* proceed */
9104}
9105
9106int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run) {
9107 bool delete_indexes = false;

Callers 2

cbm_cmd_installFunction · 0.85

Calls 3

count_db_indexesFunction · 0.85
cbm_list_indexesFunction · 0.85
prompt_ynFunction · 0.85

Tested by

no test coverage detected