Skip to content

Commit 33138b2

Browse files
committed
feat: enable Claude Code Web visibility for automation workflows
Make automation workflows visible and trackable in Claude Code Web by using @claude triggers instead of direct API calls. This allows you to see the workflow progress live in your Claude Code Web session. Changes: 1. spec-to-code.yml (Code Generation): - Simplified to just trigger @claude with instructions - GitHub Action posts @claude comment when 'approved' label is added - Claude Code (via claude.yml) picks up the task - User sees generation progress in Claude Code Web - Claude Code creates implementations, commits, and makes PR 2. quality-check.yml (Quality Evaluation): - Posts @claude comment with evaluation instructions - Claude Code views preview images and evaluates - User sees evaluation progress in Claude Code Web - Claude Code posts results and adds labels 3. claude.yml (Core): - Enhanced permissions: contents:write, pull-requests:write, issues:write - Allows Claude Code to commit and create PRs - Fetch full history for better context Workflow Flow: 1. Issue gets 'approved' label 2. spec-to-code.yml posts @claude comment 3. claude.yml triggers (sees @claude) 4. Claude Code executes in Web (YOU SEE THIS LIVE!) 5. Claude Code commits implementations 6. Claude Code creates PR 7. test-and-preview.yml runs (regular CI) 8. quality-check.yml posts @claude comment 9. Claude Code evaluates (YOU SEE THIS LIVE!) 10. Claude Code posts quality report + labels Benefits: - 👁️ Full visibility in Claude Code Web - 🎮 Can intervene if needed - 📊 See progress in real-time - 🔍 Better debugging when things go wrong - 💬 Natural conversation-based workflow - 🤖 Same AI throughout (Claude Code Max)
1 parent c6e008f commit 33138b2

File tree

3 files changed

+95
-164
lines changed

3 files changed

+95
-164
lines changed

.github/workflows/claude.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020
runs-on: ubuntu-latest
2121
permissions:
22-
contents: read
23-
pull-requests: read
24-
issues: read
22+
contents: write # Allow commits
23+
pull-requests: write # Allow PR creation
24+
issues: write # Allow issue comments
2525
id-token: write
26-
actions: read # Required for Claude to read CI results on PRs
26+
actions: read # Required for Claude to read CI results on PRs
2727
steps:
2828
- name: Checkout repository
2929
uses: actions/checkout@v4
3030
with:
31-
fetch-depth: 1
31+
fetch-depth: 0 # Full history for better context
3232

3333
- name: Run Claude Code
3434
id: claude

.github/workflows/quality-check.yml

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -57,46 +57,64 @@ jobs:
5757
mkdir -p preview_images
5858
gsutil -m cp -r "gs://${{ steps.metadata.outputs.bucket }}/${{ steps.metadata.outputs.base_path }}/*" preview_images/ || echo "No images to download"
5959
60-
- name: Quality evaluation with Claude Code
61-
uses: anthropics/claude-code-action@v1
60+
- name: Trigger quality check with @claude
61+
uses: actions/github-script@v7
6262
with:
63-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
64-
prompt: |
65-
TASK: Evaluate plot implementations against specifications
66-
67-
PR: #${{ steps.metadata.outputs.pr_number }}
68-
Preview images location: preview_images/
69-
70-
Instructions:
71-
1. List all PNG files in preview_images/ directory
72-
2. For each preview image:
73-
a. Parse filename to extract: spec_id, library, variant
74-
b. Read corresponding spec file: specs/{spec_id}.md
75-
c. View the preview image
76-
d. Evaluate against quality criteria in spec
77-
78-
3. For each implementation, check:
79-
- Does it meet ALL quality criteria listed in spec?
63+
script: |
64+
const prNumber = ${{ steps.metadata.outputs.pr_number }};
65+
const bucket = '${{ steps.metadata.outputs.bucket }}';
66+
const basePath = '${{ steps.metadata.outputs.base_path }}';
67+
68+
await github.rest.issues.createComment({
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
issue_number: prNumber,
72+
body: `@claude
73+
74+
## 🎯 Task: Quality Evaluation
75+
76+
Preview images have been generated and uploaded to GCS. Please evaluate the implementations.
77+
78+
### Instructions
79+
80+
1. **Preview images location**
81+
- Already downloaded to \`preview_images/\` directory in this repository
82+
- GCS Bucket: \`${bucket}\`
83+
- GCS Path: \`${basePath}/\`
84+
85+
2. **For each preview image:**
86+
- Parse filename to extract: spec_id, library, variant (format: \`{spec_id}_{library}_{variant}.png\`)
87+
- Read corresponding spec file: \`specs/{spec_id}.md\`
88+
- View the preview image carefully using your vision capabilities
89+
- Evaluate against quality criteria listed in the spec
90+
91+
3. **Check each quality criterion:**
92+
- Does it meet ALL quality criteria from the spec?
8093
- Are visual elements clear and readable?
8194
- Are colors appropriate and accessible?
8295
- Is the layout well-structured?
8396
- Score: 0-100 (≥85 to pass)
8497
85-
4. Generate quality report with:
86-
- Overall verdict (PASS if all ≥85, FAIL otherwise)
87-
- Score for each implementation
88-
- Specific feedback for each quality criterion
98+
4. **Generate quality report with:**
99+
- Overall verdict (PASS if all implementations score ≥85, FAIL otherwise)
100+
- Score for each implementation (matplotlib and seaborn separately)
101+
- Specific feedback for each quality criterion (met/failed)
89102
- Strengths and improvements needed
103+
- Concrete, actionable suggestions if FAIL
90104
91-
5. Use gh CLI to:
92-
- Post quality report as comment on PR #${{ steps.metadata.outputs.pr_number }}
93-
- Add label "quality-approved" if PASS
94-
- Add label "quality-check-failed" if FAIL
105+
5. **Update this PR:**
106+
- Post quality report as comment on this PR
107+
- Use \`gh pr edit\` to add appropriate label:
108+
- "quality-approved" if PASS
109+
- "quality-check-failed" if FAIL
95110
96-
Scoring Guidelines:
111+
### Scoring Guidelines
97112
- 90-100: Excellent - All criteria met, production ready
98113
- 85-89: Good - Minor issues, acceptable
99-
- 75-84: Needs improvement
100-
- <75: Rejected - Major issues
114+
- 75-84: Needs improvement - regeneration recommended
115+
- <75: Rejected - Major issues, regeneration required
116+
117+
Be objective and constructive in your feedback. Focus on measurable criteria.
101118
102-
Be objective and constructive in your feedback.
119+
Preview images are ready - please proceed with the evaluation!`
120+
});

.github/workflows/spec-to-code.yml

Lines changed: 41 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@ on:
55
types: [labeled]
66

77
jobs:
8-
generate-code:
8+
trigger-claude-code:
99
# Only run when "approved" label is added
1010
if: github.event.label.name == 'approved'
1111
runs-on: ubuntu-latest
1212
permissions:
13-
contents: write
14-
pull-requests: write
1513
issues: write
16-
id-token: write
1714

1815
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 0
23-
2416
- name: Extract spec ID from issue
2517
id: extract_spec
2618
env:
@@ -43,141 +35,62 @@ jobs:
4335
echo "spec_id=$SPEC_ID" >> $GITHUB_OUTPUT
4436
echo "✅ Extracted spec ID: $SPEC_ID"
4537
46-
- name: Check if spec file exists
47-
id: check_spec
48-
run: |
49-
SPEC_ID="${{ steps.extract_spec.outputs.spec_id }}"
50-
SPEC_FILE="specs/${SPEC_ID}.md"
51-
52-
if [ ! -f "$SPEC_FILE" ]; then
53-
echo "Creating spec file from issue..."
54-
mkdir -p specs
55-
echo "${{ github.event.issue.body }}" > "$SPEC_FILE"
56-
57-
git config --global user.name "github-actions[bot]"
58-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
59-
git add "$SPEC_FILE"
60-
git commit -m "feat: add spec file for $SPEC_ID from issue #${{ github.event.issue.number }}"
61-
else
62-
echo "✅ Spec file exists: $SPEC_FILE"
63-
fi
64-
65-
- name: Generate implementations with Claude Code
66-
id: generate
67-
uses: anthropics/claude-code-action@v1
38+
- name: Trigger Claude Code with @claude comment
39+
uses: actions/github-script@v7
6840
with:
69-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
70-
prompt: |
71-
TASK: Generate plot implementations from specification
41+
script: |
42+
const specId = '${{ steps.extract_spec.outputs.spec_id }}';
43+
44+
await github.rest.issues.createComment({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
issue_number: context.issue.number,
48+
body: `@claude
49+
50+
## 🎯 Task: Generate Plot Implementations
7251
73-
SPEC_ID: ${{ steps.extract_spec.outputs.spec_id }}
74-
ISSUE: #${{ github.event.issue.number }}
52+
This issue has been approved! Please generate implementations for **${specId}**.
7553
76-
Instructions:
77-
1. Read the spec file: specs/${{ steps.extract_spec.outputs.spec_id }}.md
78-
2. Read generation rules: rules/generation/v1.0.0-draft/code-generation-rules.md
79-
3. Read quality criteria: rules/generation/v1.0.0-draft/quality-criteria.md
80-
4. Read self-review checklist: rules/generation/v1.0.0-draft/self-review-checklist.md
54+
### Instructions
8155
82-
5. Generate matplotlib implementation:
83-
- Target: plots/matplotlib/scatter/${{ steps.extract_spec.outputs.spec_id }}/default.py
56+
1. **Read the specification**
57+
- File: \`specs/${specId}.md\`
58+
- If file doesn't exist, create it from the issue body
59+
60+
2. **Read generation rules**
61+
- \`rules/generation/v1.0.0-draft/code-generation-rules.md\`
62+
- \`rules/generation/v1.0.0-draft/quality-criteria.md\`
63+
- \`rules/generation/v1.0.0-draft/self-review-checklist.md\`
64+
65+
3. **Generate matplotlib implementation**
66+
- Target: \`plots/matplotlib/scatter/${specId}/default.py\`
8467
- Follow generation rules exactly
8568
- Implement all spec requirements
8669
- Use type hints, docstrings, validation
87-
- Add standalone execution block
70+
- Add standalone execution block (\`if __name__ == '__main__':\`)
8871
- Self-review: Max 3 attempts to pass quality criteria
8972
90-
6. Generate seaborn implementation:
91-
- Target: plots/seaborn/scatterplot/${{ steps.extract_spec.outputs.spec_id }}/default.py
73+
4. **Generate seaborn implementation**
74+
- Target: \`plots/seaborn/scatterplot/${specId}/default.py\`
9275
- Same requirements as matplotlib
9376
94-
7. Create summary in markdown format with:
95-
- Libraries generated (matplotlib, seaborn)
96-
- Self-review results for each
97-
- File paths created
98-
- Any issues encountered
77+
5. **Create Pull Request**
78+
- Branch: \`auto/${specId}\`
79+
- Title: \`feat: implement ${specId}\`
80+
- Include summary of generation results
81+
- Link to this issue
9982
100-
IMPORTANT:
83+
### Requirements
10184
- Each implementation must pass self-review before moving to next
10285
- Use deterministic sample data (fixed seeds or hardcoded data)
10386
- Code must work standalone (no external files)
10487
- Follow Python 3.10+ syntax
88+
- Commit with clear messages
10589
106-
Output your work summary when complete.
107-
108-
- name: Create Pull Request
109-
uses: peter-evans/create-pull-request@v5
110-
with:
111-
token: ${{ secrets.GITHUB_TOKEN }}
112-
commit-message: |
113-
feat: implement ${{ steps.extract_spec.outputs.spec_id }}
114-
115-
Auto-generated implementations from issue #${{ github.event.issue.number }}
116-
Generated using Claude Code with versioned rules (v1.0.0-draft)
117-
118-
- matplotlib implementation
119-
- seaborn implementation
120-
branch: auto/${{ steps.extract_spec.outputs.spec_id }}
121-
title: "feat: implement ${{ steps.extract_spec.outputs.spec_id }}"
122-
body: |
123-
## 🤖 Auto-generated Implementation
124-
125-
This PR contains auto-generated code for **${{ steps.extract_spec.outputs.spec_id }}**
126-
127-
**Source:** Issue #${{ github.event.issue.number }}
128-
**Generated by:** Claude Code Action with versioned rules (v1.0.0-draft)
129-
130-
### What was generated
131-
132-
- ✅ matplotlib implementation (`plots/matplotlib/scatter/${{ steps.extract_spec.outputs.spec_id }}/default.py`)
133-
- ✅ seaborn implementation (`plots/seaborn/scatterplot/${{ steps.extract_spec.outputs.spec_id }}/default.py`)
134-
135-
### Next Steps
136-
137-
- [ ] Review generated code
138-
- [ ] Run tests (triggered automatically on PR)
139-
- [ ] Generate previews (triggered automatically on PR)
140-
- [ ] Quality check (triggered automatically after previews)
141-
142-
### Generation Process
143-
144-
1. ✅ Spec read from `specs/${{ steps.extract_spec.outputs.spec_id }}.md`
145-
2. ✅ Generation rules applied from `rules/generation/v1.0.0-draft/`
146-
3. ✅ Self-review loop completed (max 3 attempts per library)
147-
4. ✅ Code committed to branch
148-
149-
---
150-
151-
*Generated by [Claude Code Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*
152-
labels: |
153-
code-generated
154-
auto-pr
155-
draft: false
156-
157-
- name: Comment on issue
158-
uses: actions/github-script@v7
159-
with:
160-
script: |
161-
const specId = '${{ steps.extract_spec.outputs.spec_id }}';
162-
163-
await github.rest.issues.createComment({
164-
owner: context.repo.owner,
165-
repo: context.repo.repo,
166-
issue_number: context.issue.number,
167-
body: `## 🤖 Code Generation Complete
168-
169-
Implementations for **${specId}** have been generated using Claude Code!
170-
171-
**Generated:**
172-
- ✅ matplotlib
173-
- ✅ seaborn
174-
175-
A pull request has been created with the generated code.
176-
177-
### Next Steps
178-
1. Multi-version tests will run automatically (Python 3.10-3.13)
179-
2. Preview images will be generated
180-
3. AI quality check will evaluate the implementations
90+
### Expected Outcome
91+
- PR created with matplotlib and seaborn implementations
92+
- Both pass self-review
93+
- Tests will run automatically on PR
18194
182-
Check the [workflow run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`
95+
Please proceed with the generation!`
18396
});

0 commit comments

Comments
 (0)