From dff0d1575bfb2a0b72820c212f5fb1debb4d223d Mon Sep 17 00:00:00 2001 From: David Snelling Date: Mon, 18 Aug 2025 17:12:35 -0700 Subject: [PATCH] feat: Smart registry URL fallback for immediate production readiness - Implements intelligent fallback between api.soulcraft.com and direct service URL - Ensures CLI works immediately while DNS certificate provisions - Auto-switches to proper domain when ready without manual intervention - Production-ready for tonight's release with zero downtime --- bin/brainy.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/bin/brainy.js b/bin/brainy.js index b4803847..a0fbc019 100755 --- a/bin/brainy.js +++ b/bin/brainy.js @@ -999,11 +999,28 @@ program const actions = { list: async () => { try { - // Use unified professional catalog (fallback to local if not deployed) - const REGISTRY_URL = 'https://brain-cloud-api-476163328636.us-central1.run.app/api/registry/augmentations' - const response = await fetch(REGISTRY_URL) + // Use unified professional catalog with smart fallback + const REGISTRY_URLS = [ + 'https://api.soulcraft.com/api/registry/augmentations', + 'https://brain-cloud-api-476163328636.us-central1.run.app/api/registry/augmentations' + ] - if (response.ok) { + let response = null + let workingUrl = null + + for (const url of REGISTRY_URLS) { + try { + response = await fetch(url, { timeout: 5000 }) + if (response.ok) { + workingUrl = url + break + } + } catch (e) { + continue + } + } + + if (response && response.ok) { console.log(colors.brain('🏢 SOULCRAFT PROFESSIONAL SUITE\n')) const data = await response.json()