Skip to main content

Docs Code Validation

The praisonai docs command extracts and validates Python code blocks from your Mintlify documentation, ensuring all examples are runnable and correct.

Quick Start

Commands

praisonai docs run

Extracts Python code blocks from documentation, classifies them as runnable or partial, executes runnable blocks, and generates reports.
Options: Examples:

--dry-run preview mode

Use --dry-run to see exactly what docs run would execute — no subprocesses, no API calls, no cost.
Every discovered runnable block is written to the report with:
  • status: not_run
  • skip_reason: "Dry run"
  • The runnable_decision field the classifier assigned (so you can audit which blocks would have run)
Dry-run does not validate that code executes correctly — it only proves that the runner sees the block and classifies it as runnable. Use it as a fast preview before a real run, or in PRs to confirm no new blocks were unintentionally added or removed.

When to use --dry-run

Choose between --dry-run, --mode strict, and the default lenient run: Contributor opening a docs PR — add an .mdx file with a Python block, run praisonai docs run --dry-run --docs-path ./docs, confirm the new block is classified not_run with skip_reason: "Dry run", then push so CI runs the full suite. Maintainer auditing a large docs tree — run praisonai docs run --dry-run --report-dir ./audit, then filter report.csv for status=not_run to see the full inventory of runnable blocks — no cost, no LLM waiting. CI PR-preview job — on PR events, call praisonai docs run --dry-run and upload report.md as an artifact so reviewers see what a real run would attempt without spending API tokens. Example: preview before a real run

praisonai docs list

Lists all discovered code blocks without executing them.
Options: Examples:

Code Block Classification

The system classifies each Python code block as:

Terminal Actions Detected

  • agents.start() / agent.start()
  • print()
  • asyncio.run()
  • if __name__ == "__main__":

Directives

Control execution behavior with HTML comments above code blocks:
reports/docs/[timestamp]/ ├── report.json # Machine-readable results ├── report.md # Human-readable summary ├── report.csv # CSV for quick scanning/filtering └── logs/ ├── quickstart__0.stdout.log └── quickstart__0.stderr.log
skip_reason: "Dry run" identifies items that were only previewed. Other not_run items come from runnable=false directives or lenient-mode classification.

CI/CD Integration

Add to your GitHub Actions workflow:
Pull-request preview (no API keys required):

praisonai docs run-all

Runs all documentation code blocks group-by-group with parallel execution by default.
Options: Examples:

praisonai docs stats

Shows statistics for documentation code blocks by group.
Options:

Exit Codes

In strict mode (--mode strict), exit code 1 is also returned if any blocks are marked as not_run.

CLI Command Validation

The praisonai docs cli subcommand group validates CLI commands found in bash code blocks within documentation. It discovers praisonai commands and validates them by running with --help to ensure they exist and work correctly.

Quick Start

praisonai docs cli run-all

Validates all CLI commands from documentation by running each with --help.
Options: Examples:

praisonai docs cli list

Lists all discovered CLI commands from documentation without executing them.
Options: Examples:

praisonai docs cli stats

Shows statistics for CLI commands found in documentation.
Options: Example Output:

praisonai docs cli report

View CLI validation report with failures and error grouping.
Options: Examples:

Command Classification

CLI commands are classified as:

Placeholder Detection

Commands are automatically skipped if they contain:
  • [OPTIONS] or [...]
  • <file>, <name>, <path> style placeholders
  • path/to/, /my/project/ style example paths
  • your_, example_ prefixed values

CI/CD Integration for CLI Validation

Add to your GitHub Actions workflow: