@pecot/workflow-mcp 7.0.1-dev.34 → 7.0.1-dev.36

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pecot-w",
3
- "version": "7.0.1-dev.34",
3
+ "version": "7.0.1-dev.36",
4
4
  "description": "pecot-w (pecot-workflow) workflow automation plugin for Claude Code - skills, hooks, agents, and commands for AI-assisted development",
5
5
  "author": {
6
6
  "name": "pecot"
@@ -9,6 +9,7 @@ import { extractClosingIssueNumbers } from '../domain/pull-request.js';
9
9
  import { assumePullRequestState, describeReadinessChange, displayReference, hasReadinessChanged, isDone, isStackedOn } from '../domain/readiness.js';
10
10
  import { createIssueReference } from '../domain/reference-parser.js';
11
11
  import { RESTACK_PATH } from '../domain/restack.js';
12
+ import { isSameRepository } from '../domain/repository-resolver.js';
12
13
  import { FLAG_PECOT_BASE, FLAG_PECOT_SESSION_TITLE } from '../domain/state.js';
13
14
  import { gitCurrentBranch, GitCommandError, runGit } from '../infra/git.js';
14
15
  import { GitHubAPIError, GitHubNotFoundError, isClosedByAnotherRequest, isMissingReferenceError } from '../infra/github/errors.js';
@@ -27,7 +28,7 @@ import { settle } from './tracker-sync.js';
27
28
  import { isPositive, parseReference, PR_REFERENCE_DESCRIPTION, primaryRemote, reasonOf } from './pr.js';
28
29
  const SKIPPED_ISSUE_DATA = z.strictObject({
29
30
  number: z.int().describe('Issue number'),
30
- reason: z.enum(['epic', 'already-closed', 'not-found', 'failed']).describe('Why it was not closed: epic (protected), already-closed, not-found, or failed (see warnings)'),
31
+ reason: z.enum(['epic', 'already-closed', 'not-found', 'failed']).describe('Why it was not closed: epic (protected), already-closed (including Issues GitHub closed on merge), not-found, or failed (see warnings)'),
31
32
  });
32
33
  const DELETED_BRANCH_DATA = z.strictObject({
33
34
  branch: z.string().describe('Name of the branch'),
@@ -43,7 +44,7 @@ const RESTACK_DATA = z.strictObject({
43
44
  branch: z.string().optional().describe('Branch linked to that Issue, to restack in its working directory (omitted when none)'),
44
45
  });
45
46
  const SESSION_FINISH_OUTPUT = z.strictObject({
46
- closedIssues: z.array(z.int()).describe('Issue numbers closed (to be closed on dry_run)'),
47
+ closedIssues: z.array(z.int()).describe('Issue numbers this command closed (to be closed on dry_run); usually empty for a PR to the default branch, since GitHub closes them on merge'),
47
48
  skippedIssues: z.array(SKIPPED_ISSUE_DATA).describe('Closing Issues of the PR that this command did not close'),
48
49
  deletedBranches: z.array(DELETED_BRANCH_DATA).describe('Branches deleted (to be deleted on dry_run)'),
49
50
  readinessChanges: z.array(READINESS_CHANGE_DATA).describe('Issues waiting for the closed Issues whose readiness changed by the merge'),
@@ -54,7 +55,7 @@ const SESSION_FINISH_OUTPUT = z.strictObject({
54
55
  async function fetchPullRequestForCleanup(config, location, out) {
55
56
  try {
56
57
  const client = createGitHubClient(out, config.host);
57
- return { client, pr: await client.getPullRequestSlim(location.owner, location.repository, location.number) };
58
+ return { client, pr: await client.getPullRequestForFinish(location.owner, location.repository, location.number) };
58
59
  }
59
60
  catch (error) {
60
61
  if (error instanceof GitHubNotFoundError)
@@ -64,43 +65,62 @@ async function fetchPullRequestForCleanup(config, location, out) {
64
65
  throw error;
65
66
  }
66
67
  }
67
- function collectClosingIssueNumbers(pr) {
68
- const numbers = new Set(pr.closing_issues.map(issue => issue.number));
69
- for (const number of extractClosingIssueNumbers(pr.body))
70
- numbers.add(number);
68
+ // GitHub はキーワードを既定ブランチ宛ての PR でだけ解釈するので、そのときは closing issues だけを使う
69
+ function collectClosingIssueNumbers(pr, location) {
70
+ const numbers = new Set(pr.closing_issues.filter(issue => isSameRepository(issue, location)).map(issue => issue.number));
71
+ if (pr.base_ref !== pr.default_branch) {
72
+ for (const number of extractClosingIssueNumbers(pr.body, location))
73
+ numbers.add(number);
74
+ }
71
75
  const branchNumber = extractIssueNumberFromBranch(pr.head_ref);
72
76
  if (isPositive(branchNumber))
73
77
  numbers.add(branchNumber);
74
78
  return numbers;
75
79
  }
76
- // Epic 保護。Issue Type が Epic か、sub-issue を持つ Issue
77
- async function findEpicProtectedNumbers(client, location, issueNumbers, out) {
78
- const protectedNumbers = new Set();
80
+ // Epic(Issue Type が Epic か、sub-issue を持つ)と閉じた Issue を分ける。読めない Issue は、閉じた理由を上書きしないよう閉じない
81
+ async function classifyClosingIssues(client, location, issueNumbers, out) {
82
+ const classified = { open: new Set(), epic: new Set(), closed: new Set(), unread: new Set() };
79
83
  const ordered = [...issueNumbers].toSorted((a, b) => a - b);
80
84
  for (const number of ordered) {
81
85
  try {
82
- if (isEpicIssue(await client.getIssueKind(location.owner, location.repository, number)))
83
- protectedNumbers.add(number);
86
+ const kind = await client.getIssueKind(location.owner, location.repository, number);
87
+ if (isEpicIssue(kind))
88
+ classified.epic.add(number);
89
+ else if (kind.state === 'CLOSED')
90
+ classified.closed.add(number);
91
+ else
92
+ classified.open.add(number);
84
93
  }
85
94
  catch (error) {
86
- if (error instanceof GitHubNotFoundError)
95
+ if (error instanceof GitHubNotFoundError) {
96
+ // 状態は確かめていないが、close の 404 で not-found として記録するため open に入れる
97
+ classified.open.add(number);
87
98
  continue;
99
+ }
88
100
  if (!(error instanceof GitHubAPIError))
89
101
  throw error;
90
- out.warning(`kind check of Issue #${String(number)} failed: ${error.message}; not protected`);
102
+ out.warning(`reading Issue #${String(number)} failed: ${error.message}; not closed`);
103
+ classified.unread.add(number);
91
104
  }
92
105
  }
93
- return protectedNumbers;
106
+ return classified;
94
107
  }
95
- async function closeRelatedIssues(context, client, location, closing, epicProtected) {
108
+ function sorted(numbers) {
109
+ return [...numbers].toSorted((a, b) => a - b);
110
+ }
111
+ async function closeRelatedIssues(context, client, location, issues) {
96
112
  const { out, isDryRun, record } = context;
97
- const protectedOrdered = [...epicProtected].toSorted((a, b) => a - b);
98
- const closingOrdered = [...closing].toSorted((a, b) => a - b);
99
- for (const number of protectedOrdered) {
113
+ for (const number of sorted(issues.epic)) {
100
114
  settle(out, { verb: 'skip', target: `closing Issue #${String(number)} (Epic)` });
101
115
  record.skippedIssues.push({ number, reason: 'epic' });
102
116
  }
103
- for (const number of closingOrdered) {
117
+ for (const number of sorted(issues.unread))
118
+ record.skippedIssues.push({ number, reason: 'failed' });
119
+ for (const number of sorted(issues.closed)) {
120
+ settle(out, { verb: 'unchanged', target: `Issue #${String(number)} (already closed)` });
121
+ record.skippedIssues.push({ number, reason: 'already-closed' });
122
+ }
123
+ for (const number of sorted(issues.open)) {
104
124
  const operation = { verb: 'close', target: `Issue #${String(number)}` };
105
125
  out.planned(operation);
106
126
  if (isDryRun) {
@@ -337,12 +357,9 @@ async function finish(input, context) {
337
357
  if (pr.state !== 'MERGED')
338
358
  stopWith(out, hinted `PR #${String(reference.number)} is not merged yet (state: ${pr.state}); merge it with ${commandHint(['pr', 'merge'])} first`, 'pr-state');
339
359
  context.record.hasStarted = true;
340
- const closing = collectClosingIssueNumbers(pr);
341
- const epicProtected = await findEpicProtectedNumbers(client, location, closing, out);
342
- for (const number of epicProtected)
343
- closing.delete(number);
344
- out.count('Issues to close', closing.size);
345
- await closeRelatedIssues(context, client, location, closing, epicProtected);
360
+ const issues = await classifyClosingIssues(client, location, collectClosingIssueNumbers(pr, location), out);
361
+ out.count('Issues to close', issues.open.size);
362
+ await closeRelatedIssues(context, client, location, issues);
346
363
  await updateWaitingIssues(context, { client, config, location, pullRequest: mergedPullRequestOf(location, reference.number, pr) });
347
364
  if (input.delete_branch)
348
365
  await deleteMergedBranch(context, client, location, pr.head_ref);
@@ -1,13 +1,15 @@
1
1
  import type { HintedText } from './command-hint.js';
2
2
  import type { PullRequestReadout } from './issue-readout.js';
3
3
  import type { SectionHeading } from './sections.js';
4
+ import type { RepositoryReference } from './repository-resolver.js';
4
5
  import type { BaseReading } from './state.js';
5
6
  import type { RestackDecision } from './restack.js';
6
7
  export declare const SCREENSHOT_MISSING_ERROR: HintedText;
7
8
  /**
8
- 本文の Closes / Fixes / Resolves に続く Issue 番号を、出てきた順に重複なしで返す
9
+ 本文のコードと HTML コメントの外の Closes / Fixes / Resolves に続く、repository の Issue 番号を、出てきた順に重複なしで返す。
10
+ GitHub が既定ブランチ宛ての PR で数えない所は数えない
9
11
  */
10
- export declare function extractClosingIssueNumbers(body: string): readonly number[];
12
+ export declare function extractClosingIssueNumbers(body: string, repository: Readonly<RepositoryReference>): readonly number[];
11
13
  /**
12
14
  本文にその Issue 番号の参照が無ければ、末尾に `Closes #N` を足す。あればそのまま返す
13
15
  */
@@ -2,7 +2,8 @@
2
2
  // 引数の型は、infra/github/pulls.ts の返す値が構造として満たす形をここに持つ(domain は infra を import できない)。
3
3
  import { commandHint, hinted, inputHint, inputNameHint, joinHinted } from './command-hint.js';
4
4
  import { PYTHON_LINE_BREAK, parsePythonInteger, pythonRightStrip, pythonStrip, splitCodePoints, truncateCodePoints } from './python-format.js';
5
- import { hasSummaryImage, validateBodyStyle, validateHeadingSummaries, validateSections } from './sections.js';
5
+ import { hasSummaryImage, maskCodeAndComments, validateBodyStyle, validateHeadingSummaries, validateSections } from './sections.js';
6
+ import { isSameRepository } from './repository-resolver.js';
6
7
  import { RESTACK_PATH } from './restack.js';
7
8
  // Issue 参照(`#N`、URL 内のフラグメントは除く)。`owner/repo#N` の形も受ける
8
9
  const ISSUE_REFERENCE_PATTERN = /(?:^|[^/])#\d+|[\w-]+\/[\w.-]+#\d+/u;
@@ -10,18 +11,20 @@ const ISSUE_REFERENCE_PATTERN = /(?:^|[^/])#\d+|[\w-]+\/[\w.-]+#\d+/u;
10
11
  const PYTHON_SPACE = String.raw `[\t\n\v\f\r\u{1C}-\u{20}\u{85}\u{A0}\u{1680}\u{2000}-\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}]`;
11
12
  // GitHub が認識する close・fix・resolve と、それぞれの -s / -es / -d 付きの形。`owner/repo#N` の形も受ける
12
13
  // eslint-disable-next-line security/detect-non-literal-regexp -- 固定の文字列から組み立てる
13
- const CLOSING_KEYWORDS_PATTERN = new RegExp(String.raw `(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)${PYTHON_SPACE}+(?:[\w-]+/[\w.-]+)?#(\p{Nd}+)`, 'giu');
14
+ const CLOSING_KEYWORDS_PATTERN = new RegExp(String.raw `(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)${PYTHON_SPACE}+(?:([\w-]+)/([\w.-]+))?#(\p{Nd}+)`, 'giu');
14
15
  const PR_CREATE_PATH = ['pr', 'create'];
15
16
  export const SCREENSHOT_MISSING_ERROR = hinted `Summary has no image and \`screenshot\` gives no reason to omit one. If the change alters a screen, Markdown the tool writes for GitHub, or CLI output text, take a screenshot and add it to Summary as \`![alt](./<file>.png)\`. Otherwise, write the reason in the \`screenshot\` frontmatter field (\`${inputNameHint(PR_CREATE_PATH, 'screenshot')}\` with \`${inputNameHint(PR_CREATE_PATH, 'message')}\`)`;
16
17
  /**
17
- 本文の Closes / Fixes / Resolves に続く Issue 番号を、出てきた順に重複なしで返す
18
+ 本文のコードと HTML コメントの外の Closes / Fixes / Resolves に続く、repository の Issue 番号を、出てきた順に重複なしで返す。
19
+ GitHub が既定ブランチ宛ての PR で数えない所は数えない
18
20
  */
19
- export function extractClosingIssueNumbers(body) {
21
+ export function extractClosingIssueNumbers(body, repository) {
20
22
  const numbers = [];
21
- body.replaceAll(CLOSING_KEYWORDS_PATTERN, (matched, digits) => {
22
- numbers.push(Number(parsePythonInteger(digits)));
23
- return matched;
24
- });
23
+ for (const match of maskCodeAndComments(body).matchAll(CLOSING_KEYWORDS_PATTERN)) {
24
+ const [, owner, name = '', digits = ''] = match;
25
+ if (owner === undefined || isSameRepository({ owner, repository: name }, repository))
26
+ numbers.push(Number(parsePythonInteger(digits)));
27
+ }
25
28
  return [...new Set(numbers)];
26
29
  }
27
30
  /**
@@ -40,6 +40,10 @@ em-dash 見出しのサマリが規則を満たすか確認し、違反の表記
40
40
  見出し自体が無いものは validateSections が不足として返すため、ここでは扱わない
41
41
  */
42
42
  export declare function validateHeadingSummaries(body: string, requiredSections: readonly SectionHeading[]): readonly string[];
43
+ /**
44
+ フェンス(引用の中を含む)・インデントのコードブロック・インラインコード・HTML コメントの中身を消した本文を返す。行の数は変えない
45
+ */
46
+ export declare function maskCodeAndComments(body: string): string;
43
47
  export declare function validateBodyStyle(body: string): readonly string[];
44
48
  /**
45
49
  折りたたみ(`<details>`)の開閉が対応しているかを判定する。
@@ -284,6 +284,51 @@ function maskedLines(body, fill = ' ') {
284
284
  .replaceAll(HTML_COMMENT_PATTERN, comment => comment.replaceAll(/[^\n]/g, () => fill));
285
285
  return { lines: masked.split('\n'), hasUnclosedFence };
286
286
  }
287
+ const BLOCKQUOTE_MARKER = /^ {0,3}>[\t ]?/u;
288
+ const INDENTED_CODE_LINE = /^(?: {4}|\t)/u;
289
+ // 引用の行頭の `>` を、入れ子の分まで外す
290
+ function unquote(line) {
291
+ let text = line;
292
+ let depth = 0;
293
+ while (BLOCKQUOTE_MARKER.test(text)) {
294
+ text = text.replace(BLOCKQUOTE_MARKER, '');
295
+ depth += 1;
296
+ }
297
+ return { depth, text };
298
+ }
299
+ // 引用の深さが同じ行の並びごとにフェンスを読む。引用の中で開いたフェンスは、引用が終われば閉じる
300
+ function maskBySameDepth(lines) {
301
+ const groups = [];
302
+ for (const line of lines) {
303
+ const last = groups.at(-1);
304
+ if (last?.at(0)?.depth === line.depth)
305
+ last.push(line);
306
+ else
307
+ groups.push([line]);
308
+ }
309
+ return groups.flatMap(group => maskedLines(group.map(line => line.text).join('\n')).lines);
310
+ }
311
+ // インデントのコードブロックの行か。段落の続きの行はコードにならないので、前が空行かコードの行のときだけ
312
+ function indentedCodeFlags(lines) {
313
+ let isInCode = false;
314
+ let isAfterBlank = true;
315
+ return lines.map((line) => {
316
+ const isBlank = line.trim() === '';
317
+ const isCode = !isBlank && INDENTED_CODE_LINE.test(line) && (isAfterBlank || isInCode);
318
+ if (!isBlank)
319
+ isInCode = isCode;
320
+ isAfterBlank = isBlank;
321
+ return isCode;
322
+ });
323
+ }
324
+ /**
325
+ フェンス(引用の中を含む)・インデントのコードブロック・インラインコード・HTML コメントの中身を消した本文を返す。行の数は変えない
326
+ */
327
+ export function maskCodeAndComments(body) {
328
+ const lines = body.split('\n').map(line => unquote(line));
329
+ const codeFlags = indentedCodeFlags(lines.map(line => line.text));
330
+ return maskBySameDepth(lines).map((line, index) => (codeFlags.at(index) === true ? '' : line)).join('\n');
331
+ }
287
332
  // 行の中の `<...>` トークンを、出てくる順に返す
288
333
  function tokensIn(line) {
289
334
  const tokens = Array.from(line.matchAll(TOKEN_PATTERN), match => ({ text: match[0], index: match.index }));
@@ -69,6 +69,25 @@ Stacks API が求める X-GitHub-Api-Version(https://docs.github.com/en/rest/p
69
69
  */
70
70
  export declare const STACKS_API_VERSION = "2026-03-10";
71
71
  /**
72
+ session finish が読む PR
73
+ */
74
+ export interface PullRequestForFinish {
75
+ readonly state: string;
76
+ readonly body: string;
77
+ readonly head_ref: string;
78
+ readonly base_ref: string;
79
+ readonly is_draft: boolean;
80
+ readonly closing_issues: readonly {
81
+ readonly owner: string;
82
+ readonly repository: string;
83
+ readonly number: number;
84
+ }[];
85
+ /**
86
+ base のリポの既定ブランチ。空のリポなどで無ければ undefined
87
+ */
88
+ readonly default_branch: string | undefined;
89
+ }
90
+ /**
72
91
  pr merge が読む PR の状態
73
92
  */
74
93
  export interface PullRequestForMerge {
@@ -147,6 +166,10 @@ export declare class PullsApi extends IssuesApi {
147
166
  */
148
167
  mergePullRequest(owner: string, repository: string, number: number, mergeMethod?: string, sha?: string): Promise<JsonObject>;
149
168
  /**
169
+ session finish が閉じる Issue を決めるのに使う PR を読む(GraphQL)。PR が無ければ GitHubNotFoundError
170
+ */
171
+ getPullRequestForFinish(owner: string, repository: string, number: number): Promise<PullRequestForFinish>;
172
+ /**
150
173
  pr merge の判断に使う PR の状態を読む(GraphQL)。
151
174
  merge queue の項目を持たない GHES は、項目なしのクエリで読み直し、どちらも false にする
152
175
  */
@@ -7,7 +7,7 @@ import { isJsonArray } from '../../domain/python-format.js';
7
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_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';
10
+ import { QUERY_GET_PULL_REQUEST_FOR_FINISH, 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
13
  /**
@@ -205,6 +205,29 @@ export class PullsApi extends IssuesApi {
205
205
  });
206
206
  }
207
207
  /**
208
+ session finish が閉じる Issue を決めるのに使う PR を読む(GraphQL)。PR が無ければ GitHubNotFoundError
209
+ */
210
+ async getPullRequestForFinish(owner, repository, number) {
211
+ const pullRequest = await this.fetchPullRequest(QUERY_GET_PULL_REQUEST_FOR_FINISH, owner, repository, number);
212
+ const defaultBranch = jsonField(jsonField(jsonField(pullRequest, 'baseRepository'), 'defaultBranchRef'), 'name');
213
+ return {
214
+ state: requireString(jsonField(pullRequest, 'state'), 'pullRequest.state'),
215
+ body: requireString(jsonField(pullRequest, 'body'), 'pullRequest.body'),
216
+ head_ref: requireString(jsonField(pullRequest, 'headRefName'), 'pullRequest.headRefName'),
217
+ base_ref: requireString(jsonField(pullRequest, 'baseRefName'), 'pullRequest.baseRefName'),
218
+ is_draft: requiresBoolean(jsonField(pullRequest, 'isDraft'), 'pullRequest.isDraft'),
219
+ closing_issues: truthyNodes(jsonField(pullRequest, 'closingIssuesReferences')).map((issue) => {
220
+ const issueRepository = jsonField(issue, 'repository');
221
+ return {
222
+ owner: requireString(jsonField(jsonField(issueRepository, 'owner'), 'login'), 'closingIssue.repository.owner.login'),
223
+ repository: requireString(jsonField(issueRepository, 'name'), 'closingIssue.repository.name'),
224
+ number: requireNumber(jsonField(issue, 'number'), 'closingIssue.number'),
225
+ };
226
+ }),
227
+ default_branch: typeof defaultBranch === 'string' ? defaultBranch : undefined,
228
+ };
229
+ }
230
+ /**
208
231
  pr merge の判断に使う PR の状態を読む(GraphQL)。
209
232
  merge queue の項目を持たない GHES は、項目なしのクエリで読み直し、どちらも false にする
210
233
  */
@@ -30,6 +30,7 @@ export declare const QUERY_GET_ISSUE_SLIM: string;
30
30
  export declare const QUERY_GET_ISSUE_SLIM_WITHOUT_BLOCKED_BY: string;
31
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}";
32
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_FINISH = "query ($owner: String!, $repo: String!, $number: Int!) {\n repository(owner: $owner, name: $repo) {\n pullRequest(number: $number) {\n number\n state\n body\n headRefName\n baseRefName\n isDraft\n closingIssuesReferences(first: 10) {\n nodes {\n number\n repository {\n name\n owner {\n login\n }\n }\n }\n }\n baseRepository {\n defaultBranchRef {\n name\n }\n }\n }\n }\n}";
33
34
  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
35
  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}";
35
36
  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}";
@@ -624,6 +624,35 @@ export const QUERY_GET_PULL_REQUEST_SLIM = `query ($owner: String!, $repo: Strin
624
624
  }
625
625
  }
626
626
  }`;
627
+ // session finish が読む PR。closing issues のリポと、既定ブランチの名前を足す
628
+ export const QUERY_GET_PULL_REQUEST_FOR_FINISH = `query ($owner: String!, $repo: String!, $number: Int!) {
629
+ repository(owner: $owner, name: $repo) {
630
+ pullRequest(number: $number) {
631
+ number
632
+ state
633
+ body
634
+ headRefName
635
+ baseRefName
636
+ isDraft
637
+ closingIssuesReferences(first: 10) {
638
+ nodes {
639
+ number
640
+ repository {
641
+ name
642
+ owner {
643
+ login
644
+ }
645
+ }
646
+ }
647
+ }
648
+ baseRepository {
649
+ defaultBranchRef {
650
+ name
651
+ }
652
+ }
653
+ }
654
+ }
655
+ }`;
627
656
  // pr merge が読む PR の状態。GetPullRequestSlim を変えずに、マージの判断に要る項目だけを読む
628
657
  export const QUERY_GET_PULL_REQUEST_FOR_MERGE = `query ($owner: String!, $repo: String!, $number: Int!) {
629
658
  repository(owner: $owner, name: $repo) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pecot/workflow-mcp",
3
- "version": "7.0.1-dev.34",
3
+ "version": "7.0.1-dev.36",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pecot/workflow-mcp",
9
- "version": "7.0.1-dev.34",
9
+ "version": "7.0.1-dev.36",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@modelcontextprotocol/server": "^2.4.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pecot/workflow-mcp",
3
- "version": "7.0.1-dev.34",
3
+ "version": "7.0.1-dev.36",
4
4
  "type": "module",
5
5
  "description": "pecot-workflow MCP server (standalone distribution)",
6
6
  "license": "MIT",