@blogic-cz/agent-tools 1.6.13 → 1.6.14
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 +6 -0
- package/dist/gh-tool/pr/commands.d.ts +9 -0
- package/dist/gh-tool/pr/commands.d.ts.map +1 -1
- package/dist/gh-tool/pr/index.d.ts +1 -1
- package/dist/gh-tool/pr/index.d.ts.map +1 -1
- package/dist/gh-tool/pr/review.d.ts +7 -0
- package/dist/gh-tool/pr/review.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/gh-tool/main.ts +3 -1
- package/src/gh-tool/pr/commands.ts +42 -0
- package/src/gh-tool/pr/index.ts +1 -0
- package/src/gh-tool/pr/review.ts +110 -0
package/README.md
CHANGED
|
@@ -355,6 +355,8 @@ bun gh-tool pr checks-failed --pr 123 --with-logs --format json # includes diagn
|
|
|
355
355
|
bun gh-tool pr rerun-checks --pr 123 --failed-only --watch --timeout 600
|
|
356
356
|
bun gh-tool pr trigger-checks --pr 123 --workflow dotnet-pull-request.yml # only when zero checks reported
|
|
357
357
|
bun gh-tool pr watch --prs 123,124 --format jsonl --timeout 600
|
|
358
|
+
bun gh-tool pr edit-comment --comment-id 456 --body-file correction.md # Edit your own review comment
|
|
359
|
+
bun gh-tool pr edit-comment --comment-id 789 --kind issue --pr 123 --body "Corrected detail"
|
|
358
360
|
bun gh-tool pr reply-and-resolve --comment-id 456 --body "Done" # infers PR and thread
|
|
359
361
|
bun gh-tool pr request-review --repo be --pr 123 --reviewers alice,bob
|
|
360
362
|
bun gh-tool pr review --pr 123 --event comment --body "Notes, no verdict"
|
|
@@ -365,6 +367,10 @@ bun gh-tool pr review --pr 123 --event approve --confirm
|
|
|
365
367
|
# Optional --pr/--thread-id retain legacy flow and are validated before either mutation.
|
|
366
368
|
```
|
|
367
369
|
|
|
370
|
+
`pr edit-comment` defaults to inline review comments; pass `--kind issue` for PR discussion
|
|
371
|
+
comments. It checks the authenticated GitHub user owns the comment before editing, and `--pr`
|
|
372
|
+
also verifies the comment belongs to that pull request.
|
|
373
|
+
|
|
368
374
|
`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.
|
|
369
375
|
|
|
370
376
|
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.
|
|
@@ -328,6 +328,15 @@ export declare const prCommentCommand: Command.Command<"comment", {
|
|
|
328
328
|
readonly pr: Option.Option<number>;
|
|
329
329
|
readonly repo: Option.Option<string>;
|
|
330
330
|
}, {}, import("#gh/service").GhError, GitHubService>;
|
|
331
|
+
export declare const prEditCommentCommand: Command.Command<"edit-comment", {
|
|
332
|
+
readonly body: Option.Option<string>;
|
|
333
|
+
readonly bodyFile: Option.Option<string>;
|
|
334
|
+
readonly commentId: number;
|
|
335
|
+
readonly format: "json" | "toon";
|
|
336
|
+
readonly kind: "issue" | "review";
|
|
337
|
+
readonly pr: Option.Option<number>;
|
|
338
|
+
readonly repo: Option.Option<string>;
|
|
339
|
+
}, {}, import("#gh/service").GhError, GitHubService>;
|
|
331
340
|
export declare const prDiscussionSummaryCommand: Command.Command<"discussion-summary", {
|
|
332
341
|
readonly format: "json" | "toon";
|
|
333
342
|
readonly pr: Option.Option<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAW,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAW,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAkGhD,eAAO,MAAM,cAAc,cAAe,MAAM,4FAM/C,CAAC;AAiCF,eAAO,MAAM,aAAa,OAAQ,MAAM,aAAa,MAAM;;;;;;gDA6BvD,CAAC;AAEL,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;CAC/C,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,qBAAqB,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,YACtB,mBAAmB,UACpB,SAAS,WAAW,EAAE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BAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAC1D,CAAC,QACH,aAAa,CAAC,MAAM,CAAC;;EAW5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;oDAgCjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;oDAiBsD,CAAC;AAE1F,eAAO,MAAM,0BAA0B;;;;oDAuBtC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;oDAgDpC,CAAC;AA2EF,eAAO,MAAM,cAAc,6HAG1B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { prChecksCommand, prChecksFailedCommand, prCloseCommand, prCommentCommand, prCommentsCommand, prCreateCommand, prDiscussionSummaryCommand, prDraftCommand, prEditCommand, prFeedbackCommand, prIssueCommentsCommand, prIssueCommentsLatestCommand, prLastHumanReviewerCommand, prListCommand, prMergeCommand, prReadyCommand, prStackCommand, prRequestReviewCommand, prReplyCommand, prRerunChecksCommand, prReplyAndResolveCommand, prResolveCommand, prReviewCommand, prReviewsCommand, prStatusCommand, prSubmitReviewCommand, prThreadsCommand, prTriggerChecksCommand, prWaitMergeableCommand, prReviewTriageCommand, prReviewTriageBatchCommand, prViewCommand, prWatchCommand, } from "./commands";
|
|
1
|
+
export { prChecksCommand, prChecksFailedCommand, prCloseCommand, prCommentCommand, prEditCommentCommand, prCommentsCommand, prCreateCommand, prDiscussionSummaryCommand, prDraftCommand, prEditCommand, prFeedbackCommand, prIssueCommentsCommand, prIssueCommentsLatestCommand, prLastHumanReviewerCommand, prListCommand, prMergeCommand, prReadyCommand, prStackCommand, 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,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,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
|
+
{"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,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,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"}
|
|
@@ -48,6 +48,13 @@ export declare const fetchDiscussionSummary: (pr: number | null) => Effect.Effec
|
|
|
48
48
|
unresolvedReviewThreadsCount: number;
|
|
49
49
|
unresolvedUnrepliedReviewThreadsCount: number;
|
|
50
50
|
}, import("#gh/service").GhError, GitHubService>;
|
|
51
|
+
export declare const editComment: (commentId: number, body: string, kind: "issue" | "review", pr: number | null) => Effect.Effect<{
|
|
52
|
+
commentId: number;
|
|
53
|
+
url: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
hint: string;
|
|
56
|
+
nextCommand: string;
|
|
57
|
+
}, import("#gh/service").GhError, GitHubService>;
|
|
51
58
|
/**
|
|
52
59
|
* Reply to an inline review comment via REST API.
|
|
53
60
|
*/
|
|
@@ -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,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
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,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkf5C;;;GAGG;AACH,eAAO,MAAM,YAAY,gMAcvB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,uKAoCxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,8KAmC7B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,+NA+CvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;gDAaxB,CAAC;AAEH,eAAO,MAAM,uBAAuB,6JAgBlC,CAAC;AAEH,eAAO,MAAM,gBAAgB,gHA0C3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;gDA4CjC,CAAC;AAeH,eAAO,MAAM,WAAW;;;;;;gDAmGtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;gDA4FzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;gDA0FjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;gDAWxB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAgCzD;;;GAGG;AACH,eAAO,MAAM,YAAY;QACnB,MAAM,GAAG,IAAI;WACV,WAAW;UACZ,MAAM;aACH,OAAO;;;;;;;gDAmDhB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;gDAyM9B,CAAC;AAeH,eAAO,MAAM,sBAAsB;;;;gDA8CjC,CAAC"}
|
package/package.json
CHANGED
package/src/gh-tool/main.ts
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
prIssueCommentsCommand,
|
|
37
37
|
prIssueCommentsLatestCommand,
|
|
38
38
|
prCommentCommand,
|
|
39
|
+
prEditCommentCommand,
|
|
39
40
|
prDiscussionSummaryCommand,
|
|
40
41
|
prFeedbackCommand,
|
|
41
42
|
prReplyCommand,
|
|
@@ -108,6 +109,7 @@ const prCommand = Command.make("pr", {}).pipe(
|
|
|
108
109
|
prIssueCommentsCommand,
|
|
109
110
|
prIssueCommentsLatestCommand,
|
|
110
111
|
prCommentCommand,
|
|
112
|
+
prEditCommentCommand,
|
|
111
113
|
prDiscussionSummaryCommand,
|
|
112
114
|
prReplyCommand,
|
|
113
115
|
prResolveCommand,
|
|
@@ -206,7 +208,7 @@ WORKFLOW FOR AI AGENTS:
|
|
|
206
208
|
1. Use 'pr view' to inspect current PR
|
|
207
209
|
2. Use 'pr discussion-summary' for overview (counts + latest discussion comment)
|
|
208
210
|
3. Use 'pr threads' and 'pr issue-comments-latest --author <username> --body-contains "Review"' for review context
|
|
209
|
-
4. Use 'pr reply', 'pr comment' and 'pr resolve' to handle feedback
|
|
211
|
+
4. Use 'pr reply', 'pr comment', 'pr edit-comment' and 'pr resolve' to handle feedback
|
|
210
212
|
4b. Use 'pr review --event request-changes|approve|comment --confirm' to post a verdict, or 'pr submit-review' for a pending one
|
|
211
213
|
5. Use 'pr checks' to monitor CI status; 'pr trigger-checks --workflow <file.yml>' when zero checks were reported
|
|
212
214
|
6. Use 'pr merge' to merge (dry-run by default)
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
} from "./core";
|
|
53
53
|
import {
|
|
54
54
|
createReview,
|
|
55
|
+
editComment,
|
|
55
56
|
fetchComments,
|
|
56
57
|
fetchDiscussionSummary,
|
|
57
58
|
fetchFeedback,
|
|
@@ -1306,6 +1307,47 @@ export const prCommentCommand = Command.make(
|
|
|
1306
1307
|
),
|
|
1307
1308
|
).pipe(Command.withDescription("Post a general PR discussion comment"));
|
|
1308
1309
|
|
|
1310
|
+
export const prEditCommentCommand = Command.make(
|
|
1311
|
+
"edit-comment",
|
|
1312
|
+
{
|
|
1313
|
+
body: Flag.String("body").pipe(
|
|
1314
|
+
Flag.withDescription("Updated comment body text"),
|
|
1315
|
+
Flag.optional,
|
|
1316
|
+
),
|
|
1317
|
+
bodyFile: Flag.String("body-file").pipe(
|
|
1318
|
+
Flag.withDescription("Read updated comment body from a file path or '-' for stdin"),
|
|
1319
|
+
Flag.optional,
|
|
1320
|
+
),
|
|
1321
|
+
commentId: Flag.Int("comment-id").pipe(Flag.withDescription("ID of the comment to edit")),
|
|
1322
|
+
format: formatOption,
|
|
1323
|
+
kind: Flag.Literals("kind", ["review", "issue"]).pipe(
|
|
1324
|
+
Flag.withDescription("Comment type: inline review comment or PR discussion comment"),
|
|
1325
|
+
Flag.withDefault("review"),
|
|
1326
|
+
),
|
|
1327
|
+
pr: Flag.Int("pr").pipe(
|
|
1328
|
+
Flag.withDescription("Require the comment to belong to this PR"),
|
|
1329
|
+
Flag.optional,
|
|
1330
|
+
),
|
|
1331
|
+
repo: repoOption,
|
|
1332
|
+
},
|
|
1333
|
+
({ body, bodyFile, commentId, format, kind, pr, repo }) =>
|
|
1334
|
+
withRepo(
|
|
1335
|
+
repo,
|
|
1336
|
+
Effect.gen(function* () {
|
|
1337
|
+
const resolvedBody = yield* resolveRequiredTextInput({
|
|
1338
|
+
command: "gh-tool pr edit-comment",
|
|
1339
|
+
value: Option.getOrNull(body),
|
|
1340
|
+
fileValue: Option.getOrNull(bodyFile),
|
|
1341
|
+
valueFlag: "--body",
|
|
1342
|
+
fileFlag: "--body-file",
|
|
1343
|
+
label: "body",
|
|
1344
|
+
});
|
|
1345
|
+
const result = yield* editComment(commentId, resolvedBody, kind, Option.getOrNull(pr));
|
|
1346
|
+
yield* logFormatted(result, format);
|
|
1347
|
+
}),
|
|
1348
|
+
),
|
|
1349
|
+
).pipe(Command.withDescription("Edit your own inline review or PR discussion comment"));
|
|
1350
|
+
|
|
1309
1351
|
export const prDiscussionSummaryCommand = Command.make(
|
|
1310
1352
|
"discussion-summary",
|
|
1311
1353
|
{
|
package/src/gh-tool/pr/index.ts
CHANGED
package/src/gh-tool/pr/review.ts
CHANGED
|
@@ -299,6 +299,15 @@ type ReviewCommentById = {
|
|
|
299
299
|
pull_request_url: string;
|
|
300
300
|
};
|
|
301
301
|
|
|
302
|
+
type EditableComment = {
|
|
303
|
+
id: number;
|
|
304
|
+
user: { login: string };
|
|
305
|
+
html_url: string;
|
|
306
|
+
updated_at: string;
|
|
307
|
+
pull_request_url?: string;
|
|
308
|
+
issue_url?: string;
|
|
309
|
+
};
|
|
310
|
+
|
|
302
311
|
const REST_PAGE_SIZE = 100;
|
|
303
312
|
|
|
304
313
|
const feedbackOrigin = (commitSha: string | null, currentHeadSha: string | null): FeedbackOrigin =>
|
|
@@ -801,6 +810,107 @@ const fetchReviewCommentById = Effect.fn("pr.fetchReviewCommentById")(function*
|
|
|
801
810
|
return comment;
|
|
802
811
|
});
|
|
803
812
|
|
|
813
|
+
export const editComment = Effect.fn("pr.editComment")(function* (
|
|
814
|
+
commentId: number,
|
|
815
|
+
body: string,
|
|
816
|
+
kind: "review" | "issue",
|
|
817
|
+
pr: number | null,
|
|
818
|
+
) {
|
|
819
|
+
const service = yield* GitHubService;
|
|
820
|
+
const repoInfo = yield* service.getRepoInfo();
|
|
821
|
+
const command = "gh-tool pr edit-comment";
|
|
822
|
+
if (
|
|
823
|
+
!Number.isInteger(commentId) ||
|
|
824
|
+
commentId <= 0 ||
|
|
825
|
+
(pr !== null && (!Number.isInteger(pr) || pr <= 0))
|
|
826
|
+
) {
|
|
827
|
+
return yield* Effect.fail(
|
|
828
|
+
new GitHubCommandError({
|
|
829
|
+
command,
|
|
830
|
+
exitCode: 1,
|
|
831
|
+
stderr: "--comment-id and --pr must be positive integers",
|
|
832
|
+
message: "--comment-id and --pr must be positive integers",
|
|
833
|
+
hint: "Pass a positive comment ID and, when supplied, a positive PR number.",
|
|
834
|
+
}),
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
if (body.trim().length === 0) {
|
|
838
|
+
return yield* Effect.fail(
|
|
839
|
+
new GitHubCommandError({
|
|
840
|
+
command,
|
|
841
|
+
exitCode: 1,
|
|
842
|
+
stderr: "Comment body cannot be empty",
|
|
843
|
+
message: "Comment body cannot be empty",
|
|
844
|
+
hint: "Pass non-empty comment text with --body or --body-file.",
|
|
845
|
+
}),
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
const endpoint = `repos/${repoInfo.owner}/${repoInfo.name}/${kind === "review" ? "pulls" : "issues"}/comments/${commentId}`;
|
|
850
|
+
const target = yield* service.runGhJson<EditableComment>(["api", endpoint]);
|
|
851
|
+
const viewer = yield* service.runGhJson<{ login: string }>(["api", "user"]);
|
|
852
|
+
if (target.user.login.toLowerCase() !== viewer.login.toLowerCase()) {
|
|
853
|
+
return yield* Effect.fail(
|
|
854
|
+
new GitHubCommandError({
|
|
855
|
+
command,
|
|
856
|
+
exitCode: 1,
|
|
857
|
+
stderr: `Comment ${commentId} was written by ${target.user.login}; only your own comments can be edited`,
|
|
858
|
+
message: `Comment ${commentId} was written by ${target.user.login}; only your own comments can be edited`,
|
|
859
|
+
hint: "Edit only comments authored by the authenticated GitHub user.",
|
|
860
|
+
}),
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
const commentPrUrl = kind === "review" ? target.pull_request_url : target.issue_url;
|
|
865
|
+
if (pr !== null && !commentPrUrl?.endsWith(`/${kind === "review" ? "pulls" : "issues"}/${pr}`)) {
|
|
866
|
+
return yield* Effect.fail(
|
|
867
|
+
new GitHubCommandError({
|
|
868
|
+
command,
|
|
869
|
+
exitCode: 1,
|
|
870
|
+
stderr: `Comment ${commentId} does not belong to PR #${pr}`,
|
|
871
|
+
message: `Comment ${commentId} does not belong to PR #${pr}`,
|
|
872
|
+
hint: "Pass the PR that owns this comment, or omit --pr to edit by comment ID.",
|
|
873
|
+
}),
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
if (kind === "issue" && pr !== null) {
|
|
877
|
+
const pullRequest = yield* service.runGhJson<{ number: number }>([
|
|
878
|
+
"api",
|
|
879
|
+
`repos/${repoInfo.owner}/${repoInfo.name}/pulls/${pr}`,
|
|
880
|
+
]);
|
|
881
|
+
if (pullRequest.number !== pr) {
|
|
882
|
+
return yield* Effect.fail(
|
|
883
|
+
new GitHubCommandError({
|
|
884
|
+
command,
|
|
885
|
+
exitCode: 1,
|
|
886
|
+
stderr: `Comment ${commentId} does not belong to PR #${pr}`,
|
|
887
|
+
message: `Comment ${commentId} does not belong to PR #${pr}`,
|
|
888
|
+
hint: "Pass the PR that owns this comment, or omit --pr to edit by comment ID.",
|
|
889
|
+
}),
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
const updated = yield* service.runGhJson<EditableComment>([
|
|
895
|
+
"api",
|
|
896
|
+
"-X",
|
|
897
|
+
"PATCH",
|
|
898
|
+
endpoint,
|
|
899
|
+
"-f",
|
|
900
|
+
`body=${body}`,
|
|
901
|
+
]);
|
|
902
|
+
return {
|
|
903
|
+
commentId: updated.id,
|
|
904
|
+
url: updated.html_url,
|
|
905
|
+
updatedAt: updated.updated_at,
|
|
906
|
+
hint: "The comment was updated.",
|
|
907
|
+
nextCommand:
|
|
908
|
+
kind === "review"
|
|
909
|
+
? "gh-tool pr comments --pr <number>"
|
|
910
|
+
: "gh-tool pr issue-comments --pr <number>",
|
|
911
|
+
};
|
|
912
|
+
});
|
|
913
|
+
|
|
804
914
|
/**
|
|
805
915
|
* Reply to an inline review comment via REST API.
|
|
806
916
|
*/
|