@pecot/workflow-mcp 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +80 -22
- package/cli/dist/cli.js +6 -1
- package/cli/dist/commands/board-add.d.ts +3 -0
- package/cli/dist/commands/board-add.js +59 -0
- package/cli/dist/commands/board-judgment.d.ts +60 -0
- package/cli/dist/commands/board-judgment.js +144 -0
- package/cli/dist/commands/board-move.d.ts +3 -0
- package/cli/dist/commands/board-move.js +57 -0
- package/cli/dist/commands/board-readiness.d.ts +34 -0
- package/cli/dist/commands/board-readiness.js +108 -0
- package/cli/dist/commands/board-show.d.ts +3 -0
- package/cli/dist/commands/board-show.js +72 -0
- package/cli/dist/commands/board-sync.d.ts +3 -0
- package/cli/dist/commands/board-sync.js +111 -0
- package/cli/dist/commands/{project-info.d.ts → board-view.d.ts} +21 -7
- package/cli/dist/commands/{project-info.js → board-view.js} +22 -12
- package/cli/dist/commands/board.d.ts +3 -0
- package/cli/dist/commands/board.js +12 -0
- package/cli/dist/commands/branch.d.ts +3 -0
- package/cli/dist/commands/branch.js +100 -0
- package/cli/dist/commands/command-binding.js +4 -0
- package/cli/dist/commands/command-definition.d.ts +20 -6
- package/cli/dist/commands/command-definition.js +11 -7
- package/cli/dist/commands/command-help.js +2 -2
- package/cli/dist/commands/command-hint.d.ts +5 -0
- package/cli/dist/commands/command-hint.js +13 -0
- package/cli/dist/commands/command-stop.d.ts +5 -3
- package/cli/dist/commands/command-stop.js +7 -6
- package/cli/dist/commands/failure-kind.d.ts +3 -0
- package/cli/dist/commands/failure-kind.js +34 -0
- package/cli/dist/commands/failure.d.ts +6 -0
- package/cli/dist/commands/failure.js +29 -3
- package/cli/dist/commands/github-client.d.ts +6 -2
- package/cli/dist/commands/github-client.js +13 -3
- package/cli/dist/commands/help.js +8 -13
- package/cli/dist/commands/issue-board.d.ts +33 -0
- package/cli/dist/commands/issue-board.js +61 -1
- package/cli/dist/commands/issue-comment.js +47 -28
- package/cli/dist/commands/issue-create.js +548 -91
- package/cli/dist/commands/issue-dependency.d.ts +3 -0
- package/cli/dist/commands/issue-dependency.js +282 -0
- package/cli/dist/commands/issue-readiness.d.ts +94 -0
- package/cli/dist/commands/issue-readiness.js +218 -0
- package/cli/dist/commands/issue-reopen.d.ts +3 -0
- package/cli/dist/commands/issue-reopen.js +115 -0
- package/cli/dist/commands/issue-shared.d.ts +32 -19
- package/cli/dist/commands/issue-shared.js +82 -75
- package/cli/dist/commands/issue-show.d.ts +3 -0
- package/cli/dist/commands/issue-show.js +169 -0
- package/cli/dist/commands/issue.d.ts +0 -1
- package/cli/dist/commands/issue.js +6 -8
- package/cli/dist/commands/names.d.ts +33 -0
- package/cli/dist/commands/names.js +62 -0
- package/cli/dist/commands/output.d.ts +14 -2
- package/cli/dist/commands/output.js +14 -7
- package/cli/dist/commands/pr-waiting.d.ts +20 -0
- package/cli/dist/commands/pr-waiting.js +106 -0
- package/cli/dist/commands/pr.d.ts +19 -0
- package/cli/dist/commands/pr.js +242 -323
- package/cli/dist/commands/project-sync.d.ts +2 -1
- package/cli/dist/commands/project-sync.js +18 -9
- package/cli/dist/commands/project.d.ts +3 -2
- package/cli/dist/commands/project.js +212 -175
- package/cli/dist/commands/registry.js +13 -10
- package/cli/dist/commands/release.d.ts +2 -2
- package/cli/dist/commands/release.js +53 -114
- package/cli/dist/commands/renamed-commands.d.ts +26 -0
- package/cli/dist/commands/renamed-commands.js +53 -0
- package/cli/dist/commands/repository-match.js +3 -2
- package/cli/dist/commands/session-finish.d.ts +3 -0
- package/cli/dist/commands/session-finish.js +267 -0
- package/cli/dist/commands/session-start.d.ts +3 -0
- package/cli/dist/commands/{repository.js → session-start.js} +99 -128
- package/cli/dist/commands/session.d.ts +3 -0
- package/cli/dist/commands/session.js +82 -29
- package/cli/dist/commands/tracker-sync-dependabot.d.ts +7 -0
- package/cli/dist/commands/{dependabot.js → tracker-sync-dependabot.js} +57 -66
- package/cli/dist/commands/tracker-sync-security.d.ts +7 -0
- package/cli/dist/commands/{security.js → tracker-sync-security.js} +50 -61
- package/cli/dist/commands/tracker-sync.d.ts +7 -0
- package/cli/dist/commands/tracker-sync.js +3 -6
- package/cli/dist/commands/tracker.d.ts +3 -0
- package/cli/dist/commands/tracker.js +18 -0
- package/cli/dist/commands/usage-error.d.ts +4 -0
- package/cli/dist/commands/usage-error.js +6 -0
- package/cli/dist/commands/work-target.d.ts +12 -3
- package/cli/dist/commands/work-target.js +46 -5
- package/cli/dist/commands/worktree.js +32 -28
- package/cli/dist/domain/batch-plan.d.ts +73 -0
- package/cli/dist/domain/batch-plan.js +114 -0
- package/cli/dist/domain/blocked-by-change.d.ts +99 -0
- package/cli/dist/domain/blocked-by-change.js +101 -0
- package/cli/dist/domain/board-move.d.ts +90 -0
- package/cli/dist/domain/board-move.js +92 -0
- package/cli/dist/domain/branch-name.js +1 -1
- package/cli/dist/domain/command-hint.d.ts +85 -0
- package/cli/dist/domain/command-hint.js +148 -0
- package/cli/dist/domain/config.d.ts +4 -0
- package/cli/dist/domain/config.js +11 -1
- package/cli/dist/domain/dependabot.js +1 -1
- package/cli/dist/domain/errors.d.ts +5 -0
- package/cli/dist/domain/errors.js +5 -0
- package/cli/dist/domain/format.d.ts +51 -4
- package/cli/dist/domain/format.js +72 -6
- package/cli/dist/domain/frontmatter.d.ts +18 -3
- package/cli/dist/domain/frontmatter.js +38 -12
- package/cli/dist/domain/issue-order.d.ts +55 -0
- package/cli/dist/domain/issue-order.js +65 -0
- package/cli/dist/domain/issue-readout.d.ts +36 -0
- package/cli/dist/domain/pull-request.d.ts +71 -4
- package/cli/dist/domain/pull-request.js +59 -10
- package/cli/dist/domain/readiness.d.ts +27 -0
- package/cli/dist/domain/readiness.js +114 -3
- package/cli/dist/domain/reference-parser.d.ts +3 -1
- package/cli/dist/domain/reference-parser.js +6 -2
- package/cli/dist/domain/release.d.ts +7 -3
- package/cli/dist/domain/release.js +5 -12
- package/cli/dist/domain/repository-policy.d.ts +9 -3
- package/cli/dist/domain/repository-policy.js +8 -7
- package/cli/dist/domain/repository-resolver.js +4 -1
- package/cli/dist/domain/security-alerts.js +1 -1
- package/cli/dist/domain/state.d.ts +30 -0
- package/cli/dist/domain/state.js +39 -0
- package/cli/dist/domain/work-start.d.ts +34 -0
- package/cli/dist/domain/work-start.js +49 -0
- package/cli/dist/infra/authored-notes.d.ts +1 -1
- package/cli/dist/infra/authored-notes.js +10 -4
- package/cli/dist/infra/config-store.d.ts +4 -0
- package/cli/dist/infra/config-store.js +13 -0
- package/cli/dist/infra/git.d.ts +12 -0
- package/cli/dist/infra/git.js +13 -1
- package/cli/dist/infra/github/client.d.ts +5 -0
- package/cli/dist/infra/github/client.js +10 -7
- package/cli/dist/infra/github/errors.d.ts +18 -0
- package/cli/dist/infra/github/errors.js +22 -0
- package/cli/dist/infra/github/issues.d.ts +39 -3
- package/cli/dist/infra/github/issues.js +178 -23
- package/cli/dist/infra/github/projects.d.ts +35 -0
- package/cli/dist/infra/github/projects.js +89 -8
- package/cli/dist/infra/github/pulls.d.ts +24 -0
- package/cli/dist/infra/github/pulls.js +56 -0
- package/cli/dist/infra/github/queries.d.ts +12 -4
- package/cli/dist/infra/github/queries.js +156 -8
- package/cli/dist/infra/github/readout.d.ts +5 -1
- package/cli/dist/infra/github/readout.js +11 -0
- package/cli/dist/infra/github/repos.d.ts +18 -0
- package/cli/dist/infra/github/repos.js +31 -0
- package/cli/dist/infra/nx-scope.d.ts +1 -1
- package/cli/dist/infra/nx-scope.js +1 -1
- package/cli/dist/infra/state-store.d.ts +10 -1
- package/cli/dist/infra/state-store.js +14 -2
- package/cli/dist/infra/worktree-links.d.ts +3 -0
- package/cli/dist/infra/worktree-links.js +8 -1
- package/cli/dist/infra/worktree.d.ts +12 -1
- package/cli/dist/infra/worktree.js +40 -23
- package/cli/dist/mcp/result.d.ts +34 -6
- package/cli/dist/mcp/result.js +62 -18
- package/cli/dist/mcp/server.d.ts +2 -2
- package/cli/dist/mcp/server.js +24 -10
- package/cli/templates/comment/plan.md +14 -0
- package/cli/templates/issue/bug.md +1 -1
- package/cli/templates/issue/task-implement.md +13 -6
- package/cli/templates/issue/task.md +1 -1
- package/cli/templates/workflow/pecot-board-sync.yml +84 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/cli/dist/commands/dependabot.d.ts +0 -3
- package/cli/dist/commands/issue-project.d.ts +0 -3
- package/cli/dist/commands/issue-project.js +0 -176
- package/cli/dist/commands/issue-quick.d.ts +0 -3
- package/cli/dist/commands/issue-quick.js +0 -126
- package/cli/dist/commands/issue-read.d.ts +0 -3
- package/cli/dist/commands/issue-read.js +0 -80
- package/cli/dist/commands/repository.d.ts +0 -5
- package/cli/dist/commands/security.d.ts +0 -3
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types -- GitHubClient は内部の状態を持つ */
|
|
2
|
+
// session finish。cli/commands/pr.py の pr_cleanup の移植。
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { describeApiError } from '../domain/api-error-detail.js';
|
|
5
|
+
import { extractIssueNumberFromBranch } from '../domain/branch-name.js';
|
|
6
|
+
import { getDevelopBranch } from '../domain/config.js';
|
|
7
|
+
import { isEpicIssue } from '../domain/issue-kind.js';
|
|
8
|
+
import { extractClosingIssueNumbers } from '../domain/pull-request.js';
|
|
9
|
+
import { FLAG_MERGE_SLASH_PENDING, FLAG_PECOT_ACTIVE, FLAG_PECOT_BASE, FLAG_PECOT_QUICK_MODE, FLAG_PECOT_SESSION_TITLE, FLAG_WIP_BRANCH_LINKED } from '../domain/state.js';
|
|
10
|
+
import { gitCurrentBranch, GitCommandError, runGit } from '../infra/git.js';
|
|
11
|
+
import { GitHubAPIError, GitHubNotFoundError, isClosedByAnotherRequest, isMissingReferenceError } from '../infra/github/errors.js';
|
|
12
|
+
import { isFileNotFound } from '../infra/os-error.js';
|
|
13
|
+
import { consumeFlag, removeFlag } from '../infra/state-store.js';
|
|
14
|
+
import { getCurrentWorktreeName, isWorktreeEnvironment } from '../infra/worktree.js';
|
|
15
|
+
import { requireActiveConfigPlain, stopWith } from './command-stop.js';
|
|
16
|
+
import { kindOfFailure } from './failure.js';
|
|
17
|
+
import { createGitHubClient } from './github-client.js';
|
|
18
|
+
import { createOutput } from './output.js';
|
|
19
|
+
import { defineCommand } from './command-definition.js';
|
|
20
|
+
import { settle } from './tracker-sync.js';
|
|
21
|
+
import { isPositive, parseReference, PR_REFERENCE_DESCRIPTION, primaryRemote, reasonOf } from './pr.js';
|
|
22
|
+
async function fetchPullRequestForCleanup(config, location, out) {
|
|
23
|
+
try {
|
|
24
|
+
const client = createGitHubClient(out, config.host);
|
|
25
|
+
return { client, pr: await client.getPullRequestSlim(location.owner, location.repository, location.number) };
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (error instanceof GitHubNotFoundError)
|
|
29
|
+
return stopWith(out, `PR not found: ${location.owner}/${location.repository}/${String(location.number)}`, 'github-not-found');
|
|
30
|
+
if (error instanceof GitHubAPIError)
|
|
31
|
+
return stopWith(out, error.message, kindOfFailure(error));
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function collectClosingIssueNumbers(pr) {
|
|
36
|
+
const numbers = new Set(pr.closing_issues.map(issue => issue.number));
|
|
37
|
+
for (const number of extractClosingIssueNumbers(pr.body))
|
|
38
|
+
numbers.add(number);
|
|
39
|
+
const branchNumber = extractIssueNumberFromBranch(pr.head_ref);
|
|
40
|
+
if (isPositive(branchNumber))
|
|
41
|
+
numbers.add(branchNumber);
|
|
42
|
+
return numbers;
|
|
43
|
+
}
|
|
44
|
+
// Epic 保護。Issue Type が Epic か、sub-issue を持つ Issue
|
|
45
|
+
async function findEpicProtectedNumbers(client, location, issueNumbers, out) {
|
|
46
|
+
const protectedNumbers = new Set();
|
|
47
|
+
const ordered = [...issueNumbers].toSorted((a, b) => a - b);
|
|
48
|
+
for (const number of ordered) {
|
|
49
|
+
try {
|
|
50
|
+
if (isEpicIssue(await client.getIssueKind(location.owner, location.repository, number)))
|
|
51
|
+
protectedNumbers.add(number);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (error instanceof GitHubNotFoundError)
|
|
55
|
+
continue;
|
|
56
|
+
if (!(error instanceof GitHubAPIError))
|
|
57
|
+
throw error;
|
|
58
|
+
out.warning(`kind check of Issue #${String(number)} failed: ${error.message}; not protected`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return protectedNumbers;
|
|
62
|
+
}
|
|
63
|
+
async function closeRelatedIssues(context, client, location, closing, epicProtected) {
|
|
64
|
+
const { out, isDryRun } = context;
|
|
65
|
+
const protectedOrdered = [...epicProtected].toSorted((a, b) => a - b);
|
|
66
|
+
const closingOrdered = [...closing].toSorted((a, b) => a - b);
|
|
67
|
+
for (const number of protectedOrdered)
|
|
68
|
+
settle(out, { verb: 'skip', target: `closing Issue #${String(number)} (Epic)` });
|
|
69
|
+
for (const number of closingOrdered) {
|
|
70
|
+
const operation = { verb: 'close', target: `Issue #${String(number)}` };
|
|
71
|
+
out.planned(operation);
|
|
72
|
+
if (isDryRun)
|
|
73
|
+
continue;
|
|
74
|
+
try {
|
|
75
|
+
await client.closeIssue(location.owner, location.repository, number);
|
|
76
|
+
out.done(operation);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error instanceof GitHubNotFoundError) {
|
|
80
|
+
out.warning(`Issue #${String(number)} not found; skipped`);
|
|
81
|
+
}
|
|
82
|
+
else if (error instanceof GitHubAPIError) {
|
|
83
|
+
if (isClosedByAnotherRequest(error))
|
|
84
|
+
out.done({ verb: 'unchanged', target: `Issue #${String(number)} (already closed)` });
|
|
85
|
+
else
|
|
86
|
+
out.warning(`closing Issue #${String(number)} failed: ${describeApiError(error)}`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// head ブランチを消し、続けて wip ブランチを消す。head が無くても wip は試す
|
|
95
|
+
async function deleteMergedBranch(context, client, location, headBranch) {
|
|
96
|
+
const { out, isDryRun } = context;
|
|
97
|
+
const operation = { verb: 'delete', target: `remote branch ${headBranch}` };
|
|
98
|
+
out.planned(operation);
|
|
99
|
+
if (isDryRun)
|
|
100
|
+
return;
|
|
101
|
+
try {
|
|
102
|
+
await client.deleteBranch(location.owner, location.repository, headBranch);
|
|
103
|
+
out.done(operation);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (!(error instanceof GitHubAPIError))
|
|
107
|
+
throw error;
|
|
108
|
+
if (!isMissingReferenceError(error)) {
|
|
109
|
+
out.warning(`deleting remote branch ${headBranch} failed: ${describeApiError(error)}`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
out.done({ verb: 'unchanged', target: `remote branch ${headBranch} (already deleted)` });
|
|
113
|
+
}
|
|
114
|
+
const wipBranch = `wip/${headBranch}`;
|
|
115
|
+
try {
|
|
116
|
+
await client.deleteBranch(location.owner, location.repository, wipBranch);
|
|
117
|
+
out.done({ verb: 'delete', target: `remote branch ${wipBranch}` });
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (!(error instanceof GitHubAPIError))
|
|
121
|
+
throw error;
|
|
122
|
+
if (!isMissingReferenceError(error))
|
|
123
|
+
out.warning(`deleting remote branch ${wipBranch} failed: ${describeApiError(error)}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// 手元と PR の repository が同じなら主の remote 名。違えば警告を出して undefined
|
|
127
|
+
function sameRepositoryRemote(cwd, location, out) {
|
|
128
|
+
const skipped = 'skipped local cleanup';
|
|
129
|
+
try {
|
|
130
|
+
const found = primaryRemote(cwd);
|
|
131
|
+
if (found === undefined) {
|
|
132
|
+
out.warning(`cannot read the remote URL; ${skipped}`);
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (found.location === undefined) {
|
|
136
|
+
out.warning(`cannot read the repository from the remote URL; ${skipped}`);
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
if (found.location.owner !== location.owner || found.location.repository !== location.repository) {
|
|
140
|
+
out.warning(`current repository (${found.location.owner}/${found.location.repository}) differs from the PR's (${location.owner}/${location.repository}); ${skipped}`);
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
return found.name;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
out.warning(`cannot determine the repository; ${skipped}`);
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// worktree では worktree 名、そうでなければ develop ブランチ
|
|
151
|
+
function resolveCheckoutTarget(cwd, config, location, out) {
|
|
152
|
+
try {
|
|
153
|
+
if (isWorktreeEnvironment(cwd))
|
|
154
|
+
return getCurrentWorktreeName(cwd) ?? 'main';
|
|
155
|
+
const developBranch = getDevelopBranch(config, location.owner, location.repository);
|
|
156
|
+
if (developBranch !== undefined && developBranch !== '')
|
|
157
|
+
return developBranch;
|
|
158
|
+
out.warning('develop_branch is not set; skipped local cleanup');
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
out.warning('cannot determine the worktree; skipped local cleanup');
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function didRunLocalStep(context, operation, cwd, arguments_, failure) {
|
|
167
|
+
const { out, isDryRun } = context;
|
|
168
|
+
out.planned(operation);
|
|
169
|
+
if (isDryRun)
|
|
170
|
+
return true;
|
|
171
|
+
try {
|
|
172
|
+
runGit(arguments_, { cwd, check: true });
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (!(error instanceof GitCommandError) && !isFileNotFound(error))
|
|
176
|
+
throw error;
|
|
177
|
+
out.warning(`${failure} failed: ${reasonOf(error)}`);
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
out.done(operation);
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
function localCleanupAfterMerge(context, headBranch, config, location) {
|
|
184
|
+
const { out } = context;
|
|
185
|
+
const cwd = process.cwd();
|
|
186
|
+
const remote = sameRepositoryRemote(cwd, location, out);
|
|
187
|
+
if (remote === undefined)
|
|
188
|
+
return;
|
|
189
|
+
const currentBranch = gitCurrentBranch(cwd);
|
|
190
|
+
const checkoutTarget = resolveCheckoutTarget(cwd, config, location, out);
|
|
191
|
+
if (checkoutTarget === undefined)
|
|
192
|
+
return;
|
|
193
|
+
const developBranch = getDevelopBranch(config, location.owner, location.repository);
|
|
194
|
+
if (developBranch === undefined || developBranch === '') {
|
|
195
|
+
out.warning('develop_branch is not set; skipped local cleanup');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (currentBranch === checkoutTarget) {
|
|
199
|
+
settle(out, { verb: 'unchanged', target: `current branch ${checkoutTarget}` });
|
|
200
|
+
}
|
|
201
|
+
else if (!didRunLocalStep(context, { verb: 'set', target: `current branch to ${checkoutTarget}` }, cwd, ['checkout', checkoutTarget], `checking out ${checkoutTarget}`)) {
|
|
202
|
+
// checkout が失敗したら、pull と branch -D は別のブランチに当たるので止める
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
didRunLocalStep(context, { verb: 'update', target: `${checkoutTarget} from ${remote}/${developBranch}` }, cwd, ['pull', remote, developBranch], `pulling ${developBranch}`);
|
|
206
|
+
if (headBranch === checkoutTarget) {
|
|
207
|
+
settle(out, { verb: 'skip', target: `deleting local branch ${headBranch} (it is the checkout target)` });
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
didRunLocalStep(context, { verb: 'delete', target: `local branch ${headBranch}` }, cwd, ['branch', '-D', headBranch], `deleting local branch ${headBranch}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function removeActiveFlags(out) {
|
|
214
|
+
try {
|
|
215
|
+
for (const flag of [FLAG_PECOT_ACTIVE, FLAG_PECOT_BASE, FLAG_PECOT_SESSION_TITLE, FLAG_PECOT_QUICK_MODE, FLAG_WIP_BRANCH_LINKED])
|
|
216
|
+
removeFlag(flag);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
out.warning(`removing flag files failed: ${reasonOf(error)}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const FinishInputSchema = z.strictObject({
|
|
223
|
+
pr_ref: z.string().describe(PR_REFERENCE_DESCRIPTION),
|
|
224
|
+
dry_run: z.boolean().default(false).describe('Dry-run (do not actually clean up)'),
|
|
225
|
+
delete_branch: z.boolean().default(false).describe('Delete the branch'),
|
|
226
|
+
skip_local_cleanup: z.boolean().default(false).describe('Skip the local branch switch and deletion'),
|
|
227
|
+
});
|
|
228
|
+
async function runFinish(input, io) {
|
|
229
|
+
const out = createOutput(input.dry_run, io);
|
|
230
|
+
const context = { out, isDryRun: input.dry_run };
|
|
231
|
+
const config = requireActiveConfigPlain(out);
|
|
232
|
+
const reference = parseReference(input.pr_ref, input.repo, out);
|
|
233
|
+
const location = { owner: reference.owner, repository: reference.repository };
|
|
234
|
+
const { client, pr } = await fetchPullRequestForCleanup(config, reference, out);
|
|
235
|
+
if (pr.state !== 'MERGED')
|
|
236
|
+
stopWith(out, `PR #${String(reference.number)} is not merged yet (state: ${pr.state}); merge it with gh pr merge first`, 'pr-state');
|
|
237
|
+
const closing = collectClosingIssueNumbers(pr);
|
|
238
|
+
const epicProtected = await findEpicProtectedNumbers(client, location, closing, out);
|
|
239
|
+
for (const number of epicProtected)
|
|
240
|
+
closing.delete(number);
|
|
241
|
+
out.count('Issues to close', closing.size);
|
|
242
|
+
await closeRelatedIssues(context, client, location, closing, epicProtected);
|
|
243
|
+
if (input.delete_branch)
|
|
244
|
+
await deleteMergedBranch(context, client, location, pr.head_ref);
|
|
245
|
+
if (input.skip_local_cleanup)
|
|
246
|
+
return;
|
|
247
|
+
localCleanupAfterMerge(context, pr.head_ref, config, location);
|
|
248
|
+
if (input.dry_run) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
removeActiveFlags(out);
|
|
252
|
+
consumeFlag(FLAG_MERGE_SLASH_PENDING);
|
|
253
|
+
}
|
|
254
|
+
const sessionFinishCommand = defineCommand({
|
|
255
|
+
path: ['session', 'finish'],
|
|
256
|
+
description: 'Clean up after a merged PR (close related Issues, delete branches, local cleanup)',
|
|
257
|
+
input: FinishInputSchema,
|
|
258
|
+
positional: ['pr_ref'],
|
|
259
|
+
shortFlags: { dry_run: '-n', delete_branch: '-d' },
|
|
260
|
+
interactive: false,
|
|
261
|
+
run: async (input, io) => {
|
|
262
|
+
await runFinish(input, io);
|
|
263
|
+
return 0;
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
export const SESSION_FINISH_COMMANDS = [sessionFinishCommand];
|
|
267
|
+
//# sourceMappingURL=session-finish.js.map
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
//
|
|
1
|
+
// session start。Python の cli/commands/repo.py の create_branch の移植。
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { describeApiError } from '../domain/api-error-detail.js';
|
|
4
3
|
import { findRepository, getFieldId, getOptionId, isRepositoryInProject } from '../domain/config.js';
|
|
5
|
-
import { ReferenceParseError, parseIssueReference
|
|
6
|
-
import {
|
|
4
|
+
import { ReferenceParseError, parseIssueReference } from '../domain/reference-parser.js';
|
|
5
|
+
import { pythonStringRepr } from '../domain/python-format.js';
|
|
7
6
|
import { repositoryFullName } from '../domain/repository-resolver.js';
|
|
7
|
+
import { displayReference } from '../domain/readiness.js';
|
|
8
8
|
import { FLAG_PECOT_ACTIVE } from '../domain/state.js';
|
|
9
|
-
import {
|
|
9
|
+
import { decideStart, describeBaseMismatch } from '../domain/work-start.js';
|
|
10
|
+
import { GitHubAPIError } from '../infra/github/errors.js';
|
|
10
11
|
import { readFlag } from '../infra/state-store.js';
|
|
11
12
|
import { createOutput } from './output.js';
|
|
12
13
|
import { defineCommand } from './command-definition.js';
|
|
14
|
+
import { commandHint, hinted, inputHint, joinHinted } from './command-hint.js';
|
|
13
15
|
import { requireActiveConfig, stopWith } from './command-stop.js';
|
|
16
|
+
import { kindOfFailure } from './failure.js';
|
|
14
17
|
import { createGitHubClient } from './github-client.js';
|
|
15
18
|
import { USAGE_EXIT_CODE } from './usage-error.js';
|
|
16
19
|
import { requireRepositoryMatch, resolveCurrentRepository } from './repository-match.js';
|
|
17
|
-
import {
|
|
20
|
+
import { createReadinessCache, readIssueReadinessIfSupported } from './issue-readiness.js';
|
|
21
|
+
import { planWorkTarget, recordWorkTarget } from './work-target.js';
|
|
22
|
+
const START_PATH = ['session', 'start'];
|
|
18
23
|
/**
|
|
19
24
|
A-1. 作業ディレクトリの git remote のリポジトリが Issue のリポジトリと違えば、終了コード 2 で止める
|
|
20
25
|
*/
|
|
@@ -25,30 +30,58 @@ function rejectCwdRepositoryMismatch(out, owner, repository) {
|
|
|
25
30
|
const current = resolved.repository;
|
|
26
31
|
if (current.owner === owner && current.repository === repository)
|
|
27
32
|
return;
|
|
28
|
-
stopWith(out,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
stopWith(out, joinHinted([
|
|
34
|
+
`the repository of the work Issue (${owner}/${repository}) differs from `
|
|
35
|
+
+ `the CWD git remote (${repositoryFullName(current)})\n`
|
|
36
|
+
+ 'move to the worktree of the target repository and run again:\n'
|
|
37
|
+
+ `<project-root>/base/${repository}/ or <project-root>/<wtN>/${repository}/\n`
|
|
38
|
+
+ 'create one with /pecot-w:w-worktree-add only if the repository has no worktree\n'
|
|
39
|
+
+ 'to issue the command on purpose from outside the CWD (for example in a script), ',
|
|
40
|
+
hinted `give ${inputHint(START_PATH, 'allow_cross_repo')}`,
|
|
41
|
+
], ''), 'repo-mismatch', USAGE_EXIT_CODE);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
develop_branch を設定する直し方の行
|
|
45
|
+
*/
|
|
46
|
+
function developBranchGuide(owner, repository) {
|
|
47
|
+
return hinted `set it with: ${commandHint(['project', 'link'], { repo: `${owner}/${repository}`, develop_branch: 'develop' })}`;
|
|
35
48
|
}
|
|
36
49
|
/**
|
|
37
50
|
3. ベースブランチを決める(--base を先に、無ければ設定の develop_branch)
|
|
38
51
|
*/
|
|
39
52
|
function resolveBaseBranch(out, query) {
|
|
40
|
-
const { config, owner, repository, issueNumber,
|
|
53
|
+
const { config, owner, repository, issueNumber, branch, base } = query;
|
|
41
54
|
if (base !== undefined && base !== '')
|
|
42
55
|
return base;
|
|
43
56
|
const developBranch = findRepository(config, owner, repository)?.develop_branch;
|
|
44
57
|
if (developBranch === undefined || developBranch === '') {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
+ `or give the base: pecot create-branch ${owner}/${repository}/${String(issueNumber)} ${branchName} --base main`);
|
|
58
|
+
const withBase = commandHint(START_PATH, { issue_ref: `${owner}/${repository}/${String(issueNumber)}`, branch, base: 'main' });
|
|
59
|
+
stopWith(out, joinHinted([`develop_branch is not set for ${owner}/${repository}`, developBranchGuide(owner, repository), hinted `or give the base: ${withBase}`]), 'repo-setting-missing');
|
|
48
60
|
}
|
|
49
61
|
return developBranch;
|
|
50
62
|
}
|
|
51
63
|
/**
|
|
64
|
+
3.5. 着手の判定を読み、積む先を決める。blocked と読めないときは止める。依存関係を持たない GHES は、warning を出して判定なしで進める
|
|
65
|
+
*/
|
|
66
|
+
async function decideWorkStart(out, client, config, issue) {
|
|
67
|
+
const label = displayReference(issue, issue.repository);
|
|
68
|
+
const warnNotChecked = (reason) => {
|
|
69
|
+
out.warning(`readiness is not checked: ${reason}`);
|
|
70
|
+
};
|
|
71
|
+
const result = await readIssueReadinessIfSupported(client, config, issue, createReadinessCache(), warnNotChecked);
|
|
72
|
+
if (result === undefined)
|
|
73
|
+
return { kind: 'start' };
|
|
74
|
+
if (result.kind === 'unreadable') {
|
|
75
|
+
if (result.snapshot === undefined)
|
|
76
|
+
return stopWith(out, `could not read blocked-by of ${label}: ${result.reason}`, 'dependency-unreadable');
|
|
77
|
+
const isUnset = result.snapshot.developmentBranch === undefined || result.snapshot.developmentBranch === '';
|
|
78
|
+
const guide = isUnset ? [developBranchGuide(issue.repository.owner, issue.repository.repository)] : [];
|
|
79
|
+
return stopWith(out, joinHinted([`could not judge readiness of ${label}: ${result.reason}`, ...guide]), 'dependency-unreadable');
|
|
80
|
+
}
|
|
81
|
+
const decision = decideStart(result.readiness, result.prerequisites, issue);
|
|
82
|
+
return decision.kind === 'blocked' ? stopWith(out, decision.message, 'not-ready', USAGE_EXIT_CODE) : decision;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
52
85
|
A-2. .pecot-active が別の OPEN な Issue を指していれば、終了コード 2 で止める
|
|
53
86
|
*/
|
|
54
87
|
async function guardActiveOverwrite(out, client, issueReference) {
|
|
@@ -68,11 +101,13 @@ async function guardActiveOverwrite(out, client, issueReference) {
|
|
|
68
101
|
const { repository, number } = existingReference;
|
|
69
102
|
const { state } = await client.getIssueSlim(repository.owner, repository.repository, number);
|
|
70
103
|
if (state === 'OPEN') {
|
|
71
|
-
stopWith(out,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
stopWith(out, joinHinted([
|
|
105
|
+
`this worktree is already working on another Issue (${existing}, OPEN)\n`
|
|
106
|
+
+ 'overwriting .pecot-active could mix up the tasks\n'
|
|
107
|
+
+ 'finish the other Issue first, or create another worktree with '
|
|
108
|
+
+ '/pecot-w:w-worktree-add and run /pecot-w:w-active again in its session',
|
|
109
|
+
hinted `if it is stale and you want to overwrite it on purpose, give ${inputHint(START_PATH, 'force_overwrite_active')}`,
|
|
110
|
+
]), 'guard-blocked', USAGE_EXIT_CODE);
|
|
76
111
|
}
|
|
77
112
|
out.warning(state === 'CLOSED'
|
|
78
113
|
? `.pecot-active points to closed Issue ${existing}; overwriting it`
|
|
@@ -106,24 +141,25 @@ async function setIssueStatusActive(out, client, config, issue) {
|
|
|
106
141
|
out.warning(`could not set ${target}: ${error.message}`);
|
|
107
142
|
}
|
|
108
143
|
}
|
|
109
|
-
const
|
|
110
|
-
path:
|
|
144
|
+
const sessionStartCommand = defineCommand({
|
|
145
|
+
path: START_PATH,
|
|
111
146
|
description: 'Create a branch linked to an Issue (shown in the Development section of the Issue)',
|
|
112
147
|
input: z.strictObject({
|
|
113
148
|
issue_ref: z.string().describe('Issue reference (owner/repo/123)'),
|
|
114
|
-
|
|
115
|
-
base: z.string().optional().describe('Base branch (default: develop_branch from the config)'),
|
|
149
|
+
branch: z.string().describe('Name of the branch to create'),
|
|
150
|
+
base: z.string().optional().describe('Base branch (default: chosen by readiness, else develop_branch from the config)'),
|
|
116
151
|
checkout: z.boolean().default(true).describe('Kept for compatibility; has no effect'),
|
|
117
152
|
allow_cross_repo: z.boolean().default(false).describe('Allow the CWD repository to differ from the Issue ref (for scripts and runs outside the CWD)'),
|
|
118
153
|
force_overwrite_active: z.boolean().default(false).describe('Disable the .pecot-active overwrite guard (when sure it is stale)'),
|
|
154
|
+
dry_run: z.boolean().default(false).describe('Show what would be created and recorded without writing anything'),
|
|
119
155
|
}),
|
|
120
|
-
positional: ['issue_ref', '
|
|
121
|
-
shortFlags: { base: '-b', allow_cross_repo: '-X', force_overwrite_active: '-F' },
|
|
156
|
+
positional: ['issue_ref', 'branch'],
|
|
157
|
+
shortFlags: { base: '-b', allow_cross_repo: '-X', force_overwrite_active: '-F', dry_run: '-n' },
|
|
122
158
|
negations: { checkout: '--no-checkout' },
|
|
123
159
|
interactive: false,
|
|
124
160
|
run: async (input, io) => {
|
|
125
161
|
requireRepositoryMatch('reject', input.repo, io, process.cwd());
|
|
126
|
-
const out = createOutput(
|
|
162
|
+
const out = createOutput(input.dry_run, io);
|
|
127
163
|
// 1. 設定取得
|
|
128
164
|
const config = requireActiveConfig(out);
|
|
129
165
|
// 2. issue_ref をパース(フル形式必須、基準リポは渡さない)
|
|
@@ -134,16 +170,14 @@ const branchCreationCommand = defineCommand({
|
|
|
134
170
|
catch (error) {
|
|
135
171
|
if (!(error instanceof ReferenceParseError))
|
|
136
172
|
throw error;
|
|
137
|
-
return stopWith(out, error.message, USAGE_EXIT_CODE);
|
|
173
|
+
return stopWith(out, error.message, 'invalid-input', USAGE_EXIT_CODE);
|
|
138
174
|
}
|
|
139
175
|
const { owner, repository } = issue.repository;
|
|
140
176
|
const issueNumber = issue.number;
|
|
141
177
|
// A-1. 作業ディレクトリと Issue ref のリポジトリの整合チェック
|
|
142
178
|
if (!input.allow_cross_repo)
|
|
143
179
|
rejectCwdRepositoryMismatch(out, owner, repository);
|
|
144
|
-
|
|
145
|
-
const baseBranch = resolveBaseBranch(out, { config, owner, repository, issueNumber, branchName: input.branch_name, base: input.base });
|
|
146
|
-
const finalBranchName = `${input.branch_name}/${String(issueNumber)}`;
|
|
180
|
+
const finalBranchName = `${input.branch}/${String(issueNumber)}`;
|
|
147
181
|
try {
|
|
148
182
|
const client = createGitHubClient(out, config.host);
|
|
149
183
|
// A-2. .pecot-active 上書きガード
|
|
@@ -151,115 +185,52 @@ const branchCreationCommand = defineCommand({
|
|
|
151
185
|
await guardActiveOverwrite(out, client, `${owner}/${repository}/${String(issueNumber)}`);
|
|
152
186
|
// 4. リポジトリがプロジェクトに含まれているか確認
|
|
153
187
|
if (!await isRepositoryInProject(config, owner, repository, client)) {
|
|
154
|
-
stopWith(out, `${owner}/${repository} is not in the project
|
|
188
|
+
stopWith(out, `${owner}/${repository} is not in the project`, 'repo-not-in-project');
|
|
155
189
|
}
|
|
190
|
+
// 4.5. 着手の判定で base を選ぶ。--base は積む先と比べる
|
|
191
|
+
const decision = await decideWorkStart(out, client, config, issue);
|
|
192
|
+
const mismatch = describeBaseMismatch(input.base, decision, issue);
|
|
193
|
+
if (mismatch !== undefined)
|
|
194
|
+
stopWith(out, mismatch, 'invalid-input', USAGE_EXIT_CODE);
|
|
195
|
+
// 3. ベースブランチ決定(積まないときだけ、--base か設定の develop_branch を求める)
|
|
196
|
+
const baseBranch = decision.kind === 'stack' ? decision.branch : resolveBaseBranch(out, { config, owner, repository, issueNumber, branch: input.branch, base: input.base });
|
|
156
197
|
// 5. Issue Node ID とタイトル取得(タイトルはセッション名用)
|
|
157
198
|
const { id: issueNodeId, title: issueTitle } = await client.getIssueNodeIdAndTitle(owner, repository, issueNumber);
|
|
158
199
|
// 6. ベースブランチの commit SHA 取得
|
|
159
|
-
|
|
200
|
+
let baseSha;
|
|
201
|
+
try {
|
|
202
|
+
baseSha = await client.getBranchSha(owner, repository, baseBranch);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (error instanceof GitHubAPIError && decision.kind === 'stack') {
|
|
206
|
+
return stopWith(out, `base branch ${baseBranch} of ${displayReference(decision.issue, issue.repository)} not found: ${error.message}`, 'git-unresolved');
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
const stackedNote = decision.kind === 'stack' ? ` (stacked on ${displayReference(decision.issue, issue.repository)})` : '';
|
|
211
|
+
if (input.dry_run) {
|
|
212
|
+
out.planned({ verb: 'create', target: `branch ${finalBranchName} in ${owner}/${repository} from ${baseBranch}${stackedNote}` });
|
|
213
|
+
out.planned({ verb: 'set', target: `Issue ${owner}/${repository}/${String(issueNumber)} status active` });
|
|
214
|
+
planWorkTarget(out, owner, repository, issueNumber);
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
160
217
|
// 7. リンクブランチ作成(ブランチ名末尾に Issue 番号を自動付与)
|
|
161
218
|
const createdBranch = await client.createLinkedBranch(issueNodeId, baseSha, finalBranchName);
|
|
162
|
-
out.done({ verb: 'create', target: `branch ${createdBranch} in ${owner}/${repository} from ${baseBranch}` });
|
|
219
|
+
out.done({ verb: 'create', target: `branch ${createdBranch} in ${owner}/${repository} from ${baseBranch}${stackedNote}` });
|
|
163
220
|
// 7.5. プロジェクトアイテムのステータスを active に更新
|
|
164
221
|
await setIssueStatusActive(out, client, config, { owner, repository, number: issueNumber });
|
|
165
222
|
// 9. 作業対象を .pecot-active と .pecot-session-title に保存(hook の自動投稿とセッション名用)
|
|
166
|
-
recordWorkTarget(out, owner, repository, issueNumber, issueTitle
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
catch (error) {
|
|
170
|
-
if (!(error instanceof GitHubAPIError))
|
|
171
|
-
throw error;
|
|
172
|
-
out.error(`could not create branch ${finalBranchName} in ${owner}/${repository}: ${error.message}`);
|
|
173
|
-
return 1;
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
const branchDeletionCommand = defineCommand({
|
|
178
|
-
path: ['delete-branch'],
|
|
179
|
-
description: 'Delete a remote branch (a protected branch is never deleted)',
|
|
180
|
-
input: z.strictObject({
|
|
181
|
-
repo_ref: z.string().describe('Repository reference (owner/repo)'),
|
|
182
|
-
branch: z.string().describe('Name of the branch to delete'),
|
|
183
|
-
dry_run: z.boolean().default(false).describe('Show what would be deleted without deleting anything'),
|
|
184
|
-
}),
|
|
185
|
-
positional: ['repo_ref', 'branch'],
|
|
186
|
-
shortFlags: { dry_run: '-n' },
|
|
187
|
-
interactive: false,
|
|
188
|
-
run: async (input, io) => {
|
|
189
|
-
requireRepositoryMatch('reject', input.repo, io, process.cwd());
|
|
190
|
-
const out = createOutput(input.dry_run, io);
|
|
191
|
-
// 1. repo_ref をパース
|
|
192
|
-
let target;
|
|
193
|
-
try {
|
|
194
|
-
target = parseRepositoryReference(input.repo_ref);
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
if (!(error instanceof ReferenceParseError))
|
|
198
|
-
throw error;
|
|
199
|
-
return stopWith(out, error.message, USAGE_EXIT_CODE);
|
|
200
|
-
}
|
|
201
|
-
const { owner, repository } = target;
|
|
202
|
-
// 2. 設定取得
|
|
203
|
-
const config = requireActiveConfig(out);
|
|
204
|
-
// 3. 保護ブランチ収集(設定の develop_branch・release_branch と、API の既定ブランチ)
|
|
205
|
-
const protectedBranches = new Set();
|
|
206
|
-
const repositoryConfig = findRepository(config, owner, repository);
|
|
207
|
-
for (const branch of [repositoryConfig?.develop_branch, repositoryConfig?.release_branch]) {
|
|
208
|
-
if (branch !== undefined && branch !== '')
|
|
209
|
-
protectedBranches.add(branch);
|
|
210
|
-
}
|
|
211
|
-
let client;
|
|
212
|
-
try {
|
|
213
|
-
client = createGitHubClient(out, config.host);
|
|
214
|
-
protectedBranches.add(await client.getRepositoryDefaultBranch(owner, repository));
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
if (!(error instanceof GitHubAPIError))
|
|
218
|
-
throw error;
|
|
219
|
-
out.error(`could not read the default branch of ${owner}/${repository}: ${error.message}`);
|
|
220
|
-
return 1;
|
|
221
|
-
}
|
|
222
|
-
// 4. 保護ブランチチェック
|
|
223
|
-
if (protectedBranches.has(input.branch)) {
|
|
224
|
-
out.error(`${input.branch} is a protected branch\nprotected: ${[...protectedBranches].toSorted(compareStrings).join(', ')}`);
|
|
225
|
-
return 1;
|
|
226
|
-
}
|
|
227
|
-
// 5. dry-run
|
|
228
|
-
const operation = { verb: 'delete', target: `remote branch ${input.branch} in ${owner}/${repository}` };
|
|
229
|
-
if (input.dry_run) {
|
|
230
|
-
out.planned(operation);
|
|
223
|
+
recordWorkTarget(out, owner, repository, issueNumber, issueTitle, {
|
|
224
|
+
base: { branch: baseBranch, sha: baseSha, stackedOn: decision.kind === 'stack' ? decision.issue : undefined },
|
|
225
|
+
});
|
|
231
226
|
return 0;
|
|
232
227
|
}
|
|
233
|
-
// 6. 削除実行
|
|
234
|
-
try {
|
|
235
|
-
await client.deleteBranch(owner, repository, input.branch);
|
|
236
|
-
}
|
|
237
228
|
catch (error) {
|
|
238
229
|
if (!(error instanceof GitHubAPIError))
|
|
239
230
|
throw error;
|
|
240
|
-
out
|
|
241
|
-
return 1;
|
|
231
|
+
return stopWith(out, `could not create branch ${finalBranchName} in ${owner}/${repository}: ${error.message}`, kindOfFailure(error));
|
|
242
232
|
}
|
|
243
|
-
out.done(operation);
|
|
244
|
-
// wip ブランチも連動削除
|
|
245
|
-
const wipBranch = `wip/${input.branch}`;
|
|
246
|
-
try {
|
|
247
|
-
await client.deleteBranch(owner, repository, wipBranch);
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
if (!(error instanceof GitHubAPIError))
|
|
251
|
-
throw error;
|
|
252
|
-
// wip ブランチの削除の失敗だけは、API の応答の本文の詳細も見せる(Python の describe_api_error と同じ)。存在しない場合は何も出さない
|
|
253
|
-
if (!isMissingReferenceError(error))
|
|
254
|
-
out.warning(`could not delete remote branch ${wipBranch} in ${owner}/${repository}: ${describeApiError(error)}`);
|
|
255
|
-
return 0;
|
|
256
|
-
}
|
|
257
|
-
out.done({ verb: 'delete', target: `remote branch ${wipBranch} in ${owner}/${repository}` });
|
|
258
|
-
return 0;
|
|
259
233
|
},
|
|
260
234
|
});
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
*/
|
|
264
|
-
export const REPOSITORY_COMMANDS = [branchCreationCommand, branchDeletionCommand];
|
|
265
|
-
//# sourceMappingURL=repository.js.map
|
|
235
|
+
export const SESSION_START_COMMANDS = [sessionStartCommand];
|
|
236
|
+
//# sourceMappingURL=session-start.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { CommandDefinition } from './command-definition.js';
|
|
2
|
+
/**
|
|
3
|
+
session のグループのコマンド。start は session-start.ts、finish は session-finish.ts にある。並びは help の一覧に出る順
|
|
4
|
+
*/
|
|
2
5
|
export declare const SESSION_COMMANDS: readonly CommandDefinition[];
|
|
3
6
|
//# sourceMappingURL=session.d.ts.map
|