Loading...
Loading...
Compare original and translation side by side
@greptile-apps@greptile-apps review@greptile-apps@greptile-apps review--max-iterations N--max-iterations Nundefinedundefined
For self-hosted GitLab instances whose hostname doesn't contain "gitlab", the user can override by passing `--vcs gitlab` as an input. For Perforce, pass `--vcs perforce`.
对于主机名不包含“gitlab”的自托管 GitLab 实例,用户可以通过传入 `--vcs gitlab` 作为输入来覆盖检测结果。对于 Perforce,传入 `--vcs perforce`。gh pr view --json number,headRefName -q '{number: .number, branch: .headRefName}'glab mr view --output json | jq '{iid: .iid, branch: .source_branch}'undefinedgh pr view --json number,headRefName -q '{number: .number, branch: .headRefName}'glab mr view --output json | jq '{iid: .iid, branch: .source_branch}'undefined
Ensure the correct workspace (`p4 client`) is set before proceeding.
Key field differences:
- GitHub: `number`, `headRefName`, `headRefOid`
- GitLab: `iid`, `source_branch`, `sha`
- Perforce: changelist number, `P4CLIENT`, shelved files
继续操作前,确保已设置正确的工作区(`p4 client`)。
关键字段差异:
- GitHub:`number`、`headRefName`、`headRefOid`
- GitLab:`iid`、`source_branch`、`sha`
- Perforce:changelist 编号、`P4CLIENT`、已 shelve 的文件--max-iterations--max-iterationsgit pushundefinedgit pushundefined
Wait for checks to start after push/shelve:
```bash
sleep 5GREPTILE_STATE=$(gh pr checks <PR_NUMBER> --json name,state | jq -r '.[] | select(.name | test("greptile"; "i")) | .state')PENDINGIN_PROGRESSif [ "$GREPTILE_STATE" != "PENDING" ] && [ "$GREPTILE_STATE" != "IN_PROGRESS" ]; then
gh pr comment <PR_NUMBER> --body "@greptile-apps review"
fiHEAD_SHA=$(gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid)
ATTEMPTS=0
MAX_ATTEMPTS=60
POLL_INTERVAL_SECONDS=10
while true; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -gt "$MAX_ATTEMPTS" ]; then
echo "Timed out waiting for the Greptile check run after approximately 10 minutes." >&2
exit 1
fi
GREPTILE_CHECK=$(gh api "repos/{owner}/{repo}/commits/$HEAD_SHA/check-runs" \
--jq '.check_runs[] | select(.name | test("greptile"; "i"))' 2>/dev/null)
if [ -z "$GREPTILE_CHECK" ]; then
echo "Waiting for Greptile check to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
STATUS=$(echo "$GREPTILE_CHECK" | jq -r '.status // "completed"')
CONCLUSION=$(echo "$GREPTILE_CHECK" | jq -r '.conclusion // "pending"')
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" = "success" ]; then
echo "Greptile check passed!"
else
echo "Greptile check completed with: $CONCLUSION"
fi
break
fi
echo "Waiting for Greptile... (status: $STATUS)"
sleep "$POLL_INTERVAL_SECONDS"
doneupdated_atgh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100" \
--jq '[.[] | select(.user.login | test("greptile"; "i"))] | sort_by(.updated_at) | last | {updated_at, body}'PIPELINES=$(glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines")
GREPTILE_RUNNING=$(echo "$PIPELINES" | jq '[.[] | select(.status == "running" or .status == "pending")] | length')if [ "$GREPTILE_RUNNING" = "0" ]; then
glab mr note <MR_IID> --message "@greptile-apps review"
fip4 shelveHEAD_SHA=$(glab mr view <MR_IID> --output json | jq -r '.sha')
ATTEMPTS=0
MAX_ATTEMPTS=60
POLL_INTERVAL_SECONDS=10
while true; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -gt "$MAX_ATTEMPTS" ]; then
echo "Timed out waiting for the Greptile pipeline job after approximately 10 minutes." >&2
exit 1
fi
PIPELINES=$(glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines")
# Find the most recent pipeline for this SHA
PIPELINE_ID=$(echo "$PIPELINES" | jq -r --arg sha "$HEAD_SHA" \
'[.[] | select(.sha == $sha)] | sort_by(.id) | last | .id // empty')
if [ -z "$PIPELINE_ID" ]; then
echo "Waiting for Greptile pipeline to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
JOBS=$(glab api "projects/:fullpath/pipelines/$PIPELINE_ID/jobs")
GREPTILE_JOB=$(echo "$JOBS" | jq '.[] | select(.name | test("greptile"; "i"))')
if [ -z "$GREPTILE_JOB" ]; then
echo "Waiting for Greptile job to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
JOB_STATUS=$(echo "$GREPTILE_JOB" | jq -r '.status')
if [ "$JOB_STATUS" = "success" ] || [ "$JOB_STATUS" = "failed" ] || [ "$JOB_STATUS" = "canceled" ]; then
echo "Greptile job completed with: $JOB_STATUS"
break
fi
echo "Waiting for Greptile... (status: $JOB_STATUS)"
sleep "$POLL_INTERVAL_SECONDS"
done
等待检查在 push/shelve 后启动:
```bash
sleep 5GREPTILE_STATE=$(gh pr checks <PR_NUMBER> --json name,state | jq -r '.[] | select(.name | test("greptile"; "i")) | .state')PENDINGIN_PROGRESSif [ "$GREPTILE_STATE" != "PENDING" ] && [ "$GREPTILE_STATE" != "IN_PROGRESS" ]; then
gh pr comment <PR_NUMBER> --body "@greptile-apps review"
fiHEAD_SHA=$(gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid)
ATTEMPTS=0
MAX_ATTEMPTS=60
POLL_INTERVAL_SECONDS=10
while true; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -gt "$MAX_ATTEMPTS" ]; then
echo "Timed out waiting for the Greptile check run after approximately 10 minutes." >&2
exit 1
fi
GREPTILE_CHECK=$(gh api "repos/{owner}/{repo}/commits/$HEAD_SHA/check-runs" \
--jq '.check_runs[] | select(.name | test("greptile"; "i"))' 2>/dev/null)
if [ -z "$GREPTILE_CHECK" ]; then
echo "Waiting for Greptile check to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
STATUS=$(echo "$GREPTILE_CHECK" | jq -r '.status // "completed"')
CONCLUSION=$(echo "$GREPTILE_CHECK" | jq -r '.conclusion // "pending"')
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" = "success" ]; then
echo "Greptile check passed!"
else
echo "Greptile check completed with: $CONCLUSION"
fi
break
fi
echo "Waiting for Greptile... (status: $STATUS)"
sleep "$POLL_INTERVAL_SECONDS"
doneupdated_atgh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100" \
--jq '[.[] | select(.user.login | test("greptile"; "i"))] | sort_by(.updated_at) | last | {updated_at, body}'PIPELINES=$(glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines")
GREPTILE_RUNNING=$(echo "$PIPELINES" | jq '[.[] | select(.status == "running" or .status == "pending")] | length')if [ "$GREPTILE_RUNNING" = "0" ]; then
glab mr note <MR_IID> --message "@greptile-apps review"
fip4 shelveHEAD_SHA=$(glab mr view <MR_IID> --output json | jq -r '.sha')
ATTEMPTS=0
MAX_ATTEMPTS=60
POLL_INTERVAL_SECONDS=10
while true; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -gt "$MAX_ATTEMPTS" ]; then
echo "Timed out waiting for the Greptile pipeline job after approximately 10 minutes." >&2
exit 1
fi
PIPELINES=$(glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines")
# Find the most recent pipeline for this SHA
PIPELINE_ID=$(echo "$PIPELINES" | jq -r --arg sha "$HEAD_SHA" \
'[.[] | select(.sha == $sha)] | sort_by(.id) | last | .id // empty')
if [ -z "$PIPELINE_ID" ]; then
echo "Waiting for Greptile pipeline to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
JOBS=$(glab api "projects/:fullpath/pipelines/$PIPELINE_ID/jobs")
GREPTILE_JOB=$(echo "$JOBS" | jq '.[] | select(.name | test("greptile"; "i"))')
if [ -z "$GREPTILE_JOB" ]; then
echo "Waiting for Greptile job to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
JOB_STATUS=$(echo "$GREPTILE_JOB" | jq -r '.status')
if [ "$JOB_STATUS" = "success" ] || [ "$JOB_STATUS" = "failed" ] || [ "$JOB_STATUS" = "canceled" ]; then
echo "Greptile job completed with: $JOB_STATUS"
break
fi
echo "Waiting for Greptile... (status: $JOB_STATUS)"
sleep "$POLL_INTERVAL_SECONDS"
donegh pr view <PR_NUMBER> --json body -q '.body'gh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100"updated_atgh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviewsgreptile-apps[bot]greptile-apps-staging[bot]glab mr view <MR_IID> --output json | jq -r '.description'glab api "projects/:fullpath/merge_requests/<MR_IID>/notes"author.usernamep4 describe -s <CL_NUMBER>3/55/5Confidence: 3/5updated_atgh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/commentsglab api "projects/:fullpath/merge_requests/<MR_IID>/discussions"DiffNotenotes[0].type == "DiffNote""resolved": falsegh pr view <PR_NUMBER> --json body -q '.body'gh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100"updated_atgh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviewsgreptile-apps[bot]greptile-apps-staging[bot]glab mr view <MR_IID> --output json | jq -r '.description'glab api "projects/:fullpath/merge_requests/<MR_IID>/notes"author.usernamep4 describe -s <CL_NUMBER>3/55/5Confidence: 3/5updated_atgh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/commentsglab api "projects/:fullpath/merge_requests/<MR_IID>/discussions""resolved": falseDiffNotenotes[0].type == "DiffNote"--max-iterations--max-iterationsgh api graphql -f query='
query($cursor: String) {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PR_NUMBER) {
reviewThreads(first: 100, after: $cursor) {
pageInfo { hasNextPage endCursor }
nodes {
id
isResolved
comments(first: 1) {
nodes { body path author { login } }
}
}
}
}
}
}'gh api graphql -f query='
mutation {
t1: resolveReviewThread(input: {threadId: "ID1"}) { thread { isResolved } }
t2: resolveReviewThread(input: {threadId: "ID2"}) { thread { isResolved } }
}'glab api "projects/:fullpath/merge_requests/<MR_IID>/discussions?per_page=100""resolved": falseidglab api --method PUT \
"projects/:fullpath/merge_requests/<MR_IID>/discussions/<DISCUSSION_ID>" \
--field resolved=truegh api graphql -f query='
query($cursor: String) {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PR_NUMBER) {
reviewThreads(first: 100, after: $cursor) {
pageInfo { hasNextPage endCursor }
nodes {
id
isResolved
comments(first: 1) {
nodes { body path author { login } }
}
}
}
}
}
}'gh api graphql -f query='
mutation {
t1: resolveReviewThread(input: {threadId: "ID1"}) { thread { isResolved } }
t2: resolveReviewThread(input: {threadId: "ID2"}) { thread { isResolved } }
}'glab api "projects/:fullpath/merge_requests/<MR_IID>/discussions?per_page=100""resolved": falseidglab api --method PUT \
"projects/:fullpath/merge_requests/<MR_IID>/discussions/<DISCUSSION_ID>" \
--field resolved=truegit add -A
git commit -m "address greptile review feedback (greploop iteration N)"
git pushundefinedgit add -A
git commit -m "address greptile review feedback (greploop iteration N)"
git pushundefined
Wait for checks to start after push/shelve:
```bash
sleep 5
等待检查在 push/shelve 后启动:
```bash
sleep 5| Field | Value |
|---|---|
| Platform | GitHub / GitLab / Perforce |
| Iterations | N |
| Final confidence | X/5 |
| Comments resolved | N |
| Remaining comments | N (if any) |
| 字段 | 值 |
|---|---|
| 平台 | GitHub / GitLab / Perforce |
| 迭代次数 | N |
| 最终置信度 | X/5 |
| 已解决评论 | N |
| 剩余评论 | N(如有) |
Greploop complete.
Platform: GitHub
Iterations: 2
Confidence: 5/5
Resolved: 7 comments
Remaining: 0<N>--max-iterationsGreploop stopped after <N> iterations (--max-iterations <N>).
Platform: GitLab
Confidence: 4/5
Resolved: 12 comments
Remaining: 2
Remaining issues:
- src/auth.ts:45 — "Consider rate limiting this endpoint"
- src/db.ts:112 — "Missing index on user_id column"Greploop complete.
Platform: Perforce
Changelist: 12345
Iterations: 3
Confidence: 5/5
Resolved: 9 comments
Remaining: 0Greploop complete.
Platform: GitHub
Iterations: 2
Confidence: 5/5
Resolved: 7 comments
Remaining: 0<N>--max-iterationsGreploop stopped after <N> iterations (--max-iterations <N>).
Platform: GitLab
Confidence: 4/5
Resolved: 12 comments
Remaining: 2
Remaining issues:
- src/auth.ts:45 — "Consider rate limiting this endpoint"
- src/db.ts:112 — "Missing index on user_id column"Greploop complete.
Platform: Perforce
Changelist: 12345
Iterations: 3
Confidence: 5/5
Resolved: 9 comments
Remaining: 0