Skip to content

Latest commit

 

History

History
145 lines (99 loc) · 2.44 KB

File metadata and controls

145 lines (99 loc) · 2.44 KB

🚀 Quick Start Guide

This guide will help you get started with Cocos CLI, from installation to basic usage.

🛠️ Installation

1. 📋 Prerequisites

  • Node.js 22.17.0 or higher
  • Git

2. 📦 Installation Steps

# Clone repository
git clone <repository-url>
cd cocos-cli

# Install dependencies
npm run init
npm install

# Download development tools (first time only)
npm run download-tools

# Build and link globally
npm run build
npm link

3. ✅ Verify Installation

# Check if command is available
cocos --help
cocos --version

📚 Basic Usage

🏗️ Create Project

# Create new Cocos project
cocos create --project ./my-game

# Specify project type (default: 3d)
cocos create --project ./my-game --type 2d

⚡ Build Project

# Build to Web Mobile platform
cocos build --project ./my-game --platform web-mobile

# Debug mode build
cocos build --project ./my-game --platform web-mobile --debug

🎨 Interactive Wizard

Use the interactive wizard to easily complete various operations:

# Start wizard
cocos wizard

The wizard will guide you through:

  • Project building
  • Starting MCP server
  • Viewing help information

🔌 MCP Server

Start MCP server to support AI tool integration:

# Start MCP server
cocos start-mcp-server --project ./my-game --port 9527

⚙️ Common Options

🚫 Non-interactive Mode

Use in CI environments or automated scripts:

cocos --no-interactive build --project ./my-game

🐛 Debug Mode

Get detailed execution information:

cocos --debug build --project ./my-game

🔧 Troubleshooting

❌ Command Not Found

# Check global link
npm list -g --depth=0

# Re-link
npm unlink -g cocos-cli
npm link

⚠️ Build Errors

# Clean and rebuild
npm run build:clear
npm run build

📁 Project Path Issues

  • Use absolute paths
  • Ensure project directory exists and is accessible
  • Check if project contains necessary configuration files

🎯 Next Steps

❓ Get Help

# Display help information
cocos --help

# Display help for specific command
cocos build --help
cocos create --help