Skip to content

Commit 9c6d334

Browse files
committed
fix: match preview branch deploy UI and persist deployHash
- Deploy screen in TUI dev mode now matches preview branch: shows "Deploying project resources..." with DeployStatus CFN messages, filters redundant step, yellow error text, and log path link. - Persist deployHash in deployed-state.json after successful deploys so canSkipDeploy can detect unchanged projects and skip re-deploy.
1 parent cd64794 commit 9c6d334

2 files changed

Lines changed: 48 additions & 12 deletions

File tree

src/cli/commands/deploy/actions.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
synthesizeCdk,
3535
validateProject,
3636
} from '../../operations/deploy';
37+
import { computeProjectDeployHash } from '../../operations/deploy/change-detection';
3738
import { formatTargetStatus, getGatewayTargetStatuses } from '../../operations/deploy/gateway-status';
3839
import { createDeploymentManager } from '../../operations/deploy/imperative';
3940
import { deleteOrphanedABTests, setupABTests } from '../../operations/deploy/post-deploy-ab-tests';
@@ -510,6 +511,13 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise<Dep
510511
}
511512
}
512513

514+
let deployHash: string | undefined;
515+
try {
516+
deployHash = await computeProjectDeployHash(configIO);
517+
} catch {
518+
// hash computation is best-effort
519+
}
520+
513521
const existingState = await configIO.readDeployedState().catch(() => undefined);
514522
let deployedState = buildDeployedState({
515523
targetName: target.name,
@@ -527,6 +535,14 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise<Dep
527535
harnesses: deployedHarnesses,
528536
runtimeEndpoints,
529537
});
538+
539+
if (deployHash) {
540+
const targetState = deployedState.targets[target.name];
541+
if (targetState?.resources) {
542+
targetState.resources.deployHash = deployHash;
543+
}
544+
}
545+
530546
await configIO.writeDeployedState(deployedState);
531547

532548
// Show gateway URLs and target sync status

src/cli/tui/screens/dev/DevScreen.tsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import type { AgentEnvSpec } from '../../../../schema';
22
import { isPreviewEnabled } from '../../../feature-flags';
33
import { getDevSupportedAgents, getEndpointUrl, loadProjectConfig } from '../../../operations/dev';
4-
import { GradientText, LogLink, Panel, Screen, SelectList, StepProgress, TextInput } from '../../components';
4+
import {
5+
DeployStatus,
6+
GradientText,
7+
LogLink,
8+
Panel,
9+
Screen,
10+
SelectList,
11+
StepProgress,
12+
TextInput,
13+
} from '../../components';
514
import { useDevDeploy } from '../../hooks/useDevDeploy';
615
import { type ConversationMessage, useDevServer } from '../../hooks/useDevServer';
716
import { InvokeScreen } from '../invoke/InvokeScreen';
@@ -232,8 +241,10 @@ export function DevScreen(props: DevScreenProps) {
232241

233242
const {
234243
steps: deploySteps,
244+
deployMessages,
235245
isComplete: deployComplete,
236246
error: deployError,
247+
logPath: deployLogPath,
237248
} = useDevDeploy({ skip: props.skipDeploy, ready: mode === 'deploying' });
238249

239250
const hasTransitionedFromDeployRef = useRef(false);
@@ -510,19 +521,28 @@ export function DevScreen(props: DevScreenProps) {
510521
}
511522

512523
if (mode === 'deploying') {
524+
const hasStartedCfn = deployMessages.length > 0;
525+
const displaySteps = hasStartedCfn ? deploySteps.filter(s => s.label !== 'Deploy to AWS') : deploySteps;
526+
513527
return (
514-
<Screen title="Dev Server" onExit={handleExit} helpText="Esc cancel">
515-
<Panel title="Deploying Harness" fullWidth>
516-
<Box flexDirection="column">
517-
<StepProgress steps={deploySteps} />
518-
{deployError && (
519-
<Box flexDirection="column" marginTop={1}>
520-
<Text color="red">Deploy failed: {deployError}</Text>
521-
<Text dimColor>Press Esc to go back.</Text>
522-
</Box>
523-
)}
528+
<Screen title="Dev" onExit={handleExit} helpText="Esc quit">
529+
<Box flexDirection="column" paddingX={1}>
530+
<Text bold>Deploying project resources...</Text>
531+
<Box marginTop={1}>
532+
<StepProgress steps={displaySteps} />
524533
</Box>
525-
</Panel>
534+
{hasStartedCfn && (
535+
<Box marginTop={1}>
536+
<DeployStatus messages={deployMessages} isComplete={deployComplete} hasError={!!deployError} />
537+
</Box>
538+
)}
539+
{deployError && (
540+
<Box marginTop={1}>
541+
<Text color="yellow">Deploy failed: {deployError}</Text>
542+
</Box>
543+
)}
544+
{deployLogPath && <LogLink filePath={deployLogPath} />}
545+
</Box>
526546
</Screen>
527547
);
528548
}

0 commit comments

Comments
 (0)