@pecot/workflow-mcp 5.0.0 → 7.0.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/.claude-plugin/plugin.json +1 -1
- package/README.md +27 -22
- package/cli/dist/cli.js +6 -1
- package/cli/dist/commands/board-add.d.ts +3 -0
- package/cli/dist/commands/board-add.js +69 -0
- package/cli/dist/commands/board-judgment.d.ts +69 -0
- package/cli/dist/commands/board-judgment.js +150 -0
- package/cli/dist/commands/board-move.d.ts +3 -0
- package/cli/dist/commands/board-move.js +65 -0
- package/cli/dist/commands/board-readiness.d.ts +34 -0
- package/cli/dist/commands/board-readiness.js +108 -0
- package/cli/dist/commands/board-show.d.ts +3 -0
- package/cli/dist/commands/board-show.js +75 -0
- package/cli/dist/commands/board-sync.d.ts +3 -0
- package/cli/dist/commands/board-sync.js +120 -0
- package/cli/dist/commands/board-view.d.ts +151 -0
- package/cli/dist/commands/board-view.js +293 -0
- package/cli/dist/commands/board.d.ts +3 -0
- package/cli/dist/commands/board.js +12 -0
- package/cli/dist/commands/branch.d.ts +3 -0
- package/cli/dist/commands/branch.js +111 -0
- package/cli/dist/commands/command-binding.js +4 -0
- package/cli/dist/commands/command-definition.d.ts +39 -8
- package/cli/dist/commands/command-definition.js +20 -7
- package/cli/dist/commands/command-help.js +2 -2
- package/cli/dist/commands/command-hint.d.ts +5 -0
- package/cli/dist/commands/command-hint.js +13 -0
- package/cli/dist/commands/command-stop.d.ts +5 -3
- package/cli/dist/commands/command-stop.js +7 -6
- package/cli/dist/commands/failure-kind.d.ts +3 -0
- package/cli/dist/commands/failure-kind.js +35 -0
- package/cli/dist/commands/failure.d.ts +6 -0
- package/cli/dist/commands/failure.js +29 -3
- package/cli/dist/commands/github-client.d.ts +6 -2
- package/cli/dist/commands/github-client.js +13 -3
- package/cli/dist/commands/help.js +8 -13
- package/cli/dist/commands/issue-board.d.ts +61 -0
- package/cli/dist/commands/issue-board.js +85 -1
- package/cli/dist/commands/issue-comment.js +66 -30
- package/cli/dist/commands/issue-create.js +632 -92
- package/cli/dist/commands/issue-dependency.d.ts +3 -0
- package/cli/dist/commands/issue-dependency.js +310 -0
- package/cli/dist/commands/issue-readiness.d.ts +122 -0
- package/cli/dist/commands/issue-readiness.js +253 -0
- package/cli/dist/commands/issue-reopen.d.ts +3 -0
- package/cli/dist/commands/issue-reopen.js +130 -0
- package/cli/dist/commands/issue-shared.d.ts +33 -20
- package/cli/dist/commands/issue-shared.js +84 -76
- package/cli/dist/commands/issue-show.d.ts +3 -0
- package/cli/dist/commands/issue-show.js +239 -0
- package/cli/dist/commands/issue.d.ts +0 -1
- package/cli/dist/commands/issue.js +6 -8
- package/cli/dist/commands/names.d.ts +33 -0
- package/cli/dist/commands/names.js +63 -0
- package/cli/dist/commands/output.d.ts +32 -4
- package/cli/dist/commands/output.js +28 -8
- package/cli/dist/commands/pr-merge.d.ts +3 -0
- package/cli/dist/commands/pr-merge.js +230 -0
- package/cli/dist/commands/pr-reference.d.ts +8 -0
- package/cli/dist/commands/pr-reference.js +30 -0
- package/cli/dist/commands/pr-restack.d.ts +6 -0
- package/cli/dist/commands/pr-restack.js +233 -0
- package/cli/dist/commands/pr-waiting.d.ts +59 -0
- package/cli/dist/commands/pr-waiting.js +143 -0
- package/cli/dist/commands/pr.d.ts +23 -0
- package/cli/dist/commands/pr.js +378 -366
- package/cli/dist/commands/project-sync.d.ts +12 -3
- package/cli/dist/commands/project-sync.js +23 -13
- package/cli/dist/commands/project.d.ts +3 -2
- package/cli/dist/commands/project.js +371 -177
- package/cli/dist/commands/registry.js +15 -10
- package/cli/dist/commands/release.d.ts +2 -2
- package/cli/dist/commands/release.js +118 -130
- package/cli/dist/commands/renamed-commands.d.ts +26 -0
- package/cli/dist/commands/renamed-commands.js +53 -0
- package/cli/dist/commands/repository-match.js +9 -3
- package/cli/dist/commands/session-finish.d.ts +3 -0
- package/cli/dist/commands/session-finish.js +383 -0
- package/cli/dist/commands/session-start.d.ts +3 -0
- package/cli/dist/commands/session-start.js +252 -0
- package/cli/dist/commands/session.d.ts +3 -0
- package/cli/dist/commands/session.js +186 -32
- package/cli/dist/commands/tracker-sync-dependabot.d.ts +7 -0
- package/cli/dist/commands/{dependabot.js → tracker-sync-dependabot.js} +76 -68
- package/cli/dist/commands/tracker-sync-security.d.ts +7 -0
- package/cli/dist/commands/{security.js → tracker-sync-security.js} +71 -64
- package/cli/dist/commands/tracker-sync.d.ts +37 -0
- package/cli/dist/commands/tracker-sync.js +18 -6
- package/cli/dist/commands/tracker.d.ts +3 -0
- package/cli/dist/commands/tracker.js +20 -0
- package/cli/dist/commands/usage-error.d.ts +4 -0
- package/cli/dist/commands/usage-error.js +6 -0
- package/cli/dist/commands/work-target.d.ts +20 -3
- package/cli/dist/commands/work-target.js +49 -6
- package/cli/dist/commands/worktree.js +103 -33
- package/cli/dist/domain/batch-plan.d.ts +73 -0
- package/cli/dist/domain/batch-plan.js +114 -0
- package/cli/dist/domain/blocked-by-change.d.ts +99 -0
- package/cli/dist/domain/blocked-by-change.js +101 -0
- package/cli/dist/domain/board-move.d.ts +90 -0
- package/cli/dist/domain/board-move.js +92 -0
- package/cli/dist/domain/branch-name.js +1 -1
- package/cli/dist/domain/command-hint.d.ts +85 -0
- package/cli/dist/domain/command-hint.js +148 -0
- package/cli/dist/domain/config.d.ts +4 -0
- package/cli/dist/domain/config.js +11 -1
- package/cli/dist/domain/dependabot.js +1 -1
- package/cli/dist/domain/errors.d.ts +5 -0
- package/cli/dist/domain/errors.js +5 -0
- package/cli/dist/domain/format.d.ts +51 -4
- package/cli/dist/domain/format.js +72 -6
- package/cli/dist/domain/frontmatter.d.ts +18 -3
- package/cli/dist/domain/frontmatter.js +38 -12
- package/cli/dist/domain/issue-order.d.ts +55 -0
- package/cli/dist/domain/issue-order.js +65 -0
- package/cli/dist/domain/issue-readout.d.ts +36 -4
- package/cli/dist/domain/pull-request.d.ts +71 -4
- package/cli/dist/domain/pull-request.js +59 -10
- package/cli/dist/domain/readiness.d.ts +44 -0
- package/cli/dist/domain/readiness.js +153 -5
- package/cli/dist/domain/reference-parser.d.ts +3 -1
- package/cli/dist/domain/reference-parser.js +6 -2
- package/cli/dist/domain/release.d.ts +7 -3
- package/cli/dist/domain/release.js +5 -12
- package/cli/dist/domain/repository-policy.d.ts +9 -3
- package/cli/dist/domain/repository-policy.js +8 -7
- package/cli/dist/domain/repository-resolver.js +4 -1
- package/cli/dist/domain/restack.d.ts +62 -0
- package/cli/dist/domain/restack.js +53 -0
- package/cli/dist/domain/security-alerts.js +1 -1
- package/cli/dist/domain/state.d.ts +69 -0
- package/cli/dist/domain/state.js +67 -1
- package/cli/dist/domain/work-start.d.ts +30 -0
- package/cli/dist/domain/work-start.js +42 -0
- package/cli/dist/infra/authored-notes.d.ts +1 -1
- package/cli/dist/infra/authored-notes.js +10 -4
- package/cli/dist/infra/config-store.d.ts +4 -0
- package/cli/dist/infra/config-store.js +13 -0
- package/cli/dist/infra/git.d.ts +76 -0
- package/cli/dist/infra/git.js +123 -1
- package/cli/dist/infra/github/client.d.ts +5 -0
- package/cli/dist/infra/github/client.js +10 -7
- package/cli/dist/infra/github/errors.d.ts +18 -0
- package/cli/dist/infra/github/errors.js +22 -0
- package/cli/dist/infra/github/issues.d.ts +39 -3
- package/cli/dist/infra/github/issues.js +178 -23
- package/cli/dist/infra/github/projects.d.ts +35 -0
- package/cli/dist/infra/github/projects.js +89 -8
- package/cli/dist/infra/github/pulls.d.ts +105 -2
- package/cli/dist/infra/github/pulls.js +172 -5
- package/cli/dist/infra/github/queries.d.ts +15 -4
- package/cli/dist/infra/github/queries.js +203 -40
- package/cli/dist/infra/github/readout.d.ts +5 -1
- package/cli/dist/infra/github/readout.js +11 -33
- package/cli/dist/infra/github/repos.d.ts +18 -0
- package/cli/dist/infra/github/repos.js +31 -0
- package/cli/dist/infra/nx-scope.d.ts +1 -1
- package/cli/dist/infra/nx-scope.js +1 -1
- package/cli/dist/infra/state-store.d.ts +10 -1
- package/cli/dist/infra/state-store.js +14 -2
- package/cli/dist/infra/worktree-links.d.ts +3 -0
- package/cli/dist/infra/worktree-links.js +8 -1
- package/cli/dist/infra/worktree.d.ts +12 -1
- package/cli/dist/infra/worktree.js +40 -23
- package/cli/dist/mcp/result.d.ts +82 -7
- package/cli/dist/mcp/result.js +139 -19
- package/cli/dist/mcp/server.d.ts +2 -2
- package/cli/dist/mcp/server.js +57 -10
- package/cli/templates/comment/plan.md +14 -0
- package/cli/templates/comment/review-findings.md +3 -2
- package/cli/templates/issue/bug.md +13 -4
- package/cli/templates/issue/task-implement.md +13 -6
- package/cli/templates/issue/task.md +13 -4
- package/cli/templates/workflow/pecot-board-sync.yml +84 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/cli/dist/commands/dependabot.d.ts +0 -3
- package/cli/dist/commands/issue-project.d.ts +0 -3
- package/cli/dist/commands/issue-project.js +0 -176
- package/cli/dist/commands/issue-quick.d.ts +0 -3
- package/cli/dist/commands/issue-quick.js +0 -126
- package/cli/dist/commands/issue-read.d.ts +0 -3
- package/cli/dist/commands/issue-read.js +0 -80
- package/cli/dist/commands/project-info.d.ts +0 -48
- package/cli/dist/commands/project-info.js +0 -181
- package/cli/dist/commands/repository.d.ts +0 -5
- package/cli/dist/commands/repository.js +0 -265
- package/cli/dist/commands/security.d.ts +0 -3
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// owner が user か organization かは分からないので、user のクエリを先に試し、失敗したら organization を試す。
|
|
3
3
|
import { isJsonObject, jsonField } from '../../domain/json.js';
|
|
4
4
|
import { JSON_NULL } from '../../domain/json-null.js';
|
|
5
|
-
import { GitHubAPIError, GitHubNotFoundError } from './errors.js';
|
|
5
|
+
import { asNotFoundError, GitHubAPIError, GitHubNotFoundError, isSchemaError } from './errors.js';
|
|
6
6
|
import { asArray, asObject, isTruthy, requireString, truthyNodes } from './payload.js';
|
|
7
|
-
import { MUTATION_ADD_TO_PROJECT, MUTATION_CREATE_PROJECT, MUTATION_CREATE_PROJECT_FIELD, MUTATION_DELETE_PROJECT_ITEM, MUTATION_LINK_PROJECT_REPOSITORY, MUTATION_UPDATE_PROJECT_FIELD, MUTATION_UPDATE_PROJECT_ITEM_FIELD, QUERY_GET_ISSUE_PROJECT_ITEMS, QUERY_GET_LINKED_REPOSITORIES_ORG, QUERY_GET_LINKED_REPOSITORIES_USER, QUERY_GET_ORG_NODE_ID, QUERY_GET_PROJECT_FIELDS_ORG, QUERY_GET_PROJECT_FIELDS_USER, QUERY_GET_PROJECT_ID_ORG, QUERY_GET_PROJECT_ID_USER, QUERY_GET_USER_NODE_ID, QUERY_LIST_PROJECT_ITEMS, QUERY_LIST_PROJECTS_ORG, QUERY_LIST_PROJECTS_USER, } from './queries.js';
|
|
7
|
+
import { MUTATION_ADD_TO_PROJECT, MUTATION_CREATE_PROJECT, MUTATION_CREATE_PROJECT_FIELD, MUTATION_DELETE_PROJECT_ITEM, MUTATION_UNARCHIVE_PROJECT_ITEM, MUTATION_LINK_PROJECT_REPOSITORY, MUTATION_UPDATE_PROJECT_FIELD, MUTATION_UPDATE_PROJECT_ITEM_FIELD, QUERY_GET_ISSUE_BOARD_ITEM, QUERY_GET_ISSUE_PROJECT_ITEMS, QUERY_GET_LINKED_REPOSITORIES_ORG, QUERY_GET_LINKED_REPOSITORIES_USER, QUERY_GET_ORG_NODE_ID, QUERY_GET_PROJECT_FIELDS_ORG, QUERY_GET_PROJECT_FIELDS_USER, QUERY_GET_PROJECT_ID_ORG, QUERY_GET_PROJECT_ID_USER, QUERY_GET_USER_NODE_ID, QUERY_LIST_PROJECT_ITEMS, QUERY_LIST_PROJECT_ITEMS_LEGACY, QUERY_LIST_PROJECTS_ORG, QUERY_LIST_PROJECTS_USER, } from './queries.js';
|
|
8
8
|
import { ReposApi } from './repos.js';
|
|
9
|
+
// 着手の判定に足したフィールドの名前が出るスキーマの失敗(`Field 'x' doesn't exist` と `Cannot query field "x"`)
|
|
10
|
+
const READINESS_FIELD_ERROR = /(?:Field '|field ")(?:issueType|subIssues|parent|blockedBy)['"]/u;
|
|
9
11
|
const MAX_ARCHIVED_CONSECUTIVE = 50;
|
|
10
12
|
const DEFAULT_PROJECT_LIMIT = 20;
|
|
11
13
|
function lowerText(value) {
|
|
@@ -45,15 +47,52 @@ export class ProjectsApi extends ReposApi {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
50
|
+
Issue を読むクエリ。無い Issue・リポジトリの NOT_FOUND を GitHubNotFoundError にする
|
|
51
|
+
*/
|
|
52
|
+
async queryIssue(query, variables) {
|
|
53
|
+
try {
|
|
54
|
+
return await this.executeGraphql(query, variables);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw asNotFoundError(error);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
queryIssue の、部分エラーを許す版
|
|
62
|
+
*/
|
|
63
|
+
async queryIssueTolerating(query, variables, isTolerated) {
|
|
64
|
+
try {
|
|
65
|
+
return await this.executeGraphqlTolerating(query, variables, isTolerated);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw asNotFoundError(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
48
72
|
プロジェクトボードのアイテムを取得する(ページネーション対応)
|
|
49
73
|
*/
|
|
50
74
|
async listProjectItems(projectId, options = {}) {
|
|
51
|
-
const { limit, excludeArchived = false, workflowFieldName = '' } = options;
|
|
75
|
+
const { limit, excludeArchived = false, workflowFieldName = '', onLegacy } = options;
|
|
76
|
+
let query = QUERY_LIST_PROJECT_ITEMS;
|
|
52
77
|
let allItems = [];
|
|
53
78
|
let cursor = JSON_NULL;
|
|
54
79
|
let archivedConsecutive = 0;
|
|
55
80
|
for (;;) {
|
|
56
|
-
|
|
81
|
+
let result;
|
|
82
|
+
try {
|
|
83
|
+
result = await this.executeGraphql(query, { projectId, cursor });
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
// 古い GHES は blockedBy などを知らない。足す前のクエリで先頭から読み直す
|
|
87
|
+
if (query === QUERY_LIST_PROJECT_ITEMS_LEGACY || !isSchemaError(error) || !READINESS_FIELD_ERROR.test(error.message))
|
|
88
|
+
throw error;
|
|
89
|
+
query = QUERY_LIST_PROJECT_ITEMS_LEGACY;
|
|
90
|
+
allItems = [];
|
|
91
|
+
cursor = JSON_NULL;
|
|
92
|
+
archivedConsecutive = 0;
|
|
93
|
+
onLegacy?.();
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
57
96
|
const node = jsonField(result, 'node');
|
|
58
97
|
if (!isTruthy(node))
|
|
59
98
|
break;
|
|
@@ -111,6 +150,14 @@ export class ProjectsApi extends ReposApi {
|
|
|
111
150
|
return requireString(jsonField(item, 'id'), 'projectV2Item.id');
|
|
112
151
|
}
|
|
113
152
|
/**
|
|
153
|
+
アーカイブ済みのアイテムをボードに戻す
|
|
154
|
+
*/
|
|
155
|
+
async unarchiveProjectItem(projectId, itemId) {
|
|
156
|
+
const result = await this.executeGraphql(MUTATION_UNARCHIVE_PROJECT_ITEM, { projectId, itemId });
|
|
157
|
+
if (!isTruthy(jsonField(jsonField(result, 'unarchiveProjectV2Item'), 'item')))
|
|
158
|
+
throw new GitHubAPIError('failed to unarchive the project item');
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
114
161
|
プロジェクトボードからアイテムを削除し、削除したアイテムの ID を返す
|
|
115
162
|
*/
|
|
116
163
|
async deleteProjectItem(projectId, itemId) {
|
|
@@ -171,7 +218,14 @@ export class ProjectsApi extends ReposApi {
|
|
|
171
218
|
Issue から直接引くので、全アイテムの走査は要らない。Issue やリポジトリが無い、またはプロジェクトに無ければ undefined
|
|
172
219
|
*/
|
|
173
220
|
async getItemIdByIssue(projectId, owner, repository, issueNumber) {
|
|
174
|
-
const
|
|
221
|
+
const item = await this.getIssueProjectItem(projectId, owner, repository, issueNumber);
|
|
222
|
+
return item?.id;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
getItemIdByIssue と同じ引き方で、アイテムの ID とアーカイブ済みかを取る
|
|
226
|
+
*/
|
|
227
|
+
async getIssueProjectItem(projectId, owner, repository, issueNumber) {
|
|
228
|
+
const result = await this.queryIssue(QUERY_GET_ISSUE_PROJECT_ITEMS, { owner, repo: repository, number: issueNumber });
|
|
175
229
|
const repositoryNode = jsonField(result, 'repository');
|
|
176
230
|
if (!isTruthy(repositoryNode))
|
|
177
231
|
return undefined;
|
|
@@ -180,16 +234,43 @@ export class ProjectsApi extends ReposApi {
|
|
|
180
234
|
return undefined;
|
|
181
235
|
const projectItems = truthyNodes(jsonField(issue, 'projectItems'));
|
|
182
236
|
for (const item of projectItems) {
|
|
183
|
-
if (jsonField(jsonField(item, 'project'), 'id')
|
|
184
|
-
|
|
237
|
+
if (jsonField(jsonField(item, 'project'), 'id') !== projectId)
|
|
238
|
+
continue;
|
|
239
|
+
return { id: requireString(jsonField(item, 'id'), 'projectItems.nodes.id'), isArchived: jsonField(item, 'isArchived') === true };
|
|
185
240
|
}
|
|
186
241
|
return undefined;
|
|
187
242
|
}
|
|
188
243
|
/**
|
|
244
|
+
Issue 1 件の、指定のプロジェクトの項目を、readBoard の一覧の項目と同じ形で返す(札は含めない)。
|
|
245
|
+
workflow は進行の列の値で、空なら null。Issue やリポジトリが無い、またはプロジェクトに無ければ undefined
|
|
246
|
+
*/
|
|
247
|
+
async getIssueBoardItem(projectId, owner, repository, issueNumber, workflowFieldName) {
|
|
248
|
+
const result = await this.executeGraphql(QUERY_GET_ISSUE_BOARD_ITEM, { owner, repo: repository, number: issueNumber, workflowFieldName });
|
|
249
|
+
const issue = jsonField(jsonField(result, 'repository'), 'issue');
|
|
250
|
+
if (!isTruthy(issue))
|
|
251
|
+
return undefined;
|
|
252
|
+
const item = truthyNodes(jsonField(issue, 'projectItems')).find(node => jsonField(jsonField(node, 'project'), 'id') === projectId);
|
|
253
|
+
if (item === undefined)
|
|
254
|
+
return undefined;
|
|
255
|
+
const workflow = jsonField(jsonField(item, 'workflow'), 'name');
|
|
256
|
+
const owning = jsonField(issue, 'repository');
|
|
257
|
+
return {
|
|
258
|
+
id: requireString(jsonField(item, 'id'), 'projectItems.nodes.id'),
|
|
259
|
+
workflow: typeof workflow === 'string' ? workflow : JSON_NULL,
|
|
260
|
+
title: jsonField(issue, 'title') ?? '',
|
|
261
|
+
content: {
|
|
262
|
+
number: jsonField(issue, 'number') ?? JSON_NULL,
|
|
263
|
+
state: jsonField(issue, 'state') ?? JSON_NULL,
|
|
264
|
+
url: jsonField(issue, 'url') ?? JSON_NULL,
|
|
265
|
+
repository: `${requireString(jsonField(jsonField(owning, 'owner'), 'login'), 'issue.repository.owner.login')}/${requireString(jsonField(owning, 'name'), 'issue.repository.name')}`,
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
189
270
|
プロジェクトアイテムで値が入っている単一選択フィールドの ID を取る。アイテムが見つからなければ空
|
|
190
271
|
*/
|
|
191
272
|
async getItemSetFieldIds(projectId, owner, repository, issueNumber, itemId) {
|
|
192
|
-
const result = await this.
|
|
273
|
+
const result = await this.queryIssue(QUERY_GET_ISSUE_PROJECT_ITEMS, { owner, repo: repository, number: issueNumber });
|
|
193
274
|
const issue = jsonField(jsonField(result, 'repository'), 'issue');
|
|
194
275
|
const fieldIds = new Set();
|
|
195
276
|
const items = truthyNodes(jsonField(issue, 'projectItems'));
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { JsonObject } from '../../domain/json.js';
|
|
2
2
|
import type { PullRequestsByHeadReadout } from '../../domain/issue-readout.js';
|
|
3
3
|
import { IssuesApi } from './issues.js';
|
|
4
|
+
/**
|
|
5
|
+
base のブランチ名で引いた、同じリポの開いている PR
|
|
6
|
+
*/
|
|
7
|
+
export interface PullRequestsByBase {
|
|
8
|
+
readonly pullRequests: readonly {
|
|
9
|
+
readonly number: number;
|
|
10
|
+
readonly headRefName: string;
|
|
11
|
+
}[];
|
|
12
|
+
/**
|
|
13
|
+
先頭の件数に収まらず、続きがあるか
|
|
14
|
+
*/
|
|
15
|
+
readonly hasNextPage: boolean;
|
|
16
|
+
}
|
|
4
17
|
export interface ClosingIssue {
|
|
5
18
|
readonly number: number;
|
|
6
19
|
readonly title: string;
|
|
@@ -44,6 +57,62 @@ export interface ReviewThread {
|
|
|
44
57
|
readonly line: number | null;
|
|
45
58
|
readonly comments: readonly ReviewThreadComment[];
|
|
46
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
GitHub のスタック。pullRequests は下の段からの PR 番号
|
|
62
|
+
*/
|
|
63
|
+
export interface PullRequestStack {
|
|
64
|
+
readonly number: number;
|
|
65
|
+
readonly pullRequests: readonly number[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
Stacks API が求める X-GitHub-Api-Version(https://docs.github.com/en/rest/pulls/stacks)
|
|
69
|
+
*/
|
|
70
|
+
export declare const STACKS_API_VERSION = "2026-03-10";
|
|
71
|
+
/**
|
|
72
|
+
pr merge が読む PR の状態
|
|
73
|
+
*/
|
|
74
|
+
export interface PullRequestForMerge {
|
|
75
|
+
readonly number: number;
|
|
76
|
+
readonly state: string;
|
|
77
|
+
readonly isDraft: boolean;
|
|
78
|
+
readonly baseRefName: string;
|
|
79
|
+
readonly headRefOid: string;
|
|
80
|
+
readonly isMergeQueueEnabled: boolean;
|
|
81
|
+
readonly isInMergeQueue: boolean;
|
|
82
|
+
}
|
|
83
|
+
declare const ASYNC_MERGE_STATUSES: readonly ['pending', 'merged', 'enqueued', 'failed'];
|
|
84
|
+
export type AsyncMergeStatus = typeof ASYNC_MERGE_STATUSES[number];
|
|
85
|
+
/**
|
|
86
|
+
非同期のマージの結果。uuid は pending のときだけ、message は details.message
|
|
87
|
+
*/
|
|
88
|
+
export interface AsyncMergeResult {
|
|
89
|
+
readonly status: AsyncMergeStatus;
|
|
90
|
+
readonly uuid?: string;
|
|
91
|
+
readonly message?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
非同期のマージの要求への応答。accepted は 200・202、rejected は 400、conflict は 409
|
|
95
|
+
*/
|
|
96
|
+
export type AsyncMergeRequestOutcome = {
|
|
97
|
+
readonly outcome: 'accepted';
|
|
98
|
+
readonly result: AsyncMergeResult;
|
|
99
|
+
} | {
|
|
100
|
+
readonly outcome: 'rejected';
|
|
101
|
+
readonly message: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly outcome: 'conflict';
|
|
104
|
+
readonly uuid?: string;
|
|
105
|
+
};
|
|
106
|
+
export interface AsyncMergeOptions {
|
|
107
|
+
/**
|
|
108
|
+
読んだ head の SHA。読んだ後に push された PR をマージしない
|
|
109
|
+
*/
|
|
110
|
+
readonly sha: string;
|
|
111
|
+
/**
|
|
112
|
+
base が merge queue を使うか。使うときはマージの方法の値を渡さない
|
|
113
|
+
*/
|
|
114
|
+
readonly mergeQueue: boolean;
|
|
115
|
+
}
|
|
47
116
|
export interface PullRequestWithReviews extends PullRequestBase {
|
|
48
117
|
readonly reviews: readonly PullRequestReview[];
|
|
49
118
|
readonly review_threads: readonly ReviewThread[];
|
|
@@ -56,6 +125,11 @@ export declare class PullsApi extends IssuesApi {
|
|
|
56
125
|
*/
|
|
57
126
|
listPullRequestsByHead(owner: string, repository: string, headReferenceName: string): Promise<PullRequestsByHeadReadout>;
|
|
58
127
|
/**
|
|
128
|
+
base のブランチ名で開いている PR を引き、同じリポの PR だけを返す(古い順に先頭 20 件)。
|
|
129
|
+
20 件に収まらないときは hasNextPage が真。リポが無ければ GitHubNotFoundError
|
|
130
|
+
*/
|
|
131
|
+
listPullRequestsByBase(owner: string, repository: string, baseReferenceName: string): Promise<PullRequestsByBase>;
|
|
132
|
+
/**
|
|
59
133
|
PR を作る
|
|
60
134
|
*/
|
|
61
135
|
createPullRequest(owner: string, repository: string, title: string, body: string, head: string, base: string, isDraft?: boolean): Promise<JsonObject>;
|
|
@@ -68,13 +142,42 @@ export declare class PullsApi extends IssuesApi {
|
|
|
68
142
|
*/
|
|
69
143
|
getPullRequestWithReviews(owner: string, repository: string, number: number): Promise<PullRequestWithReviews>;
|
|
70
144
|
/**
|
|
71
|
-
PR をマージする。mergeMethod は merge・squash・rebase。既定は squash
|
|
145
|
+
PR をマージする。mergeMethod は merge・squash・rebase。既定は squash。
|
|
146
|
+
sha を渡すと、head がその SHA でなければ GitHub が 409 で拒む
|
|
147
|
+
*/
|
|
148
|
+
mergePullRequest(owner: string, repository: string, number: number, mergeMethod?: string, sha?: string): Promise<JsonObject>;
|
|
149
|
+
/**
|
|
150
|
+
pr merge の判断に使う PR の状態を読む(GraphQL)。
|
|
151
|
+
merge queue の項目を持たない GHES は、項目なしのクエリで読み直し、どちらも false にする
|
|
152
|
+
*/
|
|
153
|
+
getPullRequestForMerge(owner: string, repository: string, number: number): Promise<PullRequestForMerge>;
|
|
154
|
+
/**
|
|
155
|
+
非同期のマージを頼む(https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request-asynchronously)。
|
|
156
|
+
403・422 などは handleHttpError の例外
|
|
157
|
+
*/
|
|
158
|
+
requestAsyncMerge(owner: string, repository: string, number: number, options: Readonly<AsyncMergeOptions>): Promise<AsyncMergeRequestOutcome>;
|
|
159
|
+
/**
|
|
160
|
+
非同期のマージの結果を読む。結果が消えていれば(24 時間で消える)undefined
|
|
161
|
+
*/
|
|
162
|
+
getAsyncMergeResult(owner: string, repository: string, number: number, uuid: string): Promise<AsyncMergeResult | undefined>;
|
|
163
|
+
/**
|
|
164
|
+
その PR が入っているスタックを読む。入っていなければ undefined。
|
|
165
|
+
スタックの機能が無いリポは GitHubNotFoundError
|
|
166
|
+
*/
|
|
167
|
+
getStackOfPullRequest(owner: string, repository: string, pullRequestNumber: number): Promise<PullRequestStack | undefined>;
|
|
168
|
+
/**
|
|
169
|
+
スタックを作る。pullRequestNumbers は下の段からの順
|
|
170
|
+
*/
|
|
171
|
+
createStack(owner: string, repository: string, pullRequestNumbers: readonly number[]): Promise<PullRequestStack>;
|
|
172
|
+
/**
|
|
173
|
+
既にあるスタックの一番上に PR を足す。pullRequestNumbers は下からの順
|
|
72
174
|
*/
|
|
73
|
-
|
|
175
|
+
addToStack(owner: string, repository: string, stackNumber: number, pullRequestNumbers: readonly number[]): Promise<PullRequestStack>;
|
|
74
176
|
/**
|
|
75
177
|
open の dependabot の PR を全件取る(GraphQL)。pullRequests に author の引数が無いので、全ページを辿ってから絞る。
|
|
76
178
|
GraphQL のノードをそのまま返す
|
|
77
179
|
*/
|
|
78
180
|
listOpenDependabotPullRequests(owner: string, repository: string): Promise<readonly JsonObject[]>;
|
|
79
181
|
}
|
|
182
|
+
export {};
|
|
80
183
|
//# sourceMappingURL=pulls.d.ts.map
|
|
@@ -4,12 +4,68 @@ import { isJsonObject, jsonField } from '../../domain/json.js';
|
|
|
4
4
|
import { JSON_NULL } from '../../domain/json-null.js';
|
|
5
5
|
import { extractReferencesIssueNumbers } from '../../domain/reference-parser.js';
|
|
6
6
|
import { isJsonArray } from '../../domain/python-format.js';
|
|
7
|
-
import { GitHubAPIError, GitHubNotFoundError } from './errors.js';
|
|
7
|
+
import { GitHubAPIError, GitHubNotFoundError, isSchemaError } from './errors.js';
|
|
8
8
|
import { IssuesApi } from './issues.js';
|
|
9
9
|
import { asObject, isTruthy, numberOrNull, requireNumber, requireString, requireValue, stringOrNull, throwMalformed, truthyNodes } from './payload.js';
|
|
10
|
-
import { QUERY_GET_PULL_REQUEST_SLIM, QUERY_GET_PULL_REQUEST_WITH_REVIEWS, QUERY_LIST_OPEN_PULL_REQUESTS, QUERY_LIST_PULL_REQUESTS_BY_HEAD } from './queries.js';
|
|
10
|
+
import { QUERY_GET_PULL_REQUEST_FOR_MERGE, QUERY_GET_PULL_REQUEST_FOR_MERGE_WITHOUT_QUEUE, QUERY_GET_PULL_REQUEST_SLIM, QUERY_GET_PULL_REQUEST_WITH_REVIEWS, QUERY_LIST_OPEN_PULL_REQUESTS, QUERY_LIST_PULL_REQUESTS_BY_BASE, QUERY_LIST_PULL_REQUESTS_BY_HEAD } from './queries.js';
|
|
11
11
|
import { readPullRequests } from './readout.js';
|
|
12
12
|
import { repositoryPath } from './rest-path.js';
|
|
13
|
+
/**
|
|
14
|
+
Stacks API が求める X-GitHub-Api-Version(https://docs.github.com/en/rest/pulls/stacks)
|
|
15
|
+
*/
|
|
16
|
+
export const STACKS_API_VERSION = '2026-03-10';
|
|
17
|
+
const MERGE_QUEUE_FIELD_ERROR = /(?:Field '|field ")(?:isMergeQueueEnabled|isInMergeQueue)['"]/u;
|
|
18
|
+
// eslint-disable-next-line no-restricted-syntax -- 配列から型を作るための as const
|
|
19
|
+
const ASYNC_MERGE_STATUSES = ['pending', 'merged', 'enqueued', 'failed'];
|
|
20
|
+
function requiresBoolean(value, path) {
|
|
21
|
+
return typeof value === 'boolean' ? value : throwMalformed(path);
|
|
22
|
+
}
|
|
23
|
+
function isAsyncMergeStatus(value) {
|
|
24
|
+
return ASYNC_MERGE_STATUSES.some(status => status === value);
|
|
25
|
+
}
|
|
26
|
+
function readAsyncMergeResult(value) {
|
|
27
|
+
const status = jsonField(value, 'status');
|
|
28
|
+
if (!isAsyncMergeStatus(status))
|
|
29
|
+
throwMalformed(`mergeAsync.status (${typeof status === 'string' ? status : JSON.stringify(status)})`);
|
|
30
|
+
const details = jsonField(value, 'details');
|
|
31
|
+
const uuid = jsonField(details, 'uuid');
|
|
32
|
+
const message = jsonField(details, 'message');
|
|
33
|
+
if (status === 'pending' && typeof uuid !== 'string')
|
|
34
|
+
throwMalformed('mergeAsync.details.uuid');
|
|
35
|
+
return {
|
|
36
|
+
status,
|
|
37
|
+
...status === 'pending' && typeof uuid === 'string' && { uuid },
|
|
38
|
+
...typeof message === 'string' && { message },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// 文書は 400・409 の本文の形を示していないので、JSON でなくても止めない
|
|
42
|
+
function bodyOrUndefined(response) {
|
|
43
|
+
try {
|
|
44
|
+
return response.json();
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function readStack(value) {
|
|
51
|
+
if (!isJsonObject(value))
|
|
52
|
+
throwMalformed('stack');
|
|
53
|
+
const pullRequests = jsonField(value, 'pull_requests');
|
|
54
|
+
if (!isJsonArray(pullRequests))
|
|
55
|
+
throwMalformed('stack.pull_requests');
|
|
56
|
+
return {
|
|
57
|
+
number: requireNumber(jsonField(value, 'number'), 'stack.number'),
|
|
58
|
+
pullRequests: pullRequests.map(pullRequest => requireNumber(jsonField(pullRequest, 'number'), 'stack.pull_requests.number')),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// 番号の型を問わずに、その PR を含むか。数でない番号でも含めば、readStack が形の誤りとして止める
|
|
62
|
+
function hasPullRequestNumber(stack, pullRequestNumber) {
|
|
63
|
+
const pullRequests = jsonField(stack, 'pull_requests');
|
|
64
|
+
return isJsonArray(pullRequests) && pullRequests.some((pullRequest) => {
|
|
65
|
+
const number = jsonField(pullRequest, 'number');
|
|
66
|
+
return number === pullRequestNumber || number === String(pullRequestNumber);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
13
69
|
// author がある場合だけ login を読む。author が無い(削除されたユーザーなど)、または login が空なら null
|
|
14
70
|
function loginOrNull(author) {
|
|
15
71
|
const login = jsonField(author, 'login');
|
|
@@ -77,6 +133,23 @@ export class PullsApi extends IssuesApi {
|
|
|
77
133
|
};
|
|
78
134
|
}
|
|
79
135
|
/**
|
|
136
|
+
base のブランチ名で開いている PR を引き、同じリポの PR だけを返す(古い順に先頭 20 件)。
|
|
137
|
+
20 件に収まらないときは hasNextPage が真。リポが無ければ GitHubNotFoundError
|
|
138
|
+
*/
|
|
139
|
+
async listPullRequestsByBase(owner, repository, baseReferenceName) {
|
|
140
|
+
const result = await this.executeGraphql(QUERY_LIST_PULL_REQUESTS_BY_BASE, { owner, repo: repository, baseRefName: baseReferenceName });
|
|
141
|
+
const repositoryNode = jsonField(result, 'repository');
|
|
142
|
+
if (!isTruthy(repositoryNode))
|
|
143
|
+
throw new GitHubNotFoundError(`repository not found: ${owner}/${repository}`);
|
|
144
|
+
const connection = jsonField(repositoryNode, 'pullRequests');
|
|
145
|
+
return {
|
|
146
|
+
pullRequests: readPullRequests(truthyNodes(connection))
|
|
147
|
+
.filter(pullRequest => !pullRequest.isCrossRepository)
|
|
148
|
+
.map(pullRequest => ({ number: pullRequest.number, headRefName: pullRequest.headRefName })),
|
|
149
|
+
hasNextPage: jsonField(jsonField(connection, 'pageInfo'), 'hasNextPage') === true,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
80
153
|
PR を作る
|
|
81
154
|
*/
|
|
82
155
|
async createPullRequest(owner, repository, title, body, head, base, isDraft = false) {
|
|
@@ -123,12 +196,106 @@ export class PullsApi extends IssuesApi {
|
|
|
123
196
|
};
|
|
124
197
|
}
|
|
125
198
|
/**
|
|
126
|
-
PR をマージする。mergeMethod は merge・squash・rebase。既定は squash
|
|
199
|
+
PR をマージする。mergeMethod は merge・squash・rebase。既定は squash。
|
|
200
|
+
sha を渡すと、head がその SHA でなければ GitHub が 409 で拒む
|
|
127
201
|
*/
|
|
128
|
-
async mergePullRequest(owner, repository, number, mergeMethod = 'squash') {
|
|
202
|
+
async mergePullRequest(owner, repository, number, mergeMethod = 'squash', sha) {
|
|
129
203
|
return this.restObject('PUT', `${repositoryPath(owner, repository)}/pulls/${String(number)}/merge`, {
|
|
130
|
-
json: { merge_method: mergeMethod },
|
|
204
|
+
json: sha === undefined ? { merge_method: mergeMethod } : { merge_method: mergeMethod, sha },
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
pr merge の判断に使う PR の状態を読む(GraphQL)。
|
|
209
|
+
merge queue の項目を持たない GHES は、項目なしのクエリで読み直し、どちらも false にする
|
|
210
|
+
*/
|
|
211
|
+
async getPullRequestForMerge(owner, repository, number) {
|
|
212
|
+
let pullRequest;
|
|
213
|
+
let hasQueueFields = true;
|
|
214
|
+
try {
|
|
215
|
+
pullRequest = await this.fetchPullRequest(QUERY_GET_PULL_REQUEST_FOR_MERGE, owner, repository, number);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
if (!isSchemaError(error) || !MERGE_QUEUE_FIELD_ERROR.test(error.message))
|
|
219
|
+
throw error;
|
|
220
|
+
pullRequest = await this.fetchPullRequest(QUERY_GET_PULL_REQUEST_FOR_MERGE_WITHOUT_QUEUE, owner, repository, number);
|
|
221
|
+
hasQueueFields = false;
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
number: requireNumber(jsonField(pullRequest, 'number'), 'pullRequest.number'),
|
|
225
|
+
state: requireString(jsonField(pullRequest, 'state'), 'pullRequest.state'),
|
|
226
|
+
isDraft: requiresBoolean(jsonField(pullRequest, 'isDraft'), 'pullRequest.isDraft'),
|
|
227
|
+
baseRefName: requireString(jsonField(pullRequest, 'baseRefName'), 'pullRequest.baseRefName'),
|
|
228
|
+
headRefOid: requireString(jsonField(pullRequest, 'headRefOid'), 'pullRequest.headRefOid'),
|
|
229
|
+
isMergeQueueEnabled: hasQueueFields && requiresBoolean(jsonField(pullRequest, 'isMergeQueueEnabled'), 'pullRequest.isMergeQueueEnabled'),
|
|
230
|
+
isInMergeQueue: hasQueueFields && requiresBoolean(jsonField(pullRequest, 'isInMergeQueue'), 'pullRequest.isInMergeQueue'),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
非同期のマージを頼む(https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request-asynchronously)。
|
|
235
|
+
403・422 などは handleHttpError の例外
|
|
236
|
+
*/
|
|
237
|
+
async requestAsyncMerge(owner, repository, number, options) {
|
|
238
|
+
const response = await this.restRequest('PUT', `${repositoryPath(owner, repository)}/pulls/${String(number)}/merge-async`, {
|
|
239
|
+
json: options.mergeQueue ? { sha: options.sha } : { sha: options.sha, merge_method: 'squash' },
|
|
240
|
+
apiVersion: STACKS_API_VERSION,
|
|
131
241
|
});
|
|
242
|
+
if (response.statusCode === 400) {
|
|
243
|
+
const message = jsonField(bodyOrUndefined(response), 'message');
|
|
244
|
+
return { outcome: 'rejected', message: typeof message === 'string' ? message : response.text };
|
|
245
|
+
}
|
|
246
|
+
if (response.statusCode === 409) {
|
|
247
|
+
const uuid = jsonField(jsonField(bodyOrUndefined(response), 'details'), 'uuid');
|
|
248
|
+
return typeof uuid === 'string' ? { outcome: 'conflict', uuid } : { outcome: 'conflict' };
|
|
249
|
+
}
|
|
250
|
+
if (!response.isSuccess)
|
|
251
|
+
this.handleHttpError(response);
|
|
252
|
+
return { outcome: 'accepted', result: readAsyncMergeResult(response.json()) };
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
非同期のマージの結果を読む。結果が消えていれば(24 時間で消える)undefined
|
|
256
|
+
*/
|
|
257
|
+
async getAsyncMergeResult(owner, repository, number, uuid) {
|
|
258
|
+
const response = await this.restRequest('GET', `${repositoryPath(owner, repository)}/pulls/${String(number)}/merge-async/${encodeURIComponent(uuid)}`, {
|
|
259
|
+
apiVersion: STACKS_API_VERSION,
|
|
260
|
+
});
|
|
261
|
+
if (response.statusCode === 404)
|
|
262
|
+
return undefined;
|
|
263
|
+
if (!response.isSuccess)
|
|
264
|
+
this.handleHttpError(response);
|
|
265
|
+
return readAsyncMergeResult(response.json());
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
その PR が入っているスタックを読む。入っていなければ undefined。
|
|
269
|
+
スタックの機能が無いリポは GitHubNotFoundError
|
|
270
|
+
*/
|
|
271
|
+
async getStackOfPullRequest(owner, repository, pullRequestNumber) {
|
|
272
|
+
const stacks = await this.restJson('GET', `${repositoryPath(owner, repository)}/stacks`, {
|
|
273
|
+
params: { pull_request: pullRequestNumber },
|
|
274
|
+
apiVersion: STACKS_API_VERSION,
|
|
275
|
+
});
|
|
276
|
+
if (!isJsonArray(stacks))
|
|
277
|
+
throwMalformed('stacks');
|
|
278
|
+
// 関係の無いスタックの形の誤りで登録を止めないよう、探している PR を含むものだけ厳しく読む
|
|
279
|
+
const found = stacks.find(stack => hasPullRequestNumber(stack, pullRequestNumber));
|
|
280
|
+
return found === undefined ? undefined : readStack(found);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
スタックを作る。pullRequestNumbers は下の段からの順
|
|
284
|
+
*/
|
|
285
|
+
async createStack(owner, repository, pullRequestNumbers) {
|
|
286
|
+
return readStack(await this.restJson('POST', `${repositoryPath(owner, repository)}/stacks`, {
|
|
287
|
+
json: { pull_requests: [...pullRequestNumbers] },
|
|
288
|
+
apiVersion: STACKS_API_VERSION,
|
|
289
|
+
}));
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
既にあるスタックの一番上に PR を足す。pullRequestNumbers は下からの順
|
|
293
|
+
*/
|
|
294
|
+
async addToStack(owner, repository, stackNumber, pullRequestNumbers) {
|
|
295
|
+
return readStack(await this.restJson('POST', `${repositoryPath(owner, repository)}/stacks/${String(stackNumber)}/add`, {
|
|
296
|
+
json: { pull_requests: [...pullRequestNumbers] },
|
|
297
|
+
apiVersion: STACKS_API_VERSION,
|
|
298
|
+
}));
|
|
132
299
|
}
|
|
133
300
|
/**
|
|
134
301
|
open の dependabot の PR を全件取る(GraphQL)。pullRequests に author の引数が無いので、全ページを辿ってから絞る。
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare const QUERY_LIST_PROJECT_ITEMS
|
|
1
|
+
export declare const QUERY_LIST_PROJECT_ITEMS: string;
|
|
2
|
+
export declare const QUERY_LIST_PROJECT_ITEMS_LEGACY: string;
|
|
2
3
|
export declare const QUERY_LIST_PROJECT_ITEMS_FILTERED = "query ($projectId: ID!, $cursor: String, $filterQuery: String) {\n node(id: $projectId) {\n ... on ProjectV2 {\n items(first: 100, after: $cursor, query: $filterQuery) {\n nodes {\n id\n updatedAt\n fieldValues(first: 10) {\n nodes {\n ... on ProjectV2ItemFieldSingleSelectValue {\n field {\n ... on ProjectV2SingleSelectField {\n name\n }\n }\n name\n }\n }\n }\n content {\n ... on Issue {\n id\n number\n title\n state\n url\n labels(first: 10) {\n nodes {\n name\n }\n }\n repository {\n owner {\n login\n }\n name\n }\n }\n ... on PullRequest {\n id\n number\n title\n state\n url\n repository {\n owner {\n login\n }\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n}";
|
|
3
4
|
export declare const QUERY_GET_ISSUE_NODE_ID = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n id\n title\n }\n }\n}";
|
|
4
5
|
export declare const QUERY_GET_LINKED_REPOSITORIES_USER = "query ($owner: String!, $projectNumber: Int!) {\n user(login: $owner) {\n projectV2(number: $projectNumber) {\n repositories(first: 100) {\n nodes {\n owner {\n login\n }\n name\n }\n }\n }\n }\n}";
|
|
@@ -10,9 +11,10 @@ export declare const MUTATION_LINK_PROJECT_REPOSITORY = "mutation ($projectId: I
|
|
|
10
11
|
export declare const MUTATION_ADD_TO_PROJECT = "mutation ($projectId: ID!, $contentId: ID!) {\n addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) {\n item {\n id\n }\n }\n}";
|
|
11
12
|
export declare const MUTATION_UPDATE_PROJECT_ITEM_FIELD = "mutation ($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {\n updateProjectV2ItemFieldValue(\n input: {\n projectId: $projectId\n itemId: $itemId\n fieldId: $fieldId\n value: { singleSelectOptionId: $optionId }\n }\n ) {\n projectV2Item {\n id\n }\n }\n}";
|
|
12
13
|
export declare const MUTATION_DELETE_PROJECT_ITEM = "mutation ($projectId: ID!, $itemId: ID!) {\n deleteProjectV2Item(input: { projectId: $projectId, itemId: $itemId }) {\n deletedItemId\n }\n}";
|
|
14
|
+
export declare const MUTATION_UNARCHIVE_PROJECT_ITEM = "mutation ($projectId: ID!, $itemId: ID!) {\n unarchiveProjectV2Item(input: { projectId: $projectId, itemId: $itemId }) {\n item {\n id\n }\n }\n}";
|
|
13
15
|
export declare const MUTATION_ADD_SUB_ISSUE = "mutation ($parentId: ID!, $childId: ID!) {\n addSubIssue(input: { issueId: $parentId, subIssueId: $childId }) {\n issue {\n number\n }\n subIssue {\n number\n }\n }\n}";
|
|
14
16
|
export declare const MUTATION_CREATE_LINKED_BRANCH = "mutation CreateLinkedBranch($input: CreateLinkedBranchInput!) {\n createLinkedBranch(input: $input) {\n linkedBranch {\n ref {\n name\n prefix\n }\n }\n }\n}";
|
|
15
|
-
export declare const QUERY_GET_ISSUE_PROJECT_ITEMS = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n projectItems(first: 20) {\n nodes {\n id\n project {\n id\n }\n fieldValues(first: 20) {\n nodes {\n ... on ProjectV2ItemFieldSingleSelectValue {\n field {\n ... on ProjectV2SingleSelectField {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}";
|
|
17
|
+
export declare const QUERY_GET_ISSUE_PROJECT_ITEMS = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n projectItems(first: 20) {\n nodes {\n id\n isArchived\n project {\n id\n }\n fieldValues(first: 20) {\n nodes {\n ... on ProjectV2ItemFieldSingleSelectValue {\n field {\n ... on ProjectV2SingleSelectField {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}";
|
|
16
18
|
export declare const QUERY_LIST_PROJECTS_USER = "query ($owner: String!, $first: Int!) {\n user(login: $owner) {\n projectsV2(first: $first) {\n nodes {\n number\n title\n url\n id\n }\n }\n }\n}";
|
|
17
19
|
export declare const QUERY_LIST_PROJECTS_ORG = "query ($owner: String!, $first: Int!) {\n organization(login: $owner) {\n projectsV2(first: $first) {\n nodes {\n number\n title\n url\n id\n }\n }\n }\n}";
|
|
18
20
|
export declare const QUERY_GET_PROJECT_FIELDS_USER = "query ($owner: String!, $projectNumber: Int!) {\n user(login: $owner) {\n projectV2(number: $projectNumber) {\n id\n title\n url\n fields(first: 50) {\n nodes {\n ... on ProjectV2SingleSelectField {\n id\n databaseId\n name\n options {\n id\n name\n color\n description\n }\n }\n ... on ProjectV2Field {\n id\n name\n }\n }\n }\n views(first: 1) {\n nodes {\n number\n }\n }\n }\n }\n}";
|
|
@@ -24,13 +26,22 @@ export declare const QUERY_GET_ORG_NODE_ID = "query ($login: String!) {\n organ
|
|
|
24
26
|
export declare const MUTATION_CREATE_PROJECT = "mutation ($ownerId: ID!, $title: String!) {\n createProjectV2(input: { ownerId: $ownerId, title: $title }) {\n projectV2 {\n id\n number\n title\n url\n }\n }\n}";
|
|
25
27
|
export declare const QUERY_GET_ISSUE_KIND = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n number\n state\n issueType {\n name\n }\n subIssues(first: 1) {\n totalCount\n }\n }\n }\n}";
|
|
26
28
|
export declare const QUERY_GET_ISSUE_KIND_PHASE1 = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n number\n state\n subIssues(first: 1) {\n totalCount\n }\n }\n }\n}";
|
|
27
|
-
export declare const QUERY_GET_ISSUE_SLIM
|
|
29
|
+
export declare const QUERY_GET_ISSUE_SLIM: string;
|
|
30
|
+
export declare const QUERY_GET_ISSUE_SLIM_WITHOUT_BLOCKED_BY: string;
|
|
28
31
|
export declare const QUERY_GET_SUB_ISSUES_PAGE = "query ($owner: String!, $repo: String!, $number: Int!, $after: String!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n subIssues(first: 100, after: $after) {\n nodes {\n number\n state\n title\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n}";
|
|
29
32
|
export declare const QUERY_GET_PULL_REQUEST_SLIM = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n pullRequest(number: $number) {\n number\n state\n title\n body\n headRefName\n baseRefName\n isDraft\n mergeable\n comments {\n totalCount\n }\n closingIssuesReferences(first: 10) {\n nodes {\n number\n title\n }\n }\n reviews(first: 10) {\n nodes {\n state\n author {\n login\n }\n }\n }\n }\n }\n}";
|
|
33
|
+
export declare const QUERY_GET_PULL_REQUEST_FOR_MERGE = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n pullRequest(number: $number) {\n number\n state\n isDraft\n baseRefName\n headRefOid\n isMergeQueueEnabled\n isInMergeQueue\n }\n }\n}";
|
|
34
|
+
export declare const QUERY_GET_PULL_REQUEST_FOR_MERGE_WITHOUT_QUEUE = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n pullRequest(number: $number) {\n number\n state\n isDraft\n baseRefName\n headRefOid\n }\n }\n}";
|
|
30
35
|
export declare const QUERY_GET_PULL_REQUEST_WITH_REVIEWS = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n pullRequest(number: $number) {\n number\n state\n title\n body\n headRefName\n baseRefName\n isDraft\n mergeable\n comments {\n totalCount\n }\n closingIssuesReferences(first: 10) {\n nodes {\n number\n title\n }\n }\n reviews(first: 20) {\n nodes {\n state\n body\n author {\n login\n }\n submittedAt\n }\n }\n reviewThreads(first: 50) {\n nodes {\n isResolved\n path\n line\n comments(first: 10) {\n nodes {\n author {\n login\n }\n body\n createdAt\n }\n }\n }\n }\n }\n }\n}";
|
|
31
36
|
export declare const QUERY_LIST_OPEN_PULL_REQUESTS = "query ($owner: String!, $repo: String!, $after: String) {\n repository(owner: $owner, name: $repo) {\n pullRequests(\n first: 25\n states: OPEN\n after: $after\n orderBy: { field: CREATED_AT, direction: ASC }\n ) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n number\n title\n url\n createdAt\n author {\n __typename\n login\n }\n isInMergeQueue\n autoMergeRequest {\n enabledAt\n }\n mergeable\n baseRef {\n target {\n ... on Commit {\n committedDate\n }\n }\n }\n firstCommits: commits(first: 1) {\n nodes {\n commit {\n message\n signature {\n isValid\n }\n author {\n user {\n login\n }\n }\n }\n }\n }\n headCommits: commits(last: 1) {\n nodes {\n commit {\n statusCheckRollup {\n state\n }\n }\n }\n }\n lastForcePush: timelineItems(last: 1, itemTypes: [HEAD_REF_FORCE_PUSHED_EVENT]) {\n nodes {\n ... on HeadRefForcePushedEvent {\n createdAt\n }\n }\n }\n lastDequeue: timelineItems(last: 1, itemTypes: [REMOVED_FROM_MERGE_QUEUE_EVENT]) {\n nodes {\n ... on RemovedFromMergeQueueEvent {\n createdAt\n }\n }\n }\n }\n }\n }\n}";
|
|
37
|
+
export declare const QUERY_HAS_ADD_BLOCKED_BY_INPUT = "{\n __type(name: \"AddBlockedByInput\") {\n name\n }\n}";
|
|
32
38
|
export declare const MUTATION_ADD_BLOCKED_BY = "mutation ($issueId: ID!, $blockingIssueId: ID!) {\n addBlockedBy(input: { issueId: $issueId, blockingIssueId: $blockingIssueId }) {\n issue {\n number\n }\n blockingIssue {\n number\n }\n }\n}";
|
|
33
39
|
export declare const MUTATION_REMOVE_BLOCKED_BY = "mutation ($issueId: ID!, $blockingIssueId: ID!) {\n removeBlockedBy(input: { issueId: $issueId, blockingIssueId: $blockingIssueId }) {\n issue {\n number\n }\n blockingIssue {\n number\n }\n }\n}";
|
|
34
|
-
export declare const QUERY_GET_ISSUE_PREREQUISITES = "query ($owner: String!, $repo: String!, $number: Int!, $columnFieldName: String!, $labelFieldName: String!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n ...PrerequisiteIssueFields\n body\n blockedBy(first:
|
|
40
|
+
export declare const QUERY_GET_ISSUE_PREREQUISITES = "query ($owner: String!, $repo: String!, $number: Int!, $columnFieldName: String!, $labelFieldName: String!, $blockedByFirst: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n ...PrerequisiteIssueFields\n body\n parent {\n number\n repository {\n owner {\n login\n }\n name\n }\n }\n blockedBy(first: $blockedByFirst) {\n totalCount\n nodes {\n ...PrerequisiteIssueFields\n }\n }\n }\n }\n}\n\nfragment PrerequisiteIssueFields on Issue {\n id\n number\n state\n title\n repository {\n owner {\n login\n }\n name\n }\n issueType {\n name\n }\n subIssues(first: 1) {\n totalCount\n }\n projectItems(first: 20, includeArchived: false) {\n totalCount\n nodes {\n project {\n id\n }\n column: fieldValueByName(name: $columnFieldName) {\n ...SingleSelectValueFields\n }\n label: fieldValueByName(name: $labelFieldName) {\n ...SingleSelectValueFields\n }\n }\n }\n linkedBranches(first: 10) {\n totalCount\n nodes {\n ref {\n name\n associatedPullRequests(first: 10) {\n totalCount\n nodes {\n ...PullRequestFields\n }\n }\n }\n }\n }\n closedByPullRequestsReferences(first: 10, includeClosedPrs: true) {\n totalCount\n nodes {\n ...PullRequestFields\n }\n }\n}\n\nfragment SingleSelectValueFields on ProjectV2ItemFieldValue {\n ... on ProjectV2ItemFieldSingleSelectValue {\n name\n optionId\n field {\n ... on ProjectV2SingleSelectField {\n id\n }\n }\n }\n}\n\nfragment PullRequestFields on PullRequest {\n number\n state\n headRefName\n baseRefName\n isDraft\n isCrossRepository\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
35
41
|
export declare const QUERY_LIST_PULL_REQUESTS_BY_HEAD = "query ($owner: String!, $repo: String!, $headRefName: String!) {\n repository(owner: $owner, name: $repo) {\n pullRequests(\n headRefName: $headRefName\n states: [OPEN, CLOSED, MERGED]\n first: 20\n orderBy: { field: CREATED_AT, direction: DESC }\n ) {\n pageInfo {\n hasNextPage\n }\n nodes {\n ...PullRequestFields\n }\n }\n }\n}\n\nfragment PullRequestFields on PullRequest {\n number\n state\n headRefName\n baseRefName\n isDraft\n isCrossRepository\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
42
|
+
export declare const QUERY_LIST_PULL_REQUESTS_BY_BASE = "query ($owner: String!, $repo: String!, $baseRefName: String!) {\n repository(owner: $owner, name: $repo) {\n pullRequests(\n baseRefName: $baseRefName\n states: [OPEN]\n first: 20\n orderBy: { field: CREATED_AT, direction: ASC }\n ) {\n pageInfo {\n hasNextPage\n }\n nodes {\n ...PullRequestFields\n }\n }\n }\n}\n\nfragment PullRequestFields on PullRequest {\n number\n state\n headRefName\n baseRefName\n isDraft\n isCrossRepository\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
43
|
+
export declare const QUERY_GET_ISSUE_BLOCKED_BY_REFERENCES = "query ($owner: String!, $repo: String!, $number: Int!, $blockedByFirst: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n id\n body\n blockedBy(first: $blockedByFirst) {\n totalCount\n nodes {\n ...BlockedByReferenceFields\n }\n }\n }\n }\n}\n\nfragment BlockedByReferenceFields on Issue {\n id\n number\n state\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
44
|
+
export declare const QUERY_GET_BLOCKED_BY_OF_NODES = "query ($ids: [ID!]!, $blockedByFirst: Int!) {\n nodes(ids: $ids) {\n ... on Issue {\n id\n blockedBy(first: $blockedByFirst) {\n totalCount\n nodes {\n ...BlockedByReferenceFields\n }\n }\n }\n }\n}\n\nfragment BlockedByReferenceFields on Issue {\n id\n number\n state\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
45
|
+
export declare const QUERY_GET_ISSUE_BLOCKING_REFERENCES = "query ($owner: String!, $repo: String!, $number: Int!, $blockingFirst: Int!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n blocking(first: $blockingFirst) {\n totalCount\n nodes {\n ...BlockedByReferenceFields\n }\n }\n }\n }\n}\n\nfragment BlockedByReferenceFields on Issue {\n id\n number\n state\n repository {\n owner {\n login\n }\n name\n }\n}";
|
|
46
|
+
export declare const QUERY_GET_ISSUE_BOARD_ITEM = "query ($owner: String!, $repo: String!, $number: Int!, $workflowFieldName: String!) {\n repository(owner: $owner, name: $repo) {\n issue(number: $number) {\n number\n title\n state\n url\n repository {\n owner {\n login\n }\n name\n }\n projectItems(first: 20, includeArchived: false) {\n nodes {\n id\n project {\n id\n }\n workflow: fieldValueByName(name: $workflowFieldName) {\n ... on ProjectV2ItemFieldSingleSelectValue {\n name\n }\n }\n }\n }\n }\n }\n}";
|
|
36
47
|
//# sourceMappingURL=queries.d.ts.map
|