Add terminal screenshot previews to CLI site deployments#1442
Add terminal screenshot previews to CLI site deployments#1442ChiragAgg5k wants to merge 10 commits intomasterfrom
Conversation
Greptile SummaryThis PR adds terminal screenshot preview rendering to the CLI site deployment summary. The implementation mirrors the console's finalization behavior: it extends the outer timeout when screenshots are still pending, waits up to 30 s for them to arrive, then falls back gracefully with a hint. The Confidence Score: 5/5Safe to merge; all previously flagged P1 concerns are addressed and only a minor dead-constant nit remains. The spurious-timeout fix (extending No files require special attention. Important Files Changed
Reviews (6): Last reviewed commit: "Sync CLI package manifests" | 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