kind: WavePipeline metadata: name: ops-refresh description: "Refresh a stale issue by comparing it against recent codebase changes" release: true skills: - gh-cli - software-design requires: tools: - gh input: source: cli example: "re-cinq/wave 45 -- acceptance criteria are outdated after the worktree refactor" schema: type: string description: "owner/repo number, or full issue URL [-- optional criticism or direction]" steps: - id: gather-context persona: "gitea-analyst" model: claude-haiku workspace: type: worktree branch: "{{ pipeline_id }}" exec: type: prompt source: | Input: {{ input }} Parse the input: - If the input is a URL (https://github.com/OWNER/REPO/issues/NUM), extract REPO and NUMBER. - If the input is "owner/repo number", extract REPO (first token) and NUMBER (second token). - Split on " -- " to separate the identifier from optional criticism. - If there is text after " -- ", that is the user's CRITICISM about what's wrong with the issue. Execute these steps: 1. Fetch the full issue: {{ forge.cli_tool }} issue view NUMBER --repo REPO --json number,title,body,labels,url,createdAt,comments 2. Get recent commits since the issue was created (cap at 30): git log --since="" --oneline -30 3. Get releases since the issue was created: {{ forge.cli_tool }} release list --repo REPO --limit 20 Filter to only releases after the issue's createdAt date. 4. Scan the issue body for file path references (backtick-quoted paths, relative paths). For each referenced file, check if it still exists. Produce a JSON result matching the contract schema. output_artifacts: - name: issue_context path: .wave/artifact.json type: json required: true retry: policy: none max_attempts: 1 handover: contract: type: json_schema schema_path: .wave/contracts/issue-update-context.schema.json validate: true must_pass: true on_failure: retry allow_recovery: true recovery_level: progressive progressive_validation: false - id: draft-update persona: "gitea-analyst" dependencies: [gather-context] memory: inject_artifacts: - step: gather-context artifact: issue_context as: context workspace: type: worktree branch: "{{ pipeline_id }}" exec: type: prompt source: | The context artifact contains the gathered issue context. Compare the original issue against the codebase changes and draft an updated version. Step 1: Analyze each section of the issue body. Classify each as: - STILL_VALID: Content is accurate and up-to-date - OUTDATED: Content references old behavior, removed files, or superseded patterns - INCOMPLETE: Content is partially correct but missing recent developments - WRONG: Content is factually incorrect given current codebase state Step 2: If there is user criticism (non-empty "criticism" field), address EVERY point raised. The criticism takes priority — it represents what the issue author thinks is wrong. Step 3: Draft the updated issue: - Preserve sections classified as STILL_VALID (do not rewrite what works) - Rewrite OUTDATED and WRONG sections to reflect current reality - Expand INCOMPLETE sections with missing information - If the title needs updating, draft a new title - Append a "---\n**Changes since original**" section at the bottom listing what changed and why Step 4: If file paths in the issue body are now missing (from referenced_files.missing), update or remove those references. Produce a JSON result matching the contract schema. output_artifacts: - name: update_draft path: .wave/artifact.json type: json required: true retry: policy: none max_attempts: 1 handover: contract: type: json_schema schema_path: .wave/contracts/issue-update-draft.schema.json validate: true must_pass: true on_failure: retry allow_recovery: true recovery_level: progressive progressive_validation: false - id: apply-update persona: "gitea-enhancer" dependencies: [draft-update] memory: inject_artifacts: - step: draft-update artifact: update_draft as: draft - step: gather-context artifact: issue_context as: context workspace: type: worktree branch: "{{ pipeline_id }}" exec: type: prompt source: | Extract the repo and issue number from the available artifacts. Apply the update: - If title_changed is true: {{ forge.cli_tool }} issue edit --repo --title '' - Write the updated_body to a temp file, then apply it: {{ forge.cli_tool }} issue edit --repo --body-file - Clean up the temp file after applying. Verify the update was applied: {{ forge.cli_tool }} issue view --repo --json number,title,body,url Compare the returned title and body against what was intended. Flag any discrepancies. Record the results as a JSON object matching the contract schema. output_artifacts: - name: update_result path: .wave/artifact.json type: json required: true outcomes: - type: issue extract_from: .wave/artifact.json json_path: .url label: "Updated Issue" retry: policy: none max_attempts: 1 handover: contract: type: json_schema schema_path: .wave/contracts/issue-update-result.schema.json validate: true must_pass: true on_failure: retry allow_recovery: true recovery_level: progressive progressive_validation: false