@blogic-cz/agent-tools 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -309,9 +309,16 @@ bun gh-tool pr trigger-checks --pr 123 --workflow dotnet-pull-request.yml # only
309
309
  bun gh-tool pr watch --prs 123,124 --format jsonl --timeout 600
310
310
  bun gh-tool pr reply-and-resolve --comment-id 456 --body "Done" # infers PR and thread
311
311
  bun gh-tool pr request-review --repo be --pr 123 --reviewers alice,bob
312
+ bun gh-tool pr review --pr 123 --event comment --body "Notes, no verdict"
313
+ bun gh-tool pr review --pr 123 --event request-changes --body-stdin --confirm <<'EOF'
314
+ Rebase breaks two call sites; the Interop spec belongs in the domain module.
315
+ EOF
316
+ bun gh-tool pr review --pr 123 --event approve --confirm
312
317
  # Optional --pr/--thread-id retain legacy flow and are validated before either mutation.
313
318
  ```
314
319
 
320
+ `pr review` creates and submits a review in one call, for a verdict reached from a diff with no pending review to submit. `pr submit-review` takes the same `--event` for a review that is already pending. `--event approve` and `--event request-changes` change whether the PR can merge, so both require `--confirm`, the same gate `pr merge` uses; `--event comment` carries no verdict and needs none. `--event comment` and `--event request-changes` require a non-empty body — GitHub rejects a bodyless one. GitHub also refuses a verdict on your own PR; that failure returns a hint pointing at `--event comment` instead of the raw API error.
321
+
315
322
  Reruns preflight every target before mutation and fail closed with `evidence_unavailable` when attempt jobs or logs cannot be read. Failed jobs use one `gh run rerun RUN --failed` mutation per workflow run. Without `--watch`, output returns current attempt metadata immediately; with `--watch`, discovery and watching share one absolute `--timeout` deadline and report `discovery_timeout` or `watch_timeout` with latest attempt state. Repeated matching pre-test infrastructure failures return `escalation_required` without mutation. See [`skills/gh-tool/SKILL.md`](skills/gh-tool/SKILL.md) for operating guidance; this section is canonical for added output fields.
316
323
 
317
324
  Zero reported checks is a state, not an error: `gh pr checks` exits nonzero on an empty result, and every command that reads checks maps that to `[]`. `pr trigger-checks` covers the case where GitHub dropped the `pull_request` event and no run exists at all — it dispatches the named `workflow_dispatch` workflow **on the PR head branch**, then compares the created run's `headSha` back to the PR head and reports `matchesPrHead`. A run dispatched on the wrong ref goes green for another branch and must never be read as PR evidence, so `workflow run` also returns the discovered `runId`/`headSha` instead of a bare `dispatched: true`.
@@ -4,4 +4,6 @@ export declare const CI_CHECK_WATCH_TIMEOUT_MS: 600000;
4
4
  export declare const GRAPHQL_PAGE_SIZE: 100;
5
5
  export declare const GH_BINARY: "gh";
6
6
  export declare const MERGE_STRATEGIES: readonly ["squash", "merge", "rebase"];
7
+ export declare const REVIEW_EVENTS: readonly ["comment", "approve", "request-changes"];
8
+ export declare const DEFAULT_REVIEW_EVENT: "comment";
7
9
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/gh-tool/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAG,QAAiB,CAAC;AACxD,eAAO,MAAM,qBAAqB,EAAG,IAAa,CAAC;AACnD,eAAO,MAAM,yBAAyB,EAAG,MAAgB,CAAC;AAC1D,eAAO,MAAM,iBAAiB,EAAG,GAAY,CAAC;AAC9C,eAAO,MAAM,SAAS,EAAG,IAAa,CAAC;AAEvC,eAAO,MAAM,gBAAgB,wCAAyC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/gh-tool/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAG,QAAiB,CAAC;AACxD,eAAO,MAAM,qBAAqB,EAAG,IAAa,CAAC;AACnD,eAAO,MAAM,yBAAyB,EAAG,MAAgB,CAAC;AAC1D,eAAO,MAAM,iBAAiB,EAAG,GAAY,CAAC;AAC9C,eAAO,MAAM,SAAS,EAAG,IAAa,CAAC;AAEvC,eAAO,MAAM,gBAAgB,wCAAyC,CAAC;AAEvE,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAChF,eAAO,MAAM,oBAAoB,EAAG,SAAkB,CAAC"}
@@ -106,8 +106,8 @@ export declare const fetchReviewTriage: (prNumber: number | null, format?: "json
106
106
  };
107
107
  classification: ReviewTriageClassification;
108
108
  info: {
109
- headSha: string | null;
110
109
  baseSha: string | null;
110
+ headSha: string | null;
111
111
  number: number;
112
112
  url: string;
113
113
  title: string;
@@ -124,7 +124,6 @@ export declare const fetchReviewTriage: (prNumber: number | null, format?: "json
124
124
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
125
125
  reviewRequests: import("#gh/types").ReviewRequest[];
126
126
  headRefOid?: string;
127
- baseRefOid?: string;
128
127
  };
129
128
  unresolvedThreads: import("#gh/types").ReviewThread[];
130
129
  visibleOpenThreads: import("#gh/types").ReviewThread[];
@@ -341,9 +340,21 @@ export declare const prResolveCommand: Command.Command<"resolve", {
341
340
  readonly threadId: string;
342
341
  readonly repo: Option.Option<string>;
343
342
  }, {}, GitHubCommandError | import("#gh/errors").GitHubNotFoundError | import("#gh/errors").GitHubAuthError, GitHubService>;
343
+ export declare const prReviewCommand: Command.Command<"review", {
344
+ readonly body: Option.Option<string>;
345
+ readonly bodyFile: Option.Option<string>;
346
+ readonly bodyStdin: boolean;
347
+ readonly confirm: boolean;
348
+ readonly event: "approve" | "comment" | "request-changes";
349
+ readonly format: "json" | "toon";
350
+ readonly pr: Option.Option<number>;
351
+ readonly repo: Option.Option<string>;
352
+ }, {}, GitHubCommandError | import("#gh/errors").GitHubNotFoundError | import("#gh/errors").GitHubAuthError, GitHubService>;
344
353
  export declare const prSubmitReviewCommand: Command.Command<"submit-review", {
345
354
  readonly body: Option.Option<string>;
346
355
  readonly bodyFile: Option.Option<string>;
356
+ readonly confirm: boolean;
357
+ readonly event: "approve" | "comment" | "request-changes";
347
358
  readonly format: "json" | "toon";
348
359
  readonly pr: Option.Option<number>;
349
360
  readonly repo: Option.Option<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["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AM,sBAAsB;;;;;;;2HAwCqD,CAAC;AAEzF,eAAO,MAAM,4BAA4B;;;;;;2HA8BoC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;2HAmC0C,CAAC;AAExE,eAAO,MAAM,0BAA0B;;;;2HAqBtC,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;2HAmCyC,CAAC;AAErE,eAAO,MAAM,gBAAgB;;;;2HAiByC,CAAC;AAYvE,eAAO,MAAM,eAAe;;;;;;;;;2HAkD3B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;2HAsDjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,6DAI5B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,CAAC,EACT,MAAM,aAAa,CAAC,MAAM,CAAC;;EAW5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;2HAgCjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;2HAiBsD,CAAC;AAE1F,eAAO,MAAM,0BAA0B;;;;2HAuBtC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;2HAkDpC,CAAC"}
@@ -4,7 +4,7 @@ import type { GitHubAuthError, GitHubNotFoundError } from "#gh/errors";
4
4
  import { GitHubCommandError, GitHubMergeError } from "#gh/errors";
5
5
  import { GitHubService } from "#gh/service";
6
6
  export declare const NO_CHECKS_REPORTED_RE: RegExp;
7
- export declare const viewPR: (prNumber: number | null) => Effect.Effect<{
7
+ export declare const fetchPRView: (prNumber: number | null) => Effect.Effect<{
8
8
  headSha: string | null;
9
9
  baseSha: string | null;
10
10
  number: number;
@@ -23,7 +23,26 @@ export declare const viewPR: (prNumber: number | null) => Effect.Effect<{
23
23
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
24
24
  reviewRequests: import("#gh/types").ReviewRequest[];
25
25
  headRefOid?: string;
26
- baseRefOid?: string;
26
+ }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
27
+ export declare const viewPR: (prNumber: number | null) => Effect.Effect<{
28
+ baseSha: string | null;
29
+ headSha: string | null;
30
+ number: number;
31
+ url: string;
32
+ title: string;
33
+ headRefName: string;
34
+ baseRefName: string;
35
+ state: string;
36
+ isDraft: boolean;
37
+ mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
38
+ body: string;
39
+ author: {
40
+ login: string;
41
+ is_bot: boolean;
42
+ };
43
+ reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
44
+ reviewRequests: import("#gh/types").ReviewRequest[];
45
+ headRefOid?: string;
27
46
  }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
28
47
  export declare const detectPRStatus: () => Effect.Effect<{
29
48
  mode: "none";
@@ -50,8 +69,8 @@ export declare const listPRs: (opts: {
50
69
  search: string | null;
51
70
  }) => Effect.Effect<PRInfo[], GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
52
71
  export declare const waitForMergeable: (pr: number | null, timeoutSeconds: number) => Effect.Effect<{
53
- headSha: string | null;
54
72
  baseSha: string | null;
73
+ headSha: string | null;
55
74
  number: number;
56
75
  url: string;
57
76
  title: string;
@@ -68,7 +87,6 @@ export declare const waitForMergeable: (pr: number | null, timeoutSeconds: numbe
68
87
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
69
88
  reviewRequests: import("#gh/types").ReviewRequest[];
70
89
  headRefOid?: string;
71
- baseRefOid?: string;
72
90
  }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
73
91
  export declare const createPR: (opts: {
74
92
  base: string | null;
@@ -88,8 +106,8 @@ export declare const closePR: (opts: {
88
106
  comment: string | null;
89
107
  deleteBranch: boolean;
90
108
  }) => Effect.Effect<{
91
- headSha: string | null;
92
109
  baseSha: string | null;
110
+ headSha: string | null;
93
111
  number: number;
94
112
  url: string;
95
113
  title: string;
@@ -106,14 +124,13 @@ export declare const closePR: (opts: {
106
124
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
107
125
  reviewRequests: import("#gh/types").ReviewRequest[];
108
126
  headRefOid?: string;
109
- baseRefOid?: string;
110
127
  }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
111
128
  export declare const readyPR: (opts: {
112
129
  pr: number | null;
113
130
  }) => Effect.Effect<{
114
131
  wasAlreadyReady: boolean;
115
- headSha: string | null;
116
132
  baseSha: string | null;
133
+ headSha: string | null;
117
134
  number: number;
118
135
  url: string;
119
136
  title: string;
@@ -130,7 +147,6 @@ export declare const readyPR: (opts: {
130
147
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
131
148
  reviewRequests: import("#gh/types").ReviewRequest[];
132
149
  headRefOid?: string;
133
- baseRefOid?: string;
134
150
  }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
135
151
  export declare const editPR: (opts: {
136
152
  pr: number;
@@ -138,8 +154,8 @@ export declare const editPR: (opts: {
138
154
  body: string | null;
139
155
  base: string | null;
140
156
  }) => Effect.Effect<{
141
- headSha: string | null;
142
157
  baseSha: string | null;
158
+ headSha: string | null;
143
159
  number: number;
144
160
  url: string;
145
161
  title: string;
@@ -156,7 +172,6 @@ export declare const editPR: (opts: {
156
172
  reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
157
173
  reviewRequests: import("#gh/types").ReviewRequest[];
158
174
  headRefOid?: string;
159
- baseRefOid?: string;
160
175
  }, GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
161
176
  export declare const fetchChecks: (pr: number | null, watch: boolean, failFast: boolean, timeoutSeconds: number, quiet?: any) => Effect.Effect<CheckResult[], GitHubCommandError | GitHubNotFoundError | GitHubAuthError, GitHubService>;
162
177
  export declare const triggerChecks: (pr: number | null, workflow: string, fields: readonly string[]) => Effect.Effect<{
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EAEjB,WAAW,EACX,aAAa,EACb,MAAM,EAGN,iBAAiB,EAIlB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoL5C,eAAO,MAAM,qBAAqB,QAAwB,CAAC;AAiK3D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;iBAY4C,MAAM;iBAAe,MAAM;6EAMxF,CAAC;AAEH,eAAO,MAAM,cAAc;;cAkBL,cAAc,EAAE;;;;;QAqIb,MAAM;;;;;;;;kGAQ7B,CAAC;AAEH,eAAO,MAAM,OAAO;WACX,MAAM;WACN,MAAM;YACL,MAAM,GAAG,IAAI;UACf,MAAM,GAAG,IAAI;UACb,MAAM,GAAG,IAAI;YACX,MAAM,GAAG,IAAI;wGAkBrB,CAAC;AAMH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;iBAvMkC,MAAM;iBAAe,MAAM;6EAoOxF,CAAC;AAEH,eAAO,MAAM,QAAQ;UACb,MAAM,GAAG,IAAI;WACZ,MAAM;UACP,MAAM;WACL,OAAO;UACR,MAAM,GAAG,IAAI;sGA8FnB,CAAC;AA+FH,eAAO,MAAM,OAAO;QACd,MAAM;cACA,aAAa;kBACT,OAAO;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AC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAU5D,CAAC;AAEL,eAAO,MAAM,iBAAiB;;iBA9iCJ,MAAM,GAAG,IAAI;iBAAW,MAAM,GAAG,IAAI;;;;;;;;;;;;;;6EA2kC7D,CAAC;AAEH,eAAO,MAAM,qBAAqB;;iBA7kCR,MAAM,GAAG,IAAI;iBAAW,MAAM,GAAG,IAAI;;;;;;;;;;;;;;6EA6mC7D,CAAC;AAqBH,eAAO,MAAM,QAAQ;qBAES,MAAM;oBAAkB,MAAM;YAAU,UAAU;iBAChE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,sHAwM7D,CAAC;AAmEH,eAAO,MAAM,WAAW;YAGH,OAAO;qBAAmB,MAAM;6HAwLnD,CAAC"}
@@ -1,2 +1,2 @@
1
- export { prChecksCommand, prChecksFailedCommand, prCloseCommand, prCommentCommand, prCommentsCommand, prCreateCommand, prDiscussionSummaryCommand, prEditCommand, prFeedbackCommand, prIssueCommentsCommand, prIssueCommentsLatestCommand, prLastHumanReviewerCommand, prListCommand, prMergeCommand, prReadyCommand, prRequestReviewCommand, prReplyCommand, prRerunChecksCommand, prReplyAndResolveCommand, prResolveCommand, prReviewsCommand, prStatusCommand, prSubmitReviewCommand, prThreadsCommand, prTriggerChecksCommand, prWaitMergeableCommand, prReviewTriageCommand, prReviewTriageBatchCommand, prViewCommand, prWatchCommand, } from "./commands";
1
+ export { prChecksCommand, prChecksFailedCommand, prCloseCommand, prCommentCommand, prCommentsCommand, prCreateCommand, prDiscussionSummaryCommand, prEditCommand, prFeedbackCommand, prIssueCommentsCommand, prIssueCommentsLatestCommand, prLastHumanReviewerCommand, prListCommand, prMergeCommand, prReadyCommand, prRequestReviewCommand, prReplyCommand, prRerunChecksCommand, prReplyAndResolveCommand, prResolveCommand, prReviewCommand, prReviewsCommand, prStatusCommand, prSubmitReviewCommand, prThreadsCommand, prTriggerChecksCommand, prWaitMergeableCommand, prReviewTriageCommand, prReviewTriageBatchCommand, prViewCommand, prWatchCommand, } from "./commands";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import type { IssueComment, PullRequestReview, ReviewComment, ReviewThread } from "#gh/types";
3
+ import type { REVIEW_EVENTS } from "#gh/config";
3
4
  import { GitHubCommandError } from "#gh/errors";
4
5
  import { GitHubService } from "#gh/service";
5
6
  /**
@@ -77,7 +78,24 @@ export declare const resolveThread: (threadId: string) => Effect.Effect<{
77
78
  resolved: boolean;
78
79
  threadId: string;
79
80
  }, GitHubCommandError | import("#gh/errors").GitHubNotFoundError | import("#gh/errors").GitHubAuthError, GitHubService>;
80
- export declare const submitPendingReview: (pr: number | null, reviewId: string | null, body: string | null) => Effect.Effect<{
81
+ export type ReviewEvent = (typeof REVIEW_EVENTS)[number];
82
+ /**
83
+ * Create and submit a review in one call — the path for a verdict an agent reached from a diff
84
+ * it just read, with no pending review to submit.
85
+ */
86
+ export declare const createReview: (opts: {
87
+ pr: number | null;
88
+ event: ReviewEvent;
89
+ body: string;
90
+ confirm: boolean;
91
+ }) => Effect.Effect<{
92
+ submitted: true;
93
+ pr: number;
94
+ reviewId: number;
95
+ state: string;
96
+ url: string;
97
+ }, GitHubCommandError | import("#gh/errors").GitHubNotFoundError | import("#gh/errors").GitHubAuthError, GitHubService>;
98
+ export declare const submitPendingReview: (pr: number | null, reviewId: string | null, body: string | null, event?: "approve" | "comment" | "request-changes" | undefined, confirm?: any) => Effect.Effect<{
81
99
  submitted: true;
82
100
  reviewId: string;
83
101
  state: string;
@@ -1 +1 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAEV,YAAY,EAGZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EAEb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAic5C;;;GAGG;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cz/agent-tools",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "CLI tools for AI coding agent workflows — GitHub, database, Kubernetes, Azure platform, Azure DevOps, logs, sessions, and audit",
5
5
  "keywords": [
6
6
  "agent",
@@ -5,3 +5,6 @@ export const GRAPHQL_PAGE_SIZE = 100 as const;
5
5
  export const GH_BINARY = "gh" as const;
6
6
 
7
7
  export const MERGE_STRATEGIES = ["squash", "merge", "rebase"] as const;
8
+
9
+ export const REVIEW_EVENTS = ["comment", "approve", "request-changes"] as const;
10
+ export const DEFAULT_REVIEW_EVENT = "comment" as const;
@@ -37,6 +37,7 @@ import {
37
37
  prFeedbackCommand,
38
38
  prReplyCommand,
39
39
  prResolveCommand,
40
+ prReviewCommand,
40
41
  prReviewsCommand,
41
42
  prLastHumanReviewerCommand,
42
43
  prSubmitReviewCommand,
@@ -105,6 +106,7 @@ const prCommand = Command.make("pr", {}).pipe(
105
106
  prDiscussionSummaryCommand,
106
107
  prReplyCommand,
107
108
  prResolveCommand,
109
+ prReviewCommand,
108
110
  prSubmitReviewCommand,
109
111
  prChecksCommand,
110
112
  prChecksFailedCommand,
@@ -199,7 +201,8 @@ WORKFLOW FOR AI AGENTS:
199
201
  1. Use 'pr view' to inspect current PR
200
202
  2. Use 'pr discussion-summary' for overview (counts + latest discussion comment)
201
203
  3. Use 'pr threads' and 'pr issue-comments-latest --author <username> --body-contains "Review"' for review context
202
- 4. Use 'pr submit-review', 'pr reply', 'pr comment' and 'pr resolve' to handle feedback
204
+ 4. Use 'pr reply', 'pr comment' and 'pr resolve' to handle feedback
205
+ 4b. Use 'pr review --event request-changes|approve|comment --confirm' to post a verdict, or 'pr submit-review' for a pending one
203
206
  5. Use 'pr checks' to monitor CI status; 'pr trigger-checks --workflow <file.yml>' when zero checks were reported
204
207
  6. Use 'pr merge' to merge (dry-run by default)
205
208
  7. Use 'issue list' to list open/closed issues
@@ -24,7 +24,9 @@ import {
24
24
  CI_CHECK_WATCH_TIMEOUT_MS,
25
25
  DEFAULT_DELETE_BRANCH,
26
26
  DEFAULT_MERGE_STRATEGY,
27
+ DEFAULT_REVIEW_EVENT,
27
28
  MERGE_STRATEGIES,
29
+ REVIEW_EVENTS,
28
30
  } from "#gh/config";
29
31
 
30
32
  import {
@@ -33,6 +35,7 @@ import {
33
35
  createPR,
34
36
  detectPRStatus,
35
37
  editPR,
38
+ fetchPRView,
36
39
  fetchChecks,
37
40
  fetchChecksForCommand,
38
41
  fetchFailedChecks,
@@ -46,6 +49,7 @@ import {
46
49
  waitForMergeable,
47
50
  } from "./core";
48
51
  import {
52
+ createReview,
49
53
  fetchComments,
50
54
  fetchDiscussionSummary,
51
55
  fetchFeedback,
@@ -223,7 +227,10 @@ const withStableHead = Effect.fn("pr.withStableHead")(function* <A, E, R>(
223
227
  const snapshot = yield* collectWithStableState(
224
228
  initial,
225
229
  (info) => collect(info.number, info.headSha),
226
- (info) => viewPR(info.number),
230
+ (info) =>
231
+ fetchPRView(info.number).pipe(
232
+ Effect.map((refreshed) => ({ ...refreshed, baseSha: initial.baseSha })),
233
+ ),
227
234
  (before, after) => after.headSha === before.headSha,
228
235
  );
229
236
  if (snapshot !== null) return { info: snapshot.state, value: snapshot.value };
@@ -1332,6 +1339,68 @@ export const prResolveCommand = Command.make(
1332
1339
  ),
1333
1340
  ).pipe(Command.withDescription("Resolve a review thread via GraphQL"));
1334
1341
 
1342
+ const reviewEventOption = Flag.choice("event", REVIEW_EVENTS).pipe(
1343
+ Flag.withDescription("Review verdict: comment, approve, or request-changes"),
1344
+ Flag.withDefault(DEFAULT_REVIEW_EVENT),
1345
+ );
1346
+
1347
+ const reviewConfirmOption = Flag.boolean("confirm").pipe(
1348
+ Flag.withDescription("Required for --event approve and --event request-changes"),
1349
+ Flag.withDefault(false),
1350
+ );
1351
+
1352
+ export const prReviewCommand = Command.make(
1353
+ "review",
1354
+ {
1355
+ body: Flag.string("body").pipe(Flag.withDescription("Review body text"), Flag.optional),
1356
+ bodyFile: Flag.string("body-file").pipe(
1357
+ Flag.withDescription("Read review body from a file path or '-' for stdin"),
1358
+ Flag.optional,
1359
+ ),
1360
+ bodyStdin: Flag.boolean("body-stdin").pipe(
1361
+ Flag.withDescription("Read review body from stdin"),
1362
+ Flag.withDefault(false),
1363
+ ),
1364
+ confirm: reviewConfirmOption,
1365
+ event: reviewEventOption,
1366
+ format: formatOption,
1367
+ pr: Flag.integer("pr").pipe(
1368
+ Flag.withDescription("PR number (default: current branch PR)"),
1369
+ Flag.optional,
1370
+ ),
1371
+ repo: repoOption,
1372
+ },
1373
+ ({ body, bodyFile, bodyStdin, confirm, event, format, pr, repo }) =>
1374
+ withRepo(
1375
+ repo,
1376
+ Effect.gen(function* () {
1377
+ const resolvedBody = yield* resolveDefaultTextInput({
1378
+ command: "gh-tool pr review",
1379
+ value: Option.getOrNull(body),
1380
+ fileValue: Option.getOrNull(bodyFile),
1381
+ stdin: bodyStdin,
1382
+ valueFlag: "--body",
1383
+ fileFlag: "--body-file",
1384
+ stdinFlag: "--body-stdin",
1385
+ label: "body",
1386
+ defaultValue: "",
1387
+ });
1388
+
1389
+ const result = yield* createReview({
1390
+ pr: Option.getOrNull(pr),
1391
+ event,
1392
+ body: resolvedBody,
1393
+ confirm,
1394
+ });
1395
+ yield* logFormatted(result, format);
1396
+ }),
1397
+ ),
1398
+ ).pipe(
1399
+ Command.withDescription(
1400
+ "Create and submit a review (--event comment, approve, or request-changes; verdicts need --confirm)",
1401
+ ),
1402
+ );
1403
+
1335
1404
  export const prSubmitReviewCommand = Command.make(
1336
1405
  "submit-review",
1337
1406
  {
@@ -1343,6 +1412,8 @@ export const prSubmitReviewCommand = Command.make(
1343
1412
  Flag.withDescription("Read review body from a file path or '-' for stdin"),
1344
1413
  Flag.optional,
1345
1414
  ),
1415
+ confirm: reviewConfirmOption,
1416
+ event: reviewEventOption,
1346
1417
  format: formatOption,
1347
1418
  pr: Flag.integer("pr").pipe(
1348
1419
  Flag.withDescription("PR number (default: current branch PR)"),
@@ -1356,7 +1427,7 @@ export const prSubmitReviewCommand = Command.make(
1356
1427
  Flag.optional,
1357
1428
  ),
1358
1429
  },
1359
- ({ body, bodyFile, format, pr, repo, reviewId }) =>
1430
+ ({ body, bodyFile, confirm, event, format, pr, repo, reviewId }) =>
1360
1431
  withRepo(
1361
1432
  repo,
1362
1433
  Effect.gen(function* () {
@@ -1370,13 +1441,19 @@ export const prSubmitReviewCommand = Command.make(
1370
1441
  fileFlag: "--body-file",
1371
1442
  label: "body",
1372
1443
  });
1373
- const result = yield* submitPendingReview(prNumber, reviewIdValue, bodyValue);
1444
+ const result = yield* submitPendingReview(
1445
+ prNumber,
1446
+ reviewIdValue,
1447
+ bodyValue,
1448
+ event,
1449
+ confirm,
1450
+ );
1374
1451
  yield* logFormatted(result, format);
1375
1452
  }),
1376
1453
  ),
1377
1454
  ).pipe(
1378
1455
  Command.withDescription(
1379
- "Submit a pending review as COMMENT (auto-detects your pending review if --review-id is omitted)",
1456
+ "Submit a pending review (--event comment by default; verdicts need --confirm; auto-detects your pending review if --review-id is omitted)",
1380
1457
  ),
1381
1458
  );
1382
1459
 
@@ -359,7 +359,7 @@ const buildFailedChecksReport = Effect.fn("pr.buildFailedChecksReport")(function
359
359
  };
360
360
  });
361
361
 
362
- export const viewPR = Effect.fn("pr.viewPR")(function* (prNumber: number | null) {
362
+ export const fetchPRView = Effect.fn("pr.fetchPRView")(function* (prNumber: number | null) {
363
363
  const gh = yield* GitHubService;
364
364
 
365
365
  const args = ["pr", "view"];
@@ -368,14 +368,31 @@ export const viewPR = Effect.fn("pr.viewPR")(function* (prNumber: number | null)
368
368
  }
369
369
  args.push(
370
370
  "--json",
371
- "number,url,title,headRefName,baseRefName,headRefOid,baseRefOid,state,isDraft,mergeable,body,author,reviewDecision,reviewRequests",
371
+ "number,url,title,headRefName,baseRefName,headRefOid,state,isDraft,mergeable,body,author,reviewDecision,reviewRequests",
372
372
  );
373
373
 
374
- const info = yield* gh.runGhJson<PRViewInfo & { headRefOid?: string; baseRefOid?: string }>(args);
374
+ const info = yield* gh.runGhJson<PRViewInfo & { headRefOid?: string }>(args);
375
375
  return {
376
376
  ...info,
377
377
  headSha: info.headRefOid ?? info.headSha ?? null,
378
- baseSha: info.baseRefOid ?? info.baseSha ?? null,
378
+ baseSha: info.baseSha ?? null,
379
+ };
380
+ });
381
+
382
+ export const viewPR = Effect.fn("pr.viewPR")(function* (prNumber: number | null) {
383
+ const gh = yield* GitHubService;
384
+
385
+ const info = yield* fetchPRView(prNumber);
386
+ const repo = yield* gh.getRepoInfo();
387
+ const baseSha = yield* gh.runGh([
388
+ "api",
389
+ `repos/${repo.owner}/${repo.name}/pulls/${info.number}`,
390
+ "--jq",
391
+ ".base.sha",
392
+ ]);
393
+ return {
394
+ ...info,
395
+ baseSha: baseSha.stdout.trim() || null,
379
396
  };
380
397
  });
381
398
 
@@ -593,7 +610,9 @@ export const waitForMergeable = Effect.fn("pr.waitForMergeable")(function* (
593
610
  // Cap the sleep to the remaining budget so the total wait doesn't overshoot the deadline.
594
611
  const remaining = deadlineMs - Number(now);
595
612
  yield* Effect.sleep(Duration.millis(Math.min(MERGEABLE_POLL_INTERVAL_MS, remaining)));
596
- latest = yield* viewPR(pr);
613
+ latest = yield* fetchPRView(pr).pipe(
614
+ Effect.map((info) => ({ ...info, baseSha: latest.baseSha })),
615
+ );
597
616
  }),
598
617
  step: () => undefined,
599
618
  });
@@ -1283,7 +1302,10 @@ export const fetchFailedChecks = Effect.fn("pr.fetchFailedChecks")(function* (
1283
1302
  const snapshot = yield* collectWithStableState(
1284
1303
  initial,
1285
1304
  (info) => fetchCheckResults(info.number),
1286
- (info) => viewPR(info.number),
1305
+ (info) =>
1306
+ fetchPRView(info.number).pipe(
1307
+ Effect.map((refreshed) => ({ ...refreshed, baseSha: initial.baseSha })),
1308
+ ),
1287
1309
  (before, after) => after.headSha === before.headSha,
1288
1310
  );
1289
1311
  if (snapshot !== null) {
@@ -19,6 +19,7 @@ export {
19
19
  prRerunChecksCommand,
20
20
  prReplyAndResolveCommand,
21
21
  prResolveCommand,
22
+ prReviewCommand,
22
23
  prReviewsCommand,
23
24
  prStatusCommand,
24
25
  prSubmitReviewCommand,
@@ -11,6 +11,8 @@ import type {
11
11
  FeedbackOrigin,
12
12
  } from "#gh/types";
13
13
 
14
+ import type { REVIEW_EVENTS } from "#gh/config";
15
+
14
16
  import { GitHubCommandError } from "#gh/errors";
15
17
  import { GitHubService } from "#gh/service";
16
18
 
@@ -967,12 +969,110 @@ export const resolveThread = Effect.fn("pr.resolveThread")(function* (threadId:
967
969
  };
968
970
  });
969
971
 
972
+ export type ReviewEvent = (typeof REVIEW_EVENTS)[number];
973
+
974
+ const REVIEW_EVENT_API = {
975
+ approve: "APPROVE",
976
+ comment: "COMMENT",
977
+ "request-changes": "REQUEST_CHANGES",
978
+ } as const satisfies Record<ReviewEvent, string>;
979
+
980
+ // APPROVE and REQUEST_CHANGES change whether the PR can merge, so they need the same explicit
981
+ // opt-in as `pr merge`. COMMENT carries no verdict and stays free.
982
+ const requireVerdictConfirm = Effect.fn("pr.requireVerdictConfirm")(function* (opts: {
983
+ command: string;
984
+ event: ReviewEvent;
985
+ confirm: boolean;
986
+ }) {
987
+ if (opts.event === "comment" || opts.confirm) {
988
+ return;
989
+ }
990
+
991
+ const detail = `--event ${opts.event} posts a verdict review; pass --confirm to submit it`;
992
+
993
+ return yield* Effect.fail(
994
+ new GitHubCommandError({
995
+ command: opts.command,
996
+ exitCode: 1,
997
+ stderr: detail,
998
+ message: detail,
999
+ hint: "APPROVE and REQUEST_CHANGES change the merge state of the PR. Re-run with --confirm once the verdict is intended.",
1000
+ }),
1001
+ );
1002
+ });
1003
+
1004
+ /**
1005
+ * Create and submit a review in one call — the path for a verdict an agent reached from a diff
1006
+ * it just read, with no pending review to submit.
1007
+ */
1008
+ export const createReview = Effect.fn("pr.createReview")(function* (opts: {
1009
+ pr: number | null;
1010
+ event: ReviewEvent;
1011
+ body: string;
1012
+ confirm: boolean;
1013
+ }) {
1014
+ const service = yield* GitHubService;
1015
+ const command = "gh-tool pr review";
1016
+
1017
+ yield* requireVerdictConfirm({ command, event: opts.event, confirm: opts.confirm });
1018
+
1019
+ // GitHub rejects a bodyless COMMENT or REQUEST_CHANGES review; only APPROVE may be silent.
1020
+ if (opts.event !== "approve" && opts.body.trim() === "") {
1021
+ const detail = `--event ${opts.event} requires a non-empty body`;
1022
+
1023
+ return yield* Effect.fail(
1024
+ new GitHubCommandError({
1025
+ command,
1026
+ exitCode: 1,
1027
+ stderr: detail,
1028
+ message: detail,
1029
+ hint: "Pass --body, --body-file, or --body-stdin with what has to change.",
1030
+ }),
1031
+ );
1032
+ }
1033
+
1034
+ const repoInfo = yield* service.getRepoInfo();
1035
+ const resolvedPr = opts.pr ?? (yield* viewPR(null)).number;
1036
+
1037
+ const args = [
1038
+ "api",
1039
+ "--method",
1040
+ "POST",
1041
+ `repos/${repoInfo.owner}/${repoInfo.name}/pulls/${resolvedPr}/reviews`,
1042
+ "-f",
1043
+ `event=${REVIEW_EVENT_API[opts.event]}`,
1044
+ ];
1045
+
1046
+ if (opts.body !== "") {
1047
+ args.push("-f", `body=${opts.body}`);
1048
+ }
1049
+
1050
+ const result = yield* service.runGhJson<{
1051
+ id: number;
1052
+ state: string;
1053
+ html_url: string;
1054
+ }>(args);
1055
+
1056
+ return {
1057
+ submitted: true as const,
1058
+ pr: resolvedPr,
1059
+ reviewId: result.id,
1060
+ state: result.state,
1061
+ url: result.html_url,
1062
+ };
1063
+ });
1064
+
970
1065
  export const submitPendingReview = Effect.fn("pr.submitPendingReview")(function* (
971
1066
  pr: number | null,
972
1067
  reviewId: string | null,
973
1068
  body: string | null,
1069
+ event: ReviewEvent = "comment",
1070
+ confirm = false,
974
1071
  ) {
975
1072
  const service = yield* GitHubService;
1073
+
1074
+ yield* requireVerdictConfirm({ command: "gh-tool pr submit-review", event, confirm });
1075
+
976
1076
  const repoInfo = yield* service.getRepoInfo();
977
1077
 
978
1078
  const resolvedPr = pr ?? (yield* viewPR(null)).number;
@@ -1007,7 +1107,7 @@ export const submitPendingReview = Effect.fn("pr.submitPendingReview")(function*
1007
1107
 
1008
1108
  const result = (yield* service.runGraphQL(SUBMIT_REVIEW_MUTATION, {
1009
1109
  reviewId: targetReviewId,
1010
- event: "COMMENT",
1110
+ event: REVIEW_EVENT_API[event],
1011
1111
  body: body ?? "",
1012
1112
  })) as SubmitReviewResult;
1013
1113
 
@@ -34,6 +34,11 @@ const KNOWN_STDERR_HINTS: ReadonlyArray<{
34
34
  re: /already exists/i,
35
35
  hint: "The resource already exists. Fetch the existing one and update it instead of creating another.",
36
36
  },
37
+ {
38
+ re: /Can not (?:approve|request changes on) your own pull request/i,
39
+ hint: "GitHub refuses a verdict review on your own PR. Post the findings with --event comment, or have the reviewing account submit the verdict.",
40
+ nextCommand: "agent-tools-gh pr review --pr <number> --event comment --body <text>",
41
+ },
37
42
  {
38
43
  re: /pending review/i,
39
44
  hint: "A pending (unsubmitted) review blocks this mutation. Inspect its contents and submit or discard it before retrying.",