# Project Management

Initialize and manage game engine projects with GPM's project management tools.

## Overview

GPM provides comprehensive project management commands for initializing new packages, detecting game engine projects, and managing project configurations. The system supports multiple game engines with automatic detection and configuration.

## Commands

| Command                                              | Description                 | Usage                    |
| ---------------------------------------------------- | --------------------------- | ------------------------ |
| [`gpm init`](/cli-reference/cli/project/init.md)     | Initialize new UPM package  | `gpm init [flags]`       |
| [`gpm detect`](/cli-reference/cli/project/detect.md) | Detect game engine projects | `gpm detect [directory]` |

## Quick Start

### Project Detection

```bash
# Detect current project
gpm detect

# Detect specific directory
gpm detect /path/to/project

# Detect with JSON output
gpm detect --json
```

### Package Initialization

```bash
# Initialize new package
gpm init

# Initialize with specific values
gpm init --name com.company.mypackage --description "My package"

# Initialize with all defaults
gpm init --yes
```

## Engine Support

### Unity (Fully Supported)

* **Project Detection**: Automatic detection of Unity projects
* **Package Initialization**: Full UPM package creation
* **Manifest Management**: Automatic manifest.json updates
* **Scoped Registries**: Automatic registry configuration

### Godot (Planned)

* **Project Detection**: Detection of Godot projects
* **Package Initialization**: Godot addon package creation
* **Project Configuration**: project.godot integration

### Unreal Engine (Planned)

* **Project Detection**: Detection of Unreal projects
* **Package Initialization**: Unreal plugin package creation
* **Project Configuration**: .uproject integration

### Cocos Creator (Planned)

* **Project Detection**: Detection of Cocos Creator projects
* **Package Initialization**: Cocos Creator extension creation
* **Project Configuration**: project.json integration

## Project Detection

### Detection Criteria

GPM automatically detects game engine projects based on:

* **Unity**: `Assets/`, `ProjectSettings/`, `Packages/manifest.json`
* **Unreal**: `*.uproject` files, `Content/`, `Config/`
* **Godot**: `project.godot` file, `.tscn` files
* **Cocos Creator**: `project.json`, `assets/` directory

### Confidence Levels

* **Maximum**: Very specific indicators (e.g., `.uproject` files)
* **High**: Multiple strong indicators
* **Medium**: Some indicators present
* **Low**: Weak or few indicators
* **None**: No indicators found

## Package Initialization

### Package Structure

GPM creates a complete package structure:

```
mypackage/
├── package.json          # Package metadata
├── README.md             # Package documentation
├── LICENSE               # Package license
├── Runtime/              # Runtime scripts
│   └── MyPackage/
│       └── MyPackage.cs
├── Editor/               # Editor scripts
│   └── MyPackage/
│       └── MyPackageEditor.cs
└── Tests/                # Test scripts
    └── Runtime/
        └── MyPackageTests.cs
```

### Package.json Requirements

* **name**: Package identifier (reverse-DNS format)
* **version**: Package version (semantic versioning)
* **description**: Package description
* **author**: Package author information
* **license**: Package license
* **unity**: Minimum Unity version

## Common Workflows

### New Package Development

```bash
# 1. Detect project type
gpm detect

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

# 3. Develop package
# Add source code
# Add tests
# Update documentation

# 4. Pack and publish
gpm pack
gpm publish --access=scoped
```

### Project Setup

```bash
# 1. Detect existing project
gpm detect /path/to/project

# 2. Install packages
gpm install com.unity.analytics

# 3. Add new packages
gpm add com.company.mypackage

# 4. List installed packages
gpm list
```

### Team Collaboration

```bash
# 1. Detect project
gpm detect

# 2. Install team packages
gpm install

# 3. Add new dependency
gpm add com.team.shared-utils

# 4. Commit changes
git add Packages/manifest.json
git commit -m "Add team package dependency"
```

## Best Practices

### Project Organization

```bash
# Organize projects by engine
mkdir -p /workspace/unity-projects
mkdir -p /workspace/godot-projects
mkdir -p /workspace/unreal-projects

# Use clear naming conventions
gpm init --name com.company.analytics-sdk
gpm init --name com.company.ui-framework
```

### Package Naming

```bash
# Use reverse-DNS format
gpm init --name com.company.mypackage

# Use descriptive names
gpm init --name com.company.game-analytics
gpm init --name com.company.networking-utils
```

### Version Management

```bash
# Start with version 1.0.0
gpm init --name com.company.mypackage --version 1.0.0

# Use semantic versioning
gpm version patch  # 1.0.0 → 1.0.1
gpm version minor  # 1.0.0 → 1.1.0
gpm version major  # 1.0.0 → 2.0.0
```

## Error Handling

### Common Issues

* **No projects detected**: Check directory structure and file presence
* **Invalid package name**: Use reverse-DNS format
* **Package already exists**: Remove existing package.json or use different directory
* **Permission denied**: Check directory permissions

### Troubleshooting

1. **Detection issues**: Verify project structure and file presence
2. **Initialization errors**: Check package name format and directory permissions
3. **Configuration errors**: Verify Unity version and other settings
4. **File creation errors**: Check disk space and permissions

## Integration Examples

### CI/CD Integration

```bash
# Detect projects in CI
gpm detect --json > detection-results.json

# Initialize packages in CI
gpm init --name com.company.mypackage --yes
```

### Development Workflow

```bash
# Check project type
gpm detect

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

# Develop and test
# Pack and publish
gpm pack
gpm publish --access=scoped
```

## Related Commands

* [Package Management](/cli-reference/cli/package-management.md) - Package installation and management
* [Publishing](/cli-reference/cli/publishing.md) - Package publishing
* [Engine Support](/multi-engine-support/engines.md) - Engine-specific guides

## See Also

* [Package Guidelines](https://github.com/gpm-sh/docs/blob/main/packages/README.md) - Package naming and structure
* [Unity Package Manager](https://github.com/gpm-sh/docs/blob/main/engines/unity.md) - Unity-specific workflows
* [Multi-Engine Support](https://github.com/gpm-sh/docs/blob/main/engines/auto-detection.md) - Cross-engine development


---

# 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/project.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.
