Files
CTO/generate-progress-dashboard.sh
ReachableCEO 04a410d8cf Implement Phase 2 enhancements: git-native integration, testing, and progress tracking
MAJOR ENHANCEMENTS DELIVERED:

 Point 2 - Integration Automation:
- Git-native auto-merge using post-commit hooks (preferred over workflows)
- Automatic INTEGRATION-WIP merging on every feature branch commit
- Conflict handling with graceful error messages
- No dependency on Gitea Actions or external runners

 Point 4 - Bootstrap Testing Framework:
- Comprehensive 8-test validation suite (test-bootstrap.sh)
- Tests template files, git setup, branch creation, placeholders
- Validates AI agent instructions and automation scripts
- Color-coded output with detailed failure diagnostics

 Point 5 - Progress Dashboard System:
- Real-time HTML dashboard generation (generate-progress-dashboard.sh)
- Metrics collection from git history and worklog files
- Visual health scoring and activity tracking
- Mobile-responsive design for CTO oversight

PLATFORM UPDATES:
- Updated mental model: Gitea-exclusive (GitHub/GitLab banned)
- Removed all non-Gitea references from scripts and docs
- Simplified automation to git-native approach (user preference)
- Added PLATFORM-REQUIREMENTS.md to document constraints

TODO TRACKING SYSTEM:
- Comprehensive TODO.md (human-readable) with Phase 2/3 roadmap
- TODO-LLM.md (AI-optimized) for quick reference
- Detailed implementation priorities and success metrics
- Complete enhancement backlog organization

RETROSPECTIVE DOCUMENTATION:
- RETROSPECTIVE.md (human) - Complete project analysis
- RETROSPECTIVE-LLM.md (AI) - Concise summary for agents
- Comprehensive review of entire conversation and deliverables
- Future enhancement roadmap with prioritized improvements

Ready for Phase 2 implementation with production-ready Phase 1 foundation.
2025-09-05 08:03:48 -05:00

328 lines
11 KiB
Bash
Executable File

#!/bin/bash
# CTO AI Delegation - Progress Dashboard Generator
# Analyzes git history and worklog files to create visual progress dashboard
set -e
# Configuration
DASHBOARD_DIR="docs/dashboard"
OUTPUT_FILE="$DASHBOARD_DIR/index.html"
DATA_FILE="$DASHBOARD_DIR/metrics.json"
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${BLUE}🔧 CTO AI Delegation - Progress Dashboard Generator${NC}"
echo "================================================="
# Validate git repository
if [ ! -d ".git" ]; then
echo "❌ Error: Not in a git repository"
exit 1
fi
# Create dashboard directory
mkdir -p "$DASHBOARD_DIR"
# Collect metrics
collect_metrics() {
echo "📊 Collecting project metrics..."
# Git metrics
local total_commits=$(git rev-list --all --count 2>/dev/null || echo "0")
local total_branches=$(git branch -a | grep -v HEAD | wc -l)
local feature_branches=$(git branch | grep -c "feature/" || echo "0")
local last_commit_date=$(git log -1 --format="%cd" --date=short 2>/dev/null || echo "N/A")
local repo_age_days=$(git log --reverse --format="%cd" --date=short | head -1 | xargs -I {} date -d {} +%s 2>/dev/null | xargs -I {} echo $(($(date +%s) - {}) / 86400)) || echo "0")
# Milestone metrics
local total_tags=$(git tag | wc -l)
local recent_tags=$(git tag --sort=-creatordate | head -5 | tr '\n' ',' | sed 's/,$//')
# Integration metrics
local integration_commits=$(git log --oneline INTEGRATION-WIP 2>/dev/null | grep -c "Auto-Integration" || echo "0")
local bootstrap_complete=$(git tag | grep -c "bootstrap" || echo "0")
# Worklog analysis
local worklog_entries=$(grep -c "SESSION:" docs/WORKLOG-LLM.md 2>/dev/null || echo "0")
local current_status=$(grep "STATUS:" docs/WORKLOG-LLM.md 2>/dev/null | head -1 | cut -d':' -f2 | xargs || echo "Unknown")
# Health score calculation (0-100)
local health_score=0
[ "$bootstrap_complete" -gt 0 ] && health_score=$((health_score + 25))
[ "$total_commits" -gt 5 ] && health_score=$((health_score + 25))
[ "$feature_branches" -gt 0 ] && health_score=$((health_score + 25))
[ "$integration_commits" -gt 0 ] && health_score=$((health_score + 25))
# Generate JSON data
cat > "$DATA_FILE" << EOF
{
"generated": "$(date -u '+%Y-%m-%d %H:%M:%S UTC')",
"project": {
"health_score": $health_score,
"status": "$current_status",
"repository_age_days": $repo_age_days
},
"git_metrics": {
"total_commits": $total_commits,
"total_branches": $total_branches,
"feature_branches": $feature_branches,
"last_commit_date": "$last_commit_date"
},
"milestones": {
"total_tags": $total_tags,
"recent_tags": "$recent_tags",
"bootstrap_complete": $bootstrap_complete
},
"integration": {
"auto_integrations": $integration_commits,
"integration_rate": $(( integration_commits > 0 ? (integration_commits * 100) / total_commits : 0 ))
},
"activity": {
"worklog_entries": $worklog_entries,
"avg_commits_per_day": $(( repo_age_days > 0 ? total_commits / repo_age_days : 0 ))
}
}
EOF
echo "✅ Metrics collected and saved to $DATA_FILE"
}
# Generate HTML dashboard
generate_dashboard() {
echo "🎨 Generating HTML dashboard..."
# Read metrics
local health_score=$(grep -o '"health_score": [0-9]*' "$DATA_FILE" | cut -d':' -f2 | xargs)
local total_commits=$(grep -o '"total_commits": [0-9]*' "$DATA_FILE" | cut -d':' -f2 | xargs)
local feature_branches=$(grep -o '"feature_branches": [0-9]*' "$DATA_FILE" | cut -d':' -f2 | xargs)
local total_tags=$(grep -o '"total_tags": [0-9]*' "$DATA_FILE" | cut -d':' -f2 | xargs)
local integration_rate=$(grep -o '"integration_rate": [0-9]*' "$DATA_FILE" | cut -d':' -f2 | xargs)
local last_commit=$(grep -o '"last_commit_date": "[^"]*"' "$DATA_FILE" | cut -d'"' -f4)
local status=$(grep -o '"status": "[^"]*"' "$DATA_FILE" | cut -d'"' -f4)
# Health score color
local health_color="red"
[ "$health_score" -gt 50 ] && health_color="orange"
[ "$health_score" -gt 75 ] && health_color="green"
# Generate HTML
cat > "$OUTPUT_FILE" << EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CTO AI Delegation - Progress Dashboard</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 20px;
background-color: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 10px;
padding: 30px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.header {
text-align: center;
margin-bottom: 40px;
border-bottom: 2px solid #eee;
padding-bottom: 20px;
}
.header h1 {
color: #333;
margin: 0;
}
.header .subtitle {
color: #666;
margin-top: 10px;
}
.metrics-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.metric-card {
background: #f9f9f9;
border-radius: 8px;
padding: 20px;
text-align: center;
border-left: 4px solid #007acc;
}
.metric-value {
font-size: 2em;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.metric-label {
color: #666;
font-size: 0.9em;
}
.health-score {
font-size: 3em;
font-weight: bold;
color: $health_color;
}
.status-section {
background: #e8f4f8;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
}
.status-current {
font-size: 1.2em;
color: #007acc;
font-weight: bold;
}
.timestamp {
color: #999;
font-size: 0.8em;
text-align: center;
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.section-title {
color: #333;
border-bottom: 2px solid #007acc;
padding-bottom: 5px;
margin-bottom: 15px;
}
@media (max-width: 768px) {
.metrics-grid {
grid-template-columns: 1fr;
}
.container {
padding: 15px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🤖 CTO AI Delegation Dashboard</h1>
<div class="subtitle">Real-time progress tracking for AI development sessions</div>
</div>
<div class="status-section">
<h3 class="section-title">📊 Project Health</h3>
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;">
<div>
<div class="health-score">$health_score%</div>
<div>Overall Health Score</div>
</div>
<div style="text-align: right;">
<div class="status-current">$status</div>
<div style="color: #666;">Current Status</div>
</div>
</div>
</div>
<div class="metrics-grid">
<div class="metric-card">
<div class="metric-value">$total_commits</div>
<div class="metric-label">Total Commits</div>
</div>
<div class="metric-card">
<div class="metric-value">$feature_branches</div>
<div class="metric-label">Feature Branches</div>
</div>
<div class="metric-card">
<div class="metric-value">$total_tags</div>
<div class="metric-label">Milestones Tagged</div>
</div>
<div class="metric-card">
<div class="metric-value">$integration_rate%</div>
<div class="metric-label">Integration Success Rate</div>
</div>
</div>
<div class="status-section">
<h3 class="section-title">📅 Recent Activity</h3>
<p><strong>Last Commit:</strong> $last_commit</p>
<p><strong>Integration Status:</strong> $([ "$integration_rate" -gt 80 ] && echo "✅ Excellent" || echo "⚠️ Needs Attention")</p>
<p><strong>AI Agent Activity:</strong> $([ "$total_commits" -gt 0 ] && echo "Active" || echo "Inactive")</p>
</div>
<div class="status-section">
<h3 class="section-title">🎯 Quick Actions</h3>
<ul>
<li><strong>View Current Work:</strong> <code>cat docs/CURRENTWORK-LLM.md</code></li>
<li><strong>Check Integration:</strong> <code>git log --oneline INTEGRATION-WIP</code></li>
<li><strong>Review Milestones:</strong> <code>git tag -n</code></li>
<li><strong>Update Dashboard:</strong> <code>./generate-progress-dashboard.sh</code></li>
</ul>
</div>
<div class="timestamp">
Dashboard generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')<br>
🤖 CTO AI Delegation Framework - Automatic Progress Tracking
</div>
</div>
</body>
</html>
EOF
echo "✅ Dashboard generated: $OUTPUT_FILE"
}
# Main execution
main() {
local mode="${1:-full}"
case "$mode" in
"--quick-update"|"--auto-update")
echo "🔄 Quick dashboard update..."
collect_metrics
generate_dashboard
;;
"--full-report"|"--full")
echo "📋 Full dashboard report generation..."
collect_metrics
generate_dashboard
;;
"--check-sources")
echo "🔍 Checking data sources..."
[ -f "docs/WORKLOG-LLM.md" ] && echo "✅ WORKLOG-LLM.md found" || echo "⚠️ WORKLOG-LLM.md missing"
[ -f "docs/CURRENTWORK-LLM.md" ] && echo "✅ CURRENTWORK-LLM.md found" || echo "⚠️ CURRENTWORK-LLM.md missing"
[ -d ".git" ] && echo "✅ Git repository found" || echo "❌ Git repository missing"
;;
"--validate-metrics")
echo "🧪 Validating metrics..."
collect_metrics
echo "📊 Metrics validation complete"
;;
*)
collect_metrics
generate_dashboard
;;
esac
echo ""
echo -e "${GREEN}🎯 Progress Dashboard Ready!${NC}"
echo -e "📁 Dashboard: $OUTPUT_FILE"
echo -e "📊 Metrics: $DATA_FILE"
echo ""
echo -e "${YELLOW}💡 View dashboard:${NC}"
echo -e " Open $OUTPUT_FILE in your browser"
echo -e " Or run: open $OUTPUT_FILE"
}
# Execute main function
main "$@"