@pecot/workflow-mcp 6.0.0 → 7.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 +4 -57
- package/cli/dist/commands/board-add.js +11 -1
- package/cli/dist/commands/board-judgment.d.ts +12 -3
- package/cli/dist/commands/board-judgment.js +12 -6
- package/cli/dist/commands/board-move.js +9 -1
- package/cli/dist/commands/board-readiness.d.ts +3 -3
- package/cli/dist/commands/board-show.js +5 -2
- package/cli/dist/commands/board-sync.js +14 -5
- package/cli/dist/commands/board-view.d.ts +94 -5
- package/cli/dist/commands/board-view.js +119 -17
- package/cli/dist/commands/branch.js +12 -1
- package/cli/dist/commands/command-definition.d.ts +19 -2
- package/cli/dist/commands/command-definition.js +9 -0
- package/cli/dist/commands/failure-kind.d.ts +1 -1
- package/cli/dist/commands/failure-kind.js +1 -0
- package/cli/dist/commands/issue-board.d.ts +31 -3
- package/cli/dist/commands/issue-board.js +28 -4
- package/cli/dist/commands/issue-comment.js +19 -2
- package/cli/dist/commands/issue-create.js +90 -7
- package/cli/dist/commands/issue-dependency.js +32 -4
- package/cli/dist/commands/issue-readiness.d.ts +30 -2
- package/cli/dist/commands/issue-readiness.js +35 -0
- package/cli/dist/commands/issue-reopen.js +18 -3
- package/cli/dist/commands/issue-shared.d.ts +3 -3
- package/cli/dist/commands/issue-shared.js +3 -2
- package/cli/dist/commands/issue-show.js +78 -8
- package/cli/dist/commands/names.js +1 -0
- package/cli/dist/commands/output.d.ts +18 -2
- package/cli/dist/commands/output.js +16 -3
- package/cli/dist/commands/pr-merge.d.ts +3 -0
- package/cli/dist/commands/pr-merge.js +230 -0
- package/cli/dist/commands/pr-reference.d.ts +8 -0
- package/cli/dist/commands/pr-reference.js +30 -0
- package/cli/dist/commands/pr-restack.d.ts +6 -0
- package/cli/dist/commands/pr-restack.js +233 -0
- package/cli/dist/commands/pr-waiting.d.ts +41 -2
- package/cli/dist/commands/pr-waiting.js +74 -37
- package/cli/dist/commands/pr.d.ts +10 -6
- package/cli/dist/commands/pr.js +160 -67
- package/cli/dist/commands/project-sync.d.ts +10 -2
- package/cli/dist/commands/project-sync.js +7 -6
- package/cli/dist/commands/project.js +173 -16
- package/cli/dist/commands/registry.js +2 -0
- package/cli/dist/commands/release.js +67 -18
- package/cli/dist/commands/repository-match.js +7 -2
- package/cli/dist/commands/session-finish.js +128 -12
- package/cli/dist/commands/session-start.js +22 -6
- package/cli/dist/commands/session.js +121 -20
- package/cli/dist/commands/tracker-sync-dependabot.js +21 -4
- package/cli/dist/commands/tracker-sync-security.js +22 -4
- package/cli/dist/commands/tracker-sync.d.ts +30 -0
- package/cli/dist/commands/tracker-sync.js +15 -0
- package/cli/dist/commands/tracker.js +2 -0
- package/cli/dist/commands/work-target.d.ts +10 -2
- package/cli/dist/commands/work-target.js +6 -4
- package/cli/dist/commands/worktree.js +71 -5
- package/cli/dist/domain/issue-readout.d.ts +0 -4
- package/cli/dist/domain/pull-request.d.ts +1 -1
- package/cli/dist/domain/readiness.d.ts +17 -0
- package/cli/dist/domain/readiness.js +39 -2
- package/cli/dist/domain/restack.d.ts +62 -0
- package/cli/dist/domain/restack.js +53 -0
- package/cli/dist/domain/state.d.ts +39 -0
- package/cli/dist/domain/state.js +28 -1
- package/cli/dist/domain/work-start.d.ts +0 -4
- package/cli/dist/domain/work-start.js +0 -7
- package/cli/dist/infra/git.d.ts +64 -0
- package/cli/dist/infra/git.js +110 -0
- package/cli/dist/infra/github/pulls.d.ts +81 -2
- package/cli/dist/infra/github/pulls.js +116 -5
- package/cli/dist/infra/github/queries.d.ts +4 -1
- package/cli/dist/infra/github/queries.js +47 -32
- package/cli/dist/infra/github/readout.js +0 -33
- package/cli/dist/mcp/result.d.ts +63 -16
- package/cli/dist/mcp/result.js +106 -30
- package/cli/dist/mcp/server.js +37 -4
- package/cli/templates/comment/plan.md +2 -2
- package/cli/templates/comment/review-findings.md +3 -2
- package/cli/templates/issue/bug.md +13 -4
- package/cli/templates/issue/task.md +13 -4
- package/cli/templates/workflow/pecot-board-sync.yml +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import { upsertWaitsForMerge } from '../domain/prerequisites.js';
|
|
|
15
15
|
import { FLAG_ISSUE_CREATE_SLASH_PENDING, FLAG_ISSUE_PENDING, FLAG_PECOT_QUICK_MODE } from '../domain/state.js';
|
|
16
16
|
import { compareStrings, pythonRightStrip, pythonStrip, pythonStringRepr, truncateCodePoints } from '../domain/python-format.js';
|
|
17
17
|
import { createIssueReference, issueReferenceKey, issueReferenceToCliReference } from '../domain/reference-parser.js';
|
|
18
|
-
import { describeReadiness, displayReference, hasStarted } from '../domain/readiness.js';
|
|
18
|
+
import { describeReadiness, displayReference, hasStarted, stackChains } from '../domain/readiness.js';
|
|
19
19
|
import { parseIssueFile } from '../infra/frontmatter-file.js';
|
|
20
20
|
import { DependenciesUnsupportedError, GitHubAPIError } from '../infra/github/errors.js';
|
|
21
21
|
import { DEPENDENCIES_UNSUPPORTED } from '../infra/github/issues.js';
|
|
@@ -31,7 +31,7 @@ import { createGitHubClient } from './github-client.js';
|
|
|
31
31
|
import { applyBoardMove } from './issue-board.js';
|
|
32
32
|
import { createReadinessCache, readIssueReadiness } from './issue-readiness.js';
|
|
33
33
|
import { addToBoardOrWarn, BACKLOG_TYPES, buildIssueTitle, clientForIssueCreate, createIssueOrExit, ensureRepositoryInProject, ISSUE_TYPE_SCHEMA, issuePath, linkToParentEpic, normalizeParentEpicCli, PARENT_EPIC_DESCRIPTION, readUsedOrders, resolveEpicTargetRepository, resolveParentEpicReference, runWithExit, setIssueFields, stopForDuplicateOrder, summarizeCreatedIssue, TYPE_DEFAULT_STATUS, validateIssueTemplate, validateStatusForType, warnEpicRepositoryException, } from './issue-shared.js';
|
|
34
|
-
import { createOutput } from './output.js';
|
|
34
|
+
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
35
35
|
import { USAGE_EXIT_CODE } from './usage-error.js';
|
|
36
36
|
const FILES_SCHEMA = z.array(z.string()).optional().describe('Path of a Markdown file with frontmatter (several for a batch post)');
|
|
37
37
|
const LABEL_SCHEMA = z.array(z.string()).optional().describe('Label (can be given several times)');
|
|
@@ -43,6 +43,44 @@ const PLACEHOLDER_PATTERN = /\{\{issue:([^{}\s]+)\}\}/gu;
|
|
|
43
43
|
const PREPARED_FILENAME_PATTERN = /^issue-.+-\d{8}-\d{6}-(?<suffix>.+)$/u;
|
|
44
44
|
// Python の `$` は末尾の改行の前にも当たる
|
|
45
45
|
const REPOSITORY_SEGMENT_PATTERN = /^[\w.-]+\n?$/u;
|
|
46
|
+
// validateStatusForType が、作るときの status を型の既定(backlog・ready)か、前提があるときの blocked に限る
|
|
47
|
+
const CREATED_STATUS = z.enum(['backlog', 'blocked', 'ready']);
|
|
48
|
+
function isCreatedStatus(value) {
|
|
49
|
+
return CREATED_STATUS.safeParse(value).success;
|
|
50
|
+
}
|
|
51
|
+
const CREATED_ISSUE_DATA = z.strictObject({
|
|
52
|
+
owner: z.string().describe('Owner of the repository of the Issue'),
|
|
53
|
+
repository: z.string().describe('Name of the repository of the Issue'),
|
|
54
|
+
number: z.int().describe('Issue number'),
|
|
55
|
+
url: z.string().describe('URL of the Issue'),
|
|
56
|
+
status: CREATED_STATUS.optional().describe('Workflow status written on the board (ready when it was moved out of blocked; omitted when not written)'),
|
|
57
|
+
parent: z.string().optional().describe('Parent Epic the Issue was added to as a sub-issue (owner/repo/N; omitted when none)'),
|
|
58
|
+
});
|
|
59
|
+
const STACKABLE_CHAINS = z.array(z.array(z.string())).optional().describe('Stackable chains, each from the bottom; files by key, existing Issues as #N or owner/repo#N (omitted when none)');
|
|
60
|
+
const PLAN_PREREQUISITE_DATA = z.strictObject({
|
|
61
|
+
issue: z.string().describe('Prerequisite: key of a file, or #N / owner/repo#N for an existing Issue'),
|
|
62
|
+
wait: z.enum(['stack', 'merge']).describe('How to wait for the prerequisite'),
|
|
63
|
+
});
|
|
64
|
+
const PLAN_ROW_DATA = z.strictObject({
|
|
65
|
+
file: z.string().describe('Key of the file (the --prepare suffix, else the file stem)'),
|
|
66
|
+
order: z.int().optional().describe('Order number in the title (omitted without a parent Epic)'),
|
|
67
|
+
blockedBy: z.array(PLAN_PREREQUISITE_DATA).describe('Prerequisites in the order written'),
|
|
68
|
+
approach: z.enum(['alone', 'wait-merge', 'stack', 'join']).describe('How to proceed'),
|
|
69
|
+
stackOn: z.string().optional().describe('Prerequisite to stack on (only when approach is stack)'),
|
|
70
|
+
});
|
|
71
|
+
const PLANNED_ISSUE_DATA = z.strictObject({
|
|
72
|
+
owner: z.string().describe('Owner of the repository'),
|
|
73
|
+
repository: z.string().describe('Name of the repository'),
|
|
74
|
+
title: z.string().describe('Title of the Issue'),
|
|
75
|
+
});
|
|
76
|
+
const ISSUE_CREATE_OUTPUT = z.strictObject({
|
|
77
|
+
issues: z.array(CREATED_ISSUE_DATA).optional().describe('Issues created, in the order of creation (also kept on a failure after some were created)'),
|
|
78
|
+
stackableChains: STACKABLE_CHAINS,
|
|
79
|
+
plan: z.array(PLAN_ROW_DATA).optional().describe('Progression table of the files (only on dry_run with files)'),
|
|
80
|
+
plannedIssue: PLANNED_ISSUE_DATA.optional().describe('Issue that would be created (only on dry_run with message or freeform)'),
|
|
81
|
+
file: z.string().optional().describe('Absolute path of the template file copied (only with prepare)'),
|
|
82
|
+
dryRun: DRY_RUN_FIELD,
|
|
83
|
+
});
|
|
46
84
|
// --- 共通 ---
|
|
47
85
|
// owner/repo の形が不正なら error と終了コード 2。正しければ owner と name を返す
|
|
48
86
|
function validateRepositoryShape(output, repository) {
|
|
@@ -51,6 +89,16 @@ function validateRepositoryShape(output, repository) {
|
|
|
51
89
|
const message = `invalid repository format: ${repository}\nexpected: owner/repo`;
|
|
52
90
|
return isValid ? [parts.owner, parts.repository] : stopWith(output, message, 'invalid-input', USAGE_EXIT_CODE);
|
|
53
91
|
}
|
|
92
|
+
function newSession() {
|
|
93
|
+
return { failures: [], cache: createReadinessCache(), issues: [] };
|
|
94
|
+
}
|
|
95
|
+
// 投稿中の Issue は常に末尾にある。isUpdate なら末尾を書き換え、そうでなければ足す
|
|
96
|
+
function recordIssue(output, session, entry, isUpdate) {
|
|
97
|
+
if (isUpdate)
|
|
98
|
+
session.issues.pop();
|
|
99
|
+
session.issues.push(entry);
|
|
100
|
+
output.result({ issues: [...session.issues] });
|
|
101
|
+
}
|
|
54
102
|
function reAddCommand(issue, prerequisite) {
|
|
55
103
|
const base = { issue_ref: issueReferenceToCliReference(issue), by: issueReferenceToCliReference(prerequisite.reference) };
|
|
56
104
|
return commandHint(['issue', 'block'], prerequisite.wait === 'merge' ? { ...base, wait: 'merge', reason: prerequisite.reason ?? '' } : base);
|
|
@@ -131,6 +179,8 @@ async function postIssue(output, client, config, session, posting) {
|
|
|
131
179
|
const { owner, repository } = posting;
|
|
132
180
|
const issue = await createIssueOrExit(output, client, owner, repository, posting.title, posting.body, posting.labels, posting.source);
|
|
133
181
|
const { number, url, nodeId } = summarizeCreatedIssue(issue);
|
|
182
|
+
const entry = { owner, repository, number, url };
|
|
183
|
+
recordIssue(output, session, entry, false);
|
|
134
184
|
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
135
185
|
const reference = createIssueReference(createRepositoryReference(owner, repository), number);
|
|
136
186
|
consumeFlag(FLAG_ISSUE_PENDING);
|
|
@@ -149,17 +199,26 @@ async function postIssue(output, client, config, session, posting) {
|
|
|
149
199
|
if (!hasTriedBoard)
|
|
150
200
|
added = await addToBoardOrWarn(output, client, config, owner, repository, number, posting.useResponseNodeId ? nodeId : undefined, url);
|
|
151
201
|
let isMovedToReady = false;
|
|
202
|
+
let status;
|
|
152
203
|
if (added !== undefined) {
|
|
153
204
|
const written = await setIssueFields(output, client, config, added.itemId, target, posting.fields);
|
|
205
|
+
const option = written.includes('workflow') ? posting.fields.find(field => field.fieldName === 'workflow')?.optionName : undefined;
|
|
206
|
+
if (option !== undefined && isCreatedStatus(option))
|
|
207
|
+
status = option;
|
|
208
|
+
recordIssue(output, session, { ...entry, ...status !== undefined && { status } }, true);
|
|
154
209
|
if (posting.settleColumn && written.includes('workflow') && linked === posting.prerequisites.length) {
|
|
155
210
|
isMovedToReady = await settleColumn(output, client, config, session, reference, added, linked) === 'Ready';
|
|
211
|
+
if (isMovedToReady)
|
|
212
|
+
status = 'ready';
|
|
156
213
|
}
|
|
157
214
|
}
|
|
158
215
|
const knownNodeId = added?.issueNodeId ?? issueNodeId;
|
|
216
|
+
let parent;
|
|
159
217
|
if (posting.parentReference !== undefined) {
|
|
160
218
|
// ボードへの追加に失敗したときは、URL を出し済み
|
|
161
|
-
await linkToParentEpic(output, client, target, posting.parentReference, knownNodeId ?? (() => client.getIssueNodeId(owner, repository, number)), added === undefined ? undefined : url);
|
|
219
|
+
parent = await linkToParentEpic(output, client, target, posting.parentReference, knownNodeId ?? (() => client.getIssueNodeId(owner, repository, number)), added === undefined ? undefined : url);
|
|
162
220
|
}
|
|
221
|
+
recordIssue(output, session, { ...entry, ...status !== undefined && { status }, ...parent !== undefined && { parent } }, true);
|
|
163
222
|
if (added !== undefined)
|
|
164
223
|
output.data(url);
|
|
165
224
|
return { number, nodeId: knownNodeId, isMovedToReady, isOnBoard: added !== undefined };
|
|
@@ -168,6 +227,7 @@ async function postIssue(output, client, config, session, posting) {
|
|
|
168
227
|
予行の行。番号の要るボード・欄・親 Epic の書き込みは出さない
|
|
169
228
|
*/
|
|
170
229
|
function planIssue(output, owner, repository, title) {
|
|
230
|
+
output.result({ plannedIssue: { owner, repository, title } });
|
|
171
231
|
output.planned({ verb: 'create', target: `Issue in ${owner}/${repository}: ${title}` });
|
|
172
232
|
}
|
|
173
233
|
function parentReferenceOf(raw, config, owner, repository) {
|
|
@@ -185,6 +245,7 @@ function prepareTemplate(output, template, repository, suffix, isDryRun) {
|
|
|
185
245
|
stopWith(output, `template not found: ${source}`, 'other');
|
|
186
246
|
}
|
|
187
247
|
if (isDryRun) {
|
|
248
|
+
output.result({});
|
|
188
249
|
output.planned({ verb: 'create', target: `Issue template ${template} in ${outputDirectory()}` });
|
|
189
250
|
return;
|
|
190
251
|
}
|
|
@@ -196,6 +257,7 @@ function prepareTemplate(output, template, repository, suffix, isDryRun) {
|
|
|
196
257
|
try {
|
|
197
258
|
withReservedOutputPath(outputDirectory(), timestamp => `issue-${template}-${timestamp}${nameSuffix}.md`, (reserved) => {
|
|
198
259
|
writeFileSync(reserved, content, 'utf8');
|
|
260
|
+
output.result({ file: path.resolve(reserved) });
|
|
199
261
|
output.data(reserved);
|
|
200
262
|
});
|
|
201
263
|
}
|
|
@@ -419,6 +481,11 @@ async function readExistingPrerequisites(output, client, files, prerequisites) {
|
|
|
419
481
|
function chainsText(progressions, labels) {
|
|
420
482
|
return formatStackableChains(progressions, key => labels.get(key) ?? key);
|
|
421
483
|
}
|
|
484
|
+
// formatStackableChains と同じ並びを、表記に直した配列で返す
|
|
485
|
+
function chainsData(progressions, labels) {
|
|
486
|
+
const chains = stackChains(progressions).filter(chain => chain.length >= 2).map(chain => chain.map(key => labels.get(key) ?? key));
|
|
487
|
+
return chains.length === 0 ? {} : { stackableChains: chains };
|
|
488
|
+
}
|
|
422
489
|
function expandPlaceholders(body, created, owner, repository) {
|
|
423
490
|
return body.replaceAll(PLACEHOLDER_PATTERN, (whole, key) => {
|
|
424
491
|
const issue = created.get(key);
|
|
@@ -494,6 +561,18 @@ function existingLabels(context) {
|
|
|
494
561
|
}
|
|
495
562
|
return labels;
|
|
496
563
|
}
|
|
564
|
+
function planRowData(row, home) {
|
|
565
|
+
const label = ({ target, key }) => target.kind === 'file' ? key : displayReference(target.reference, home);
|
|
566
|
+
const { progression } = row;
|
|
567
|
+
const stackOn = progression?.kind === 'stack' ? row.prerequisites.find(({ key }) => key === progression.on) : undefined;
|
|
568
|
+
return {
|
|
569
|
+
file: row.file,
|
|
570
|
+
...row.order !== undefined && { order: row.order },
|
|
571
|
+
blockedBy: row.prerequisites.map(prerequisite => ({ issue: label(prerequisite), wait: prerequisite.wait })),
|
|
572
|
+
approach: progression?.kind ?? 'alone',
|
|
573
|
+
...progression?.kind === 'stack' && { stackOn: stackOn === undefined ? progression.on : label(stackOn) },
|
|
574
|
+
};
|
|
575
|
+
}
|
|
497
576
|
function printPlan(output, context) {
|
|
498
577
|
const rows = context.locals.map((local, index) => ({
|
|
499
578
|
file: local.key,
|
|
@@ -501,7 +580,9 @@ function printPlan(output, context) {
|
|
|
501
580
|
prerequisites: context.prerequisites.at(index) ?? [],
|
|
502
581
|
progression: context.progressions.get(local.key),
|
|
503
582
|
}));
|
|
504
|
-
const
|
|
583
|
+
const labels = existingLabels(context);
|
|
584
|
+
output.result({ plan: rows.map(row => planRowData(row, context.home)), ...chainsData(context.progressions, labels) });
|
|
585
|
+
const chains = chainsText(context.progressions, labels);
|
|
505
586
|
output.data([formatPlanTable(rows, context.home), ...chains === undefined ? [] : ['', chains]].join('\n'));
|
|
506
587
|
}
|
|
507
588
|
function postPrerequisites(context, index, posted) {
|
|
@@ -525,7 +606,7 @@ function postPrerequisites(context, index, posted) {
|
|
|
525
606
|
}
|
|
526
607
|
async function postFiles(output, context) {
|
|
527
608
|
const { locals, client, config } = context;
|
|
528
|
-
const session =
|
|
609
|
+
const session = newSession();
|
|
529
610
|
const created = new Map();
|
|
530
611
|
const posted = [];
|
|
531
612
|
const labels = existingLabels(context);
|
|
@@ -569,6 +650,7 @@ async function postFiles(output, context) {
|
|
|
569
650
|
consumeFlag(FLAG_ISSUE_CREATE_SLASH_PENDING);
|
|
570
651
|
if (session.failures.length > 0)
|
|
571
652
|
throw new CommandExit(1, 'partial-failure');
|
|
653
|
+
output.result(chainsData(progressions, labels));
|
|
572
654
|
const chains = chainsText(progressions, labels);
|
|
573
655
|
if (chains !== undefined)
|
|
574
656
|
output.data(`\n${chains}`);
|
|
@@ -613,7 +695,7 @@ async function createDirect(output, options, loadedConfig, isDryRun) {
|
|
|
613
695
|
fields.push({ fieldName: 'priority', optionName: options.priority, label: `priority ${options.priority}` });
|
|
614
696
|
if (options.size !== undefined && options.size !== '')
|
|
615
697
|
fields.push({ fieldName: 'size', optionName: options.size, label: `size ${options.size}` });
|
|
616
|
-
await postIssue(output, client, config,
|
|
698
|
+
await postIssue(output, client, config, newSession(), {
|
|
617
699
|
owner,
|
|
618
700
|
repository,
|
|
619
701
|
title,
|
|
@@ -693,7 +775,7 @@ async function createFreeform(output, input, isDryRun) {
|
|
|
693
775
|
planIssue(output, owner, repository, title);
|
|
694
776
|
return;
|
|
695
777
|
}
|
|
696
|
-
const posted = await postIssue(output, client, config,
|
|
778
|
+
const posted = await postIssue(output, client, config, newSession(), {
|
|
697
779
|
owner,
|
|
698
780
|
repository,
|
|
699
781
|
title,
|
|
@@ -754,6 +836,7 @@ const ISSUE_CREATE = defineCommand({
|
|
|
754
836
|
template: TEMPLATE_SCHEMA,
|
|
755
837
|
suffix: z.string().optional().describe('Suffix of the output file name (only with --prepare)'),
|
|
756
838
|
}),
|
|
839
|
+
output: ISSUE_CREATE_OUTPUT,
|
|
757
840
|
positional: ['files'],
|
|
758
841
|
shortFlags: { message: '-m', title: '-t', repo: '-r', label: '-l', prepare: '-p', suffix: '-s', dry_run: '-n' },
|
|
759
842
|
interactive: false,
|
|
@@ -5,7 +5,7 @@ import { hasExpectedPrerequisites, decideBlock, decideUnblock, searchCycle } fro
|
|
|
5
5
|
import { decideBoardMove } from '../domain/board-move.js';
|
|
6
6
|
import { getOptionId } from '../domain/config.js';
|
|
7
7
|
import { describeReadiness, displayReference, hasStarted } from '../domain/readiness.js';
|
|
8
|
-
import { createIssueReference, issueReferenceKey } from '../domain/reference-parser.js';
|
|
8
|
+
import { createIssueReference, issueReferenceKey, issueReferenceToCliReference } from '../domain/reference-parser.js';
|
|
9
9
|
import { createRepositoryReference } from '../domain/repository-resolver.js';
|
|
10
10
|
import { MAX_BLOCKED_BY } from '../infra/github/issues.js';
|
|
11
11
|
import { defineCommand } from './command-definition.js';
|
|
@@ -16,12 +16,27 @@ import { apiFailureMessage, createGitHubClient } from './github-client.js';
|
|
|
16
16
|
import { applyBoardMove } from './issue-board.js';
|
|
17
17
|
import { createReadinessCache, readIssueReadiness } from './issue-readiness.js';
|
|
18
18
|
import { ensureRepositoryInProject, ISSUE_REF_DESCRIPTION, parseIssueReferenceOrExit, runWithExit } from './issue-shared.js';
|
|
19
|
-
import { createOutput } from './output.js';
|
|
19
|
+
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
20
20
|
import { USAGE_EXIT_CODE } from './usage-error.js';
|
|
21
21
|
const CONTENT_EXIT_CODE = 3;
|
|
22
22
|
// たどる Issue の数の上限。大きな連鎖で止まらないことより、確かめずに付けないことを優先する
|
|
23
23
|
const MAX_CYCLE_ISSUES = 200;
|
|
24
24
|
const BLOCK_PATH = ['issue', 'block'];
|
|
25
|
+
const ISSUE_FIELD = z.string().describe('The waiting Issue (owner/repo/N)');
|
|
26
|
+
const BY_FIELD = z.string().describe('The prerequisite Issue (owner/repo/N)');
|
|
27
|
+
const ISSUE_BLOCK_OUTPUT = z.strictObject({
|
|
28
|
+
issue: ISSUE_FIELD,
|
|
29
|
+
by: BY_FIELD,
|
|
30
|
+
wait: z.enum(['stack', 'merge']).describe('Wait kind of the blocked-by after the command'),
|
|
31
|
+
change: z.enum(['added', 'updated', 'unchanged']).describe('added (new blocked-by), updated (wait kind or reason changed), or unchanged'),
|
|
32
|
+
dryRun: DRY_RUN_FIELD,
|
|
33
|
+
});
|
|
34
|
+
const ISSUE_UNBLOCK_OUTPUT = z.strictObject({
|
|
35
|
+
issue: ISSUE_FIELD,
|
|
36
|
+
by: BY_FIELD,
|
|
37
|
+
change: z.enum(['removed', 'unchanged']).describe('removed, or unchanged when it was not a blocked-by'),
|
|
38
|
+
dryRun: DRY_RUN_FIELD,
|
|
39
|
+
});
|
|
25
40
|
function toReference(target) {
|
|
26
41
|
return createIssueReference(createRepositoryReference(target.owner, target.repository), target.number);
|
|
27
42
|
}
|
|
@@ -159,10 +174,12 @@ async function runBlock(out, input) {
|
|
|
159
174
|
if (linked === undefined && total >= MAX_BLOCKED_BY)
|
|
160
175
|
stopWith(out, `${name} already has ${String(MAX_BLOCKED_BY)} blocked-by issues`, 'dependency-rejected');
|
|
161
176
|
const decision = decideBlock({ body: read.body, home, by, wait: input.wait, reason, isLinked: linked !== undefined });
|
|
177
|
+
const result = { issue: issueReferenceToCliReference(target), by: issueReferenceToCliReference(by), wait: input.wait };
|
|
162
178
|
if (decision.kind === 'malformed') {
|
|
163
179
|
stopWith(out, `Waits for merge of ${name} is malformed: ${decision.reason}; fix the section in the Issue body and run the command again`, 'content-invalid', CONTENT_EXIT_CODE);
|
|
164
180
|
}
|
|
165
181
|
else if (decision.kind === 'unchanged') {
|
|
182
|
+
out.result({ ...result, change: 'unchanged' });
|
|
166
183
|
out.planned({ verb: 'unchanged', target: `blocked-by ${byName} on ${name}` });
|
|
167
184
|
out.done({ verb: 'unchanged', target: `blocked-by ${byName} on ${name}` });
|
|
168
185
|
return;
|
|
@@ -176,8 +193,11 @@ async function runBlock(out, input) {
|
|
|
176
193
|
? { verb: 'add', target: `blocked-by ${byName} to ${name}` }
|
|
177
194
|
: { verb: 'update', target: `blocked-by ${byName} on ${name} (wait: ${input.wait})` };
|
|
178
195
|
out.planned(operation);
|
|
179
|
-
|
|
196
|
+
const change = decision.kind === 'add' ? 'added' : 'updated';
|
|
197
|
+
if (input.dry_run) {
|
|
198
|
+
out.result({ ...result, change });
|
|
180
199
|
return;
|
|
200
|
+
}
|
|
181
201
|
if (byId !== undefined && decision.kind === 'add') {
|
|
182
202
|
const blockingId = byId;
|
|
183
203
|
await wrapped(out, `could not add blocked-by ${byName} to ${name}`, async () => {
|
|
@@ -193,6 +213,7 @@ async function runBlock(out, input) {
|
|
|
193
213
|
}
|
|
194
214
|
if (decision.kind === 'update')
|
|
195
215
|
out.done(operation);
|
|
216
|
+
out.result({ ...result, change });
|
|
196
217
|
const keys = new Set([...keysOf(issues), issueReferenceKey(by)]);
|
|
197
218
|
await moveBoard(context, { keys, by, wait: { wait: input.wait, reason } }, true);
|
|
198
219
|
}
|
|
@@ -216,19 +237,24 @@ async function runUnblock(out, input) {
|
|
|
216
237
|
if (linked === undefined && total > issues.length)
|
|
217
238
|
stopWith(out, `could not read blocked-by of ${name}: ${String(issues.length)} of ${String(total)} issues were read`, 'dependency-unreadable');
|
|
218
239
|
const decision = decideUnblock({ body: read.body, home, by, isLinked: linked !== undefined });
|
|
240
|
+
const result = { issue: issueReferenceToCliReference(target), by: issueReferenceToCliReference(by) };
|
|
219
241
|
if (linked === undefined || decision.kind === 'unchanged') {
|
|
242
|
+
out.result({ ...result, change: 'unchanged' });
|
|
220
243
|
out.planned({ verb: 'unchanged', target: `${name} is not blocked by ${byName}` });
|
|
221
244
|
out.done({ verb: 'unchanged', target: `${name} is not blocked by ${byName}` });
|
|
222
245
|
return;
|
|
223
246
|
}
|
|
224
247
|
const operation = { verb: 'remove', target: `blocked-by ${byName} from ${name}` };
|
|
225
248
|
out.planned(operation);
|
|
226
|
-
if (input.dry_run)
|
|
249
|
+
if (input.dry_run) {
|
|
250
|
+
out.result({ ...result, change: 'removed' });
|
|
227
251
|
return;
|
|
252
|
+
}
|
|
228
253
|
await wrapped(out, `could not remove blocked-by ${byName} from ${name}`, async () => {
|
|
229
254
|
await client.removeBlockedBy(read.id, linked.id);
|
|
230
255
|
});
|
|
231
256
|
out.done(operation);
|
|
257
|
+
out.result({ ...result, change: 'removed' });
|
|
232
258
|
if (decision.malformedReason !== undefined) {
|
|
233
259
|
out.warning(`Waits for merge of ${name} is malformed: ${decision.malformedReason}; the section was not changed`);
|
|
234
260
|
}
|
|
@@ -252,6 +278,7 @@ const ISSUE_BLOCK = defineCommand({
|
|
|
252
278
|
reason: z.string().optional().describe('Why it waits for the merge (required with --wait merge)'),
|
|
253
279
|
dry_run: z.boolean().default(false).describe('Show what would change without writing anything'),
|
|
254
280
|
}),
|
|
281
|
+
output: ISSUE_BLOCK_OUTPUT,
|
|
255
282
|
positional: ['issue_ref'],
|
|
256
283
|
interactive: false,
|
|
257
284
|
run: async (input, io) => {
|
|
@@ -269,6 +296,7 @@ const ISSUE_UNBLOCK = defineCommand({
|
|
|
269
296
|
by: z.string().describe('The prerequisite Issue to remove (`owner/repo/N`; another repository is allowed)'),
|
|
270
297
|
dry_run: z.boolean().default(false).describe('Show what would change without writing anything'),
|
|
271
298
|
}),
|
|
299
|
+
output: ISSUE_UNBLOCK_OUTPUT,
|
|
272
300
|
positional: ['issue_ref'],
|
|
273
301
|
interactive: false,
|
|
274
302
|
run: async (input, io) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import type { ProjectConfig } from '../domain/config.js';
|
|
2
|
-
import type { JsonObject } from '../domain/json.js';
|
|
3
3
|
import type { FactsMismatch, IssueFacts, IssuePullRequest, Prerequisite, Readiness } from '../domain/readiness.js';
|
|
4
4
|
import type { IssueReference } from '../domain/reference-parser.js';
|
|
5
5
|
import type { GitHubClient } from '../infra/github/index.js';
|
|
@@ -80,13 +80,41 @@ DependenciesUnsupportedError はそのまま投げる。
|
|
|
80
80
|
*/
|
|
81
81
|
export declare function judgeSnapshot(client: Readonly<GitHubClient>, snapshot: Readonly<IssueSnapshot>, cache: ReadinessCache, cycle?: readonly string[]): Promise<IssueReadiness>;
|
|
82
82
|
/**
|
|
83
|
+
判定済みの Issue の前提を assume で置き換え、同じ judgeSnapshot で判定し直す。API は、積んだ並びを引き足すときだけ呼ぶ
|
|
84
|
+
*/
|
|
85
|
+
export declare function judgeAssuming(client: Readonly<GitHubClient>, config: ProjectConfig, judged: Readonly<JudgedIssue>, assume: (prerequisites: readonly Prerequisite[]) => readonly Prerequisite[], cache: ReadinessCache): Promise<IssueReadiness>;
|
|
86
|
+
/**
|
|
83
87
|
Issue 1 件の読み取りから判定までを通す。輪は呼ぶ側が渡す(issue show は輪を見ない)
|
|
84
88
|
*/
|
|
85
89
|
export declare function readIssueReadiness(client: Readonly<GitHubClient>, config: ProjectConfig, reference: IssueReference, cache: ReadinessCache, cycle?: readonly string[], blockedByFirst?: number): Promise<IssueReadiness>;
|
|
86
90
|
/**
|
|
91
|
+
readinessJson の形。キーの並びは readinessJson と同じにする
|
|
92
|
+
*/
|
|
93
|
+
export declare const READINESS_JSON: z.ZodObject<{
|
|
94
|
+
kind: z.ZodEnum<{
|
|
95
|
+
blocked: "blocked";
|
|
96
|
+
stackable: "stackable";
|
|
97
|
+
startable: "startable";
|
|
98
|
+
}>;
|
|
99
|
+
stackOn: z.ZodNullable<z.ZodObject<{
|
|
100
|
+
number: z.ZodInt;
|
|
101
|
+
repository: z.ZodString;
|
|
102
|
+
branch: z.ZodString;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
105
|
+
text: z.ZodString;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
export type ReadinessJson = z.input<typeof READINESS_JSON>;
|
|
108
|
+
/**
|
|
109
|
+
board show の判定。前提を読めなかった Issue の kind は unknown
|
|
110
|
+
*/
|
|
111
|
+
export type BoardReadinessJson = Omit<ReadinessJson, 'kind'> & {
|
|
112
|
+
readonly kind: ReadinessJson['kind'] | 'unknown';
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
87
115
|
JSON の出力に使う判定。reason は blocked のときだけの理由のコード、stackOn は積む先
|
|
88
116
|
*/
|
|
89
|
-
export declare function readinessJson(readiness: Readonly<Readiness>, text: string):
|
|
117
|
+
export declare function readinessJson(readiness: Readonly<Readiness>, text: string): ReadinessJson;
|
|
90
118
|
/**
|
|
91
119
|
readIssueReadiness の、依存関係を持たない GHES を判定なしで通す形。GHES なら undefined を返し、onUnsupported に理由を渡す
|
|
92
120
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Issue の着手の可否の読み取り。前提を読み、判定する。board show と issue show が使う。
|
|
2
2
|
// 流れは getIssuePrerequisites → readWaitsForMerge → toIssueFacts → judgeReadiness。
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import { findRepository, workflowFieldName } from '../domain/config.js';
|
|
4
5
|
import { JSON_NULL } from '../domain/json-null.js';
|
|
5
6
|
import { readWaitsForMerge } from '../domain/prerequisites.js';
|
|
@@ -183,6 +184,27 @@ export async function judgeSnapshot(client, snapshot, cache, cycle) {
|
|
|
183
184
|
};
|
|
184
185
|
}
|
|
185
186
|
/**
|
|
187
|
+
判定済みの Issue の前提を assume で置き換え、同じ judgeSnapshot で判定し直す。API は、積んだ並びを引き足すときだけ呼ぶ
|
|
188
|
+
*/
|
|
189
|
+
export async function judgeAssuming(client, config, judged, assume, cache) {
|
|
190
|
+
const { repository } = judged.ref;
|
|
191
|
+
const snapshot = {
|
|
192
|
+
kind: 'snapshot',
|
|
193
|
+
ref: judged.ref,
|
|
194
|
+
title: judged.title,
|
|
195
|
+
target: judged.target,
|
|
196
|
+
prerequisites: assume(judged.prerequisites),
|
|
197
|
+
titles: judged.titles,
|
|
198
|
+
mismatches: judged.mismatches,
|
|
199
|
+
malformedReason: judged.malformedReason,
|
|
200
|
+
parent: judged.parent,
|
|
201
|
+
developmentBranch: findRepository(config, repository.owner, repository.repository)?.develop_branch,
|
|
202
|
+
};
|
|
203
|
+
// 輪は前提の辺だけで決まり、状態の置き換えで変わらない
|
|
204
|
+
const reason = judged.readiness?.reason;
|
|
205
|
+
return await judgeSnapshot(client, snapshot, cache, reason?.code === 'cycle' ? reason.cycle : undefined);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
186
208
|
Issue 1 件の読み取りから判定までを通す。輪は呼ぶ側が渡す(issue show は輪を見ない)
|
|
187
209
|
*/
|
|
188
210
|
export async function readIssueReadiness(client, config, reference, cache, cycle, blockedByFirst) {
|
|
@@ -190,6 +212,19 @@ export async function readIssueReadiness(client, config, reference, cache, cycle
|
|
|
190
212
|
return snapshot.kind === 'unreadable' ? snapshot : await judgeSnapshot(client, snapshot, cache, cycle);
|
|
191
213
|
}
|
|
192
214
|
/**
|
|
215
|
+
readinessJson の形。キーの並びは readinessJson と同じにする
|
|
216
|
+
*/
|
|
217
|
+
export const READINESS_JSON = z.strictObject({
|
|
218
|
+
kind: z.enum(['startable', 'stackable', 'blocked']).describe('Readiness judgment'),
|
|
219
|
+
stackOn: z.strictObject({
|
|
220
|
+
number: z.int().describe('Issue number to stack on'),
|
|
221
|
+
repository: z.string().describe('Repository of that Issue (owner/repo)'),
|
|
222
|
+
branch: z.string().describe('Branch to stack on'),
|
|
223
|
+
}).nullable().describe('Prerequisite to stack on (null unless stackable)'),
|
|
224
|
+
reason: z.string().nullable().describe('Code of the reason for blocked (null unless blocked)'),
|
|
225
|
+
text: z.string().describe('Readiness as shown in the Readiness line'),
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
193
228
|
JSON の出力に使う判定。reason は blocked のときだけの理由のコード、stackOn は積む先
|
|
194
229
|
*/
|
|
195
230
|
export function readinessJson(readiness, text) {
|
|
@@ -8,14 +8,22 @@ import { isStatusConfigured, setIssueField } from './issue-board.js';
|
|
|
8
8
|
import { stopWith, requireActiveConfigPlain } from './command-stop.js';
|
|
9
9
|
import { kindOfFailure } from './failure.js';
|
|
10
10
|
import { connectToProject, exitInvalidStatus, ISSUE_REF_DESCRIPTION, issuePath, notConfiguredMessage, parseIssueReferenceOrExit, runWithExit, VALID_STATUSES, } from './issue-shared.js';
|
|
11
|
-
import { createOutput } from './output.js';
|
|
11
|
+
import { createOutput, DRY_RUN_FIELD } from './output.js';
|
|
12
12
|
// Projects V2 の自動化が Issue をもう一度閉じることがあるため、status を設定した後に待つ
|
|
13
13
|
const AUTOMATION_WAIT_MILLISECONDS = 3000;
|
|
14
|
+
const ISSUE_REOPEN_OUTPUT = z.strictObject({
|
|
15
|
+
issue: z.string().describe('Issue reopened (owner/repo/N)'),
|
|
16
|
+
status: z.string().optional().describe('Workflow status set on the board (omitted when the Issue is not on the board or the status is not configured)'),
|
|
17
|
+
unarchived: z.boolean().describe('Whether the item was unarchived on the board'),
|
|
18
|
+
commented: z.boolean().describe('Whether the reason was posted as a comment'),
|
|
19
|
+
dryRun: DRY_RUN_FIELD,
|
|
20
|
+
});
|
|
14
21
|
// アーカイブの解除、1 回目の reopen、ボードの status の更新。設定できたら自動化を待つ
|
|
15
22
|
async function reopenAndSetStatus(output, client, config, issue, status) {
|
|
16
23
|
const { owner, repository, number } = issue;
|
|
17
24
|
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
18
25
|
const item = await client.getIssueProjectItem(config.project.id, owner, repository, number);
|
|
26
|
+
output.result({ issue: issuePath(issue.owner, issue.repository, issue.number), unarchived: false, commented: false });
|
|
19
27
|
// アーカイブ済みの項目はボードの列に出ないので戻す。失敗したら Issue を開かずに止める
|
|
20
28
|
if (item?.isArchived === true) {
|
|
21
29
|
try {
|
|
@@ -27,6 +35,7 @@ async function reopenAndSetStatus(output, client, config, issue, status) {
|
|
|
27
35
|
stopWith(output, `could not unarchive ${target} on the board: ${error.message}`, kindOfFailure(error));
|
|
28
36
|
}
|
|
29
37
|
output.done({ verb: 'update', target: `${target} unarchived on the board` });
|
|
38
|
+
output.result({ unarchived: true });
|
|
30
39
|
}
|
|
31
40
|
await client.reopenIssue(owner, repository, number);
|
|
32
41
|
const itemId = item?.id;
|
|
@@ -35,6 +44,7 @@ async function reopenAndSetStatus(output, client, config, issue, status) {
|
|
|
35
44
|
}
|
|
36
45
|
else if (await setIssueField(client, config, itemId, 'workflow', status)) {
|
|
37
46
|
output.done({ verb: 'set', target: `${target} status ${status}` });
|
|
47
|
+
output.result({ status });
|
|
38
48
|
await delay(AUTOMATION_WAIT_MILLISECONDS);
|
|
39
49
|
}
|
|
40
50
|
else {
|
|
@@ -55,22 +65,26 @@ async function confirmReopened(output, client, issue, comment) {
|
|
|
55
65
|
return;
|
|
56
66
|
await client.addIssueComment(owner, repository, number, comment);
|
|
57
67
|
output.done({ verb: 'create', target: `comment on ${issuePath(owner, repository, number)}` });
|
|
68
|
+
output.result({ commented: true });
|
|
58
69
|
}
|
|
59
70
|
// 予行。ボードの項目を読み、書く操作を並べる
|
|
60
71
|
async function planReopen(output, client, config, issue, status, comment) {
|
|
61
72
|
const { owner, repository, number } = issue;
|
|
62
73
|
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
63
74
|
const item = await client.getIssueProjectItem(config.project.id, owner, repository, number);
|
|
75
|
+
const hasComment = comment !== undefined && comment !== '';
|
|
76
|
+
const willSetStatus = item !== undefined && isStatusConfigured(config, status);
|
|
77
|
+
output.result({ issue: issuePath(issue.owner, issue.repository, issue.number), ...willSetStatus && { status }, unarchived: item?.isArchived === true, commented: hasComment });
|
|
64
78
|
output.planned({ verb: 'reopen', target });
|
|
65
79
|
if (item?.isArchived === true)
|
|
66
80
|
output.planned({ verb: 'update', target: `${target} unarchived on the board` });
|
|
67
81
|
if (item === undefined)
|
|
68
82
|
output.warning(`${target} is not on the project board`);
|
|
69
|
-
else if (
|
|
83
|
+
else if (willSetStatus)
|
|
70
84
|
output.planned({ verb: 'set', target: `${target} status ${status}` });
|
|
71
85
|
else
|
|
72
86
|
output.warning(notConfiguredMessage(status));
|
|
73
|
-
if (
|
|
87
|
+
if (hasComment)
|
|
74
88
|
output.planned({ verb: 'create', target: `comment on ${issuePath(owner, repository, number)}` });
|
|
75
89
|
}
|
|
76
90
|
async function reopenIssue(output, client, config, issue, status, comment) {
|
|
@@ -86,6 +100,7 @@ const ISSUE_REOPEN = defineCommand({
|
|
|
86
100
|
comment: z.string().optional().describe('Reason for reopening (posted as a comment)'),
|
|
87
101
|
dry_run: z.boolean().default(false).describe('Show what would change without writing anything'),
|
|
88
102
|
}),
|
|
103
|
+
output: ISSUE_REOPEN_OUTPUT,
|
|
89
104
|
positional: ['issue_ref'],
|
|
90
105
|
shortFlags: { status: '-s', comment: '-c', dry_run: '-n' },
|
|
91
106
|
interactive: false,
|
|
@@ -39,7 +39,7 @@ run の本体を包む。終わったら 0 を返す。BadParameterError は使
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function runWithExit(body: () => Promise<void>): Promise<0>;
|
|
41
41
|
/**
|
|
42
|
-
`owner/repo/N` の表記。エラー文と done
|
|
42
|
+
`owner/repo/N` の表記。エラー文と done の行の対象、MCP の data の参照に使う
|
|
43
43
|
*/
|
|
44
44
|
export declare function issuePath(owner: string, repository: string, number: number): string;
|
|
45
45
|
export interface IssueTarget {
|
|
@@ -139,9 +139,9 @@ export interface IssueField {
|
|
|
139
139
|
*/
|
|
140
140
|
export declare function setIssueFields(output: Output, client: GitHubClient, config: ProjectConfig, itemId: string, target: string, fields: readonly IssueField[]): Promise<readonly string[]>;
|
|
141
141
|
/**
|
|
142
|
-
親 Epic のサブ Issue にする。失敗は Issue の URL(issueUrl が undefined なら出し済みとして省く)、error の行の順に出して終了コード 1。issueNodeId
|
|
142
|
+
親 Epic のサブ Issue にする。失敗は Issue の URL(issueUrl が undefined なら出し済みとして省く)、error の行の順に出して終了コード 1。issueNodeId は、無ければ取り直す関数。行に出した親の参照(owner/repo/N)を返す
|
|
143
143
|
*/
|
|
144
|
-
export declare function linkToParentEpic(output: Output, client: GitHubClient, target: string, parentReference: IssueReference, issueNodeId: string | (() => Promise<string>), issueUrl: string | undefined): Promise<
|
|
144
|
+
export declare function linkToParentEpic(output: Output, client: GitHubClient, target: string, parentReference: IssueReference, issueNodeId: string | (() => Promise<string>), issueUrl: string | undefined): Promise<string>;
|
|
145
145
|
/**
|
|
146
146
|
リポジトリがプロジェクトにリンクされていなければ、message を error に出して終了コード 1
|
|
147
147
|
*/
|
|
@@ -83,7 +83,7 @@ export async function runWithExit(body) {
|
|
|
83
83
|
}
|
|
84
84
|
// --- Issue 参照 ---
|
|
85
85
|
/**
|
|
86
|
-
`owner/repo/N` の表記。エラー文と done
|
|
86
|
+
`owner/repo/N` の表記。エラー文と done の行の対象、MCP の data の参照に使う
|
|
87
87
|
*/
|
|
88
88
|
export function issuePath(owner, repository, number) {
|
|
89
89
|
return `${owner}/${repository}/${String(number)}`;
|
|
@@ -328,7 +328,7 @@ export async function setIssueFields(output, client, config, itemId, target, fie
|
|
|
328
328
|
return written;
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
|
-
親 Epic のサブ Issue にする。失敗は Issue の URL(issueUrl が undefined なら出し済みとして省く)、error の行の順に出して終了コード 1。issueNodeId
|
|
331
|
+
親 Epic のサブ Issue にする。失敗は Issue の URL(issueUrl が undefined なら出し済みとして省く)、error の行の順に出して終了コード 1。issueNodeId は、無ければ取り直す関数。行に出した親の参照(owner/repo/N)を返す
|
|
332
332
|
*/
|
|
333
333
|
export async function linkToParentEpic(output, client, target, parentReference, issueNodeId, issueUrl) {
|
|
334
334
|
const parent = issueReferenceToCliReference(parentReference);
|
|
@@ -344,6 +344,7 @@ export async function linkToParentEpic(output, client, target, parentReference,
|
|
|
344
344
|
stopWith(output, `could not add ${target} as sub-issue of ${parent}: ${error.message}\nthe order in its title is not counted for the next numbering until it is linked to the parent; link it by hand`, kindOfFailure(error));
|
|
345
345
|
}
|
|
346
346
|
output.done({ verb: 'add', target: `${target} as sub-issue of ${parent}` });
|
|
347
|
+
return parent;
|
|
347
348
|
}
|
|
348
349
|
/**
|
|
349
350
|
リポジトリがプロジェクトにリンクされていなければ、message を error に出して終了コード 1
|