@github-tools/sdk 1.13.0 → 1.14.0
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 +5 -5
- package/dist/connect/eve.d.mts +1 -1
- package/dist/connect/eve.mjs +1 -1
- package/dist/connect.d.mts +3 -3
- package/dist/connect.mjs +2 -2
- package/dist/{eve-runtime-BkzmgsI2.mjs → eve-runtime-BdolQrBF.mjs} +3 -2
- package/dist/eve-runtime-BdolQrBF.mjs.map +1 -0
- package/dist/{eve-runtime-C5HaKmOP.d.mts → eve-runtime-D1v4C0UP.d.mts} +4 -4
- package/dist/{eve-runtime-C5HaKmOP.d.mts.map → eve-runtime-D1v4C0UP.d.mts.map} +1 -1
- package/dist/eve-runtime.d.mts +4 -4
- package/dist/eve-runtime.mjs +2 -2
- package/dist/eve.d.mts +3 -3
- package/dist/eve.mjs +2 -2
- package/dist/{index-BjRUOM2Z.d.mts → index-PqQNoVuw.d.mts} +2 -2
- package/dist/{index-BjRUOM2Z.d.mts.map → index-PqQNoVuw.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{src-DPcwVTf-.mjs → src-D9WxaIVj.mjs} +5 -3
- package/dist/src-D9WxaIVj.mjs.map +1 -0
- package/dist/{token-qesvchbI.mjs → token-Dt6qs_kf.mjs} +2 -2
- package/dist/{token-qesvchbI.mjs.map → token-Dt6qs_kf.mjs.map} +1 -1
- package/dist/{tool-types-K8i--5D9.d.mts → tool-types-DbZpOYFG.d.mts} +89 -32
- package/dist/tool-types-DbZpOYFG.d.mts.map +1 -0
- package/dist/{types-6aWpzNzg.d.mts → types-BAEqBfM5.d.mts} +3 -3
- package/dist/{types-6aWpzNzg.d.mts.map → types-BAEqBfM5.d.mts.map} +1 -1
- package/dist/{types-BVSe0Zey.d.mts → types-CCoH12WC.d.mts} +2 -2
- package/dist/{types-BVSe0Zey.d.mts.map → types-CCoH12WC.d.mts.map} +1 -1
- package/dist/workflow.d.mts +2 -2
- package/dist/workflow.mjs +2 -2
- package/dist/{write-tools-BEcL5Fv6.mjs → write-tools-Ct0ZV87Z.mjs} +242 -124
- package/dist/write-tools-Ct0ZV87Z.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/eve-runtime-BkzmgsI2.mjs.map +0 -1
- package/dist/src-DPcwVTf-.mjs.map +0 -1
- package/dist/tool-types-K8i--5D9.d.mts.map +0 -1
- package/dist/write-tools-BEcL5Fv6.mjs.map +0 -1
|
@@ -196,6 +196,58 @@ function gitBlobSha(content) {
|
|
|
196
196
|
return sha1Hex(payload);
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
|
+
//#region src/core/pagination.ts
|
|
200
|
+
const pageSchema = z.number().int().positive().optional().default(1).describe("1-based page. When hasMore is true, call again with nextPage (or page + 1). Do not repeat the same page.");
|
|
201
|
+
const maxPagesSchema = z.number().int().positive().max(20).optional().describe("Fetch and combine up to this many pages in one call (max 20). Prefer this over many page=N calls. Omit to fetch a single page. If hasMore, the next start page is nextPage, not page + 1.");
|
|
202
|
+
function pagingFields(page, perPage, itemCount, hasMore) {
|
|
203
|
+
return {
|
|
204
|
+
hasMore,
|
|
205
|
+
page,
|
|
206
|
+
perPage,
|
|
207
|
+
...hasMore ? { nextPage: page + Math.max(1, Math.ceil(itemCount / perPage)) } : {}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** True when the returned window does not yet cover `totalCount`. */
|
|
211
|
+
function hasMoreByTotal(page, perPage, itemCount, totalCount) {
|
|
212
|
+
return (page - 1) * perPage + itemCount < totalCount;
|
|
213
|
+
}
|
|
214
|
+
function pagedList(items, perPage, page, hasMore) {
|
|
215
|
+
return {
|
|
216
|
+
items,
|
|
217
|
+
...pagingFields(page, perPage, items.length, hasMore)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Fetches a single page (`startPage`, default 1) by default. When `maxPages`
|
|
222
|
+
* is set, fetches pages sequentially starting at `startPage` and stops early
|
|
223
|
+
* once a page returns fewer than `perPage` items (the last page).
|
|
224
|
+
* `hasMore` is true when the last fetched page was full.
|
|
225
|
+
*/
|
|
226
|
+
async function fetchAllPages(fetchPage, perPage, maxPages, startPage = 1) {
|
|
227
|
+
if (!maxPages || maxPages <= 1) {
|
|
228
|
+
const items = await fetchPage(startPage);
|
|
229
|
+
return {
|
|
230
|
+
items,
|
|
231
|
+
hasMore: items.length >= perPage
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const items = [];
|
|
235
|
+
let hasMore = false;
|
|
236
|
+
for (let i = 0; i < maxPages; i++) {
|
|
237
|
+
const pageItems = await fetchPage(startPage + i);
|
|
238
|
+
items.push(...pageItems);
|
|
239
|
+
if (pageItems.length < perPage) {
|
|
240
|
+
hasMore = false;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
hasMore = true;
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
items,
|
|
247
|
+
hasMore
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
199
251
|
//#region src/core/repository.ts
|
|
200
252
|
const CREATE_COMMIT_ON_BRANCH_MUTATION = `
|
|
201
253
|
mutation CreateCommitOnBranch($input: CreateCommitOnBranchInput!) {
|
|
@@ -274,21 +326,23 @@ async function getRepositoryCore({ token, owner, repo }) {
|
|
|
274
326
|
const listBranchesInputSchema = z.object({
|
|
275
327
|
owner: z.string().describe("Repository owner"),
|
|
276
328
|
repo: z.string().describe("Repository name"),
|
|
277
|
-
perPage: z.number().optional().default(30).describe("Number of branches to return (max 100)")
|
|
329
|
+
perPage: z.number().optional().default(30).describe("Number of branches to return (max 100)"),
|
|
330
|
+
page: pageSchema
|
|
278
331
|
});
|
|
279
|
-
const listBranchesDescription = "List branches in a GitHub repository";
|
|
280
|
-
async function listBranchesCore({ token, owner, repo, perPage }) {
|
|
332
|
+
const listBranchesDescription = "List branches in a GitHub repository. When hasMore, pass nextPage — do not repeat the same call.";
|
|
333
|
+
async function listBranchesCore({ token, owner, repo, perPage, page = 1 }) {
|
|
281
334
|
return withOctokit(token, async (octokit) => {
|
|
282
335
|
const { data } = await octokit.rest.repos.listBranches({
|
|
283
336
|
owner,
|
|
284
337
|
repo,
|
|
285
|
-
per_page: perPage
|
|
338
|
+
per_page: perPage,
|
|
339
|
+
page
|
|
286
340
|
});
|
|
287
|
-
return data.map((branch) => ({
|
|
341
|
+
return pagedList(data.map((branch) => ({
|
|
288
342
|
name: branch.name,
|
|
289
343
|
sha: branch.commit.sha,
|
|
290
344
|
protected: branch.protected
|
|
291
|
-
}));
|
|
345
|
+
})), perPage, page, data.length >= perPage);
|
|
292
346
|
});
|
|
293
347
|
}
|
|
294
348
|
const getFileContentInputSchema = z.object({
|
|
@@ -354,10 +408,11 @@ const getRepositoryTreeInputSchema = z.object({
|
|
|
354
408
|
owner: z.string().describe("Repository owner"),
|
|
355
409
|
repo: z.string().describe("Repository name"),
|
|
356
410
|
ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)"),
|
|
357
|
-
|
|
411
|
+
path: z.string().optional().describe("Only entries at or under this directory prefix. Prefer this over recursive true on large repos"),
|
|
412
|
+
recursive: z.boolean().optional().default(false).describe("Recursively list the entire tree instead of just the top level. Prefer path + recursive false when exploring")
|
|
358
413
|
});
|
|
359
|
-
const getRepositoryTreeDescription = "List the file and directory structure of a repository at a given ref";
|
|
360
|
-
async function getRepositoryTreeCore({ token, owner, repo, ref, recursive }) {
|
|
414
|
+
const getRepositoryTreeDescription = "List the file and directory structure of a repository at a given ref. Prefer a path prefix over recursive true. If truncated, narrow path instead of recalling the full tree.";
|
|
415
|
+
async function getRepositoryTreeCore({ token, owner, repo, ref, path, recursive }) {
|
|
361
416
|
return withOctokit(token, async (octokit) => {
|
|
362
417
|
const treeSha = ref || (await octokit.rest.repos.get({
|
|
363
418
|
owner,
|
|
@@ -369,15 +424,21 @@ async function getRepositoryTreeCore({ token, owner, repo, ref, recursive }) {
|
|
|
369
424
|
tree_sha: treeSha,
|
|
370
425
|
recursive: recursive ? "true" : void 0
|
|
371
426
|
});
|
|
427
|
+
const prefix = path?.replace(/\/+$/, "");
|
|
428
|
+
const entries = data.tree.filter((entry) => {
|
|
429
|
+
if (!prefix || !entry.path) return !prefix;
|
|
430
|
+
return entry.path === prefix || entry.path.startsWith(`${prefix}/`);
|
|
431
|
+
}).map((entry) => ({
|
|
432
|
+
path: entry.path,
|
|
433
|
+
type: entry.type,
|
|
434
|
+
size: entry.size,
|
|
435
|
+
sha: entry.sha
|
|
436
|
+
}));
|
|
372
437
|
return {
|
|
373
438
|
sha: data.sha,
|
|
374
439
|
truncated: data.truncated,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
type: entry.type,
|
|
378
|
-
size: entry.size,
|
|
379
|
-
sha: entry.sha
|
|
380
|
-
}))
|
|
440
|
+
path: prefix,
|
|
441
|
+
entries
|
|
381
442
|
};
|
|
382
443
|
});
|
|
383
444
|
}
|
|
@@ -612,6 +673,8 @@ async function createOrUpdateFileCore({ token, owner, repo, path, message, conte
|
|
|
612
673
|
//#region src/core/model-output.ts
|
|
613
674
|
const MAX_PATCH_LENGTH = 4e3;
|
|
614
675
|
const MAX_CONTENT_LENGTH = 2e4;
|
|
676
|
+
const MAX_MODEL_TREE_ENTRIES = 200;
|
|
677
|
+
const MAX_MODEL_DIFF_FILES = 80;
|
|
615
678
|
function truncateText(text, maxLength) {
|
|
616
679
|
if (text.length <= maxLength) return text;
|
|
617
680
|
return `${text.slice(0, maxLength)}\n\n[truncated: ${text.length - maxLength} more characters]`;
|
|
@@ -622,34 +685,66 @@ function truncatePatchFields(files) {
|
|
|
622
685
|
patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch
|
|
623
686
|
}));
|
|
624
687
|
}
|
|
688
|
+
function capDiffFiles(files) {
|
|
689
|
+
if (!files) return {
|
|
690
|
+
files,
|
|
691
|
+
filesOmitted: 0
|
|
692
|
+
};
|
|
693
|
+
const truncated = truncatePatchFields(files);
|
|
694
|
+
if (truncated.length <= MAX_MODEL_DIFF_FILES) return {
|
|
695
|
+
files: truncated,
|
|
696
|
+
filesOmitted: 0
|
|
697
|
+
};
|
|
698
|
+
return {
|
|
699
|
+
files: truncated.slice(0, MAX_MODEL_DIFF_FILES),
|
|
700
|
+
filesOmitted: truncated.length - MAX_MODEL_DIFF_FILES
|
|
701
|
+
};
|
|
702
|
+
}
|
|
625
703
|
function listPullRequestFilesToModelOutput({ output }) {
|
|
704
|
+
const result = output;
|
|
626
705
|
return {
|
|
627
706
|
type: "json",
|
|
628
|
-
value:
|
|
707
|
+
value: {
|
|
708
|
+
...result,
|
|
709
|
+
items: truncatePatchFields(result.items)
|
|
710
|
+
}
|
|
629
711
|
};
|
|
630
712
|
}
|
|
631
713
|
function getCommitToModelOutput({ output }) {
|
|
632
714
|
const commit = output;
|
|
715
|
+
const { files, filesOmitted } = capDiffFiles(commit.files);
|
|
633
716
|
return {
|
|
634
717
|
type: "json",
|
|
635
718
|
value: {
|
|
636
719
|
...commit,
|
|
637
|
-
files
|
|
720
|
+
files,
|
|
721
|
+
...filesOmitted > 0 ? { filesOmitted } : {}
|
|
638
722
|
}
|
|
639
723
|
};
|
|
640
724
|
}
|
|
641
725
|
function compareCommitsToModelOutput({ output }) {
|
|
642
726
|
const comparison = output;
|
|
727
|
+
const { files, filesOmitted } = capDiffFiles(comparison.files);
|
|
643
728
|
return {
|
|
644
729
|
type: "json",
|
|
645
730
|
value: {
|
|
646
731
|
...comparison,
|
|
647
|
-
files
|
|
732
|
+
files,
|
|
733
|
+
...filesOmitted > 0 ? { filesOmitted } : {}
|
|
648
734
|
}
|
|
649
735
|
};
|
|
650
736
|
}
|
|
651
737
|
function getFileContentToModelOutput({ output }) {
|
|
652
738
|
const result = output;
|
|
739
|
+
if (result.type === "directory" && "entries" in result && result.entries.length > MAX_MODEL_TREE_ENTRIES) return {
|
|
740
|
+
type: "json",
|
|
741
|
+
value: {
|
|
742
|
+
...result,
|
|
743
|
+
truncated: true,
|
|
744
|
+
entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),
|
|
745
|
+
entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES
|
|
746
|
+
}
|
|
747
|
+
};
|
|
653
748
|
if ("content" in result && result.content.length > MAX_CONTENT_LENGTH) return {
|
|
654
749
|
type: "json",
|
|
655
750
|
value: {
|
|
@@ -662,13 +757,31 @@ function getFileContentToModelOutput({ output }) {
|
|
|
662
757
|
value: result
|
|
663
758
|
};
|
|
664
759
|
}
|
|
760
|
+
function getRepositoryTreeToModelOutput({ output }) {
|
|
761
|
+
const result = output;
|
|
762
|
+
if (result.entries.length <= MAX_MODEL_TREE_ENTRIES) return {
|
|
763
|
+
type: "json",
|
|
764
|
+
value: result
|
|
765
|
+
};
|
|
766
|
+
return {
|
|
767
|
+
type: "json",
|
|
768
|
+
value: {
|
|
769
|
+
...result,
|
|
770
|
+
truncated: true,
|
|
771
|
+
entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),
|
|
772
|
+
entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
}
|
|
665
776
|
function getPullRequestContextToModelOutput({ output }) {
|
|
666
777
|
const result = output;
|
|
778
|
+
const { files, filesOmitted } = capDiffFiles(result.files);
|
|
667
779
|
return {
|
|
668
780
|
type: "json",
|
|
669
781
|
value: {
|
|
670
782
|
...result,
|
|
671
|
-
files
|
|
783
|
+
files,
|
|
784
|
+
...filesOmitted > 0 ? { filesOmitted } : {}
|
|
672
785
|
}
|
|
673
786
|
};
|
|
674
787
|
}
|
|
@@ -711,24 +824,6 @@ function applyDetailBody(body, detail, maxLength = 500) {
|
|
|
711
824
|
return `${body.slice(0, maxLength)}\n\n[truncated: ${body.length - maxLength} more characters]`;
|
|
712
825
|
}
|
|
713
826
|
//#endregion
|
|
714
|
-
//#region src/core/pagination.ts
|
|
715
|
-
const maxPagesSchema = z.number().int().positive().max(20).optional().describe("Automatically fetch and combine up to this many pages on top of perPage. Omit to fetch a single page.");
|
|
716
|
-
/**
|
|
717
|
-
* Fetches a single page (`startPage`, default 1) by default. When `maxPages`
|
|
718
|
-
* is set, fetches pages sequentially starting at `startPage` and stops early
|
|
719
|
-
* once a page returns fewer than `perPage` items (the last page).
|
|
720
|
-
*/
|
|
721
|
-
async function fetchAllPages(fetchPage, perPage, maxPages, startPage = 1) {
|
|
722
|
-
if (!maxPages || maxPages <= 1) return fetchPage(startPage);
|
|
723
|
-
const results = [];
|
|
724
|
-
for (let i = 0; i < maxPages; i++) {
|
|
725
|
-
const items = await fetchPage(startPage + i);
|
|
726
|
-
results.push(...items);
|
|
727
|
-
if (items.length < perPage) break;
|
|
728
|
-
}
|
|
729
|
-
return results;
|
|
730
|
-
}
|
|
731
|
-
//#endregion
|
|
732
827
|
//#region src/core/pull-requests.ts
|
|
733
828
|
const listPullRequestsInputSchema = z.object({
|
|
734
829
|
owner: z.string().describe("Repository owner"),
|
|
@@ -739,21 +834,23 @@ const listPullRequestsInputSchema = z.object({
|
|
|
739
834
|
"all"
|
|
740
835
|
]).optional().default("open").describe("Filter by state"),
|
|
741
836
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
837
|
+
page: pageSchema,
|
|
742
838
|
maxPages: maxPagesSchema
|
|
743
839
|
});
|
|
744
|
-
const listPullRequestsDescription = "List pull requests for a GitHub repository";
|
|
745
|
-
async function listPullRequestsCore({ token, owner, repo, state, perPage, maxPages }) {
|
|
840
|
+
const listPullRequestsDescription = "List pull requests for a GitHub repository. When hasMore, pass nextPage or raise maxPages — do not repeat the same call.";
|
|
841
|
+
async function listPullRequestsCore({ token, owner, repo, state, perPage, page = 1, maxPages }) {
|
|
746
842
|
return withOctokit(token, async (octokit) => {
|
|
747
|
-
|
|
843
|
+
const { items, hasMore } = await fetchAllPages(async (currentPage) => {
|
|
748
844
|
const { data } = await octokit.rest.pulls.list({
|
|
749
845
|
owner,
|
|
750
846
|
repo,
|
|
751
847
|
state,
|
|
752
848
|
per_page: perPage,
|
|
753
|
-
page
|
|
849
|
+
page: currentPage
|
|
754
850
|
});
|
|
755
851
|
return data;
|
|
756
|
-
}, perPage, maxPages)
|
|
852
|
+
}, perPage, maxPages, page);
|
|
853
|
+
return pagedList(items.map((pr) => ({
|
|
757
854
|
number: pr.number,
|
|
758
855
|
title: pr.title,
|
|
759
856
|
state: pr.state,
|
|
@@ -764,7 +861,7 @@ async function listPullRequestsCore({ token, owner, repo, state, perPage, maxPag
|
|
|
764
861
|
draft: pr.draft,
|
|
765
862
|
createdAt: pr.created_at,
|
|
766
863
|
updatedAt: pr.updated_at
|
|
767
|
-
}));
|
|
864
|
+
})), perPage, page, hasMore);
|
|
768
865
|
});
|
|
769
866
|
}
|
|
770
867
|
const getPullRequestInputSchema = z.object({
|
|
@@ -997,9 +1094,9 @@ const listPullRequestFilesInputSchema = z.object({
|
|
|
997
1094
|
includePatch: z.boolean().optional().default(false).describe("Include diff patches (token-heavy). Prefer false for an overview, then set true with filenames to fetch specific diffs"),
|
|
998
1095
|
filenames: z.array(z.string()).optional().describe("If set, only return these file paths (useful with includePatch: true for targeted diffs)"),
|
|
999
1096
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
1000
|
-
page:
|
|
1097
|
+
page: pageSchema
|
|
1001
1098
|
});
|
|
1002
|
-
const listPullRequestFilesDescription = "List files changed in a pull request with status and stats. Patches are omitted by default — set includePatch true (optionally with filenames) to fetch diffs";
|
|
1099
|
+
const listPullRequestFilesDescription = "List files changed in a pull request with status and stats. Patches are omitted by default — set includePatch true (optionally with filenames) to fetch diffs. When hasMore, pass nextPage — do not repeat the same call.";
|
|
1003
1100
|
async function listPullRequestFilesCore({ token, owner, repo, pullNumber, includePatch, filenames, perPage, page }) {
|
|
1004
1101
|
return withOctokit(token, async (octokit) => {
|
|
1005
1102
|
const { data } = await octokit.rest.pulls.listFiles({
|
|
@@ -1010,14 +1107,14 @@ async function listPullRequestFilesCore({ token, owner, repo, pullNumber, includ
|
|
|
1010
1107
|
page
|
|
1011
1108
|
});
|
|
1012
1109
|
const filenameSet = filenames?.length ? new Set(filenames) : null;
|
|
1013
|
-
return data.filter((file) => !filenameSet || filenameSet.has(file.filename)).map((file) => ({
|
|
1110
|
+
return pagedList(data.filter((file) => !filenameSet || filenameSet.has(file.filename)).map((file) => ({
|
|
1014
1111
|
filename: file.filename,
|
|
1015
1112
|
status: file.status,
|
|
1016
1113
|
additions: file.additions,
|
|
1017
1114
|
deletions: file.deletions,
|
|
1018
1115
|
changes: file.changes,
|
|
1019
1116
|
...includePatch && file.patch != null ? { patch: file.patch } : {}
|
|
1020
|
-
}));
|
|
1117
|
+
})), perPage, page, data.length >= perPage);
|
|
1021
1118
|
});
|
|
1022
1119
|
}
|
|
1023
1120
|
const listPullRequestReviewsInputSchema = z.object({
|
|
@@ -1025,9 +1122,9 @@ const listPullRequestReviewsInputSchema = z.object({
|
|
|
1025
1122
|
repo: z.string().describe("Repository name"),
|
|
1026
1123
|
pullNumber: z.number().describe("Pull request number"),
|
|
1027
1124
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
1028
|
-
page:
|
|
1125
|
+
page: pageSchema
|
|
1029
1126
|
});
|
|
1030
|
-
const listPullRequestReviewsDescription = "List reviews on a pull request (approvals, change requests, and comments)";
|
|
1127
|
+
const listPullRequestReviewsDescription = "List reviews on a pull request (approvals, change requests, and comments). When hasMore, pass nextPage — do not repeat the same call.";
|
|
1031
1128
|
async function listPullRequestReviewsCore({ token, owner, repo, pullNumber, perPage, page }) {
|
|
1032
1129
|
return withOctokit(token, async (octokit) => {
|
|
1033
1130
|
const { data } = await octokit.rest.pulls.listReviews({
|
|
@@ -1037,14 +1134,14 @@ async function listPullRequestReviewsCore({ token, owner, repo, pullNumber, perP
|
|
|
1037
1134
|
per_page: perPage,
|
|
1038
1135
|
page
|
|
1039
1136
|
});
|
|
1040
|
-
return data.map((review) => ({
|
|
1137
|
+
return pagedList(data.map((review) => ({
|
|
1041
1138
|
id: review.id,
|
|
1042
1139
|
state: review.state,
|
|
1043
1140
|
body: review.body,
|
|
1044
1141
|
author: review.user?.login,
|
|
1045
1142
|
url: review.html_url,
|
|
1046
1143
|
submittedAt: review.submitted_at
|
|
1047
|
-
}));
|
|
1144
|
+
})), perPage, page, data.length >= perPage);
|
|
1048
1145
|
});
|
|
1049
1146
|
}
|
|
1050
1147
|
const createPullRequestReviewInputSchema = z.object({
|
|
@@ -1257,22 +1354,24 @@ const listIssuesInputSchema = z.object({
|
|
|
1257
1354
|
]).optional().default("open").describe("Filter by state"),
|
|
1258
1355
|
labels: z.string().optional().describe("Comma-separated list of label names to filter by"),
|
|
1259
1356
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
1357
|
+
page: pageSchema,
|
|
1260
1358
|
maxPages: maxPagesSchema
|
|
1261
1359
|
});
|
|
1262
|
-
const listIssuesDescription = "List issues for a GitHub repository (excludes pull requests)";
|
|
1263
|
-
async function listIssuesCore({ token, owner, repo, state, labels, perPage, maxPages }) {
|
|
1360
|
+
const listIssuesDescription = "List issues for a GitHub repository (excludes pull requests). When hasMore, pass nextPage or raise maxPages — do not repeat the same call.";
|
|
1361
|
+
async function listIssuesCore({ token, owner, repo, state, labels, perPage, page = 1, maxPages }) {
|
|
1264
1362
|
return withOctokit(token, async (octokit) => {
|
|
1265
|
-
|
|
1363
|
+
const { items, hasMore } = await fetchAllPages(async (currentPage) => {
|
|
1266
1364
|
const { data } = await octokit.rest.issues.listForRepo({
|
|
1267
1365
|
owner,
|
|
1268
1366
|
repo,
|
|
1269
1367
|
state,
|
|
1270
1368
|
labels,
|
|
1271
1369
|
per_page: perPage,
|
|
1272
|
-
page
|
|
1370
|
+
page: currentPage
|
|
1273
1371
|
});
|
|
1274
1372
|
return data;
|
|
1275
|
-
}, perPage, maxPages
|
|
1373
|
+
}, perPage, maxPages, page);
|
|
1374
|
+
return pagedList(items.filter((issue) => !issue.pull_request).map((issue) => ({
|
|
1276
1375
|
number: issue.number,
|
|
1277
1376
|
title: issue.title,
|
|
1278
1377
|
state: issue.state,
|
|
@@ -1281,7 +1380,7 @@ async function listIssuesCore({ token, owner, repo, state, labels, perPage, maxP
|
|
|
1281
1380
|
labels: issue.labels.map((l) => typeof l === "string" ? l : l.name),
|
|
1282
1381
|
createdAt: issue.created_at,
|
|
1283
1382
|
updatedAt: issue.updated_at
|
|
1284
|
-
}));
|
|
1383
|
+
})), perPage, page, hasMore);
|
|
1285
1384
|
});
|
|
1286
1385
|
}
|
|
1287
1386
|
const getIssueInputSchema = z.object({
|
|
@@ -1319,10 +1418,10 @@ const listIssueCommentsInputSchema = z.object({
|
|
|
1319
1418
|
repo: z.string().describe("Repository name"),
|
|
1320
1419
|
issueNumber: z.number().describe("Issue number"),
|
|
1321
1420
|
perPage: z.number().optional().default(30).describe("Number of comments to return (max 100)"),
|
|
1322
|
-
page:
|
|
1421
|
+
page: pageSchema,
|
|
1323
1422
|
detail: detailSchema
|
|
1324
1423
|
});
|
|
1325
|
-
const listIssueCommentsDescription = "List comments on a GitHub issue. Bodies are truncated by default (detail: summary)";
|
|
1424
|
+
const listIssueCommentsDescription = "List comments on a GitHub issue. Bodies are truncated by default (detail: summary). When hasMore, pass nextPage — do not repeat the same call.";
|
|
1326
1425
|
async function listIssueCommentsCore({ token, owner, repo, issueNumber, perPage, page, detail = "summary" }) {
|
|
1327
1426
|
return withOctokit(token, async (octokit) => {
|
|
1328
1427
|
const { data } = await octokit.rest.issues.listComments({
|
|
@@ -1332,14 +1431,14 @@ async function listIssueCommentsCore({ token, owner, repo, issueNumber, perPage,
|
|
|
1332
1431
|
per_page: perPage,
|
|
1333
1432
|
page
|
|
1334
1433
|
});
|
|
1335
|
-
return data.map((comment) => ({
|
|
1434
|
+
return pagedList(data.map((comment) => ({
|
|
1336
1435
|
id: comment.id,
|
|
1337
1436
|
url: comment.html_url,
|
|
1338
1437
|
body: applyDetailBody(comment.body, detail),
|
|
1339
1438
|
author: comment.user?.login,
|
|
1340
1439
|
createdAt: comment.created_at,
|
|
1341
1440
|
updatedAt: comment.updated_at
|
|
1342
|
-
}));
|
|
1441
|
+
})), perPage, page, data.length >= perPage);
|
|
1343
1442
|
});
|
|
1344
1443
|
}
|
|
1345
1444
|
const createIssueInputSchema = z.object({
|
|
@@ -1527,9 +1626,9 @@ const listLabelsInputSchema = z.object({
|
|
|
1527
1626
|
owner: z.string().describe("Repository owner"),
|
|
1528
1627
|
repo: z.string().describe("Repository name"),
|
|
1529
1628
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
1530
|
-
page:
|
|
1629
|
+
page: pageSchema
|
|
1531
1630
|
});
|
|
1532
|
-
const listLabelsDescription = "List labels available in a GitHub repository";
|
|
1631
|
+
const listLabelsDescription = "List labels available in a GitHub repository. When hasMore, pass nextPage — do not repeat the same call.";
|
|
1533
1632
|
async function listLabelsCore({ token, owner, repo, perPage, page }) {
|
|
1534
1633
|
return withOctokit(token, async (octokit) => {
|
|
1535
1634
|
const { data } = await octokit.rest.issues.listLabelsForRepo({
|
|
@@ -1538,11 +1637,11 @@ async function listLabelsCore({ token, owner, repo, perPage, page }) {
|
|
|
1538
1637
|
per_page: perPage,
|
|
1539
1638
|
page
|
|
1540
1639
|
});
|
|
1541
|
-
return data.map((label) => ({
|
|
1640
|
+
return pagedList(data.map((label) => ({
|
|
1542
1641
|
name: label.name,
|
|
1543
1642
|
color: label.color,
|
|
1544
1643
|
description: label.description
|
|
1545
|
-
}));
|
|
1644
|
+
})), perPage, page, data.length >= perPage);
|
|
1546
1645
|
});
|
|
1547
1646
|
}
|
|
1548
1647
|
const addLabelsInputSchema = z.object({
|
|
@@ -1719,7 +1818,7 @@ const reactionContentSchema = z.enum([
|
|
|
1719
1818
|
"rocket",
|
|
1720
1819
|
"eyes"
|
|
1721
1820
|
]);
|
|
1722
|
-
function shapeReactions(reactions) {
|
|
1821
|
+
function shapeReactions(reactions, perPage, page) {
|
|
1723
1822
|
const counts = {};
|
|
1724
1823
|
for (const reaction of reactions) counts[reaction.content] = (counts[reaction.content] ?? 0) + 1;
|
|
1725
1824
|
return {
|
|
@@ -1728,7 +1827,8 @@ function shapeReactions(reactions) {
|
|
|
1728
1827
|
reactions: reactions.map((reaction) => ({
|
|
1729
1828
|
content: reaction.content,
|
|
1730
1829
|
user: reaction.user?.login
|
|
1731
|
-
}))
|
|
1830
|
+
})),
|
|
1831
|
+
...pagingFields(page, perPage, reactions.length, reactions.length >= perPage)
|
|
1732
1832
|
};
|
|
1733
1833
|
}
|
|
1734
1834
|
const listIssueReactionsInputSchema = z.object({
|
|
@@ -1737,9 +1837,9 @@ const listIssueReactionsInputSchema = z.object({
|
|
|
1737
1837
|
issueNumber: z.number().describe("Issue or pull request number — pull request conversations share the issue numbering"),
|
|
1738
1838
|
content: reactionContentSchema.optional().describe("Only return reactions of this type"),
|
|
1739
1839
|
perPage: z.number().optional().default(30).describe("Number of reactions to return (max 100)"),
|
|
1740
|
-
page:
|
|
1840
|
+
page: pageSchema
|
|
1741
1841
|
});
|
|
1742
|
-
const listIssueReactionsDescription = "List reactions on an issue or pull request conversation, with per-emoji counts for the returned page";
|
|
1842
|
+
const listIssueReactionsDescription = "List reactions on an issue or pull request conversation, with per-emoji counts for the returned page. When hasMore, pass nextPage — do not repeat the same call.";
|
|
1743
1843
|
async function listIssueReactionsCore({ token, owner, repo, issueNumber, content, perPage, page }) {
|
|
1744
1844
|
return withOctokit(token, async (octokit) => {
|
|
1745
1845
|
const { data } = await octokit.rest.reactions.listForIssue({
|
|
@@ -1750,7 +1850,7 @@ async function listIssueReactionsCore({ token, owner, repo, issueNumber, content
|
|
|
1750
1850
|
per_page: perPage,
|
|
1751
1851
|
page
|
|
1752
1852
|
});
|
|
1753
|
-
return shapeReactions(data);
|
|
1853
|
+
return shapeReactions(data, perPage, page);
|
|
1754
1854
|
});
|
|
1755
1855
|
}
|
|
1756
1856
|
const addIssueReactionInputSchema = z.object({
|
|
@@ -1783,9 +1883,9 @@ const listCommentReactionsInputSchema = z.object({
|
|
|
1783
1883
|
commentId: z.number().describe("Issue or pull request comment ID (from getIssueContext or addIssueComment)"),
|
|
1784
1884
|
content: reactionContentSchema.optional().describe("Only return reactions of this type"),
|
|
1785
1885
|
perPage: z.number().optional().default(30).describe("Number of reactions to return (max 100)"),
|
|
1786
|
-
page:
|
|
1886
|
+
page: pageSchema
|
|
1787
1887
|
});
|
|
1788
|
-
const listCommentReactionsDescription = "List reactions on an issue or pull request comment, with per-emoji counts for the returned page";
|
|
1888
|
+
const listCommentReactionsDescription = "List reactions on an issue or pull request comment, with per-emoji counts for the returned page. When hasMore, pass nextPage — do not repeat the same call.";
|
|
1789
1889
|
async function listCommentReactionsCore({ token, owner, repo, commentId, content, perPage, page }) {
|
|
1790
1890
|
return withOctokit(token, async (octokit) => {
|
|
1791
1891
|
const { data } = await octokit.rest.reactions.listForIssueComment({
|
|
@@ -1796,7 +1896,7 @@ async function listCommentReactionsCore({ token, owner, repo, commentId, content
|
|
|
1796
1896
|
per_page: perPage,
|
|
1797
1897
|
page
|
|
1798
1898
|
});
|
|
1799
|
-
return shapeReactions(data);
|
|
1899
|
+
return shapeReactions(data, perPage, page);
|
|
1800
1900
|
});
|
|
1801
1901
|
}
|
|
1802
1902
|
const addCommentReactionInputSchema = z.object({
|
|
@@ -2030,9 +2130,9 @@ const listNotificationsInputSchema = z.object({
|
|
|
2030
2130
|
all: z.boolean().optional().default(false).describe("Include notifications already marked as read"),
|
|
2031
2131
|
participating: z.boolean().optional().default(false).describe("Only notifications where the authenticated user is directly participating or mentioned"),
|
|
2032
2132
|
perPage: z.number().optional().default(20).describe("Number of notifications to return (max 50)"),
|
|
2033
|
-
page:
|
|
2133
|
+
page: pageSchema
|
|
2034
2134
|
});
|
|
2035
|
-
const listNotificationsDescription = "List notification threads for the authenticated user. Unread only by default — set all true to include read threads. Requires a token with notifications access";
|
|
2135
|
+
const listNotificationsDescription = "List notification threads for the authenticated user. Unread only by default — set all true to include read threads. Requires a token with notifications access. When hasMore, pass nextPage — do not repeat the same call.";
|
|
2036
2136
|
async function listNotificationsCore({ token, all, participating, perPage, page }) {
|
|
2037
2137
|
return withOctokit(token, async (octokit) => {
|
|
2038
2138
|
const { data } = await octokit.rest.activity.listNotificationsForAuthenticatedUser({
|
|
@@ -2041,7 +2141,7 @@ async function listNotificationsCore({ token, all, participating, perPage, page
|
|
|
2041
2141
|
per_page: perPage,
|
|
2042
2142
|
page
|
|
2043
2143
|
});
|
|
2044
|
-
return data.map((thread) => ({
|
|
2144
|
+
return pagedList(data.map((thread) => ({
|
|
2045
2145
|
threadId: thread.id,
|
|
2046
2146
|
repository: thread.repository.full_name,
|
|
2047
2147
|
subject: {
|
|
@@ -2052,7 +2152,7 @@ async function listNotificationsCore({ token, all, participating, perPage, page
|
|
|
2052
2152
|
reason: thread.reason,
|
|
2053
2153
|
unread: thread.unread,
|
|
2054
2154
|
updatedAt: thread.updated_at
|
|
2055
|
-
}));
|
|
2155
|
+
})), perPage, page, data.length >= perPage);
|
|
2056
2156
|
});
|
|
2057
2157
|
}
|
|
2058
2158
|
const markNotificationReadInputSchema = z.object({ threadId: z.string().describe("Notification thread ID (from listNotifications)") });
|
|
@@ -2216,12 +2316,13 @@ const listCommitsInputSchema = z.object({
|
|
|
2216
2316
|
since: z.string().optional().describe("Only commits after this date (ISO 8601 format)"),
|
|
2217
2317
|
until: z.string().optional().describe("Only commits before this date (ISO 8601 format)"),
|
|
2218
2318
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
2319
|
+
page: pageSchema,
|
|
2219
2320
|
maxPages: maxPagesSchema
|
|
2220
2321
|
});
|
|
2221
|
-
const listCommitsDescription = "List commits for a GitHub repository. Filter
|
|
2222
|
-
async function listCommitsCore({ token, owner, repo, path, sha, author, since, until, perPage, maxPages }) {
|
|
2322
|
+
const listCommitsDescription = "List commits for a GitHub repository. Filter with path, author, since, or until instead of paging the full history. When hasMore, pass nextPage or raise maxPages — do not repeat the same call. For line-by-line attribution, use getBlame.";
|
|
2323
|
+
async function listCommitsCore({ token, owner, repo, path, sha, author, since, until, perPage, page = 1, maxPages }) {
|
|
2223
2324
|
return withOctokit(token, async (octokit) => {
|
|
2224
|
-
|
|
2325
|
+
const { items, hasMore } = await fetchAllPages(async (currentPage) => {
|
|
2225
2326
|
const { data } = await octokit.rest.repos.listCommits({
|
|
2226
2327
|
owner,
|
|
2227
2328
|
repo,
|
|
@@ -2231,17 +2332,18 @@ async function listCommitsCore({ token, owner, repo, path, sha, author, since, u
|
|
|
2231
2332
|
since,
|
|
2232
2333
|
until,
|
|
2233
2334
|
per_page: perPage,
|
|
2234
|
-
page
|
|
2335
|
+
page: currentPage
|
|
2235
2336
|
});
|
|
2236
2337
|
return data;
|
|
2237
|
-
}, perPage, maxPages)
|
|
2338
|
+
}, perPage, maxPages, page);
|
|
2339
|
+
return pagedList(items.map((commit) => ({
|
|
2238
2340
|
sha: commit.sha,
|
|
2239
2341
|
message: commit.commit.message,
|
|
2240
2342
|
author: commit.commit.author?.name,
|
|
2241
2343
|
authorLogin: commit.author?.login,
|
|
2242
2344
|
date: commit.commit.author?.date,
|
|
2243
2345
|
url: commit.html_url
|
|
2244
|
-
}));
|
|
2346
|
+
})), perPage, page, hasMore);
|
|
2245
2347
|
});
|
|
2246
2348
|
}
|
|
2247
2349
|
const getCommitInputSchema = z.object({
|
|
@@ -2381,9 +2483,9 @@ async function compareCommitsCore({ token, owner, repo, base, head, includePatch
|
|
|
2381
2483
|
const listGistsInputSchema = z.object({
|
|
2382
2484
|
username: z.string().optional().describe("GitHub username — omit to list your own gists"),
|
|
2383
2485
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
2384
|
-
page:
|
|
2486
|
+
page: pageSchema
|
|
2385
2487
|
});
|
|
2386
|
-
const listGistsDescription = "List gists for the authenticated user or a specific user";
|
|
2488
|
+
const listGistsDescription = "List gists for the authenticated user or a specific user. When hasMore, pass nextPage — do not repeat the same call.";
|
|
2387
2489
|
async function listGistsCore({ token, username, perPage, page }) {
|
|
2388
2490
|
return withOctokit(token, async (octokit) => {
|
|
2389
2491
|
const { data } = username ? await octokit.rest.gists.listForUser({
|
|
@@ -2394,7 +2496,7 @@ async function listGistsCore({ token, username, perPage, page }) {
|
|
|
2394
2496
|
per_page: perPage,
|
|
2395
2497
|
page
|
|
2396
2498
|
});
|
|
2397
|
-
return data.map((gist) => ({
|
|
2499
|
+
return pagedList(data.map((gist) => ({
|
|
2398
2500
|
id: gist.id,
|
|
2399
2501
|
description: gist.description,
|
|
2400
2502
|
public: gist.public,
|
|
@@ -2404,7 +2506,7 @@ async function listGistsCore({ token, username, perPage, page }) {
|
|
|
2404
2506
|
comments: gist.comments,
|
|
2405
2507
|
createdAt: gist.created_at,
|
|
2406
2508
|
updatedAt: gist.updated_at
|
|
2407
|
-
}));
|
|
2509
|
+
})), perPage, page, data.length >= perPage);
|
|
2408
2510
|
});
|
|
2409
2511
|
}
|
|
2410
2512
|
const getGistInputSchema = z.object({ gistId: z.string().describe("Gist ID") });
|
|
@@ -2433,9 +2535,9 @@ async function getGistCore({ token, gistId }) {
|
|
|
2433
2535
|
const listGistCommentsInputSchema = z.object({
|
|
2434
2536
|
gistId: z.string().describe("Gist ID"),
|
|
2435
2537
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
2436
|
-
page:
|
|
2538
|
+
page: pageSchema
|
|
2437
2539
|
});
|
|
2438
|
-
const listGistCommentsDescription = "List comments on a gist";
|
|
2540
|
+
const listGistCommentsDescription = "List comments on a gist. When hasMore, pass nextPage — do not repeat the same call.";
|
|
2439
2541
|
async function listGistCommentsCore({ token, gistId, perPage, page }) {
|
|
2440
2542
|
return withOctokit(token, async (octokit) => {
|
|
2441
2543
|
const { data } = await octokit.rest.gists.listComments({
|
|
@@ -2443,14 +2545,14 @@ async function listGistCommentsCore({ token, gistId, perPage, page }) {
|
|
|
2443
2545
|
per_page: perPage,
|
|
2444
2546
|
page
|
|
2445
2547
|
});
|
|
2446
|
-
return data.map((comment) => ({
|
|
2548
|
+
return pagedList(data.map((comment) => ({
|
|
2447
2549
|
id: comment.id,
|
|
2448
2550
|
body: comment.body,
|
|
2449
2551
|
author: comment.user?.login,
|
|
2450
2552
|
url: comment.url,
|
|
2451
2553
|
createdAt: comment.created_at,
|
|
2452
2554
|
updatedAt: comment.updated_at
|
|
2453
|
-
}));
|
|
2555
|
+
})), perPage, page, data.length >= perPage);
|
|
2454
2556
|
});
|
|
2455
2557
|
}
|
|
2456
2558
|
const createGistInputSchema = z.object({
|
|
@@ -2542,9 +2644,9 @@ const listWorkflowsInputSchema = z.object({
|
|
|
2542
2644
|
owner: z.string().describe("Repository owner"),
|
|
2543
2645
|
repo: z.string().describe("Repository name"),
|
|
2544
2646
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
2545
|
-
page:
|
|
2647
|
+
page: pageSchema
|
|
2546
2648
|
});
|
|
2547
|
-
const listWorkflowsDescription = "List GitHub Actions workflows in a repository";
|
|
2649
|
+
const listWorkflowsDescription = "List GitHub Actions workflows in a repository. When hasMore, pass nextPage — do not repeat the same call.";
|
|
2548
2650
|
async function listWorkflowsCore({ token, owner, repo, perPage, page }) {
|
|
2549
2651
|
return withOctokit(token, async (octokit) => {
|
|
2550
2652
|
const { data } = await octokit.rest.actions.listRepoWorkflows({
|
|
@@ -2563,7 +2665,8 @@ async function listWorkflowsCore({ token, owner, repo, perPage, page }) {
|
|
|
2563
2665
|
url: wf.html_url,
|
|
2564
2666
|
createdAt: wf.created_at,
|
|
2565
2667
|
updatedAt: wf.updated_at
|
|
2566
|
-
}))
|
|
2668
|
+
})),
|
|
2669
|
+
...pagingFields(page, perPage, data.workflows.length, hasMoreByTotal(page, perPage, data.workflows.length, data.total_count))
|
|
2567
2670
|
};
|
|
2568
2671
|
});
|
|
2569
2672
|
}
|
|
@@ -2590,14 +2693,14 @@ const listWorkflowRunsInputSchema = z.object({
|
|
|
2590
2693
|
"pending"
|
|
2591
2694
|
]).optional().describe("Status to filter by"),
|
|
2592
2695
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
2593
|
-
page:
|
|
2696
|
+
page: pageSchema,
|
|
2594
2697
|
maxPages: maxPagesSchema
|
|
2595
2698
|
});
|
|
2596
|
-
const listWorkflowRunsDescription = "List workflow runs for a repository, optionally filtered by workflow, branch, status, or event";
|
|
2699
|
+
const listWorkflowRunsDescription = "List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. When hasMore, pass nextPage or raise maxPages — do not repeat the same call.";
|
|
2597
2700
|
async function listWorkflowRunsCore({ token, owner, repo, workflowId, branch, event, status, perPage, page, maxPages }) {
|
|
2598
2701
|
return withOctokit(token, async (octokit) => {
|
|
2599
2702
|
let totalCount = 0;
|
|
2600
|
-
const
|
|
2703
|
+
const { items } = await fetchAllPages(async (currentPage) => {
|
|
2601
2704
|
const { data } = workflowId ? await octokit.rest.actions.listWorkflowRuns({
|
|
2602
2705
|
owner,
|
|
2603
2706
|
repo,
|
|
@@ -2621,7 +2724,7 @@ async function listWorkflowRunsCore({ token, owner, repo, workflowId, branch, ev
|
|
|
2621
2724
|
}, perPage, maxPages, page);
|
|
2622
2725
|
return {
|
|
2623
2726
|
totalCount,
|
|
2624
|
-
runs:
|
|
2727
|
+
runs: items.map((run) => ({
|
|
2625
2728
|
id: run.id,
|
|
2626
2729
|
name: run.name,
|
|
2627
2730
|
status: run.status,
|
|
@@ -2634,7 +2737,8 @@ async function listWorkflowRunsCore({ token, owner, repo, workflowId, branch, ev
|
|
|
2634
2737
|
updatedAt: run.updated_at,
|
|
2635
2738
|
runNumber: run.run_number,
|
|
2636
2739
|
runAttempt: run.run_attempt
|
|
2637
|
-
}))
|
|
2740
|
+
})),
|
|
2741
|
+
...pagingFields(page, perPage, items.length, hasMoreByTotal(page, perPage, items.length, totalCount))
|
|
2638
2742
|
};
|
|
2639
2743
|
});
|
|
2640
2744
|
}
|
|
@@ -2675,9 +2779,9 @@ const listWorkflowJobsInputSchema = z.object({
|
|
|
2675
2779
|
runId: z.number().describe("Workflow run ID"),
|
|
2676
2780
|
filter: z.enum(["latest", "all"]).optional().default("latest").describe("Filter by the latest attempt or all attempts"),
|
|
2677
2781
|
perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
|
|
2678
|
-
page:
|
|
2782
|
+
page: pageSchema
|
|
2679
2783
|
});
|
|
2680
|
-
const listWorkflowJobsDescription = "List jobs for a workflow run, including step-level status and timing";
|
|
2784
|
+
const listWorkflowJobsDescription = "List jobs for a workflow run, including step-level status and timing. When hasMore, pass nextPage — do not repeat the same call.";
|
|
2681
2785
|
async function listWorkflowJobsCore({ token, owner, repo, runId, filter, perPage, page }) {
|
|
2682
2786
|
return withOctokit(token, async (octokit) => {
|
|
2683
2787
|
const { data } = await octokit.rest.actions.listJobsForWorkflowRun({
|
|
@@ -2707,7 +2811,8 @@ async function listWorkflowJobsCore({ token, owner, repo, runId, filter, perPage
|
|
|
2707
2811
|
startedAt: step.started_at,
|
|
2708
2812
|
completedAt: step.completed_at
|
|
2709
2813
|
}))
|
|
2710
|
-
}))
|
|
2814
|
+
})),
|
|
2815
|
+
...pagingFields(page, perPage, data.jobs.length, hasMoreByTotal(page, perPage, data.jobs.length, data.total_count))
|
|
2711
2816
|
};
|
|
2712
2817
|
});
|
|
2713
2818
|
}
|
|
@@ -2825,26 +2930,27 @@ const listCheckRunsInputSchema = z.object({
|
|
|
2825
2930
|
repo: z.string().describe("Repository name"),
|
|
2826
2931
|
ref: z.string().describe("Git ref: branch, tag, or commit SHA"),
|
|
2827
2932
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
2933
|
+
page: pageSchema,
|
|
2828
2934
|
maxPages: maxPagesSchema
|
|
2829
2935
|
});
|
|
2830
|
-
const listCheckRunsDescription = "List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag";
|
|
2831
|
-
async function listCheckRunsCore({ token, owner, repo, ref, perPage, maxPages }) {
|
|
2936
|
+
const listCheckRunsDescription = "List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. When hasMore, pass nextPage or raise maxPages — do not repeat the same call.";
|
|
2937
|
+
async function listCheckRunsCore({ token, owner, repo, ref, perPage, page = 1, maxPages }) {
|
|
2832
2938
|
return withOctokit(token, async (octokit) => {
|
|
2833
2939
|
let totalCount = 0;
|
|
2834
|
-
const
|
|
2940
|
+
const { items } = await fetchAllPages(async (currentPage) => {
|
|
2835
2941
|
const { data } = await octokit.rest.checks.listForRef({
|
|
2836
2942
|
owner,
|
|
2837
2943
|
repo,
|
|
2838
2944
|
ref,
|
|
2839
2945
|
per_page: perPage,
|
|
2840
|
-
page
|
|
2946
|
+
page: currentPage
|
|
2841
2947
|
});
|
|
2842
2948
|
totalCount = data.total_count;
|
|
2843
2949
|
return data.check_runs;
|
|
2844
|
-
}, perPage, maxPages);
|
|
2950
|
+
}, perPage, maxPages, page);
|
|
2845
2951
|
return {
|
|
2846
2952
|
totalCount,
|
|
2847
|
-
checkRuns:
|
|
2953
|
+
checkRuns: items.map((run) => ({
|
|
2848
2954
|
id: run.id,
|
|
2849
2955
|
name: run.name,
|
|
2850
2956
|
status: run.status,
|
|
@@ -2852,7 +2958,8 @@ async function listCheckRunsCore({ token, owner, repo, ref, perPage, maxPages })
|
|
|
2852
2958
|
url: run.html_url,
|
|
2853
2959
|
startedAt: run.started_at,
|
|
2854
2960
|
completedAt: run.completed_at
|
|
2855
|
-
}))
|
|
2961
|
+
})),
|
|
2962
|
+
...pagingFields(page, perPage, items.length, hasMoreByTotal(page, perPage, items.length, totalCount))
|
|
2856
2963
|
};
|
|
2857
2964
|
});
|
|
2858
2965
|
}
|
|
@@ -2887,21 +2994,23 @@ const listReleasesInputSchema = z.object({
|
|
|
2887
2994
|
owner: z.string().describe("Repository owner"),
|
|
2888
2995
|
repo: z.string().describe("Repository name"),
|
|
2889
2996
|
perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
|
|
2997
|
+
page: pageSchema,
|
|
2890
2998
|
maxPages: maxPagesSchema,
|
|
2891
2999
|
detail: detailSchema
|
|
2892
3000
|
});
|
|
2893
|
-
const listReleasesDescription = "List releases for a GitHub repository, newest first (includes drafts and prereleases). Bodies truncated by default (detail: summary)";
|
|
2894
|
-
async function listReleasesCore({ token, owner, repo, perPage, maxPages, detail = "summary" }) {
|
|
3001
|
+
const listReleasesDescription = "List releases for a GitHub repository, newest first (includes drafts and prereleases). Bodies truncated by default (detail: summary). When hasMore, pass nextPage or raise maxPages — do not repeat the same call.";
|
|
3002
|
+
async function listReleasesCore({ token, owner, repo, perPage, page = 1, maxPages, detail = "summary" }) {
|
|
2895
3003
|
return withOctokit(token, async (octokit) => {
|
|
2896
|
-
|
|
3004
|
+
const { items, hasMore } = await fetchAllPages(async (currentPage) => {
|
|
2897
3005
|
const { data } = await octokit.rest.repos.listReleases({
|
|
2898
3006
|
owner,
|
|
2899
3007
|
repo,
|
|
2900
3008
|
per_page: perPage,
|
|
2901
|
-
page
|
|
3009
|
+
page: currentPage
|
|
2902
3010
|
});
|
|
2903
3011
|
return data;
|
|
2904
|
-
}, perPage, maxPages)
|
|
3012
|
+
}, perPage, maxPages, page);
|
|
3013
|
+
return pagedList(items.map((release) => ({
|
|
2905
3014
|
id: release.id,
|
|
2906
3015
|
tagName: release.tag_name,
|
|
2907
3016
|
name: release.name,
|
|
@@ -2912,7 +3021,7 @@ async function listReleasesCore({ token, owner, repo, perPage, maxPages, detail
|
|
|
2912
3021
|
author: release.author?.login,
|
|
2913
3022
|
createdAt: release.created_at,
|
|
2914
3023
|
publishedAt: release.published_at
|
|
2915
|
-
}));
|
|
3024
|
+
})), perPage, page, hasMore);
|
|
2916
3025
|
});
|
|
2917
3026
|
}
|
|
2918
3027
|
const getLatestReleaseInputSchema = z.object({
|
|
@@ -3088,7 +3197,7 @@ const getPullRequestContextInputSchema = z.object({
|
|
|
3088
3197
|
filesPerPage: z.number().optional().default(100).describe("Max files to return when includeFiles is true (max 100)"),
|
|
3089
3198
|
detail: detailSchema
|
|
3090
3199
|
});
|
|
3091
|
-
const getPullRequestContextDescription = "Fetch pull request details plus files, reviews, and optional CI checks in one call — prefer this over separate getPullRequest / listPullRequestFiles / listPullRequestReviews calls";
|
|
3200
|
+
const getPullRequestContextDescription = "Fetch pull request details plus files, reviews, and optional CI checks in one call — prefer this over separate getPullRequest / listPullRequestFiles / listPullRequestReviews calls. filesHasMore / reviewsHasMore mean more pages exist on those lists.";
|
|
3092
3201
|
async function getPullRequestContextCore({ token, owner, repo, pullNumber, includeFiles, includeReviews, includeChecks, includePatch, filesPerPage, detail = "summary" }) {
|
|
3093
3202
|
const pullRequest = await getPullRequestCore({
|
|
3094
3203
|
token,
|
|
@@ -3134,8 +3243,14 @@ async function getPullRequestContextCore({ token, owner, repo, pullNumber, inclu
|
|
|
3134
3243
|
]);
|
|
3135
3244
|
return withComposedRateLimit({
|
|
3136
3245
|
pullRequest,
|
|
3137
|
-
...files !== void 0 ? {
|
|
3138
|
-
|
|
3246
|
+
...files !== void 0 ? {
|
|
3247
|
+
files: files.items,
|
|
3248
|
+
filesHasMore: files.hasMore
|
|
3249
|
+
} : {},
|
|
3250
|
+
...reviews !== void 0 ? {
|
|
3251
|
+
reviews: reviews.items,
|
|
3252
|
+
reviewsHasMore: reviews.hasMore
|
|
3253
|
+
} : {},
|
|
3139
3254
|
...checks !== void 0 ? { checks } : {}
|
|
3140
3255
|
});
|
|
3141
3256
|
}
|
|
@@ -3148,7 +3263,7 @@ const getIssueContextInputSchema = z.object({
|
|
|
3148
3263
|
maxComments: z.number().optional().default(5).describe("Max recent comments to include (keep small — fetch more only when needed)"),
|
|
3149
3264
|
detail: z.enum(["summary", "full"]).optional().default("full").describe("full returns the complete body (default for this one-shot tool); summary truncates to ~500 chars")
|
|
3150
3265
|
});
|
|
3151
|
-
const getIssueContextDescription = "Fetch an issue plus available label names and recent comments in one call — prefer this over separate getIssue / listLabels / comment calls when triaging. Call once; do not re-fetch the same issue.";
|
|
3266
|
+
const getIssueContextDescription = "Fetch an issue plus available label names and recent comments in one call — prefer this over separate getIssue / listLabels / comment calls when triaging. Call once; do not re-fetch the same issue. commentsHasMore means more comments exist — use listIssueComments with nextPage.";
|
|
3152
3267
|
async function getIssueContextCore({ token, owner, repo, issueNumber, includeLabels, includeComments, maxComments, detail = "full" }) {
|
|
3153
3268
|
const [issue, labels, comments] = await Promise.all([
|
|
3154
3269
|
getIssueCore({
|
|
@@ -3177,8 +3292,11 @@ async function getIssueContextCore({ token, owner, repo, issueNumber, includeLab
|
|
|
3177
3292
|
]);
|
|
3178
3293
|
return withComposedRateLimit({
|
|
3179
3294
|
issue,
|
|
3180
|
-
...labels !== void 0 ? { labelNames: labels.map((label) => label.name) } : {},
|
|
3181
|
-
...comments !== void 0 ? {
|
|
3295
|
+
...labels !== void 0 ? { labelNames: labels.items.map((label) => label.name) } : {},
|
|
3296
|
+
...comments !== void 0 ? {
|
|
3297
|
+
comments: comments.items,
|
|
3298
|
+
commentsHasMore: comments.hasMore
|
|
3299
|
+
} : {}
|
|
3182
3300
|
});
|
|
3183
3301
|
}
|
|
3184
3302
|
const getReleaseContextInputSchema = z.object({
|
|
@@ -3211,7 +3329,7 @@ async function getReleaseContextCore({ token, owner, repo, releaseId, includePre
|
|
|
3211
3329
|
perPage: 10,
|
|
3212
3330
|
maxPages: 1,
|
|
3213
3331
|
detail
|
|
3214
|
-
})).find((r) => r.id !== release.id && !r.draft);
|
|
3332
|
+
})).items.find((r) => r.id !== release.id && !r.draft);
|
|
3215
3333
|
let comparison;
|
|
3216
3334
|
if (includeCompare && previous) comparison = await compareCommitsCore({
|
|
3217
3335
|
token,
|
|
@@ -4709,6 +4827,6 @@ const GITHUB_TOOL_NAMES = Object.fromEntries(ALL_GITHUB_TOOL_NAMES.map((name) =>
|
|
|
4709
4827
|
*/
|
|
4710
4828
|
const GITHUB_WRITE_TOOLS = Object.fromEntries(GITHUB_WRITE_TOOL_NAMES.map((name) => [name, name]));
|
|
4711
4829
|
//#endregion
|
|
4712
|
-
export { getWorkflowJobLogsInputSchema as $,
|
|
4830
|
+
export { getWorkflowJobLogsInputSchema as $, listBranchesCore as $i, deleteIssueCommentInputSchema as $n, listPullRequestReviewsInputSchema as $r, searchCodeInputSchema as $t, getLatestReleaseCore as A, createBranchDescription as Ai, listIssueReactionsCore as An, addPullRequestCommentCore as Ar, listGistCommentsCore as At, updateReleaseDescription as B, deleteBranchInputSchema as Bi, addLabelsDescription as Bn, deletePullRequestCommentDescription as Br, compareCommitsDescription as Bt, getReleaseContextInputSchema as C, compareCommitsToModelOutput as Ci, addCommentReactionInputSchema as Cn, updateIssueCommentInputSchema as Cr, createGistInputSchema as Ct, deleteReleaseCore as D, getRepositoryTreeToModelOutput as Di, listCommentReactionsCore as Dn, updateLabelCore as Dr, getGistCore as Dt, createReleaseInputSchema as E, getPullRequestContextToModelOutput as Ei, addIssueReactionInputSchema as En, updateIssueInputSchema as Er, deleteGistInputSchema as Et, getReleaseInputSchema as F, createRepositoryCore as Fi, addAssigneesInputSchema as Fn, createPullRequestInputSchema as Fr, listGistsInputSchema as Ft, listCheckRunsCore as G, getFileContentDescription as Gi, createIssueCore as Gn, listPullRequestFilesCore as Gr, getCommitCore as Gt, getCombinedStatusCore as H, forkRepositoryDescription as Hi, closeIssueCore as Hn, getPullRequestCore as Hr, getBlameCore as Ht, listReleasesCore as I, createRepositoryDescription as Ii, addIssueCommentCore as In, createPullRequestReviewCore as Ir, updateGistCore as It, cancelWorkflowRunCore as J, getRepositoryDescription as Ji, createLabelCore as Jn, listPullRequestReviewThreadsCore as Jr, listCommitsCore as Jt, listCheckRunsDescription as K, getFileContentInputSchema as Ki, createIssueDescription as Kn, listPullRequestFilesDescription as Kr, getCommitDescription as Kt, listReleasesDescription as L, createRepositoryInputSchema as Li, addIssueCommentDescription as Ln, createPullRequestReviewDescription as Lr, updateGistDescription as Lt, getLatestReleaseInputSchema as M, createOrUpdateFileCore as Mi, listIssueReactionsInputSchema as Mn, addPullRequestCommentInputSchema as Mr, listGistCommentsInputSchema as Mt, getReleaseCore as N, createOrUpdateFileDescription as Ni, addAssigneesCore as Nn, createPullRequestCore as Nr, listGistsCore as Nt, deleteReleaseDescription as O, listPullRequestFilesToModelOutput as Oi, listCommentReactionsDescription as On, updateLabelDescription as Or, getGistDescription as Ot, getReleaseDescription as P, createOrUpdateFileInputSchema as Pi, addAssigneesDescription as Pn, createPullRequestDescription as Pr, listGistsDescription as Pt, getWorkflowJobLogsDescription as Q, getRepositoryTreeInputSchema as Qi, deleteIssueCommentDescription as Qn, listPullRequestReviewsDescription as Qr, searchCodeDescription as Qt, listReleasesInputSchema as R, deleteBranchCore as Ri, addIssueCommentInputSchema as Rn, createPullRequestReviewInputSchema as Rr, updateGistInputSchema as Rt, getReleaseContextDescription as S, resolveGithubToken as Si, addCommentReactionDescription as Sn, updateIssueCommentDescription as Sr, createGistDescription as St, createReleaseDescription as T, getFileContentToModelOutput as Ti, addIssueReactionDescription as Tn, updateIssueDescription as Tr, deleteGistDescription as Tt, getCombinedStatusDescription as U, forkRepositoryInputSchema as Ui, closeIssueDescription as Un, getPullRequestDescription as Ur, getBlameDescription as Ut, updateReleaseInputSchema as V, forkRepositoryCore as Vi, addLabelsInputSchema as Vn, deletePullRequestCommentInputSchema as Vr, compareCommitsInputSchema as Vt, getCombinedStatusInputSchema as W, getFileContentCore as Wi, closeIssueInputSchema as Wn, getPullRequestInputSchema as Wr, getBlameInputSchema as Wt, cancelWorkflowRunInputSchema as X, getRepositoryTreeCore as Xi, createLabelInputSchema as Xn, listPullRequestReviewThreadsInputSchema as Xr, listCommitsInputSchema as Xt, cancelWorkflowRunDescription as Y, getRepositoryInputSchema as Yi, createLabelDescription as Yn, listPullRequestReviewThreadsDescription as Yr, listCommitsDescription as Yt, getWorkflowJobLogsCore as Z, getRepositoryTreeDescription as Zi, deleteIssueCommentCore as Zn, listPullRequestReviewsCore as Zr, searchCodeCore as Zt, getIssueContextInputSchema as _, updatePullRequestCommentInputSchema as _i, getDiscussionInputSchema as _n, removeAssigneesInputSchema as _r, triggerWorkflowInputSchema as _t, isGithubWriteToolName as a, mergePullRequestInputSchema as ai, searchRepositoriesInputSchema as an, getIssueInputSchema as ar, listWorkflowJobsInputSchema as at, getPullRequestContextInputSchema as b, updatePullRequestInputSchema as bi, listDiscussionsInputSchema as bn, removeLabelInputSchema as br, createGistCommentInputSchema as bt, bindToolsContext as c, replyToReviewCommentInputSchema as ci, listNotificationsInputSchema as cn, listIssueCommentsInputSchema as cr, listWorkflowRunsInputSchema as ct, softenContextSchema as d, requestReviewersInputSchema as di, markNotificationReadInputSchema as dn, listIssuesInputSchema as dr, listWorkflowsInputSchema as dt, listBranchesDescription as ea, listPullRequestsCore as ei, searchIssuesCore as en, deleteLabelCore as er, getWorkflowRunCore as et, getCiFailureContextCore as f, resolveReviewThreadCore as fi, addDiscussionCommentCore as fn, listLabelsCore as fr, rerunWorkflowRunCore as ft, getIssueContextDescription as g, updatePullRequestCommentDescription as gi, getDiscussionDescription as gn, removeAssigneesDescription as gr, triggerWorkflowDescription as gt, getIssueContextCore as h, updatePullRequestCommentCore as hi, getDiscussionCore as hn, removeAssigneesCore as hr, triggerWorkflowCore as ht, GITHUB_TOOL_CATALOG as i, mergePullRequestDescription as ii, searchRepositoriesDescription as in, getIssueDescription as ir, listWorkflowJobsDescription as it, getLatestReleaseDescription as j, createBranchInputSchema as ji, listIssueReactionsDescription as jn, addPullRequestCommentDescription as jr, listGistCommentsDescription as jt, deleteReleaseInputSchema as k, createBranchCore as ki, listCommentReactionsInputSchema as kn, updateLabelInputSchema as kr, getGistInputSchema as kt, formatContextInstructions as l, requestReviewersCore as li, markNotificationReadCore as ln, listIssuesCore as lr, listWorkflowsCore as lt, getCiFailureContextInputSchema as m, resolveReviewThreadInputSchema as mi, addDiscussionCommentInputSchema as mn, listLabelsInputSchema as mr, rerunWorkflowRunInputSchema as mt, GITHUB_TOOL_NAMES as n, createOctokit as na, listPullRequestsInputSchema as ni, searchIssuesInputSchema as nn, deleteLabelInputSchema as nr, getWorkflowRunInputSchema as nt, PRESET_TOOLS as o, replyToReviewCommentCore as oi, listNotificationsCore as on, listIssueCommentsCore as or, listWorkflowRunsCore as ot, getCiFailureContextDescription as p, resolveReviewThreadDescription as pi, addDiscussionCommentDescription as pn, listLabelsDescription as pr, rerunWorkflowRunDescription as pt, listCheckRunsInputSchema as q, getRepositoryCore as qi, createIssueInputSchema as qn, listPullRequestFilesInputSchema as qr, getCommitInputSchema as qt, ALL_GITHUB_TOOL_NAMES as r, stripRateLimit as ra, mergePullRequestCore as ri, searchRepositoriesCore as rn, getIssueCore as rr, listWorkflowJobsCore as rt, resolvePresetTools as s, replyToReviewCommentDescription as si, listNotificationsDescription as sn, listIssueCommentsDescription as sr, listWorkflowRunsDescription as st, GITHUB_WRITE_TOOLS as t, listBranchesInputSchema as ta, listPullRequestsDescription as ti, searchIssuesDescription as tn, deleteLabelDescription as tr, getWorkflowRunDescription as tt, mergeContextArgs as u, requestReviewersDescription as ui, markNotificationReadDescription as un, listIssuesDescription as ur, listWorkflowsDescription as ut, getPullRequestContextCore as v, updatePullRequestCore as vi, listDiscussionsCore as vn, removeLabelCore as vr, createGistCommentCore as vt, createReleaseCore as w, getCommitToModelOutput as wi, addIssueReactionCore as wn, updateIssueCore as wr, deleteGistCore as wt, getReleaseContextCore as x, createGithubTokenResolver as xi, addCommentReactionCore as xn, updateIssueCommentCore as xr, createGistCore as xt, getPullRequestContextDescription as y, updatePullRequestDescription as yi, listDiscussionsDescription as yn, removeLabelDescription as yr, createGistCommentDescription as yt, updateReleaseCore as z, deleteBranchDescription as zi, addLabelsCore as zn, deletePullRequestCommentCore as zr, compareCommitsCore as zt };
|
|
4713
4831
|
|
|
4714
|
-
//# sourceMappingURL=write-tools-
|
|
4832
|
+
//# sourceMappingURL=write-tools-Ct0ZV87Z.mjs.map
|