Skip to content

Commit 926ca30

Browse files
Add Cloudflare Pages deploy & OAuth middleware
Add a GitHub Actions workflow to auto-generate and deploy the SPECTRA dashboard to Cloudflare Pages, and introduce GitHub OAuth protection for the site. New files: deploy-dashboard.yml (workflow), site/_middleware.js (OAuth/session handling), site/access-denied.html (UI), site/functions/auth/callback.js (placeholder), and a dark theme stylesheet. Also update site index, scripts, styles and spectra.config.json, expand documentation index and agent guidance (proactive tool usage / screenshot handling), and add a git tag Bash command to .claude settings. These changes enable automated deployments and optional repository-restricted access to the dashboard via configurable environment variables.
1 parent aadebd5 commit 926ca30

File tree

12 files changed

+780
-26
lines changed

12 files changed

+780
-26
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"Bash(cp dashboard-site/access-denied.html \"C:/SourceCode/Spectra_Demo/dashboard-site/\")",
104104
"Bash(git status:*)",
105105
"Bash(for branch:*)",
106-
"Bash(git ls-tree:*)"
106+
"Bash(git ls-tree:*)",
107+
"Bash(git tag:*)"
107108
]
108109
}
109110
}

test_app_documentation/.github/agents/spectra-execution.agent.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ Users may use single-letter shortcuts for speed:
8686
- **b** = BLOCKED (ask for reason)
8787
- **s** = SKIP (ask for reason)
8888

89+
## Proactive Tool Usage
90+
91+
### After a FAILED Result
92+
After recording a FAILED result with `advance_test_case`:
93+
1. Ask: "Would you like to attach a screenshot of the failure?"
94+
2. If yes: guide them to provide base64 image data, then call `save_screenshot`
95+
3. If the user provides a multi-line failure description, call `add_test_note` to store the full details separately from the one-line notes in `advance_test_case`
96+
97+
### Progress Summaries
98+
- Call `get_execution_summary` every 5 completed tests to show a mid-run progress snapshot
99+
- Call `get_execution_summary` immediately when the user asks "how are we doing?", "status?", "progress?", or similar
100+
89101
## Bug Logging (Azure DevOps MCP)
90102

91103
When a test fails and user confirms bug creation:
@@ -102,7 +114,7 @@ When a test fails and user confirms bug creation:
102114

103115
## Screenshot Handling
104116

105-
When user provides a screenshot or mentions taking one:
117+
After any FAILED or BLOCKED result, proactively ask the user if they want to attach a screenshot as evidence. When user provides a screenshot or mentions taking one:
106118

107119
1. Call `save_screenshot` with the base64-encoded image data and test handle
108120
2. Optionally include a caption describing what the screenshot shows
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# SPECTRA Dashboard Auto-Deployment
2+
#
3+
# Automatically regenerates and deploys the SPECTRA dashboard to Cloudflare Pages
4+
# when test files, documentation, execution data, or configuration change.
5+
#
6+
# Required GitHub Secrets:
7+
# CLOUDFLARE_API_TOKEN - Cloudflare API token with "Edit Cloudflare Pages" permissions
8+
# CLOUDFLARE_ACCOUNT_ID - Your Cloudflare account ID
9+
#
10+
# Required Cloudflare Pages Environment Variables:
11+
# GITHUB_CLIENT_ID - GitHub OAuth App client ID (for authentication)
12+
# GITHUB_CLIENT_SECRET - GitHub OAuth App client secret
13+
# ALLOWED_REPOS - Comma-separated org/repo list (e.g., "myorg/myrepo")
14+
# SESSION_SECRET - Random string for cookie signing
15+
# AUTH_ENABLED - Set to "true" to enable authentication
16+
#
17+
# For full setup instructions, see docs/deployment/cloudflare-pages-setup.md
18+
19+
name: Deploy SPECTRA Dashboard
20+
21+
on:
22+
push:
23+
branches:
24+
- main
25+
paths:
26+
- 'tests/**'
27+
- '.execution/**'
28+
- 'docs/**'
29+
- 'spectra.config.json'
30+
31+
workflow_dispatch:
32+
33+
concurrency:
34+
group: dashboard-deploy
35+
cancel-in-progress: true
36+
37+
jobs:
38+
deploy:
39+
runs-on: ubuntu-latest
40+
name: Generate and Deploy Dashboard
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Setup .NET
49+
uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: '8.0'
52+
53+
- name: Install SPECTRA CLI
54+
run: dotnet tool install -g spectra-cli
55+
56+
- name: Run coverage analysis with auto-linking
57+
run: spectra ai analyze --coverage --auto-link
58+
continue-on-error: true
59+
60+
- name: Generate dashboard
61+
run: spectra dashboard --output ./site
62+
63+
- name: Copy Cloudflare Pages functions (OAuth middleware)
64+
run: |
65+
if [ -d "dashboard-site/functions" ]; then
66+
cp -r dashboard-site/functions ./site/functions
67+
fi
68+
69+
- name: Read project name from config
70+
id: config
71+
run: |
72+
PROJECT_NAME=$(jq -r '.dashboard.cloudflare_project_name // "spectra-dashboard"' spectra.config.json 2>/dev/null || echo "spectra-dashboard")
73+
echo "project_name=$PROJECT_NAME" >> "$GITHUB_OUTPUT"
74+
75+
- name: Deploy to Cloudflare Pages
76+
uses: cloudflare/wrangler-action@v3
77+
with:
78+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
79+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
80+
command: pages deploy ./site --project-name=${{ steps.config.outputs.project_name }}
81+
82+
- name: Post deployment summary
83+
run: |
84+
echo "## Dashboard Deployed" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
echo "The SPECTRA dashboard has been updated and deployed." >> $GITHUB_STEP_SUMMARY
87+
echo "**Project:** ${{ steps.config.outputs.project_name }}" >> $GITHUB_STEP_SUMMARY
88+
echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
89+
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)