Skip to content

Commit 27a19b7

Browse files
docs: update plot specifications and examples across multiple libraries
- Remove return type sections from various plot specifications - Enhance descriptions and examples for clarity - Standardize data requirements and use cases - Improve overall formatting and consistency in documentation
1 parent 4372b3c commit 27a19b7

29 files changed

+554
-1876
lines changed

.github/workflows/bot-validate-request.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ jobs:
4949
exit 0
5050
fi
5151
52-
# Check 2: Must not already have spec ID in title (indicated by [...])
53-
if [[ "$ISSUE_TITLE" == *"["* ]]; then
54-
echo "::notice::Skipping: Issue title already contains spec ID"
55-
echo "should_run=false" >> $GITHUB_OUTPUT
56-
exit 0
52+
# Check 2: Must not already have spec ID in title
53+
# Spec ID format: [lowercase-with-hyphens] at the beginning, NOT [update...]
54+
# Valid spec-id: [scatter-basic], [line-timeseries-multi]
55+
# NOT spec-id: [update], [update:matplotlib], [Update:...]
56+
if [[ "$ISSUE_TITLE" =~ ^\[[a-z0-9-]+\] ]]; then
57+
FIRST_BRACKET=$(echo "$ISSUE_TITLE" | grep -oP '^\[\K[a-z0-9-]+(?=\])' || echo "")
58+
# Skip only if it's a valid spec-id (not an update marker)
59+
if [[ -n "$FIRST_BRACKET" && ! "$FIRST_BRACKET" =~ ^update ]]; then
60+
echo "::notice::Skipping: Issue title already has spec ID: $FIRST_BRACKET"
61+
echo "should_run=false" >> $GITHUB_OUTPUT
62+
exit 0
63+
fi
5764
fi
5865
5966
# Check 3: For labeled events, only trigger when plot-request label is added

.github/workflows/gen-create-spec.yml

Lines changed: 102 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: "Gen: Create Spec"
2-
run-name: "Create Spec: ${{ github.event.issue.title }}"
1+
name: "Gen: Create Spec / Handle Update"
2+
run-name: "${{ contains(github.event.issue.labels.*.name, 'update') && 'Update' || 'Create Spec' }}: ${{ github.event.issue.title }}"
33

44
on:
55
issues:
@@ -19,6 +19,8 @@ jobs:
1919
spec_id: ${{ steps.extract_spec.outputs.spec_id }}
2020
feature_branch: ${{ steps.create_branch.outputs.feature_branch }}
2121
spec_exists: ${{ steps.check_spec.outputs.exists }}
22+
is_update: ${{ steps.check.outputs.is_update }}
23+
target_library: ${{ steps.check.outputs.target_library }}
2224

2325
permissions:
2426
contents: write
@@ -28,10 +30,13 @@ jobs:
2830
steps:
2931
- name: Check conditions
3032
id: check
33+
env:
34+
ISSUE_TITLE: ${{ github.event.issue.title }}
3135
run: |
3236
echo "=== Debug Info ==="
3337
echo "Label added: ${{ github.event.label.name }}"
3438
echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}"
39+
echo "Issue title: $ISSUE_TITLE"
3540
echo "=================="
3641
3742
# Check 1: Must be "approved" label being added
@@ -49,15 +54,27 @@ jobs:
4954
exit 0
5055
fi
5156
52-
# Check 3: Must NOT have "update" label (updates use existing spec)
57+
# Check 3: Detect if this is an update request
5358
HAS_UPDATE="${{ contains(github.event.issue.labels.*.name, 'update') }}"
5459
if [[ "$HAS_UPDATE" == "true" ]]; then
55-
echo "::notice::Skipping: This is an update request, not a new spec"
56-
echo "should_run=false" >> $GITHUB_OUTPUT
57-
exit 0
60+
echo "is_update=true" >> $GITHUB_OUTPUT
61+
echo "::notice::This is an update request"
62+
63+
# Extract target library from title [update:library] or empty for all
64+
if [[ "$ISSUE_TITLE" =~ \[update:([a-z]+)\] ]]; then
65+
TARGET_LIB="${BASH_REMATCH[1]}"
66+
echo "target_library=$TARGET_LIB" >> $GITHUB_OUTPUT
67+
echo "::notice::Target library: $TARGET_LIB"
68+
else
69+
echo "target_library=" >> $GITHUB_OUTPUT
70+
echo "::notice::Target: all libraries"
71+
fi
72+
else
73+
echo "is_update=false" >> $GITHUB_OUTPUT
74+
echo "target_library=" >> $GITHUB_OUTPUT
5875
fi
5976
60-
echo "::notice::All conditions met - proceeding with spec creation"
77+
echo "::notice::All conditions met - proceeding"
6178
echo "should_run=true" >> $GITHUB_OUTPUT
6279
6380
- name: Checkout repository
@@ -104,8 +121,13 @@ jobs:
104121
fi
105122
106123
# Fallback: extract from title if in brackets [spec-id]
124+
# Must be at the beginning and NOT an update marker
107125
if [ -z "$SPEC_ID" ]; then
108-
SPEC_ID=$(echo "$ISSUE_TITLE" | grep -oP '\[\K[a-z0-9-]+(?=\])' | tail -1 || echo "")
126+
FIRST_BRACKET=$(echo "$ISSUE_TITLE" | grep -oP '^\[\K[a-z0-9-]+(?=\])' || echo "")
127+
# Only use if it's not an update marker
128+
if [[ -n "$FIRST_BRACKET" && ! "$FIRST_BRACKET" =~ ^update ]]; then
129+
SPEC_ID="$FIRST_BRACKET"
130+
fi
109131
fi
110132
111133
if [ -z "$SPEC_ID" ]; then
@@ -121,13 +143,19 @@ jobs:
121143
id: check_spec
122144
env:
123145
SPEC_ID: ${{ steps.extract_spec.outputs.spec_id }}
146+
IS_UPDATE: ${{ steps.check.outputs.is_update }}
124147
run: |
125148
if [ -f "specs/$SPEC_ID.md" ]; then
126149
echo "exists=true" >> $GITHUB_OUTPUT
127-
echo "::notice::Spec file already exists: specs/$SPEC_ID.md"
150+
echo "::notice::Spec file exists: specs/$SPEC_ID.md"
128151
else
129152
echo "exists=false" >> $GITHUB_OUTPUT
130-
echo "::notice::Spec file does not exist yet"
153+
# For updates, spec MUST exist
154+
if [[ "$IS_UPDATE" == "true" ]]; then
155+
echo "::error::Update request but spec file does not exist: specs/$SPEC_ID.md"
156+
exit 1
157+
fi
158+
echo "::notice::Spec file does not exist yet (will be created)"
131159
fi
132160
133161
- name: Check if feature branch exists
@@ -151,12 +179,21 @@ jobs:
151179
env:
152180
SPEC_ID: ${{ steps.extract_spec.outputs.spec_id }}
153181
BRANCH_EXISTS: ${{ steps.check_branch.outputs.exists }}
182+
IS_UPDATE: ${{ steps.check.outputs.is_update }}
154183
run: |
155184
BRANCH="plot/$SPEC_ID"
156185
157186
echo "feature_branch=$BRANCH" >> $GITHUB_OUTPUT
158187
159-
if [[ "$BRANCH_EXISTS" == "true" ]]; then
188+
# For updates: always create fresh branch from main (old branch was deleted after merge)
189+
if [[ "$IS_UPDATE" == "true" ]]; then
190+
if [[ "$BRANCH_EXISTS" == "true" ]]; then
191+
echo "::notice::Deleting existing branch for fresh update: $BRANCH"
192+
git push origin --delete "$BRANCH" 2>/dev/null || true
193+
fi
194+
git checkout -b "$BRANCH" origin/main
195+
echo "::notice::Created fresh branch from main for update: $BRANCH"
196+
elif [[ "$BRANCH_EXISTS" == "true" ]]; then
160197
git fetch origin "$BRANCH"
161198
git checkout "$BRANCH"
162199
echo "::notice::Checked out existing branch: $BRANCH"
@@ -193,17 +230,18 @@ jobs:
193230
194231
4. Create the spec file at: `specs/${{ steps.extract_spec.outputs.spec_id }}.md`
195232
- Follow the template structure exactly
196-
- Fill in all sections based on the issue description
197-
- Be specific and detailed in quality criteria
198-
- Include realistic use cases
233+
- Keep it simple and focused (description, data, tags, use cases)
234+
- Include example data if helpful (inline or dataset reference)
235+
- Include realistic use cases with domain context
199236
200237
5. Do NOT commit or push - just create the file
201238
202239
### Quality Requirements
203-
- All required sections must be present (Title, Description, Data Requirements)
204-
- Quality criteria should be specific and measurable
240+
- All required sections: Title, Description, Data, Tags, Use Cases
241+
- Description should clearly explain what the plot visualizes
242+
- Data section should list required columns with types
205243
- Use cases should be realistic and varied
206-
- The spec should be complete enough for AI to generate implementations
244+
- Keep it concise - AI uses central prompts for implementation details
207245
208246
- name: Commit and push spec file
209247
if: steps.check.outputs.should_run == 'true'
@@ -212,13 +250,20 @@ jobs:
212250
SPEC_ID: ${{ steps.extract_spec.outputs.spec_id }}
213251
BRANCH: ${{ steps.create_branch.outputs.feature_branch }}
214252
ISSUE_NUMBER: ${{ github.event.issue.number }}
253+
IS_UPDATE: ${{ steps.check.outputs.is_update }}
215254
run: |
216-
217255
# Configure git
218256
git config user.name "github-actions[bot]"
219257
git config user.email "github-actions[bot]@users.noreply.github.com"
220258
221-
# Check if spec file was created
259+
# For updates, spec already exists - just push the branch
260+
if [[ "$IS_UPDATE" == "true" ]]; then
261+
git push -u origin "$BRANCH"
262+
echo "::notice::Pushed update branch: $BRANCH"
263+
exit 0
264+
fi
265+
266+
# For new specs: check if spec file was created
222267
if [ -f "specs/$SPEC_ID.md" ]; then
223268
git add "specs/$SPEC_ID.md"
224269
@@ -237,15 +282,36 @@ jobs:
237282
exit 1
238283
fi
239284
240-
- name: Post comment with spec creation summary
285+
- name: Post comment with summary
241286
if: steps.check.outputs.should_run == 'true'
242287
env:
243288
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
244289
SPEC_ID: ${{ steps.extract_spec.outputs.spec_id }}
245290
BRANCH: ${{ steps.create_branch.outputs.feature_branch }}
246291
ISSUE_NUMBER: ${{ github.event.issue.number }}
292+
IS_UPDATE: ${{ steps.check.outputs.is_update }}
293+
TARGET_LIBRARY: ${{ steps.check.outputs.target_library }}
247294
run: |
248-
gh issue comment "$ISSUE_NUMBER" --body "## Spec Created
295+
if [[ "$IS_UPDATE" == "true" ]]; then
296+
if [[ -n "$TARGET_LIBRARY" ]]; then
297+
SCOPE="**$TARGET_LIBRARY** only"
298+
else
299+
SCOPE="all 9 libraries"
300+
fi
301+
302+
gh issue comment "$ISSUE_NUMBER" --body "## 🔄 Update Request
303+
304+
**Spec ID:** \`$SPEC_ID\`
305+
**Branch:** \`$BRANCH\`
306+
**Scope:** $SCOPE
307+
308+
### Next Steps
309+
Triggering code regeneration...
310+
311+
---
312+
:robot: *[gen-create-spec workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
313+
else
314+
gh issue comment "$ISSUE_NUMBER" --body "## ✅ Spec Created
249315
250316
**Spec ID:** \`$SPEC_ID\`
251317
**Branch:** \`$BRANCH\`
@@ -256,6 +322,7 @@ jobs:
256322
257323
---
258324
:robot: *[gen-create-spec workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
325+
fi
259326
260327
# ============================================================================
261328
# Step 2: Trigger library generation
@@ -274,11 +341,19 @@ jobs:
274341
SPEC_ID: ${{ needs.create-spec.outputs.spec_id }}
275342
FEATURE_BRANCH: ${{ needs.create-spec.outputs.feature_branch }}
276343
ISSUE_NUMBER: ${{ github.event.issue.number }}
344+
TARGET_LIBRARY: ${{ needs.create-spec.outputs.target_library }}
277345
run: |
278-
gh workflow run gen-new-plot.yml \
279-
--repo ${{ github.repository }} \
280-
-f spec_id="$SPEC_ID" \
281-
-f feature_branch="$FEATURE_BRANCH" \
282-
-f issue_number="$ISSUE_NUMBER"
346+
# Build command with optional target_library
347+
CMD="gh workflow run gen-new-plot.yml --repo ${{ github.repository }}"
348+
CMD="$CMD -f spec_id=\"$SPEC_ID\""
349+
CMD="$CMD -f feature_branch=\"$FEATURE_BRANCH\""
350+
CMD="$CMD -f issue_number=\"$ISSUE_NUMBER\""
351+
352+
if [[ -n "$TARGET_LIBRARY" ]]; then
353+
CMD="$CMD -f target_library=\"$TARGET_LIBRARY\""
354+
echo "::notice::Triggering gen-new-plot.yml for $SPEC_ID (library: $TARGET_LIBRARY)"
355+
else
356+
echo "::notice::Triggering gen-new-plot.yml for $SPEC_ID (all libraries)"
357+
fi
283358
284-
echo "::notice::Triggered gen-new-plot.yml for $SPEC_ID"
359+
eval $CMD

.github/workflows/gen-new-plot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
description: "Main issue number"
1717
required: true
1818
type: string
19+
target_library:
20+
description: "Single library to regenerate (empty = all libraries)"
21+
required: false
22+
type: string
23+
default: ""
1924

2025
concurrency:
2126
group: spec-to-code-${{ inputs.issue_number }}
@@ -36,6 +41,7 @@ jobs:
3641
spec_id: ${{ inputs.spec_id }}
3742
feature_branch: ${{ inputs.feature_branch }}
3843
issue_number: ${{ inputs.issue_number }}
44+
target_library: ${{ inputs.target_library }}
3945

4046
steps:
4147
- name: Log inputs
@@ -44,6 +50,7 @@ jobs:
4450
echo "Spec ID: ${{ inputs.spec_id }}"
4551
echo "Feature Branch: ${{ inputs.feature_branch }}"
4652
echo "Issue Number: ${{ inputs.issue_number }}"
53+
echo "Target Library: ${{ inputs.target_library || 'all' }}"
4754
echo "======================="
4855
4956
- name: Checkout repository
@@ -97,13 +104,20 @@ jobs:
97104
id: create
98105
env:
99106
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
TARGET_LIBRARY: ${{ inputs.target_library }}
100108
run: |
101109
SPEC_ID="${{ inputs.spec_id }}"
102110
PARENT_NUM="${{ inputs.issue_number }}"
103111
FEATURE_BRANCH="${{ inputs.feature_branch }}"
104112
PARENT_NODE_ID=$(gh api repos/${{ github.repository }}/issues/$PARENT_NUM --jq '.node_id')
105113
106114
for LIBRARY in ${{ env.LIBRARIES }}; do
115+
# Skip if target_library is set and doesn't match
116+
if [[ -n "$TARGET_LIBRARY" && "$TARGET_LIBRARY" != "$LIBRARY" ]]; then
117+
echo "::notice::Skipping $LIBRARY (target: $TARGET_LIBRARY)"
118+
continue
119+
fi
120+
107121
echo "Creating sub-issue for $LIBRARY..."
108122
109123
# Check if sub-issue already exists
@@ -155,6 +169,7 @@ jobs:
155169
# ============================================================================
156170
generate-matplotlib:
157171
needs: [setup, create-sub-issues]
172+
if: inputs.target_library == '' || inputs.target_library == 'matplotlib'
158173
uses: ./.github/workflows/gen-library-impl.yml
159174
with:
160175
spec_id: ${{ inputs.spec_id }}
@@ -168,6 +183,7 @@ jobs:
168183

169184
generate-seaborn:
170185
needs: [setup, create-sub-issues]
186+
if: inputs.target_library == '' || inputs.target_library == 'seaborn'
171187
uses: ./.github/workflows/gen-library-impl.yml
172188
with:
173189
spec_id: ${{ inputs.spec_id }}
@@ -181,6 +197,7 @@ jobs:
181197

182198
generate-plotly:
183199
needs: [setup, create-sub-issues]
200+
if: inputs.target_library == '' || inputs.target_library == 'plotly'
184201
uses: ./.github/workflows/gen-library-impl.yml
185202
with:
186203
spec_id: ${{ inputs.spec_id }}
@@ -194,6 +211,7 @@ jobs:
194211

195212
generate-bokeh:
196213
needs: [setup, create-sub-issues]
214+
if: inputs.target_library == '' || inputs.target_library == 'bokeh'
197215
uses: ./.github/workflows/gen-library-impl.yml
198216
with:
199217
spec_id: ${{ inputs.spec_id }}
@@ -207,6 +225,7 @@ jobs:
207225

208226
generate-altair:
209227
needs: [setup, create-sub-issues]
228+
if: inputs.target_library == '' || inputs.target_library == 'altair'
210229
uses: ./.github/workflows/gen-library-impl.yml
211230
with:
212231
spec_id: ${{ inputs.spec_id }}
@@ -220,6 +239,7 @@ jobs:
220239

221240
generate-plotnine:
222241
needs: [setup, create-sub-issues]
242+
if: inputs.target_library == '' || inputs.target_library == 'plotnine'
223243
uses: ./.github/workflows/gen-library-impl.yml
224244
with:
225245
spec_id: ${{ inputs.spec_id }}
@@ -233,6 +253,7 @@ jobs:
233253

234254
generate-pygal:
235255
needs: [setup, create-sub-issues]
256+
if: inputs.target_library == '' || inputs.target_library == 'pygal'
236257
uses: ./.github/workflows/gen-library-impl.yml
237258
with:
238259
spec_id: ${{ inputs.spec_id }}
@@ -246,6 +267,7 @@ jobs:
246267

247268
generate-highcharts:
248269
needs: [setup, create-sub-issues]
270+
if: inputs.target_library == '' || inputs.target_library == 'highcharts'
249271
uses: ./.github/workflows/gen-library-impl.yml
250272
with:
251273
spec_id: ${{ inputs.spec_id }}
@@ -259,6 +281,7 @@ jobs:
259281

260282
generate-letsplot:
261283
needs: [setup, create-sub-issues]
284+
if: inputs.target_library == '' || inputs.target_library == 'letsplot'
262285
uses: ./.github/workflows/gen-library-impl.yml
263286
with:
264287
spec_id: ${{ inputs.spec_id }}

0 commit comments

Comments
 (0)