Complete Task

Complete the current task following the defined workflow

npelloux 2 updated 5mo ago
Claude CodeGeneric
View source ↗
---
description: Complete the current task following the defined workflow
---

# Complete Task

## Workflow

```text
/complete-task
    │
    ▼
Main agent runs pipeline directly
    │
    ├── Verify gate → FAIL → return to main
    ├── code-review subagent → FAIL → return findings + next steps
    ├── Task-check subagent → FAIL → return issues
    ├── submit-pr subagent → captures output
    ├── Check reviewDecision (CHANGES_REQUESTED = not mergeable)
    ├── Address ALL CodeRabbit feedback (comments + nitpicks)
    ├── Re-run submit-pr if fixes made
    └── Return SUCCESS with PR ready to merge

Usage

/complete-task                    # Full pipeline
/complete-task --feedback-rejected # Skip code review

Instructions

Run this pipeline directly (do NOT spawn a subagent to orchestrate - subagents cannot spawn other subagents). Stop and return on first failure.

  1. Verify gate: Run pnpm nx run-many -t lint,typecheck,test (use 5 minute timeout)

    • FAIL → return: VERIFY GATE FAILED [paste the COMPLETE error output here - do not summarize] NEXT STEPS: Fix the errors and re-run /complete-task LOOP CONTROL: If this is your third successive attempt, ask the user for help.
  2. Code review [SKIP IF --feedback-rejected]:

    • Use Task tool with subagent_type: "code-review", prompt: "Review changed files"
    • PASS → continue
    • FAIL → return: CODE REVIEW FAILED [paste the COMPLETE output from code-review subagent here - do not summarize] NEXT STEPS: - Fix issues and re-run /complete-task - OR reject all findings and re-run /complete-task --feedback-rejected LOOP CONTROL: If this is your third successive attempt, ask the user for help.
  3. Task-check [SKIP IF marker exists OR no issue]:

    • Get current branch: git branch --show-current
    • Extract issue number from branch (pattern: issue-<NUMBER>-...)
    • If no issue number found → skip to step 4 (no task to verify)
    • Check if /tmp/task-check-done-<branch>.marker exists
    • If marker exists → skip to step 4
    • If missing:
      • Fetch issue details: gh issue view <issue-number> --json title,body --jq '{title: .title, body: .body}'
      • Build work summary: list changed files via git diff --name-only main
      • Use Task tool with subagent_type: "task-check", prompt:
        Task ID: <issue-number>
        Task location: Inline (see task definition below)
        
        Task definition (fetched from gh issue view <issue-number>):
        <task-details>
        {
          "title": "<title from gh output>",
          "body": "<body from gh output>"
        }
        </task-details>
        
        Work summary: Modified files: <list of changed files>
        Attempt: 1
        
      • FAIL → return: TASK CHECK FAILED [paste the COMPLETE output here - do not summarize] NEXT STEPS: Address the issues and re-run /complete-task LOOP CONTROL: If this is your third successive attempt, ask the user for help.
      • PASS → create marker: date > /tmp/task-check-done-<branch>.marker
  4. Submit PR:

    • Use Task tool with subagent_type: "submit-pr", prompt: "Submit the PR"
    • FAIL → return: SUBMIT PR FAILED [paste the COMPLETE raw output here - do not summarize] NEXT STEPS: Address the issues and re-run /complete-task LOOP CONTROL: If this is your third successive attempt, ask the user for help.
  5. Resolve CodeRabbit feedback (principles: CHANGES_REQUESTED means not mergeable; nitpicks contain valuable information; every unresolved item must be addressed):

    • Run ./scripts/get-pr-feedback.sh to get unresolved feedback using GitHub's native GraphQL API

    • If "✓ No unresolved feedback" → skip to SUCCESS

    • For EACH unresolved item (CRITICAL, MAJOR, or NITPICK):

      • Either: Apply the fix (use the AI Prompt provided)
      • Or: Reply to the thread on GitHub explaining why not fixing
    • After addressing all items: commit, push, run ./scripts/submit-pr.sh --update

    • Run ./scripts/get-pr-feedback.sh again to verify no unresolved items remain

    • Repeat until "✓ No unresolved feedback"

    • SUCCESS → return structured message:

      PR READY FOR REVIEW

      Pipeline Status

      • Verify gate: PASS
      • Code review: PASS [or SKIPPED if --feedback-rejected]
      • Task check: PASS [or SKIPPED if no issue]
      • CI checks: PASS
      • CodeRabbit: APPROVED [or COMMENTED - no blocking issues]

      CodeRabbit Feedback Addressed

      [For each comment/nitpick: file:line - summary - FIXED or NOT FIXING: reason] OR "None"

      PR

      (ready to merge)

Debugging SonarCloud Failures

When SonarCloud fails with coverage issues:

  1. Get the exact failure details - Do NOT guess. Query the SonarCloud API:

    # Get PR number: gh pr view --json number -q .number
    curl -s "https://sonarcloud.io/api/measures/component_tree?component=NTCoding_living-architecture&pullRequest=<PR_NUMBER>&metricKeys=new_coverage&strategy=leaves&ps=100" | jq '.components[] | select(.measures[0].value == "0.0" or .measures[0].value == null) | {path: .path, coverage: .measures[0].value}'
    
  2. Identify the root cause based on actual data:

    • Files with null coverage = lcov.info paths not matching source files
    • Files with 0.0 coverage = tests not covering the code
    • Type-only files (interfaces, types) = exclude from coverage in sonar-project.properties

Maintain Complete Task?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Complete Task on getagentictools](https://getagentictools.com/loops/npelloux-complete-task?ref=badge)