|
| 1 | +#!/bin/bash |
| 2 | +# CommitVigil: THE ULTIMATE "GOD-MODE" DEMO 🛡️ |
| 3 | +# This script is the definitive showcase of the entire platform capability. |
| 4 | +API_URL="http://localhost:8000/api/v1" |
| 5 | +HEALTH_URL="http://localhost:8000/health" |
| 6 | +METRICS_URL="http://localhost:8000/metrics" |
| 7 | +API_KEY="my-secure-api-key-12345" |
| 8 | +USER_ID="dev_god" |
| 9 | +echo "----------------------------------------------------------------------" |
| 10 | +echo "🛡️ COMMITVIGIL: THE ULTIMATE PERFORMANCE INFRASTRUCTURE DEMO" |
| 11 | +echo "----------------------------------------------------------------------" |
| 12 | +# Helper for URL encoding |
| 13 | +urlencode() { |
| 14 | + python3 -c "import urllib.parse; print(urllib.parse.quote('''$1'''))" |
| 15 | +} |
| 16 | +# 1. Health & Resilience Check |
| 17 | +echo -e "\n🔍 [Phase 1] Resilience & Health Check..." |
| 18 | +MAX_RETRIES=10 |
| 19 | +RETRY_COUNT=0 |
| 20 | +while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do |
| 21 | + HEALTH=$(curl -s $HEALTH_URL | jq -r .status 2>/dev/null) |
| 22 | + if [[ "$HEALTH" == "ok" ]]; then |
| 23 | + echo "✅ API is Healthy and Ready." |
| 24 | + break |
| 25 | + fi |
| 26 | + echo "⏳ Waiting for API to be healthy... ($RETRY_COUNT/$MAX_RETRIES)" |
| 27 | + RETRY_COUNT=$((RETRY_COUNT + 1)) |
| 28 | + sleep 5 |
| 29 | +done |
| 30 | + |
| 31 | +if [[ "$HEALTH" != "ok" ]]; then |
| 32 | + echo "❌ API failed to become healthy. Please check 'docker compose logs'." |
| 33 | + exit 1 |
| 34 | +fi |
| 35 | +# 2. Identity Mapping & SSO Discovery |
| 36 | +echo -e "\n🆔 [Phase 2] Identity Sync (Mapping dev_god to Git & Slack)..." |
| 37 | +curl -s -X POST -H "X-API-Key: $API_KEY" "$API_URL/users/config/slack?user_id=$USER_ID&slack_id=U_GOD_123" | jq . |
| 38 | +curl -s -X POST -H "X-API-Key: $API_KEY" "$API_URL/users/config/git?user_id=$USER_ID&email=god@commitvigil.ai" | jq . |
| 39 | +# 3. Multi-Scenario Orchestration |
| 40 | +echo -e "\n🧠 [Phase 3] The Multi-Agent Reasoning Pipeline..." |
| 41 | +# Scenario A: Standard Supportive Burnout Detection |
| 42 | +echo "--- Scenario A: Burnout Detection (English) ---" |
| 43 | +CHECK_IN="I am drowning in these refactor tasks. I've worked 60 hours this week." |
| 44 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 45 | + "$API_URL/evaluate" \ |
| 46 | + -d "{\"user_id\": \"$USER_ID\", \"commitment\": \"Architecture Refactor\", \"check_in\": \"$CHECK_IN\"}" | jq . |
| 47 | +# Scenario B: Japanese Cultural Routing (Wa/Harmony) |
| 48 | +echo -e "\n--- Scenario B: Cultural Persona Routing (Japanese) ---" |
| 49 | +CHECK_IN_JA="申し訳ありませんが、締め切りに間に合わない可能性があります。和を重んじ、精一杯調整いたします。" |
| 50 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 51 | + "$API_URL/evaluate" \ |
| 52 | + -d "{\"user_id\": \"$USER_ID\", \"commitment\": \"API Sync\", \"check_in\": \"$CHECK_IN_JA\"}" | jq . |
| 53 | +# Scenario C: German Directness (Sachlichkeit) |
| 54 | +echo -e "\n--- Scenario C: Cultural Persona Routing (German) ---" |
| 55 | +CHECK_IN_DE="Ich werde die Datenbank-Migration bis Freitag abschließen. Die Fakten sprechen für eine Verzögerung von zwei Tagen." |
| 56 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 57 | + "$API_URL/evaluate" \ |
| 58 | + -d "{\"user_id\": \"$USER_ID\", \"commitment\": \"DB Migration\", \"check_in\": \"$CHECK_IN_DE\"}" | jq . |
| 59 | +# 4. The Industry Semantic Firewall |
| 60 | +echo -e "\n🛡️ [Phase 4] The Industry Semantic Firewall (Blocking & Redaction)..." |
| 61 | +# Scenario A: Finance Compliance (Insidier Trading/Market Manipulation) |
| 62 | +echo "--- Scenario A: Finance Compliance Block ---" |
| 63 | +CHECK_IN_FIN="I'm busy manipulating the market and discussing insider trading." |
| 64 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 65 | + "$API_URL/evaluate" \ |
| 66 | + -d "{\"user_id\": \"$USER_ID\", \"commitment\": \"Financial Audit\", \"check_in\": \"$CHECK_IN_FIN\"}" | jq . |
| 67 | +# Scenario B: HR/Legal Policy Enforcement |
| 68 | +echo -e "\n--- Scenario B: HR Boundary Protection (Salary Discussion) ---" |
| 69 | +CHECK_IN_HR="I am late because I am fighting with HR about my salary increase." |
| 70 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 71 | + "$API_URL/evaluate" \ |
| 72 | + -d "{\"user_id\": \"$USER_ID\", \"commitment\": \"Weekly Sync\", \"check_in\": \"$CHECK_IN_HR\"}" | jq . |
| 73 | +# 5. GitOps Accountability |
| 74 | +echo -e "\n⚙️ [Phase 5] GitOps Ingestion Layer..." |
| 75 | +COMMIT_MSG="fix: resolve racing condition. [CommitVigil: I will implement the lock strategy by Monday]" |
| 76 | +curl -s -X POST -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \ |
| 77 | + "$API_URL/ingest/git" \ |
| 78 | + -d "{\"author_email\": \"god@commitvigil.ai\", \"message\": \"$COMMIT_MSG\"}" | jq . |
| 79 | +# 6. Professional Integrity Audits (Deliverables) |
| 80 | +echo -e "\n📊 [Phase 6] The Final Deliverable: Integrity Audits..." |
| 81 | +# Markdown Format |
| 82 | +echo "--- Format: Markdown (Saving to integrity_audit.md) ---" |
| 83 | +curl -s -H "X-API-Key: $API_KEY" "$API_URL/reports/audit/$USER_ID?report_format=markdown" | jq -r .content > integrity_audit.md |
| 84 | +echo "✅ Report saved to: $(pwd)/integrity_audit.md" |
| 85 | + |
| 86 | +# JSON Summary |
| 87 | +echo -e "\n--- Format: High-Fidelity JSON (Saving to integrity_audit.json) ---" |
| 88 | +curl -s -H "X-API-Key: $API_KEY" "$API_URL/reports/audit/$USER_ID" | jq . > integrity_audit.json |
| 89 | +echo "✅ Report saved to: $(pwd)/integrity_audit.json" |
| 90 | + |
| 91 | +# HTML Format (Premium Glassmorphic) |
| 92 | +echo -e "\n--- Format: Premium HTML (Saving to live_audit_report.html) ---" |
| 93 | +curl -s -H "X-API-Key: $API_KEY" "$API_URL/reports/audit/$USER_ID?report_format=html" > live_audit_report.html |
| 94 | +echo "✅ Report saved to: $(pwd)/live_audit_report.html" |
| 95 | + |
| 96 | +# 7. Real-Time Observability |
| 97 | +echo -e "\n📈 [Phase 7] Real-Time Observability & Metrics..." |
| 98 | +curl -s http://localhost:8000/metrics | grep "http_request_duration_seconds" | head -n 5 |
| 99 | + |
| 100 | +# 8. Enterprise Scaling: Departmental aggregate reports |
| 101 | +echo -e "\n🏢 [Phase 8] Enterprise Scaling: Departmental Heatmap..." |
| 102 | +# First, simulate some departmental users in the DB (Enterprise logic assumes 'Engineering' dept exists) |
| 103 | +echo "Generating departmental aggregate audit for 'Engineering'..." |
| 104 | +curl -s -H "X-API-Key: $API_KEY" "$API_URL/reports/department/Engineering" | jq . > departmental_audit.json |
| 105 | +echo "✅ Departmental Report saved to: $(pwd)/departmental_audit.json" |
| 106 | +echo -e "\n--- [ADVANCED] Scenario 9: The Global Context Switch (Healthcare) ---" |
| 107 | +echo "Switching industry context to 'healthcare' for user_id=dev_god..." |
| 108 | +# Mentions PII or health data - handled by the Healthcare Semantic Firewall |
| 109 | +CHECK_IN="I am busy processing Patient ID #12345's surgery records." |
| 110 | +curl -s -X 'POST' \ |
| 111 | + -H "X-API-Key: $API_KEY" \ |
| 112 | + -H 'Content-Type: application/json' \ |
| 113 | + "$API_URL/evaluate" \ |
| 114 | + -d "{ |
| 115 | + \"user_id\": \"$USER_ID\", |
| 116 | + \"commitment\": \"Data Entry\", |
| 117 | + \"check_in\": \"$CHECK_IN\" |
| 118 | +}" | jq . |
| 119 | +echo -e "\n--- [ADVANCED] Scenario 10: The Global Context Switch (Sales/Legal) ---" |
| 120 | +echo "Switching to a relationship-centric, high-context check-in..." |
| 121 | +CHECK_IN="I promise to deliver the contract. I value our long-term partnership." |
| 122 | +curl -s -X 'POST' \ |
| 123 | + -H "X-API-Key: $API_KEY" \ |
| 124 | + -H 'Content-Type: application/json' \ |
| 125 | + "$API_URL/evaluate" \ |
| 126 | + -d "{ |
| 127 | + \"user_id\": \"$USER_ID\", |
| 128 | + \"commitment\": \"Contract Delivery\", |
| 129 | + \"check_in\": \"$CHECK_IN\" |
| 130 | +}" | jq . |
| 131 | +echo -e "\n--- [ADVANCED] Scenario 11: African Cultural Intelligence (Ubuntu) ---" |
| 132 | +echo "Simulating a communal-accountability check-in (en-AF)..." |
| 133 | +# This will trigger the 'Ubuntu-inspired' persona |
| 134 | +CHECK_IN="I am working on the payroll module. I know the whole department is waiting on me to finish so they can get paid on time." |
| 135 | +curl -s -X 'POST' \ |
| 136 | + -H "X-API-Key: $API_KEY" \ |
| 137 | + -H 'Content-Type: application/json' \ |
| 138 | + "$API_URL/evaluate" \ |
| 139 | + -d "{ |
| 140 | + \"user_id\": \"$USER_ID\", |
| 141 | + \"commitment\": \"Payroll Module Completion\", |
| 142 | + \"check_in\": \"$CHECK_IN\" |
| 143 | +}" | jq . |
| 144 | +echo -e "\n--------------------------------------------------" |
| 145 | +echo "✅ GOD-MODE DEMO COMPLETE. COMMITVIGIL IS UNIVERSALLY READY & INCLUSIVE. 🛡️" |
| 146 | +echo "--------------------------------------------------" |
0 commit comments