Skip to content

Commit 414f667

Browse files
committed
refactor: use positive enableSemanticSearch naming internally
Rename noSemanticSearch to enableSemanticSearch in primitive options and hoist initialSelectedIds array to module-level constant to avoid new reference on every render.
1 parent 5ee649f commit 414f667

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/cli/primitives/GatewayPrimitive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface AddGatewayOptions {
2626
agentClientId?: string;
2727
agentClientSecret?: string;
2828
agents?: string;
29-
noSemanticSearch?: boolean;
29+
enableSemanticSearch?: boolean;
3030
}
3131

3232
/**
@@ -188,7 +188,7 @@ export class GatewayPrimitive extends BasePrimitive<AddGatewayOptions, Removable
188188
agentClientId: cliOptions.agentClientId,
189189
agentClientSecret: cliOptions.agentClientSecret,
190190
agents: cliOptions.agents,
191-
noSemanticSearch: cliOptions.semanticSearch === false,
191+
enableSemanticSearch: cliOptions.semanticSearch !== false,
192192
});
193193

194194
if (cliOptions.json) {
@@ -285,7 +285,7 @@ export class GatewayPrimitive extends BasePrimitive<AddGatewayOptions, Removable
285285
description: options.description ?? `Gateway for ${options.name}`,
286286
authorizerType: options.authorizerType,
287287
jwtConfig: undefined,
288-
enableSemanticSearch: !options.noSemanticSearch,
288+
enableSemanticSearch: options.enableSemanticSearch ?? true,
289289
};
290290

291291
if (options.authorizerType === 'CUSTOM_JWT' && options.discoveryUrl) {

src/cli/tui/hooks/useCreateMcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function useCreateGateway() {
2828
allowedScopes: config.jwtConfig?.allowedScopes?.join(','),
2929
agentClientId: config.jwtConfig?.agentClientId,
3030
agentClientSecret: config.jwtConfig?.agentClientSecret,
31-
noSemanticSearch: !config.enableSemanticSearch,
31+
enableSemanticSearch: config.enableSemanticSearch,
3232
});
3333
if (!addResult.success) {
3434
throw new Error(addResult.error ?? 'Failed to create gateway');

src/cli/tui/screens/mcp/AddGatewayScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ interface AddGatewayScreenProps {
2727
unassignedTargets: string[];
2828
}
2929

30+
const INITIAL_ADVANCED_SELECTED = [SEMANTIC_SEARCH_ITEM_ID];
31+
3032
export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassignedTargets }: AddGatewayScreenProps) {
3133
const wizard = useAddGatewayWizard(unassignedTargets.length);
3234

@@ -79,7 +81,7 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
7981
const advancedNav = useMultiSelectNavigation({
8082
items: advancedConfigItems,
8183
getId: item => item.id,
82-
initialSelectedIds: [SEMANTIC_SEARCH_ITEM_ID],
84+
initialSelectedIds: INITIAL_ADVANCED_SELECTED,
8385
onConfirm: selectedIds =>
8486
wizard.setAdvancedConfig({ enableSemanticSearch: selectedIds.includes(SEMANTIC_SEARCH_ITEM_ID) }),
8587
onExit: () => wizard.goBack(),

0 commit comments

Comments
 (0)