Files
loc_az_hci/scripts/docs/update-diagrams.sh
defiQUG c39465c2bd
Some checks failed
Test / test (push) Has been cancelled
Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 09:04:46 -08:00

58 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
source ~/.bashrc
# Update Diagrams
# Regenerates diagrams from source files (if using Mermaid or similar)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
DIAGRAMS_DIR="$PROJECT_ROOT/diagrams"
DOCS_DIR="$PROJECT_ROOT/docs"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
check_diagrams() {
log_info "Checking for diagram source files..."
if [ ! -d "$DIAGRAMS_DIR" ]; then
log_warn "Diagrams directory not found: $DIAGRAMS_DIR"
return 0
fi
local diagram_count=0
while IFS= read -r -d '' file; do
diagram_count=$((diagram_count + 1))
log_info "Found diagram: $(basename "$file")"
done < <(find "$DIAGRAMS_DIR" -name "*.mmd" -o -name "*.mermaid" -type f -print0 2>/dev/null)
if [ $diagram_count -eq 0 ]; then
log_warn "No diagram source files found"
else
log_info "Found $diagram_count diagram source file(s)"
log_info "To render diagrams, use Mermaid CLI or online editor"
log_info "Mermaid CLI: npm install -g @mermaid-js/mermaid-cli"
log_info "Then run: mmdc -i diagram.mmd -o diagram.png"
fi
}
main() {
log_info "Updating diagrams..."
check_diagrams
log_info "Done!"
}
main "$@"