---
title: "CLI"
description: "Command-line interface for managing runtime sync and IndexNow."
canonical_url: "https://nuxtseo.com/docs/ai-ready/guides/cli"
last_updated: "2026-05-06T18:43:54.489Z"
---

The `nuxt-ai-ready` CLI provides commands for managing runtime indexing and IndexNow sync from your terminal.

## Installation

The CLI is included with the module. Run it via npx:

```bash
npx nuxt-ai-ready <command>
```

Or add a script to your `package.json`:

```json [package.json]
{
  "scripts": {
    "ai-ready": "nuxt-ai-ready"
  }
}
```

## Authentication

The CLI automatically reads the secret from `node_modules/.cache/nuxt/ai-ready/secret`, which the module generates when you run `nuxi dev` or `nuxi build`.

<callout color="blue" icon="i-heroicons-information-circle">

Run `nuxi dev` or `nuxi build` at least once before using the CLI to generate the auth secret.

</callout>

## Commands

### status

Show indexing status and IndexNow sync progress.

```bash
npx nuxt-ai-ready status
npx nuxt-ai-ready status --url https://mysite.com
```

**Options:**

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Alias
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --url
      </code>
    </td>
    
    <td>
      <code>
        -u
      </code>
    </td>
    
    <td>
      <code>
        http://localhost:3000
      </code>
    </td>
    
    <td>
      Site URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      Working directory
    </td>
  </tr>
</tbody>
</table>

**Output:**

```text
AI Ready Status
Total pages: 50
Indexed: 45
Pending: 5

IndexNow:
  Pending: 10
  Total submitted: 500
  Last submitted: 2025-01-15T10:30:00.000Z
```

### poll

Trigger page indexing for pending pages.

```bash
# Index up to 10 pages (default)
npx nuxt-ai-ready poll

# Index up to 50 pages
npx nuxt-ai-ready poll --limit 50

# Index all pending pages
npx nuxt-ai-ready poll --all
```

**Options:**

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Alias
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --url
      </code>
    </td>
    
    <td>
      <code>
        -u
      </code>
    </td>
    
    <td>
      <code>
        http://localhost:3000
      </code>
    </td>
    
    <td>
      Site URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --limit
      </code>
    </td>
    
    <td>
      <code>
        -l
      </code>
    </td>
    
    <td>
      <code>
        10
      </code>
    </td>
    
    <td>
      Max pages to process
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --all
      </code>
    </td>
    
    <td>
      <code>
        -a
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Process all pending pages
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      Working directory
    </td>
  </tr>
</tbody>
</table>

**Output:**

```text
Triggering poll at http://localhost:3000...
Indexed: 20 pages
Remaining: 25
Duration: 1234ms
```

### restore

Restore database from prerendered dump. Useful for resetting to the build-time state.

```bash
# Restore and clear existing pages
npx nuxt-ai-ready restore

# Restore without clearing (merge)
npx nuxt-ai-ready restore --no-clear
```

**Options:**

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Alias
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --url
      </code>
    </td>
    
    <td>
      <code>
        -u
      </code>
    </td>
    
    <td>
      <code>
        http://localhost:3000
      </code>
    </td>
    
    <td>
      Site URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --clear
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Clear existing pages first
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      Working directory
    </td>
  </tr>
</tbody>
</table>

**Output:**

```text
Restoring database at http://localhost:3000...
Restored: 50 pages
Cleared: 45 existing pages
```

### prune

Remove stale routes that are no longer in the sitemap.

```bash
# Preview what would be pruned (dry run)
npx nuxt-ai-ready prune --dry

# Prune routes older than 7 days
npx nuxt-ai-ready prune --ttl 604800

# Preview with custom TTL
npx nuxt-ai-ready prune --dry --ttl 86400
```

**Options:**

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Alias
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --url
      </code>
    </td>
    
    <td>
      <code>
        -u
      </code>
    </td>
    
    <td>
      <code>
        http://localhost:3000
      </code>
    </td>
    
    <td>
      Site URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --dry
      </code>
    </td>
    
    <td>
      <code>
        -d
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Preview without deleting
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --ttl
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        pruneTtl
      </code>
      
       config
    </td>
    
    <td>
      Prune routes older than this (seconds)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      Working directory
    </td>
  </tr>
</tbody>
</table>

**Output (dry run):**

```text
Previewing stale routes at http://localhost:3000...
Would prune: 5 routes
  • /old-page-1
  • /old-page-2
  • /removed-feature
  ... and 2 more
```

### indexnow

Trigger IndexNow sync to notify search engines of changes.

```bash
# Submit up to 100 URLs (default)
npx nuxt-ai-ready indexnow

# Submit up to 500 URLs
npx nuxt-ai-ready indexnow --limit 500
```

**Options:**

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Alias
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --url
      </code>
    </td>
    
    <td>
      <code>
        -u
      </code>
    </td>
    
    <td>
      <code>
        http://localhost:3000
      </code>
    </td>
    
    <td>
      Site URL
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --limit
      </code>
    </td>
    
    <td>
      <code>
        -l
      </code>
    </td>
    
    <td>
      <code>
        100
      </code>
    </td>
    
    <td>
      Max URLs to submit
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      Working directory
    </td>
  </tr>
</tbody>
</table>

**Output:**

```text
Triggering IndexNow sync at http://localhost:3000...
Submitted: 50 URLs
Remaining: 150
```

## Workflow Examples

### Development Workflow

```bash
# Start dev server
nuxi dev

# In another terminal, check status
npx nuxt-ai-ready status

# Manually trigger indexing
npx nuxt-ai-ready poll --all
```

### Production Deployment

```bash
# After deployment, index all pages
npx nuxt-ai-ready poll --all --url https://mysite.com

# Notify search engines
npx nuxt-ai-ready indexnow --url https://mysite.com

# Clean up old routes weekly
npx nuxt-ai-ready prune --ttl 604800 --url https://mysite.com
```

### CI/CD Integration

Add to your deployment pipeline:

```yaml [.github/workflows/deploy.yml]
- name: Index pages
  run: npx nuxt-ai-ready poll --all --url ${{ vars.SITE_URL }}

- name: Notify search engines
  run: npx nuxt-ai-ready indexnow --url ${{ vars.SITE_URL }}
```

## Troubleshooting

### "No secret found" Error

The CLI needs an auth secret generated by the module. Run `nuxi dev` or `nuxi build` first:

```bash
nuxi dev
# or
nuxi build
```

### Connection Refused

Ensure the dev server or production site is running and accessible at the specified URL:

```bash
# Check if server is running
curl http://localhost:3000/__ai-ready/status
```

### Wrong Working Directory

If running from a different directory, specify `--cwd`:

```bash
npx nuxt-ai-ready status --cwd /path/to/project
```
