Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/impl-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,71 @@ jobs:

- name: Run Claude Code to generate implementation
id: claude
continue-on-error: true
timeout-minutes: 60
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model opus"
prompt: |
## Task: Generate ${{ steps.inputs.outputs.library }} Implementation

You are generating the **${{ steps.inputs.outputs.library }}** implementation for **${{ steps.inputs.outputs.specification_id }}**.

### Step 1: Read required files
1. `prompts/plot-generator.md` - Base generation rules
2. `prompts/default-style-guide.md` - Visual style requirements
3. `prompts/quality-criteria.md` - Quality requirements
4. `prompts/library/${{ steps.inputs.outputs.library }}.md` - Library-specific rules
5. `plots/${{ steps.inputs.outputs.specification_id }}/specification.md` - The specification

### Step 2: Generate implementation
Create: `plots/${{ steps.inputs.outputs.specification_id }}/implementations/${{ steps.inputs.outputs.library }}.py`

The script MUST:
- Save as `plot.png` in the current directory
- For interactive libraries (plotly, bokeh, altair, highcharts, pygal, letsplot): also save `plot.html`

### Step 3: Test and fix (up to 3 attempts)
Run the implementation:
```bash
source .venv/bin/activate
cd plots/${{ steps.inputs.outputs.specification_id }}/implementations
MPLBACKEND=Agg python ${{ steps.inputs.outputs.library }}.py
```

If it fails, fix and try again (max 3 attempts).

### Step 4: Visual self-check
Look at the generated `plot.png`:
- Does it match the specification?
- Are axes labeled correctly?
- Is the visualization clear?

### Step 5: Format the code
```bash
source .venv/bin/activate
ruff format plots/${{ steps.inputs.outputs.specification_id }}/implementations/${{ steps.inputs.outputs.library }}.py
ruff check --fix plots/${{ steps.inputs.outputs.specification_id }}/implementations/${{ steps.inputs.outputs.library }}.py
```

### Step 6: Commit
```bash
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plots/${{ steps.inputs.outputs.specification_id }}/implementations/${{ steps.inputs.outputs.library }}.py
git commit -m "feat(${{ steps.inputs.outputs.library }}): implement ${{ steps.inputs.outputs.specification_id }}"
git push -u origin implementation/${{ steps.inputs.outputs.specification_id }}/${{ steps.inputs.outputs.library }}
```

### Report result
Print exactly one line:
- `GENERATION_SUCCESS` - if everything worked
- `GENERATION_FAILED: <reason>` - if it failed

- name: Retry Claude (on failure)
if: steps.claude.outcome == 'failure'
id: claude_retry
timeout-minutes: 60
uses: anthropics/claude-code-action@v1
with:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/impl-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,54 @@ jobs:

gh issue comment "$ISSUE" --body "$BODY"

- name: Close issue if all libraries done
if: steps.check.outputs.should_run == 'true' && steps.issue.outputs.number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ steps.issue.outputs.number }}
SPEC_ID: ${{ steps.extract.outputs.specification_id }}
run: |
# All 9 supported libraries
LIBRARIES="matplotlib seaborn plotly bokeh altair plotnine pygal highcharts letsplot"

# Get current labels on the issue
LABELS=$(gh issue view "$ISSUE" --json labels -q '.labels[].name' 2>/dev/null || echo "")

# Count done implementations
DONE_COUNT=0
for lib in $LIBRARIES; do
if echo "$LABELS" | grep -q "^impl:${lib}:done$"; then
DONE_COUNT=$((DONE_COUNT + 1))
fi
done

echo "::notice::Libraries done: $DONE_COUNT/9"

# Close issue if all 9 libraries are done
if [ "$DONE_COUNT" -eq 9 ]; then
gh issue comment "$ISSUE" --body "## :tada: All Implementations Complete!

All 9 library implementations for \`${SPEC_ID}\` have been successfully merged.

| Library | Status |
|---------|--------|
| matplotlib | :white_check_mark: |
| seaborn | :white_check_mark: |
| plotly | :white_check_mark: |
| bokeh | :white_check_mark: |
| altair | :white_check_mark: |
| plotnine | :white_check_mark: |
| pygal | :white_check_mark: |
| highcharts | :white_check_mark: |
| letsplot | :white_check_mark: |

---
:robot: *[impl-merge](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"

gh issue close "$ISSUE"
echo "::notice::Closed issue #$ISSUE - all implementations complete"
fi
Comment on lines +258 to +281
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-close logic only checks for impl:{lib}:done labels and requires all 9 libraries to have this label. However, if any library implementation fails 3 times, it gets marked with impl:{lib}:failed instead (see impl-review.yml line 349). This means issues will remain open indefinitely if even a single library cannot implement the spec. Consider also counting impl:{lib}:failed labels and closing the issue when all 9 libraries have either :done or :failed status.

Copilot uses AI. Check for mistakes.

- name: Trigger database sync
if: steps.check.outputs.should_run == 'true'
env:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/impl-repair.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,68 @@ jobs:

- name: Run Claude Code to repair implementation
id: claude
continue-on-error: true
timeout-minutes: 45
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model opus"
prompt: |
## Task: Repair ${{ inputs.library }} Implementation for ${{ inputs.specification_id }}

This is **repair attempt ${{ inputs.attempt }}/3**. The previous implementation was rejected.

### Step 1: Read the AI review feedback
Read `/tmp/ai_feedback.md` to understand what needs to be fixed.

### Step 2: Read reference files
1. `prompts/library/${{ inputs.library }}.md` - Library-specific rules
2. `plots/${{ inputs.specification_id }}/specification.md` - The specification
3. `prompts/quality-criteria.md` - Quality requirements

### Step 3: Read current implementation
`plots/${{ inputs.specification_id }}/implementations/${{ inputs.library }}.py`

### Step 4: Fix the issues
Based on the AI feedback, fix:
- Visual quality issues
- Code quality issues
- Spec compliance issues

### Step 5: Test the fix
```bash
source .venv/bin/activate
cd plots/${{ inputs.specification_id }}/implementations
MPLBACKEND=Agg python ${{ inputs.library }}.py
```

### Step 6: Visual self-check
View `plot.png` and verify fixes are correct.

### Step 7: Format the code
```bash
source .venv/bin/activate
ruff format plots/${{ inputs.specification_id }}/implementations/${{ inputs.library }}.py
ruff check --fix plots/${{ inputs.specification_id }}/implementations/${{ inputs.library }}.py
```

### Step 8: Commit and push
```bash
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plots/${{ inputs.specification_id }}/implementations/${{ inputs.library }}.py
git commit -m "fix(${{ inputs.library }}): address review feedback for ${{ inputs.specification_id }}

Attempt ${{ inputs.attempt }}/3 - fixes based on AI review"
git push origin ${{ env.branch }}
```

### Report result
Print: `REPAIR_SUCCESS` or `REPAIR_FAILED: <reason>`

- name: Retry Claude (on failure)
if: steps.claude.outcome == 'failure'
id: claude_retry
timeout-minutes: 45
uses: anthropics/claude-code-action@v1
with:
Expand Down
98 changes: 97 additions & 1 deletion .github/workflows/spec-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,102 @@ jobs:
- name: Process with Claude
if: steps.check.outputs.should_run == 'true'
id: process
continue-on-error: true
timeout-minutes: 30
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model opus"
prompt: |
## Task: Create New Specification

You are creating a new plot specification.

### Issue Details
- **Title:** ${{ github.event.issue.title }}
- **Number:** #${{ github.event.issue.number }}
- **Author:** ${{ github.event.issue.user.login }}
- **Body:**
```
${{ github.event.issue.body }}
```

---

## Instructions

1. **Read the rules:** `prompts/spec-id-generator.md`

2. **Check for duplicates:**
- List all existing specs: `ls plots/`
- Read existing specification files if titles seem similar
- If duplicate found: Post comment explaining which spec matches, then STOP

3. **Generate specification-id:**
- Format: `{type}-{variant}` or `{type}-{variant}-{modifier}`
- Examples: `scatter-basic`, `bar-grouped-horizontal`, `heatmap-correlation`
- All lowercase, hyphens only

4. **Create specification branch:**
```bash
git checkout -b "specification/{specification-id}"
```

5. **Post analysis comment:**
Post a SHORT comment (max 3-4 sentences) to the issue using `gh issue comment`:
- Is this a valid/useful plot type?
- Does it already exist? (check `ls plots/`)
- Any concerns?

6. **Create specification files:**
- Read template: `prompts/templates/specification.md`
- Read metadata template: `prompts/templates/specification.yaml`
- Create directory: `plots/{specification-id}/`
- Create: `plots/{specification-id}/specification.md` (follow template structure)
- Create: `plots/{specification-id}/specification.yaml` with:
- `specification_id`: the generated id
- `title`: a proper title
- `created`: Use `$(date -u +"%Y-%m-%dT%H:%M:%SZ")` for current timestamp
- `issue`: ${{ github.event.issue.number }}
- `suggested`: ${{ github.event.issue.user.login }}
- `tags`: appropriate tags for this plot type
- Create empty folder: `plots/{specification-id}/implementations/`
- Create empty folder: `plots/{specification-id}/metadata/`

7. **Commit and push:**
```bash
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plots/{specification-id}/
git commit -m "spec: add {specification-id} specification

Created from issue #${{ github.event.issue.number }}"
git push -u origin "specification/{specification-id}"
```

8. **Update issue title:**
```bash
gh issue edit ${{ github.event.issue.number }} --title "[{specification-id}] {original title}"
```

9. **Output for workflow:**
After completing, print these lines exactly:
```
SPECIFICATION_ID={specification-id}
BRANCH=specification/{specification-id}
```

---

## Important Rules
- Do NOT create a PR (the workflow does that)
- Do NOT add labels
- Do NOT close the issue
- STOP after pushing the branch

- name: Retry Claude (on failure)
if: steps.check.outputs.should_run == 'true' && steps.process.outcome == 'failure'
id: process_retry
timeout-minutes: 30
uses: anthropics/claude-code-action@v1
with:
Expand Down Expand Up @@ -194,7 +290,7 @@ jobs:
--body "$(cat <<EOF
## New Specification: \`${SPEC_ID}\`

Closes #${{ github.event.issue.number }}
Related to #${{ github.event.issue.number }}

---

Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/spec-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,74 @@ jobs:

- name: Process update with Claude
id: process
continue-on-error: true
timeout-minutes: 30
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model opus"
prompt: |
## Task: Update Existing Specification

You are updating an existing plot specification.

### Issue Details
- **Title:** ${{ github.event.issue.title }}
- **Number:** #${{ github.event.issue.number }}
- **Specification ID:** ${{ steps.extract.outputs.specification_id }}
- **Body:**
```
${{ github.event.issue.body }}
```

---

## Instructions

1. **Read current specification:**
- `plots/${{ steps.extract.outputs.specification_id }}/specification.md`
- `plots/${{ steps.extract.outputs.specification_id }}/specification.yaml`

2. **Post analysis comment:**
Post a SHORT comment (max 3-4 sentences) to the issue using `gh issue comment`:
- Is this a valid/useful change?
- What will be modified?
- Any concerns?

3. **Create update branch:**
```bash
git checkout -b "specification/${{ steps.extract.outputs.specification_id }}-update"
```

4. **Apply updates:**
- Modify `plots/${{ steps.extract.outputs.specification_id }}/specification.md` as needed
- Update `plots/${{ steps.extract.outputs.specification_id }}/specification.yaml`:
- Add entry to `history` array with:
- `date`: current timestamp (ISO 8601 format)
- `issue`: ${{ github.event.issue.number }}
- `changes`: brief description of what changed

5. **Commit and push:**
```bash
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plots/${{ steps.extract.outputs.specification_id }}/
git commit -m "spec: update ${{ steps.extract.outputs.specification_id }}

Updated from issue #${{ github.event.issue.number }}"
git push -u origin "specification/${{ steps.extract.outputs.specification_id }}-update"
```

---

## Important Rules
- Do NOT create a PR (the workflow does that)
- Do NOT add labels
- STOP after pushing the branch

- name: Retry Claude (on failure)
if: steps.process.outcome == 'failure'
id: process_retry
timeout-minutes: 30
uses: anthropics/claude-code-action@v1
with:
Expand Down
Loading
Loading