Run CLI is an interactive Command Line Interface (CLI) designed to manage Google Cloud Run resources with an enhanced user experience. It leverages a Text-based User Interface (TUI) to provide a rich, interactive environment directly in the terminal.
- Language: Go (Golang)
- Key Libraries:
github.com/rivo/tview: For building the Terminal User Interface (TUI).github.com/gdamore/tcell: Underlying library for terminal handling.github.com/spf13/cobra: For CLI command structure and flag parsing.
- Architecture:
cmd/run/: Contains the main entry point (main.go).internal/run/command/: Handles the CLI command definitions and initialization.internal/run/tui/: Contains the terminal UI logic.app/: Main application layout and pages (service,job,worker).component/: Reusable UI components (header,table,loader,spinner,logo,modals).
internal/run/model/: Defines the data models used across the application (e.g.,service,job,info).
The project uses a Makefile to automate common development tasks.
-
Build: Compile the project and generate the binary in
./bin/run.make build
-
Run: Build and execute the local binary.
make run
-
Test: Run unit tests with coverage analysis.
make test -
Lint: Run the code linter (
golangci-lint).make lint
-
Docker:
- Build the Docker image:
make build-image - Run the container:
make run-container
- Build the Docker image:
- Project Structure: Follows standard Go project layout with
cmdfor executables andinternalfor private library code. Thepkgis used for public libraries. - Linting:
golangci-lintis used to enforce code style and quality. Ensuremake lintpasses before committing. - Testing: Unit tests are encouraged. Use
make testto verify changes. - UI Components: The UI is modularized in
internal/run/tui.- Pages: Located in
internal/run/tui/app. - Components: Shared elements (Spinner, Logo, Header) are in
internal/run/tui/component.
- Pages: Located in
- Initialization: The application performs a parallel pre-load of Projects and Services during the initial loading screen (featuring the Logo and Spinner). This ensures the dashboard is populated immediately upon launch.
- Async Operations: Long-running tasks like scaling services or worker pools use the
spinnercomponent to provide visual feedback without blocking the UI. - Data Fetching: UI packages (
service,project) expose helper functions (Fetch,PreLoad) to allow data retrieval without tight coupling to the main application logic.
- Always add new features to the README.md file.
- Always use
make buildinstead ofgo buildto compile the project. - Always add unit tests for every code change or new feature.