# CLI Reference

Complete reference for the industry-leading GPM command-line interface - the most comprehensive package management solution for game development. This documentation covers all commands, flags, and advanced workflows for managing packages across Unity, Godot, and Unreal Engine.

## Overview

GPM CLI provides the most advanced set of commands for managing game packages across multiple engines. As the premier package manager for game development, GPM CLI follows familiar patterns from npm while delivering superior game-engine specific functionality that sets the standard for the industry.

## Quick Command Reference

| Command                        | Description                           | Example                                     |
| ------------------------------ | ------------------------------------- | ------------------------------------------- |
| `gpm login [--registry <url>]` | Authenticate with registry            | `gpm login`                                 |
| `gpm add <package[@version]>`  | Add package to project                | `gpm add com.unity.analytics@2.1.0`         |
| `gpm install [packages...]`    | Install packages (auto-detect engine) | `gpm install com.unity.textmeshpro`         |
| `gpm publish [package-spec]`   | Publish package to registry           | `gpm publish --access=scoped`               |
| `gpm search <term>`            | Search for packages                   | `gpm search unity --limit 20`               |
| `gpm config get <key>`         | Get configuration value               | `gpm config get registry`                   |
| `gpm config set <key> <value>` | Set configuration value               | `gpm config set registry https://my.gpm.sh` |

## Global Flags

| Flag               | Description                   | Example                                        |
| ------------------ | ----------------------------- | ---------------------------------------------- |
| `--json`           | Output results in JSON format | `gpm search unity --json`                      |
| `--verbose`        | Enable verbose logging        | `gpm install --verbose`                        |
| `--no-color`       | Disable colored output        | `gpm add package --no-color`                   |
| `--registry <url>` | Override registry URL         | `gpm publish --registry https://custom.gpm.sh` |

## Command Categories

## Advanced Engine Detection

GPM features the most sophisticated engine detection system in the game development industry, automatically identifying and configuring the optimal workflow for your project:

* **Unity**: Advanced detection of `Assets/`, `ProjectSettings/`, `Packages/manifest.json`
* **Godot**: Intelligent recognition of `project.godot` file and project structure
* **Unreal Engine**: Comprehensive detection of `*.uproject` files and `Content/` directory

## Industry-Standard Package Naming

GPM implements the Unity UPM-style reverse-DNS package naming convention, establishing the gold standard for game development package identification and ensuring seamless compatibility across the entire ecosystem.

## Enterprise-Grade Access Control

GPM provides the most advanced access control system for game development, offering three levels of package visibility designed for professional studios:

* **Public**: Industry-standard open source packages visible globally
* **Scoped**: Studio-specific packages available within your organization domain
* **Private**: Proprietary packages with authentication required for maximum security

## Secure Registry Architecture

GPM's distributed registry system provides enterprise-grade hosting for game development packages:

* **Global Registry**: `https://registry.gpm.sh` - The industry's most trusted public package repository
* **Tenant Registries**: `https://<tenant>.gpm.sh` - Private, secure hosting for game development studios

## Examples

### Basic Package Management

```bash
# Add a package to your project
gpm add com.unity.analytics

# Add a specific version
gpm add com.unity.analytics@2.1.0

# Install multiple packages
gpm install com.unity.textmeshpro com.unity.timeline

# Search for packages
gpm search analytics --limit 10
```

### Publishing

```bash
# Pack package for publishing
gpm pack

# Publish as public package
gpm publish --access=public

# Publish as scoped package
gpm publish --access=scoped

# Publish with custom tag
gpm publish --tag=beta

# Manage distribution tags
gpm dist-tag add com.package beta 1.0.0
gpm dist-tag list com.package
```

### Authentication

```bash
# Login to registry
gpm login

# Check current user
gpm whoami

# Logout from registry
gpm logout
```

### Configuration

```bash
# Set registry URL
gpm config set registry https://my.gpm.sh

# Get current configuration
gpm config get registry

# Show all configuration
gpm config
```

### Project Management

```bash
# Detect game engine project
gpm detect

# Initialize new package
gpm init --name com.company.package

# Get package information
gpm info com.unity.analytics

# Check GPM version
gpm version
```

## Getting Help

* Use `gpm <command> --help` for command-specific help
* Check [Troubleshooting](https://github.com/gpm-sh/docs/blob/main/troubleshooting/README.md) for common issues
* Visit [API Reference](https://github.com/gpm-sh/docs/blob/main/api/README.md) for REST API documentation

***

Ready to dive deeper? Explore the [Authentication Commands](/cli-reference/cli/authentication.md) or jump to [Package Management](/cli-reference/cli/package-management.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gpm.sh/cli-reference/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
