Skip to content

Commit 51dd78f

Browse files
committed
fix(import): wire deploy and status navigation from CLI-inline TUI
When running `agentcore import` from CLI (not full TUI), selecting "deploy" or "status" from the next-steps menu now renders the corresponding screen instead of silently exiting.
1 parent f39d0bd commit 51dd78f

1 file changed

Lines changed: 37 additions & 5 deletions

File tree

src/cli/commands/import/command.ts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,44 @@ export const registerImport = (program: Command) => {
2828
const { render } = await import('ink');
2929
const React = await import('react');
3030
const { ImportFlow } = await import('../../tui/screens/import');
31-
const { clear, unmount } = render(
31+
const inkRef: { current?: { clear: () => void; unmount: () => void } } = {};
32+
33+
const exitTui = () => {
34+
inkRef.current?.clear();
35+
inkRef.current?.unmount();
36+
};
37+
38+
const navigateTo = async (command: string) => {
39+
exitTui();
40+
if (command === 'deploy') {
41+
const { DeployScreen } = await import('../../tui/screens/deploy/DeployScreen');
42+
const deployInstance = render(
43+
React.createElement(DeployScreen, {
44+
isInteractive: false,
45+
onExit: () => {
46+
deployInstance.unmount();
47+
process.exit(0);
48+
},
49+
})
50+
);
51+
} else if (command === 'status') {
52+
const { StatusScreen } = await import('../../tui/screens/status/StatusScreen');
53+
const statusInstance = render(
54+
React.createElement(StatusScreen, {
55+
isInteractive: false,
56+
onExit: () => {
57+
statusInstance.unmount();
58+
process.exit(0);
59+
},
60+
})
61+
);
62+
}
63+
};
64+
65+
inkRef.current = render(
3266
React.createElement(ImportFlow, {
33-
onBack: () => {
34-
clear();
35-
unmount();
36-
},
67+
onBack: exitTui,
68+
onNavigate: (command: string) => void navigateTo(command),
3769
})
3870
);
3971
return;

0 commit comments

Comments
 (0)