From ea609c42d3c3732bb2b5f72b66ff2f6996c5189f Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 14 Jul 2025 15:29:38 +0000 Subject: [PATCH] fix: Use random slugs to avoid conflicts in simple-organization-setup - Restored random suffix for slugs to prevent conflicts - Added fallback to 'replica' prefix for edge cases like single digit names - Keeps matching existing replicas by name (not slug) - Ensures slugs are always valid even for short names like '1' --- src/commands/simple-organization-setup.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/simple-organization-setup.ts b/src/commands/simple-organization-setup.ts index e5ef6a5..57f3961 100644 --- a/src/commands/simple-organization-setup.ts +++ b/src/commands/simple-organization-setup.ts @@ -243,9 +243,11 @@ export async function simpleOrganizationSetupCommand(folderPath?: string, option replica = await ReplicasService.getV1Replicas1(existingReplica.uuid); replicaSpinner.succeed(`Updated existing replica: ${replica.name} (model: ${replicaFolder.modelName})`); } else { - // Create new replica with folder name as slug + // Create new replica with random slug to avoid conflicts replicaSpinner.text = `Creating new replica: ${replicaFolder.name}...`; - const slug = replicaFolder.name.toLowerCase().replace(/[^a-z0-9]/g, '-'); + const randomSuffix = Math.random().toString(36).substr(2, 9); + const baseSlug = replicaFolder.name.toLowerCase().replace(/[^a-z0-9]/g, '-') || 'replica'; + const slug = `${baseSlug}-${randomSuffix}`; const replicaCreateResponse = await ReplicasService.postV1Replicas('2025-03-25', { name: replicaFolder.name,