@pecot/workflow-mcp 0.0.0-stage → 5.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 +8 -0
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/bin/pecot-workflow-mcp.mjs +10 -0
- package/cli/dist/cli.d.ts +26 -0
- package/cli/dist/cli.js +222 -0
- package/cli/dist/commands/cell-table.d.ts +3 -0
- package/cli/dist/commands/cell-table.js +495 -0
- package/cli/dist/commands/command-binding.d.ts +26 -0
- package/cli/dist/commands/command-binding.js +266 -0
- package/cli/dist/commands/command-definition.d.ts +136 -0
- package/cli/dist/commands/command-definition.js +101 -0
- package/cli/dist/commands/command-help.d.ts +8 -0
- package/cli/dist/commands/command-help.js +173 -0
- package/cli/dist/commands/command-stop.d.ts +19 -0
- package/cli/dist/commands/command-stop.js +30 -0
- package/cli/dist/commands/dependabot.d.ts +3 -0
- package/cli/dist/commands/dependabot.js +165 -0
- package/cli/dist/commands/directory-option.d.ts +7 -0
- package/cli/dist/commands/directory-option.js +48 -0
- package/cli/dist/commands/failure.d.ts +13 -0
- package/cli/dist/commands/failure.js +33 -0
- package/cli/dist/commands/fuzzy.d.ts +7 -0
- package/cli/dist/commands/fuzzy.js +79 -0
- package/cli/dist/commands/github-client.d.ts +12 -0
- package/cli/dist/commands/github-client.js +23 -0
- package/cli/dist/commands/global-options.d.ts +25 -0
- package/cli/dist/commands/global-options.js +83 -0
- package/cli/dist/commands/help-layout.d.ts +40 -0
- package/cli/dist/commands/help-layout.js +117 -0
- package/cli/dist/commands/help.d.ts +8 -0
- package/cli/dist/commands/help.js +55 -0
- package/cli/dist/commands/input-schema.d.ts +14 -0
- package/cli/dist/commands/input-schema.js +56 -0
- package/cli/dist/commands/issue-board.d.ts +38 -0
- package/cli/dist/commands/issue-board.js +62 -0
- package/cli/dist/commands/issue-comment.d.ts +3 -0
- package/cli/dist/commands/issue-comment.js +196 -0
- package/cli/dist/commands/issue-create.d.ts +3 -0
- package/cli/dist/commands/issue-create.js +329 -0
- package/cli/dist/commands/issue-project.d.ts +3 -0
- package/cli/dist/commands/issue-project.js +176 -0
- package/cli/dist/commands/issue-quick.d.ts +3 -0
- package/cli/dist/commands/issue-quick.js +126 -0
- package/cli/dist/commands/issue-read.d.ts +3 -0
- package/cli/dist/commands/issue-read.js +80 -0
- package/cli/dist/commands/issue-shared.d.ts +159 -0
- package/cli/dist/commands/issue-shared.js +419 -0
- package/cli/dist/commands/issue.d.ts +4 -0
- package/cli/dist/commands/issue.js +15 -0
- package/cli/dist/commands/names.d.ts +9 -0
- package/cli/dist/commands/names.js +16 -0
- package/cli/dist/commands/output.d.ts +78 -0
- package/cli/dist/commands/output.js +187 -0
- package/cli/dist/commands/pr.d.ts +3 -0
- package/cli/dist/commands/pr.js +933 -0
- package/cli/dist/commands/project-info.d.ts +48 -0
- package/cli/dist/commands/project-info.js +181 -0
- package/cli/dist/commands/project-sync.d.ts +91 -0
- package/cli/dist/commands/project-sync.js +273 -0
- package/cli/dist/commands/project.d.ts +5 -0
- package/cli/dist/commands/project.js +677 -0
- package/cli/dist/commands/registry.d.ts +6 -0
- package/cli/dist/commands/registry.js +27 -0
- package/cli/dist/commands/release.d.ts +10 -0
- package/cli/dist/commands/release.js +414 -0
- package/cli/dist/commands/repository-display.d.ts +3 -0
- package/cli/dist/commands/repository-display.js +7 -0
- package/cli/dist/commands/repository-match.d.ts +14 -0
- package/cli/dist/commands/repository-match.js +33 -0
- package/cli/dist/commands/repository.d.ts +5 -0
- package/cli/dist/commands/repository.js +265 -0
- package/cli/dist/commands/rich-panel.d.ts +22 -0
- package/cli/dist/commands/rich-panel.js +295 -0
- package/cli/dist/commands/security.d.ts +3 -0
- package/cli/dist/commands/security.js +164 -0
- package/cli/dist/commands/session.d.ts +3 -0
- package/cli/dist/commands/session.js +161 -0
- package/cli/dist/commands/tracker-sync.d.ts +58 -0
- package/cli/dist/commands/tracker-sync.js +53 -0
- package/cli/dist/commands/usage-error.d.ts +47 -0
- package/cli/dist/commands/usage-error.js +72 -0
- package/cli/dist/commands/value-types.d.ts +46 -0
- package/cli/dist/commands/value-types.js +94 -0
- package/cli/dist/commands/work-target.d.ts +13 -0
- package/cli/dist/commands/work-target.js +41 -0
- package/cli/dist/commands/worktree.d.ts +3 -0
- package/cli/dist/commands/worktree.js +335 -0
- package/cli/dist/domain/api-error-detail.d.ts +10 -0
- package/cli/dist/domain/api-error-detail.js +25 -0
- package/cli/dist/domain/branch-name.d.ts +5 -0
- package/cli/dist/domain/branch-name.js +10 -0
- package/cli/dist/domain/changelog.d.ts +43 -0
- package/cli/dist/domain/changelog.js +107 -0
- package/cli/dist/domain/config.d.ts +215 -0
- package/cli/dist/domain/config.js +300 -0
- package/cli/dist/domain/dependabot-pull-requests.d.ts +82 -0
- package/cli/dist/domain/dependabot-pull-requests.js +338 -0
- package/cli/dist/domain/dependabot-source.d.ts +51 -0
- package/cli/dist/domain/dependabot-source.js +4 -0
- package/cli/dist/domain/dependabot.d.ts +47 -0
- package/cli/dist/domain/dependabot.js +88 -0
- package/cli/dist/domain/errors.d.ts +19 -0
- package/cli/dist/domain/errors.js +31 -0
- package/cli/dist/domain/field-options.d.ts +31 -0
- package/cli/dist/domain/field-options.js +44 -0
- package/cli/dist/domain/format.d.ts +47 -0
- package/cli/dist/domain/format.js +168 -0
- package/cli/dist/domain/frontmatter.d.ts +122 -0
- package/cli/dist/domain/frontmatter.js +264 -0
- package/cli/dist/domain/git-runner.d.ts +10 -0
- package/cli/dist/domain/git-runner.js +4 -0
- package/cli/dist/domain/git-url.d.ts +17 -0
- package/cli/dist/domain/git-url.js +30 -0
- package/cli/dist/domain/issue-kind.d.ts +16 -0
- package/cli/dist/domain/issue-kind.js +16 -0
- package/cli/dist/domain/issue-readout.d.ts +107 -0
- package/cli/dist/domain/issue-readout.js +4 -0
- package/cli/dist/domain/json-null.d.ts +2 -0
- package/cli/dist/domain/json-null.js +5 -0
- package/cli/dist/domain/json.d.ts +21 -0
- package/cli/dist/domain/json.js +47 -0
- package/cli/dist/domain/prerequisites.d.ts +32 -0
- package/cli/dist/domain/prerequisites.js +192 -0
- package/cli/dist/domain/pull-request.d.ts +134 -0
- package/cli/dist/domain/pull-request.js +232 -0
- package/cli/dist/domain/python-format.d.ts +105 -0
- package/cli/dist/domain/python-format.js +304 -0
- package/cli/dist/domain/readiness.d.ts +172 -0
- package/cli/dist/domain/readiness.js +280 -0
- package/cli/dist/domain/reference-parser.d.ts +49 -0
- package/cli/dist/domain/reference-parser.js +119 -0
- package/cli/dist/domain/release.d.ts +49 -0
- package/cli/dist/domain/release.js +72 -0
- package/cli/dist/domain/repository-policy.d.ts +32 -0
- package/cli/dist/domain/repository-policy.js +65 -0
- package/cli/dist/domain/repository-resolver.d.ts +57 -0
- package/cli/dist/domain/repository-resolver.js +119 -0
- package/cli/dist/domain/sections.d.ts +69 -0
- package/cli/dist/domain/sections.js +514 -0
- package/cli/dist/domain/security-alerts-source.d.ts +29 -0
- package/cli/dist/domain/security-alerts-source.js +4 -0
- package/cli/dist/domain/security-alerts.d.ts +52 -0
- package/cli/dist/domain/security-alerts.js +107 -0
- package/cli/dist/domain/security-tracker.d.ts +115 -0
- package/cli/dist/domain/security-tracker.js +353 -0
- package/cli/dist/domain/state.d.ts +29 -0
- package/cli/dist/domain/state.js +56 -0
- package/cli/dist/domain/tracker-body.d.ts +70 -0
- package/cli/dist/domain/tracker-body.js +65 -0
- package/cli/dist/domain/yaml-document.d.ts +5 -0
- package/cli/dist/domain/yaml-document.js +206 -0
- package/cli/dist/infra/authored-notes.d.ts +37 -0
- package/cli/dist/infra/authored-notes.js +66 -0
- package/cli/dist/infra/changelog-file.d.ts +19 -0
- package/cli/dist/infra/changelog-file.js +43 -0
- package/cli/dist/infra/child-stdin.d.ts +4 -0
- package/cli/dist/infra/child-stdin.js +8 -0
- package/cli/dist/infra/config-store.d.ts +49 -0
- package/cli/dist/infra/config-store.js +121 -0
- package/cli/dist/infra/diagnostics.d.ts +9 -0
- package/cli/dist/infra/diagnostics.js +2 -0
- package/cli/dist/infra/file-kind.d.ts +9 -0
- package/cli/dist/infra/file-kind.js +26 -0
- package/cli/dist/infra/frontmatter-file.d.ts +14 -0
- package/cli/dist/infra/frontmatter-file.js +30 -0
- package/cli/dist/infra/git.d.ts +74 -0
- package/cli/dist/infra/git.js +133 -0
- package/cli/dist/infra/github/auth.d.ts +60 -0
- package/cli/dist/infra/github/auth.js +158 -0
- package/cli/dist/infra/github/client.d.ts +173 -0
- package/cli/dist/infra/github/client.js +576 -0
- package/cli/dist/infra/github/dependabot-source.d.ts +13 -0
- package/cli/dist/infra/github/dependabot-source.js +33 -0
- package/cli/dist/infra/github/errors.d.ts +47 -0
- package/cli/dist/infra/github/errors.js +42 -0
- package/cli/dist/infra/github/index.d.ts +13 -0
- package/cli/dist/infra/github/index.js +19 -0
- package/cli/dist/infra/github/issues.d.ts +129 -0
- package/cli/dist/infra/github/issues.js +273 -0
- package/cli/dist/infra/github/payload.d.ts +44 -0
- package/cli/dist/infra/github/payload.js +80 -0
- package/cli/dist/infra/github/projects.d.ts +108 -0
- package/cli/dist/infra/github/projects.js +303 -0
- package/cli/dist/infra/github/pulls.d.ts +80 -0
- package/cli/dist/infra/github/pulls.js +161 -0
- package/cli/dist/infra/github/queries.d.ts +36 -0
- package/cli/dist/infra/github/queries.js +883 -0
- package/cli/dist/infra/github/readout.d.ts +18 -0
- package/cli/dist/infra/github/readout.js +156 -0
- package/cli/dist/infra/github/repos.d.ts +68 -0
- package/cli/dist/infra/github/repos.js +137 -0
- package/cli/dist/infra/github/rest-path.d.ts +14 -0
- package/cli/dist/infra/github/rest-path.js +31 -0
- package/cli/dist/infra/github/security-alerts-source.d.ts +15 -0
- package/cli/dist/infra/github/security-alerts-source.js +73 -0
- package/cli/dist/infra/gitignore-spec.d.ts +36 -0
- package/cli/dist/infra/gitignore-spec.js +235 -0
- package/cli/dist/infra/nx-scope.d.ts +51 -0
- package/cli/dist/infra/nx-scope.js +182 -0
- package/cli/dist/infra/os-error.d.ts +24 -0
- package/cli/dist/infra/os-error.js +38 -0
- package/cli/dist/infra/paths.d.ts +88 -0
- package/cli/dist/infra/paths.js +234 -0
- package/cli/dist/infra/state-store.d.ts +45 -0
- package/cli/dist/infra/state-store.js +118 -0
- package/cli/dist/infra/template-store.d.ts +15 -0
- package/cli/dist/infra/template-store.js +34 -0
- package/cli/dist/infra/text-file.d.ts +12 -0
- package/cli/dist/infra/text-file.js +33 -0
- package/cli/dist/infra/worktree-copy.d.ts +24 -0
- package/cli/dist/infra/worktree-copy.js +95 -0
- package/cli/dist/infra/worktree-links.d.ts +139 -0
- package/cli/dist/infra/worktree-links.js +433 -0
- package/cli/dist/infra/worktree-setup.d.ts +21 -0
- package/cli/dist/infra/worktree-setup.js +41 -0
- package/cli/dist/infra/worktree.d.ts +174 -0
- package/cli/dist/infra/worktree.js +567 -0
- package/cli/dist/mcp/result.d.ts +33 -0
- package/cli/dist/mcp/result.js +52 -0
- package/cli/dist/mcp/serve.d.ts +51 -0
- package/cli/dist/mcp/serve.js +183 -0
- package/cli/dist/mcp/server.d.ts +21 -0
- package/cli/dist/mcp/server.js +128 -0
- package/cli/dist/mcp/session-directory.d.ts +26 -0
- package/cli/dist/mcp/session-directory.js +84 -0
- package/cli/dist/package.json +1 -0
- package/cli/dist/version.d.ts +17 -0
- package/cli/dist/version.js +42 -0
- package/cli/templates/comment/merge-diff.md +34 -0
- package/cli/templates/comment/plan.md +181 -0
- package/cli/templates/comment/precede-notify.md +33 -0
- package/cli/templates/comment/review-findings.md +42 -0
- package/cli/templates/comment/review-resolution.md +48 -0
- package/cli/templates/issue/bug.md +63 -0
- package/cli/templates/issue/epic.md +54 -0
- package/cli/templates/issue/task-implement.md +67 -0
- package/cli/templates/issue/task.md +48 -0
- package/cli/templates/issue/tracker.md +48 -0
- package/cli/templates/pr/create.md +123 -0
- package/cli/templates/pr/release.md +56 -0
- package/hooks/lib/core/pecot-gitignore-ensure.sh +48 -0
- package/npm-shrinkwrap.json +83 -0
- package/package.json +22 -4
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types -- 引数の型は readonly にできない */
|
|
2
|
+
// add-to-project・update-issue-status・issue reopen。cli/commands/issue.py の移植。
|
|
3
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { getFieldId, getOptionId } from '../domain/config.js';
|
|
6
|
+
import { GitHubAPIError } from '../infra/github/errors.js';
|
|
7
|
+
import { defineCommand } from './command-definition.js';
|
|
8
|
+
import { addIssueToBoard, setIssueField } from './issue-board.js';
|
|
9
|
+
import { stopWith, requireActiveConfigPlain } from './command-stop.js';
|
|
10
|
+
import { createGitHubClient } from './github-client.js';
|
|
11
|
+
import { ensureRepositoryInProject, exitInvalidStatus, ISSUE_REF_DESCRIPTION, issuePath, parseIssueReferenceOrExit, runWithExit, VALID_STATUSES, } from './issue-shared.js';
|
|
12
|
+
import { createOutput } from './output.js';
|
|
13
|
+
// Projects V2 の自動化が Issue をもう一度閉じることがあるため、status を設定した後に待つ
|
|
14
|
+
const AUTOMATION_WAIT_MILLISECONDS = 3000;
|
|
15
|
+
// クライアントを作り、リポジトリがプロジェクトにあることを確かめる。無ければ error と終了コード 1
|
|
16
|
+
async function connectToProject(output, config, owner, repository) {
|
|
17
|
+
const client = createGitHubClient(output, config.host);
|
|
18
|
+
await ensureRepositoryInProject(output, config, client, owner, repository, `repository ${owner}/${repository} is not in the project`);
|
|
19
|
+
return client;
|
|
20
|
+
}
|
|
21
|
+
function isStatusConfigured(config, status) {
|
|
22
|
+
const fieldId = getFieldId(config, 'workflow');
|
|
23
|
+
const optionId = getOptionId(config, 'workflow', status);
|
|
24
|
+
return fieldId !== undefined && fieldId !== '' && optionId !== undefined && optionId !== '';
|
|
25
|
+
}
|
|
26
|
+
// blocked は後から足せる option なので、足し方の hint を添える
|
|
27
|
+
function notConfiguredMessage(status) {
|
|
28
|
+
const base = `status '${status}' is not configured in the project`;
|
|
29
|
+
return status === 'blocked' ? `${base}\nhint: run pecot project init to add the Blocked option to the board` : base;
|
|
30
|
+
}
|
|
31
|
+
const ADD_TO_PROJECT = defineCommand({
|
|
32
|
+
path: ['add-to-project'],
|
|
33
|
+
description: 'Add an Issue to the project board with a GraphQL mutation (for an Issue created outside pecot)',
|
|
34
|
+
input: z.object({
|
|
35
|
+
issue_ref: z.string().describe(ISSUE_REF_DESCRIPTION),
|
|
36
|
+
status: z.string().default('ready').describe('Initial status (backlog/pending/blocked/ready/active/in_review/archived)'),
|
|
37
|
+
}),
|
|
38
|
+
positional: ['issue_ref'],
|
|
39
|
+
shortFlags: { status: '-s' },
|
|
40
|
+
interactive: false,
|
|
41
|
+
run: async (input, io) => {
|
|
42
|
+
const output = createOutput(false, io);
|
|
43
|
+
return await runWithExit(async () => {
|
|
44
|
+
const { status } = input;
|
|
45
|
+
if (status !== '' && !VALID_STATUSES.has(status))
|
|
46
|
+
exitInvalidStatus(output, status);
|
|
47
|
+
const config = requireActiveConfigPlain(output);
|
|
48
|
+
if (status !== '' && !isStatusConfigured(config, status)) {
|
|
49
|
+
stopWith(output, notConfiguredMessage(status));
|
|
50
|
+
}
|
|
51
|
+
const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
|
|
52
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
53
|
+
try {
|
|
54
|
+
const client = await connectToProject(output, config, owner, repository);
|
|
55
|
+
const { itemId } = await addIssueToBoard(client, config, owner, repository, number, undefined);
|
|
56
|
+
output.done({ verb: 'add', target: `${target} to project` });
|
|
57
|
+
if (status !== '') {
|
|
58
|
+
await setIssueField(client, config, itemId, 'workflow', status);
|
|
59
|
+
output.done({ verb: 'set', target: `${target} status ${status}` });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (!(error instanceof GitHubAPIError))
|
|
64
|
+
throw error;
|
|
65
|
+
stopWith(output, `could not add ${target} to project: ${error.message}`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
const UPDATE_ISSUE_STATUS = defineCommand({
|
|
71
|
+
path: ['update-issue-status'],
|
|
72
|
+
description: 'Update the status of an Issue on the project board by Issue number (pecot commands normally set the status themselves)',
|
|
73
|
+
input: z.object({
|
|
74
|
+
issue_ref: z.string().describe(ISSUE_REF_DESCRIPTION),
|
|
75
|
+
status: z.string().describe('Status (backlog/pending/blocked/ready/active/in_review/archived)'),
|
|
76
|
+
}),
|
|
77
|
+
positional: ['issue_ref', 'status'],
|
|
78
|
+
interactive: false,
|
|
79
|
+
run: async (input, io) => {
|
|
80
|
+
const output = createOutput(false, io);
|
|
81
|
+
return await runWithExit(async () => {
|
|
82
|
+
const { status } = input;
|
|
83
|
+
if (!VALID_STATUSES.has(status))
|
|
84
|
+
exitInvalidStatus(output, status);
|
|
85
|
+
const config = requireActiveConfigPlain(output);
|
|
86
|
+
const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
|
|
87
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
88
|
+
try {
|
|
89
|
+
const client = await connectToProject(output, config, owner, repository);
|
|
90
|
+
const itemId = await client.getItemIdByIssue(config.project.id, owner, repository, number);
|
|
91
|
+
if (itemId === undefined) {
|
|
92
|
+
stopWith(output, `${target} is not on the project board\nhint: add it to the board first with add-to-project`);
|
|
93
|
+
}
|
|
94
|
+
if (!await setIssueField(client, config, itemId, 'workflow', status)) {
|
|
95
|
+
stopWith(output, notConfiguredMessage(status));
|
|
96
|
+
}
|
|
97
|
+
output.done({ verb: 'set', target: `${target} status ${status}` });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (!(error instanceof GitHubAPIError))
|
|
101
|
+
throw error;
|
|
102
|
+
stopWith(output, `could not set ${target} status ${status}: ${error.message}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
// 1 回目の reopen(status を更新する前提として open にする)と、ボードの status の更新。設定できたら自動化を待つ
|
|
108
|
+
async function reopenAndSetStatus(output, client, config, issue, status) {
|
|
109
|
+
const { owner, repository, number } = issue;
|
|
110
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
111
|
+
await client.reopenIssue(owner, repository, number);
|
|
112
|
+
const itemId = await client.getItemIdByIssue(config.project.id, owner, repository, number);
|
|
113
|
+
if (itemId === undefined) {
|
|
114
|
+
output.warning(`${target} is not on the project board`);
|
|
115
|
+
}
|
|
116
|
+
else if (await setIssueField(client, config, itemId, 'workflow', status)) {
|
|
117
|
+
output.done({ verb: 'set', target: `${target} status ${status}` });
|
|
118
|
+
await delay(AUTOMATION_WAIT_MILLISECONDS);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
output.warning(notConfiguredMessage(status));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// 2 回目の reopen(自動化による close への対策)で open を確かめ、--comment があれば理由を投稿する
|
|
125
|
+
async function confirmReopened(output, client, issue, comment) {
|
|
126
|
+
const { owner, repository, number } = issue;
|
|
127
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
128
|
+
const result = await client.reopenIssue(owner, repository, number);
|
|
129
|
+
const state = result['state'];
|
|
130
|
+
if (state !== 'open') {
|
|
131
|
+
stopWith(output, `${target} did not become open (state: ${typeof state === 'string' ? state : 'None'})`);
|
|
132
|
+
}
|
|
133
|
+
output.done({ verb: 'reopen', target });
|
|
134
|
+
if (comment === undefined || comment === '')
|
|
135
|
+
return;
|
|
136
|
+
await client.addIssueComment(owner, repository, number, comment);
|
|
137
|
+
output.done({ verb: 'create', target: `comment on ${issuePath(owner, repository, number)}` });
|
|
138
|
+
}
|
|
139
|
+
async function reopenIssue(output, client, config, issue, status, comment) {
|
|
140
|
+
await reopenAndSetStatus(output, client, config, issue, status);
|
|
141
|
+
await confirmReopened(output, client, issue, comment);
|
|
142
|
+
}
|
|
143
|
+
const ISSUE_REOPEN = defineCommand({
|
|
144
|
+
path: ['issue', 'reopen'],
|
|
145
|
+
description: 'Reopen a closed Issue (also sets the status on the board)',
|
|
146
|
+
input: z.object({
|
|
147
|
+
issue_ref: z.string().describe(ISSUE_REF_DESCRIPTION),
|
|
148
|
+
status: z.string().default('ready').describe('Status after reopening (backlog/pending/blocked/ready/active/in_review/archived)'),
|
|
149
|
+
comment: z.string().optional().describe('Reason for reopening (posted as a comment)'),
|
|
150
|
+
}),
|
|
151
|
+
positional: ['issue_ref'],
|
|
152
|
+
shortFlags: { status: '-s', comment: '-c' },
|
|
153
|
+
interactive: false,
|
|
154
|
+
run: async (input, io) => {
|
|
155
|
+
const output = createOutput(false, io);
|
|
156
|
+
return await runWithExit(async () => {
|
|
157
|
+
const { status, comment } = input;
|
|
158
|
+
if (!VALID_STATUSES.has(status))
|
|
159
|
+
exitInvalidStatus(output, status);
|
|
160
|
+
const config = requireActiveConfigPlain(output);
|
|
161
|
+
const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
|
|
162
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
163
|
+
try {
|
|
164
|
+
const client = await connectToProject(output, config, owner, repository);
|
|
165
|
+
await reopenIssue(output, client, config, { owner, repository, number }, status, comment);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (!(error instanceof GitHubAPIError))
|
|
169
|
+
throw error;
|
|
170
|
+
stopWith(output, `could not reopen ${target}: ${error.message}`);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
export const ISSUE_PROJECT_COMMANDS = [ADD_TO_PROJECT, UPDATE_ISSUE_STATUS, ISSUE_REOPEN];
|
|
176
|
+
//# sourceMappingURL=issue-project.js.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types -- 引数の型は readonly にできない */
|
|
2
|
+
// issue quick。cli/commands/issue.py の issue_quick_command の移植。テンプレートの検証はしない。
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { splitOwnerRepository } from '../domain/repository-resolver.js';
|
|
5
|
+
import { findRepository } from '../domain/config.js';
|
|
6
|
+
import { pythonRightStrip, pythonStrip, truncateCodePoints } from '../domain/python-format.js';
|
|
7
|
+
import { FLAG_ISSUE_CREATE_SLASH_PENDING, FLAG_ISSUE_PENDING, FLAG_PECOT_QUICK_MODE } from '../domain/state.js';
|
|
8
|
+
import { GitHubAPIError } from '../infra/github/errors.js';
|
|
9
|
+
import { formatTimestamp } from '../infra/paths.js';
|
|
10
|
+
import { consumeFlag, touchFlag } from '../infra/state-store.js';
|
|
11
|
+
import { defineCommand } from './command-definition.js';
|
|
12
|
+
import { stopWith, requireActiveConfigPlain } from './command-stop.js';
|
|
13
|
+
import { addToBoardOrWarn, BACKLOG_TYPES, buildIssueTitle, clientForIssueCreate, createIssueOrExit, ISSUE_TYPE_SCHEMA, issuePath, linkToParentEpic, normalizeParentEpicCli, PARENT_EPIC_DESCRIPTION, resolveParentEpicReference, runWithExit, setIssueFields, summarizeCreatedIssue, } from './issue-shared.js';
|
|
14
|
+
import { createOutput } from './output.js';
|
|
15
|
+
import { recordWorkTarget } from './work-target.js';
|
|
16
|
+
// Python の re の `\s` と同じ集合。JS の `\s` と違い、U+001C〜U+001F を含む。U+FEFF は含まない
|
|
17
|
+
// eslint-disable-next-line no-control-regex -- Python の空白に含まれる制御文字
|
|
18
|
+
const PYTHON_WHITESPACE_RUN = /[\p{White_Space}\u{1C}\u{1D}\u{1E}\u{1F}]+/gu;
|
|
19
|
+
// テンプレートの検証を飛ばす quick でも、起票規約への参照を本文の末尾に残す
|
|
20
|
+
const BODY_FOOTER = '<!-- pecot issue quick で起票(テンプレ検証スキップ)。起票ルール: skills/w-help/references/issue-flow-rules.md#起票時の既定-status -->';
|
|
21
|
+
const TITLE_LENGTH = 50;
|
|
22
|
+
// 空のメッセージと owner/repo の形の誤りを止める
|
|
23
|
+
function parseQuickArguments(output, message, repository) {
|
|
24
|
+
if (pythonStrip(message) === '') {
|
|
25
|
+
stopWith(output, 'the message is empty');
|
|
26
|
+
}
|
|
27
|
+
const parts = splitOwnerRepository(repository);
|
|
28
|
+
if (parts === undefined) {
|
|
29
|
+
stopWith(output, `invalid repository format: ${repository}\nexpected: owner/repo`);
|
|
30
|
+
}
|
|
31
|
+
return [parts.owner, parts.repository];
|
|
32
|
+
}
|
|
33
|
+
// status は Backlog に置く型なら backlog、それ以外は active。priority は medium、size は s(Backlog に置く型は付けない)
|
|
34
|
+
function quickFields(issueType) {
|
|
35
|
+
const isBacklog = BACKLOG_TYPES.has(issueType);
|
|
36
|
+
const status = isBacklog ? 'backlog' : 'active';
|
|
37
|
+
const fields = [
|
|
38
|
+
{ fieldName: 'workflow', optionName: status, label: `status ${status}` },
|
|
39
|
+
{ fieldName: 'priority', optionName: 'medium', label: 'priority medium' },
|
|
40
|
+
];
|
|
41
|
+
if (!isBacklog)
|
|
42
|
+
fields.push({ fieldName: 'size', optionName: 's', label: 'size s' });
|
|
43
|
+
return fields;
|
|
44
|
+
}
|
|
45
|
+
async function createBranch(output, config, client, owner, repository, issueNumber, issueNodeId, title) {
|
|
46
|
+
const base = findRepository(config, owner, repository)?.develop_branch;
|
|
47
|
+
if (base === undefined || base === '') {
|
|
48
|
+
stopWith(output, `develop_branch is not set for repository ${owner}/${repository}\nset it with: pecot project set-repo ${owner}/${repository} --develop-branch develop\n(or --develop-branch develop-aist / --develop-branch main)`);
|
|
49
|
+
}
|
|
50
|
+
const name = `feat/${formatTimestamp(Date.now())}/${String(issueNumber)}`;
|
|
51
|
+
const sha = await client.getBranchSha(owner, repository, base);
|
|
52
|
+
const created = await client.createLinkedBranch(issueNodeId, sha, name);
|
|
53
|
+
output.done({ verb: 'create', target: `branch ${created} in ${owner}/${repository}` });
|
|
54
|
+
recordWorkTarget(output, owner, repository, issueNumber, title, { failWithExit: false });
|
|
55
|
+
}
|
|
56
|
+
// ブランチの作成。API の失敗は warning にして続ける(--no-branch なら作業対象を記録するだけ)
|
|
57
|
+
async function branchOrRecord(output, config, client, target, isNoBranch) {
|
|
58
|
+
if (isNoBranch) {
|
|
59
|
+
recordWorkTarget(output, target.owner, target.repository, target.number, target.title, { failWithExit: false });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await createBranch(output, config, client, target.owner, target.repository, target.number, target.nodeId, target.title);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (!(error instanceof GitHubAPIError))
|
|
67
|
+
throw error;
|
|
68
|
+
output.warning(`could not create the branch: ${error.message}\ncreate the branch manually`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// 作った Issue の後始末。ボードへの追加に失敗したら、そこで止める
|
|
72
|
+
async function finishIssue(output, config, client, owner, repository, issue, options) {
|
|
73
|
+
const { number, url, nodeId } = summarizeCreatedIssue(issue);
|
|
74
|
+
const target = `Issue ${issuePath(owner, repository, number)}`;
|
|
75
|
+
const added = await addToBoardOrWarn(output, client, config, owner, repository, number, nodeId, url);
|
|
76
|
+
if (added === undefined)
|
|
77
|
+
return;
|
|
78
|
+
await setIssueFields(output, client, config, added.itemId, target, quickFields(options.issueType));
|
|
79
|
+
if (options.parentReference !== undefined) {
|
|
80
|
+
if (options.issueType === 'epic')
|
|
81
|
+
output.warning('giving a parent Epic to an Epic is not recommended');
|
|
82
|
+
await linkToParentEpic(output, client, target, options.parentReference, added.issueNodeId, url);
|
|
83
|
+
}
|
|
84
|
+
const title = typeof issue['title'] === 'string' ? issue['title'] : '';
|
|
85
|
+
await branchOrRecord(output, config, client, { owner, repository, number, nodeId: added.issueNodeId, title }, options.noBranch);
|
|
86
|
+
if (!BACKLOG_TYPES.has(options.issueType))
|
|
87
|
+
touchFlag(FLAG_PECOT_QUICK_MODE);
|
|
88
|
+
output.data(url);
|
|
89
|
+
}
|
|
90
|
+
const ISSUE_QUICK = defineCommand({
|
|
91
|
+
path: ['issue', 'quick'],
|
|
92
|
+
hasOwnRepo: true,
|
|
93
|
+
ignoresGlobalRepo: true,
|
|
94
|
+
description: 'Create an Issue at once from a free-format message',
|
|
95
|
+
input: z.object({
|
|
96
|
+
message: z.string().describe('Issue message (free format)'),
|
|
97
|
+
repo: z.string().describe('Repository (owner/repo form)'),
|
|
98
|
+
parent_epic: z.string().optional().describe(PARENT_EPIC_DESCRIPTION),
|
|
99
|
+
order: z.int().optional().describe('Order number of the subtask (used with parent_epic)'),
|
|
100
|
+
no_branch: z.boolean().default(false).describe('Skip creating a branch'),
|
|
101
|
+
type: ISSUE_TYPE_SCHEMA,
|
|
102
|
+
}),
|
|
103
|
+
positional: [],
|
|
104
|
+
shortFlags: { message: '-m', repo: '-r' },
|
|
105
|
+
interactive: false,
|
|
106
|
+
run: async (input, io) => {
|
|
107
|
+
const output = createOutput(false, io);
|
|
108
|
+
return await runWithExit(async () => {
|
|
109
|
+
const [owner, repository] = parseQuickArguments(output, input.message, input.repo);
|
|
110
|
+
const config = requireActiveConfigPlain(output);
|
|
111
|
+
const rawParent = normalizeParentEpicCli(input.parent_epic);
|
|
112
|
+
const parentReference = rawParent === undefined ? undefined : resolveParentEpicReference(rawParent, config, owner, repository);
|
|
113
|
+
// タイトルは先頭 50 文字の空白を 1 つにまとめたもの
|
|
114
|
+
const cleaned = pythonStrip(truncateCodePoints(input.message, TITLE_LENGTH).replaceAll(PYTHON_WHITESPACE_RUN, ' '));
|
|
115
|
+
const title = buildIssueTitle(input.type, cleaned, { parentEpic: parentReference?.number, order: input.order });
|
|
116
|
+
const client = await clientForIssueCreate(output, config, owner, repository, input.repo, parentReference, input.order);
|
|
117
|
+
const body = `${pythonRightStrip(input.message)}\n\n${BODY_FOOTER}`;
|
|
118
|
+
const issue = await createIssueOrExit(output, client, owner, repository, title, body, undefined);
|
|
119
|
+
consumeFlag(FLAG_ISSUE_PENDING);
|
|
120
|
+
consumeFlag(FLAG_ISSUE_CREATE_SLASH_PENDING);
|
|
121
|
+
await finishIssue(output, config, client, owner, repository, issue, { issueType: input.type, parentReference, noBranch: input.no_branch });
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
export const ISSUE_QUICK_COMMANDS = [ISSUE_QUICK];
|
|
126
|
+
//# sourceMappingURL=issue-quick.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// issue read。cli/commands/issue.py の issue_read の移植。
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { GitHubAPIError } from '../infra/github/errors.js';
|
|
4
|
+
import { defineCommand } from './command-definition.js';
|
|
5
|
+
import { stopWith, requireActiveConfigPlain } from './command-stop.js';
|
|
6
|
+
import { createGitHubClient } from './github-client.js';
|
|
7
|
+
import { ISSUE_REF_DESCRIPTION, issuePath, parseIssueReferenceOrExit, runWithExit } from './issue-shared.js';
|
|
8
|
+
import { createOutput } from './output.js';
|
|
9
|
+
const MAX_COMMENT_LIMIT = 20;
|
|
10
|
+
const DEFAULT_COMMENT_LIMIT = 5;
|
|
11
|
+
function parentLine(issue, owner, repository) {
|
|
12
|
+
const { parent } = issue;
|
|
13
|
+
if (parent === null)
|
|
14
|
+
return undefined;
|
|
15
|
+
const isCrossRepository = parent.owner !== null && parent.repo !== null && (parent.owner !== owner || parent.repo !== repository);
|
|
16
|
+
const label = isCrossRepository ? `${parent.owner}/${parent.repo}#${String(parent.number)}` : `#${String(parent.number)}`;
|
|
17
|
+
return `**Parent:** ${label} ${parent.title} (${parent.state})`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
Issue の情報を Markdown にする。owner・repo は、親が別のリポジトリかを調べる元
|
|
21
|
+
*/
|
|
22
|
+
function formatIssueMarkdown(issue, owner, repository) {
|
|
23
|
+
const lines = [`## #${String(issue.number)} ${issue.title}`, ''];
|
|
24
|
+
const meta = [`**State:** ${issue.state}`];
|
|
25
|
+
if (issue.comments.total_count > 0)
|
|
26
|
+
meta.push(`**Comments:** ${String(issue.comments.total_count)}`);
|
|
27
|
+
lines.push(meta.join(' | '), '');
|
|
28
|
+
const parent = parentLine(issue, owner, repository);
|
|
29
|
+
if (parent !== undefined)
|
|
30
|
+
lines.push(parent, '');
|
|
31
|
+
if (issue.linked_branches.length > 0) {
|
|
32
|
+
lines.push('**Branches:**', ...issue.linked_branches.map(branch => ` - \`${branch}\``), '');
|
|
33
|
+
}
|
|
34
|
+
if (issue.linked_prs.length > 0) {
|
|
35
|
+
lines.push('**Linked PRs:**', ...issue.linked_prs.map(pr => ` - #${String(pr.number)} ${pr.title} (${pr.state})`), '');
|
|
36
|
+
}
|
|
37
|
+
if (issue.sub_issues.length > 0) {
|
|
38
|
+
lines.push('**Sub-issues:**', ...issue.sub_issues.map(sub => ` - #${String(sub.number)} ${sub.title} (${sub.state})`), '');
|
|
39
|
+
}
|
|
40
|
+
lines.push('---', '', issue.body);
|
|
41
|
+
const comments = issue.comments.nodes;
|
|
42
|
+
if (comments.length > 0) {
|
|
43
|
+
lines.push('', '', `### Comments (${String(comments.length)}/${String(issue.comments.total_count)})`, '');
|
|
44
|
+
for (const comment of comments) {
|
|
45
|
+
lines.push('---', '', `**@${comment.author}** - ${comment.created_at.slice(0, 10)}`, '', comment.body, '');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return lines.join('\n');
|
|
49
|
+
}
|
|
50
|
+
const ISSUE_READ = defineCommand({
|
|
51
|
+
path: ['issue', 'read'],
|
|
52
|
+
description: 'Fetch Issue details efficiently (GraphQL, only the needed fields)',
|
|
53
|
+
input: z.object({
|
|
54
|
+
issue_ref: z.string().describe(ISSUE_REF_DESCRIPTION),
|
|
55
|
+
json: z.boolean().default(false).describe('Output as JSON'),
|
|
56
|
+
comment_limit: z.int().min(0).max(MAX_COMMENT_LIMIT).default(DEFAULT_COMMENT_LIMIT).describe('Number of comments to show (0-20; 0 hides them)'),
|
|
57
|
+
}),
|
|
58
|
+
positional: ['issue_ref'],
|
|
59
|
+
shortFlags: { json: '-j', comment_limit: '-c' },
|
|
60
|
+
interactive: false,
|
|
61
|
+
run: async (input, io) => {
|
|
62
|
+
const output = createOutput(false, io);
|
|
63
|
+
return await runWithExit(async () => {
|
|
64
|
+
const config = requireActiveConfigPlain(output);
|
|
65
|
+
const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
|
|
66
|
+
let issue;
|
|
67
|
+
try {
|
|
68
|
+
issue = await createGitHubClient(output, config.host).getIssueSlim(owner, repository, number, input.comment_limit);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (!(error instanceof GitHubAPIError))
|
|
72
|
+
throw error;
|
|
73
|
+
return stopWith(output, `could not read Issue ${issuePath(owner, repository, number)}: ${error.message}`);
|
|
74
|
+
}
|
|
75
|
+
output.data(input.json ? JSON.stringify({ ...issue, owner, repo: repository }, undefined, 2) : formatIssueMarkdown(issue, owner, repository));
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
export const ISSUE_READ_COMMANDS = [ISSUE_READ];
|
|
80
|
+
//# sourceMappingURL=issue-read.js.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ProjectConfig } from '../domain/config.js';
|
|
3
|
+
import type { IssueFrontmatter } from '../domain/frontmatter.js';
|
|
4
|
+
import type { IssueReference } from '../domain/reference-parser.js';
|
|
5
|
+
import type { JsonObject } from '../domain/json.js';
|
|
6
|
+
import type { GitHubClient } from '../infra/github/index.js';
|
|
7
|
+
import type { BoardItem } from './issue-board.js';
|
|
8
|
+
import type { Output } from './output.js';
|
|
9
|
+
export type IssueType = IssueFrontmatter['type'];
|
|
10
|
+
/**
|
|
11
|
+
issue comment のテンプレ検証失敗の終了コード。通信失敗・設定なし・引数不足の 1 と区別し、hooks がこの値で分岐する
|
|
12
|
+
*/
|
|
13
|
+
export declare const COMMENT_VALIDATION_EXIT_CODE = 3;
|
|
14
|
+
/**
|
|
15
|
+
Issue 種別の入力。issue create と issue quick が共有する
|
|
16
|
+
*/
|
|
17
|
+
export declare const ISSUE_TYPE_SCHEMA: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
bug: "bug";
|
|
19
|
+
epic: "epic";
|
|
20
|
+
task: "task";
|
|
21
|
+
tracker: "tracker";
|
|
22
|
+
}>>;
|
|
23
|
+
export declare const PARENT_EPIC_DESCRIPTION = "Parent Epic reference: an integer (relative to aggregation_repo) or the primary form 'owner/repo/N'";
|
|
24
|
+
export declare const ISSUE_REF_DESCRIPTION = "Issue reference (`owner/repo/N`, or the short form `N` in the repository of `--repo`, or else of the git remote of the current directory)";
|
|
25
|
+
export declare const VALID_STATUSES: ReadonlySet<string>;
|
|
26
|
+
/**
|
|
27
|
+
起票時の status は、型対応テンプレートの既定値だけを受ける。pending / archived への配置はボード上の手動操作
|
|
28
|
+
*/
|
|
29
|
+
export declare const TYPE_DEFAULT_STATUS: Readonly<Record<IssueType, string>>;
|
|
30
|
+
/**
|
|
31
|
+
Backlog に置く型(quick の status / size / quick フラグの扱いが Epic と同じ)
|
|
32
|
+
*/
|
|
33
|
+
export declare const BACKLOG_TYPES: ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
run の本体を包む。終わったら 0 を返す。BadParameterError は使い方の誤りにして伝える。
|
|
36
|
+
それ以外の例外はそのまま伝える。CommandExit は defineCommand が受けて終了コードにする
|
|
37
|
+
*/
|
|
38
|
+
export declare function runWithExit(body: () => Promise<void>): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
`owner/repo/N` の表記。エラー文と done の行の対象に使う
|
|
41
|
+
*/
|
|
42
|
+
export declare function issuePath(owner: string, repository: string, number: number): string;
|
|
43
|
+
export interface IssueTarget {
|
|
44
|
+
readonly owner: string;
|
|
45
|
+
readonly repository: string;
|
|
46
|
+
readonly number: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
parseIssueReferenceFromContext の失敗を、error の行と終了コード 2 にしたもの
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseIssueReferenceOrExit(output: Output, repository: string | undefined, raw: string): IssueTarget;
|
|
52
|
+
/**
|
|
53
|
+
不正な status と、有効な値を出して終了コード 1
|
|
54
|
+
*/
|
|
55
|
+
export declare function exitInvalidStatus(output: Output, status: string): never;
|
|
56
|
+
/**
|
|
57
|
+
起票時の status が、型対応テンプレートの既定値と一致するか確かめる。違えば終了コード 1。
|
|
58
|
+
enum 外の値(`--status foo`)と、型に合わない別テンプレートの既定値(`--type bug --status backlog`)は文を分ける
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateStatusForType(output: Output, issueType: IssueType, status: string): void;
|
|
61
|
+
/**
|
|
62
|
+
CLI のオプションで来た parent_epic。空・空白だけなら undefined、数字だけなら整数(安全な整数を超えるなら数字の文字列)、それ以外は文字列
|
|
63
|
+
*/
|
|
64
|
+
export declare function normalizeParentEpicCli(raw: string | undefined): number | string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
parent_epic を Issue 参照にする。整数は aggregation_repo の Issue(未設定なら task のリポジトリ)、`owner/repo/N` はそのまま。
|
|
67
|
+
解決できなければ BadParameterError。番号が安全な整数を超える参照は、丸めずに解決できない参照として扱う
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveParentEpicReference(raw: number | string, config: ProjectConfig, taskOwner: string, taskRepository: string): IssueReference;
|
|
70
|
+
export interface EpicTarget {
|
|
71
|
+
readonly repository: string;
|
|
72
|
+
/**
|
|
73
|
+
--repo が aggregation_repo と違う例外なので、warnEpicRepositoryException を出す
|
|
74
|
+
*/
|
|
75
|
+
readonly needsWarning: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
Epic を作るリポジトリを、aggregation_repo の方針で決める。
|
|
79
|
+
repository が空で aggregation_repo も未設定なら、決められないので終了コード 2
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveEpicTargetRepository(output: Output, repository: string | undefined, config: ProjectConfig): EpicTarget;
|
|
82
|
+
/**
|
|
83
|
+
Epic の作成先が aggregation_repo と違うときの警告
|
|
84
|
+
*/
|
|
85
|
+
export declare function warnEpicRepositoryException(output: Output, resolvedRepository: string, config: ProjectConfig): void;
|
|
86
|
+
export interface IssueTitleOptions {
|
|
87
|
+
readonly parentEpic?: number | undefined;
|
|
88
|
+
readonly order?: number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
同じ段の中の枝の文字(a-z)。order が無ければ使わない
|
|
91
|
+
*/
|
|
92
|
+
readonly parallel?: string | undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
タイトルに接頭辞と、Epic 番号・order(・枝の文字)を付ける。例は `[Task] #353-04a: タイトル`
|
|
96
|
+
*/
|
|
97
|
+
export declare function buildIssueTitle(issueType: string, title: string, options?: Readonly<IssueTitleOptions>): string;
|
|
98
|
+
/**
|
|
99
|
+
同じ Epic に、同じ(段, 枝の文字)の Issue が無いことを確かめる。OPEN でも CLOSED でも、一度使った番号は再利用できない。
|
|
100
|
+
同じ段では、枝ありと枝なしも重複。最初の一致を error にして終了コード 1。Epic を取れなければ warning だけで続ける
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkDuplicateOrder(output: Output, client: GitHubClient, owner: string, repository: string, parentEpic: number, order: number, parallel?: string): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
Issue を作り、`created:` の行を出して API の応答を返す。失敗は error の行と終了コード 1。
|
|
105
|
+
source は作成元のファイル名(`from <source>` として行の末尾に付く)
|
|
106
|
+
*/
|
|
107
|
+
export declare function createIssueOrExit(output: Output, client: GitHubClient, owner: string, repository: string, title: string, body: string, labels: readonly string[] | undefined, source?: string): Promise<JsonObject>;
|
|
108
|
+
export interface IssueSummary {
|
|
109
|
+
readonly number: number;
|
|
110
|
+
readonly url: string;
|
|
111
|
+
/**
|
|
112
|
+
作成の応答に node_id が無ければ undefined
|
|
113
|
+
*/
|
|
114
|
+
readonly nodeId: string | undefined;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
Issue の作成の応答から、番号・URL・node id を取る
|
|
118
|
+
*/
|
|
119
|
+
export declare function summarizeCreatedIssue(issue: JsonObject): IssueSummary;
|
|
120
|
+
/**
|
|
121
|
+
Issue をボードへ追加する。失敗は warning と Issue の URL を出して undefined
|
|
122
|
+
*/
|
|
123
|
+
export declare function addToBoardOrWarn(output: Output, client: GitHubClient, config: ProjectConfig, owner: string, repository: string, issueNumber: number, issueNodeId: string | undefined, issueUrl: string): Promise<BoardItem | undefined>;
|
|
124
|
+
export interface IssueField {
|
|
125
|
+
readonly fieldName: string;
|
|
126
|
+
readonly optionName: string;
|
|
127
|
+
/**
|
|
128
|
+
`set:` の行に出す名前
|
|
129
|
+
*/
|
|
130
|
+
readonly label: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
カスタムフィールドを順に設定し、設定できた分を 1 行の set にする。失敗したフィールドは、何も出さずに飛ばす
|
|
134
|
+
*/
|
|
135
|
+
export declare function setIssueFields(output: Output, client: GitHubClient, config: ProjectConfig, itemId: string, target: string, fields: readonly IssueField[]): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
親 Epic のサブ Issue にする。失敗は Issue の URL、error の行の順に出して終了コード 1
|
|
138
|
+
*/
|
|
139
|
+
export declare function linkToParentEpic(output: Output, client: GitHubClient, target: string, parentReference: IssueReference, issueNodeId: string, issueUrl: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
リポジトリがプロジェクトにリンクされていなければ、message を error に出して終了コード 1
|
|
142
|
+
*/
|
|
143
|
+
export declare function ensureRepositoryInProject(output: Output, config: ProjectConfig, client: GitHubClient, owner: string, repository: string, message: string): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
起票用のクライアントを作り、リポジトリのリンクと、親 Epic のリポジトリでの order の重複を確かめる
|
|
146
|
+
*/
|
|
147
|
+
export declare function clientForIssueCreate(output: Output, config: ProjectConfig, owner: string, repository: string, display: string, parentReference: IssueReference | undefined, order: number | undefined, parallel?: string): Promise<GitHubClient>;
|
|
148
|
+
/**
|
|
149
|
+
本文をテンプレートと比べ、違反を 1 つの error にして出す。違反があれば true。
|
|
150
|
+
1 行目はテンプレートのパス。続く行に、違反のある種類だけを並べる
|
|
151
|
+
*/
|
|
152
|
+
export declare function hasReportedTemplateViolations(output: Output, body: string, templatePath: string, options?: {
|
|
153
|
+
readonly emDashHint?: boolean;
|
|
154
|
+
}): boolean;
|
|
155
|
+
/**
|
|
156
|
+
Issue 本文を種別のテンプレートと比べる。違反があれば error を出して終了コード 1
|
|
157
|
+
*/
|
|
158
|
+
export declare function validateIssueTemplate(output: Output, templateType: NonNullable<IssueFrontmatter['template']>, body: string): void;
|
|
159
|
+
//# sourceMappingURL=issue-shared.d.ts.map
|