Scripts
title: Documentation Validation Tools description: Deep usage guide for validate_docs.py including command classification, execution safety, and CI integration. search: boost: 0.6
Documentation Validation Tools¶
Consolidated reference docs live in
docs/developer-guide.mdanddocs/architecture.md. This README provides deep usage details for validation helper scripts (primarilyvalidate_docs.py).
This directory contains tools for validating the accuracy and cross-platform compatibility of documentation in the AIBugBench project.
validate_docs.py¶
A comprehensive validation script that automatically tests all documented commands across the AIBugBench project to ensure they work correctly on different platforms.
Features¶
- Automatic Command Detection: Scans all documentation files for command blocks
- Platform-Specific Execution: Runs commands appropriate for the current platform (Windows CMD, PowerShell, macOS/Linux)
- Safety First: Classifies commands by safety level and skips destructive operations
- Sandboxed Execution: Runs potentially file-modifying commands in isolated temporary directories
- Output Validation: Compares actual command output with documented expected results
- Comprehensive Reporting: Generates detailed reports with success/failure breakdown
- Cross-Platform Support: Works on Windows, macOS, and Linux
Command Classification¶
Commands are automatically classified into these safety levels:
- SAFE: Read-only commands (ls, dir, echo, python --version)
- SANDBOX: File-modifying commands that can be safely isolated (mkdir, cp, python scripts/bootstrap_repo.py)
- NETWORK: Commands that access network resources (git clone, curl, wget)
- DESTRUCTIVE: Potentially dangerous commands (rm -rf, format, shutdown) - skipped by default
Usage¶
Basic Usage¶
List documentation commands (no execution):
Scan only (alias legacy flag names):
Validate all safe commands:
Run with detailed output:
Advanced Options¶
Include potentially destructive commands (use with extreme caution):
Save validation report to file:
Specify custom project root:
Emit JSON summary (machine readable):
Command Line Options¶
--verbose, -v: Enable detailed logging output--list: List commands (caps at 50 for brevity) without execution--docs-only: Only scan for commands, don't execute them--dry-run: Alias for--docs-only(kept for familiarity)--skip-destructive: Skip potentially destructive commands (default: True)--no-skip-destructive: Run destructive commands (use with caution)--output, -o: Save validation report to specified file--project-root: Specify project root directory (auto-detected by default)--json: Emit JSON summary to stdout--json-file: Write JSON summary to a file (implies--json)
Example Output¶
...existing code...
Security Considerations¶
Incremental Refactor Note¶
Core parsing logic is being migrated into an importable package under validation/ (validation.docs_core). The script remains a thin CLI wrapper and will shrink over time as execution/reporting are modularized. External usage should import from validation for unit tests instead of invoking the script directly.
The validation script includes several safety measures:
- Destructive Command Detection: Automatically identifies and skips dangerous commands
- Sandboxed Execution: File-modifying commands run in temporary, isolated directories
- Timeout Protection: Commands are terminated after 30 seconds to prevent hangs
- Path Validation: Prevents execution outside of safe directories
- Tool Requirements: Verifies required tools are available before execution
Important: Never run the validation script with --no-skip-destructive on production systems or systems containing important data. Always test in isolated environments first.