Commands Overview
Introduction
The cpm command-line interface provides comprehensive repository management capabilities through an intuitive command structure. This document provides a complete overview of all available commands organized by functional area.
Command Structure
All cpm commands follow this general pattern:
cpm [command] [subcommand] [arguments] [flags]
Global Flags
These flags are available for all commands:
| Flag | Description | Default |
|---|---|---|
--config <path> |
Path to configuration file | ~/.cpm/config.yaml |
--verbose |
Enable verbose output for debugging | false |
--help, -h |
Display help for any command | - |
Command Categories
cpm commands are organized into the following functional categories:
- Repository Commands - Manage git repositories
- Organization Commands - Manage organizations and teams
- User Commands - Manage users and access control
- SSH Key Commands - Manage SSH authentication keys
- Server Commands - Manage remote servers
- Neighbor Commands - Discover and sync with peer servers
- Configuration Commands - Configure cpm settings
Repository Commands
Commands for managing git repositories across your infrastructure.
cpm init
Initialize a new bare git repository and register it in the database.
Usage:
cpm init <repository-name> [flags]
Flags:
--path <directory>- Directory path to create repository in--org <name>- Associate repository with an organization
See: Repository Commands Reference
cpm list
List repositories from local filesystem, remote server, or organization.
Usage:
cpm list [flags]
Flags:
--local- List local repositories (default)--remote <host>- List repositories on remote server--org <name>- List repositories in organization
See: Repository Commands Reference
cpm push
Push a repository to a remote server using rsync over SSH.
Usage:
cpm push <repository> [flags]
Flags:
--to <server>- Target server name (defaults to main server)
See: Repository Commands Reference
cpm pull
Pull a repository from a remote server using rsync over SSH.
Usage:
cpm pull <repository> [flags]
Flags:
--from <server>- Source server name (defaults to main server)
See: Repository Commands Reference
cpm merge
Merge a source branch into a target branch in a repository.
Usage:
cpm merge <source-branch> [flags]
Flags:
--into <branch>- Target branch to merge into--repo <path|name>- Repository path or name
See: Repository Commands Reference
Organization Commands
Commands for managing organizations and team-based repository access.
cpm org create
Create a new organization.
Usage:
cpm org create <name> [flags]
See: Organization Commands Reference
cpm org list
List all organizations.
Usage:
cpm org list
See: Organization Commands Reference
cpm org show
Show detailed information about an organization.
Usage:
cpm org show <name>
See: Organization Commands Reference
cpm org delete
Delete an organization.
Usage:
cpm org delete <name>
See: Organization Commands Reference
cpm org add-member
Add a user to an organization.
Usage:
cpm org add-member <org> <user> [flags]
See: Organization Commands Reference
cpm org remove-member
Remove a user from an organization.
Usage:
cpm org remove-member <org> <user>
See: Organization Commands Reference
cpm org add-repo
Add a repository to an organization.
Usage:
cpm org add-repo <org> <repo>
See: Organization Commands Reference
cpm org remove-repo
Remove a repository from an organization.
Usage:
cpm org remove-repo <org> <repo>
See: Organization Commands Reference
User Commands
Commands for managing users and repository access permissions.
cpm user add
Add a new user to the system.
Usage:
cpm user add <username> [flags]
Flags:
--email <address>- User email address--key <public-key>- SSH public key
cpm user list
List all users with their details.
Usage:
cpm user list
cpm user show
Show detailed user information.
Usage:
cpm user show <username>
cpm user remove
Remove a user from the system.
Usage:
cpm user remove <username>
SSH Key Commands
Commands for managing SSH authentication keys.
cpm ssh-key generate
Generate a new ed25519 SSH key pair.
Usage:
cpm ssh-key generate <name>
See: SSH Key Commands Reference
cpm ssh-key list
List all managed SSH keys.
Usage:
cpm ssh-key list
See: SSH Key Commands Reference
cpm ssh-key show
Display the public key content.
Usage:
cpm ssh-key show <name>
See: SSH Key Commands Reference
cpm ssh-key push
Push public key to server's authorized_keys file.
Usage:
cpm ssh-key push <name> --to <server>
See: SSH Key Commands Reference
cpm ssh-key pull
Retrieve authorized_keys from a remote server.
Usage:
cpm ssh-key pull --from <server>
See: SSH Key Commands Reference
cpm ssh-key delete
Delete an SSH key pair.
Usage:
cpm ssh-key delete <name>
See: SSH Key Commands Reference
Server Commands
Commands for managing remote cpm servers.
cpm servers list
Display all registered servers.
Usage:
cpm servers list
See: Server Commands Reference
cpm servers add
Register a new cpm server.
Usage:
cpm servers add <name> <host> [flags]
Flags:
--port <number>- SSH port number (default: 22)--user <username>- SSH username (default: git)--key <path>- Path to SSH private key
See: Server Commands Reference
cpm servers remove
Remove a registered server.
Usage:
cpm servers remove <name>
See: Server Commands Reference
cpm servers set-main
Designate a server as the main storage server.
Usage:
cpm servers set-main <name>
See: Server Commands Reference
cpm servers status
Show health status and system information.
Usage:
cpm servers status [name]
See: Server Commands Reference
Neighbor Commands
Commands for discovering and syncing with peer cpm servers.
cpm neighbors list
Display all registered neighbor servers.
Usage:
cpm neighbors list
See: Neighbor Commands Reference
cpm neighbors discover
Scan the local network for cpm servers.
Usage:
cpm neighbors discover [flags]
Flags:
--network <cidr>- Network CIDR to scan (e.g., 192.168.1.0/24)
See: Neighbor Commands Reference
cpm neighbors add
Manually register a neighbor server.
Usage:
cpm neighbors add <host>
See: Neighbor Commands Reference
cpm neighbors remove
Remove a neighbor server.
Usage:
cpm neighbors remove <host>
See: Neighbor Commands Reference
cpm neighbors ping
Test connectivity to a neighbor server.
Usage:
cpm neighbors ping <host>
See: Neighbor Commands Reference
cpm neighbors sync
Synchronize a repository with a neighbor server.
Usage:
cpm neighbors sync <repo> [flags]
Flags:
--to <neighbor>- Push repository to neighbor--from <neighbor>- Pull repository from neighbor
See: Neighbor Commands Reference
Configuration Commands
Commands for managing cpm configuration settings.
cpm config init
Initialize default configuration file.
Usage:
cpm config init
See: Configuration Commands Reference
cpm config show
Display current configuration settings.
Usage:
cpm config show
See: Configuration Commands Reference
cpm config set
Set a configuration value.
Usage:
cpm config set <key> <value>
Valid Keys:
main_server- Main server addressdata_dir- Directory for storing repository datassh_key_path- Default SSH key pathdatabase_path- Path to SQLite database
See: Configuration Commands Reference
cpm config get
Retrieve a specific configuration value.
Usage:
cpm config get <key>
See: Configuration Commands Reference
cpm config path
Display the path to the configuration file.
Usage:
cpm config path
See: Configuration Commands Reference
Command Patterns
Common Usage Patterns
Working with Multiple Servers
# Add servers
cpm servers add origin git.example.com --user git
cpm servers add backup backup.example.com --user git
# Set main server
cpm servers set-main origin
# Push to specific server
cpm push myrepo --to backup
Organization Workflow
# Create organization
cpm org create myteam --description "My team's repositories"
# Add members
cpm org add-member myteam alice --role admin
cpm org add-member myteam bob --role member
# Create and add repository
cpm init project --org myteam
cpm org add-repo myteam project
SSH Key Management
# Generate key
cpm ssh-key generate production
# Deploy to servers
cpm ssh-key push production --to git@server1.com
cpm ssh-key push production --to git@server2.com
# Verify deployment
cpm ssh-key pull --from git@server1.com
Neighbor Discovery and Sync
# Discover neighbors
cpm neighbors discover --network 192.168.1.0/24
# List discovered neighbors
cpm neighbors list
# Sync repository with neighbor
cpm neighbors sync myrepo --to neighbor-192.168.1.100-9418
Exit Codes
All cpm commands use standard exit codes:
| Code | Meaning |
|---|---|
0 |
Success |
1 |
General error |
2 |
Command usage error |
130 |
User interrupted (Ctrl+C) |
Command Aliases
Some commands have shorter aliases for convenience:
| Full Command | Alias |
|---|---|
cpm servers list |
cpm srv ls |
cpm config show |
cpm cfg show |
cpm org list |
cpm organizations |
Help System
Getting Help
Get help for any command using the --help flag:
# General help
cpm --help
# Command-specific help
cpm init --help
cpm org --help
cpm ssh-key generate --help
Help Format
Command help includes:
- Command description
- Usage syntax
- Available flags and options
- Examples
- Related commands
Next Steps
- Review detailed command references for each category
- See Quick Start Guide for common workflows
- Read Configuration Reference for setup details
- Explore Architecture Overview for system design