From eacf2aadd7bdbd0ecf6b965427a3d20f9f912933 Mon Sep 17 00:00:00 2001 From: Arthur d'Avray Date: Thu, 4 Jun 2026 14:05:06 +0200 Subject: [PATCH] refactor: use fetch instead of search for the setup connectivity check --- src/commands/setup.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commands/setup.ts b/src/commands/setup.ts index d24e4a5..e8596a2 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -1,5 +1,4 @@ import type { Command } from 'commander'; -import { LinkupClient } from 'linkup-sdk'; import { getConfigPath, saveApiKey, validateApiKey } from '../config'; import { exitWithCode, exitWithError, formatError } from '../output/errors'; @@ -43,9 +42,11 @@ async function runSetup(): Promise { console.log('\nStep 3: Test connection'); try { - const client = new LinkupClient({ apiKey }); - await client.search({ depth: 'fast', outputType: 'searchResults', query: 'test' }); - console.log('Connected to Linkup API'); + const response = await fetch(SETUP_URL); + if (!response.ok) { + throw new Error(`Linkup website returned ${response.status} ${response.statusText}`); + } + console.log('Connected to Linkup website'); } catch (error) { console.error(`Warning: connection test failed: ${formatError(error)}`); console.error('Your API key was saved. You can test it with \'linkup search "hello"\'');