kind: WavePipeline metadata: name: ops-rewrite description: "Analyze and rewrite poorly documented issues" release: true skills: - gh-cli - software-design requires: tools: - gh 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: "gitea-analyst" model: claude-haiku 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 and - If "owner/repo NUM" → extract and - If "owner/repo" alone → batch mode, use {{ input }} as Step 2: Fetch issues via {{ forge.cli_tool }}. - Single: {{ forge.cli_tool }} issue view --repo --json number,title,body,labels,url - Batch: {{ forge.cli_tool }} issue list --repo {{ input }} --limit 10 --json number,title,body,labels,url IMPORTANT: If a specific issue number was parsed from the input but the fetch fails (not found, permissions error), STOP. Output JSON with repository set to , issues_to_enhance as empty array, and total_to_enhance: 0. Do NOT fall back to batch mode when a specific issue was requested. 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 retry: policy: none max_attempts: 1 handover: contract: type: json_schema schema_path: .wave/contracts/enhancement-plan.schema.json validate: true must_pass: true on_failure: retry allow_recovery: true recovery_level: progressive progressive_validation: false - id: apply-enhancements persona: "gitea-enhancer" dependencies: [scan-and-score] memory: inject_artifacts: - step: scan-and-score artifact: enhancement_plan as: impl_plan workspace: type: worktree branch: "{{ pipeline_id }}" exec: type: prompt source: | Read the "repository" field from the plan artifact to get . For each issue in issues_to_enhance: 1. Apply title: {{ forge.cli_tool }} issue edit --repo --title 'suggested_title' 2. Apply body — write to temp file first, then apply: cat > /tmp/issue-body.md <<'BODY_EOF' BODY_EOF {{ forge.cli_tool }} issue edit --repo --body-file /tmp/issue-body.md 3. Add labels: {{ forge.cli_tool }} issue edit --repo --add-label "label1,label2" 4. Capture URL: {{ forge.cli_tool }} issue view --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[*].url label: "Enhanced Issue" retry: policy: none max_attempts: 1 handover: contract: type: json_schema schema_path: .wave/contracts/enhancement-results.schema.json validate: true must_pass: true on_failure: retry allow_recovery: true recovery_level: progressive progressive_validation: false