This validation layer helps identify documentation gaps without blocking development. It's designed to be run periodically to track documentation health.
# Using pnpm
pnpm run validate:docs
# Using npm
npm run validate:docs
# Direct execution
node scripts/validate-docs.jsOutput: Generates DOCS_VALIDATION_REPORT.md in the repository root.
Look for these key metrics:
- Total Features Inventoried: How many features were scanned
- Fully/Partially/Missing Documentation: Coverage breakdown
- Completeness Issues: Number of docs missing required sections
- Consistency Issues: Broken commands or invalid paths (should be 0)
Check all items should be ✅ ADEQUATE:
- Production Build Steps
- CI/CD Pipeline Documentation
- Infrastructure Deployment
- Secret Management
- Monitoring & Alerting
- Upgrade/Migration Guide
- Disaster Recovery
- Performance Tuning
Section 2: Feature-to-Documentation Mapping
- Shows all features and their doc coverage
- Filter by
MISSINGto see undocumented features - Use suggested paths to create new docs
Section 6: Missing Documentation Checklist
- Ready-to-use checklist of missing docs
- Includes suggested filenames and locations
- Prioritized list for completion
- Add your feature code
- Run validation:
pnpm run validate:docs - Check report for your feature in Section 2
- If marked
MISSING, add documentation per Section 6 - Re-run validation to verify
- Run validation:
pnpm run validate:docs - Review Section 3 (Completeness Analysis)
- Pick a doc with HIGH severity
- Add missing sections listed
- Re-run to verify improvement
- Before release, run:
pnpm run validate:docs - Check Section 5 (Production Readiness)
- All items should be ✅ ADEQUATE
- If ❌ or
⚠️ , address before release - Review Section 7 (Recommendations) for priorities
Option 1: Manual runs (Recommended initially)
# Run before major releases
pnpm run validate:docsOption 2: CI Integration (Informational)
- name: Documentation Validation
run: pnpm run validate:docs
continue-on-error: true # Non-blocking
- name: Upload Report
uses: actions/upload-artifact@v3
with:
name: docs-validation-report
path: DOCS_VALIDATION_REPORT.mdOption 3: PR Comments
- name: Validate Docs
run: pnpm run validate:docs
continue-on-error: true
- name: Comment PR
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('DOCS_VALIDATION_REPORT.md', 'utf8');
const summary = report.split('## 1.')[0]; // Just executive summary
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: '## Documentation Validation\n\n' + summary
});- FULL: Feature is well-documented across multiple pages
- PARTIAL: Feature mentioned but needs more detail
- MISSING: No documentation found for feature
- HIGH: Missing 5+ required sections
- MEDIUM: Missing 2-4 required sections
- LOW: Missing 1 section
- BLOCKER: Must have for production (build, CI/CD, infra)
- IMPORTANT: Should have for operations (secrets, monitoring)
- OPTIONAL: Nice to have (performance tuning)
- Production Readiness all ✅ ADEQUATE
- Consistency Issues: 0
- Fully Documented > 50%
- Production Readiness has ❌ MISSING
- Consistency Issues > 0
- Missing Documentation > 50%
- Production Readiness has
⚠️ PARTIAL - Completeness Issues > 100
- Many HIGH severity docs
| Frequency | When | Who | Focus |
|---|---|---|---|
| Daily | During feature development | Developers | Check their new features |
| Weekly | During doc updates | Tech Writers | Complete missing sections |
| Sprint End | Before release planning | Team Leads | Review recommendations |
| Release | Before production deploy | Release Managers | Verify production readiness |
| Quarterly | Strategic planning | Product/Eng | Assess overall doc health |
-
Start with essentials:
- Purpose/overview (what it does)
- Basic usage (how to use it)
- Common issues (troubleshooting)
-
Add details progressively:
- Setup instructions
- Configuration options
- Advanced usage
- Security considerations
-
Link related docs:
- Reference other relevant pages
- Cross-link SDK/contracts/features
- Provide examples from real usage
-
Document as you code:
- Add basic README when creating feature
- Update docs when changing behavior
- Include examples in code comments
-
Use templates:
- Copy structure from well-documented features
- Follow the required sections checklist
- Maintain consistent style
-
Validate frequently:
- Run after completing each feature
- Check before committing docs
- Verify before PR approval
# Install pnpm globally
npm install -g pnpm@8.15.0
# Or use npm instead
npm run validate:docs# Check Node.js version (need >= 18.18.0)
node --version
# Run directly to see full errors
node scripts/validate-docs.js# Check write permissions
ls -la | grep DOCS_VALIDATION_REPORT.md
# Try running with explicit permissions
chmod +x scripts/validate-docs.js
node scripts/validate-docs.jsCurrently validates all features. To focus on specific areas:
# Run validation
pnpm run validate:docs
# Then search report for your feature
grep -A 5 "YourFeatureName" DOCS_VALIDATION_REPORT.md- Script Documentation: See
scripts/README.md - Implementation Details: See
VALIDATION_IMPLEMENTATION.md - Full Report: See
DOCS_VALIDATION_REPORT.md - Script Source: See
scripts/validate-docs.js
# You added a new contract: SuperToken.sol
# Run validation
pnpm run validate:docs
# Search report for SuperToken
# Result: "Contract: SuperToken | MISSING"
# Create documentation
# File: docs-site/tokens/super-token.mdx
# Include: purpose, architecture, usage, deployment
# Re-run validation
pnpm run validate:docs
# Now shows: "Contract: SuperToken | PARTIAL" or "FULL"# Check which docs need work
pnpm run validate:docs
# Look at Section 3: Completeness Analysis
# Pick a HIGH severity doc
# Example: agents/pricing-agents.mdx
# Missing: Setup/Installation, Environment Variables, Deployment
# Add those sections to the doc
# Verify improvement
pnpm run validate:docs
# Section 3 should show fewer missing sections# Before release, validate production readiness
pnpm run validate:docs
# Check Section 5: Production Readiness Assessment
# Ensure all BLOCKER items are ✅ ADEQUATE
# If any ❌ MISSING:
# - Review Section 6 for missing docs
# - Add critical documentation
# - Re-validate until all green
# Ready for release when all BLOCKER items ✅Q: Does this block builds or deployments?
A: No, it's purely informational. Non-blocking by design.
Q: How often should I run it?
A: Whenever you add/modify features or documentation.
Q: Can I customize what it checks?
A: Yes, edit scripts/validate-docs.js to add/remove checks.
Q: Where should I put new documentation?
A: The report suggests paths in Section 6.
Q: What if I disagree with findings?
A: The report is informational - use your judgment on priorities.
Q: Can this auto-generate documentation?
A: No, it only validates existing docs and suggests improvements.
Q: How do I track improvement over time?
A: Run periodically and compare the coverage statistics in the executive summary.
Need More Help? Review the comprehensive documentation:
scripts/README.md- Technical detailsVALIDATION_IMPLEMENTATION.md- Architecture and implementationDOCS_VALIDATION_REPORT.md- Latest validation results