@pecot/workflow-mcp 8.0.1-dev.70 → 8.0.1-dev.71
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/cli/dist/commands/pr.js +1 -0
- package/cli/dist/domain/pull-request.d.ts +1 -0
- package/cli/dist/domain/pull-request.js +2 -1
- package/cli/dist/domain/review-finish.js +2 -2
- package/cli/dist/infra/github/pulls.d.ts +1 -0
- package/cli/dist/infra/github/pulls.js +1 -0
- package/cli/dist/infra/github/queries.d.ts +1 -1
- package/cli/dist/infra/github/queries.js +1 -0
- package/cli/templates/comment/review-findings.md +2 -1
- package/cli/templates/workflow/pecot-review.yml +9 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/cli/dist/commands/pr.js
CHANGED
|
@@ -799,6 +799,7 @@ const REVIEW_COMMENT_JSON = z.strictObject({
|
|
|
799
799
|
author: z.string().nullable().describe('Login of the author (null when deleted)'),
|
|
800
800
|
body: z.string().describe('Body of the comment'),
|
|
801
801
|
created_at: z.string().nullable().describe('Creation time'),
|
|
802
|
+
url: z.string().nullable().describe('URL of the comment'),
|
|
802
803
|
});
|
|
803
804
|
const REVIEW_THREAD_JSON = z.strictObject({
|
|
804
805
|
is_resolved: z.boolean().describe('Whether the thread is resolved'),
|
|
@@ -144,6 +144,7 @@ export interface ReviewThreadView {
|
|
|
144
144
|
readonly author: string | null;
|
|
145
145
|
readonly body: string;
|
|
146
146
|
readonly created_at: string | null;
|
|
147
|
+
readonly url: string | null;
|
|
147
148
|
}[];
|
|
148
149
|
}
|
|
149
150
|
export interface PullRequestWithReviewsView extends PullRequestView {
|
|
@@ -197,7 +197,8 @@ export function formatReviewThreadsMarkdown(threads) {
|
|
|
197
197
|
for (const comment of thread.comments) {
|
|
198
198
|
const author = comment.author === null || comment.author === '' ? '(unknown)' : comment.author;
|
|
199
199
|
const date = datePart(comment.created_at);
|
|
200
|
-
|
|
200
|
+
const url = comment.url === null || comment.url === '' ? '' : ` ${comment.url}`;
|
|
201
|
+
lines.push(`**@${author}**${date === '' ? '' : ` (${date})`}${url}:`);
|
|
201
202
|
const body = pythonStrip(comment.body);
|
|
202
203
|
if (body !== '')
|
|
203
204
|
lines.push(...body.split('\n').map(line => `> ${line}`));
|
|
@@ -81,8 +81,8 @@ export function decideReviewFinish(input) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
// w-review
|
|
85
|
-
const FINDING_HEAD = /^\*\*
|
|
84
|
+
// w-review の指摘のインラインコメントの先頭 `**F-NN**`
|
|
85
|
+
const FINDING_HEAD = /^\*\*F-\d+\*\*/u;
|
|
86
86
|
/**
|
|
87
87
|
止まった場所。since より後に作られた指摘のインラインコメントがあれば after-inline。since が無ければ unknown
|
|
88
88
|
*/
|
|
@@ -198,6 +198,7 @@ export class PullsApi extends IssuesApi {
|
|
|
198
198
|
author: loginOrNull(jsonField(comment, 'author')),
|
|
199
199
|
body: requiredTextOrEmpty(jsonField(comment, 'body')),
|
|
200
200
|
created_at: stringOrNull(jsonField(comment, 'createdAt')),
|
|
201
|
+
url: stringOrNull(jsonField(comment, 'url')),
|
|
201
202
|
})),
|
|
202
203
|
})),
|
|
203
204
|
};
|
|
@@ -34,7 +34,7 @@ export declare const QUERY_GET_PULL_REQUEST_SLIM = "query ($owner: String!, $rep
|
|
|
34
34
|
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}";
|
|
35
35
|
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}";
|
|
36
36
|
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}";
|
|
37
|
-
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}";
|
|
37
|
+
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 url\n }\n }\n }\n }\n }\n }\n}";
|
|
38
38
|
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}";
|
|
39
39
|
export declare const QUERY_HAS_ADD_BLOCKED_BY_INPUT = "{\n __type(name: \"AddBlockedByInput\") {\n name\n }\n}";
|
|
40
40
|
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}";
|
|
@@ -13,7 +13,8 @@ template: review-findings
|
|
|
13
13
|
- 視点の印はレビューの指摘に付け、`[tech]`・`[cuj]` のどれかを書く。main が流した CUJ の不合格は `[cuj]` にする。外部のレビュアーの指摘には付けない
|
|
14
14
|
- General には、行に紐づけられない指摘だけを書く(PR 本文・欠けているもの・差分の外の既存行・横断的な設計)
|
|
15
15
|
- Disposition は表にし、インラインにした分も含めて全 F-NN を 1 行ずつ並べる。URL は本文に裸で書かず、F-NN の欄をコメントへのリンクにする(自分が投稿したコメントは `html_url`、外部のレビュアーは元のスレッド)。インラインでない分はリンクにしない
|
|
16
|
-
-
|
|
16
|
+
- 想定する方針の欄は「対応」か「対応不要(理由)」で書く。保留は使わない。2 巡目以降に前の指摘が直っていれば「直った」と書く
|
|
17
|
+
- F-NN は PR の中の通し番号にする。2 巡目以降は、前の `review-findings` にある最大の番号の続きから振る
|
|
17
18
|
- 指摘が 0 件でも投稿する。0 件の節は `- 非インライン指摘なし` / `- 指摘なし` にする(Disposition は表にしない)
|
|
18
19
|
- `-m` の 1 行の投稿は節が欠けて検証で止まる。このファイルを編集してから投稿する
|
|
19
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# pecot-workflow-template: review
|
|
1
|
+
# pecot-workflow-template: review 3
|
|
2
2
|
#
|
|
3
3
|
# Place this file at .github/workflows/pecot-review.yml in your repository.
|
|
4
4
|
#
|
|
@@ -115,18 +115,24 @@ jobs:
|
|
|
115
115
|
GH_TOKEN: ${{ steps.token.outputs.token || github.token }}
|
|
116
116
|
PR: ${{ github.event.issue.number }}
|
|
117
117
|
COMMENTER: ${{ github.event.comment.user.login }}
|
|
118
|
+
COMMENT_AT: ${{ github.event.comment.created_at }}
|
|
118
119
|
run: |
|
|
119
120
|
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR")
|
|
120
121
|
role=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$COMMENTER/permission" --jq .role_name)
|
|
121
122
|
head=$(jq -r '.head.repo.full_name // ""' <<< "$pr")
|
|
122
123
|
draft=$(jq -r .draft <<< "$pr")
|
|
123
124
|
state=$(jq -r .state <<< "$pr")
|
|
125
|
+
sha=$(jq -r .head.sha <<< "$pr")
|
|
126
|
+
COMMIT_AT=$(gh api "repos/$GITHUB_REPOSITORY/commits/$sha" --jq .commit.committer.date)
|
|
127
|
+
# A commit pushed after the comment was not seen by the commenter, so it is not reviewed.
|
|
128
|
+
commit_time=$(date -d "$COMMIT_AT" +%s)
|
|
129
|
+
comment_time=$(date -d "$COMMENT_AT" +%s)
|
|
124
130
|
ok=false
|
|
125
|
-
if [ "$head" = "$GITHUB_REPOSITORY" ] && [ "$draft" = false ] && [ "$state" = open ]; then
|
|
131
|
+
if [ "$head" = "$GITHUB_REPOSITORY" ] && [ "$draft" = false ] && [ "$state" = open ] && [ "$commit_time" -le "$comment_time" ]; then
|
|
126
132
|
case "$role" in admin|maintain|write) ok=true ;; esac
|
|
127
133
|
fi
|
|
128
134
|
echo "ok=$ok" >> "$GITHUB_OUTPUT"
|
|
129
|
-
echo "sha=$
|
|
135
|
+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
|
130
136
|
|
|
131
137
|
- name: Acknowledge the request
|
|
132
138
|
if: ${{ github.event_name == 'issue_comment' && steps.pr.outputs.ok == 'true' }}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pecot/workflow-mcp",
|
|
3
|
-
"version": "8.0.1-dev.
|
|
3
|
+
"version": "8.0.1-dev.71",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@pecot/workflow-mcp",
|
|
9
|
-
"version": "8.0.1-dev.
|
|
9
|
+
"version": "8.0.1-dev.71",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/server": "^2.4.0",
|