-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_docs.py
More file actions
118 lines (94 loc) · 4.03 KB
/
verify_docs.py
File metadata and controls
118 lines (94 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python3
import os
import re
import sys
def check_mermaid_diagrams(file_path):
"""Check if Mermaid diagrams are properly formatted in a file"""
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Find all Mermaid code blocks
mermaid_blocks = re.findall(r'```mermaid\s*([\s\S]*?)\s*```', content)
print(f"File: {file_path}")
print(f"Found {len(mermaid_blocks)} Mermaid diagrams")
# Check each diagram for basic syntax
for i, diagram in enumerate(mermaid_blocks):
lines = diagram.strip().split('\n')
if len(lines) < 2:
print(f" Warning: Diagram {i+1} appears to be empty or too short")
continue
diagram_type = lines[0].strip().split()[0] if lines else "unknown"
print(f" Diagram {i+1}: {diagram_type}")
# Check for common syntax issues
if diagram_type in ['graph', 'flowchart']:
nodes = re.findall(r'([A-Z][A-Z0-9]*)\[', diagram)
if len(nodes) == 0:
print(f" Warning: No nodes found")
print()
return len(mermaid_blocks)
except Exception as e:
print(f"Error reading {file_path}: {e}")
return 0
def check_roadmap_features(file_path):
"""Check if roadmap features are properly documented"""
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Look for roadmap sections
roadmap_sections = re.findall(r'##*\s*(.*?[Rr]oadmap.*?|.*?[Ff]uture.*?|.*?[Pp]lan.*?)\s*\n([\s\S]*?)(?=\n##|\Z)', content)
print(f"File: {file_path}")
print(f"Found {len(roadmap_sections)} roadmap/plan sections")
for section_title, section_content in roadmap_sections:
print(f" Section: {section_title.strip()}")
# Look for feature lists
feature_lists = re.findall(r'[-*]\s*\[.\]\s*(.+)', section_content)
if feature_lists:
print(f" Found {len(feature_lists)} features/plans")
for feature in feature_lists[:5]: # Show first 5
print(f" - {feature.strip()}")
if len(feature_lists) > 5:
print(f" ... and {len(feature_lists) - 5} more")
else:
print(" No feature list found")
print()
return len(roadmap_sections)
except Exception as e:
print(f"Error reading {file_path}: {e}")
return 0
def main():
"""Main verification function"""
print("=== Documentation Verification Script ===\n")
# Define files to check
doc_files = [
'README.md',
'docs/SYNESTHETIC_FRAMEWORK.md',
'docs/API_DOCS.md',
'docs/frontend-progress-state.md'
]
total_diagrams = 0
total_roadmaps = 0
# Check each documentation file
for doc_file in doc_files:
full_path = os.path.join(os.getcwd(), doc_file)
if os.path.exists(full_path):
print(f"--- Checking {doc_file} ---")
diagrams = check_mermaid_diagrams(full_path)
roadmaps = check_roadmap_features(full_path)
total_diagrams += diagrams
total_roadmaps += roadmaps
else:
print(f"File not found: {full_path}")
# Summary
print("=== Verification Summary ===")
print(f"Total Mermaid diagrams found: {total_diagrams}")
print(f"Total roadmap sections found: {total_roadmaps}")
if total_diagrams == 0:
print("\n⚠️ WARNING: No Mermaid diagrams found!")
else:
print(f"\n✅ Found {total_diagrams} Mermaid diagrams across documentation")
if total_roadmaps == 0:
print("⚠️ WARNING: No roadmap sections found!")
else:
print(f"✅ Found {total_roadmaps} roadmap sections across documentation")
if __name__ == "__main__":
main()