@pecot/workflow-mcp 8.0.1-dev.59 → 8.0.1-dev.61
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/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/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 +85 -15
- package/cli/dist/commands/pr.js +18 -18
- package/cli/dist/commands/project.js +5 -3
- 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/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/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/pulls.d.ts +4 -0
- package/cli/dist/infra/github/pulls.js +6 -0
- 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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ export interface BaseQuery {
|
|
|
16
16
|
/**
|
|
17
17
|
求める前に一度だけ呼ぶ。pr restack が追跡参照を新しくするのに使う
|
|
18
18
|
*/
|
|
19
|
-
readonly beforeInfer?: (() => void) | undefined;
|
|
19
|
+
readonly beforeInfer?: (() => Promise<void> | void) | undefined;
|
|
20
20
|
}
|
|
21
21
|
export interface BaseResult {
|
|
22
22
|
readonly reading: BaseReading;
|
|
@@ -32,7 +32,7 @@ async function inferBase(query) {
|
|
|
32
32
|
const developBranch = getDevelopBranch(config, issue.repository.owner, issue.repository.repository);
|
|
33
33
|
if (developBranch === undefined || developBranch === '')
|
|
34
34
|
return notInferred(undefined, undefined);
|
|
35
|
-
query.beforeInfer?.();
|
|
35
|
+
await query.beforeInfer?.();
|
|
36
36
|
let readiness;
|
|
37
37
|
try {
|
|
38
38
|
readiness = await readIssueReadinessIfSupported(project.client(), config, issue, createReadinessCache());
|
|
@@ -64,7 +64,7 @@ const boardSyncCommand = defineCommand({
|
|
|
64
64
|
run: async (input, io) => {
|
|
65
65
|
const out = createOutput(input.dry_run, io);
|
|
66
66
|
const config = requireBoardConfig(out, input.project, ['board', 'sync']);
|
|
67
|
-
const client = makeClient(out, config);
|
|
67
|
+
const client = await makeClient(out, config);
|
|
68
68
|
const before = await client.getGraphqlRateLimit();
|
|
69
69
|
let read;
|
|
70
70
|
try {
|
|
@@ -2,15 +2,19 @@ import type { ProjectConfig } from '../domain/config.js';
|
|
|
2
2
|
import { GitHubClient } from '../infra/github/index.js';
|
|
3
3
|
import type { Output } from './output.js';
|
|
4
4
|
/**
|
|
5
|
-
host 向けのクライアントを作る。host が undefined
|
|
5
|
+
host 向けのクライアントを作る。host が undefined なら既定のホスト。環境にトークンが無いときは、最初の要求の前に gh auth token を読む
|
|
6
6
|
*/
|
|
7
7
|
export declare function createGitHubClient(out: Readonly<Output>, host: string | undefined): GitHubClient;
|
|
8
8
|
/**
|
|
9
|
+
createGitHubClient で作り、トークンまで読み終えたクライアントを返す。認証の失敗(GitHubAuthError)を、最初の要求の失敗と分けて出すときに使う
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAuthenticatedGitHubClient(out: Readonly<Output>, host: string | undefined): Promise<GitHubClient>;
|
|
12
|
+
/**
|
|
9
13
|
GitHub の失敗(GitHubAPIError と、接続の失敗の TransportFailure)なら、その文を返す。それ以外は投げ直す
|
|
10
14
|
*/
|
|
11
15
|
export declare function apiFailureMessage(error: unknown): string;
|
|
12
16
|
/**
|
|
13
17
|
クライアントを作る。認証などの失敗は error の行にして終了コード 1 で止める
|
|
14
18
|
*/
|
|
15
|
-
export declare function makeClient(out: Readonly<Output>, config: Readonly<ProjectConfig>): GitHubClient
|
|
19
|
+
export declare function makeClient(out: Readonly<Output>, config: Readonly<ProjectConfig>): Promise<GitHubClient>;
|
|
16
20
|
//# sourceMappingURL=github-client.d.ts.map
|
|
@@ -4,10 +4,18 @@ import { GitHubAPIError } from '../infra/github/errors.js';
|
|
|
4
4
|
import { stopWith } from './command-stop.js';
|
|
5
5
|
import { kindOfFailure } from './failure.js';
|
|
6
6
|
/**
|
|
7
|
-
host 向けのクライアントを作る。host が undefined
|
|
7
|
+
host 向けのクライアントを作る。host が undefined なら既定のホスト。環境にトークンが無いときは、最初の要求の前に gh auth token を読む
|
|
8
8
|
*/
|
|
9
9
|
export function createGitHubClient(out, host) {
|
|
10
|
-
return new GitHubClient({ host, diagnostics: out });
|
|
10
|
+
return new GitHubClient({ host, diagnostics: out, signal: out.signal });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
createGitHubClient で作り、トークンまで読み終えたクライアントを返す。認証の失敗(GitHubAuthError)を、最初の要求の失敗と分けて出すときに使う
|
|
14
|
+
*/
|
|
15
|
+
export async function createAuthenticatedGitHubClient(out, host) {
|
|
16
|
+
const client = createGitHubClient(out, host);
|
|
17
|
+
await client.ensureToken();
|
|
18
|
+
return client;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
GitHub の失敗(GitHubAPIError と、接続の失敗の TransportFailure)なら、その文を返す。それ以外は投げ直す
|
|
@@ -20,9 +28,9 @@ export function apiFailureMessage(error) {
|
|
|
20
28
|
/**
|
|
21
29
|
クライアントを作る。認証などの失敗は error の行にして終了コード 1 で止める
|
|
22
30
|
*/
|
|
23
|
-
export function makeClient(out, config) {
|
|
31
|
+
export async function makeClient(out, config) {
|
|
24
32
|
try {
|
|
25
|
-
return
|
|
33
|
+
return await createAuthenticatedGitHubClient(out, config.host);
|
|
26
34
|
}
|
|
27
35
|
catch (error) {
|
|
28
36
|
if (!(error instanceof GitHubAPIError))
|
|
@@ -18,7 +18,7 @@ import { defineCommand, CommandExit } from './command-definition.js';
|
|
|
18
18
|
import { commandHint, hinted, inputNameHint, placeholder } from './command-hint.js';
|
|
19
19
|
import { stopWith, requireConfigFor, PROJECT_INPUT } from './command-stop.js';
|
|
20
20
|
import { kindOfFailure } from './failure.js';
|
|
21
|
-
import { createGitHubClient } from './github-client.js';
|
|
21
|
+
import { createAuthenticatedGitHubClient, createGitHubClient } from './github-client.js';
|
|
22
22
|
import { COMMENT_VALIDATION_EXIT_CODE, hasReportedTemplateViolations, issuePath, parseIssueReferenceOrExit, runWithExit, } from './issue-shared.js';
|
|
23
23
|
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
24
24
|
const TEMPLATE_SCHEMA = z.enum(['plan', 'merge-diff', 'review-findings', 'review-resolution', 'precede-notify']);
|
|
@@ -183,7 +183,8 @@ async function postDirect(output, project, repository, issueReference, message,
|
|
|
183
183
|
output.planned({ verb: 'create', target: `comment on ${issuePath(target.owner, target.repository, target.number)}` });
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
// 認証の失敗を、コメントを作れない文に包まないため
|
|
187
|
+
await createComment(output, await createAuthenticatedGitHubClient(output, config.host), target, message);
|
|
187
188
|
}
|
|
188
189
|
const COMMENT_PATH = ['issue', 'comment'];
|
|
189
190
|
const ISSUE_COMMENT = defineCommand({
|
|
@@ -8,7 +8,7 @@ import { DependenciesUnsupportedError, GitHubAPIError } from '../infra/github/er
|
|
|
8
8
|
import { defineCommand } from './command-definition.js';
|
|
9
9
|
import { stopWith, requireConfigFor, PROJECT_INPUT } from './command-stop.js';
|
|
10
10
|
import { kindOfFailure } from './failure.js';
|
|
11
|
-
import {
|
|
11
|
+
import { createAuthenticatedGitHubClient } from './github-client.js';
|
|
12
12
|
import { ISSUE_REF_DESCRIPTION, issuePath, parseIssueReferenceOrExit, runWithExit } from './issue-shared.js';
|
|
13
13
|
import { blockedByReadCount, createReadinessCache, judgeSnapshot, READINESS_JSON, readIssueReadiness, readinessJson, snapshotWithoutPrerequisites } from './issue-readiness.js';
|
|
14
14
|
import { createOutput } from './output.js';
|
|
@@ -220,7 +220,8 @@ const ISSUE_SHOW = defineCommand({
|
|
|
220
220
|
const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
|
|
221
221
|
const { config } = requireConfigFor(output, { owner, repository }, input.project, ['issue', 'show']);
|
|
222
222
|
let issue;
|
|
223
|
-
|
|
223
|
+
// 認証の失敗を、Issue を読めない文に包まないため
|
|
224
|
+
const client = await createAuthenticatedGitHubClient(output, config.host);
|
|
224
225
|
try {
|
|
225
226
|
issue = await client.getIssueSlim(owner, repository, number, input.comment_limit);
|
|
226
227
|
}
|
|
@@ -68,6 +68,10 @@ export interface Output<D extends object = Record<string, unknown>> {
|
|
|
68
68
|
dry-run のときは dryRun: true を重ねるので、output に DRY_RUN_FIELD を置く
|
|
69
69
|
*/
|
|
70
70
|
result(fields: Readonly<Partial<D>>): void;
|
|
71
|
+
/**
|
|
72
|
+
io の signal(MCP の要求の取り消し)。CLI では undefined
|
|
73
|
+
*/
|
|
74
|
+
readonly signal: Readonly<AbortSignal> | undefined;
|
|
71
75
|
}
|
|
72
76
|
/**
|
|
73
77
|
warning の行の前置き。MCP の側はこれで stderr から warning の文を拾う
|
|
@@ -8,7 +8,7 @@ import { GitHubAPIError, GitHubNotFoundError } from '../infra/github/errors.js';
|
|
|
8
8
|
import { PROJECT_INPUT, requireConfigFor, stopWith } from './command-stop.js';
|
|
9
9
|
import { defineCommand } from './command-definition.js';
|
|
10
10
|
import { kindOfFailure } from './failure.js';
|
|
11
|
-
import {
|
|
11
|
+
import { createAuthenticatedGitHubClient } from './github-client.js';
|
|
12
12
|
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
13
13
|
import { parseReference, PR_REFERENCE_DESCRIPTION } from './pr-reference.js';
|
|
14
14
|
// 要求を送らずに止める(ドラフト、閉じている、スタックの最下段でない)
|
|
@@ -209,7 +209,8 @@ export const PR_MERGE_COMMAND = defineCommand({
|
|
|
209
209
|
const out = createOutput(input.dry_run, io);
|
|
210
210
|
const target = parseReference(input.pr_ref, input.repo, out);
|
|
211
211
|
const config = requireConfigFor(out, target, input.project, ['pr', 'merge']).config;
|
|
212
|
-
|
|
212
|
+
// 認証の失敗を、PR を読めない文に包まないため
|
|
213
|
+
const client = await createAuthenticatedGitHubClient(out, config.host);
|
|
213
214
|
const name = `PR #${String(target.number)}`;
|
|
214
215
|
const pullRequest = await readPullRequest(out, client, target);
|
|
215
216
|
checkState(out, name, pullRequest);
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { describeApiError } from '../domain/api-error-detail.js';
|
|
5
5
|
import { getDevelopBranch } from '../domain/config.js';
|
|
6
|
-
import { FORCE_PUSH_COMMAND } from '../domain/pull-request.js';
|
|
6
|
+
import { extractClosingIssueNumbers, FORCE_PUSH_COMMAND } from '../domain/pull-request.js';
|
|
7
7
|
import { describeGone, describeRestackCheck, RESTACK_PATH } from '../domain/restack.js';
|
|
8
8
|
import { FLAG_PECOT_RESTACK, formatRestackProgress, interpretRestackProgress } from '../domain/state.js';
|
|
9
9
|
import { abortRebase, conflictedFiles, continueRebase, fetchRemote, forkPoint, gitStdout, hasSameTree, isAncestor, isRebaseInProgress, mergeBase, PUSH_TIMEOUT_MILLISECONDS, pushWithLease, rebaseOnto, remoteOnlyChanges, resetHardTo, resolveCommit, } from '../infra/git.js';
|
|
10
|
+
import { findConfigFor } from '../infra/config-store.js';
|
|
10
11
|
import { readBaseRecord, readFlag, removeFlag, writeBaseRecord, writeFlag } from '../infra/state-store.js';
|
|
11
12
|
import { defineCommand } from './command-definition.js';
|
|
12
13
|
import { commandHint, hinted } from './command-hint.js';
|
|
13
14
|
import { PROJECT_INPUT, requireConfigFor, stopWith } from './command-stop.js';
|
|
14
15
|
import { kindOfFailure } from './failure.js';
|
|
15
|
-
import { createGitHubClient } from './github-client.js';
|
|
16
|
+
import { apiFailureMessage, createGitHubClient } from './github-client.js';
|
|
16
17
|
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
17
|
-
import { stopOnMalformedRecord, validatePullRequestContext } from './pr.js';
|
|
18
|
+
import { primaryRemote, stopOnMalformedRecord, validatePullRequestContext } from './pr.js';
|
|
18
19
|
import { readRestackDecision } from './restack-reading.js';
|
|
19
20
|
import { readBaseOrInfer, warnUnresolved } from './base-reading.js';
|
|
20
21
|
import { USAGE_EXIT_CODE } from './usage-error.js';
|
|
@@ -31,6 +32,7 @@ const PR_RESTACK_OUTPUT = z.strictObject({
|
|
|
31
32
|
pullRequest: z.int().optional().describe('Merged PR of the lower branch (only when the cause is base-merged)'),
|
|
32
33
|
pushed: z.boolean().optional().describe('Whether the branch was pushed (only when restacked)'),
|
|
33
34
|
conflicts: z.array(z.string()).optional().describe('Files with conflicts (only on conflict)'),
|
|
35
|
+
relinked: z.int().optional().describe('Open PR whose body was saved again so that GitHub links its closing Issues (only after a restack onto the develop branch)'),
|
|
34
36
|
dryRun: DRY_RUN_FIELD,
|
|
35
37
|
});
|
|
36
38
|
const RestackInputSchema = z.strictObject({
|
|
@@ -79,10 +81,6 @@ function describePushFailure(push, remote, branch) {
|
|
|
79
81
|
case 'timed-out': {
|
|
80
82
|
return hinted `push timed out after ${String(PUSH_TIMEOUT_MILLISECONDS / MILLISECONDS_PER_SECOND)} seconds\n${unchanged}\npush the branch yourself: ${FORCE_PUSH_COMMAND} ${remote} ${branch}\nthen run: ${commandHint(RESTACK_PATH)}`;
|
|
81
83
|
}
|
|
82
|
-
case 'cancelled': {
|
|
83
|
-
// MCP の取り消しには応答が送られない。誰にも届かないが、記録を書かずに止める扱いとして持つ
|
|
84
|
-
return hinted `push was cancelled\n${unchanged}\nrun again: ${commandHint(RESTACK_PATH)}`;
|
|
85
|
-
}
|
|
86
84
|
case 'rejected': {
|
|
87
85
|
return hinted `push was rejected: ${push.stderr.trim()}\n${unchanged}\nrun again: ${commandHint(RESTACK_PATH)}`;
|
|
88
86
|
}
|
|
@@ -101,7 +99,15 @@ async function finishRestack(out, cwd, progress, signal) {
|
|
|
101
99
|
if (isSynced)
|
|
102
100
|
resetHardTo(cwd, remoteBranch);
|
|
103
101
|
else if (leaseSha !== undefined) {
|
|
104
|
-
|
|
102
|
+
let push;
|
|
103
|
+
try {
|
|
104
|
+
push = await pushWithLease(cwd, remote, branch, leaseSha, { signal });
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
// 取り消しでも、記録を書かずに途中の記録を消して止める
|
|
108
|
+
removeFlag(FLAG_PECOT_RESTACK);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
105
111
|
if (!push.pushed) {
|
|
106
112
|
removeFlag(FLAG_PECOT_RESTACK);
|
|
107
113
|
stopWith(out, describePushFailure(push, remote, branch), 'git-unresolved');
|
|
@@ -113,6 +119,54 @@ async function finishRestack(out, cwd, progress, signal) {
|
|
|
113
119
|
out.result({ branch, base: ontoBranch, outcome: isSynced ? 'synced' : 'restacked', ...!isSynced && { pushed: leaseSha !== undefined } });
|
|
114
120
|
out.done({ verb: 'update', target: isSynced ? `${branch} synced with ${remoteBranch}` : `${branch} restacked on ${ontoBranch}` });
|
|
115
121
|
}
|
|
122
|
+
const RELINK_TARGET = 'to its closing Issues';
|
|
123
|
+
// 本文の Closes のうち、まだリンクになっていないものがあるか。GitHub がリンクにするのは、既定のブランチに向いた PR だけ
|
|
124
|
+
function hasUnlinkedClosingIssues(pullRequest, target) {
|
|
125
|
+
if (pullRequest.state !== 'OPEN' || pullRequest.base_ref !== pullRequest.default_branch)
|
|
126
|
+
return false;
|
|
127
|
+
const linked = new Set(pullRequest.closing_issues.filter(issue => issue.owner === target.owner && issue.repository === target.repository).map(issue => issue.number));
|
|
128
|
+
return extractClosingIssueNumbers(pullRequest.body, target).some(number => !linked.has(number));
|
|
129
|
+
}
|
|
130
|
+
// 開発ブランチへ載せ直した PR の本文を保存し直す。GitHub は base の付け替えでは Closes を読み直さず、Issue とリンクしない
|
|
131
|
+
async function relinkClosingIssues(out, target, progress) {
|
|
132
|
+
const { owner, repository, developBranch } = target;
|
|
133
|
+
if (progress.ontoBranch !== developBranch)
|
|
134
|
+
return;
|
|
135
|
+
let number;
|
|
136
|
+
try {
|
|
137
|
+
const client = createGitHubClient(out, target.host);
|
|
138
|
+
const { pullRequests } = await client.listPullRequestsByHead(owner, repository, progress.branch);
|
|
139
|
+
number = pullRequests.find(found => found.state === 'OPEN' && !found.isCrossRepository)?.number;
|
|
140
|
+
if (number === undefined)
|
|
141
|
+
return;
|
|
142
|
+
const pullRequest = await client.getPullRequestForFinish(owner, repository, number);
|
|
143
|
+
if (!hasUnlinkedClosingIssues(pullRequest, target))
|
|
144
|
+
return;
|
|
145
|
+
await client.updatePullRequestBody(owner, repository, number, pullRequest.body);
|
|
146
|
+
out.result({ relinked: number });
|
|
147
|
+
out.done({ verb: 'update', target: `PR #${String(number)} relinked ${RELINK_TARGET}` });
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
const label = number === undefined ? `the PR of ${progress.branch}` : `PR #${String(number)}`;
|
|
151
|
+
out.warning(`cannot relink ${label} ${RELINK_TARGET}: ${apiFailureMessage(error)}\nto link them, save the body of ${label} again on GitHub without changes`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function planRelink(out, branch, target, ontoBranch) {
|
|
155
|
+
if (ontoBranch === target.developBranch)
|
|
156
|
+
out.planned({ verb: 'update', target: `PR of ${branch} relinked ${RELINK_TARGET}` });
|
|
157
|
+
}
|
|
158
|
+
// --continue で終えた後に保存し直す先。rebase の間はブランチを読めないので、終えてから求める。求まらなければ保存し直さない
|
|
159
|
+
function relinkTargetOf(cwd, project) {
|
|
160
|
+
const location = primaryRemote(cwd)?.location;
|
|
161
|
+
if (location === undefined)
|
|
162
|
+
return undefined;
|
|
163
|
+
const lookup = findConfigFor(location, project);
|
|
164
|
+
if (lookup.kind !== 'found')
|
|
165
|
+
return undefined;
|
|
166
|
+
const { config } = lookup.found;
|
|
167
|
+
const developBranch = getDevelopBranch(config, location.owner, location.repository);
|
|
168
|
+
return developBranch === undefined || developBranch === '' ? undefined : { owner: location.owner, repository: location.repository, host: config.host, developBranch };
|
|
169
|
+
}
|
|
116
170
|
// --continue と --abort。途中の記録だけを読む。記録が無ければ、利用者が始めた rebase を動かさずに止まる
|
|
117
171
|
async function resumeRestack(out, cwd, mode, isDryRun, signal) {
|
|
118
172
|
const reading = interpretRestackProgress(readFlag(FLAG_PECOT_RESTACK));
|
|
@@ -131,18 +185,19 @@ async function resumeRestack(out, cwd, mode, isDryRun, signal) {
|
|
|
131
185
|
if (isDryRun) {
|
|
132
186
|
out.result({ branch: progress.branch, base: progress.ontoBranch, outcome: mode === 'abort' ? 'aborted' : 'restacked' });
|
|
133
187
|
out.planned(mode === 'abort' ? { verb: 'unchanged', target: `${progress.branch} restack aborted` } : { verb: 'update', target: `${progress.branch} restacked on ${progress.ontoBranch}` });
|
|
134
|
-
return;
|
|
188
|
+
return mode === 'abort' ? undefined : progress;
|
|
135
189
|
}
|
|
136
190
|
if (mode === 'abort') {
|
|
137
191
|
abortRebase(cwd);
|
|
138
192
|
removeFlag(FLAG_PECOT_RESTACK);
|
|
139
193
|
out.result({ branch: progress.branch, base: progress.ontoBranch, outcome: 'aborted' });
|
|
140
194
|
out.done({ verb: 'unchanged', target: `${progress.branch} restack aborted` });
|
|
141
|
-
return;
|
|
195
|
+
return undefined;
|
|
142
196
|
}
|
|
143
197
|
if (isRebasing && continueRebase(cwd) === 'conflict')
|
|
144
198
|
stopOnConflict(out, cwd, progress);
|
|
145
199
|
await finishRestack(out, cwd, progress, signal);
|
|
200
|
+
return progress;
|
|
146
201
|
}
|
|
147
202
|
function currentBranch(cwd) {
|
|
148
203
|
return gitStdout(['rev-parse', '--abbrev-ref', 'HEAD'], { cwd })?.trim();
|
|
@@ -154,7 +209,7 @@ function hasUncommittedChanges(cwd) {
|
|
|
154
209
|
async function decideFor(out, cwd, host, target) {
|
|
155
210
|
const { remote, owner, repository, developBranch, reading } = target;
|
|
156
211
|
const { branch } = reading.record;
|
|
157
|
-
const read = await readRestackDecision({ client: () => createGitHubClient(out, host), owner, repository, cwd, remote, reading, developBranch });
|
|
212
|
+
const read = await readRestackDecision({ client: () => createGitHubClient(out, host), owner, repository, cwd, remote, reading, developBranch, signal: out.signal });
|
|
158
213
|
switch (read.kind) {
|
|
159
214
|
case 'pull-request-unreadable': {
|
|
160
215
|
return stopWith(out, `cannot read the PR of the base branch ${branch}: ${describeApiError(read.error)}`, kindOfFailure(read.error));
|
|
@@ -195,7 +250,14 @@ async function runRestack(input, io) {
|
|
|
195
250
|
stopWith(out, 'give only one of check, continue and abort', 'invalid-input', USAGE_EXIT_CODE);
|
|
196
251
|
const cwd = '.';
|
|
197
252
|
if (input.continue || input.abort) {
|
|
198
|
-
await resumeRestack(out, cwd, input.abort ? 'abort' : 'continue', input.dry_run, io.signal);
|
|
253
|
+
const finished = await resumeRestack(out, cwd, input.abort ? 'abort' : 'continue', input.dry_run, io.signal);
|
|
254
|
+
const relinkTarget = finished === undefined ? undefined : relinkTargetOf(cwd, input.project);
|
|
255
|
+
if (finished === undefined || relinkTarget === undefined)
|
|
256
|
+
return;
|
|
257
|
+
if (input.dry_run)
|
|
258
|
+
planRelink(out, finished.branch, relinkTarget, finished.ontoBranch);
|
|
259
|
+
else
|
|
260
|
+
await relinkClosingIssues(out, relinkTarget, finished);
|
|
199
261
|
return;
|
|
200
262
|
}
|
|
201
263
|
const { currentBranch: branch, remoteName: remote, location } = validatePullRequestContext(cwd, out);
|
|
@@ -205,8 +267,11 @@ async function runRestack(input, io) {
|
|
|
205
267
|
const config = requireConfigFor(out, location, input.project, RESTACK_PATH).config;
|
|
206
268
|
// 記録が無ければ、求める前に fetch して、手元に無い下の段も追跡参照で見る
|
|
207
269
|
let fetched;
|
|
208
|
-
const fetchOnce = () => (fetched ??= fetchRemote(cwd, remote));
|
|
209
|
-
const
|
|
270
|
+
const fetchOnce = async () => await (fetched ??= fetchRemote(cwd, remote, out.signal));
|
|
271
|
+
const fetchBeforeInfer = async () => {
|
|
272
|
+
await fetchOnce();
|
|
273
|
+
};
|
|
274
|
+
const base = await readBaseOrInfer({ directory: cwd, project: { config, client: () => createGitHubClient(out, config.host) }, beforeInfer: fetchBeforeInfer });
|
|
210
275
|
warnUnresolved(base, out);
|
|
211
276
|
const { reading } = base;
|
|
212
277
|
stopOnMalformedRecord(reading, out);
|
|
@@ -223,10 +288,11 @@ async function runRestack(input, io) {
|
|
|
223
288
|
}
|
|
224
289
|
if (!input.check && hasUncommittedChanges(cwd))
|
|
225
290
|
stopWith(out, 'working tree has uncommitted changes', 'preflight-failed', UNCOMMITTED_EXIT_CODE);
|
|
226
|
-
const fetchResult = fetchOnce();
|
|
291
|
+
const fetchResult = await fetchOnce();
|
|
227
292
|
if (!fetchResult.succeeded)
|
|
228
293
|
stopWith(out, `cannot fetch ${remote}: ${fetchResult.stderr.trim()}`, 'git-unresolved');
|
|
229
294
|
const target = { remote, owner: location.owner, repository: location.repository, reading, developBranch };
|
|
295
|
+
const relinkTarget = { owner: location.owner, repository: location.repository, host: config.host, developBranch };
|
|
230
296
|
const decision = await decideFor(out, cwd, config.host, target);
|
|
231
297
|
if (decision.kind === 'gone')
|
|
232
298
|
return stopWith(out, describeGone(decision), 'pr-state');
|
|
@@ -243,9 +309,11 @@ async function runRestack(input, io) {
|
|
|
243
309
|
const isSynced = isSyncedWithRemote(cwd, progress);
|
|
244
310
|
out.result({ branch, base: decision.base, outcome: isSynced ? 'synced' : 'restacked' });
|
|
245
311
|
out.planned({ verb: 'update', target: isSynced ? `${branch} synced with ${remote}/${branch}` : `${branch} restacked on ${decision.base}` });
|
|
312
|
+
planRelink(out, branch, relinkTarget, decision.base);
|
|
246
313
|
return;
|
|
247
314
|
}
|
|
248
315
|
await finishRestack(out, cwd, progress, io.signal);
|
|
316
|
+
await relinkClosingIssues(out, relinkTarget, progress);
|
|
249
317
|
return;
|
|
250
318
|
}
|
|
251
319
|
if (decision.kind !== 'moved' && decision.kind !== 'merged') {
|
|
@@ -257,6 +325,7 @@ async function runRestack(input, io) {
|
|
|
257
325
|
if (input.dry_run) {
|
|
258
326
|
out.result({ branch, base: decision.base, outcome: 'needs-restack', ...causeOf(decision) });
|
|
259
327
|
out.planned({ verb: 'update', target: `${branch} restacked on ${decision.base}` });
|
|
328
|
+
planRelink(out, branch, relinkTarget, decision.base);
|
|
260
329
|
return;
|
|
261
330
|
}
|
|
262
331
|
if (rebaseOnto(cwd, progress.ontoSha, rebaseStartOf(out, cwd, target, progress.ontoSha)) === 'conflict') {
|
|
@@ -264,6 +333,7 @@ async function runRestack(input, io) {
|
|
|
264
333
|
stopOnConflict(out, cwd, progress);
|
|
265
334
|
}
|
|
266
335
|
await finishRestack(out, cwd, progress, io.signal);
|
|
336
|
+
await relinkClosingIssues(out, relinkTarget, progress);
|
|
267
337
|
}
|
|
268
338
|
const prRestack = defineCommand({
|
|
269
339
|
path: RESTACK_PATH,
|
package/cli/dist/commands/pr.js
CHANGED
|
@@ -101,8 +101,8 @@ function isRegularFile(file) {
|
|
|
101
101
|
return false;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function expectedTitleScope(target, head, out) {
|
|
105
|
-
const projects = nxProjects(target.toplevel);
|
|
104
|
+
async function expectedTitleScope(target, head, out) {
|
|
105
|
+
const projects = await nxProjects(target.toplevel, { signal: out.signal });
|
|
106
106
|
const files = projects === undefined ? undefined : changedFiles(target.toplevel, target.from, head);
|
|
107
107
|
if (projects === undefined || files === undefined) {
|
|
108
108
|
out.warning('cannot read nx projects or the diff; skipped the PR title scope check');
|
|
@@ -110,14 +110,14 @@ function expectedTitleScope(target, head, out) {
|
|
|
110
110
|
}
|
|
111
111
|
return expectedScope(files, projects);
|
|
112
112
|
}
|
|
113
|
-
function titleScopeErrors(query, out) {
|
|
113
|
+
async function titleScopeErrors(query, out) {
|
|
114
114
|
const { config, owner, repository, title, base, head, directory, template, developBranch, releaseBranch } = query;
|
|
115
115
|
if (isReleasePullRequest(template, base, head, developBranch, releaseBranch))
|
|
116
116
|
return [];
|
|
117
117
|
const target = nxScopeTarget(config, owner, repository, base, directory, query.stacked);
|
|
118
118
|
if (target === undefined)
|
|
119
119
|
return [];
|
|
120
|
-
const expected = expectedTitleScope(target, head, out);
|
|
120
|
+
const expected = await expectedTitleScope(target, head, out);
|
|
121
121
|
if (expected === undefined || expected.length === 0)
|
|
122
122
|
return [];
|
|
123
123
|
const given = parseTitleScope(title);
|
|
@@ -278,10 +278,10 @@ async function pushFixHintFor(push, reading, target) {
|
|
|
278
278
|
return undefined;
|
|
279
279
|
if (reading?.kind !== 'stacked')
|
|
280
280
|
return DIVERGED_FIX_HINT;
|
|
281
|
-
const { config, location, directory, remote, client, lowerPullRequest } = target;
|
|
281
|
+
const { config, location, directory, remote, client, lowerPullRequest, signal } = target;
|
|
282
282
|
const developBranch = getDevelopBranch(config, location.owner, location.repository) ?? '';
|
|
283
283
|
try {
|
|
284
|
-
const read = await readRestackDecision({ client, owner: location.owner, repository: location.repository, cwd: directory, remote, reading, developBranch, lowerPullRequest });
|
|
284
|
+
const read = await readRestackDecision({ client, owner: location.owner, repository: location.repository, cwd: directory, remote, reading, developBranch, lowerPullRequest, signal });
|
|
285
285
|
return pushFixHintOf(read.kind === 'decided' ? read.decision : undefined);
|
|
286
286
|
}
|
|
287
287
|
catch (error) {
|
|
@@ -293,7 +293,7 @@ async function pushFixHintFor(push, reading, target) {
|
|
|
293
293
|
async function runPreflightChecksOrExit(directory, base, config, client, out) {
|
|
294
294
|
const context = validatePullRequestContext(directory, out);
|
|
295
295
|
const push = getPushStatus(context.currentBranch, directory, context.remoteName);
|
|
296
|
-
const pushFixHint = await pushFixHintFor(push, base.reading, { config, location: context.location, directory, remote: context.remoteName, client, lowerPullRequest: base.lowerPullRequest });
|
|
296
|
+
const pushFixHint = await pushFixHintFor(push, base.reading, { config, location: context.location, directory, remote: context.remoteName, client, lowerPullRequest: base.lowerPullRequest, signal: out.signal });
|
|
297
297
|
const warnings = collectPreflightWarnings({ gitStatus: getGitStatus(directory), stashList: getStashList(directory), isPushed: push.isPushed, pushMessage: push.message, pushFixHint });
|
|
298
298
|
if (warnings.length === 0)
|
|
299
299
|
return;
|
|
@@ -431,7 +431,7 @@ async function isRestackedLocally(reading, directory, target, out) {
|
|
|
431
431
|
const { config, location } = target;
|
|
432
432
|
const developBranch = getDevelopBranch(config, location.owner, location.repository) ?? '';
|
|
433
433
|
try {
|
|
434
|
-
const read = await readRestackDecision({ client: lazyClient(config, out), owner: location.owner, repository: location.repository, cwd: directory, remote: primaryRemoteName(directory), reading, developBranch });
|
|
434
|
+
const read = await readRestackDecision({ client: lazyClient(config, out), owner: location.owner, repository: location.repository, cwd: directory, remote: primaryRemoteName(directory), reading, developBranch, signal: out.signal });
|
|
435
435
|
return read.kind === 'decided' && read.decision.kind === 'rebased';
|
|
436
436
|
}
|
|
437
437
|
catch (error) {
|
|
@@ -504,7 +504,7 @@ async function validateAndSubmit(input, out) {
|
|
|
504
504
|
stackedBase: use?.stackedBase,
|
|
505
505
|
}),
|
|
506
506
|
...baseErrors,
|
|
507
|
-
...titleScopeErrors({ config, owner: location.owner, repository: location.repository, title, base, head, directory, template, developBranch, releaseBranch, stacked }, out),
|
|
507
|
+
...await titleScopeErrors({ config, owner: location.owner, repository: location.repository, title, base, head, directory, template, developBranch, releaseBranch, stacked }, out),
|
|
508
508
|
];
|
|
509
509
|
exitOnValidationErrors(errors, out);
|
|
510
510
|
const isRelease = template === 'release';
|
|
@@ -602,12 +602,12 @@ async function createDirect(input, directory, out) {
|
|
|
602
602
|
}, out);
|
|
603
603
|
}
|
|
604
604
|
// --prepare
|
|
605
|
-
function addScopeHint(content, config, location, base, directory, stacked, out) {
|
|
605
|
+
async function addScopeHint(content, config, location, base, directory, stacked, out) {
|
|
606
606
|
const target = nxScopeTarget(config, location.owner, location.repository, base, directory, stacked);
|
|
607
607
|
if (target === undefined)
|
|
608
608
|
return content;
|
|
609
609
|
const head = gitCurrentBranch(directory);
|
|
610
|
-
const expected = head === undefined || head === '' ? undefined : expectedTitleScope(target, head, out);
|
|
610
|
+
const expected = head === undefined || head === '' ? undefined : await expectedTitleScope(target, head, out);
|
|
611
611
|
if (expected === undefined || expected.length === 0)
|
|
612
612
|
return content;
|
|
613
613
|
const scope = expected.join(',');
|
|
@@ -672,7 +672,7 @@ async function prepareTemplate(directory, out, template, project) {
|
|
|
672
672
|
content = content.replace(/^base:\s*"[^"]*"/mu, () => `base: "${base}"`);
|
|
673
673
|
out.done({ verb: 'set', target: `base to ${base}` });
|
|
674
674
|
out.result({ base });
|
|
675
|
-
content = addScopeHint(content, config, { owner: location.owner, repository: location.repository }, base, directory, record === undefined ? undefined : { sha: record.sha }, out);
|
|
675
|
+
content = await addScopeHint(content, config, { owner: location.owner, repository: location.repository }, base, directory, record === undefined ? undefined : { sha: record.sha }, out);
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
content = await fillClosesInTemplate(content, config, directory, location, out);
|
|
@@ -835,8 +835,8 @@ function hasBranch(branch, cwd) {
|
|
|
835
835
|
}
|
|
836
836
|
// 下の段のブランチがマージで消えた後は、開発ブランチと比べる。追跡参照は fetch --prune まで残るので、
|
|
837
837
|
// remote に尋ね、無いと答えたときだけ消えたとみなす。届かないか時間切れなら追跡参照で決める
|
|
838
|
-
function isOnRemote(branch, cwd, remote, out) {
|
|
839
|
-
const head = remoteBranchHead(cwd, remote, branch);
|
|
838
|
+
async function isOnRemote(branch, cwd, remote, out) {
|
|
839
|
+
const head = await remoteBranchHead(cwd, remote, branch, out.signal);
|
|
840
840
|
if (head.isReachable && head.sha === undefined)
|
|
841
841
|
return false;
|
|
842
842
|
const isTracked = hasBranch(`${remote}/${branch}`, cwd);
|
|
@@ -844,8 +844,8 @@ function isOnRemote(branch, cwd, remote, out) {
|
|
|
844
844
|
out.warning(`base branch ${branch} is on ${remote}, but ${remote}/${branch} is not fetched; compared with the develop branch\nrun: git fetch ${remote} ${branch}`);
|
|
845
845
|
return isTracked;
|
|
846
846
|
}
|
|
847
|
-
function determineBaseBranch(config, reading, location, cwd, remote, out) {
|
|
848
|
-
if (reading.kind === 'stacked' && isOnRemote(reading.record.branch, cwd, remote, out))
|
|
847
|
+
async function determineBaseBranch(config, reading, location, cwd, remote, out) {
|
|
848
|
+
if (reading.kind === 'stacked' && await isOnRemote(reading.record.branch, cwd, remote, out))
|
|
849
849
|
return `${remote}/${reading.record.branch}`;
|
|
850
850
|
const developBranch = getDevelopBranch(config, location.owner, location.repository);
|
|
851
851
|
if (developBranch === undefined || developBranch === '') {
|
|
@@ -924,7 +924,7 @@ async function runCheck(input, io) {
|
|
|
924
924
|
warnUnresolved(base, out);
|
|
925
925
|
const { reading } = base;
|
|
926
926
|
stopOnMalformedRecord(reading, out);
|
|
927
|
-
const baseBranch = determineBaseBranch(config, reading, context.location, directory, context.remoteName, out);
|
|
927
|
+
const baseBranch = await determineBaseBranch(config, reading, context.location, directory, context.remoteName, out);
|
|
928
928
|
const gitStatus = getGitStatus(directory);
|
|
929
929
|
const commits = gitStdout(['log', '--oneline', `${baseBranch}..HEAD`], { cwd: directory });
|
|
930
930
|
const diffSummary = gitStdout(['diff', '--stat', `${baseBranch}...HEAD`], { cwd: directory });
|
|
@@ -954,7 +954,7 @@ async function runCheck(input, io) {
|
|
|
954
954
|
out.data(`${heading}\n`);
|
|
955
955
|
out.data(`${content}\n`);
|
|
956
956
|
}
|
|
957
|
-
const pushFixHint = await pushFixHintFor(push, reading, { config, location: context.location, directory, remote: context.remoteName, client: lazyClient(config, out) });
|
|
957
|
+
const pushFixHint = await pushFixHintFor(push, reading, { config, location: context.location, directory, remote: context.remoteName, client: lazyClient(config, out), signal: out.signal });
|
|
958
958
|
const warnings = collectPreflightWarnings({ gitStatus, stashList, isPushed: push.isPushed, pushMessage: push.message, pushFixHint });
|
|
959
959
|
out.count('preflight warnings', warnings.length);
|
|
960
960
|
printPreflightWarnings(out, warnings);
|
|
@@ -16,7 +16,7 @@ import { CommandExit, defineCommand } from './command-definition.js';
|
|
|
16
16
|
import { commandHint, hinted, inputHint, inputNameHint, placeholder } from './command-hint.js';
|
|
17
17
|
import { requireActiveConfig, stopWith } from './command-stop.js';
|
|
18
18
|
import { kindOfFailure } from './failure.js';
|
|
19
|
-
import { createGitHubClient } from './github-client.js';
|
|
19
|
+
import { createAuthenticatedGitHubClient, createGitHubClient } from './github-client.js';
|
|
20
20
|
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
21
21
|
import { BLOCKED_SPEC, NEEDS_ATTENTION_SPEC, PRIORITY_FIELD_OPTIONS, SIZE_FIELD_OPTIONS, STATUS_FIELD_NAME, WORKFLOW_FIELD_OPTIONS, buildRepository, failApi, fieldNodesOf, findProjectByTitle, hasWorkflowField, lastFieldNamed, missingRequiredOptions, stopMissingOptions, syncProjectConfig, textOf, } from './project-sync.js';
|
|
22
22
|
const DEFAULT_HOST = 'github.com';
|
|
@@ -314,7 +314,8 @@ const initCommand = defineCommand({
|
|
|
314
314
|
run: async (input, io) => {
|
|
315
315
|
const out = createOutput(input.dry_run, io);
|
|
316
316
|
const { owner, name, host, suffix } = input;
|
|
317
|
-
|
|
317
|
+
// 認証の失敗を、フィールドの初期化の失敗に包まないため
|
|
318
|
+
const client = await createAuthenticatedGitHubClient(out, host);
|
|
318
319
|
if (input.dry_run)
|
|
319
320
|
out.result({});
|
|
320
321
|
const mark = fieldReporter((fields) => {
|
|
@@ -555,7 +556,8 @@ example: ${commandHint(ACTIVATE_PATH, { host: 'github.com', owner: 'example-org'
|
|
|
555
556
|
example: ${commandHint(ACTIVATE_PATH, { host: 'ghes.example.com', owner: 'example-org' })}
|
|
556
557
|
example: ${commandHint(ACTIVATE_PATH, { project: 'ghes.example.com_example-org_example-project_example-org' })}`, 'invalid-input');
|
|
557
558
|
}
|
|
558
|
-
|
|
559
|
+
// 認証の失敗に、--owner を渡す案内を添えないため
|
|
560
|
+
const client = await createAuthenticatedGitHubClient(out, host);
|
|
559
561
|
const owner = await resolveActivationOwner(out, client, input.owner);
|
|
560
562
|
// 一覧は書き込まないので、dry_run でも data に dryRun を足さない
|
|
561
563
|
if (project === undefined)
|
|
@@ -12,7 +12,7 @@ import { ReleaseError, runPreflight } from '../domain/release.js';
|
|
|
12
12
|
import { splitOwnerRepository } from '../domain/repository-resolver.js';
|
|
13
13
|
import { fetchCodeScanningStatus, fetchSecretScanningStatus, SecurityAlertError } from '../domain/security-alerts.js';
|
|
14
14
|
import { extractReleaseNotesFromFile, readChangelogIfExists, resolveChangelogPath } from '../infra/changelog-file.js';
|
|
15
|
-
import { gitRunnerFor, gitToplevel, primaryRemoteName, primaryRemoteRepository } from '../infra/git.js';
|
|
15
|
+
import { gitRunnerFor, gitToplevel, primaryRemoteName, primaryRemoteRepository, remoteTagExists } from '../infra/git.js';
|
|
16
16
|
import { TransportFailure } from '../infra/github/client.js';
|
|
17
17
|
import { createDependabotSource } from '../infra/github/dependabot-source.js';
|
|
18
18
|
import { GitHubAPIError, GitHubNotFoundError } from '../infra/github/errors.js';
|
|
@@ -20,7 +20,7 @@ import { createScanAlertSource } from '../infra/github/security-alerts-source.js
|
|
|
20
20
|
import { commandHint, hinted, inputHint, inputNameHint, placeholder } from './command-hint.js';
|
|
21
21
|
import { PROJECT_INPUT, requireConfigFor, stopWith } from './command-stop.js';
|
|
22
22
|
import { kindOfFailure } from './failure.js';
|
|
23
|
-
import { createGitHubClient, makeClient } from './github-client.js';
|
|
23
|
+
import { createAuthenticatedGitHubClient, createGitHubClient, makeClient } from './github-client.js';
|
|
24
24
|
import { issuePath } from './issue-shared.js';
|
|
25
25
|
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
26
26
|
import { CommandExit, defineCommand } from './command-definition.js';
|
|
@@ -85,7 +85,7 @@ function warnAlertsUnavailable(out, reason) {
|
|
|
85
85
|
async function checkDependabotAlerts(out, config, owner, repository, skip) {
|
|
86
86
|
let status;
|
|
87
87
|
try {
|
|
88
|
-
const client =
|
|
88
|
+
const client = await createAuthenticatedGitHubClient(out, config.host);
|
|
89
89
|
status = await fetchDependabotAlertStatus(createDependabotSource(client), config.host, owner, repository);
|
|
90
90
|
}
|
|
91
91
|
catch (error) {
|
|
@@ -154,8 +154,8 @@ async function checkAlerts(out, config, owner, repository) {
|
|
|
154
154
|
dependabot = await checkDependabotAlerts(out, config, owner, repository, skip);
|
|
155
155
|
return true;
|
|
156
156
|
},
|
|
157
|
-
async () => await isScanningPassed(out, 'code scanning', async () => await fetchCodeScanningStatus(createScanAlertSource(
|
|
158
|
-
async () => await isScanningPassed(out, 'secret scanning', async () => await fetchSecretScanningStatus(createScanAlertSource(
|
|
157
|
+
async () => await isScanningPassed(out, 'code scanning', async () => await fetchCodeScanningStatus(createScanAlertSource(await createAuthenticatedGitHubClient(out, config.host)), config.host, owner, repository), skip),
|
|
158
|
+
async () => await isScanningPassed(out, 'secret scanning', async () => await fetchSecretScanningStatus(createScanAlertSource(await createAuthenticatedGitHubClient(out, config.host)), config.host, owner, repository), skip),
|
|
159
159
|
];
|
|
160
160
|
let isPassed = true;
|
|
161
161
|
for (const check of checks) {
|
|
@@ -216,7 +216,7 @@ const releaseCheckCommand = defineCommand({
|
|
|
216
216
|
const releaseBranch = requireBranchSetting(out, getReleaseBranch(config, owner, repository), 'release', owner, repository);
|
|
217
217
|
const remote = primaryRemoteName(cwd) ?? 'origin';
|
|
218
218
|
try {
|
|
219
|
-
const client =
|
|
219
|
+
const client = await createAuthenticatedGitHubClient(out, config.host);
|
|
220
220
|
const result = await runPreflight({
|
|
221
221
|
changelogPath: context.changelogPath,
|
|
222
222
|
changelogContent: readChangelogIfExists(context.changelogPath),
|
|
@@ -225,7 +225,7 @@ const releaseCheckCommand = defineCommand({
|
|
|
225
225
|
version: input.version,
|
|
226
226
|
tagPrefix: context.tagPrefix,
|
|
227
227
|
remote,
|
|
228
|
-
}, gitRunnerFor(cwd), async (base, head) => await client.countCommitsAhead(owner, repository, base, head));
|
|
228
|
+
}, gitRunnerFor(cwd), async (name, tagName) => await remoteTagExists(cwd, name, tagName, out.signal), async (base, head) => await client.countCommitsAhead(owner, repository, base, head));
|
|
229
229
|
out.count(`commits to release (${remote}/${result.developBranch} -> ${remote}/${result.releaseBranch})`, result.diffCount);
|
|
230
230
|
out.result({ version: result.version, tag: result.tagName, releaseNotes: result.releaseNotes, commitCount: result.diffCount });
|
|
231
231
|
out.data(`version: ${result.version}\ntag: ${result.tagName}\n\n${result.releaseNotes}`);
|
|
@@ -291,7 +291,7 @@ const releaseCreateCommand = defineCommand({
|
|
|
291
291
|
out.data(releaseNotes);
|
|
292
292
|
return 0;
|
|
293
293
|
}
|
|
294
|
-
const client = makeClient(out, config);
|
|
294
|
+
const client = await makeClient(out, config);
|
|
295
295
|
try {
|
|
296
296
|
const result = await client.createRelease(owner, repository, tagName, releaseName, releaseNotes, { targetCommitish: releaseBranch });
|
|
297
297
|
out.done(operation);
|
|
@@ -26,6 +26,10 @@ export interface RestackTarget {
|
|
|
26
26
|
渡されたら、下の段の PR を読み直さない
|
|
27
27
|
*/
|
|
28
28
|
readonly lowerPullRequest?: KnownLowerPullRequest | undefined;
|
|
29
|
+
/**
|
|
30
|
+
MCP の要求の取り消し。ls-remote に渡す
|
|
31
|
+
*/
|
|
32
|
+
readonly signal: Readonly<AbortSignal> | undefined;
|
|
29
33
|
}
|
|
30
34
|
export type RestackReading = {
|
|
31
35
|
readonly kind: 'decided';
|