Skip to content

Commit 8f44713

Browse files
authored
fix(tui): remove dead PlaceholderScreen and fix gateway wizard UX (#597)
- Remove unreachable PlaceholderScreen route and component (dead code) - Add exitEnabled={false} to gateway wizard Screen to prevent accidental Escape exit mid-flow - Show friendly authorizer name in confirm review instead of raw enum - Update output key comment to document hash suffix pattern
1 parent bf1406c commit 8f44713

5 files changed

Lines changed: 11 additions & 31 deletions

File tree

src/cli/cloudformation/outputs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function parseGatewayOutputs(
5454
const gatewayNames = Object.keys(gatewaySpecs);
5555
const gatewayIdMap = new Map(gatewayNames.map(name => [toPascalId(name), name]));
5656

57-
// Match pattern: Gateway{Name}{Type}Output
57+
// Match pattern: Gateway{Name}{Type}Output{Hash}
5858
const outputPattern = /^Gateway(.+?)(Id|Arn|Url)Output/;
5959

6060
for (const [key, value] of Object.entries(outputs)) {

src/cli/tui/App.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getWorkingDirectory } from '../../lib';
22
import { createProgram } from '../cli';
33
import { LayoutProvider } from './context';
44
import { MissingProjectMessage, WrongDirectoryMessage, getProjectRootMismatch, projectExists } from './guards';
5-
import { PlaceholderScreen } from './screens/PlaceholderScreen';
65
import { AddFlow } from './screens/add/AddFlow';
76
import { CreateScreen } from './screens/create';
87
import { DeployScreen } from './screens/deploy/DeployScreen';
@@ -17,7 +16,7 @@ import { RunEvalFlow, RunScreen } from './screens/run-eval';
1716
import { StatusScreen } from './screens/status/StatusScreen';
1817
import { UpdateScreen } from './screens/update';
1918
import { ValidateScreen } from './screens/validate';
20-
import { type CommandMeta, getCommandsForUI } from './utils/commands';
19+
import { getCommandsForUI } from './utils/commands';
2120
import { useApp } from 'ink';
2221
import React, { useState } from 'react';
2322

@@ -27,7 +26,6 @@ const cwd = getWorkingDirectory();
2726
type Route =
2827
| { name: 'home' }
2928
| { name: 'help'; initialQuery?: string }
30-
| { name: 'command'; command: CommandMeta }
3129
| { name: 'dev' }
3230
| { name: 'deploy' }
3331
| { name: 'invoke' }
@@ -102,8 +100,6 @@ function AppContent() {
102100
setRoute({ name: 'package' });
103101
} else if (id === 'update') {
104102
setRoute({ name: 'update' });
105-
} else {
106-
setRoute({ name: 'command', command: cmd });
107103
}
108104
};
109105

@@ -243,7 +239,8 @@ function AppContent() {
243239
return <UpdateScreen isInteractive={true} onExit={() => setRoute({ name: 'help' })} />;
244240
}
245241

246-
return <PlaceholderScreen command={route.command} onBack={() => setRoute({ name: 'help' })} />;
242+
// All visible commands are handled above; this is unreachable.
243+
return null;
247244
}
248245

249246
export function App() {

src/cli/tui/screens/PlaceholderScreen.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/cli/tui/screens/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { PlaceholderScreen } from './PlaceholderScreen';
21
export { DevScreen } from './dev';
32
export { InvokeScreen } from './invoke';
43
export { StatusScreen } from './status';

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function AddGatewayScreen({
243243
const headerContent = <StepIndicator steps={wizard.steps} currentStep={wizard.step} labels={GATEWAY_STEP_LABELS} />;
244244

245245
return (
246-
<Screen title="Add Gateway" onExit={onExit} helpText={helpText} headerContent={headerContent}>
246+
<Screen title="Add Gateway" onExit={onExit} helpText={helpText} headerContent={headerContent} exitEnabled={false}>
247247
<Panel>
248248
{isNameStep && (
249249
<TextInput
@@ -345,7 +345,12 @@ export function AddGatewayScreen({
345345
fields={[
346346
{ label: 'Name', value: wizard.config.name },
347347
{ label: 'Description', value: wizard.config.description },
348-
{ label: 'Authorizer', value: wizard.config.authorizerType },
348+
{
349+
label: 'Authorizer',
350+
value:
351+
AUTHORIZER_TYPE_OPTIONS.find(o => o.id === wizard.config.authorizerType)?.title ??
352+
wizard.config.authorizerType,
353+
},
349354
...(wizard.config.authorizerType === 'CUSTOM_JWT' && wizard.config.jwtConfig
350355
? [
351356
{ label: 'Discovery URL', value: wizard.config.jwtConfig.discoveryUrl },

0 commit comments

Comments
 (0)