-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_library_docs.sh
More file actions
executable file
·128 lines (101 loc) · 4.05 KB
/
generate_library_docs.sh
File metadata and controls
executable file
·128 lines (101 loc) · 4.05 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
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
################################################################################
# Generate Library Documentation for Robot Framework Libraries
#
# This script generates documentation for selected RF libraries:
# - Browser Library (Playwright-based web testing)
# - RequestsLibrary (HTTP API testing)
#
# Documentation is generated in multiple formats:
# - JSON: Machine-readable format for MCP tools
# - HTML: Human-readable format for browsers
# - XML: Libspec format for tooling integration
################################################################################
set -euo pipefail
DOCS_DIR="/app/docs"
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
echo "=================================="
echo "RF Library Documentation Generator"
echo "=================================="
echo "Started: ${TIMESTAMP}"
echo ""
# Create docs directory if it doesn't exist
mkdir -p "${DOCS_DIR}"
# Function to generate documentation for a library
generate_docs() {
local library_name="$1"
local display_name="$2"
echo "📚 Generating documentation for ${display_name}..."
# Generate JSON format (machine-readable for MCP)
if python -m robot.libdoc "${library_name}" "${DOCS_DIR}/${library_name}.json" 2>/dev/null; then
echo " ✅ JSON: ${DOCS_DIR}/${library_name}.json"
else
echo " ⚠️ JSON generation failed for ${library_name}"
fi
# Generate HTML format (human-readable)
if python -m robot.libdoc "${library_name}" "${DOCS_DIR}/${library_name}.html" 2>/dev/null; then
echo " ✅ HTML: ${DOCS_DIR}/${library_name}.html"
else
echo " ⚠️ HTML generation failed for ${library_name}"
fi
# Generate XML/Libspec format (tooling integration)
if python -m robot.libdoc "${library_name}" "${DOCS_DIR}/${library_name}.xml" 2>/dev/null; then
echo " ✅ XML: ${DOCS_DIR}/${library_name}.xml"
else
echo " ⚠️ XML generation failed for ${library_name}"
fi
echo ""
}
# Generate documentation for each library
generate_docs "Browser" "Browser Library (Playwright)"
generate_docs "RequestsLibrary" "Requests Library (HTTP/REST)"
# Generate summary file
cat > "${DOCS_DIR}/README.md" << 'EOF'
# Robot Framework Library Documentation
This directory contains auto-generated documentation for all installed RF libraries.
## Available Libraries
### Browser Library (Playwright-based)
- **Version**: 19.12.3
- **Purpose**: Web browser automation using Playwright
- **Documentation**:
- [Browser.html](Browser.html) - Human-readable HTML
- [Browser.json](Browser.json) - Machine-readable JSON
- [Browser.xml](Browser.xml) - Libspec XML format
### RequestsLibrary
- **Version**: 0.9.7
- **Purpose**: HTTP/REST API testing
- **Documentation**:
- [RequestsLibrary.html](RequestsLibrary.html) - Human-readable HTML
- [RequestsLibrary.json](RequestsLibrary.json) - Machine-readable JSON
- [RequestsLibrary.xml](RequestsLibrary.xml) - Libspec XML format
## Formats Explained
- **HTML**: Open in browser for browsing keywords, arguments, and examples
- **JSON**: Used by MCP tools and IDEs for code completion
- **XML**: Libspec format for Robot Framework tooling integration
## Usage
### View in Browser
```bash
# From host machine (if docs are mounted)
open robot_results/docs/Browser.html
# Or serve from container
python -m http.server 8080 --directory /app/docs
```
### Query via MCP
The rf-docs-mcp server can now query these generated docs for up-to-date library information.
### Use in IDE
IDEs like VS Code with Robot Framework extensions can use the XML libspec files for autocomplete.
## Regenerate Documentation
To regenerate documentation (e.g., after library updates):
```bash
docker exec rf-docs-mcp /app/generate_library_docs.sh
```
EOF
# List all generated files with sizes
echo "📦 Generated Documentation Files:"
echo ""
ls -lh "${DOCS_DIR}" | tail -n +2 | awk '{printf " %s %s\n", $5, $9}'
echo ""
echo "=================================="
echo "Documentation generation complete!"
echo "Location: ${DOCS_DIR}"
echo "=================================="