Skill Tracer
Skills › gstack › ship › greptile.md

greptile.md

95 lines · ship/sections/greptile.md at 3f79d81

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1<!-- AUTO-GENERATED from greptile.md.tmpl — do not edit directly -->
2<!-- Regenerate: bun run gen:skill-docs -->

<!-- AUTO-GENERATED from greptile.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs -->

Raw lines 1 to 2
3## Step 10: Address Greptile review comments (if PR exists)
4
5Check for a PR first. Greptile reviews a PR, so with no PR, no `gh`, no `gh` login or
6a non-GitHub remote there is nothing to triage yet:
7
8```bash
9if ! command -v gh >/dev/null 2>&1; then echo "PR: skip (gh not installed)"
10elif ! gh auth status >/dev/null 2>&1; then echo "PR: skip (gh not logged in)"
11elif ! _GH_ERR=$(gh repo view --json nameWithOwner -q .nameWithOwner 2>&1 >/dev/null); then echo "PR: skip (not a GitHub remote: $(printf '%s' "$_GH_ERR" | head -1))"
12elif _PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null); then echo "PR: exists"
13else case "$_PR_ERR" in *"no pull requests found"*) echo "PR: skip (no PR yet)" ;; *) echo "PR: skip (PR lookup failed: $(printf '%s' "$_PR_ERR" | head -1))" ;; esac
14fi
15```
17Only `PR: exists` dispatches. `PR: skip (<reason>)` → do not dispatch; record
18"Greptile: not run (<reason>); runs on the PR once it exists" and continue to Step 11.
20**Early PR (Step 6.5):** when the record holds `EARLY_PR` and `EARLY_PR_OPENED_AT`, first
21wait for Greptile's review of that PR, substituting both values:
23```bash
24~/.claude/skills/gstack/bin/gstack-greptile-early wait <pr-number> --since <opened-at>
25```
27Each call returns within about 90 seconds; relay its progress line. Rerun on
28`GREPTILE_REVIEW: pending`. `complete` dispatches below. `timeout` or `unavailable` takes
29the Unavailable triage route with that line as the reason, never a claim of zero
30comments. Comments on the early head are triaged against the current diff
31(`already_fixed` when the code has moved on).
33Dispatch a subagent through Agent with `subagent_type: "general-purpose"` and
34`run_in_background: false`, using Step 7's shared foreground-dispatch rule.
35It fetches and classifies all Greptile comments,
36including escalation tiers; the parent handles decisions and queues approved fixes.
38**Subagent prompt:**
40> You are classifying Greptile review comments for a /ship workflow. Read `~/.claude/skills/gstack/review/greptile-triage.md` and follow the fetch, filter, classify, and **escalation detection** steps. Do NOT fix code, do NOT reply to comments, do NOT commit — report only.
42> For each comment, assign: `classification` (`valid_actionable`, `already_fixed`, `false_positive`, `suppressed`), `escalation_tier` (1 or 2), the file:line or [top-level] tag, body summary, and permalink URL.
44> Return one JSON object on the LAST LINE:
45> `{"status":"complete|no_pr|unavailable","total":N,"comments":[{"classification":"...","escalation_tier":N,"ref":"file:line","summary":"...","permalink":"url"},...],"reason":"..."}`
46> Use `complete` only after a successful fetch, including zero comments; `no_pr` only after confirming no PR exists; `unavailable` for `gh`/API errors or incomplete classification. The latter two return zero total and an empty array. State the failure reason for `unavailable`; otherwise use an empty reason.
48**Parent processing:**
50Parse the LAST line as JSON. Require the declared status, a nonnegative integer
51total matching the comments array, and the status/reason invariants above. An
52unknown or missing status is unavailable, never an empty successful review.
54For `no_pr`, record "Greptile: no PR exists"; for `complete` with zero comments,
55record "Greptile: fetched, zero comments". Both continue to Step 11.
57**Unavailable triage:** A returned `unavailable`, failed dispatch, invalid result,
58or missing completion after ~10 minutes takes this route. Stop a running child
59and confirm it stopped before continuing. Print `Greptile triage did not complete — review the PR comments manually`.
60Include `Greptile triage: UNAVAILABLE (dispatch failed)` and the actual reason in
61Step 19's review results; Step 20 has no triage field. Continue to Step 11 without
62claiming zero comments or completed triage. This optional triage does not block ship.
64Otherwise, print: `+ {total} Greptile comments ({valid_actionable} valid, {already_fixed} already fixed, {false_positive} FP)`.
66For each comment in `comments`:
68**VALID & ACTIONABLE:** Use AskUserQuestion with:
69- The comment (file:line or [top-level] + body summary + permalink URL)
70- `RECOMMENDATION: Choose A because [one-line reason]`
71- Options: A) Fix now, B) Acknowledge and ship anyway, C) It's a false positive
72- If user chooses A: queue the approved fix without editing here. After that fix passes review and tests, use the **Fix reply template** from greptile-triage.md (inline diff + explanation) and save per-project/global greptile-history (type: fix).
73- If user chooses C: reply using the **False Positive reply template** from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp).
75**VALID BUT ALREADY FIXED:** Reply using the **Already Fixed reply template** from greptile-triage.md — no AskUserQuestion needed:
76- Include what was done and the fixing commit SHA
77- Save to both per-project and global greptile-history (type: already-fixed)
79**FALSE POSITIVE:** Use AskUserQuestion:
80- Show the comment and why you think it's wrong (file:line or [top-level] + body summary + permalink URL)
81- Options:
82 - A) Reply to Greptile explaining the false positive (recommended if clearly wrong)
83 - B) Fix it anyway (if trivial)
84 - C) Ignore silently
85- If user chooses A: reply using the **False Positive reply template** from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp)
86- If user chooses B: queue the approved fix, as above.
88**SUPPRESSED:** Skip silently — these are known false positives from previous triage.
90**After triage:** If fixes were approved, save their approvals and comment references.
91Run Step 9's full review/fix loop, then return here. Finish the saved replies
92without asking again about completed fixes, and classify new comments.
93With no queued fixes, continue to Step 11.
95---

Step 10: Address Greptile review comments (if PR exists)

Check for a PR first. Greptile reviews a PR, so with no PR, no gh, no gh login or a non-GitHub remote there is nothing to triage yet:

if ! command -v gh >/dev/null 2>&1; then echo "PR: skip (gh not installed)"
elif ! gh auth status >/dev/null 2>&1; then echo "PR: skip (gh not logged in)"
elif ! _GH_ERR=$(gh repo view --json nameWithOwner -q .nameWithOwner 2>&1 >/dev/null); then echo "PR: skip (not a GitHub remote: $(printf '%s' "$_GH_ERR" | head -1))"
elif _PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null); then echo "PR: exists"
else case "$_PR_ERR" in *"no pull requests found"*) echo "PR: skip (no PR yet)" ;; *) echo "PR: skip (PR lookup failed: $(printf '%s' "$_PR_ERR" | head -1))" ;; esac
fi

Only PR: exists dispatches. PR: skip (<reason>) → do not dispatch; record "Greptile: not run (<reason>); runs on the PR once it exists" and continue to Step 11.

Early PR (Step 6.5): when the record holds EARLY_PR and EARLY_PR_OPENED_AT, first wait for Greptile's review of that PR, substituting both values:

~/.claude/skills/gstack/bin/gstack-greptile-early wait <pr-number> --since <opened-at>

Each call returns within about 90 seconds; relay its progress line. Rerun on GREPTILE_REVIEW: pending. complete dispatches below. timeout or unavailable takes the Unavailable triage route with that line as the reason, never a claim of zero comments. Comments on the early head are triaged against the current diff (already_fixed when the code has moved on).

Dispatch a subagent through Agent with subagent_type: "general-purpose" and run_in_background: false, using Step 7's shared foreground-dispatch rule. It fetches and classifies all Greptile comments, including escalation tiers; the parent handles decisions and queues approved fixes.

Subagent prompt:

You are classifying Greptile review comments for a /ship workflow. Read ~/.claude/skills/gstack/review/greptile-triage.md and follow the fetch, filter, classify, and escalation detection steps. Do NOT fix code, do NOT reply to comments, do NOT commit — report only. For each comment, assign: classification (valid_actionable, already_fixed, false_positive, suppressed), escalation_tier (1 or 2), the file:line or [top-level] tag, body summary, and permalink URL. Return one JSON object on the LAST LINE: {"status":"complete|no_pr|unavailable","total":N,"comments":[{"classification":"...","escalation_tier":N,"ref":"file:line","summary":"...","permalink":"url"},...],"reason":"..."} Use complete only after a successful fetch, including zero comments; no_pr only after confirming no PR exists; unavailable for gh/API errors or incomplete classification. The latter two return zero total and an empty array. State the failure reason for unavailable; otherwise use an empty reason.

Parent processing:

Parse the LAST line as JSON. Require the declared status, a nonnegative integer total matching the comments array, and the status/reason invariants above. An unknown or missing status is unavailable, never an empty successful review.

For no_pr, record "Greptile: no PR exists"; for complete with zero comments, record "Greptile: fetched, zero comments". Both continue to Step 11.

Unavailable triage: A returned unavailable, failed dispatch, invalid result, or missing completion after ~10 minutes takes this route. Stop a running child and confirm it stopped before continuing. Print Greptile triage did not complete — review the PR comments manually. Include Greptile triage: UNAVAILABLE (dispatch failed) and the actual reason in Step 19's review results; Step 20 has no triage field. Continue to Step 11 without claiming zero comments or completed triage. This optional triage does not block ship.

Otherwise, print: + {total} Greptile comments ({valid_actionable} valid, {already_fixed} already fixed, {false_positive} FP).

For each comment in comments:

VALID & ACTIONABLE: Use AskUserQuestion with:

  • The comment (file:line or [top-level] + body summary + permalink URL)
  • RECOMMENDATION: Choose A because [one-line reason]
  • Options: A) Fix now, B) Acknowledge and ship anyway, C) It's a false positive
  • If user chooses A: queue the approved fix without editing here. After that fix passes review and tests, use the Fix reply template from greptile-triage.md (inline diff + explanation) and save per-project/global greptile-history (type: fix).
  • If user chooses C: reply using the False Positive reply template from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp).

VALID BUT ALREADY FIXED: Reply using the Already Fixed reply template from greptile-triage.md — no AskUserQuestion needed:

  • Include what was done and the fixing commit SHA
  • Save to both per-project and global greptile-history (type: already-fixed)

FALSE POSITIVE: Use AskUserQuestion:

  • Show the comment and why you think it's wrong (file:line or [top-level] + body summary + permalink URL)
  • Options:
  • A) Reply to Greptile explaining the false positive (recommended if clearly wrong)
  • B) Fix it anyway (if trivial)
  • C) Ignore silently
  • If user chooses A: reply using the False Positive reply template from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp)
  • If user chooses B: queue the approved fix, as above.

SUPPRESSED: Skip silently — these are known false positives from previous triage.

After triage: If fixes were approved, save their approvals and comment references. Run Step 9's full review/fix loop, then return here. Finish the saved replies without asking again about completed fixes, and classify new comments. With no queued fixes, continue to Step 11.


Raw lines 3 to 95
Starts an agent dispatches :17
Starts an agent dispatch :17
Runs code bin/gstack-greptile-early :24
Starts an agent Dispatch :33
Starts an agent subagent :33
Starts an agent Subagent :38
Involves a person AskUserQuestion :68