---
title: "CLI"
description: "WPNuxt command-line tools for scaffolding and diagnostics"
canonical_url: "https://wpnuxt.com/reference/cli"
---
# CLI

> WPNuxt command-line tools for scaffolding and diagnostics

The WPNuxt CLI (`wpnuxi`) helps you create new projects, inspect your environment, and diagnose common issues.

## Installation

The CLI is available as a standalone package or via `npm create`:

<code-group>

```bash [npx (no install)]
npx wpnuxi <command>
```

```bash [Global install]
npm install -g wpnuxi
```

</code-group>

## Commands

### `wpnuxi init`

Scaffold a new WPNuxt project from the starter template.

```bash
npx wpnuxi init [directory]
```

When run without arguments, the CLI interactively prompts you for:

- **Project name** — directory to create (defaults to `my-wpnuxt-app`)
- **WordPress URL** — your WordPress site URL (defaults to `http://127.0.0.1:9400`)
- **Package manager** — pnpm, npm, yarn, or bun (auto-detects from current project)
- **Initialize git** — whether to create a git repository with an initial commit

When a directory argument is provided (e.g. `npx wpnuxi init my-blog`), the project name prompt is skipped and git is initialized automatically (use `--skip-git` to disable).

After scaffolding, it installs dependencies and writes a `.env` file with your WordPress URL.

#### Options

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --wordpress-url
      </code>
      
      , <code>
        -w
      </code>
    </td>
    
    <td>
      WordPress site URL (skips prompt)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --pm
      </code>
    </td>
    
    <td>
      Package manager: npm, pnpm, yarn, or bun (skips prompt)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --skip-install
      </code>
    </td>
    
    <td>
      Skip dependency installation
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --skip-git
      </code>
    </td>
    
    <td>
      Skip git initialization
    </td>
  </tr>
</tbody>
</table>

#### Example

```bash
npx wpnuxi init my-blog
```

This is equivalent to running `npm create wpnuxt@latest` — both use the same starter template.

---

### `wpnuxi info`

Display environment and project information. Useful when reporting issues.

```bash
npx wpnuxi info
```

#### Example Output

```text
WPNuxt Project Info

  OS                darwin arm64
  Node.js           v22.14.0
  Package Manager   pnpm
  @wpnuxt/core      ^2.0.0
  nuxt              ^4.3.1
  @nuxt/ui           ^3.1.0
  WordPress URL     https://wordpress.wpnuxt.com
  GraphQL Endpoint  https://wordpress.wpnuxt.com/graphql
```

The command reads `package.json` for dependency versions and `.env` for the WordPress URL. Package manager is detected from the lockfile (pnpm-lock.yaml, yarn.lock, bun.lockb, or package-lock.json).

#### Options

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --cwd <path>
      </code>
    </td>
    
    <td>
      Run in a different directory (defaults to current directory)
    </td>
  </tr>
</tbody>
</table>

---

### `wpnuxi doctor`

Run health checks on your WPNuxt project to diagnose common issues.

```bash
npx wpnuxi doctor
```

#### Checks Performed

<table>
<thead>
  <tr>
    <th>
      Check
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        .env has WPNUXT_WORDPRESS_URL
      </code>
    </td>
    
    <td>
      Critical
    </td>
    
    <td>
      Verifies the environment variable is set
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        WordPress URL is valid
      </code>
    </td>
    
    <td>
      Critical
    </td>
    
    <td>
      Checks the URL is a valid http/https URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GraphQL endpoint reachable
      </code>
    </td>
    
    <td>
      Critical
    </td>
    
    <td>
      Tests that the GraphQL endpoint responds
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        @wpnuxt/core in package.json
      </code>
    </td>
    
    <td>
      Critical
    </td>
    
    <td>
      Verifies the core package is a dependency
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt in package.json
      </code>
    </td>
    
    <td>
      Critical
    </td>
    
    <td>
      Verifies Nuxt is a dependency
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        WPGraphQL introspection enabled
      </code>
    </td>
    
    <td>
      Warning
    </td>
    
    <td>
      Checks that GraphQL introspection is enabled
    </td>
  </tr>
</tbody>
</table>

Critical checks that fail cause the command to exit with code 1. Non-critical checks show a warning but don't fail the command.

#### Options

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --cwd <path>
      </code>
    </td>
    
    <td>
      Run in a different directory (defaults to current directory)
    </td>
  </tr>
</tbody>
</table>

#### Example Output

```text
WPNuxt Doctor

  [PASS] .env has WPNUXT_WORDPRESS_URL
  [PASS] WordPress URL is valid
  [PASS] GraphQL endpoint reachable
  [PASS] WPGraphQL introspection enabled
  [PASS] @wpnuxt/core in package.json
  [PASS] nuxt in package.json

All critical checks passed.
```

## `npm create wpnuxt`

A convenience wrapper around `wpnuxi init`. These commands are equivalent:

```bash
npm create wpnuxt@latest
npx wpnuxi init
```


## Sitemap

See the full [sitemap](https://wpnuxt.com/sitemap.md) for all pages.
