@trim21/personal-pi-extensions 0.1.674 → 0.1.679
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 +10 -4
- package/package.json +2 -2
- package/src/codemode/declarations.ts +28 -12
- package/src/codemode/prelude.ts +32 -16
- package/src/codemode/protocol.ts +5 -2
- package/src/codemode/tool.ts +10 -3
- package/src/codemode/worker.js +36 -29
- package/src/codemode/worker.ts +2 -10
- package/src/gh/base.ts +62 -12
- package/src/gh/schemas.ts +230 -0
- package/src/gh/tools/download-release-assets.ts +51 -44
- package/src/gh/tools/get-workflow-jobs.ts +29 -18
- package/src/gh/tools/read-ci-logs.ts +37 -23
- package/src/gh/tools/read-issue-comments.ts +31 -24
- package/src/gh/tools/read-issue.ts +30 -22
- package/src/gh/tools/read-pr-comments.ts +62 -58
- package/src/gh/tools/read-pr-status.ts +31 -20
- package/src/gh/tools/read-pr.ts +30 -22
- package/src/gh/tools/wait-commit-checks.ts +35 -31
- package/src/gh/tools/wait-pr-checks.ts +30 -23
- package/src/lib/tool-bus.ts +128 -8
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
3
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
4
|
+
import {
|
|
5
|
+
type GhClient,
|
|
6
|
+
ghExec,
|
|
7
|
+
repoArgs,
|
|
8
|
+
subtitlePendant,
|
|
9
|
+
toStructuredJsonResult,
|
|
10
|
+
} from "../base.js";
|
|
11
|
+
import { issueViewSchema } from "../schemas.js";
|
|
5
12
|
|
|
6
13
|
export function addReadIssueTool(_gh: GhClient, bus: ToolBus) {
|
|
7
|
-
bus.register(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
bus.register(
|
|
15
|
+
defineStructuredTool({
|
|
16
|
+
name: "read-github-issue",
|
|
17
|
+
label: "GitHub Issue",
|
|
18
|
+
description: "Get details of a GitHub issue by number.",
|
|
19
|
+
promptSnippet: "Read a GitHub issue",
|
|
20
|
+
parameters: Type.Object({
|
|
21
|
+
number: Type.Union([Type.Number(), Type.String()], { description: "Issue number" }),
|
|
22
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO (defaults to current repo)" })),
|
|
23
|
+
}),
|
|
24
|
+
structuredSchema: issueViewSchema,
|
|
25
|
+
async execute(_id, params, signal, _onUpdate, ctx) {
|
|
26
|
+
const { number, repo } = params;
|
|
27
|
+
const out = await ghExec(
|
|
20
28
|
[
|
|
21
29
|
"issue",
|
|
22
30
|
"view",
|
|
@@ -26,11 +34,11 @@ export function addReadIssueTool(_gh: GhClient, bus: ToolBus) {
|
|
|
26
34
|
"title,state,body,author,createdAt,updatedAt,closedAt,url,labels,assignees,comments,milestone,number",
|
|
27
35
|
],
|
|
28
36
|
{ cwd: ctx.cwd, signal, input: params },
|
|
29
|
-
)
|
|
30
|
-
params,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
37
|
+
);
|
|
38
|
+
const result = toStructuredJsonResult(out, params, issueViewSchema);
|
|
39
|
+
result.details.pendant = subtitlePendant(params, "number");
|
|
40
|
+
return result;
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
36
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
4
4
|
import {
|
|
5
5
|
ghApiList,
|
|
6
6
|
type GhClient,
|
|
@@ -8,66 +8,70 @@ import {
|
|
|
8
8
|
repoArgs,
|
|
9
9
|
resolveRepo,
|
|
10
10
|
subtitlePendant,
|
|
11
|
-
|
|
11
|
+
toStructuredJsonResult,
|
|
12
12
|
} from "../base.js";
|
|
13
|
+
import { prCommentsSchema } from "../schemas.js";
|
|
13
14
|
|
|
14
15
|
export function addReadPrCommentsTool(_gh: GhClient, bus: ToolBus) {
|
|
15
|
-
bus.register(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Type.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
),
|
|
30
|
-
}),
|
|
31
|
-
async execute(_id, params, signal, _onUpdate, ctx) {
|
|
32
|
-
const { number, repo, reviews } = params;
|
|
33
|
-
let out: string;
|
|
34
|
-
if (reviews) {
|
|
35
|
-
const effectiveRepo = await resolveRepo(repo, signal, ctx.cwd, params);
|
|
36
|
-
|
|
37
|
-
const [reviewComments, reviewSummaries] = await Promise.all([
|
|
38
|
-
ghApiList(`/repos/${effectiveRepo}/pulls/${String(number)}/comments`, {
|
|
39
|
-
cwd: ctx.cwd,
|
|
40
|
-
signal,
|
|
41
|
-
input: params,
|
|
42
|
-
}),
|
|
43
|
-
ghApiList(`/repos/${effectiveRepo}/pulls/${String(number)}/reviews`, {
|
|
44
|
-
cwd: ctx.cwd,
|
|
45
|
-
signal,
|
|
46
|
-
input: params,
|
|
16
|
+
bus.register(
|
|
17
|
+
defineStructuredTool({
|
|
18
|
+
name: "read-github-pr-comments",
|
|
19
|
+
label: "GitHub PR Comments",
|
|
20
|
+
description:
|
|
21
|
+
"Get review comments on a GitHub pull request. Set reviews=true for inline code review comments with diff_hunk.",
|
|
22
|
+
promptSnippet: "Read GitHub PR comments",
|
|
23
|
+
parameters: Type.Object({
|
|
24
|
+
number: Type.Union([Type.Number(), Type.String()], { description: "PR number" }),
|
|
25
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO" })),
|
|
26
|
+
reviews: Type.Optional(
|
|
27
|
+
Type.Boolean({
|
|
28
|
+
description:
|
|
29
|
+
"If true, returns inline code review comments (with diff_hunk, path, line) via API. Default: false (returns issue comments).",
|
|
47
30
|
}),
|
|
48
|
-
|
|
31
|
+
),
|
|
32
|
+
}),
|
|
33
|
+
structuredSchema: prCommentsSchema,
|
|
34
|
+
async execute(_id, params, signal, _onUpdate, ctx) {
|
|
35
|
+
const { number, repo, reviews } = params;
|
|
36
|
+
let out: string;
|
|
37
|
+
if (reviews) {
|
|
38
|
+
const effectiveRepo = await resolveRepo(repo, signal, ctx.cwd, params);
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
40
|
+
const [reviewComments, reviewSummaries] = await Promise.all([
|
|
41
|
+
ghApiList(`/repos/${effectiveRepo}/pulls/${String(number)}/comments`, {
|
|
42
|
+
cwd: ctx.cwd,
|
|
43
|
+
signal,
|
|
44
|
+
input: params,
|
|
45
|
+
}),
|
|
46
|
+
ghApiList(`/repos/${effectiveRepo}/pulls/${String(number)}/reviews`, {
|
|
47
|
+
cwd: ctx.cwd,
|
|
48
|
+
signal,
|
|
49
|
+
input: params,
|
|
50
|
+
}),
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
out = JSON.stringify(
|
|
54
|
+
{
|
|
55
|
+
reviews: reviewSummaries,
|
|
56
|
+
comments: reviewComments,
|
|
57
|
+
},
|
|
58
|
+
null,
|
|
59
|
+
2,
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
out = await ghExec(
|
|
63
|
+
["pr", "view", String(number), ...repoArgs(repo), "--json", "comments"],
|
|
64
|
+
{
|
|
65
|
+
cwd: ctx.cwd,
|
|
66
|
+
signal,
|
|
67
|
+
input: params,
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const result = toStructuredJsonResult(out, params, prCommentsSchema);
|
|
72
|
+
result.details.pendant = subtitlePendant(params, "number");
|
|
73
|
+
return result;
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
73
77
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
4
4
|
import {
|
|
5
5
|
type GhClient,
|
|
6
6
|
mergeChecks,
|
|
7
7
|
resolveRepo,
|
|
8
8
|
splitRepo,
|
|
9
|
+
type StructuredResultOf,
|
|
9
10
|
subtitlePendant,
|
|
10
11
|
type ToolCall,
|
|
11
|
-
type ToolResult,
|
|
12
12
|
toPositiveId,
|
|
13
|
+
withStructuredResult,
|
|
13
14
|
} from "../base.js";
|
|
15
|
+
import { prStatusSchema } from "../schemas.js";
|
|
14
16
|
|
|
15
17
|
interface PrStatusParams {
|
|
16
18
|
number: number | string;
|
|
@@ -22,7 +24,10 @@ interface PrStatusParams {
|
|
|
22
24
|
* path as the wait tools (octokit), but it never polls — pending checks come
|
|
23
25
|
* back as-is.
|
|
24
26
|
*/
|
|
25
|
-
export async function prStatus(
|
|
27
|
+
export async function prStatus(
|
|
28
|
+
gh: GhClient,
|
|
29
|
+
call: ToolCall<PrStatusParams>,
|
|
30
|
+
): Promise<StructuredResultOf<typeof prStatusSchema>> {
|
|
26
31
|
const { params, ctx, signal } = call;
|
|
27
32
|
const { number, repo } = params;
|
|
28
33
|
const pullNumber = toPositiveId(number, "number");
|
|
@@ -46,25 +51,31 @@ export async function prStatus(gh: GhClient, call: ToolCall<PrStatusParams>): Pr
|
|
|
46
51
|
}));
|
|
47
52
|
|
|
48
53
|
const payload = { pr: pullNumber, repo: effectiveRepo, head_sha: headSha, checks };
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
return withStructuredResult(
|
|
55
|
+
{
|
|
56
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
57
|
+
details: { ...payload, input: params, ...(pendant && { pendant }) },
|
|
58
|
+
},
|
|
59
|
+
payload,
|
|
60
|
+
);
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
export function addReadPrStatusTool(gh: GhClient, bus: ToolBus) {
|
|
56
|
-
bus.register(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
bus.register(
|
|
65
|
+
defineStructuredTool({
|
|
66
|
+
name: "read-github-pr-status",
|
|
67
|
+
label: "GitHub PR Status",
|
|
68
|
+
description:
|
|
69
|
+
"Get the current checks of a pull request's head commit as JSON {pr, repo, head_sha, checks:[{name, bucket, event, run_id, job_id, url}]}. `bucket` is pass / fail / pending / skipped; Actions checks carry the `run_id` and `job_id` behind them (null for other CI), which is what read-github-ci-logs and get-github-workflow-jobs take. Returns the snapshot immediately without waiting — use wait-github-pr-checks to block until the checks finish.",
|
|
70
|
+
promptSnippet: "Read GitHub PR status checks",
|
|
71
|
+
parameters: Type.Object({
|
|
72
|
+
number: Type.Union([Type.Number(), Type.String()], { description: "PR number" }),
|
|
73
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO (defaults to current repo)" })),
|
|
74
|
+
}),
|
|
75
|
+
structuredSchema: prStatusSchema,
|
|
76
|
+
async execute(_id, params, signal, onUpdate, ctx) {
|
|
77
|
+
return prStatus(gh, { params, ctx, signal, onUpdate });
|
|
78
|
+
},
|
|
65
79
|
}),
|
|
66
|
-
|
|
67
|
-
return prStatus(gh, { params, ctx, signal, onUpdate });
|
|
68
|
-
},
|
|
69
|
-
});
|
|
80
|
+
);
|
|
70
81
|
}
|
package/src/gh/tools/read-pr.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
3
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
4
|
+
import {
|
|
5
|
+
type GhClient,
|
|
6
|
+
ghExec,
|
|
7
|
+
repoArgs,
|
|
8
|
+
subtitlePendant,
|
|
9
|
+
toStructuredJsonResult,
|
|
10
|
+
} from "../base.js";
|
|
11
|
+
import { prViewSchema } from "../schemas.js";
|
|
5
12
|
|
|
6
13
|
export function addReadPrTool(_gh: GhClient, bus: ToolBus) {
|
|
7
|
-
bus.register(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
bus.register(
|
|
15
|
+
defineStructuredTool({
|
|
16
|
+
name: "read-github-pr",
|
|
17
|
+
label: "GitHub PR",
|
|
18
|
+
description: "Get details of a GitHub pull request by number.",
|
|
19
|
+
promptSnippet: "Read a GitHub PR",
|
|
20
|
+
parameters: Type.Object({
|
|
21
|
+
number: Type.Union([Type.Number(), Type.String()], { description: "PR number" }),
|
|
22
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO" })),
|
|
23
|
+
}),
|
|
24
|
+
structuredSchema: prViewSchema,
|
|
25
|
+
async execute(_id, params, signal, _onUpdate, ctx) {
|
|
26
|
+
const { number, repo } = params;
|
|
27
|
+
const out = await ghExec(
|
|
20
28
|
[
|
|
21
29
|
"pr",
|
|
22
30
|
"view",
|
|
@@ -26,11 +34,11 @@ export function addReadPrTool(_gh: GhClient, bus: ToolBus) {
|
|
|
26
34
|
"title,state,body,author,createdAt,updatedAt,mergedAt,mergedBy,headRefName,baseRefName,url,additions,deletions,changedFiles,labels,assignees,reviewRequests,reviews,comments,number",
|
|
27
35
|
],
|
|
28
36
|
{ cwd: ctx.cwd, signal, input: params },
|
|
29
|
-
)
|
|
30
|
-
params,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
37
|
+
);
|
|
38
|
+
const result = toStructuredJsonResult(out, params, prViewSchema);
|
|
39
|
+
result.details.pendant = subtitlePendant(params, "number");
|
|
40
|
+
return result;
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
36
44
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
4
4
|
import {
|
|
5
5
|
type GhClient,
|
|
6
6
|
resolveRepo,
|
|
7
7
|
splitRepo,
|
|
8
|
+
type StructuredResultOf,
|
|
8
9
|
subtitlePendant,
|
|
9
10
|
type ToolCall,
|
|
10
|
-
type ToolResult,
|
|
11
11
|
waitChecksReport,
|
|
12
12
|
} from "../base.js";
|
|
13
|
+
import { checksVerdictSchema } from "../schemas.js";
|
|
13
14
|
|
|
14
15
|
interface CommitChecksWaitParams {
|
|
15
16
|
commit: number | string;
|
|
@@ -22,7 +23,7 @@ interface CommitChecksWaitParams {
|
|
|
22
23
|
async function waitCommitChecks(
|
|
23
24
|
gh: GhClient,
|
|
24
25
|
call: ToolCall<CommitChecksWaitParams>,
|
|
25
|
-
): Promise<
|
|
26
|
+
): Promise<StructuredResultOf<typeof checksVerdictSchema>> {
|
|
26
27
|
const { params, ctx, signal, onUpdate } = call;
|
|
27
28
|
const { commit, repo, event, fail_fast } = params;
|
|
28
29
|
|
|
@@ -54,35 +55,38 @@ async function waitCommitChecks(
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
export function addWaitCommitChecksTool(gh: GhClient, bus: ToolBus) {
|
|
57
|
-
bus.register(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"Commit to wait for: full or partial SHA, branch name, or tag name (resolved to the commit's SHA)",
|
|
72
|
-
}),
|
|
73
|
-
repo: Type.Optional(Type.String({ description: "OWNER/REPO" })),
|
|
74
|
-
event: Type.Optional(
|
|
75
|
-
Type.String({
|
|
58
|
+
bus.register(
|
|
59
|
+
defineStructuredTool({
|
|
60
|
+
name: "wait-github-commit-checks",
|
|
61
|
+
label: "Watch GitHub Commit Checks",
|
|
62
|
+
description:
|
|
63
|
+
"Watch CI status checks for a commit until they complete — no pull request required. " +
|
|
64
|
+
"Same semantics as wait-github-pr-checks: returns when any check fails (immediately under fail_fast) " +
|
|
65
|
+
"or all checks pass/skip; on timeout the still-in-flight snapshot is returned. " +
|
|
66
|
+
"With `event`, only check runs triggered by that workflow event (e.g. push) are judged; " +
|
|
67
|
+
"commit statuses have an unknown trigger event and are excluded under a filter. " +
|
|
68
|
+
"Use this to wait for the runs a commit's push triggered, or for checks on an arbitrary ref.",
|
|
69
|
+
promptSnippet: "Watch and wait for GitHub commit CI checks to complete",
|
|
70
|
+
parameters: Type.Object({
|
|
71
|
+
commit: Type.Union([Type.Number(), Type.String()], {
|
|
76
72
|
description:
|
|
77
|
-
"
|
|
73
|
+
"Commit to wait for: full or partial SHA, branch name, or tag name (resolved to the commit's SHA)",
|
|
78
74
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO" })),
|
|
76
|
+
event: Type.Optional(
|
|
77
|
+
Type.String({
|
|
78
|
+
description:
|
|
79
|
+
"Only judge check runs triggered by this workflow event (e.g. push, pull_request)",
|
|
80
|
+
}),
|
|
81
|
+
),
|
|
82
|
+
fail_fast: Type.Optional(
|
|
83
|
+
Type.Boolean({ description: "Exit immediately when any check fails (default: false)" }),
|
|
84
|
+
),
|
|
85
|
+
}),
|
|
86
|
+
structuredSchema: checksVerdictSchema,
|
|
87
|
+
async execute(_id, params, signal, onUpdate, ctx) {
|
|
88
|
+
return waitCommitChecks(gh, { params, ctx, signal, onUpdate });
|
|
89
|
+
},
|
|
83
90
|
}),
|
|
84
|
-
|
|
85
|
-
return waitCommitChecks(gh, { params, ctx, signal, onUpdate });
|
|
86
|
-
},
|
|
87
|
-
});
|
|
91
|
+
);
|
|
88
92
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
3
|
|
|
4
|
-
import type
|
|
4
|
+
import { defineStructuredTool, type ToolBus } from "../../lib/tool-bus.js";
|
|
5
5
|
import {
|
|
6
6
|
type GhClient,
|
|
7
7
|
ghExec,
|
|
8
8
|
resolveRepo,
|
|
9
9
|
splitRepo,
|
|
10
|
+
type StructuredResultOf,
|
|
10
11
|
subtitlePendant,
|
|
11
12
|
type ToolCall,
|
|
12
|
-
type ToolResult,
|
|
13
13
|
waitChecksReport,
|
|
14
14
|
} from "../base.js";
|
|
15
|
+
import { checksVerdictSchema } from "../schemas.js";
|
|
15
16
|
|
|
16
17
|
interface PrChecksWaitParams {
|
|
17
18
|
number: number | string;
|
|
@@ -22,7 +23,10 @@ interface PrChecksWaitParams {
|
|
|
22
23
|
const prHeadSchema = Type.Object({ headRefOid: Type.String() });
|
|
23
24
|
|
|
24
25
|
/** The toolcall handler behind `wait-github-pr-checks`. */
|
|
25
|
-
async function waitPrChecks(
|
|
26
|
+
async function waitPrChecks(
|
|
27
|
+
gh: GhClient,
|
|
28
|
+
call: ToolCall<PrChecksWaitParams>,
|
|
29
|
+
): Promise<StructuredResultOf<typeof checksVerdictSchema>> {
|
|
26
30
|
const { params, ctx, signal, onUpdate } = call;
|
|
27
31
|
const { number, repo, fail_fast } = params;
|
|
28
32
|
|
|
@@ -56,25 +60,28 @@ async function waitPrChecks(gh: GhClient, call: ToolCall<PrChecksWaitParams>): P
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
export function addWaitPrChecksTool(gh: GhClient, bus: ToolBus) {
|
|
59
|
-
bus.register(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Type.
|
|
74
|
-
|
|
63
|
+
bus.register(
|
|
64
|
+
defineStructuredTool({
|
|
65
|
+
name: "wait-github-pr-checks",
|
|
66
|
+
label: "Watch GitHub PR Checks",
|
|
67
|
+
description:
|
|
68
|
+
"Watch CI status checks for a PR until they complete. Blocks until all checks pass (or are skipped) or one fails. " +
|
|
69
|
+
"Covers both commit statuses (Azure DevOps, Jenkins, ...) and GitHub Actions check runs. " +
|
|
70
|
+
"Each polling round streams a compact bullet list of the checks still in flight via onUpdate; " +
|
|
71
|
+
"on timeout the still-in-flight snapshot is returned instead of a verdict. " +
|
|
72
|
+
"Use this when you need to wait for CI to complete and see the final result.",
|
|
73
|
+
promptSnippet: "Watch and wait for GitHub PR CI checks to complete",
|
|
74
|
+
parameters: Type.Object({
|
|
75
|
+
number: Type.Union([Type.Number(), Type.String()], { description: "PR number" }),
|
|
76
|
+
repo: Type.Optional(Type.String({ description: "OWNER/REPO" })),
|
|
77
|
+
fail_fast: Type.Optional(
|
|
78
|
+
Type.Boolean({ description: "Exit immediately when any check fails (default: false)" }),
|
|
79
|
+
),
|
|
80
|
+
}),
|
|
81
|
+
structuredSchema: checksVerdictSchema,
|
|
82
|
+
async execute(_id, params, signal, onUpdate, ctx) {
|
|
83
|
+
return waitPrChecks(gh, { params, ctx, signal, onUpdate });
|
|
84
|
+
},
|
|
75
85
|
}),
|
|
76
|
-
|
|
77
|
-
return waitPrChecks(gh, { params, ctx, signal, onUpdate });
|
|
78
|
-
},
|
|
79
|
-
});
|
|
86
|
+
);
|
|
80
87
|
}
|