-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild_docs.sh
More file actions
executable file
·64 lines (51 loc) · 1.83 KB
/
Copy pathbuild_docs.sh
File metadata and controls
executable file
·64 lines (51 loc) · 1.83 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
#!/bin/bash
# Script to build Code Keeper Bot documentation
# Usage: ./build_docs.sh
set -e
echo "🔨 Building Code Keeper Bot API Documentation..."
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if Sphinx is installed
if ! command -v sphinx-build &> /dev/null; then
echo -e "${YELLOW}⚠️ Sphinx not found. Installing...${NC}"
# Install full docs requirements (includes mermaid + MyST)
pip install --user -r docs/requirements.txt || pip install --break-system-packages -r docs/requirements.txt
# Add local user bin to PATH for current process if needed
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
fi
# Navigate to docs directory
cd docs
# Clean previous build
echo "🧹 Cleaning previous build..."
rm -rf _build
# Build HTML documentation
echo "📚 Building HTML documentation..."
if ! command -v sphinx-build &> /dev/null; then
echo -e "${YELLOW}Trying sphinx-build from user bin...${NC}"
fi
"$(command -v sphinx-build)" -b html . _build/html -W --keep-going -q
# Check if build was successful
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ Documentation built successfully!${NC}"
echo -e "${GREEN}📂 Documentation available at: docs/_build/html/index.html${NC}"
# Optional: Open in browser
if command -v xdg-open &> /dev/null; then
read -p "Open documentation in browser? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
xdg-open _build/html/index.html
fi
fi
else
echo -e "${RED}❌ Documentation build failed!${NC}"
exit 1
fi
# Generate API documentation from source
echo "🔄 Updating API documentation..."
sphinx-apidoc -o api -f -e -M ../ ../tests ../docs ../.* 2>/dev/null || true
echo -e "${GREEN}✨ Documentation generation complete!${NC}"