From 1858d959cf3e2ac8c2acd104caf736bdef22915b Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Tue, 27 May 2025 22:16:49 -0700 Subject: [PATCH] feat: Add cleanup-duplicates option to scripts CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added --cleanup-duplicates argument to scripts/graph_sync.py - Added cleanup operation execution in the CLI flow - Updated help examples to include cleanup usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/graph_sync.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/graph_sync.py b/scripts/graph_sync.py index a3c9897..dbf1659 100755 --- a/scripts/graph_sync.py +++ b/scripts/graph_sync.py @@ -39,6 +39,9 @@ Examples: # Sync only concepts python scripts/graph_sync.py --sync-collection me.comind.concept + # Clean up duplicate concept nodes + python scripts/graph_sync.py --cleanup-duplicates + # Get concept network for "distributed systems" python scripts/graph_sync.py --concept-network "distributed systems" @@ -69,6 +72,8 @@ Examples: help="Sync specific collection (e.g., me.comind.concept)") parser.add_argument("--include-external", action="store_true", help="Include external collections like posts when syncing all") + parser.add_argument("--cleanup-duplicates", action="store_true", + help="Clean up duplicate concept nodes in the database") # Query operations parser.add_argument("--concept-network", type=str, @@ -107,6 +112,12 @@ Examples: sync_service.setup_schema() logger.info("Schema setup complete") + # Cleanup operations + if args.cleanup_duplicates: + logger.info("Cleaning up duplicate concept nodes...") + cleanup_count = sync_service.cleanup_duplicate_concept_nodes() + logger.info(f"Cleanup complete. Removed {cleanup_count} duplicate nodes") + # Sync operations if args.sync_all: logger.info("Starting full sync...") -- 2.51.2