Files
code-crispies/.wave/pipelines/ops-issue-quality.yaml

196 lines
6.1 KiB
YAML

kind: WavePipeline
metadata:
name: ops-issue-quality
description: "Scan open issues for quality and post enhancement suggestions on poor-scoring ones"
release: true
skills:
- gh-cli
requires:
tools:
- gh
input:
source: cli
example: "re-cinq/wave"
schema:
type: string
description: "Repository in owner/repo format"
steps:
- id: scan
persona: "gitea-analyst"
model: claude-haiku
workspace:
mount:
- source: ./
target: /project
mode: readonly
exec:
type: prompt
source: |
Scan all open issues in the repository and produce a quality report.
Repository: {{ input }}
Split the input on "/" to get OWNER and REPO.
## Fetch Open Issues
```bash
{{ forge.cli_tool }} issue list --repo {{ input }} --state open --limit 200 \
--json number,title,body,labels,url,assignees,milestone,createdAt,updatedAt,comments
```
## Analyze Each Issue
For every issue (skip pull requests — items where the URL contains "/pull/"), evaluate:
1. **Title quality**
- Too short (< 10 chars): -20 points
- All lowercase (> 5 chars): -5 points
- All uppercase (> 5 chars): -10 points
- Vague terms ("issue", "problem", "help", "bug?", "question") with title < 30 chars: -10 points
- Fewer than 3 words: -15 points
2. **Body quality**
- Empty body: -40 points
- Body < 50 chars: -25 points
- Body < 100 chars: -10 points
- Single sentence (< 2 sentence-ending punctuation marks) with body > 20 chars: -10 points
- No structured sections (missing keywords like "steps to reproduce", "expected behavior", "actual behavior", "environment", "version", "screenshot", "reproduction") with body > 100 chars: -5 points
3. **Labels**
- No labels: -10 points
Start every issue at score 100 and apply deductions. Floor at 0.
## Output
Write a JSON file to `.wave/artifacts/quality-report.json` with this structure:
```json
{
"repository": {
"owner": "<OWNER>",
"name": "<REPO>"
},
"total_issues": <count of issues fetched>,
"analyzed_count": <count of issues analyzed (excluding PRs)>,
"poor_quality_issues": [
{
"number": <issue number>,
"title": "<issue title>",
"body": "<issue body — truncate at 500 chars>",
"quality_score": <0-100>,
"problems": ["<problem description>", ...],
"recommendations": ["<recommendation>", ...],
"labels": ["<label name>", ...],
"url": "<issue HTML URL>"
}
],
"quality_threshold": 70,
"timestamp": "<ISO 8601 timestamp>"
}
```
Include ALL issues with quality_score < 70 in `poor_quality_issues`, sorted by quality_score ascending (worst first).
output_artifacts:
- name: quality-report
path: .wave/artifacts/quality-report.json
type: json
required: true
retry:
policy: patient
max_attempts: 2
handover:
contract:
type: json_schema
source: .wave/artifacts/quality-report.json
schema_path: .wave/contracts/github-issue-analysis.schema.json
on_failure: retry
- id: enhance
persona: "gitea-commenter"
dependencies: [scan]
memory:
inject_artifacts:
- step: scan
artifact: quality-report
as: quality_report
workspace:
mount:
- source: ./
target: /project
mode: readonly
exec:
type: prompt
source: |
Post enhancement suggestions as comments on the worst-scoring issues.
Repository: {{ input }}
## Read Quality Report
Read the injected quality_report artifact. It contains the full quality analysis with per-issue scores, problems, and recommendations.
## Select Issues to Enhance
From `poor_quality_issues`, select issues where `quality_score < 50`. Process at most 10 issues to avoid comment spam.
If no issues have score < 50, check issues with score < 70 and select the 5 worst.
If there are no poor quality issues at all, write a summary noting the repository has good issue quality and skip posting.
## Post Enhancement Comment
For each selected issue, compose a helpful comment and post it:
```bash
cat > /tmp/issue-enhance-<NUMBER>.md <<'COMMENT_EOF'
## Issue Quality Suggestions
This issue has been automatically reviewed for clarity and completeness.
**Quality Score**: <score>/100
**Problems identified**:
<bulleted list of problems>
**Recommendations**:
<bulleted list of recommendations>
Consider updating this issue with the suggestions above to help maintainers triage and implement it more effectively.
---
*Posted by [Wave](https://github.com/re-cinq/wave) ops-issue-quality pipeline*
COMMENT_EOF
{{ forge.cli_tool }} issue comment <NUMBER> --repo {{ input }} --body-file /tmp/issue-enhance-<NUMBER>.md
```
Clean up temp files after posting each comment.
## Write Summary
After processing all issues, write `.wave/artifacts/enhancement-summary.md` with:
1. **Repository**: owner/repo
2. **Issues Scanned**: total count
3. **Poor Quality Issues**: count below threshold
4. **Comments Posted**: count and issue numbers
5. **Skipped**: count of issues not commented on and reason (score >= 50, or batch limit reached)
6. For each commented issue: number, title, score, and a brief note on the main problems addressed
output_artifacts:
- name: enhancement-summary
path: .wave/artifacts/enhancement-summary.md
type: markdown
required: true
retry:
policy: standard
max_attempts: 2
handover:
contract:
type: non_empty_file
source: .wave/artifacts/enhancement-summary.md