Files
code-crispies/.wave/pipelines/gh-rewrite.yaml
Michael Czechowski ab6dabd542
Some checks failed
CI / ci (push) Has been cancelled
Deploy / deploy (push) Has been cancelled
fix(ci): correct image digest separator
2026-04-30 12:20:26 +02:00

100 lines
3.3 KiB
YAML

kind: WavePipeline
metadata:
name: gh-rewrite
description: "Analyze and rewrite poorly documented GitHub issues"
release: true
input:
source: cli
example: "re-cinq/wave 42 or https://github.com/re-cinq/wave/issues/42"
schema:
type: string
description: "GitHub repo with optional issue number, or full issue URL"
steps:
- id: scan-and-score
persona: github-analyst
workspace:
type: worktree
branch: "{{ pipeline_id }}"
exec:
type: prompt
source: |
Input: {{ input }}
Step 1: Parse the input format.
- If URL (https://github.com/OWNER/REPO/issues/NUM) → extract <REPO> and <NUM>
- If "owner/repo NUM" → extract <REPO> and <NUM>
- If "owner/repo" alone → batch mode, use {{ input }} as <REPO>
Step 2: Fetch issues via gh CLI.
- Single: gh issue view <NUM> --repo <REPO> --json number,title,body,labels,url
- Batch: gh issue list --repo {{ input }} --limit 10 --json number,title,body,labels,url
Step 3: Score each issue quality (0-100) on title clarity, description completeness, labels, and acceptance criteria.
Step 4: For issues scoring below 70, create an enhancement plan with:
- suggested_title, body_template (preserving original content), suggested_labels, enhancements list
Output JSON with repository (owner/repo string), issues_to_enhance array, and total_to_enhance.
output_artifacts:
- name: enhancement_plan
path: .wave/artifact.json
type: json
required: true
handover:
max_retries: 1
contract:
type: json_schema
schema_path: .wave/contracts/github-enhancement-plan.schema.json
validate: true
must_pass: true
allow_recovery: true
recovery_level: progressive
progressive_validation: false
- id: apply-enhancements
persona: github-enhancer
dependencies: [scan-and-score]
memory:
inject_artifacts:
- step: scan-and-score
artifact: enhancement_plan
as: plan
workspace:
type: worktree
branch: "{{ pipeline_id }}"
exec:
type: prompt
source: |
Read the "repository" field from the plan artifact to get <REPO>.
For each issue in issues_to_enhance:
1. Apply title: gh issue edit <NUM> --repo <REPO> --title "suggested_title"
2. Apply body: gh issue edit <NUM> --repo <REPO> --body "body_template"
3. Add labels: gh issue edit <NUM> --repo <REPO> --add-label "label1,label2"
4. Capture URL: gh issue view <NUM> --repo <REPO> --json url --jq .url
Output JSON with enhanced_issues (issue_number, success, changes_made, url),
total_attempted, total_successful.
output_artifacts:
- name: enhancement_results
path: .wave/artifact.json
type: json
required: true
outcomes:
- type: issue
extract_from: .wave/artifact.json
json_path: .enhanced_issues[0].url
label: "Enhanced Issue"
handover:
max_retries: 1
contract:
type: json_schema
schema_path: .wave/contracts/github-enhancement-results.schema.json
validate: true
must_pass: true
allow_recovery: true
recovery_level: progressive
progressive_validation: false