@pecot/workflow-mcp 5.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.
Files changed (188) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +27 -22
  3. package/cli/dist/cli.js +6 -1
  4. package/cli/dist/commands/board-add.d.ts +3 -0
  5. package/cli/dist/commands/board-add.js +69 -0
  6. package/cli/dist/commands/board-judgment.d.ts +69 -0
  7. package/cli/dist/commands/board-judgment.js +150 -0
  8. package/cli/dist/commands/board-move.d.ts +3 -0
  9. package/cli/dist/commands/board-move.js +65 -0
  10. package/cli/dist/commands/board-readiness.d.ts +34 -0
  11. package/cli/dist/commands/board-readiness.js +108 -0
  12. package/cli/dist/commands/board-show.d.ts +3 -0
  13. package/cli/dist/commands/board-show.js +75 -0
  14. package/cli/dist/commands/board-sync.d.ts +3 -0
  15. package/cli/dist/commands/board-sync.js +120 -0
  16. package/cli/dist/commands/board-view.d.ts +151 -0
  17. package/cli/dist/commands/board-view.js +293 -0
  18. package/cli/dist/commands/board.d.ts +3 -0
  19. package/cli/dist/commands/board.js +12 -0
  20. package/cli/dist/commands/branch.d.ts +3 -0
  21. package/cli/dist/commands/branch.js +111 -0
  22. package/cli/dist/commands/command-binding.js +4 -0
  23. package/cli/dist/commands/command-definition.d.ts +39 -8
  24. package/cli/dist/commands/command-definition.js +20 -7
  25. package/cli/dist/commands/command-help.js +2 -2
  26. package/cli/dist/commands/command-hint.d.ts +5 -0
  27. package/cli/dist/commands/command-hint.js +13 -0
  28. package/cli/dist/commands/command-stop.d.ts +5 -3
  29. package/cli/dist/commands/command-stop.js +7 -6
  30. package/cli/dist/commands/failure-kind.d.ts +3 -0
  31. package/cli/dist/commands/failure-kind.js +35 -0
  32. package/cli/dist/commands/failure.d.ts +6 -0
  33. package/cli/dist/commands/failure.js +29 -3
  34. package/cli/dist/commands/github-client.d.ts +6 -2
  35. package/cli/dist/commands/github-client.js +13 -3
  36. package/cli/dist/commands/help.js +8 -13
  37. package/cli/dist/commands/issue-board.d.ts +61 -0
  38. package/cli/dist/commands/issue-board.js +85 -1
  39. package/cli/dist/commands/issue-comment.js +66 -30
  40. package/cli/dist/commands/issue-create.js +632 -92
  41. package/cli/dist/commands/issue-dependency.d.ts +3 -0
  42. package/cli/dist/commands/issue-dependency.js +310 -0
  43. package/cli/dist/commands/issue-readiness.d.ts +122 -0
  44. package/cli/dist/commands/issue-readiness.js +253 -0
  45. package/cli/dist/commands/issue-reopen.d.ts +3 -0
  46. package/cli/dist/commands/issue-reopen.js +130 -0
  47. package/cli/dist/commands/issue-shared.d.ts +33 -20
  48. package/cli/dist/commands/issue-shared.js +84 -76
  49. package/cli/dist/commands/issue-show.d.ts +3 -0
  50. package/cli/dist/commands/issue-show.js +239 -0
  51. package/cli/dist/commands/issue.d.ts +0 -1
  52. package/cli/dist/commands/issue.js +6 -8
  53. package/cli/dist/commands/names.d.ts +33 -0
  54. package/cli/dist/commands/names.js +63 -0
  55. package/cli/dist/commands/output.d.ts +32 -4
  56. package/cli/dist/commands/output.js +28 -8
  57. package/cli/dist/commands/pr-merge.d.ts +3 -0
  58. package/cli/dist/commands/pr-merge.js +230 -0
  59. package/cli/dist/commands/pr-reference.d.ts +8 -0
  60. package/cli/dist/commands/pr-reference.js +30 -0
  61. package/cli/dist/commands/pr-restack.d.ts +6 -0
  62. package/cli/dist/commands/pr-restack.js +233 -0
  63. package/cli/dist/commands/pr-waiting.d.ts +59 -0
  64. package/cli/dist/commands/pr-waiting.js +143 -0
  65. package/cli/dist/commands/pr.d.ts +23 -0
  66. package/cli/dist/commands/pr.js +378 -366
  67. package/cli/dist/commands/project-sync.d.ts +12 -3
  68. package/cli/dist/commands/project-sync.js +23 -13
  69. package/cli/dist/commands/project.d.ts +3 -2
  70. package/cli/dist/commands/project.js +371 -177
  71. package/cli/dist/commands/registry.js +15 -10
  72. package/cli/dist/commands/release.d.ts +2 -2
  73. package/cli/dist/commands/release.js +118 -130
  74. package/cli/dist/commands/renamed-commands.d.ts +26 -0
  75. package/cli/dist/commands/renamed-commands.js +53 -0
  76. package/cli/dist/commands/repository-match.js +9 -3
  77. package/cli/dist/commands/session-finish.d.ts +3 -0
  78. package/cli/dist/commands/session-finish.js +383 -0
  79. package/cli/dist/commands/session-start.d.ts +3 -0
  80. package/cli/dist/commands/session-start.js +252 -0
  81. package/cli/dist/commands/session.d.ts +3 -0
  82. package/cli/dist/commands/session.js +186 -32
  83. package/cli/dist/commands/tracker-sync-dependabot.d.ts +7 -0
  84. package/cli/dist/commands/{dependabot.js → tracker-sync-dependabot.js} +76 -68
  85. package/cli/dist/commands/tracker-sync-security.d.ts +7 -0
  86. package/cli/dist/commands/{security.js → tracker-sync-security.js} +71 -64
  87. package/cli/dist/commands/tracker-sync.d.ts +37 -0
  88. package/cli/dist/commands/tracker-sync.js +18 -6
  89. package/cli/dist/commands/tracker.d.ts +3 -0
  90. package/cli/dist/commands/tracker.js +20 -0
  91. package/cli/dist/commands/usage-error.d.ts +4 -0
  92. package/cli/dist/commands/usage-error.js +6 -0
  93. package/cli/dist/commands/work-target.d.ts +20 -3
  94. package/cli/dist/commands/work-target.js +49 -6
  95. package/cli/dist/commands/worktree.js +103 -33
  96. package/cli/dist/domain/batch-plan.d.ts +73 -0
  97. package/cli/dist/domain/batch-plan.js +114 -0
  98. package/cli/dist/domain/blocked-by-change.d.ts +99 -0
  99. package/cli/dist/domain/blocked-by-change.js +101 -0
  100. package/cli/dist/domain/board-move.d.ts +90 -0
  101. package/cli/dist/domain/board-move.js +92 -0
  102. package/cli/dist/domain/branch-name.js +1 -1
  103. package/cli/dist/domain/command-hint.d.ts +85 -0
  104. package/cli/dist/domain/command-hint.js +148 -0
  105. package/cli/dist/domain/config.d.ts +4 -0
  106. package/cli/dist/domain/config.js +11 -1
  107. package/cli/dist/domain/dependabot.js +1 -1
  108. package/cli/dist/domain/errors.d.ts +5 -0
  109. package/cli/dist/domain/errors.js +5 -0
  110. package/cli/dist/domain/format.d.ts +51 -4
  111. package/cli/dist/domain/format.js +72 -6
  112. package/cli/dist/domain/frontmatter.d.ts +18 -3
  113. package/cli/dist/domain/frontmatter.js +38 -12
  114. package/cli/dist/domain/issue-order.d.ts +55 -0
  115. package/cli/dist/domain/issue-order.js +65 -0
  116. package/cli/dist/domain/issue-readout.d.ts +36 -4
  117. package/cli/dist/domain/pull-request.d.ts +71 -4
  118. package/cli/dist/domain/pull-request.js +59 -10
  119. package/cli/dist/domain/readiness.d.ts +44 -0
  120. package/cli/dist/domain/readiness.js +153 -5
  121. package/cli/dist/domain/reference-parser.d.ts +3 -1
  122. package/cli/dist/domain/reference-parser.js +6 -2
  123. package/cli/dist/domain/release.d.ts +7 -3
  124. package/cli/dist/domain/release.js +5 -12
  125. package/cli/dist/domain/repository-policy.d.ts +9 -3
  126. package/cli/dist/domain/repository-policy.js +8 -7
  127. package/cli/dist/domain/repository-resolver.js +4 -1
  128. package/cli/dist/domain/restack.d.ts +62 -0
  129. package/cli/dist/domain/restack.js +53 -0
  130. package/cli/dist/domain/security-alerts.js +1 -1
  131. package/cli/dist/domain/state.d.ts +69 -0
  132. package/cli/dist/domain/state.js +67 -1
  133. package/cli/dist/domain/work-start.d.ts +30 -0
  134. package/cli/dist/domain/work-start.js +42 -0
  135. package/cli/dist/infra/authored-notes.d.ts +1 -1
  136. package/cli/dist/infra/authored-notes.js +10 -4
  137. package/cli/dist/infra/config-store.d.ts +4 -0
  138. package/cli/dist/infra/config-store.js +13 -0
  139. package/cli/dist/infra/git.d.ts +76 -0
  140. package/cli/dist/infra/git.js +123 -1
  141. package/cli/dist/infra/github/client.d.ts +5 -0
  142. package/cli/dist/infra/github/client.js +10 -7
  143. package/cli/dist/infra/github/errors.d.ts +18 -0
  144. package/cli/dist/infra/github/errors.js +22 -0
  145. package/cli/dist/infra/github/issues.d.ts +39 -3
  146. package/cli/dist/infra/github/issues.js +178 -23
  147. package/cli/dist/infra/github/projects.d.ts +35 -0
  148. package/cli/dist/infra/github/projects.js +89 -8
  149. package/cli/dist/infra/github/pulls.d.ts +105 -2
  150. package/cli/dist/infra/github/pulls.js +172 -5
  151. package/cli/dist/infra/github/queries.d.ts +15 -4
  152. package/cli/dist/infra/github/queries.js +203 -40
  153. package/cli/dist/infra/github/readout.d.ts +5 -1
  154. package/cli/dist/infra/github/readout.js +11 -33
  155. package/cli/dist/infra/github/repos.d.ts +18 -0
  156. package/cli/dist/infra/github/repos.js +31 -0
  157. package/cli/dist/infra/nx-scope.d.ts +1 -1
  158. package/cli/dist/infra/nx-scope.js +1 -1
  159. package/cli/dist/infra/state-store.d.ts +10 -1
  160. package/cli/dist/infra/state-store.js +14 -2
  161. package/cli/dist/infra/worktree-links.d.ts +3 -0
  162. package/cli/dist/infra/worktree-links.js +8 -1
  163. package/cli/dist/infra/worktree.d.ts +12 -1
  164. package/cli/dist/infra/worktree.js +40 -23
  165. package/cli/dist/mcp/result.d.ts +82 -7
  166. package/cli/dist/mcp/result.js +139 -19
  167. package/cli/dist/mcp/server.d.ts +2 -2
  168. package/cli/dist/mcp/server.js +57 -10
  169. package/cli/templates/comment/plan.md +14 -0
  170. package/cli/templates/comment/review-findings.md +3 -2
  171. package/cli/templates/issue/bug.md +13 -4
  172. package/cli/templates/issue/task-implement.md +13 -6
  173. package/cli/templates/issue/task.md +13 -4
  174. package/cli/templates/workflow/pecot-board-sync.yml +84 -0
  175. package/npm-shrinkwrap.json +2 -2
  176. package/package.json +1 -1
  177. package/cli/dist/commands/dependabot.d.ts +0 -3
  178. package/cli/dist/commands/issue-project.d.ts +0 -3
  179. package/cli/dist/commands/issue-project.js +0 -176
  180. package/cli/dist/commands/issue-quick.d.ts +0 -3
  181. package/cli/dist/commands/issue-quick.js +0 -126
  182. package/cli/dist/commands/issue-read.d.ts +0 -3
  183. package/cli/dist/commands/issue-read.js +0 -80
  184. package/cli/dist/commands/project-info.d.ts +0 -48
  185. package/cli/dist/commands/project-info.js +0 -181
  186. package/cli/dist/commands/repository.d.ts +0 -5
  187. package/cli/dist/commands/repository.js +0 -265
  188. package/cli/dist/commands/security.d.ts +0 -3
@@ -6,8 +6,10 @@
6
6
  import path from 'node:path';
7
7
  import { z } from 'zod';
8
8
  import { aggregationRepositoryReference, isRepositoryInProject } from '../domain/config.js';
9
+ import { formatHinted } from '../domain/command-hint.js';
9
10
  import { BaseError } from '../domain/errors.js';
10
11
  import { CommandExit } from './command-definition.js';
12
+ import { planOrders, usedOrdersOf } from '../domain/issue-order.js';
11
13
  import { pythonStrip } from '../domain/python-format.js';
12
14
  import { issueReferenceToCliReference, parseIssueReference, ReferenceParseError } from '../domain/reference-parser.js';
13
15
  import { AmbiguousRepositoryError, createRepositoryReference, resolveRepository } from '../domain/repository-resolver.js';
@@ -16,16 +18,20 @@ import { gitRunnerFor } from '../infra/git.js';
16
18
  import { GitHubAPIError } from '../infra/github/errors.js';
17
19
  import { requireNumber, requireString } from '../infra/github/payload.js';
18
20
  import { readTemplateSections, templateFile } from '../infra/template-store.js';
21
+ import { commandHint, hinted, inputHint, inputNameHint } from './command-hint.js';
19
22
  import { stopWith } from './command-stop.js';
23
+ import { kindOfFailure } from './failure.js';
20
24
  import { createGitHubClient } from './github-client.js';
21
25
  import { addIssueToBoard, createIssue, setIssueField } from './issue-board.js';
22
26
  import { USAGE_EXIT_CODE, UsageError } from './usage-error.js';
27
+ // Epic を作るコマンド。作成先の案内に使う
28
+ const EPIC_CREATE_PATH = ['issue', 'create'];
23
29
  /**
24
30
  issue comment のテンプレ検証失敗の終了コード。通信失敗・設定なし・引数不足の 1 と区別し、hooks がこの値で分岐する
25
31
  */
26
32
  export const COMMENT_VALIDATION_EXIT_CODE = 3;
27
33
  /**
28
- Issue 種別の入力。issue create と issue quick が共有する
34
+ Issue 種別の入力。issue create が使う
29
35
  */
30
36
  export const ISSUE_TYPE_SCHEMA = z.enum(['task', 'bug', 'epic', 'tracker']).default('task').describe('Issue type (task/bug/epic/tracker)');
31
37
  export const PARENT_EPIC_DESCRIPTION = 'Parent Epic reference: an integer (relative to aggregation_repo) or the primary form \'owner/repo/N\'';
@@ -45,7 +51,7 @@ const TYPE_PREFIX_MAP = new Map([
45
51
  */
46
52
  export const TYPE_DEFAULT_STATUS = { epic: 'backlog', tracker: 'backlog', task: 'ready', bug: 'ready' };
47
53
  /**
48
- Backlog に置く型(quick の status / size / quick フラグの扱いが Epic と同じ)
54
+ Backlog に置く型(freeform の size と quick-mode フラグの扱いが Epic と同じ)
49
55
  */
50
56
  export const BACKLOG_TYPES = new Set(['epic', 'tracker']);
51
57
  // --- 終了の表し方 ---
@@ -53,6 +59,12 @@ export const BACKLOG_TYPES = new Set(['epic', 'tracker']);
53
59
  引数の値が不正。Python の typer.BadParameter。呼ぶ側が受けない場合は、runWithExit が使い方の誤り(終了コード 2)にする
54
60
  */
55
61
  class BadParameterError extends BaseError {
62
+ text;
63
+ // message は CLI の形。text は出し先の形で描き直すために持つ
64
+ constructor(text) {
65
+ super(formatHinted(text, 'cli'));
66
+ this.text = text;
67
+ }
56
68
  }
57
69
  /**
58
70
  run の本体を包む。終わったら 0 を返す。BadParameterError は使い方の誤りにして伝える。
@@ -71,7 +83,7 @@ export async function runWithExit(body) {
71
83
  }
72
84
  // --- Issue 参照 ---
73
85
  /**
74
- `owner/repo/N` の表記。エラー文と done の行の対象に使う
86
+ `owner/repo/N` の表記。エラー文と done の行の対象、MCP の data の参照に使う
75
87
  */
76
88
  export function issuePath(owner, repository, number) {
77
89
  return `${owner}/${repository}/${String(number)}`;
@@ -101,7 +113,7 @@ function parseIssueReferenceFromContext(repository, raw) {
101
113
  }
102
114
  catch (error) {
103
115
  if (error instanceof ReferenceParseError)
104
- throw new BadParameterError(error.message);
116
+ throw new BadParameterError(error.hintedText ?? error.message);
105
117
  throw error;
106
118
  }
107
119
  }
@@ -115,7 +127,7 @@ export function parseIssueReferenceOrExit(output, repository, raw) {
115
127
  catch (error) {
116
128
  if (!(error instanceof BadParameterError))
117
129
  throw error;
118
- return stopWith(output, error.message, USAGE_EXIT_CODE);
130
+ return stopWith(output, error.text, 'invalid-input', USAGE_EXIT_CODE);
119
131
  }
120
132
  }
121
133
  // --- status ---
@@ -123,20 +135,20 @@ export function parseIssueReferenceOrExit(output, repository, raw) {
123
135
  不正な status と、有効な値を出して終了コード 1
124
136
  */
125
137
  export function exitInvalidStatus(output, status) {
126
- return stopWith(output, `invalid status: ${status}\nvalid values: backlog/pending/blocked/ready/active/in_review/archived`);
138
+ return stopWith(output, `invalid status: ${status}\nvalid values: backlog/pending/blocked/ready/active/in_review/archived`, 'invalid-input');
127
139
  }
128
140
  /**
129
- 起票時の status が、型対応テンプレートの既定値と一致するか確かめる。違えば終了コード 1。
130
- enum 外の値(`--status foo`)と、型に合わない別テンプレートの既定値(`--type bug --status backlog`)は文を分ける
141
+ 起票時の status が、許す値のどれかと一致するか確かめる。違えば終了コード 1。許す値の既定は、型対応テンプレートの既定値だけ。
142
+ enum 外の値(`--status foo`)と、許さない値(`--type bug --status backlog`)は文を分ける
131
143
  */
132
- export function validateStatusForType(output, issueType, status) {
144
+ export function validateStatusForType(output, issueType, status, allowed) {
133
145
  if (!VALID_STATUSES.has(status))
134
146
  exitInvalidStatus(output, status);
135
147
  // eslint-disable-next-line security/detect-object-injection -- issueType は列挙型
136
- const expected = TYPE_DEFAULT_STATUS[issueType];
137
- if (status === expected)
148
+ const accepted = allowed ?? [TYPE_DEFAULT_STATUS[issueType]];
149
+ if (accepted.includes(status))
138
150
  return;
139
- stopWith(output, `the status at creation for type '${issueType}' is only '${expected}' (given: ${status})\nhint: move it to pending or another status on the board after creation`);
151
+ stopWith(output, `the status at creation for type '${issueType}' is only ${accepted.map(value => `'${value}'`).join(' or ')} (given: ${status})\nhint: move it to pending or another status on the board after creation`, 'invalid-input');
140
152
  }
141
153
  // --- parent_epic・タイトル・order ---
142
154
  /**
@@ -182,7 +194,7 @@ export function resolveEpicTargetRepository(output, repository, config) {
182
194
  const aggregation = config.aggregation_repo;
183
195
  if (explicit === undefined) {
184
196
  if (aggregation === undefined) {
185
- stopWith(output, 'cannot decide where to create the Epic\ndeclare aggregation_repo in the project config, or pass --repo', USAGE_EXIT_CODE);
197
+ stopWith(output, hinted `cannot decide where to create the Epic\ndeclare aggregation_repo in the project config, or pass ${inputNameHint(EPIC_CREATE_PATH, 'repo')}`, 'repo-setting-missing', USAGE_EXIT_CODE);
186
198
  }
187
199
  return { repository: aggregation, needsWarning: false };
188
200
  }
@@ -192,83 +204,58 @@ export function resolveEpicTargetRepository(output, repository, config) {
192
204
  Epic の作成先が aggregation_repo と違うときの警告
193
205
  */
194
206
  export function warnEpicRepositoryException(output, resolvedRepository, config) {
195
- output.warning(`--repo ${resolvedRepository} differs from aggregation_repo (${String(config.aggregation_repo)})\ncontinuing as an exception for an Epic in an implementation repo`);
207
+ output.warning(hinted `${inputHint(EPIC_CREATE_PATH, 'repo', resolvedRepository)} differs from aggregation_repo (${String(config.aggregation_repo)})\ncontinuing as an exception for an Epic in an implementation repo`);
196
208
  }
197
209
  /**
198
- タイトルに接頭辞と、Epic 番号・order(・枝の文字)を付ける。例は `[Task] #353-04a: タイトル`
210
+ タイトルに接頭辞と、Epic 番号・order を付ける。例は `[Task] #353-04: タイトル`
199
211
  */
200
212
  export function buildIssueTitle(issueType, title, options = {}) {
201
213
  const prefix = TYPE_PREFIX_MAP.get(issueType) ?? '';
202
214
  const hasPrefix = prefix !== '' && title.startsWith(prefix);
203
215
  const baseTitle = hasPrefix ? pythonStrip(title.slice(prefix.length)) : title;
204
216
  if (options.parentEpic !== undefined && options.order !== undefined) {
205
- const number = `#${String(options.parentEpic)}-${orderLabel(options.order, options.parallel)}`;
217
+ const number = `#${String(options.parentEpic)}-${orderLabel(options.order)}`;
206
218
  return prefix === '' ? `${number}: ${baseTitle}` : `${prefix} ${number}: ${baseTitle}`;
207
219
  }
208
220
  return prefix === '' || hasPrefix ? title : `${prefix} ${title}`;
209
221
  }
210
222
  /**
211
- エラー文に出す番号。2 桁の order に、枝の文字を続ける
223
+ タイトルの番号。2 桁にそろえる
212
224
  */
213
- function orderLabel(order, parallel = '') {
214
- return `${String(order).padStart(2, '0')}${parallel}`;
215
- }
216
- // タイトルの `#123-01:` と `#123-01a:` から、Epic 番号・段・枝を取る
217
- const ORDER_PATTERN = /#(\d+)-(\d+)([a-z])?:/u;
218
- const LOWERCASE_LETTERS = Array.from({ length: 26 }, (_, index) => String.fromCodePoint(97 + index));
219
- function usedOrdersOf(subIssues, parentEpic) {
220
- const orders = [];
221
- const values = [];
222
- for (const sub of subIssues) {
223
- const [, epic, stage, letter] = ORDER_PATTERN.exec(sub.title) ?? [];
224
- if (epic === undefined || stage === undefined || Number(epic) !== parentEpic)
225
- continue;
226
- values.push(Number(stage));
227
- orders.push({ ...sub, stage: Number(stage), parallel: letter });
228
- }
229
- return { orders, values };
225
+ function orderLabel(order) {
226
+ return String(order).padStart(2, '0');
230
227
  }
231
228
  /**
232
- 同じ Epic に、同じ(段, 枝の文字)の Issue が無いことを確かめる。OPEN でも CLOSED でも、一度使った番号は再利用できない。
233
- 同じ段では、枝ありと枝なしも重複。最初の一致を error にして終了コード 1。Epic を取れなければ warning だけで続ける
229
+ 親 Epic のサブ Issue から、使われた番号を読む。全件を読む。Epic を取れなければ warning を出して undefined
234
230
  */
235
- export async function checkDuplicateOrder(output, client, owner, repository, parentEpic, order, parallel) {
236
- let subIssues;
231
+ export async function readUsedOrders(output, client, owner, repository, parentEpic) {
237
232
  try {
238
- const slim = await client.getIssueSlim(owner, repository, parentEpic, 0);
239
- subIssues = slim.sub_issues;
233
+ return usedOrdersOf(await client.getAllSubIssues(owner, repository, parentEpic), parentEpic);
240
234
  }
241
235
  catch (error) {
242
236
  if (!(error instanceof GitHubAPIError))
243
237
  throw error;
244
238
  output.warning(`could not fetch the parent Epic #${String(parentEpic)}: ${error.message}`);
245
- return;
239
+ return undefined;
246
240
  }
247
- const used = usedOrdersOf(subIssues, parentEpic);
248
- const sameOrder = used.orders.filter(sub => sub.stage === order);
249
- const duplicate = sameOrder.find(sub => sub.parallel === undefined || parallel === undefined || sub.parallel === parallel);
250
- if (duplicate === undefined)
241
+ }
242
+ /**
243
+ 明示の order が既存の Issue と重なったときの error を出して終了コード 1。一度使った番号は、OPEN でも CLOSED でも再利用できない
244
+ */
245
+ export function stopForDuplicateOrder(output, parentEpic, order, existing, nextAvailable) {
246
+ const stateLabel = existing.state === 'OPEN' ? 'OPEN' : 'CLOSED';
247
+ return stopWith(output, `Epic #${String(parentEpic)} already has an Issue with order=${String(order)} (${stateLabel})\n#${String(existing.number)} ${existing.title}\nnext available order: ${String(nextAvailable)}`, 'order-conflict');
248
+ }
249
+ /**
250
+ 同じ Epic に、同じ order の Issue が無いことを確かめる。最初の一致を error にして終了コード 1。Epic を取れなければ warning だけで続ける
251
+ */
252
+ export async function checkDuplicateOrder(output, client, owner, repository, parentEpic, order) {
253
+ const used = await readUsedOrders(output, client, owner, repository, parentEpic);
254
+ if (used === undefined)
251
255
  return;
252
- const usedValues = new Set(used.values);
253
- let nextOrder = 1;
254
- while (usedValues.has(nextOrder))
255
- nextOrder += 1;
256
- let conflict;
257
- let suggestion;
258
- if (parallel === undefined && duplicate.parallel === undefined) {
259
- conflict = `an Issue with order=${String(order)}`;
260
- suggestion = `next available order: ${String(nextOrder)}`;
261
- }
262
- else {
263
- const usedLetters = new Set(sameOrder.map(sub => sub.parallel));
264
- const letter = LOWERCASE_LETTERS.find(candidate => !usedLetters.has(candidate));
265
- suggestion = letter === undefined || usedLetters.has(undefined)
266
- ? `next available order: ${String(Math.max(...usedValues) + 1)}`
267
- : `next available number: ${orderLabel(order, letter)}`;
268
- conflict = `an Issue (${orderLabel(order, duplicate.parallel)}) that conflicts with order=${orderLabel(order, parallel)}`;
269
- }
270
- const stateLabel = duplicate.state === 'OPEN' ? 'OPEN' : 'CLOSED';
271
- stopWith(output, `Epic #${String(parentEpic)} already has ${conflict} (${stateLabel})\n#${String(duplicate.number)} ${duplicate.title}\n${suggestion}`);
256
+ const plan = planOrders(used, [{ file: '', order }]);
257
+ if (plan.kind === 'duplicate-existing')
258
+ stopForDuplicateOrder(output, parentEpic, order, plan.existing, plan.nextAvailable);
272
259
  }
273
260
  // --- Issue の作成・ボード・親 Epic ---
274
261
  /**
@@ -283,7 +270,7 @@ export async function createIssueOrExit(output, client, owner, repository, title
283
270
  catch (error) {
284
271
  if (!(error instanceof GitHubAPIError))
285
272
  throw error;
286
- return stopWith(output, `could not create an Issue in ${owner}/${repository}: ${error.message}`);
273
+ return stopWith(output, `could not create an Issue in ${owner}/${repository}: ${error.message}`, kindOfFailure(error));
287
274
  }
288
275
  const target = `Issue ${issuePath(owner, repository, requireNumber(issue['number'], 'number'))}`;
289
276
  output.done({ verb: 'create', target: source === undefined || source === '' ? target : `${target} from ${source}` });
@@ -319,14 +306,17 @@ export async function addToBoardOrWarn(output, client, config, owner, repository
319
306
  return added;
320
307
  }
321
308
  /**
322
- カスタムフィールドを順に設定し、設定できた分を 1 行の set にする。失敗したフィールドは、何も出さずに飛ばす
309
+ カスタムフィールドを順に設定し、設定できた分を 1 行の set にする。失敗したフィールドは、何も出さずに飛ばす。設定できたフィールドの名前を返す
323
310
  */
324
311
  export async function setIssueFields(output, client, config, itemId, target, fields) {
325
312
  const labels = [];
313
+ const written = [];
326
314
  for (const { fieldName, optionName, label } of fields) {
327
315
  try {
328
- if (await setIssueField(client, config, itemId, fieldName, optionName))
316
+ if (await setIssueField(client, config, itemId, fieldName, optionName)) {
329
317
  labels.push(label);
318
+ written.push(fieldName);
319
+ }
330
320
  }
331
321
  catch (error) {
332
322
  if (!(error instanceof GitHubAPIError))
@@ -335,23 +325,26 @@ export async function setIssueFields(output, client, config, itemId, target, fie
335
325
  }
336
326
  if (labels.length > 0)
337
327
  output.done({ verb: 'set', target: `${target} ${labels.join(', ')}` });
328
+ return written;
338
329
  }
339
330
  /**
340
- 親 Epic のサブ Issue にする。失敗は Issue の URL、error の行の順に出して終了コード 1
331
+ 親 Epic のサブ Issue にする。失敗は Issue の URL(issueUrl が undefined なら出し済みとして省く)、error の行の順に出して終了コード 1。issueNodeId は、無ければ取り直す関数。行に出した親の参照(owner/repo/N)を返す
341
332
  */
342
333
  export async function linkToParentEpic(output, client, target, parentReference, issueNodeId, issueUrl) {
343
334
  const parent = issueReferenceToCliReference(parentReference);
344
335
  try {
345
336
  const parentNodeId = await client.getIssueNodeId(parentReference.repository.owner, parentReference.repository.repository, parentReference.number);
346
- await client.addSubIssue(parentNodeId, issueNodeId);
337
+ await client.addSubIssue(parentNodeId, typeof issueNodeId === 'string' ? issueNodeId : await issueNodeId());
347
338
  }
348
339
  catch (error) {
349
340
  if (!(error instanceof GitHubAPIError))
350
341
  throw error;
351
- output.data(issueUrl);
352
- stopWith(output, `could not add ${target} as sub-issue of ${parent}: ${error.message}`);
342
+ if (issueUrl !== undefined)
343
+ output.data(issueUrl);
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));
353
345
  }
354
346
  output.done({ verb: 'add', target: `${target} as sub-issue of ${parent}` });
347
+ return parent;
355
348
  }
356
349
  /**
357
350
  リポジトリがプロジェクトにリンクされていなければ、message を error に出して終了コード 1
@@ -359,16 +352,31 @@ export async function linkToParentEpic(output, client, target, parentReference,
359
352
  export async function ensureRepositoryInProject(output, config, client, owner, repository, message) {
360
353
  if (await isRepositoryInProject(config, owner, repository, client))
361
354
  return;
362
- stopWith(output, message);
355
+ stopWith(output, message, 'repo-not-in-project');
356
+ }
357
+ /**
358
+ クライアントを作り、リポジトリがプロジェクトにあることを確かめる。無ければ error と終了コード 1。board add・board move・issue reopen が使う
359
+ */
360
+ export async function connectToProject(output, config, owner, repository) {
361
+ const client = createGitHubClient(output, config.host);
362
+ await ensureRepositoryInProject(output, config, client, owner, repository, `repository ${owner}/${repository} is not in the project`);
363
+ return client;
364
+ }
365
+ /**
366
+ ボードに無い status の error の文。blocked は後から足せる option なので、足し方の hint を添える
367
+ */
368
+ export function notConfiguredMessage(status) {
369
+ const base = `status '${status}' is not configured in the project`;
370
+ return status === 'blocked' ? hinted `${base}\nhint: run ${commandHint(['project', 'init'])} to add the Blocked option to the board` : base;
363
371
  }
364
372
  /**
365
373
  起票用のクライアントを作り、リポジトリのリンクと、親 Epic のリポジトリでの order の重複を確かめる
366
374
  */
367
- export async function clientForIssueCreate(output, config, owner, repository, display, parentReference, order, parallel) {
375
+ export async function clientForIssueCreate(output, config, owner, repository, display, parentReference, order) {
368
376
  const client = createGitHubClient(output, config.host);
369
377
  await ensureRepositoryInProject(output, config, client, owner, repository, `${display} is not linked to the project`);
370
378
  if (parentReference !== undefined && order !== undefined) {
371
- await checkDuplicateOrder(output, client, parentReference.repository.owner, parentReference.repository.repository, parentReference.number, order, parallel);
379
+ await checkDuplicateOrder(output, client, parentReference.repository.owner, parentReference.repository.repository, parentReference.number, order);
372
380
  }
373
381
  return client;
374
382
  }
@@ -414,6 +422,6 @@ Issue 本文を種別のテンプレートと比べる。違反があれば erro
414
422
  */
415
423
  export function validateIssueTemplate(output, templateType, body) {
416
424
  if (hasReportedTemplateViolations(output, body, templateFile('issue', templateType), { emDashHint: true }))
417
- throw new CommandExit(1);
425
+ throw new CommandExit(1, 'content-invalid');
418
426
  }
419
427
  //# sourceMappingURL=issue-shared.js.map
@@ -0,0 +1,3 @@
1
+ import type { CommandDefinition } from './command-definition.js';
2
+ export declare const ISSUE_SHOW_COMMANDS: readonly CommandDefinition[];
3
+ //# sourceMappingURL=issue-show.d.ts.map
@@ -0,0 +1,239 @@
1
+ // issue show。cli/commands/issue.py の issue_read の移植。
2
+ import { z } from 'zod';
3
+ import { JSON_NULL } from '../domain/json-null.js';
4
+ import { describePrerequisiteState, describeReadiness, describeUnknown, displayReference, TRACKER_TITLE_PREFIX } from '../domain/readiness.js';
5
+ import { createIssueReference, issueReferenceKey } from '../domain/reference-parser.js';
6
+ import { createRepositoryReference, repositoryFullName } from '../domain/repository-resolver.js';
7
+ import { DependenciesUnsupportedError, GitHubAPIError } from '../infra/github/errors.js';
8
+ import { defineCommand } from './command-definition.js';
9
+ import { stopWith, requireActiveConfigPlain } from './command-stop.js';
10
+ import { kindOfFailure } from './failure.js';
11
+ import { createGitHubClient } from './github-client.js';
12
+ import { ISSUE_REF_DESCRIPTION, issuePath, parseIssueReferenceOrExit, runWithExit } from './issue-shared.js';
13
+ import { blockedByReadCount, createReadinessCache, judgeSnapshot, READINESS_JSON, readIssueReadiness, readinessJson, snapshotWithoutPrerequisites } from './issue-readiness.js';
14
+ import { createOutput } from './output.js';
15
+ const MAX_COMMENT_LIMIT = 20;
16
+ const DEFAULT_COMMENT_LIMIT = 5;
17
+ function parentLine(issue, owner, repository) {
18
+ const { parent } = issue;
19
+ if (parent === null)
20
+ return undefined;
21
+ const isCrossRepository = parent.owner !== null && parent.repo !== null && (parent.owner !== owner || parent.repo !== repository);
22
+ const label = isCrossRepository ? `${parent.owner}/${parent.repo}#${String(parent.number)}` : `#${String(parent.number)}`;
23
+ return `**Parent:** ${label} ${parent.title} (${parent.state})`;
24
+ }
25
+ /**
26
+ Issue の情報を Markdown にする。owner・repo は、親が別のリポジトリかを調べる元
27
+ */
28
+ function formatIssueMarkdown(issue, owner, repository, readinessLines) {
29
+ const lines = [`## #${String(issue.number)} ${issue.title}`, ''];
30
+ const meta = [`**State:** ${issue.state}`];
31
+ if (issue.comments.total_count > 0)
32
+ meta.push(`**Comments:** ${String(issue.comments.total_count)}`);
33
+ lines.push(meta.join(' | '), '');
34
+ const parent = parentLine(issue, owner, repository);
35
+ const header = [...parent === undefined ? [] : [parent], ...readinessLines];
36
+ if (header.length > 0)
37
+ lines.push(...header, '');
38
+ if (issue.linked_branches.length > 0) {
39
+ lines.push('**Branches:**', ...issue.linked_branches.map(branch => ` - \`${branch}\``), '');
40
+ }
41
+ if (issue.linked_prs.length > 0) {
42
+ lines.push('**Linked PRs:**', ...issue.linked_prs.map(pr => ` - #${String(pr.number)} ${pr.title} (${pr.state})`), '');
43
+ }
44
+ if (issue.sub_issues.length > 0) {
45
+ lines.push('**Sub-issues:**', ...issue.sub_issues.map(sub => ` - #${String(sub.number)} ${sub.title} (${sub.state})`), '');
46
+ }
47
+ lines.push('---', '', issue.body);
48
+ const comments = issue.comments.nodes;
49
+ if (comments.length > 0) {
50
+ lines.push('', '', `### Comments (${String(comments.length)}/${String(issue.comments.total_count)})`, '');
51
+ for (const comment of comments) {
52
+ lines.push('---', '', `**@${comment.author}** - ${comment.created_at.slice(0, 10)}`, '', comment.body, '');
53
+ }
54
+ }
55
+ return lines.join('\n');
56
+ }
57
+ const PREREQUISITE_JSON = z.strictObject({
58
+ number: z.int().describe('Issue number of the prerequisite'),
59
+ repository: z.string().describe('Repository of the prerequisite (owner/repo)'),
60
+ state: z.enum(['OPEN', 'CLOSED']).describe('State of the prerequisite'),
61
+ wait: z.enum(['stack', 'merge']).describe('How to wait for the prerequisite (stack on its branch, or wait for its merge)'),
62
+ reason: z.string().nullable().describe('Reason written in the Waits for merge section (null when none)'),
63
+ });
64
+ const COMMENT_JSON = z.strictObject({
65
+ author: z.string().describe('Login of the author (ghost when deleted)'),
66
+ created_at: z.string().describe('Creation time (ISO 8601)'),
67
+ body: z.string().describe('Body of the comment'),
68
+ });
69
+ const COMMENTS_JSON = z.strictObject({
70
+ total_count: z.int().describe('Number of all comments'),
71
+ nodes: z.array(COMMENT_JSON).describe('Latest comments, up to comment_limit'),
72
+ });
73
+ const PARENT_JSON = z.strictObject({
74
+ number: z.int().describe('Issue number of the parent'),
75
+ title: z.string().describe('Title of the parent'),
76
+ state: z.string().describe('State of the parent (OPEN or CLOSED)'),
77
+ owner: z.string().nullable().describe('Owner of the parent repository'),
78
+ repo: z.string().nullable().describe('Name of the parent repository'),
79
+ });
80
+ const SUB_ISSUE_JSON = z.strictObject({
81
+ number: z.int().describe('Issue number of the sub-issue'),
82
+ state: z.string().describe('State of the sub-issue (OPEN or CLOSED)'),
83
+ title: z.string().describe('Title of the sub-issue'),
84
+ });
85
+ const LINKED_PR_JSON = z.strictObject({
86
+ number: z.int().describe('PR number'),
87
+ title: z.string().describe('Title of the PR'),
88
+ state: z.string().describe('State of the PR'),
89
+ });
90
+ const ISSUE_SHOW_OUTPUT = z.strictObject({
91
+ number: z.int().describe('Issue number'),
92
+ state: z.string().describe('State of the Issue (OPEN or CLOSED)'),
93
+ title: z.string().describe('Title of the Issue'),
94
+ body: z.string().describe('Body of the Issue'),
95
+ comments: COMMENTS_JSON.describe('Comments of the Issue'),
96
+ parent: PARENT_JSON.nullable().describe('Parent Issue (null when none)'),
97
+ sub_issues: z.array(SUB_ISSUE_JSON).describe('Sub-issues'),
98
+ linked_branches: z.array(z.string()).describe('Branches linked to the Issue'),
99
+ linked_prs: z.array(LINKED_PR_JSON).describe('PRs linked to the Issue'),
100
+ owner: z.string().describe('Owner of the Issue repository'),
101
+ repo: z.string().describe('Name of the Issue repository'),
102
+ blockedBy: z.array(PREREQUISITE_JSON).nullable().describe('Prerequisites (blocked by) of the Issue (null when they could not be read)'),
103
+ readiness: READINESS_JSON.nullable().describe('Readiness judgment (null when it could not be judged)'),
104
+ });
105
+ // 前提と判定を読めなかったとき
106
+ const UNREAD = { lines: [], blockedBy: JSON_NULL, readiness: JSON_NULL };
107
+ /**
108
+ 前提の行と JSON。Readiness の行は text が渡されたときだけ足す(Epic と Tracker は判定が無い)
109
+ */
110
+ function readinessView(source, readiness, text) {
111
+ const home = source.ref.repository;
112
+ const entries = source.prerequisites.map((prerequisite) => {
113
+ const { issue, wait, reason } = prerequisite;
114
+ const state = issue.state === 'open' ? 'OPEN' : 'CLOSED';
115
+ return {
116
+ label: displayReference(issue.ref, home),
117
+ title: source.titles.get(issueReferenceKey(issue.ref)) ?? '',
118
+ state,
119
+ status: describePrerequisiteState(prerequisite),
120
+ wait,
121
+ reason,
122
+ ref: issue.ref,
123
+ };
124
+ });
125
+ const lines = entries.length === 0
126
+ ? []
127
+ : [`**Blocked by:** ${entries.map(entry => `${entry.label} ${entry.title} (${entry.state}, ${entry.status})`).join(', ')}`, ...text === undefined ? [] : [`**Readiness:** ${text}`]];
128
+ return {
129
+ lines,
130
+ blockedBy: entries.map(entry => ({ number: entry.ref.number, repository: repositoryFullName(entry.ref.repository), state: entry.state, wait: entry.wait, reason: entry.reason ?? JSON_NULL })),
131
+ readiness: readiness === undefined || text === undefined ? JSON_NULL : readinessJson(readiness, text),
132
+ };
133
+ }
134
+ /**
135
+ --json の標準出力と MCP の data の中身。キーを並べた順が --json の出力の順になる
136
+ */
137
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- zod の入れ子の型
138
+ function issueShowJson(issue, owner, repository, view) {
139
+ return {
140
+ number: issue.number,
141
+ state: issue.state,
142
+ title: issue.title,
143
+ body: issue.body,
144
+ comments: { total_count: issue.comments.total_count, nodes: [...issue.comments.nodes] },
145
+ parent: issue.parent,
146
+ sub_issues: [...issue.sub_issues],
147
+ linked_branches: [...issue.linked_branches],
148
+ linked_prs: [...issue.linked_prs],
149
+ owner,
150
+ repo: repository,
151
+ blockedBy: view.blockedBy === JSON_NULL ? JSON_NULL : [...view.blockedBy],
152
+ readiness: view.readiness,
153
+ };
154
+ }
155
+ function judgedView(judged) {
156
+ const { readiness } = judged;
157
+ return readinessView(judged, readiness, readiness === undefined ? undefined : describeReadiness(readiness, judged.prerequisites, judged.ref.repository));
158
+ }
159
+ function warnAboutSections(out, source) {
160
+ const home = source.ref.repository;
161
+ const self = displayReference(source.ref, home);
162
+ for (const mismatch of source.mismatches) {
163
+ out.warning(`Waits for merge of ${self} lists ${displayReference(mismatch.ref, home)}, which is not a blocked-by of it`);
164
+ }
165
+ if (source.malformedReason !== undefined)
166
+ out.warning(`Waits for merge of ${self} is malformed: ${source.malformedReason}`);
167
+ }
168
+ // 前提が無いと分かっている Issue の判定。API は呼ばない。Epic と Tracker は判定を出さない
169
+ async function readWithoutPrerequisites(client, config, issue, reference) {
170
+ const isGrouping = issue.sub_issues.length > 0 || issue.title.startsWith(TRACKER_TITLE_PREFIX);
171
+ const target = { ref: reference, state: issue.state.toLowerCase() === 'open' ? 'open' : 'closed', column: undefined, label: undefined, kind: isGrouping ? 'epic' : 'task', branches: issue.linked_branches, pullRequests: [] };
172
+ const result = await judgeSnapshot(client, snapshotWithoutPrerequisites(config, { title: issue.title, target, parent: undefined }), createReadinessCache());
173
+ if (result.kind === 'unreadable')
174
+ throw new Error('unreachable: a snapshot without prerequisites is always judged');
175
+ return result;
176
+ }
177
+ // 判定が読めなくても、今までの出力は止めない
178
+ async function readView(out, client, config, issue, reference) {
179
+ const label = displayReference(reference, reference.repository);
180
+ try {
181
+ const result = issue.blockedByCount === 0
182
+ ? await readWithoutPrerequisites(client, config, issue, reference)
183
+ : await readIssueReadiness(client, config, reference, createReadinessCache(), undefined, blockedByReadCount(issue.blockedByCount));
184
+ if (result.kind === 'unreadable') {
185
+ const { snapshot } = result;
186
+ if (snapshot === undefined) {
187
+ out.warning(`could not read blocked-by of ${label}: ${result.reason}`);
188
+ return UNREAD;
189
+ }
190
+ out.warning(`could not judge readiness of ${label}: ${result.reason}`);
191
+ warnAboutSections(out, snapshot);
192
+ return readinessView(snapshot, undefined, describeUnknown(result.reason));
193
+ }
194
+ warnAboutSections(out, result);
195
+ return judgedView(result);
196
+ }
197
+ catch (error) {
198
+ if (!(error instanceof DependenciesUnsupportedError))
199
+ throw error;
200
+ out.warning(`could not read blocked-by of ${label}: ${error.message}`);
201
+ return UNREAD;
202
+ }
203
+ }
204
+ const ISSUE_SHOW = defineCommand({
205
+ path: ['issue', 'show'],
206
+ description: 'Fetch Issue details efficiently (GraphQL, only the needed fields)',
207
+ input: z.object({
208
+ issue_ref: z.string().describe(ISSUE_REF_DESCRIPTION),
209
+ json: z.boolean().default(false).describe('Output as JSON'),
210
+ 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)'),
211
+ }),
212
+ output: ISSUE_SHOW_OUTPUT,
213
+ positional: ['issue_ref'],
214
+ shortFlags: { json: '-j', comment_limit: '-c' },
215
+ interactive: false,
216
+ run: async (input, io) => {
217
+ const output = createOutput(false, io);
218
+ return await runWithExit(async () => {
219
+ const config = requireActiveConfigPlain(output);
220
+ const { owner, repository, number } = parseIssueReferenceOrExit(output, input.repo, input.issue_ref);
221
+ let issue;
222
+ const client = createGitHubClient(output, config.host);
223
+ try {
224
+ issue = await client.getIssueSlim(owner, repository, number, input.comment_limit);
225
+ }
226
+ catch (error) {
227
+ if (!(error instanceof GitHubAPIError))
228
+ throw error;
229
+ return stopWith(output, `could not read Issue ${issuePath(owner, repository, number)}: ${error.message}`, kindOfFailure(error));
230
+ }
231
+ const view = await readView(output, client, config, issue, createIssueReference(createRepositoryReference(owner, repository), number));
232
+ const json = issueShowJson(issue, owner, repository, view);
233
+ output.result(json);
234
+ output.data(input.json ? JSON.stringify(json, undefined, 2) : formatIssueMarkdown(issue, owner, repository, view.lines));
235
+ });
236
+ },
237
+ });
238
+ export const ISSUE_SHOW_COMMANDS = [ISSUE_SHOW];
239
+ //# sourceMappingURL=issue-show.js.map
@@ -1,4 +1,3 @@
1
1
  import type { CommandDefinition } from './command-definition.js';
2
- export declare const ISSUE_BOARD_COMMANDS: readonly CommandDefinition[];
3
2
  export declare const ISSUE_COMMANDS: readonly CommandDefinition[];
4
3
  //# sourceMappingURL=issue.d.ts.map
@@ -1,15 +1,13 @@
1
1
  import { ISSUE_COMMENT_COMMANDS } from './issue-comment.js';
2
2
  import { ISSUE_CREATE_COMMANDS } from './issue-create.js';
3
- import { ISSUE_QUICK_COMMANDS } from './issue-quick.js';
4
- import { ISSUE_PROJECT_COMMANDS } from './issue-project.js';
5
- import { ISSUE_READ_COMMANDS } from './issue-read.js';
6
- // 並びは Python の登録順(help の一覧に出る順)にそろえる
7
- export const ISSUE_BOARD_COMMANDS = ISSUE_PROJECT_COMMANDS.filter(command => command.path.length === 1);
3
+ import { ISSUE_DEPENDENCY_COMMANDS } from './issue-dependency.js';
4
+ import { ISSUE_REOPEN_COMMANDS } from './issue-reopen.js';
5
+ import { ISSUE_SHOW_COMMANDS } from './issue-show.js';
8
6
  export const ISSUE_COMMANDS = [
9
7
  ...ISSUE_CREATE_COMMANDS,
10
- ...ISSUE_QUICK_COMMANDS,
11
- ...ISSUE_READ_COMMANDS,
8
+ ...ISSUE_SHOW_COMMANDS,
12
9
  ...ISSUE_COMMENT_COMMANDS,
13
- ...ISSUE_PROJECT_COMMANDS.filter(command => command.path.length !== 1),
10
+ ...ISSUE_DEPENDENCY_COMMANDS,
11
+ ...ISSUE_REOPEN_COMMANDS,
14
12
  ];
15
13
  //# sourceMappingURL=issue.js.map
@@ -6,4 +6,37 @@ export declare function flagOf(name: string): string;
6
6
  文字列を名前の順(コードユニットの順)に並べる比較関数
7
7
  */
8
8
  export declare function byName(left: string, right: string): number;
9
+ /**
10
+ コマンド名の語と、その意味
11
+ */
12
+ export interface CommandWord {
13
+ readonly name: string;
14
+ readonly meaning: string;
15
+ readonly readOnly?: true;
16
+ }
17
+ /**
18
+ グループの語。help は、グループの一覧と `pecot <グループ> --help` に help の文を出す
19
+ */
20
+ export interface CommandGroup extends CommandWord {
21
+ readonly help: string;
22
+ }
23
+ /**
24
+ コマンド名の 1 語目に使うグループ。利用者が操作する対象で、help の一覧はこの順に並ぶ
25
+ */
26
+ export declare const COMMAND_GROUPS: readonly CommandGroup[];
27
+ /**
28
+ コマンド名の 2 語目に使う動詞の語彙。1 語に 1 つの意味を決める
29
+ */
30
+ export declare const COMMAND_VERBS: readonly CommandWord[];
31
+ /**
32
+ コマンド名の決まりに合わない path と、その理由
33
+ */
34
+ export interface CommandNameViolation {
35
+ readonly path: string;
36
+ readonly reason: string;
37
+ }
38
+ /**
39
+ コマンド名の決まり(`<グループ> <動詞>` の 2 語で、1 語目が COMMAND_GROUPS、2 語目が COMMAND_VERBS にある)に合わない path を、渡された順で返す。全部が合えば空
40
+ */
41
+ export declare function commandNameViolations(paths: readonly (readonly string[])[]): readonly CommandNameViolation[];
9
42
  //# sourceMappingURL=names.d.ts.map