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

# CLI Commands Reference

> Reference for all Artisan commands provided by Geni.

## Overview

Geni registers a suite of Artisan console commands for exporting specifications, verifying drift, diagnosing unresolved types, running MCP servers, and managing cache.

## `geni:export`

Export the OpenAPI specification to a file on disk:

```bash theme={null}
php artisan geni:export {--path=openapi.json} {--api=}
```

### Options

* `--path`: Relative or absolute path where the JSON specification file will be written (default: `openapi.json`).
* `--api`: Name of a specific API version configured in `config('geni.apis')` to export. If omitted, exports the default root API.

***

## `geni:check`

Compare the current codebase against a committed specification file and exit with a non-zero status code if drift is detected:

```bash theme={null}
php artisan geni:check {--path=openapi.json} {--api=}
```

### Options

* `--path`: Path to the committed OpenAPI JSON specification file to compare against (default: `openapi.json`).
* `--api`: Name of a specific API version to check.

### Return Codes

* `0`: Specifications match exactly (accounting for canonicalized key ordering).
* `1`: Specifications differ; diff is printed to console.

***

## `geni:analyze`

Inspect all unresolved inference diagnostics across your application:

```bash theme={null}
php artisan geni:analyze {--json} {--api=}
```

### Options

* `--json`: Output diagnostics formatted as JSON instead of a formatted terminal table.
* `--api`: Analyze a specific named API version.

### Diagnostic Output Example

```text theme={null}
+-----------------------+------+----------------------------------------------------+
| File                  | Line | Reason                                             |
+-----------------------+------+----------------------------------------------------+
| app/Http/Orders.php   | 42   | Could not resolve route-model bound column status  |
| app/Http/Users.php    | 88   | Non-literal rules array passed to Validator::make  |
+-----------------------+------+----------------------------------------------------+
```

***

## `geni:mcp`

Generate a Model Context Protocol (MCP) tool manifest or client configuration snippet:

```bash theme={null}
php artisan geni:mcp {--path=} {--format=json} {--base-url=} {--api=}
```

### Options

* `--path`: Destination file path. If omitted, prints manifest output directly to standard output.
* `--format`: Output format. Supported options:
  * `json`: Standard MCP tool manifest.
  * `claude-desktop`: Ready-to-use `mcpServers` JSON block for `claude_desktop_config.json`.
* `--base-url`: Base URL used for HTTP tool execution. Defaults to `config('app.url')`.
* `--api`: Target a specific named API version.

***

## `geni:mcp:serve`

Start a live Model Context Protocol (MCP) stdio server responding to JSON-RPC protocol requests from AI desktop clients:

```bash theme={null}
php artisan geni:mcp:serve {--api=} {--base-url=} {--timeout=15}
```

### Options

* `--api`: Target a specific named API version.
* `--base-url`: Base URL for dispatched HTTP tool execution requests.
* `--timeout`: HTTP execution request timeout in seconds (default: 15).

***

## `geni:cache`

Pre-compute and cache the generated OpenAPI specification in your configured Laravel cache store:

```bash theme={null}
php artisan geni:cache {--api=}
```

When caching is enabled in `config('geni.cache.enabled')`, subsequent visits to `/docs/api.json` serve directly from cache with zero inference overhead.

***

## `geni:clear`

Clear the cached OpenAPI specification from your Laravel cache store:

```bash theme={null}
php artisan geni:clear {--api=}
```
