Skip to content

Conversation

@CodeMan62
Copy link
Contributor

@CodeMan62 CodeMan62 commented Nov 25, 2025

Description

Added a spinner as sign of loading animation for deployments in CLI

Related Issues

#705

Closes #705

Checklist when merging to main

  • No compiler warnings (if applicable)
  • Code is formatted with rustfmt
  • No useless or dead code (if applicable)
  • Code is easy to understand
  • Doc comments are used for all functions, enums, structs, and fields (where appropriate)
  • All tests pass
  • Performance has not regressed (assuming change was not to fix a bug)
  • Version number has been updated in helix-cli/Cargo.toml and helixdb/Cargo.toml

Additional Notes

Here is a quick video
Screencast from 2025-11-25 14-25-14.webm

Greptile Overview

Greptile Summary

Implemented loading spinner animation for CLI deployment operations to address user feedback that the terminal appeared frozen during builds.

Key changes:

  • Added Spinner struct in utils.rs with async animation using tokio
  • Integrated spinner around Docker build operations in build.rs
  • Added spinners for both build and deployment phases in push.rs with provider-specific messages
  • Removed redundant status print statements from docker.rs to avoid interfering with spinner

Implementation details:

  • Spinner runs as a tokio task with braille pattern animation frames
  • Uses Arc<Mutex<String>> for thread-safe message updates
  • Properly cleans up via Drop trait to prevent resource leaks
  • Supports dynamic message updates during long operations

Important Files Changed

File Analysis

Filename Score Overview
helix-cli/src/utils.rs 4/5 Added Spinner struct with async animation loop using tokio, includes proper cleanup via Drop trait
helix-cli/src/commands/build.rs 5/5 Added spinner for Docker image build step, wrapping build_image call with start/stop
helix-cli/src/commands/push.rs 4/5 Added spinners for build and deployment phases, with dynamic messages for different cloud providers
helix-cli/src/docker.rs 5/5 Removed status print statements from build_image, delegating user feedback to spinner in calling code

Sequence Diagram

sequenceDiagram
    participant User
    participant BuildCmd as build.rs
    participant PushCmd as push.rs
    participant Spinner
    participant Docker as docker.rs
    participant CloudProvider

    Note over User,CloudProvider: Build Command Flow
    User->>BuildCmd: helix build
    BuildCmd->>Spinner: new("DOCKER", "Building...")
    BuildCmd->>Spinner: start()
    activate Spinner
    Note right of Spinner: Tokio task spawned<br/>Animation loop running
    BuildCmd->>Docker: build_image()
    Docker-->>BuildCmd: Result
    BuildCmd->>Spinner: stop()
    deactivate Spinner
    Note right of Spinner: Task aborted<br/>Line cleared
    BuildCmd-->>User: Success message

    Note over User,CloudProvider: Push Command Flow (Cloud)
    User->>PushCmd: helix push
    PushCmd->>Spinner: new("BUILD", "Building instance...")
    PushCmd->>Spinner: start()
    activate Spinner
    PushCmd->>BuildCmd: run()
    BuildCmd->>Docker: build_image()
    Docker-->>BuildCmd: Result
    BuildCmd-->>PushCmd: MetricsData
    PushCmd->>Spinner: stop()
    deactivate Spinner
    
    PushCmd->>Spinner: new("DEPLOY", "Deploying instance...")
    PushCmd->>Spinner: start()
    activate Spinner
    PushCmd->>Spinner: update("Deploying to Fly.io/ECR/Helix...")
    Note right of Spinner: Message updates<br/>while animating
    PushCmd->>CloudProvider: deploy()
    CloudProvider-->>PushCmd: Result
    PushCmd->>Spinner: stop()
    deactivate Spinner
    PushCmd-->>User: Success message
Loading

@CodeMan62 CodeMan62 changed the title Spinner Loading animation for deployments Nov 25, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@xav-db
Copy link
Member

xav-db commented Nov 26, 2025

can you confirm this is working?

@CodeMan62
Copy link
Contributor Author

Yes I have added a video in description of this pr which shows that the function is working

@CodeMan62
Copy link
Contributor Author

here is mp4 video

helix-spinner.mp4

@CodeMan62
Copy link
Contributor Author

@xav-db please take a look and let me know if anything is wrong here

@xav-db
Copy link
Member

xav-db commented Dec 6, 2025

this is really nice

@xav-db xav-db changed the base branch from main to dev December 6, 2025 08:45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these print statements removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i forget to revert this change

@xav-db xav-db self-requested a review December 6, 2025 09:03
Copy link
Member

@xav-db xav-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also fix clippy

if trimmed.is_empty() || trimmed.starts_with("//") {
continue;
// function that starts the spinner
pub fn start(&mut self) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one point claude raised was there is no tty detection so spinner might emit escape codes. worth looking into adding:

if !std::io::stdout().is_terminal() {
return; // Skip animation for non-interactive terminals
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@CodeMan62 CodeMan62 requested a review from xav-db December 6, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Loading animation for deployments in the CLI

2 participants