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

# Standardise

> Documentation and examples standardisation (FDEP) CLI commands

## Overview

The `standardise` command provides tools for managing documentation and examples consistency across the PraisonAI project. It implements the Feature Docs/Examples Protocol (FDEP) to ensure all features have proper documentation and examples.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
flowchart LR
    subgraph Check
        A[Scan Features] --> B[Validate Artifacts]
        B --> C[Detect Duplicates]
        C --> D[Generate Report]
    end
    
    subgraph Fix
        E[Identify Missing] --> F[Generate Templates]
        F --> G[Apply Changes]
    end
    
    subgraph AI
        H[Gather Context] --> I[Generate with LLM]
        I --> J[Verify Quality]
        J --> K[Write Files]
    end
    
    style A fill:#189AB4,color:#fff
    style E fill:#2E8B57,color:#fff
    style H fill:#8B0000,color:#fff
```

## Commands

### Check

Check for standardisation issues without making changes.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise check [OPTIONS]
```

**Options:**

| Option         | Type   | Default | Description                          |
| -------------- | ------ | ------- | ------------------------------------ |
| `--path`, `-p` | string | `.`     | Project root path                    |
| `--feature`    | string | -       | Specific feature slug to check       |
| `--scope`      | choice | `all`   | Scope: all, docs, examples, sdk, cli |
| `--ci`         | flag   | false   | CI mode with exit codes              |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Check all features
praisonai standardise check

# Check specific feature
praisonai standardise check --feature guardrails

# CI mode (returns exit code 1 if issues found)
praisonai standardise check --ci
```

### Report

Generate a detailed standardisation report.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise report [OPTIONS]
```

**Options:**

| Option           | Type   | Default | Description                  |
| ---------------- | ------ | ------- | ---------------------------- |
| `--path`, `-p`   | string | `.`     | Project root path            |
| `--format`, `-f` | choice | `text`  | Format: text, json, markdown |
| `--output`, `-o` | string | -       | Output file path             |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Text report to stdout
praisonai standardise report

# Markdown report to file
praisonai standardise report --format markdown --output report.md

# JSON report for automation
praisonai standardise report --format json
```

### Fix

Fix standardisation issues by creating missing artifacts.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise fix [OPTIONS]
```

**Options:**

| Option         | Type   | Default | Description                               |
| -------------- | ------ | ------- | ----------------------------------------- |
| `--path`, `-p` | string | `.`     | Project root path                         |
| `--feature`    | string | -       | Specific feature slug to fix              |
| `--apply`      | flag   | false   | Actually apply changes (default: dry-run) |
| `--no-backup`  | flag   | false   | Don't create backups                      |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Preview what would be fixed (dry-run)
praisonai standardise fix --feature guardrails

# Actually apply fixes
praisonai standardise fix --feature guardrails --apply
```

### Init

Initialise a new feature with all required artifacts.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise init FEATURE [OPTIONS]
```

**Arguments:**

| Argument  | Description                |
| --------- | -------------------------- |
| `FEATURE` | Feature slug to initialise |

**Options:**

| Option         | Type   | Default | Description           |
| -------------- | ------ | ------- | --------------------- |
| `--path`, `-p` | string | `.`     | Project root path     |
| `--apply`      | flag   | false   | Actually create files |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Preview what would be created
praisonai standardise init my-feature

# Create the files
praisonai standardise init my-feature --apply
```

### AI

AI-powered generation of documentation and examples using LLM.

<Note>
  **Real, Runnable Examples**: The AI generator creates actual working code, not templates.
  Examples are verified by execution before being written - if the code doesn't run, it won't be saved.
</Note>

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise ai FEATURE [OPTIONS]
```

**Arguments:**

| Argument  | Description                          |
| --------- | ------------------------------------ |
| `FEATURE` | Feature slug to generate content for |

**Options:**

| Option         | Type   | Default       | Description                  |
| -------------- | ------ | ------------- | ---------------------------- |
| `--type`, `-t` | choice | `all`         | Type: docs, examples, all    |
| `--apply`      | flag   | false         | Actually create files        |
| `--verify`     | flag   | false         | Additional AI content review |
| `--model`      | string | `gpt-4o-mini` | LLM model to use             |
| `--path`, `-p` | string | `.`           | Project root path            |

**Features:**

* **Real Examples**: Generates working code with mock data, not placeholder templates
* **Execution Verification**: Examples are run before writing to ensure they work
* **Auto-Retry**: If code fails, the AI attempts to fix it (up to 2 retries)
* **External Library Handling**: Examples requiring external libraries are marked but still saved

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Preview AI-generated docs
praisonai standardise ai guardrails --type docs

# Generate and apply examples with verification
praisonai standardise ai guardrails --type examples --apply --verify

# Use a different model
praisonai standardise ai guardrails --model gpt-4o --apply
```

**Verification Output:**

```
📝 Generating example_basic...
  ✅ Code verified: runs successfully
  ✓ Created: examples/guardrails/guardrails-basic.py

📝 Generating example_advanced...
  ✅ Code verified: runs successfully
  ✓ Created: examples/guardrails/guardrails-advanced.py
```

### Checkpoint

Create an undo checkpoint before making changes.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise checkpoint [OPTIONS]
```

**Options:**

| Option            | Type   | Default | Description        |
| ----------------- | ------ | ------- | ------------------ |
| `--message`, `-m` | string | -       | Checkpoint message |
| `--path`, `-p`    | string | `.`     | Repository path    |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Create checkpoint with message
praisonai standardise checkpoint -m "Before AI generation"
```

### Undo

Undo to a previous checkpoint.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise undo [OPTIONS]
```

**Options:**

| Option         | Type   | Default | Description                |
| -------------- | ------ | ------- | -------------------------- |
| `--checkpoint` | string | -       | Specific checkpoint ID     |
| `--list`       | flag   | false   | List available checkpoints |
| `--path`, `-p` | string | `.`     | Repository path            |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# List available checkpoints
praisonai standardise undo --list

# Undo to specific checkpoint
praisonai standardise undo --checkpoint standardise-checkpoint-20240101-120000

# Undo to previous checkpoint
praisonai standardise undo
```

### Redo

Redo after an undo operation.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise redo [OPTIONS]
```

**Options:**

| Option         | Type   | Default | Description     |
| -------------- | ------ | ------- | --------------- |
| `--path`, `-p` | string | `.`     | Repository path |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai standardise redo
```

## Workflow Example

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 1. Check current state
praisonai standardise check

# 2. Create checkpoint before changes
praisonai standardise checkpoint -m "Before standardisation"

# 3. Generate missing examples with AI
praisonai standardise ai guardrails --type examples --apply --verify

# 4. If something went wrong, undo
praisonai standardise undo

# 5. Generate report for documentation
praisonai standardise report --format markdown --output STANDARDISATION.md
```

## Exit Codes

When using `--ci` mode:

| Code | Meaning             |
| ---- | ------------------- |
| 0    | No issues found     |
| 1    | Issues found        |
| 2    | Error running check |

## See Also

* [Documentation Guide](/docs/guides/documentation)
* [Examples Guide](/docs/guides/examples)
* [Contributing](/docs/contributing)
