kind: WavePipeline metadata: name: gt-issue-update description: "Refresh a stale Gitea issue by comparing it against recent codebase changes" release: true input: source: cli example: "public/librenotes 45 -- acceptance criteria are outdated after the worktree refactor" schema: type: string description: "owner/repo number [-- optional criticism or direction]" steps: - id: gather-context persona: gitea-analyst workspace: type: worktree branch: "{{ pipeline_id }}" exec: type: prompt source: | MANDATORY: You MUST call the Bash tool. NEVER say "tea CLI not installed" without trying. Input: {{ input }} Parse the input: - Split on " -- " to separate the repo+number from optional criticism. - The first part is " ". Extract REPO (first token) and NUMBER (second token). - If there is text after " -- ", that is the user's CRITICISM about what's wrong with the issue. - If there is no " -- ", criticism is empty. Execute these commands using the Bash tool: 1. tea --version 2. Fetch the full issue: tea issues list --repo REPO --login librete -o json -f index,title,body,labels,state,url --limit 50 Then filter the JSON for the issue matching NUMBER. 3. Get commits since the issue was created (cap at 100): git log --since="" --oneline -100 4. Scan the issue body for file path references (anything matching patterns like `internal/...`, `cmd/...`, `.wave/...`, or backtick-quoted paths). For each referenced file, check if it still exists using `ls -la `. 5. Read CLAUDE.md for current project context: Read the file CLAUDE.md from the repository root. After gathering ALL data, produce a JSON result matching the contract schema. output_artifacts: - name: issue_context path: .wave/artifact.json type: json required: true handover: max_retries: 1 contract: type: json_schema schema_path: .wave/contracts/issue-update-context.schema.json validate: true must_pass: true 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: | MANDATORY: You MUST call the Bash tool for any commands. NEVER generate fake output. The context artifact contains the gathered issue context. Your task: 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 handover: max_retries: 1 contract: type: json_schema schema_path: .wave/contracts/issue-update-draft.schema.json validate: true must_pass: true 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: | CRITICAL: You MUST use the Bash tool for all commands. Do NOT generate fake output. Step 1: Use Bash tool to verify tea works: tea --version Step 2: Extract the repo and issue number from the available artifacts. Step 3: Apply the update: - If title_changed is true: tea issues edit --repo --login librete -t "" - Write the updated_body to a temp file, then apply it: Write updated_body to /tmp/issue-body.md tea issues edit --repo --login librete -d "$(cat /tmp/issue-body.md)" - Clean up /tmp/issue-body.md after applying. Step 4: Verify the update was applied: tea issues list --repo --login librete -o json -f index,title,body,url --limit 50 Then filter for the specific issue number. Compare the returned title and body against what was intended. Flag any discrepancies. Step 5: 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" handover: max_retries: 1 contract: type: json_schema schema_path: .wave/contracts/issue-update-result.schema.json validate: true must_pass: true allow_recovery: true recovery_level: progressive progressive_validation: false