Skip to content

Commit 35cce5a

Browse files
committed
feat: wire existing-endpoint flow for gateway targets
1 parent 3f92a52 commit 35cce5a

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/cli/commands/add/actions.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import {
2323
createCredential,
2424
resolveCredentialStrategy,
2525
} from '../../operations/identity/create-identity';
26-
import { createGatewayFromWizard, createToolFromWizard } from '../../operations/mcp/create-mcp';
26+
import {
27+
createExternalGatewayTarget,
28+
createGatewayFromWizard,
29+
createToolFromWizard,
30+
} from '../../operations/mcp/create-mcp';
2731
import { createMemory } from '../../operations/memory/create-memory';
2832
import { createRenderer } from '../../templates';
2933
import type { MemoryOption } from '../../tui/screens/generate/types';
@@ -334,6 +338,10 @@ export async function handleAddGatewayTarget(
334338
}
335339

336340
const config = buildGatewayTargetConfig(options);
341+
if (config.source === 'existing-endpoint') {
342+
const result = await createExternalGatewayTarget(config);
343+
return { success: true, toolName: result.toolName };
344+
}
337345
const result = await createToolFromWizard(config);
338346
return { success: true, toolName: result.toolName, sourcePath: result.projectPath };
339347
} catch (err) {

src/cli/commands/add/validate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ export async function validateAddGatewayTargetOptions(options: AddGatewayTargetO
198198
}
199199

200200
if (options.source === 'existing-endpoint') {
201+
if (options.host) {
202+
return { valid: false, error: '--host is not applicable for existing endpoint targets' };
203+
}
201204
if (!options.endpoint) {
202205
return { valid: false, error: '--endpoint is required when source is existing-endpoint' };
203206
}

src/cli/tui/screens/mcp/useAddGatewayTargetWizard.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import { useCallback, useMemo, useState } from 'react';
77
/**
88
* Dynamic steps based on source.
99
* - Existing endpoint: name → source → endpoint → gateway → confirm
10-
* - Create new: name → source → language → gateway → host → confirm
10+
* - Create new: name → source → language → gateway → confirm
1111
*/
1212
function getSteps(source?: 'existing-endpoint' | 'create-new'): AddGatewayTargetStep[] {
1313
if (source === 'existing-endpoint') {
1414
return ['name', 'source', 'endpoint', 'gateway', 'confirm'];
1515
}
16-
return ['name', 'source', 'language', 'gateway', 'host', 'confirm'];
16+
return ['name', 'source', 'language', 'gateway', 'confirm'];
1717
}
1818

1919
function deriveToolDefinition(name: string): ToolDefinition {
@@ -91,13 +91,8 @@ export function useAddGatewayTargetWizard(existingGateways: string[] = []) {
9191

9292
const setGateway = useCallback((gateway: string) => {
9393
setConfig(c => {
94-
const isExternal = c.source === 'existing-endpoint';
9594
const isSkipped = gateway === SKIP_FOR_NOW;
96-
if (isExternal || isSkipped) {
97-
setStep('confirm');
98-
} else {
99-
setStep('host');
100-
}
95+
setStep('confirm');
10196
return { ...c, gateway: isSkipped ? undefined : gateway };
10297
});
10398
}, []);

0 commit comments

Comments
 (0)