> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nativedesktop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Commands Overview

> Complete reference of all Native Desktop CLI commands

The Native Desktop CLI provides a comprehensive set of commands to manage your desktop application development workflow. This page provides an overview of all available commands and their primary use cases.

## Command List

### Project Management

#### `create`

Initialize a new Native Desktop project in an empty directory.

```shellscript theme={null}
native-desktop create
```

**Use Case**: Starting a new desktop application project with proper scaffolding and configuration.

**Learn More**: [Create Command Documentation](/create)

***

#### `run`

Run your Native Desktop application in development mode.

```shellscript theme={null}
native-desktop run [project-config-file]
```

**Use Case**: Testing and developing your application with live updates during development.

**Learn More**: [Run Command Documentation](/run)

***

### Build & Distribution

#### `build`

Build your Native Desktop project for production distribution.

```shellscript theme={null}
native-desktop build --config <config-file> --target <target-type> [--sign]
```

**Use Case**: Creating distributable packages for end users on your target platform.

**Learn More**: [Build Command Documentation](/build)

***

#### `sign`

Sign a built application for Windows or macOS.

```shellscript theme={null}
native-desktop sign [app-path] [options]
```

**Use Case**: Code signing your application to meet platform distribution requirements and ensure user trust.

**Learn More**: [Sign Command Documentation](/sign)

***

### Code Quality

#### `lint`

Run ESLint on your project to check for code quality issues.

```shellscript theme={null}
native-desktop lint
```

**Use Case**: Identifying and fixing code style issues and potential bugs.

**Learn More**: [Lint Command Documentation](/lint)

***

#### `fmt`

Format your source code using Prettier.

```shellscript theme={null}
native-desktop fmt
```

**Use Case**: Automatically formatting code to maintain consistent style across your project.

**Learn More**: [Format Command Documentation](/fmt)

***

#### `types`

Check TypeScript types in your project.

```shellscript theme={null}
native-desktop types
```

**Use Case**: Validating TypeScript types to catch type errors before runtime.

**Learn More**: [Types Command Documentation](/types)

***

## Command Workflow

A typical Native Desktop development workflow follows this pattern:

```mermaid theme={null}
graph LR
    A[Create Project] --> B[Development]
    B --> C[Run & Test]
    C --> D[Lint & Format]
    D --> E[Type Check]
    E --> F{Ready?}
    F -->|No| B
    F -->|Yes| G[Build]
    G --> H[Sign]
    H --> I[Distribute]
```

### 1. Project Creation

```shellscript theme={null}
# Create a new project
native-desktop create
```

### 2. Development Cycle

```shellscript theme={null}
# Run in development mode
native-desktop run

# Check code quality
native-desktop lint

# Format code
native-desktop fmt

# Verify types
native-desktop types
```

### 3. Production Build

```shellscript theme={null}
# Build for your platform
native-desktop build --config native-desktop.config.json5 --target dmg

# Sign the application
native-desktop sign --platform mac --identity "Developer ID Application"
```

## Global Options

All commands support the following global options:

### `--help` / `-h`

Display help information for the command.

```shellscript theme={null}
native-desktop <command> --help
```

### `--version` / `-v`

Display the CLI version number.

```shellscript theme={null}
native-desktop --version
```

## Platform-Specific Commands

Some commands have platform-specific behavior:

<AccordionGroup>
  <Accordion title="macOS">
    * **Build Targets**: `dmg`, `app`, `pkg`
    * **Signing**: Requires Apple Developer ID and certificates
    * **Notarization**: Supported via `sign` command with Apple ID credentials
  </Accordion>

  <Accordion title="Windows">
    * **Build Targets**: `exe`, `msi`, `msi-wrapped`
    * **Signing**: Requires code signing certificate (.pfx or .p12)
    * **Certificate Options**: Support for file-based and SHA1-based signing
  </Accordion>

  <Accordion title="Linux">
    * **Build Targets**: `deb`, `rpm`, `app-image`, `flatpak`, `snap`
    * **Signing**: Platform-specific signing mechanisms
    * **Distribution**: Multiple package formats for different distributions
  </Accordion>
</AccordionGroup>

## Configuration Files

Most commands interact with the project configuration file:

**Default Configuration File**: `native-desktop.config.json5`

You can specify a custom configuration file using the `--config` option:

```shellscript theme={null}
native-desktop build --config custom-config.json5 --target dmg
```

## Exit Codes

The Native Desktop CLI uses standard exit codes:

* **0**: Command completed successfully
* **1**: Command failed with an error

This allows for easy integration with CI/CD pipelines and scripts.

## Error Handling

When errors occur, the CLI provides detailed error messages to help diagnose issues:

```shellscript theme={null}
✖ Error: Invalid target "invalid" for platform "mac". 
  Supported targets: dmg, app, pkg
```

<Tip>
  Always read error messages carefully, they often include suggestions for fixing the issue.
</Tip>
