Module clone

Module clone 

Source
Expand description

Clone command implementation.

This module implements the repository cloning functionality with automatic workspace setup. It provides a seamless developer onboarding experience by cloning a Git repository and automatically initializing or validating workspace configuration.

§What

Provides the clone command that:

  • Clones Git repositories (HTTPS and SSH)
  • Shows progress during clone operations
  • Supports shallow clones with –depth flag
  • Supports –force to overwrite existing directories
  • Automatically detects workspace configuration (Story 11.3)
  • Validates existing configuration (Story 11.3)
  • Initializes workspace if no configuration exists (Story 11.4)

§How

The command follows this flow:

  1. Parse URL and determine destination directory
  2. Validate destination doesn’t exist (unless –force)
  3. Remove destination if –force is set
  4. Clone repository with progress indication
  5. Detect workspace configuration (Story 11.3)
  6. Validate configuration or run init (Story 11.3/11.4)
  7. Display success message with next steps (Story 11.4)

§Why

Cloning with automatic setup:

  • Reduces onboarding friction for new developers
  • Ensures consistent workspace setup
  • Validates configuration immediately
  • Provides clear feedback and next steps

§Examples

# Clone to default location (repository name)
workspace clone https://github.com/org/repo.git

# Clone to specific directory
workspace clone https://github.com/org/repo.git ./my-dir

# Clone with configuration overrides
workspace clone https://github.com/org/repo.git \
    --strategy independent \
    --environments "dev,staging,prod"

# Force clone (remove existing directory)
workspace clone https://github.com/org/repo.git --force

# Shallow clone
workspace clone https://github.com/org/repo.git --depth 1

Structs§

ValidationCheck
Represents an individual validation check.
ValidationResult
Represents the result of a validation operation.

Functions§

execute_clone
Executes the clone command.
validate_workspace
Validates workspace configuration and directory structure.