@pecot/workflow-mcp 8.0.1-dev.58 → 8.0.1-dev.60
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 +1 -0
- package/cli/dist/commands/base-reading.d.ts +1 -1
- package/cli/dist/commands/base-reading.js +1 -1
- package/cli/dist/commands/board-sync.js +1 -1
- package/cli/dist/commands/github-client.d.ts +6 -2
- package/cli/dist/commands/github-client.js +12 -4
- package/cli/dist/commands/issue-comment.js +3 -2
- package/cli/dist/commands/issue-show.js +3 -2
- package/cli/dist/commands/names.js +1 -0
- package/cli/dist/commands/output.d.ts +4 -0
- package/cli/dist/commands/output.js +1 -0
- package/cli/dist/commands/pr-merge.js +3 -2
- package/cli/dist/commands/pr-restack.js +16 -9
- package/cli/dist/commands/pr.js +18 -18
- package/cli/dist/commands/project.js +5 -3
- package/cli/dist/commands/registry.js +2 -0
- package/cli/dist/commands/release.js +8 -8
- package/cli/dist/commands/restack-reading.d.ts +4 -0
- package/cli/dist/commands/restack-reading.js +1 -1
- package/cli/dist/commands/review-finish.d.ts +3 -0
- package/cli/dist/commands/review-finish.js +276 -0
- package/cli/dist/commands/session-finish.js +18 -8
- package/cli/dist/commands/session.js +1 -1
- package/cli/dist/commands/tracker-sync-dependabot.js +1 -1
- package/cli/dist/commands/tracker-sync-security.js +1 -1
- package/cli/dist/commands/worktree.js +4 -3
- package/cli/dist/domain/errors.d.ts +5 -0
- package/cli/dist/domain/errors.js +5 -0
- package/cli/dist/domain/release.d.ts +10 -1
- package/cli/dist/domain/release.js +10 -6
- package/cli/dist/domain/review-finish.d.ts +102 -0
- package/cli/dist/domain/review-finish.js +169 -0
- package/cli/dist/infra/git.d.ts +20 -16
- package/cli/dist/infra/git.js +40 -96
- package/cli/dist/infra/github/client.d.ts +12 -1
- package/cli/dist/infra/github/client.js +49 -16
- package/cli/dist/infra/github/issues.d.ts +4 -0
- package/cli/dist/infra/github/issues.js +6 -0
- package/cli/dist/infra/github/pulls.d.ts +9 -0
- package/cli/dist/infra/github/pulls.js +14 -0
- package/cli/dist/infra/github/repos.d.ts +4 -0
- package/cli/dist/infra/github/repos.js +8 -1
- package/cli/dist/infra/nx-scope.d.ts +5 -1
- package/cli/dist/infra/nx-scope.js +20 -13
- package/cli/dist/infra/process-run.d.ts +57 -0
- package/cli/dist/infra/process-run.js +168 -0
- package/cli/dist/infra/worktree-setup.d.ts +3 -6
- package/cli/dist/infra/worktree-setup.js +8 -26
- package/cli/dist/infra/worktree.d.ts +5 -1
- package/cli/dist/infra/worktree.js +4 -4
- package/cli/dist/mcp/result.d.ts +3 -3
- package/cli/dist/mcp/result.js +4 -3
- package/cli/dist/mcp/serve.d.ts +12 -0
- package/cli/dist/mcp/serve.js +30 -2
- package/cli/dist/mcp/server.d.ts +4 -0
- package/cli/dist/mcp/server.js +14 -6
- package/cli/templates/comment/review-stopped.md +28 -0
- package/cli/templates/workflow/pecot-review.yml +11 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -164,12 +164,16 @@ export interface CreateWorktreeOptions {
|
|
|
164
164
|
使うプロジェクトの設定の名前。省略時は remote のリポを含む設定
|
|
165
165
|
*/
|
|
166
166
|
readonly project?: string | undefined;
|
|
167
|
+
/**
|
|
168
|
+
MCP の要求の取り消し。setup_command を止める
|
|
169
|
+
*/
|
|
170
|
+
readonly signal?: Readonly<AbortSignal> | undefined;
|
|
167
171
|
}
|
|
168
172
|
/**
|
|
169
173
|
ワークツリーを作成する。cwd は対象 Git リポジトリのパス。
|
|
170
174
|
作成に失敗した場合、プロジェクトルート・既存ブランチ衝突・設定の不備は WorktreeRuntimeError
|
|
171
175
|
*/
|
|
172
|
-
export declare function createWorktree(cwd: string, diagnostics: Diagnostics, options?: Readonly<CreateWorktreeOptions>): WorktreeCreateResult
|
|
176
|
+
export declare function createWorktree(cwd: string, diagnostics: Diagnostics, options?: Readonly<CreateWorktreeOptions>): Promise<WorktreeCreateResult>;
|
|
173
177
|
/**
|
|
174
178
|
ワークツリーを削除する。name は worktree add が付けた名前(wtN)か、checkout しているブランチ名。
|
|
175
179
|
WT が見つからない・削除に失敗した場合は WorktreeRuntimeError。
|
|
@@ -362,11 +362,11 @@ function copyUntrackedToWorktree(mainWorktree, worktreePath, spec, symlinkedPath
|
|
|
362
362
|
return copyable.length > 0 ? copyFiles(mainWorktree, worktreePath, copyable) : [];
|
|
363
363
|
}
|
|
364
364
|
// セットアップコマンド実行。優先順位: CLI --setup 明示 > config.setup_command > skip
|
|
365
|
-
function runEffectiveSetup(setupCommand, config, worktreePath, diagnostics) {
|
|
365
|
+
async function runEffectiveSetup(setupCommand, config, worktreePath, diagnostics, signal) {
|
|
366
366
|
const effective = setupCommand ?? config.setup_command;
|
|
367
367
|
if (effective === undefined || effective === '')
|
|
368
368
|
return undefined;
|
|
369
|
-
const result = runSetupCommand(effective, worktreePath, config.setup_command_timeout);
|
|
369
|
+
const result = await runSetupCommand(effective, worktreePath, config.setup_command_timeout, signal);
|
|
370
370
|
if (result.exitCode !== 0) {
|
|
371
371
|
// Python の core と同じ 1 メッセージ。字下げは受け口側が付ける
|
|
372
372
|
const head = result.exitCode === -1 ? `setup command timed out: ${effective}` : `setup command failed (exit ${String(result.exitCode)}): ${effective}`;
|
|
@@ -385,7 +385,7 @@ function runEffectiveSetup(setupCommand, config, worktreePath, diagnostics) {
|
|
|
385
385
|
ワークツリーを作成する。cwd は対象 Git リポジトリのパス。
|
|
386
386
|
作成に失敗した場合、プロジェクトルート・既存ブランチ衝突・設定の不備は WorktreeRuntimeError
|
|
387
387
|
*/
|
|
388
|
-
export function createWorktree(cwd, diagnostics, options = {}) {
|
|
388
|
+
export async function createWorktree(cwd, diagnostics, options = {}) {
|
|
389
389
|
// 1. メインWT検出 & プロジェクトルート
|
|
390
390
|
const mainWorktree = findMainWorktree(cwd);
|
|
391
391
|
const projectRoot = detectProjectRoot(cwd);
|
|
@@ -416,7 +416,7 @@ export function createWorktree(cwd, diagnostics, options = {}) {
|
|
|
416
416
|
? { linkedFiles: [], symlinkedPaths: [] }
|
|
417
417
|
: createWorktreeSymlinks(worktreeConfig, projectRoot, worktreePath, diagnostics);
|
|
418
418
|
const copiedFiles = options.shouldCopy === false ? [] : copyUntrackedToWorktree(mainWorktree, worktreePath, spec, linking.symlinkedPaths);
|
|
419
|
-
const setupResult = runEffectiveSetup(options.setupCommand, worktreeConfig, worktreePath, diagnostics);
|
|
419
|
+
const setupResult = await runEffectiveSetup(options.setupCommand, worktreeConfig, worktreePath, diagnostics, options.signal);
|
|
420
420
|
return { name, path: worktreePath, branch: name, baseBranch, copiedFiles, linkedFiles: linking.linkedFiles, setupResult };
|
|
421
421
|
}
|
|
422
422
|
/**
|
package/cli/dist/mcp/result.d.ts
CHANGED
|
@@ -46,9 +46,9 @@ export interface CollectedIo {
|
|
|
46
46
|
readonly warnings: () => readonly string[];
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
stdout・stderr に書かれた文字列と、失敗の原因の名前、最初の結果の行、項目、warning の文を集める io
|
|
49
|
+
stdout・stderr に書かれた文字列と、失敗の原因の名前、最初の結果の行、項目、warning の文を集める io。signal は io にそのまま渡す
|
|
50
50
|
*/
|
|
51
|
-
export declare function collectIo(): CollectedIo;
|
|
51
|
+
export declare function collectIo(signal?: Readonly<AbortSignal>): CollectedIo;
|
|
52
52
|
/**
|
|
53
53
|
ツールの項目と並べて structuredContent の最上位に置く、全ツールに共通の 4 項目
|
|
54
54
|
*/
|
|
@@ -102,7 +102,7 @@ export declare function toToolResult(outcome: Readonly<CommandOutcome>): CallToo
|
|
|
102
102
|
*/
|
|
103
103
|
export declare function toRejectedResult(message: string): CallToolResult;
|
|
104
104
|
/**
|
|
105
|
-
中断(notifications/cancelled
|
|
105
|
+
中断(notifications/cancelled か接続の切断)で、本体を呼ばなかったか途中で止めた結果。応答はクライアントに届かない
|
|
106
106
|
*/
|
|
107
107
|
export declare function toAbortedResult(): CallToolResult;
|
|
108
108
|
//# sourceMappingURL=result.d.ts.map
|
package/cli/dist/mcp/result.js
CHANGED
|
@@ -5,9 +5,9 @@ import { z } from 'zod';
|
|
|
5
5
|
import { WARNING_PREFIX } from '../commands/output.js';
|
|
6
6
|
import { USAGE_EXIT_CODE } from '../commands/usage-error.js';
|
|
7
7
|
/**
|
|
8
|
-
stdout・stderr に書かれた文字列と、失敗の原因の名前、最初の結果の行、項目、warning の文を集める io
|
|
8
|
+
stdout・stderr に書かれた文字列と、失敗の原因の名前、最初の結果の行、項目、warning の文を集める io。signal は io にそのまま渡す
|
|
9
9
|
*/
|
|
10
|
-
export function collectIo() {
|
|
10
|
+
export function collectIo(signal) {
|
|
11
11
|
const out = [];
|
|
12
12
|
const error = [];
|
|
13
13
|
let failureKind;
|
|
@@ -24,6 +24,7 @@ export function collectIo() {
|
|
|
24
24
|
error.push(text);
|
|
25
25
|
},
|
|
26
26
|
surface: 'mcp',
|
|
27
|
+
...(signal !== undefined && { signal }),
|
|
27
28
|
failureKind: (kind) => {
|
|
28
29
|
failureKind ??= kind;
|
|
29
30
|
},
|
|
@@ -164,7 +165,7 @@ export function toRejectedResult(message) {
|
|
|
164
165
|
return toToolResult({ exitCode: USAGE_EXIT_CODE, stdout: '', stderr: '', kind: 'invalid-input', message });
|
|
165
166
|
}
|
|
166
167
|
/**
|
|
167
|
-
中断(notifications/cancelled
|
|
168
|
+
中断(notifications/cancelled か接続の切断)で、本体を呼ばなかったか途中で止めた結果。応答はクライアントに届かない
|
|
168
169
|
*/
|
|
169
170
|
export function toAbortedResult() {
|
|
170
171
|
return toToolResult({ exitCode: 1, stdout: '', stderr: '', kind: 'aborted', message: 'cancelled' });
|
package/cli/dist/mcp/serve.d.ts
CHANGED
|
@@ -13,7 +13,19 @@ export interface WritableTarget {
|
|
|
13
13
|
stdout を JSON-RPC 専用にする。返した Writable だけが本物の stdout へ届き、ほかの書き込みは stderr へ逃がす。同じ stdout に対しては冪等
|
|
14
14
|
*/
|
|
15
15
|
export declare function installStdoutGuard(stdout: WritableTarget, stderr: WritableTarget): Writable;
|
|
16
|
+
/**
|
|
17
|
+
SIGTERM / SIGINT / 'exit' の配線先。既定は process 本体で、テストはフェイクを渡す
|
|
18
|
+
*/
|
|
19
|
+
export interface ProcessSignals {
|
|
20
|
+
on(event: 'SIGTERM' | 'SIGINT' | 'exit', listener: () => void): void;
|
|
21
|
+
exit(code: number): void;
|
|
22
|
+
}
|
|
16
23
|
export interface McpServeDependencies {
|
|
24
|
+
/**
|
|
25
|
+
終了時の後始末。別のプロセスグループで待っている子は、サーバが終わっても残るので止める
|
|
26
|
+
*/
|
|
27
|
+
readonly onShutdown: readonly (() => void)[];
|
|
28
|
+
readonly signals: ProcessSignals;
|
|
17
29
|
/**
|
|
18
30
|
options.unavailableReason があるとき、サーバはどのツールの呼び出しにもその理由を返す(対象のリポを決められなかったとき)
|
|
19
31
|
*/
|
package/cli/dist/mcp/serve.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// `pecot mcp` の実装。cli.ts が dynamic import で読む。stdout は JSON-RPC 専用にし、stdin が閉じたら接続を閉じる。
|
|
2
|
-
// pecot-tools の serve.ts
|
|
2
|
+
// pecot-tools の serve.ts と骨格が同じ。終了のときは、待っている子プロセス(runProcess)を止める。
|
|
3
3
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types -- 引数は Node の stream。mutable な型でしか公開されていない */
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
5
|
import { StdioServerTransport, serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
6
6
|
import { setChildStdin } from '../infra/child-stdin.js';
|
|
7
|
+
import { killRunningProcesses } from '../infra/process-run.js';
|
|
7
8
|
import { createOutput } from '../commands/output.js';
|
|
8
9
|
import { UNDETERMINED_PREFIX, resolveSessionDirectory, unusableReason } from './session-directory.js';
|
|
9
10
|
import { createMcpServer } from './server.js';
|
|
@@ -63,6 +64,26 @@ export function installStdoutGuard(stdout, stderr) {
|
|
|
63
64
|
installedGuards.set(stdout, protocolStdout);
|
|
64
65
|
return protocolStdout;
|
|
65
66
|
}
|
|
67
|
+
const SIGTERM_EXIT_CODE = 143;
|
|
68
|
+
const SIGINT_EXIT_CODE = 130;
|
|
69
|
+
function runShutdown(dependencies) {
|
|
70
|
+
for (const hook of dependencies.onShutdown)
|
|
71
|
+
hook();
|
|
72
|
+
}
|
|
73
|
+
// SIGTERM / SIGINT は既定の即終了が無効になるので、明示的に exit する
|
|
74
|
+
function installShutdownHandlers(dependencies) {
|
|
75
|
+
dependencies.signals.on('SIGTERM', () => {
|
|
76
|
+
runShutdown(dependencies);
|
|
77
|
+
dependencies.signals.exit(SIGTERM_EXIT_CODE);
|
|
78
|
+
});
|
|
79
|
+
dependencies.signals.on('SIGINT', () => {
|
|
80
|
+
runShutdown(dependencies);
|
|
81
|
+
dependencies.signals.exit(SIGINT_EXIT_CODE);
|
|
82
|
+
});
|
|
83
|
+
dependencies.signals.on('exit', () => {
|
|
84
|
+
runShutdown(dependencies);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
66
87
|
function messageOf(error) {
|
|
67
88
|
return error instanceof Error ? error.message : String(error);
|
|
68
89
|
}
|
|
@@ -74,6 +95,7 @@ export function runMcpServe(dependencies) {
|
|
|
74
95
|
const protocolStdout = dependencies.installStdoutGuard();
|
|
75
96
|
const transport = dependencies.createTransport(dependencies.stdin, protocolStdout);
|
|
76
97
|
const reportError = reportTo(dependencies.stderr);
|
|
98
|
+
installShutdownHandlers(dependencies);
|
|
77
99
|
// 接続とインスタンスの onerror に同じ Error が流れるので、1 回だけ報告する
|
|
78
100
|
const report = (error) => {
|
|
79
101
|
if (reportedErrors.has(error))
|
|
@@ -88,9 +110,13 @@ export function runMcpServe(dependencies) {
|
|
|
88
110
|
if (collected.stderr !== '')
|
|
89
111
|
reportError(`stderr so far: ${collected.stderr}`);
|
|
90
112
|
};
|
|
113
|
+
const reportCancelled = (reason) => {
|
|
114
|
+
// eslint-disable-next-line no-restricted-syntax -- 取り消しの理由の記録。失敗ではないので error の行にしない
|
|
115
|
+
dependencies.stderr.write(`cancelled: ${reason}\n`);
|
|
116
|
+
};
|
|
91
117
|
const handle = serveStdio(() => {
|
|
92
118
|
try {
|
|
93
|
-
const server = dependencies.createServer({ reportUnexpected });
|
|
119
|
+
const server = dependencies.createServer({ reportUnexpected, reportCancelled });
|
|
94
120
|
// eslint-disable-next-line unicorn/prefer-add-event-listener -- SDK の Protocol は onerror 経由で通知する
|
|
95
121
|
server.server.onerror = report;
|
|
96
122
|
return server;
|
|
@@ -118,6 +144,8 @@ export function defaultDependencies() {
|
|
|
118
144
|
return {
|
|
119
145
|
createServer: options => createMcpServer(undefined, options),
|
|
120
146
|
createTransport: (stdin, stdout) => new StdioServerTransport(stdin, stdout),
|
|
147
|
+
onShutdown: [killRunningProcesses],
|
|
148
|
+
signals: process,
|
|
121
149
|
/* v8 ignore next -- 実 process.stdout を差し替えるので、単体テストからは起動しない(ガード本体は偽の stream で確かめる) */
|
|
122
150
|
installStdoutGuard: () => installStdoutGuard(process.stdout, process.stderr),
|
|
123
151
|
stdin: process.stdin,
|
package/cli/dist/mcp/server.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export interface McpServerOptions {
|
|
|
13
13
|
readonly stdout: string;
|
|
14
14
|
readonly stderr: string;
|
|
15
15
|
}) => void;
|
|
16
|
+
/**
|
|
17
|
+
要求の取り消しでコマンドを止めたとき、その理由を伝える先(仕様が理由の記録を求める)
|
|
18
|
+
*/
|
|
19
|
+
readonly reportCancelled?: (reason: string) => void;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
MCP サーバを作り、commands のそれぞれをツールとして登録する。名前は toolName、説明は description、並びは commands の順
|
package/cli/dist/mcp/server.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types -- zod と SDK の型は readonly にできない */
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/server';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { InvalidValueError } from '../domain/errors.js';
|
|
5
|
+
import { CancelledError, InvalidValueError } from '../domain/errors.js';
|
|
6
6
|
import { parseOwnerRepository } from '../domain/repository-resolver.js';
|
|
7
7
|
import { resolveApiUrlOverride } from '../infra/github/client.js';
|
|
8
|
+
import { cancelledBy } from '../infra/process-run.js';
|
|
8
9
|
import { usageOf, withUsage } from '../commands/command-binding.js';
|
|
9
10
|
import { createOutput } from '../commands/output.js';
|
|
10
11
|
import { exitCodeOfFailure } from '../commands/failure.js';
|
|
@@ -83,7 +84,7 @@ function unexpectedMessage(error) {
|
|
|
83
84
|
async function invoke(definition, raw, options, signal) {
|
|
84
85
|
if (options.unavailableReason !== undefined)
|
|
85
86
|
return unavailableResult(options.unavailableReason);
|
|
86
|
-
const collected = collectIo();
|
|
87
|
+
const collected = collectIo(signal);
|
|
87
88
|
// interface-env: TERMINAL_WIDTH COLUMNS
|
|
88
89
|
const width = outputWidth(process.env, undefined);
|
|
89
90
|
let exitCode;
|
|
@@ -94,13 +95,17 @@ async function invoke(definition, raw, options, signal) {
|
|
|
94
95
|
if (preparation.kind === 'rejected')
|
|
95
96
|
return toRejectedResult(preparation.message);
|
|
96
97
|
try {
|
|
97
|
-
exitCode = await preparation.command.run(
|
|
98
|
+
exitCode = await preparation.command.run(collected.io);
|
|
98
99
|
}
|
|
99
100
|
catch (error) {
|
|
100
101
|
throw withUsage(error, usageOf(definition));
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
catch (error) {
|
|
105
|
+
if (error instanceof CancelledError) {
|
|
106
|
+
options.reportCancelled?.(error.message);
|
|
107
|
+
return toAbortedResult();
|
|
108
|
+
}
|
|
104
109
|
// 使い方の誤りは枠で出すので、error の行の代わりに例外の文の 1 行目を message にする
|
|
105
110
|
if (error instanceof UsageError)
|
|
106
111
|
message = error.message.split('\n', 1)[0];
|
|
@@ -149,14 +154,17 @@ function partialData(definition, raw, stdout, stderr, options) {
|
|
|
149
154
|
}
|
|
150
155
|
// コマンドは process.cwd()(起動のときに serve.ts が決めたセッションのディレクトリ)と .pecot/ の状態ファイルを読み書きするので、呼び出しは 1 件ずつ実行する。接続が複数あっても共有する
|
|
151
156
|
const sequence = { tail: Promise.resolve(true) };
|
|
152
|
-
async function inSequence(signal, task) {
|
|
157
|
+
async function inSequence(signal, options, task) {
|
|
153
158
|
const previous = sequence.tail;
|
|
154
159
|
const turn = Promise.withResolvers();
|
|
155
160
|
sequence.tail = turn.promise;
|
|
156
161
|
await previous;
|
|
157
162
|
try {
|
|
158
163
|
// 待っている間に中断(notifications/cancelled)か接続の切断があれば、本体を呼ばない。応答は届かない
|
|
159
|
-
|
|
164
|
+
if (!signal.aborted)
|
|
165
|
+
return await task();
|
|
166
|
+
options.reportCancelled?.(cancelledBy(signal).message);
|
|
167
|
+
return toAbortedResult();
|
|
160
168
|
}
|
|
161
169
|
finally {
|
|
162
170
|
turn.resolve(true);
|
|
@@ -168,7 +176,7 @@ MCP サーバを作り、commands のそれぞれをツールとして登録す
|
|
|
168
176
|
export function createMcpServer(commands = COMMANDS, options = {}) {
|
|
169
177
|
const server = new McpServer({ name: MCP_SERVER_NAME, version: readVersion() });
|
|
170
178
|
for (const definition of commands) {
|
|
171
|
-
server.registerTool(definition.toolName, { description: definition.description, inputSchema: passthroughSchema(definition), outputSchema: standardOutputSchema(toolOutputSchema(definition.output)) }, async (arguments_, serverContext) => await inSequence(serverContext.mcpReq.signal, async () => await invoke(definition, arguments_, options, serverContext.mcpReq.signal)));
|
|
179
|
+
server.registerTool(definition.toolName, { description: definition.description, inputSchema: passthroughSchema(definition), outputSchema: standardOutputSchema(toolOutputSchema(definition.output)) }, async (arguments_, serverContext) => await inSequence(serverContext.mcpReq.signal, options, async () => await invoke(definition, arguments_, options, serverContext.mcpReq.signal)));
|
|
172
180
|
}
|
|
173
181
|
return server;
|
|
174
182
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
template: review-stopped
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
読者: 自動レビューが止まった PR の作者。止まった理由と、続きを進める手順を読む。末尾の「例:」の形になる。
|
|
7
|
+
|
|
8
|
+
書き方:
|
|
9
|
+
- この本文は `pecot review finish` が埋めて PR に投稿する。エージェントも人も、手で書かない
|
|
10
|
+
- 結果は `failed`・`limit`・`setup-missing` のどれかにする。レビューを終えたとき(`reviewed`)は投稿しない
|
|
11
|
+
- 止まった場所は「指摘を投稿する前」「インラインコメントを投稿した後」「分からない」のどれかにする
|
|
12
|
+
- トークンの値と secret の値を書かない
|
|
13
|
+
- 末尾に、同じ実行で 2 度投稿しないための目印のコメントの行が付く
|
|
14
|
+
|
|
15
|
+
例:
|
|
16
|
+
|
|
17
|
+
## Review stopped — 自動レビューがターンか時間の上限で止まった
|
|
18
|
+
|
|
19
|
+
- 結果 — `limit`(ターンか時間の上限で止まった)
|
|
20
|
+
- 止まった場所 — インラインコメントを投稿した後(指摘の一覧はまだ無い)
|
|
21
|
+
- 次にすること — 大きな PR は、端末で `/pecot-w:w-revise` を回す。自動で回すなら、変数 `PECOT_REVIEW_MAX_TURNS`・`PECOT_REVIEW_TIMEOUT_MINUTES` で上限を上げる。その後、PR に `@pecotbot review` とコメントして起動し直す
|
|
22
|
+
-->
|
|
23
|
+
|
|
24
|
+
## Review stopped — <止まった理由を1行で>
|
|
25
|
+
|
|
26
|
+
- 結果 — <結果>
|
|
27
|
+
- 止まった場所 — <止まった場所>
|
|
28
|
+
- 次にすること — <次にすること>
|
|
@@ -90,6 +90,11 @@ jobs:
|
|
|
90
90
|
PECOT_REVIEW_EXTRA_ALLOWED_TOOLS: ""
|
|
91
91
|
# pecot-review:allowed-tools:end
|
|
92
92
|
steps:
|
|
93
|
+
# The finish step names where the review stopped from the inline comments posted after this time.
|
|
94
|
+
- name: Record the start time
|
|
95
|
+
id: start
|
|
96
|
+
run: echo "time=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
|
|
97
|
+
|
|
93
98
|
- name: Generate GitHub App token
|
|
94
99
|
id: token
|
|
95
100
|
if: ${{ vars.PECOT_AGENT_APP_CLIENT_ID != '' }}
|
|
@@ -174,7 +179,7 @@ jobs:
|
|
|
174
179
|
claude_args: >-
|
|
175
180
|
--permission-mode default
|
|
176
181
|
--max-turns ${{ vars.PECOT_REVIEW_MAX_TURNS || '60' }}
|
|
177
|
-
--allowedTools "Read,Glob,Grep,mcp__plugin_pecot-w_pecot-workflow__pr_show,mcp__plugin_pecot-w_pecot-workflow__issue_show,mcp__plugin_pecot-w_pecot-workflow__pr_restack,mcp__plugin_pecot-w_pecot-workflow__issue_comment,mcp__plugin_pecot-w_pecot-
|
|
182
|
+
--allowedTools "Read,Glob,Grep,mcp__plugin_pecot-w_pecot-workflow__pr_show,mcp__plugin_pecot-w_pecot-workflow__issue_show,mcp__plugin_pecot-w_pecot-workflow__pr_restack,mcp__plugin_pecot-w_pecot-workflow__issue_comment,mcp__plugin_pecot-w_pecot-workflow__review_finish,mcp__github_inline_comment__create_inline_comment${{ env.PECOT_REVIEW_EXTRA_ALLOWED_TOOLS != '' && format(',{0}', env.PECOT_REVIEW_EXTRA_ALLOWED_TOOLS) || '' }}"
|
|
178
183
|
--disallowedTools "Bash,Edit,Write,NotebookEdit,AskUserQuestion,Agent,WebFetch,WebSearch"
|
|
179
184
|
|
|
180
185
|
# The dist-tag after the package name decides the version. @latest is the newest release,
|
|
@@ -189,8 +194,12 @@ jobs:
|
|
|
189
194
|
REVIEW_CONCLUSION: ${{ steps.claude.outputs.conclusion }}
|
|
190
195
|
# Pass only whether the action got a token, never the token itself.
|
|
191
196
|
REVIEW_HAS_TOKEN: ${{ steps.claude.outputs.github_token != '' }}
|
|
197
|
+
EXECUTION_FILE: ${{ steps.claude.outputs.execution_file }}
|
|
198
|
+
REVIEW_STARTED_AT: ${{ steps.start.outputs.time }}
|
|
199
|
+
PECOT_REVIEW_TRIGGER_PHRASE: ${{ vars.PECOT_REVIEW_TRIGGER_PHRASE }}
|
|
192
200
|
PECOT_GITHUB_COM_TOKEN: ${{ steps.token.outputs.token || github.token }}
|
|
193
201
|
run: >-
|
|
194
|
-
npx -y --prefix=/ @pecot/workflow-mcp@latest
|
|
202
|
+
npx -y --prefix=/ @pecot/workflow-mcp@latest review finish "$GITHUB_REPOSITORY/$PR" --ensure
|
|
195
203
|
--job-status "$JOB_STATUS" --review-outcome "$REVIEW_OUTCOME"
|
|
196
204
|
--review-conclusion "$REVIEW_CONCLUSION" --review-has-token "$REVIEW_HAS_TOKEN"
|
|
205
|
+
--execution-file "$EXECUTION_FILE" --since "$REVIEW_STARTED_AT"
|
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.60",
|
|
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.60",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/server": "^2.4.0",
|