Skip to content

Conversation

@PauloVLB
Copy link
Member

@PauloVLB PauloVLB commented Oct 24, 2025

This PR introduces the casp init command, which performs the essential first-time setup for the CLI tool.

Key Changes:

  • Environment Validation: The command checks for a valid Docker setup and gcloud application-default credentials, exiting with a clear error message if either is missing.
  • Configuration: It automatically creates a configuration file at ~/.casp/config.json, saving the path to the gcloud credentials and an optional custom config path provided by the user.
  • Dependency Fetching: It pulls the required Docker image needed for subsequent operations.
  • Unit Testing.

@PauloVLB PauloVLB changed the title feature: add init command and config util Add init command and config util Oct 27, 2025
@PauloVLB PauloVLB marked this pull request as ready for review October 27, 2025 17:06
import click

@click.command(name='init', help='Initializes the CLI')
from ..utils import config
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to have the absolute path instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

"""Initializes the CLI by checking the Docker setup and pulling the
required image."""
click.echo('Checking Docker setup...')
if not docker_utils.check_docker_setup():
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you extract this steps to auxiliary functions, like: _check_docker, _setup_credentials and so on?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! Done.

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.

3 participants