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

Function cbm_install_handle_existing_indexes

src/cli/cli.c:3610–3639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3608 */
3609int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run);
3610int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run) {
3611 int index_count = count_db_indexes(home);
3612 if (index_count <= 0) {
3613 return 1; /* nothing to handle, proceed */
3614 }
3615
3616 if (!reset) {
3617 /* Default: preserve. Be honest — keep the indexes, advise re-index. */
3618 printf("Found %d existing index(es). Keeping them. After install, "
3619 "re-index to pick up this version's improvements:\n",
3620 index_count);
3621 cbm_list_indexes(home);
3622 printf("\n");
3623 return 1; /* proceed without deleting */
3624 }
3625
3626 /* Opt-in reset (--reset-indexes): the original prompt-and-delete path. */
3627 printf("Found %d existing index(es):\n", index_count);
3628 cbm_list_indexes(home);
3629 printf("\n");
3630 if (!prompt_yn("Delete these indexes and continue with install?")) {
3631 printf("Install cancelled.\n");
3632 return 0; /* abort */
3633 }
3634 if (!dry_run) {
3635 int removed = cbm_remove_indexes(home);
3636 printf("Removed %d index(es).\n\n", removed);
3637 }
3638 return 1; /* proceed */
3639}
3640
3641/* ── Subcommand: install ──────────────────────────────────────── */
3642

Callers 2

cbm_cmd_installFunction · 0.85
repro_issue607.cFile · 0.85

Calls 4

count_db_indexesFunction · 0.85
cbm_list_indexesFunction · 0.85
prompt_ynFunction · 0.85
cbm_remove_indexesFunction · 0.85

Tested by

no test coverage detected