Add terminal screenshot previews to CLI site deployments#1442
Add terminal screenshot previews to CLI site deployments#1442ChiragAgg5k merged 12 commits intomasterfrom
Conversation
Greptile SummaryThis PR adds terminal screenshot previews to the CLI site deployment summary by waiting for screenshot finalization after a deployment reaches Confidence Score: 5/5Safe to merge — all prior P0/P1 concerns are resolved; only minor P2 style suggestions remain. All three previously flagged issues (timeout extension, OR vs AND screenshot check, KITTY_WINDOW_ID restore) are correctly implemented. The two remaining findings are P2: visual width calculation using templates/cli/lib/commands/push.ts (frameTerminalPreview visual width), templates/cli/package.json (Windows ARM64 build exclusion) Important Files Changed
Reviews (8): Last reviewed commit: "fix(cli): externalize terminal-image in ..." | Re-trigger Greptile |
e3df1a7 to
f19330a
Compare
Summary
This PR adds a terminal-rendered screenshot preview to the CLI site deployment summary and aligns the CLI deploy flow with the console's screenshot finalization behavior.
Specifically, it:
readyso late-arrivingscreenshotLight/screenshotDarkfile IDs can still be picked upscreenshotsstorage bucket through the console SDKterminal-imageterminal-image@^3.1.1Problem
The CLI already streamed realtime build logs for site deployments, but it did not surface the deployment screenshot that the backend writes after the build completes. The console already treats this screenshot as part of the deployment lifecycle: deployment updates arrive over realtime, the deployment can sit in a short "ready but screenshots not attached yet" finalization state, and the frontend renders the screenshot once the file IDs are present.
The initial text-only ASCII experiment was not readable enough for real deployment previews, and separate light/dark sections added noise without improving the CLI output. The CLI needed a preview flow that was both faithful to the backend behavior and useful in an actual terminal.
Implementation Details
Deployment flow
The site push command now mirrors the console behavior more closely:
ready, the CLI readsscreenshotLightandscreenshotDarkfrom the deployment payloadScreenshot fetching and rendering
Once a screenshot file ID exists, the CLI:
screenshotsbucketWhy
terminal-imageThe previous plain-character renderer was not good enough for real screenshots.
terminal-imageproduces a much more legible terminal thumbnail, but its native terminal-specific inline image modes are not a good fit for a boxed, portable CLI summary. The implementation therefore forces the package onto its ANSI fallback path before framing the preview, which keeps the output predictable across terminals while still producing a much better preview than grayscale ASCII text.Dependency choice
terminal-imageis pinned to^3.1.1in the CLI templates because that line is compatible with the CLI's Node 18 target. The template lockfiles were regenerated to match.Files Changed
templates/cli/lib/commands/push.tstemplates/cli/lib/sdks.tstemplates/cli/package.jsontemplates/cli/package.json.twigtemplates/cli/package-lock.json.twigtemplates/cli/bun.lock.twigterminal-imageand sync generated dependency metadataVerification
I verified the change with both generation/linting and an end-to-end CLI deploy flow:
php example.php cli consolecomposer lint-twigcd examples/clibun run mac-arm64./build/appwrite-cli-darwin-arm64 push siteTesting deployment logssiteYesto deployYesto activate the deploymentScreenshots