Module cli

Module cli 

Source
Expand description

Command-line interface for AGPM (Claude Code Package Manager).

This module contains all CLI command implementations for the Claude Code Package Manager. The CLI provides a comprehensive set of commands for managing Claude Code resources, from project initialization to dependency management and global configuration.

§Command Architecture

Each command is implemented as a separate module with its own argument structures and execution logic. This modular design allows for:

  • Clear separation of concerns
  • Independent testing of each command
  • Easy addition of new commands
  • Consistent documentation and error handling

§Available Commands

§Project Management

  • init - Initialize a new AGPM project with a manifest file
  • add - Add sources and dependencies to the project manifest
  • remove - Remove sources and dependencies from the project manifest
  • install - Install dependencies from the manifest
  • update - Update dependencies within version constraints

§Information and Inspection

  • list - List installed resources from the lockfile
  • tree - Display dependency tree for installed resources
  • outdated - Check for available updates to dependencies
  • validate - Validate project configuration and dependencies

§System Management

  • cache - Manage the global Git repository cache
  • config - Manage global configuration settings
  • upgrade - Upgrade AGPM to newer versions with backup support

§Command Usage Patterns

§Basic Workflow

# 1. Initialize a new project
agpm init

# 2. Add sources and dependencies
agpm add source official https://github.com/org/agpm-resources.git
agpm add dep official:agents/code-reviewer.md@v1.0.0 --agent

# 3. Install dependencies
agpm install

# 4. List what's installed
agpm list

§Maintenance Operations

# Check for available updates
agpm outdated

# Validate project configuration
agpm validate --resolve --sources

# Update dependencies
agpm update

# Manage cache
agpm cache clean

# Configure global settings
agpm config add-source private https://oauth2:TOKEN@github.com/org/private.git

# Check for and install AGPM updates
agpm upgrade --check     # Check for updates
agpm upgrade             # Upgrade to latest
agpm upgrade --rollback  # Restore previous version

§Global vs Project Configuration

AGPM uses two types of configuration:

TypeFilePurposeVersion Control
Projectagpm.tomlDefine dependencies✅ Commit
Global~/.agpm/config.tomlAuthentication tokens❌ Never commit

§Cross-Platform Support

The CLI is designed to work consistently across:

  • Windows (Command Prompt, PowerShell)
  • macOS (Terminal, various shells)
  • Linux (bash, zsh, fish, etc.)

§Command Modules

Each command is implemented in its own module:

§Global Options

All commands support these global options:

  • --verbose - Enable debug output
  • --quiet - Suppress all output except errors
  • --no-progress - Disable progress bars and spinners
  • --config - Path to custom config file

§Example

# Initialize a new project
agpm init --with-examples

# Install dependencies
agpm install --verbose

# Update dependencies
agpm update --no-progress

Modules§

common
Common utilities and shared functionality for CLI commands.
install
Install Claude Code resources from manifest dependencies.
upgrade
Self-update functionality for upgrading AGPM to newer versions.
validate
Validate AGPM project configuration and dependencies.

Structs§

Cli
Main CLI structure for AGPM (Claude Code Package Manager).
CliConfig
Runtime configuration for CLI execution.