This directory contains tools for analyzing and maintaining WynIsBuff2's documentation quality.
File: doc-scanner.cjs
Fast, lightweight scanner that identifies obvious documentation issues:
- Outdated references (TODO, FIXME, deprecated, "in progress")
- Duplicate section titles across files
- Broken internal links
- Old datestamps
- Files without headers
- Empty or oversized files
Usage:
node scripts/doc-scanner.cjsOutput: doc-scan-report.json in project root
Runtime: ~2 seconds
File: document_structurer.py
Comprehensive documentation analysis with:
- Knowledge graph generation
- Token extraction and indexing
- Relationship mapping
- SQLite database for queries
- Network analysis (hubs, orphans, PageRank)
- Health scoring
- Actionable insights
Usage:
./scripts/doc-analysis.shOutput: doc-analysis/ directory with:
INSIGHTS.md- Health score and recommendationsSUMMARY.md- Statistics overviewdocuments.db- SQLite database for custom queriesknowledge_graph.json- Complete structured datatoken_frequency.csv- Most common terms
Runtime: ~30-60 seconds
File: query_docs.py
Query the documentation database for specific insights.
Common queries:
# Find orphaned files (no incoming links)
python3 scripts/query_docs.py --db doc-analysis/documents.db --orphaned
# Find most common tokens
python3 scripts/query_docs.py --db doc-analysis/documents.db --frequency --limit 50
# Find specific token usage
python3 scripts/query_docs.py --db doc-analysis/documents.db --token "BaseManager"
# Find TODOs/FIXMEs
python3 scripts/query_docs.py --db doc-analysis/documents.db --pattern "TODO|FIXME"
# Files with most content
python3 scripts/query_docs.py --db doc-analysis/documents.db --top-files --limit 20-
Run comprehensive analysis:
./scripts/doc-analysis.sh
-
Review insights:
cat doc-analysis/INSIGHTS.md
-
Identify priorities:
- Check health score (target: 80+)
- Review critical issues (broken links, orphans)
- Note duplication candidates
Weekly: Run quick scanner
node scripts/doc-scanner.cjsMonthly: Full analysis and compare against baseline
./scripts/doc-analysis.sh
# Review improvements/regressionsFind duplicate content:
python3 scripts/query_docs.py --db doc-analysis/documents.db --pattern "specific phrase"Track term usage:
python3 scripts/query_docs.py --db doc-analysis/documents.db --token "EventBus"Find navigation hubs:
# Most referenced files become natural navigation hubs
cat doc-analysis/INSIGHTS.md | grep -A 10 "Most Referenced"| Score | Status | Action Required |
|---|---|---|
| 80-100 | Excellent | Maintain |
| 60-79 | Good | Minor fixes |
| 40-59 | Fair | Improvement sprint |
| 0-39 | Poor | Immediate attention |
- Orphan Ratio: <20% ideal (files with no incoming links)
- Broken Links: Should be 0
- Stub Files: <50 lines - may need expansion
- Hub Files: Most referenced docs - good index candidates
Current state (from initial scan):
- 66 documentation files
- 534 KB total
- ~8 KB average file size
- Outdated markers: "TODO", "in progress", "deprecated"
- Missing headers: Some files lack structure
- Old dates: References to 2024
- Duplicated titles: Same section names across files
Based on CLAUDE.md principles:
- Direct language: No fluff, actionable content
- Development-focused: Useful for coding, not history
- Consolidated: No duplication, single source of truth
- Cross-referenced: Clear navigation paths
- Current: Remove outdated historical content
- Identify duplicates: Use query tool to find similar content
- Determine canonical source: Choose most current/complete version
- Merge content: Consolidate into single document
- Add cross-references: Link from deprecated to canonical
- Archive old files: Move to
docs/archive/with README - Update references: Fix any broken links
- Phase 1: Run full analysis (DONE)
- Phase 2: Review INSIGHTS.md and prioritize issues
- Phase 3: Create documentation architecture/index
- Phase 4: Consolidate duplicates
- Phase 5: Rewrite in direct, actionable language
- Phase 6: Add cross-references and navigation
- Phase 7: Validate against codebase
# Quick health check
node scripts/doc-scanner.cjs && cat doc-scan-report.json | jq '.stats'
# Full analysis
./scripts/doc-analysis.sh
# Find specific issues
python3 scripts/query_docs.py --db doc-analysis/documents.db --orphaned
python3 scripts/query_docs.py --db doc-analysis/documents.db --pattern "TODO"
# Export issues for tracking
python3 scripts/query_docs.py --db doc-analysis/documents.db --orphaned --export orphans.csv- Node.js 14+ (built-in modules only)
- Python 3.10+
ruamel.yaml- YAML parsingpython-hcl2- HCL/Terraform parsingnetworkx- Graph analysis
Automatically installed via doc-analysis.sh into isolated virtualenv.