@pecot/workflow-mcp 0.0.0-stage → 5.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.
Files changed (244) hide show
  1. package/.claude-plugin/plugin.json +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +126 -2
  4. package/bin/pecot-workflow-mcp.mjs +10 -0
  5. package/cli/dist/cli.d.ts +26 -0
  6. package/cli/dist/cli.js +222 -0
  7. package/cli/dist/commands/cell-table.d.ts +3 -0
  8. package/cli/dist/commands/cell-table.js +495 -0
  9. package/cli/dist/commands/command-binding.d.ts +26 -0
  10. package/cli/dist/commands/command-binding.js +266 -0
  11. package/cli/dist/commands/command-definition.d.ts +136 -0
  12. package/cli/dist/commands/command-definition.js +101 -0
  13. package/cli/dist/commands/command-help.d.ts +8 -0
  14. package/cli/dist/commands/command-help.js +173 -0
  15. package/cli/dist/commands/command-stop.d.ts +19 -0
  16. package/cli/dist/commands/command-stop.js +30 -0
  17. package/cli/dist/commands/dependabot.d.ts +3 -0
  18. package/cli/dist/commands/dependabot.js +165 -0
  19. package/cli/dist/commands/directory-option.d.ts +7 -0
  20. package/cli/dist/commands/directory-option.js +48 -0
  21. package/cli/dist/commands/failure.d.ts +13 -0
  22. package/cli/dist/commands/failure.js +33 -0
  23. package/cli/dist/commands/fuzzy.d.ts +7 -0
  24. package/cli/dist/commands/fuzzy.js +79 -0
  25. package/cli/dist/commands/github-client.d.ts +12 -0
  26. package/cli/dist/commands/github-client.js +23 -0
  27. package/cli/dist/commands/global-options.d.ts +25 -0
  28. package/cli/dist/commands/global-options.js +83 -0
  29. package/cli/dist/commands/help-layout.d.ts +40 -0
  30. package/cli/dist/commands/help-layout.js +117 -0
  31. package/cli/dist/commands/help.d.ts +8 -0
  32. package/cli/dist/commands/help.js +55 -0
  33. package/cli/dist/commands/input-schema.d.ts +14 -0
  34. package/cli/dist/commands/input-schema.js +56 -0
  35. package/cli/dist/commands/issue-board.d.ts +38 -0
  36. package/cli/dist/commands/issue-board.js +62 -0
  37. package/cli/dist/commands/issue-comment.d.ts +3 -0
  38. package/cli/dist/commands/issue-comment.js +196 -0
  39. package/cli/dist/commands/issue-create.d.ts +3 -0
  40. package/cli/dist/commands/issue-create.js +329 -0
  41. package/cli/dist/commands/issue-project.d.ts +3 -0
  42. package/cli/dist/commands/issue-project.js +176 -0
  43. package/cli/dist/commands/issue-quick.d.ts +3 -0
  44. package/cli/dist/commands/issue-quick.js +126 -0
  45. package/cli/dist/commands/issue-read.d.ts +3 -0
  46. package/cli/dist/commands/issue-read.js +80 -0
  47. package/cli/dist/commands/issue-shared.d.ts +159 -0
  48. package/cli/dist/commands/issue-shared.js +419 -0
  49. package/cli/dist/commands/issue.d.ts +4 -0
  50. package/cli/dist/commands/issue.js +15 -0
  51. package/cli/dist/commands/names.d.ts +9 -0
  52. package/cli/dist/commands/names.js +16 -0
  53. package/cli/dist/commands/output.d.ts +78 -0
  54. package/cli/dist/commands/output.js +187 -0
  55. package/cli/dist/commands/pr.d.ts +3 -0
  56. package/cli/dist/commands/pr.js +933 -0
  57. package/cli/dist/commands/project-info.d.ts +48 -0
  58. package/cli/dist/commands/project-info.js +181 -0
  59. package/cli/dist/commands/project-sync.d.ts +91 -0
  60. package/cli/dist/commands/project-sync.js +273 -0
  61. package/cli/dist/commands/project.d.ts +5 -0
  62. package/cli/dist/commands/project.js +677 -0
  63. package/cli/dist/commands/registry.d.ts +6 -0
  64. package/cli/dist/commands/registry.js +27 -0
  65. package/cli/dist/commands/release.d.ts +10 -0
  66. package/cli/dist/commands/release.js +414 -0
  67. package/cli/dist/commands/repository-display.d.ts +3 -0
  68. package/cli/dist/commands/repository-display.js +7 -0
  69. package/cli/dist/commands/repository-match.d.ts +14 -0
  70. package/cli/dist/commands/repository-match.js +33 -0
  71. package/cli/dist/commands/repository.d.ts +5 -0
  72. package/cli/dist/commands/repository.js +265 -0
  73. package/cli/dist/commands/rich-panel.d.ts +22 -0
  74. package/cli/dist/commands/rich-panel.js +295 -0
  75. package/cli/dist/commands/security.d.ts +3 -0
  76. package/cli/dist/commands/security.js +164 -0
  77. package/cli/dist/commands/session.d.ts +3 -0
  78. package/cli/dist/commands/session.js +161 -0
  79. package/cli/dist/commands/tracker-sync.d.ts +58 -0
  80. package/cli/dist/commands/tracker-sync.js +53 -0
  81. package/cli/dist/commands/usage-error.d.ts +47 -0
  82. package/cli/dist/commands/usage-error.js +72 -0
  83. package/cli/dist/commands/value-types.d.ts +46 -0
  84. package/cli/dist/commands/value-types.js +94 -0
  85. package/cli/dist/commands/work-target.d.ts +13 -0
  86. package/cli/dist/commands/work-target.js +41 -0
  87. package/cli/dist/commands/worktree.d.ts +3 -0
  88. package/cli/dist/commands/worktree.js +335 -0
  89. package/cli/dist/domain/api-error-detail.d.ts +10 -0
  90. package/cli/dist/domain/api-error-detail.js +25 -0
  91. package/cli/dist/domain/branch-name.d.ts +5 -0
  92. package/cli/dist/domain/branch-name.js +10 -0
  93. package/cli/dist/domain/changelog.d.ts +43 -0
  94. package/cli/dist/domain/changelog.js +107 -0
  95. package/cli/dist/domain/config.d.ts +215 -0
  96. package/cli/dist/domain/config.js +300 -0
  97. package/cli/dist/domain/dependabot-pull-requests.d.ts +82 -0
  98. package/cli/dist/domain/dependabot-pull-requests.js +338 -0
  99. package/cli/dist/domain/dependabot-source.d.ts +51 -0
  100. package/cli/dist/domain/dependabot-source.js +4 -0
  101. package/cli/dist/domain/dependabot.d.ts +47 -0
  102. package/cli/dist/domain/dependabot.js +88 -0
  103. package/cli/dist/domain/errors.d.ts +19 -0
  104. package/cli/dist/domain/errors.js +31 -0
  105. package/cli/dist/domain/field-options.d.ts +31 -0
  106. package/cli/dist/domain/field-options.js +44 -0
  107. package/cli/dist/domain/format.d.ts +47 -0
  108. package/cli/dist/domain/format.js +168 -0
  109. package/cli/dist/domain/frontmatter.d.ts +122 -0
  110. package/cli/dist/domain/frontmatter.js +264 -0
  111. package/cli/dist/domain/git-runner.d.ts +10 -0
  112. package/cli/dist/domain/git-runner.js +4 -0
  113. package/cli/dist/domain/git-url.d.ts +17 -0
  114. package/cli/dist/domain/git-url.js +30 -0
  115. package/cli/dist/domain/issue-kind.d.ts +16 -0
  116. package/cli/dist/domain/issue-kind.js +16 -0
  117. package/cli/dist/domain/issue-readout.d.ts +107 -0
  118. package/cli/dist/domain/issue-readout.js +4 -0
  119. package/cli/dist/domain/json-null.d.ts +2 -0
  120. package/cli/dist/domain/json-null.js +5 -0
  121. package/cli/dist/domain/json.d.ts +21 -0
  122. package/cli/dist/domain/json.js +47 -0
  123. package/cli/dist/domain/prerequisites.d.ts +32 -0
  124. package/cli/dist/domain/prerequisites.js +192 -0
  125. package/cli/dist/domain/pull-request.d.ts +134 -0
  126. package/cli/dist/domain/pull-request.js +232 -0
  127. package/cli/dist/domain/python-format.d.ts +105 -0
  128. package/cli/dist/domain/python-format.js +304 -0
  129. package/cli/dist/domain/readiness.d.ts +172 -0
  130. package/cli/dist/domain/readiness.js +280 -0
  131. package/cli/dist/domain/reference-parser.d.ts +49 -0
  132. package/cli/dist/domain/reference-parser.js +119 -0
  133. package/cli/dist/domain/release.d.ts +49 -0
  134. package/cli/dist/domain/release.js +72 -0
  135. package/cli/dist/domain/repository-policy.d.ts +32 -0
  136. package/cli/dist/domain/repository-policy.js +65 -0
  137. package/cli/dist/domain/repository-resolver.d.ts +57 -0
  138. package/cli/dist/domain/repository-resolver.js +119 -0
  139. package/cli/dist/domain/sections.d.ts +69 -0
  140. package/cli/dist/domain/sections.js +514 -0
  141. package/cli/dist/domain/security-alerts-source.d.ts +29 -0
  142. package/cli/dist/domain/security-alerts-source.js +4 -0
  143. package/cli/dist/domain/security-alerts.d.ts +52 -0
  144. package/cli/dist/domain/security-alerts.js +107 -0
  145. package/cli/dist/domain/security-tracker.d.ts +115 -0
  146. package/cli/dist/domain/security-tracker.js +353 -0
  147. package/cli/dist/domain/state.d.ts +29 -0
  148. package/cli/dist/domain/state.js +56 -0
  149. package/cli/dist/domain/tracker-body.d.ts +70 -0
  150. package/cli/dist/domain/tracker-body.js +65 -0
  151. package/cli/dist/domain/yaml-document.d.ts +5 -0
  152. package/cli/dist/domain/yaml-document.js +206 -0
  153. package/cli/dist/infra/authored-notes.d.ts +37 -0
  154. package/cli/dist/infra/authored-notes.js +66 -0
  155. package/cli/dist/infra/changelog-file.d.ts +19 -0
  156. package/cli/dist/infra/changelog-file.js +43 -0
  157. package/cli/dist/infra/child-stdin.d.ts +4 -0
  158. package/cli/dist/infra/child-stdin.js +8 -0
  159. package/cli/dist/infra/config-store.d.ts +49 -0
  160. package/cli/dist/infra/config-store.js +121 -0
  161. package/cli/dist/infra/diagnostics.d.ts +9 -0
  162. package/cli/dist/infra/diagnostics.js +2 -0
  163. package/cli/dist/infra/file-kind.d.ts +9 -0
  164. package/cli/dist/infra/file-kind.js +26 -0
  165. package/cli/dist/infra/frontmatter-file.d.ts +14 -0
  166. package/cli/dist/infra/frontmatter-file.js +30 -0
  167. package/cli/dist/infra/git.d.ts +74 -0
  168. package/cli/dist/infra/git.js +133 -0
  169. package/cli/dist/infra/github/auth.d.ts +60 -0
  170. package/cli/dist/infra/github/auth.js +158 -0
  171. package/cli/dist/infra/github/client.d.ts +173 -0
  172. package/cli/dist/infra/github/client.js +576 -0
  173. package/cli/dist/infra/github/dependabot-source.d.ts +13 -0
  174. package/cli/dist/infra/github/dependabot-source.js +33 -0
  175. package/cli/dist/infra/github/errors.d.ts +47 -0
  176. package/cli/dist/infra/github/errors.js +42 -0
  177. package/cli/dist/infra/github/index.d.ts +13 -0
  178. package/cli/dist/infra/github/index.js +19 -0
  179. package/cli/dist/infra/github/issues.d.ts +129 -0
  180. package/cli/dist/infra/github/issues.js +273 -0
  181. package/cli/dist/infra/github/payload.d.ts +44 -0
  182. package/cli/dist/infra/github/payload.js +80 -0
  183. package/cli/dist/infra/github/projects.d.ts +108 -0
  184. package/cli/dist/infra/github/projects.js +303 -0
  185. package/cli/dist/infra/github/pulls.d.ts +80 -0
  186. package/cli/dist/infra/github/pulls.js +161 -0
  187. package/cli/dist/infra/github/queries.d.ts +36 -0
  188. package/cli/dist/infra/github/queries.js +883 -0
  189. package/cli/dist/infra/github/readout.d.ts +18 -0
  190. package/cli/dist/infra/github/readout.js +156 -0
  191. package/cli/dist/infra/github/repos.d.ts +68 -0
  192. package/cli/dist/infra/github/repos.js +137 -0
  193. package/cli/dist/infra/github/rest-path.d.ts +14 -0
  194. package/cli/dist/infra/github/rest-path.js +31 -0
  195. package/cli/dist/infra/github/security-alerts-source.d.ts +15 -0
  196. package/cli/dist/infra/github/security-alerts-source.js +73 -0
  197. package/cli/dist/infra/gitignore-spec.d.ts +36 -0
  198. package/cli/dist/infra/gitignore-spec.js +235 -0
  199. package/cli/dist/infra/nx-scope.d.ts +51 -0
  200. package/cli/dist/infra/nx-scope.js +182 -0
  201. package/cli/dist/infra/os-error.d.ts +24 -0
  202. package/cli/dist/infra/os-error.js +38 -0
  203. package/cli/dist/infra/paths.d.ts +88 -0
  204. package/cli/dist/infra/paths.js +234 -0
  205. package/cli/dist/infra/state-store.d.ts +45 -0
  206. package/cli/dist/infra/state-store.js +118 -0
  207. package/cli/dist/infra/template-store.d.ts +15 -0
  208. package/cli/dist/infra/template-store.js +34 -0
  209. package/cli/dist/infra/text-file.d.ts +12 -0
  210. package/cli/dist/infra/text-file.js +33 -0
  211. package/cli/dist/infra/worktree-copy.d.ts +24 -0
  212. package/cli/dist/infra/worktree-copy.js +95 -0
  213. package/cli/dist/infra/worktree-links.d.ts +139 -0
  214. package/cli/dist/infra/worktree-links.js +433 -0
  215. package/cli/dist/infra/worktree-setup.d.ts +21 -0
  216. package/cli/dist/infra/worktree-setup.js +41 -0
  217. package/cli/dist/infra/worktree.d.ts +174 -0
  218. package/cli/dist/infra/worktree.js +567 -0
  219. package/cli/dist/mcp/result.d.ts +33 -0
  220. package/cli/dist/mcp/result.js +52 -0
  221. package/cli/dist/mcp/serve.d.ts +51 -0
  222. package/cli/dist/mcp/serve.js +183 -0
  223. package/cli/dist/mcp/server.d.ts +21 -0
  224. package/cli/dist/mcp/server.js +128 -0
  225. package/cli/dist/mcp/session-directory.d.ts +26 -0
  226. package/cli/dist/mcp/session-directory.js +84 -0
  227. package/cli/dist/package.json +1 -0
  228. package/cli/dist/version.d.ts +17 -0
  229. package/cli/dist/version.js +42 -0
  230. package/cli/templates/comment/merge-diff.md +34 -0
  231. package/cli/templates/comment/plan.md +181 -0
  232. package/cli/templates/comment/precede-notify.md +33 -0
  233. package/cli/templates/comment/review-findings.md +42 -0
  234. package/cli/templates/comment/review-resolution.md +48 -0
  235. package/cli/templates/issue/bug.md +63 -0
  236. package/cli/templates/issue/epic.md +54 -0
  237. package/cli/templates/issue/task-implement.md +67 -0
  238. package/cli/templates/issue/task.md +48 -0
  239. package/cli/templates/issue/tracker.md +48 -0
  240. package/cli/templates/pr/create.md +123 -0
  241. package/cli/templates/pr/release.md +56 -0
  242. package/hooks/lib/core/pecot-gitignore-ensure.sh +48 -0
  243. package/npm-shrinkwrap.json +83 -0
  244. package/package.json +22 -4
@@ -0,0 +1,883 @@
1
+ // GitHub GraphQL API のクエリ・mutation 文字列。
2
+ // 先頭の 30 個は cli/core/github/queries.py を gql が送る形で写し、一致は infra/github/tests/queries.test.ts が固定する。
3
+ // 末尾の blocked by 関係の 4 個は Python に無く、graphql-js の print の出力の形で書く。
4
+ // プロジェクトアイテム一覧取得(ページネーション対応)
5
+ export const QUERY_LIST_PROJECT_ITEMS = `query ($projectId: ID!, $cursor: String) {
6
+ node(id: $projectId) {
7
+ ... on ProjectV2 {
8
+ items(first: 100, after: $cursor) {
9
+ nodes {
10
+ id
11
+ updatedAt
12
+ fieldValues(first: 10) {
13
+ nodes {
14
+ ... on ProjectV2ItemFieldSingleSelectValue {
15
+ field {
16
+ ... on ProjectV2SingleSelectField {
17
+ name
18
+ }
19
+ }
20
+ name
21
+ }
22
+ }
23
+ }
24
+ content {
25
+ ... on Issue {
26
+ id
27
+ number
28
+ title
29
+ state
30
+ url
31
+ labels(first: 10) {
32
+ nodes {
33
+ name
34
+ }
35
+ }
36
+ repository {
37
+ owner {
38
+ login
39
+ }
40
+ name
41
+ }
42
+ }
43
+ ... on PullRequest {
44
+ id
45
+ number
46
+ title
47
+ state
48
+ url
49
+ repository {
50
+ owner {
51
+ login
52
+ }
53
+ name
54
+ }
55
+ }
56
+ }
57
+ }
58
+ pageInfo {
59
+ hasNextPage
60
+ endCursor
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }`;
66
+ // プロジェクトアイテム一覧取得(フィルタリング対応)
67
+ export const QUERY_LIST_PROJECT_ITEMS_FILTERED = `query ($projectId: ID!, $cursor: String, $filterQuery: String) {
68
+ node(id: $projectId) {
69
+ ... on ProjectV2 {
70
+ items(first: 100, after: $cursor, query: $filterQuery) {
71
+ nodes {
72
+ id
73
+ updatedAt
74
+ fieldValues(first: 10) {
75
+ nodes {
76
+ ... on ProjectV2ItemFieldSingleSelectValue {
77
+ field {
78
+ ... on ProjectV2SingleSelectField {
79
+ name
80
+ }
81
+ }
82
+ name
83
+ }
84
+ }
85
+ }
86
+ content {
87
+ ... on Issue {
88
+ id
89
+ number
90
+ title
91
+ state
92
+ url
93
+ labels(first: 10) {
94
+ nodes {
95
+ name
96
+ }
97
+ }
98
+ repository {
99
+ owner {
100
+ login
101
+ }
102
+ name
103
+ }
104
+ }
105
+ ... on PullRequest {
106
+ id
107
+ number
108
+ title
109
+ state
110
+ url
111
+ repository {
112
+ owner {
113
+ login
114
+ }
115
+ name
116
+ }
117
+ }
118
+ }
119
+ }
120
+ pageInfo {
121
+ hasNextPage
122
+ endCursor
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }`;
128
+ // Issue Node ID・タイトル取得
129
+ export const QUERY_GET_ISSUE_NODE_ID = `query ($owner: String!, $repo: String!, $number: Int!) {
130
+ repository(owner: $owner, name: $repo) {
131
+ issue(number: $number) {
132
+ id
133
+ title
134
+ }
135
+ }
136
+ }`;
137
+ // リンクリポジトリ取得(user版)
138
+ export const QUERY_GET_LINKED_REPOSITORIES_USER = `query ($owner: String!, $projectNumber: Int!) {
139
+ user(login: $owner) {
140
+ projectV2(number: $projectNumber) {
141
+ repositories(first: 100) {
142
+ nodes {
143
+ owner {
144
+ login
145
+ }
146
+ name
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }`;
152
+ // リンクリポジトリ取得(organization版)
153
+ export const QUERY_GET_LINKED_REPOSITORIES_ORG = `query ($owner: String!, $projectNumber: Int!) {
154
+ organization(login: $owner) {
155
+ projectV2(number: $projectNumber) {
156
+ repositories(first: 100) {
157
+ nodes {
158
+ owner {
159
+ login
160
+ }
161
+ name
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }`;
167
+ // プロジェクトNode ID取得(user版)
168
+ export const QUERY_GET_PROJECT_ID_USER = `query ($owner: String!, $projectNumber: Int!) {
169
+ user(login: $owner) {
170
+ projectV2(number: $projectNumber) {
171
+ id
172
+ }
173
+ }
174
+ }`;
175
+ // プロジェクトNode ID取得(organization版)
176
+ export const QUERY_GET_PROJECT_ID_ORG = `query ($owner: String!, $projectNumber: Int!) {
177
+ organization(login: $owner) {
178
+ projectV2(number: $projectNumber) {
179
+ id
180
+ }
181
+ }
182
+ }`;
183
+ // リポジトリNode ID取得
184
+ export const QUERY_GET_REPOSITORY_ID = `query ($owner: String!, $name: String!) {
185
+ repository(owner: $owner, name: $name) {
186
+ id
187
+ }
188
+ }`;
189
+ // プロジェクトにリポジトリをリンク
190
+ export const MUTATION_LINK_PROJECT_REPOSITORY = `mutation ($projectId: ID!, $repositoryId: ID!) {
191
+ linkProjectV2ToRepository(
192
+ input: { projectId: $projectId, repositoryId: $repositoryId }
193
+ ) {
194
+ repository {
195
+ id
196
+ nameWithOwner
197
+ }
198
+ }
199
+ }`;
200
+ // ボードにアイテム追加
201
+ export const MUTATION_ADD_TO_PROJECT = `mutation ($projectId: ID!, $contentId: ID!) {
202
+ addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) {
203
+ item {
204
+ id
205
+ }
206
+ }
207
+ }`;
208
+ // プロジェクトアイテムフィールド更新
209
+ export const MUTATION_UPDATE_PROJECT_ITEM_FIELD = `mutation ($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {
210
+ updateProjectV2ItemFieldValue(
211
+ input: {
212
+ projectId: $projectId
213
+ itemId: $itemId
214
+ fieldId: $fieldId
215
+ value: { singleSelectOptionId: $optionId }
216
+ }
217
+ ) {
218
+ projectV2Item {
219
+ id
220
+ }
221
+ }
222
+ }`;
223
+ // プロジェクトアイテム削除
224
+ export const MUTATION_DELETE_PROJECT_ITEM = `mutation ($projectId: ID!, $itemId: ID!) {
225
+ deleteProjectV2Item(input: { projectId: $projectId, itemId: $itemId }) {
226
+ deletedItemId
227
+ }
228
+ }`;
229
+ // サブIssue紐づけ
230
+ export const MUTATION_ADD_SUB_ISSUE = `mutation ($parentId: ID!, $childId: ID!) {
231
+ addSubIssue(input: { issueId: $parentId, subIssueId: $childId }) {
232
+ issue {
233
+ number
234
+ }
235
+ subIssue {
236
+ number
237
+ }
238
+ }
239
+ }`;
240
+ // リンクブランチ作成(Issueに紐づいたブランチ)
241
+ export const MUTATION_CREATE_LINKED_BRANCH = `mutation CreateLinkedBranch($input: CreateLinkedBranchInput!) {
242
+ createLinkedBranch(input: $input) {
243
+ linkedBranch {
244
+ ref {
245
+ name
246
+ prefix
247
+ }
248
+ }
249
+ }
250
+ }`;
251
+ // Issue番号からプロジェクトアイテム取得(高速版)
252
+ export const QUERY_GET_ISSUE_PROJECT_ITEMS = `query ($owner: String!, $repo: String!, $number: Int!) {
253
+ repository(owner: $owner, name: $repo) {
254
+ issue(number: $number) {
255
+ projectItems(first: 20) {
256
+ nodes {
257
+ id
258
+ project {
259
+ id
260
+ }
261
+ fieldValues(first: 20) {
262
+ nodes {
263
+ ... on ProjectV2ItemFieldSingleSelectValue {
264
+ field {
265
+ ... on ProjectV2SingleSelectField {
266
+ id
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }`;
277
+ // プロジェクト一覧取得(user版)
278
+ export const QUERY_LIST_PROJECTS_USER = `query ($owner: String!, $first: Int!) {
279
+ user(login: $owner) {
280
+ projectsV2(first: $first) {
281
+ nodes {
282
+ number
283
+ title
284
+ url
285
+ id
286
+ }
287
+ }
288
+ }
289
+ }`;
290
+ // プロジェクト一覧取得(organization版)
291
+ export const QUERY_LIST_PROJECTS_ORG = `query ($owner: String!, $first: Int!) {
292
+ organization(login: $owner) {
293
+ projectsV2(first: $first) {
294
+ nodes {
295
+ number
296
+ title
297
+ url
298
+ id
299
+ }
300
+ }
301
+ }
302
+ }`;
303
+ // プロジェクトフィールド取得(user版)
304
+ export const QUERY_GET_PROJECT_FIELDS_USER = `query ($owner: String!, $projectNumber: Int!) {
305
+ user(login: $owner) {
306
+ projectV2(number: $projectNumber) {
307
+ id
308
+ title
309
+ url
310
+ fields(first: 50) {
311
+ nodes {
312
+ ... on ProjectV2SingleSelectField {
313
+ id
314
+ databaseId
315
+ name
316
+ options {
317
+ id
318
+ name
319
+ color
320
+ description
321
+ }
322
+ }
323
+ ... on ProjectV2Field {
324
+ id
325
+ name
326
+ }
327
+ }
328
+ }
329
+ views(first: 1) {
330
+ nodes {
331
+ number
332
+ }
333
+ }
334
+ }
335
+ }
336
+ }`;
337
+ // プロジェクトフィールド取得(organization版)
338
+ export const QUERY_GET_PROJECT_FIELDS_ORG = `query ($owner: String!, $projectNumber: Int!) {
339
+ organization(login: $owner) {
340
+ projectV2(number: $projectNumber) {
341
+ id
342
+ title
343
+ url
344
+ fields(first: 50) {
345
+ nodes {
346
+ ... on ProjectV2SingleSelectField {
347
+ id
348
+ databaseId
349
+ name
350
+ options {
351
+ id
352
+ name
353
+ color
354
+ description
355
+ }
356
+ }
357
+ ... on ProjectV2Field {
358
+ id
359
+ name
360
+ }
361
+ }
362
+ }
363
+ views(first: 1) {
364
+ nodes {
365
+ number
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }`;
371
+ // プロジェクトフィールド作成(SingleSelect用)
372
+ export const MUTATION_CREATE_PROJECT_FIELD = `mutation ($projectId: ID!, $name: String!, $options: [ProjectV2SingleSelectFieldOptionInput!]!) {
373
+ createProjectV2Field(
374
+ input: {
375
+ projectId: $projectId
376
+ dataType: SINGLE_SELECT
377
+ name: $name
378
+ singleSelectOptions: $options
379
+ }
380
+ ) {
381
+ projectV2Field {
382
+ ... on ProjectV2SingleSelectField {
383
+ id
384
+ name
385
+ options {
386
+ id
387
+ name
388
+ }
389
+ }
390
+ }
391
+ }
392
+ }`;
393
+ // プロジェクトフィールドの選択肢の置き換え(SingleSelect用。一覧の全体を送る)
394
+ export const MUTATION_UPDATE_PROJECT_FIELD = `mutation ($fieldId: ID!, $options: [ProjectV2SingleSelectFieldOptionInput!]!) {
395
+ updateProjectV2Field(
396
+ input: { fieldId: $fieldId, singleSelectOptions: $options }
397
+ ) {
398
+ projectV2Field {
399
+ ... on ProjectV2SingleSelectField {
400
+ id
401
+ name
402
+ options {
403
+ id
404
+ name
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }`;
410
+ // ユーザーNode ID取得
411
+ export const QUERY_GET_USER_NODE_ID = `query ($login: String!) {
412
+ user(login: $login) {
413
+ id
414
+ }
415
+ }`;
416
+ // 組織Node ID取得
417
+ export const QUERY_GET_ORG_NODE_ID = `query ($login: String!) {
418
+ organization(login: $login) {
419
+ id
420
+ }
421
+ }`;
422
+ // プロジェクト作成
423
+ export const MUTATION_CREATE_PROJECT = `mutation ($ownerId: ID!, $title: String!) {
424
+ createProjectV2(input: { ownerId: $ownerId, title: $title }) {
425
+ projectV2 {
426
+ id
427
+ number
428
+ title
429
+ url
430
+ }
431
+ }
432
+ }`;
433
+ // Issue 種別判定用クエリ(軽量・Epic 判定専用)
434
+ // Phase2: issueType.name == "Epic" を一次判定
435
+ export const QUERY_GET_ISSUE_KIND = `query ($owner: String!, $repo: String!, $number: Int!) {
436
+ repository(owner: $owner, name: $repo) {
437
+ issue(number: $number) {
438
+ number
439
+ state
440
+ issueType {
441
+ name
442
+ }
443
+ subIssues(first: 1) {
444
+ totalCount
445
+ }
446
+ }
447
+ }
448
+ }`;
449
+ // issueType フィールド非対応 GHES 向けのフォールバック(Phase1 単独)
450
+ export const QUERY_GET_ISSUE_KIND_PHASE1 = `query ($owner: String!, $repo: String!, $number: Int!) {
451
+ repository(owner: $owner, name: $repo) {
452
+ issue(number: $number) {
453
+ number
454
+ state
455
+ subIssues(first: 1) {
456
+ totalCount
457
+ }
458
+ }
459
+ }
460
+ }`;
461
+ // Issue詳細取得(スリム版 - 必要なフィールドのみ)
462
+ export const QUERY_GET_ISSUE_SLIM = `query ($owner: String!, $repo: String!, $number: Int!, $commentLimit: Int!) {
463
+ repository(owner: $owner, name: $repo) {
464
+ issue(number: $number) {
465
+ number
466
+ state
467
+ title
468
+ body
469
+ comments(last: $commentLimit) {
470
+ totalCount
471
+ nodes {
472
+ author {
473
+ login
474
+ }
475
+ createdAt
476
+ body
477
+ }
478
+ }
479
+ parent {
480
+ number
481
+ title
482
+ state
483
+ repository {
484
+ owner {
485
+ login
486
+ }
487
+ name
488
+ }
489
+ }
490
+ subIssues(first: 20) {
491
+ nodes {
492
+ number
493
+ state
494
+ title
495
+ }
496
+ pageInfo {
497
+ hasNextPage
498
+ endCursor
499
+ }
500
+ }
501
+ linkedBranches(first: 10) {
502
+ nodes {
503
+ ref {
504
+ name
505
+ }
506
+ }
507
+ }
508
+ timelineItems(itemTypes: [CONNECTED_EVENT, CROSS_REFERENCED_EVENT], first: 20) {
509
+ nodes {
510
+ ... on ConnectedEvent {
511
+ subject {
512
+ ... on PullRequest {
513
+ number
514
+ title
515
+ state
516
+ }
517
+ }
518
+ }
519
+ ... on CrossReferencedEvent {
520
+ source {
521
+ ... on PullRequest {
522
+ number
523
+ title
524
+ state
525
+ }
526
+ }
527
+ }
528
+ }
529
+ }
530
+ }
531
+ }
532
+ }`;
533
+ // Python 版 queries.py の QUERY_GET_SUB_ISSUES_PAGE と逐語で一致させる。
534
+ export const QUERY_GET_SUB_ISSUES_PAGE = `query ($owner: String!, $repo: String!, $number: Int!, $after: String!) {
535
+ repository(owner: $owner, name: $repo) {
536
+ issue(number: $number) {
537
+ subIssues(first: 100, after: $after) {
538
+ nodes {
539
+ number
540
+ state
541
+ title
542
+ }
543
+ pageInfo {
544
+ hasNextPage
545
+ endCursor
546
+ }
547
+ }
548
+ }
549
+ }
550
+ }`;
551
+ // PR詳細取得(スリム版 - 必要なフィールドのみ)
552
+ export const QUERY_GET_PULL_REQUEST_SLIM = `query ($owner: String!, $repo: String!, $number: Int!) {
553
+ repository(owner: $owner, name: $repo) {
554
+ pullRequest(number: $number) {
555
+ number
556
+ state
557
+ title
558
+ body
559
+ headRefName
560
+ baseRefName
561
+ isDraft
562
+ mergeable
563
+ comments {
564
+ totalCount
565
+ }
566
+ closingIssuesReferences(first: 10) {
567
+ nodes {
568
+ number
569
+ title
570
+ }
571
+ }
572
+ reviews(first: 10) {
573
+ nodes {
574
+ state
575
+ author {
576
+ login
577
+ }
578
+ }
579
+ }
580
+ }
581
+ }
582
+ }`;
583
+ // PR詳細取得(レビュー詳細付き - --reviews オプション用)
584
+ export const QUERY_GET_PULL_REQUEST_WITH_REVIEWS = `query ($owner: String!, $repo: String!, $number: Int!) {
585
+ repository(owner: $owner, name: $repo) {
586
+ pullRequest(number: $number) {
587
+ number
588
+ state
589
+ title
590
+ body
591
+ headRefName
592
+ baseRefName
593
+ isDraft
594
+ mergeable
595
+ comments {
596
+ totalCount
597
+ }
598
+ closingIssuesReferences(first: 10) {
599
+ nodes {
600
+ number
601
+ title
602
+ }
603
+ }
604
+ reviews(first: 20) {
605
+ nodes {
606
+ state
607
+ body
608
+ author {
609
+ login
610
+ }
611
+ submittedAt
612
+ }
613
+ }
614
+ reviewThreads(first: 50) {
615
+ nodes {
616
+ isResolved
617
+ path
618
+ line
619
+ comments(first: 10) {
620
+ nodes {
621
+ author {
622
+ login
623
+ }
624
+ body
625
+ createdAt
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+ }
632
+ }`;
633
+ // open の PR の一覧。dependabot の PR の待ち状態の判定に使う。ページを辿る
634
+ // 入れ子の connection が多く、ノード数の上限に近づくので first は 25 にしている。
635
+ // timelineItems は、2 種のイベントを合わせて last: N だと force-push が多いときに片方が押し出されるため、
636
+ // 種類ごとに別名で最後の 1 件だけを取る。
637
+ export const QUERY_LIST_OPEN_PULL_REQUESTS = `query ($owner: String!, $repo: String!, $after: String) {
638
+ repository(owner: $owner, name: $repo) {
639
+ pullRequests(
640
+ first: 25
641
+ states: OPEN
642
+ after: $after
643
+ orderBy: { field: CREATED_AT, direction: ASC }
644
+ ) {
645
+ pageInfo {
646
+ hasNextPage
647
+ endCursor
648
+ }
649
+ nodes {
650
+ number
651
+ title
652
+ url
653
+ createdAt
654
+ author {
655
+ __typename
656
+ login
657
+ }
658
+ isInMergeQueue
659
+ autoMergeRequest {
660
+ enabledAt
661
+ }
662
+ mergeable
663
+ baseRef {
664
+ target {
665
+ ... on Commit {
666
+ committedDate
667
+ }
668
+ }
669
+ }
670
+ firstCommits: commits(first: 1) {
671
+ nodes {
672
+ commit {
673
+ message
674
+ signature {
675
+ isValid
676
+ }
677
+ author {
678
+ user {
679
+ login
680
+ }
681
+ }
682
+ }
683
+ }
684
+ }
685
+ headCommits: commits(last: 1) {
686
+ nodes {
687
+ commit {
688
+ statusCheckRollup {
689
+ state
690
+ }
691
+ }
692
+ }
693
+ }
694
+ lastForcePush: timelineItems(last: 1, itemTypes: [HEAD_REF_FORCE_PUSHED_EVENT]) {
695
+ nodes {
696
+ ... on HeadRefForcePushedEvent {
697
+ createdAt
698
+ }
699
+ }
700
+ }
701
+ lastDequeue: timelineItems(last: 1, itemTypes: [REMOVED_FROM_MERGE_QUEUE_EVENT]) {
702
+ nodes {
703
+ ... on RemovedFromMergeQueueEvent {
704
+ createdAt
705
+ }
706
+ }
707
+ }
708
+ }
709
+ }
710
+ }
711
+ }`;
712
+ // 前提(blocked by)を付ける。issueId が待つ側、blockingIssueId が前提
713
+ export const MUTATION_ADD_BLOCKED_BY = `mutation ($issueId: ID!, $blockingIssueId: ID!) {
714
+ addBlockedBy(input: { issueId: $issueId, blockingIssueId: $blockingIssueId }) {
715
+ issue {
716
+ number
717
+ }
718
+ blockingIssue {
719
+ number
720
+ }
721
+ }
722
+ }`;
723
+ // 前提(blocked by)を外す
724
+ export const MUTATION_REMOVE_BLOCKED_BY = `mutation ($issueId: ID!, $blockingIssueId: ID!) {
725
+ removeBlockedBy(input: { issueId: $issueId, blockingIssueId: $blockingIssueId }) {
726
+ issue {
727
+ number
728
+ }
729
+ blockingIssue {
730
+ number
731
+ }
732
+ }
733
+ }`;
734
+ const PULL_REQUEST_FIELDS = `fragment PullRequestFields on PullRequest {
735
+ number
736
+ state
737
+ headRefName
738
+ baseRefName
739
+ isDraft
740
+ isCrossRepository
741
+ repository {
742
+ owner {
743
+ login
744
+ }
745
+ name
746
+ }
747
+ }`;
748
+ const PREREQUISITE_ISSUE_FIELDS = `fragment PrerequisiteIssueFields on Issue {
749
+ id
750
+ number
751
+ state
752
+ title
753
+ repository {
754
+ owner {
755
+ login
756
+ }
757
+ name
758
+ }
759
+ issueType {
760
+ name
761
+ }
762
+ subIssues(first: 1) {
763
+ totalCount
764
+ }
765
+ projectItems(first: 20, includeArchived: false) {
766
+ totalCount
767
+ nodes {
768
+ project {
769
+ id
770
+ }
771
+ column: fieldValueByName(name: $columnFieldName) {
772
+ ...SingleSelectValueFields
773
+ }
774
+ label: fieldValueByName(name: $labelFieldName) {
775
+ ...SingleSelectValueFields
776
+ }
777
+ }
778
+ }
779
+ linkedBranches(first: 10) {
780
+ totalCount
781
+ nodes {
782
+ ref {
783
+ name
784
+ associatedPullRequests(first: 10) {
785
+ totalCount
786
+ nodes {
787
+ ...PullRequestFields
788
+ }
789
+ }
790
+ }
791
+ }
792
+ }
793
+ closedByPullRequestsReferences(first: 10, includeClosedPrs: true) {
794
+ totalCount
795
+ nodes {
796
+ ...PullRequestFields
797
+ }
798
+ }
799
+ timelineItems(
800
+ itemTypes: [CONNECTED_EVENT, DISCONNECTED_EVENT, CROSS_REFERENCED_EVENT]
801
+ first: 20
802
+ ) {
803
+ totalCount
804
+ nodes {
805
+ __typename
806
+ ... on ConnectedEvent {
807
+ subject {
808
+ ... on PullRequest {
809
+ ...PullRequestFields
810
+ }
811
+ }
812
+ }
813
+ ... on DisconnectedEvent {
814
+ subject {
815
+ ... on PullRequest {
816
+ ...PullRequestFields
817
+ }
818
+ }
819
+ }
820
+ ... on CrossReferencedEvent {
821
+ willCloseTarget
822
+ source {
823
+ ... on PullRequest {
824
+ ...PullRequestFields
825
+ }
826
+ }
827
+ }
828
+ }
829
+ }
830
+ }`;
831
+ const SINGLE_SELECT_VALUE_FIELDS = `fragment SingleSelectValueFields on ProjectV2ItemFieldValue {
832
+ ... on ProjectV2ItemFieldSingleSelectValue {
833
+ name
834
+ optionId
835
+ field {
836
+ ... on ProjectV2SingleSelectField {
837
+ id
838
+ }
839
+ }
840
+ }
841
+ }`;
842
+ // Issue と、その前提(blockedBy)を 1 回で読む。PR は 3 つの読み口から集める
843
+ export const QUERY_GET_ISSUE_PREREQUISITES = `query ($owner: String!, $repo: String!, $number: Int!, $columnFieldName: String!, $labelFieldName: String!) {
844
+ repository(owner: $owner, name: $repo) {
845
+ issue(number: $number) {
846
+ ...PrerequisiteIssueFields
847
+ body
848
+ blockedBy(first: 50) {
849
+ totalCount
850
+ nodes {
851
+ ...PrerequisiteIssueFields
852
+ }
853
+ }
854
+ }
855
+ }
856
+ }
857
+
858
+ ${PREREQUISITE_ISSUE_FIELDS}
859
+
860
+ ${SINGLE_SELECT_VALUE_FIELDS}
861
+
862
+ ${PULL_REQUEST_FIELDS}`;
863
+ // head のブランチ名で PR を引く(open・closed・merged。新しい順)
864
+ export const QUERY_LIST_PULL_REQUESTS_BY_HEAD = `query ($owner: String!, $repo: String!, $headRefName: String!) {
865
+ repository(owner: $owner, name: $repo) {
866
+ pullRequests(
867
+ headRefName: $headRefName
868
+ states: [OPEN, CLOSED, MERGED]
869
+ first: 20
870
+ orderBy: { field: CREATED_AT, direction: DESC }
871
+ ) {
872
+ pageInfo {
873
+ hasNextPage
874
+ }
875
+ nodes {
876
+ ...PullRequestFields
877
+ }
878
+ }
879
+ }
880
+ }
881
+
882
+ ${PULL_REQUEST_FIELDS}`;
883
+ //# sourceMappingURL=queries.js.map