@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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +27 -22
- package/cli/dist/cli.js +6 -1
- package/cli/dist/commands/board-add.d.ts +3 -0
- package/cli/dist/commands/board-add.js +69 -0
- package/cli/dist/commands/board-judgment.d.ts +69 -0
- package/cli/dist/commands/board-judgment.js +150 -0
- package/cli/dist/commands/board-move.d.ts +3 -0
- package/cli/dist/commands/board-move.js +65 -0
- package/cli/dist/commands/board-readiness.d.ts +34 -0
- package/cli/dist/commands/board-readiness.js +108 -0
- package/cli/dist/commands/board-show.d.ts +3 -0
- package/cli/dist/commands/board-show.js +75 -0
- package/cli/dist/commands/board-sync.d.ts +3 -0
- package/cli/dist/commands/board-sync.js +120 -0
- package/cli/dist/commands/board-view.d.ts +151 -0
- package/cli/dist/commands/board-view.js +293 -0
- package/cli/dist/commands/board.d.ts +3 -0
- package/cli/dist/commands/board.js +12 -0
- package/cli/dist/commands/branch.d.ts +3 -0
- package/cli/dist/commands/branch.js +111 -0
- package/cli/dist/commands/command-binding.js +4 -0
- package/cli/dist/commands/command-definition.d.ts +39 -8
- package/cli/dist/commands/command-definition.js +20 -7
- package/cli/dist/commands/command-help.js +2 -2
- package/cli/dist/commands/command-hint.d.ts +5 -0
- package/cli/dist/commands/command-hint.js +13 -0
- package/cli/dist/commands/command-stop.d.ts +5 -3
- package/cli/dist/commands/command-stop.js +7 -6
- package/cli/dist/commands/failure-kind.d.ts +3 -0
- package/cli/dist/commands/failure-kind.js +35 -0
- package/cli/dist/commands/failure.d.ts +6 -0
- package/cli/dist/commands/failure.js +29 -3
- package/cli/dist/commands/github-client.d.ts +6 -2
- package/cli/dist/commands/github-client.js +13 -3
- package/cli/dist/commands/help.js +8 -13
- package/cli/dist/commands/issue-board.d.ts +61 -0
- package/cli/dist/commands/issue-board.js +85 -1
- package/cli/dist/commands/issue-comment.js +66 -30
- package/cli/dist/commands/issue-create.js +632 -92
- package/cli/dist/commands/issue-dependency.d.ts +3 -0
- package/cli/dist/commands/issue-dependency.js +310 -0
- package/cli/dist/commands/issue-readiness.d.ts +122 -0
- package/cli/dist/commands/issue-readiness.js +253 -0
- package/cli/dist/commands/issue-reopen.d.ts +3 -0
- package/cli/dist/commands/issue-reopen.js +130 -0
- package/cli/dist/commands/issue-shared.d.ts +33 -20
- package/cli/dist/commands/issue-shared.js +84 -76
- package/cli/dist/commands/issue-show.d.ts +3 -0
- package/cli/dist/commands/issue-show.js +239 -0
- package/cli/dist/commands/issue.d.ts +0 -1
- package/cli/dist/commands/issue.js +6 -8
- package/cli/dist/commands/names.d.ts +33 -0
- package/cli/dist/commands/names.js +63 -0
- package/cli/dist/commands/output.d.ts +32 -4
- package/cli/dist/commands/output.js +28 -8
- 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 +59 -0
- package/cli/dist/commands/pr-waiting.js +143 -0
- package/cli/dist/commands/pr.d.ts +23 -0
- package/cli/dist/commands/pr.js +378 -366
- package/cli/dist/commands/project-sync.d.ts +12 -3
- package/cli/dist/commands/project-sync.js +23 -13
- package/cli/dist/commands/project.d.ts +3 -2
- package/cli/dist/commands/project.js +371 -177
- package/cli/dist/commands/registry.js +15 -10
- package/cli/dist/commands/release.d.ts +2 -2
- package/cli/dist/commands/release.js +118 -130
- package/cli/dist/commands/renamed-commands.d.ts +26 -0
- package/cli/dist/commands/renamed-commands.js +53 -0
- package/cli/dist/commands/repository-match.js +9 -3
- package/cli/dist/commands/session-finish.d.ts +3 -0
- package/cli/dist/commands/session-finish.js +383 -0
- package/cli/dist/commands/session-start.d.ts +3 -0
- package/cli/dist/commands/session-start.js +252 -0
- package/cli/dist/commands/session.d.ts +3 -0
- package/cli/dist/commands/session.js +186 -32
- package/cli/dist/commands/tracker-sync-dependabot.d.ts +7 -0
- package/cli/dist/commands/{dependabot.js → tracker-sync-dependabot.js} +76 -68
- package/cli/dist/commands/tracker-sync-security.d.ts +7 -0
- package/cli/dist/commands/{security.js → tracker-sync-security.js} +71 -64
- package/cli/dist/commands/tracker-sync.d.ts +37 -0
- package/cli/dist/commands/tracker-sync.js +18 -6
- package/cli/dist/commands/tracker.d.ts +3 -0
- package/cli/dist/commands/tracker.js +20 -0
- package/cli/dist/commands/usage-error.d.ts +4 -0
- package/cli/dist/commands/usage-error.js +6 -0
- package/cli/dist/commands/work-target.d.ts +20 -3
- package/cli/dist/commands/work-target.js +49 -6
- package/cli/dist/commands/worktree.js +103 -33
- package/cli/dist/domain/batch-plan.d.ts +73 -0
- package/cli/dist/domain/batch-plan.js +114 -0
- package/cli/dist/domain/blocked-by-change.d.ts +99 -0
- package/cli/dist/domain/blocked-by-change.js +101 -0
- package/cli/dist/domain/board-move.d.ts +90 -0
- package/cli/dist/domain/board-move.js +92 -0
- package/cli/dist/domain/branch-name.js +1 -1
- package/cli/dist/domain/command-hint.d.ts +85 -0
- package/cli/dist/domain/command-hint.js +148 -0
- package/cli/dist/domain/config.d.ts +4 -0
- package/cli/dist/domain/config.js +11 -1
- package/cli/dist/domain/dependabot.js +1 -1
- package/cli/dist/domain/errors.d.ts +5 -0
- package/cli/dist/domain/errors.js +5 -0
- package/cli/dist/domain/format.d.ts +51 -4
- package/cli/dist/domain/format.js +72 -6
- package/cli/dist/domain/frontmatter.d.ts +18 -3
- package/cli/dist/domain/frontmatter.js +38 -12
- package/cli/dist/domain/issue-order.d.ts +55 -0
- package/cli/dist/domain/issue-order.js +65 -0
- package/cli/dist/domain/issue-readout.d.ts +36 -4
- package/cli/dist/domain/pull-request.d.ts +71 -4
- package/cli/dist/domain/pull-request.js +59 -10
- package/cli/dist/domain/readiness.d.ts +44 -0
- package/cli/dist/domain/readiness.js +153 -5
- package/cli/dist/domain/reference-parser.d.ts +3 -1
- package/cli/dist/domain/reference-parser.js +6 -2
- package/cli/dist/domain/release.d.ts +7 -3
- package/cli/dist/domain/release.js +5 -12
- package/cli/dist/domain/repository-policy.d.ts +9 -3
- package/cli/dist/domain/repository-policy.js +8 -7
- package/cli/dist/domain/repository-resolver.js +4 -1
- package/cli/dist/domain/restack.d.ts +62 -0
- package/cli/dist/domain/restack.js +53 -0
- package/cli/dist/domain/security-alerts.js +1 -1
- package/cli/dist/domain/state.d.ts +69 -0
- package/cli/dist/domain/state.js +67 -1
- package/cli/dist/domain/work-start.d.ts +30 -0
- package/cli/dist/domain/work-start.js +42 -0
- package/cli/dist/infra/authored-notes.d.ts +1 -1
- package/cli/dist/infra/authored-notes.js +10 -4
- package/cli/dist/infra/config-store.d.ts +4 -0
- package/cli/dist/infra/config-store.js +13 -0
- package/cli/dist/infra/git.d.ts +76 -0
- package/cli/dist/infra/git.js +123 -1
- package/cli/dist/infra/github/client.d.ts +5 -0
- package/cli/dist/infra/github/client.js +10 -7
- package/cli/dist/infra/github/errors.d.ts +18 -0
- package/cli/dist/infra/github/errors.js +22 -0
- package/cli/dist/infra/github/issues.d.ts +39 -3
- package/cli/dist/infra/github/issues.js +178 -23
- package/cli/dist/infra/github/projects.d.ts +35 -0
- package/cli/dist/infra/github/projects.js +89 -8
- package/cli/dist/infra/github/pulls.d.ts +105 -2
- package/cli/dist/infra/github/pulls.js +172 -5
- package/cli/dist/infra/github/queries.d.ts +15 -4
- package/cli/dist/infra/github/queries.js +203 -40
- package/cli/dist/infra/github/readout.d.ts +5 -1
- package/cli/dist/infra/github/readout.js +11 -33
- package/cli/dist/infra/github/repos.d.ts +18 -0
- package/cli/dist/infra/github/repos.js +31 -0
- package/cli/dist/infra/nx-scope.d.ts +1 -1
- package/cli/dist/infra/nx-scope.js +1 -1
- package/cli/dist/infra/state-store.d.ts +10 -1
- package/cli/dist/infra/state-store.js +14 -2
- package/cli/dist/infra/worktree-links.d.ts +3 -0
- package/cli/dist/infra/worktree-links.js +8 -1
- package/cli/dist/infra/worktree.d.ts +12 -1
- package/cli/dist/infra/worktree.js +40 -23
- package/cli/dist/mcp/result.d.ts +82 -7
- package/cli/dist/mcp/result.js +139 -19
- package/cli/dist/mcp/server.d.ts +2 -2
- package/cli/dist/mcp/server.js +57 -10
- package/cli/templates/comment/plan.md +14 -0
- package/cli/templates/comment/review-findings.md +3 -2
- package/cli/templates/issue/bug.md +13 -4
- package/cli/templates/issue/task-implement.md +13 -6
- package/cli/templates/issue/task.md +13 -4
- package/cli/templates/workflow/pecot-board-sync.yml +84 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/cli/dist/commands/dependabot.d.ts +0 -3
- package/cli/dist/commands/issue-project.d.ts +0 -3
- package/cli/dist/commands/issue-project.js +0 -176
- package/cli/dist/commands/issue-quick.d.ts +0 -3
- package/cli/dist/commands/issue-quick.js +0 -126
- package/cli/dist/commands/issue-read.d.ts +0 -3
- package/cli/dist/commands/issue-read.js +0 -80
- package/cli/dist/commands/project-info.d.ts +0 -48
- package/cli/dist/commands/project-info.js +0 -181
- package/cli/dist/commands/repository.d.ts +0 -5
- package/cli/dist/commands/repository.js +0 -265
- package/cli/dist/commands/security.d.ts +0 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// issue block / unblock の判断(付ける・変える・何もしない・外す)と、輪の探索。I/O は引数の関数で受ける。
|
|
2
|
+
import { InvalidValueError } from './errors.js';
|
|
3
|
+
import { readWaitsForMerge, removeWaitsForMerge, upsertWaitsForMerge } from './prerequisites.js';
|
|
4
|
+
import { displayReference } from './readiness.js';
|
|
5
|
+
import { issueReferenceKey } from './reference-parser.js';
|
|
6
|
+
function nextBody(input, hasLine, currentReason) {
|
|
7
|
+
const { body, home, by, wait, reason = '' } = input;
|
|
8
|
+
if (wait === 'stack')
|
|
9
|
+
return hasLine ? removeWaitsForMerge(body, home, by) : body;
|
|
10
|
+
const trimmed = reason.trim();
|
|
11
|
+
if (trimmed === '')
|
|
12
|
+
throw new InvalidValueError('reason is required with wait: merge');
|
|
13
|
+
return hasLine && currentReason === trimmed ? body : upsertWaitsForMerge(body, home, by, trimmed);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
付ける・種類を変える・何もしないのどれにするかと、書く本文を決める。
|
|
17
|
+
節が読めないときは本文を書き換えられないので malformed を返す
|
|
18
|
+
*/
|
|
19
|
+
export function decideBlock(input) {
|
|
20
|
+
const section = readWaitsForMerge(input.body, input.home);
|
|
21
|
+
if (section.kind === 'malformed')
|
|
22
|
+
return { kind: 'malformed', reason: section.reason };
|
|
23
|
+
const key = issueReferenceKey(input.by);
|
|
24
|
+
const line = section.kind === 'ok' ? section.lines.find(candidate => issueReferenceKey(candidate.ref) === key) : undefined;
|
|
25
|
+
const body = nextBody(input, line !== undefined, line?.reason);
|
|
26
|
+
if (!input.isLinked)
|
|
27
|
+
return { kind: 'add', body };
|
|
28
|
+
return body === input.body ? { kind: 'unchanged' } : { kind: 'update', body };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
外すか何もしないかを決める。付いていなければ、節に古い行が残っていても本文は書き換えない
|
|
32
|
+
*/
|
|
33
|
+
export function decideUnblock(input) {
|
|
34
|
+
if (!input.isLinked)
|
|
35
|
+
return { kind: 'unchanged' };
|
|
36
|
+
const section = readWaitsForMerge(input.body, input.home);
|
|
37
|
+
return section.kind === 'malformed'
|
|
38
|
+
? { kind: 'remove', body: input.body, malformedReason: section.reason }
|
|
39
|
+
: { kind: 'remove', body: removeWaitsForMerge(input.body, input.home, input.by), malformedReason: undefined };
|
|
40
|
+
}
|
|
41
|
+
function pathTo(visited, key) {
|
|
42
|
+
const chain = [];
|
|
43
|
+
for (let current = visited.get(key); current !== undefined; current = current.parentKey === undefined ? undefined : visited.get(current.parentKey)) {
|
|
44
|
+
chain.unshift(current.ref);
|
|
45
|
+
}
|
|
46
|
+
return chain;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
by から blocked by を 1 段ずつたどり、target に戻れば輪として道(target → by → … → target)を返す。
|
|
50
|
+
読めない Issue・件数の不足・上限は unverifiable。GitHub は 3 つ以上の輪を通すので、確かめずに付けない
|
|
51
|
+
*/
|
|
52
|
+
export async function searchCycle(input) {
|
|
53
|
+
const { target, by, read, limit } = input;
|
|
54
|
+
const targetKey = issueReferenceKey(target);
|
|
55
|
+
const byKey = issueReferenceKey(by);
|
|
56
|
+
const visited = new Map([[byKey, { ref: by, parentKey: undefined }]]);
|
|
57
|
+
let frontier = [{ id: input.byId, ref: by }];
|
|
58
|
+
while (frontier.length > 0) {
|
|
59
|
+
const results = await read(frontier.map(({ id }) => id));
|
|
60
|
+
const next = [];
|
|
61
|
+
for (const node of frontier) {
|
|
62
|
+
const result = results.get(node.id);
|
|
63
|
+
const label = displayReference(node.ref, target.repository);
|
|
64
|
+
if (result === undefined || result.kind === 'read-failed') {
|
|
65
|
+
return { kind: 'unverifiable', reason: `could not read blocked-by of ${label}: ${result?.reason ?? 'no result'}` };
|
|
66
|
+
}
|
|
67
|
+
if (result.total > result.issues.length) {
|
|
68
|
+
return { kind: 'unverifiable', reason: `blocked-by of ${label} has ${String(result.total)} issues, more than can be read` };
|
|
69
|
+
}
|
|
70
|
+
const nodeKey = issueReferenceKey(node.ref);
|
|
71
|
+
for (const issue of result.issues) {
|
|
72
|
+
const reference = { repository: issue.repository, number: issue.number };
|
|
73
|
+
const key = issueReferenceKey(reference);
|
|
74
|
+
if (key === targetKey)
|
|
75
|
+
return { kind: 'cycle', path: [target, ...pathTo(visited, nodeKey), target] };
|
|
76
|
+
if (visited.has(key))
|
|
77
|
+
continue;
|
|
78
|
+
if (visited.size >= limit)
|
|
79
|
+
return { kind: 'unverifiable', reason: `more than ${String(limit)} issues in the blocked-by chain` };
|
|
80
|
+
visited.set(key, { ref: reference, parentKey: nodeKey });
|
|
81
|
+
next.push({ id: issue.id, ref: reference });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
frontier = next;
|
|
85
|
+
}
|
|
86
|
+
return { kind: 'none' };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
書いた後の読み直しが、書いた内容と一致するか。GitHub は書いた直後の読み取りの一致を保証しない
|
|
90
|
+
*/
|
|
91
|
+
export function hasExpectedPrerequisites(prerequisites, expected) {
|
|
92
|
+
const keys = new Set(prerequisites.map(({ issue }) => issueReferenceKey(issue.ref)));
|
|
93
|
+
if (keys.size !== expected.keys.size || [...keys].some(key => !expected.keys.has(key)))
|
|
94
|
+
return false;
|
|
95
|
+
if (expected.wait === undefined)
|
|
96
|
+
return true;
|
|
97
|
+
const byKey = issueReferenceKey(expected.by);
|
|
98
|
+
const found = prerequisites.find(({ issue }) => issueReferenceKey(issue.ref) === byKey);
|
|
99
|
+
return found?.wait === expected.wait.wait && (found.wait === 'stack' || found.reason === expected.wait.reason);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=blocked-by-change.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Readiness } from './readiness.js';
|
|
2
|
+
import type { IssueReference } from './reference-parser.js';
|
|
3
|
+
export type MovableColumn = 'Ready' | 'Blocked';
|
|
4
|
+
export type LabelValue = 'Needs Attention' | 'Todo';
|
|
5
|
+
export type MissingValue = 'Blocked' | 'Needs Attention' | 'Todo';
|
|
6
|
+
/**
|
|
7
|
+
進行の欄(列)の表示名と設定のキー(`workflow.options.<key>`)の対応
|
|
8
|
+
*/
|
|
9
|
+
export declare const COLUMN_CONFIG_KEYS: {
|
|
10
|
+
Blocked: string;
|
|
11
|
+
'In Review': string;
|
|
12
|
+
Ready: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
札(Status)の表示名と設定のキー(`status.options.<key>`)の対応
|
|
16
|
+
*/
|
|
17
|
+
export declare const LABEL_CONFIG_KEYS: {
|
|
18
|
+
'Needs Attention': string;
|
|
19
|
+
Todo: string;
|
|
20
|
+
};
|
|
21
|
+
export interface BoardMoveInput {
|
|
22
|
+
/**
|
|
23
|
+
open で、着手の対象(kind が task)か。偽なら何も返さない
|
|
24
|
+
*/
|
|
25
|
+
readonly eligible: boolean;
|
|
26
|
+
/**
|
|
27
|
+
今の列の表示名。ボードに無ければ undefined
|
|
28
|
+
*/
|
|
29
|
+
readonly column: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
今の札(Status の表示名)。無ければ undefined
|
|
32
|
+
*/
|
|
33
|
+
readonly label: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
着手の跡(ブランチか PR)がある
|
|
36
|
+
*/
|
|
37
|
+
readonly hasStarted: boolean;
|
|
38
|
+
/**
|
|
39
|
+
前提を 1 つ以上持つ
|
|
40
|
+
*/
|
|
41
|
+
readonly hasPrerequisites: boolean;
|
|
42
|
+
/**
|
|
43
|
+
着手の可否の判定。読めないときは undefined(何も返さない)
|
|
44
|
+
*/
|
|
45
|
+
readonly readiness: Readiness | undefined;
|
|
46
|
+
/**
|
|
47
|
+
今の札を自動処理(spec 023)が書いた
|
|
48
|
+
*/
|
|
49
|
+
readonly labelWrittenByAutomation: boolean;
|
|
50
|
+
/**
|
|
51
|
+
ボードにある値
|
|
52
|
+
*/
|
|
53
|
+
readonly available: {
|
|
54
|
+
readonly blocked: boolean;
|
|
55
|
+
readonly needsAttention: boolean;
|
|
56
|
+
readonly todo: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface BoardMove {
|
|
60
|
+
readonly column?: {
|
|
61
|
+
readonly from: string;
|
|
62
|
+
readonly to: MovableColumn;
|
|
63
|
+
/**
|
|
64
|
+
動かす理由の判定。文は describeReadiness で作る
|
|
65
|
+
*/
|
|
66
|
+
readonly reason: Readiness;
|
|
67
|
+
};
|
|
68
|
+
readonly label?: LabelValue;
|
|
69
|
+
/**
|
|
70
|
+
着手の跡があるのに判定が blocked の食い違い
|
|
71
|
+
*/
|
|
72
|
+
readonly conflict?: {
|
|
73
|
+
readonly column: string;
|
|
74
|
+
/**
|
|
75
|
+
blocked の理由に当たった Issue
|
|
76
|
+
*/
|
|
77
|
+
readonly issues: readonly IssueReference[];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
動かす先の値がボードに無く、動かせなかったもの
|
|
81
|
+
*/
|
|
82
|
+
readonly missing: readonly MissingValue[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
data-model.md の 6 の 2 つの表を当てはめる。
|
|
86
|
+
対象でない・ボードに無い・判定が読めないときは undefined を返す。
|
|
87
|
+
動かす先の値がボードに無いときは動かさず、missing に入れる
|
|
88
|
+
*/
|
|
89
|
+
export declare function decideBoardMove(input: BoardMoveInput): BoardMove | undefined;
|
|
90
|
+
//# sourceMappingURL=board-move.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// 列と札を直す判断(specs/024 の data-model.md の 6)。I/O を持たない純関数だけを置く。
|
|
2
|
+
import { NEEDS_ATTENTION_LABEL } from './readiness.js';
|
|
3
|
+
/**
|
|
4
|
+
進行の欄(列)の表示名と設定のキー(`workflow.options.<key>`)の対応
|
|
5
|
+
*/
|
|
6
|
+
export const COLUMN_CONFIG_KEYS = {
|
|
7
|
+
'Blocked': 'blocked',
|
|
8
|
+
'In Review': 'in_review',
|
|
9
|
+
'Ready': 'ready',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
札(Status)の表示名と設定のキー(`status.options.<key>`)の対応
|
|
13
|
+
*/
|
|
14
|
+
export const LABEL_CONFIG_KEYS = {
|
|
15
|
+
'Needs Attention': 'needs_attention',
|
|
16
|
+
'Todo': 'todo',
|
|
17
|
+
};
|
|
18
|
+
// Backlog・Pending・Archived は人が置いた列なので、動かさず札も書かない
|
|
19
|
+
const RESETTABLE_COLUMNS = new Set(['Ready', 'Active', 'In Review']);
|
|
20
|
+
const WORKING_COLUMNS = new Set(['Ready', 'Blocked', 'Active', 'In Review']);
|
|
21
|
+
function blockingIssues(readiness) {
|
|
22
|
+
const { reason } = readiness;
|
|
23
|
+
if (reason === undefined)
|
|
24
|
+
return [];
|
|
25
|
+
switch (reason.code) {
|
|
26
|
+
case 'unreadable':
|
|
27
|
+
case 'cycle': {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
case 'closed-unmerged':
|
|
31
|
+
case 'other-repository':
|
|
32
|
+
case 'diverged': {
|
|
33
|
+
return reason.issues;
|
|
34
|
+
}
|
|
35
|
+
case 'waits-merge':
|
|
36
|
+
case 'not-in-review': {
|
|
37
|
+
return reason.issues.map(({ issue }) => issue);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const BACK_TO_READY_COLUMNS = new Set(['Blocked', 'Active', 'In Review']);
|
|
42
|
+
// 着手の跡が無い Issue の列の行き先。動かさないときは undefined
|
|
43
|
+
function targetColumn(column, kind) {
|
|
44
|
+
if (kind === 'blocked')
|
|
45
|
+
return RESETTABLE_COLUMNS.has(column) ? 'Blocked' : undefined;
|
|
46
|
+
return BACK_TO_READY_COLUMNS.has(column) ? 'Ready' : undefined;
|
|
47
|
+
}
|
|
48
|
+
function targetLabel(input, readiness) {
|
|
49
|
+
if (readiness.needsReview)
|
|
50
|
+
return input.label === NEEDS_ATTENTION_LABEL ? undefined : 'Needs Attention';
|
|
51
|
+
const isOwnLabel = input.label === NEEDS_ATTENTION_LABEL && !input.labelWrittenByAutomation;
|
|
52
|
+
return isOwnLabel && input.hasPrerequisites ? 'Todo' : undefined;
|
|
53
|
+
}
|
|
54
|
+
// 人が置いた列でも、判定が読めないときでもない
|
|
55
|
+
function isDecidable(column, readiness) {
|
|
56
|
+
return WORKING_COLUMNS.has(column) && readiness.reason?.code !== 'unreadable';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
data-model.md の 6 の 2 つの表を当てはめる。
|
|
60
|
+
対象でない・ボードに無い・判定が読めないときは undefined を返す。
|
|
61
|
+
動かす先の値がボードに無いときは動かさず、missing に入れる
|
|
62
|
+
*/
|
|
63
|
+
export function decideBoardMove(input) {
|
|
64
|
+
const { column, readiness, eligible } = input;
|
|
65
|
+
if (!eligible || column === undefined || readiness === undefined || !isDecidable(column, readiness))
|
|
66
|
+
return undefined;
|
|
67
|
+
const missing = [];
|
|
68
|
+
let move = { missing };
|
|
69
|
+
if (input.hasStarted) {
|
|
70
|
+
// 着手の跡がある Issue は進めているセッションのものなので、列と札を変えない(FR-084)
|
|
71
|
+
if (readiness.kind === 'blocked' && RESETTABLE_COLUMNS.has(column)) {
|
|
72
|
+
move = { ...move, conflict: { column, issues: blockingIssues(readiness) } };
|
|
73
|
+
}
|
|
74
|
+
return move.conflict === undefined ? undefined : move;
|
|
75
|
+
}
|
|
76
|
+
const to = targetColumn(column, readiness.kind);
|
|
77
|
+
if (to !== undefined) {
|
|
78
|
+
if (to === 'Blocked' && !input.available.blocked)
|
|
79
|
+
missing.push('Blocked');
|
|
80
|
+
else
|
|
81
|
+
move = { ...move, column: { from: column, to, reason: readiness } };
|
|
82
|
+
}
|
|
83
|
+
const label = targetLabel(input, readiness);
|
|
84
|
+
if (label === 'Needs Attention' && !input.available.needsAttention)
|
|
85
|
+
missing.push('Needs Attention');
|
|
86
|
+
else if (label === 'Todo' && !input.available.todo)
|
|
87
|
+
missing.push('Todo');
|
|
88
|
+
else if (label !== undefined)
|
|
89
|
+
move = { ...move, label };
|
|
90
|
+
return move.column === undefined && move.label === undefined && missing.length === 0 ? undefined : move;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=board-move.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
案内の出し先。cli は `pecot ...` の行、mcp はツール名と入力
|
|
3
|
+
*/
|
|
4
|
+
export type HintSurface = 'cli' | 'mcp';
|
|
5
|
+
/**
|
|
6
|
+
利用者が埋める値。CLI でも MCP でも `<NAME>` と出す
|
|
7
|
+
*/
|
|
8
|
+
export interface HintPlaceholder {
|
|
9
|
+
readonly placeholder: string;
|
|
10
|
+
}
|
|
11
|
+
export type HintValue = string | number | boolean | HintPlaceholder | readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
コマンド 1 つの案内。input の並びは、位置引数の後ろのオプションの並びになる
|
|
14
|
+
*/
|
|
15
|
+
export interface CommandHint {
|
|
16
|
+
readonly kind: 'command';
|
|
17
|
+
readonly path: readonly string[];
|
|
18
|
+
readonly input: Readonly<Record<string, HintValue>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
入力 1 つだけの案内(`--allow-cross-repo` の形)
|
|
22
|
+
*/
|
|
23
|
+
export interface InputHint {
|
|
24
|
+
readonly kind: 'input';
|
|
25
|
+
readonly path: readonly string[];
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/**
|
|
28
|
+
undefined なら名前だけ(CLI は `--host`、MCP は `host`)
|
|
29
|
+
*/
|
|
30
|
+
readonly value: HintValue | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
グローバルの repo の案内。どのコマンドでも同じ形なので path を持たない
|
|
34
|
+
*/
|
|
35
|
+
export interface GlobalRepositoryHint {
|
|
36
|
+
readonly kind: 'global-repo';
|
|
37
|
+
readonly value: HintValue | undefined;
|
|
38
|
+
}
|
|
39
|
+
export type Hint = CommandHint | InputHint | GlobalRepositoryHint;
|
|
40
|
+
/**
|
|
41
|
+
文字列と案内を並べた文。描くときに案内を出し先の形にする
|
|
42
|
+
*/
|
|
43
|
+
export type HintedText = readonly (string | Hint)[];
|
|
44
|
+
/**
|
|
45
|
+
コマンドの形。案内の検証と、CLI の位置引数の並びに使う
|
|
46
|
+
*/
|
|
47
|
+
export interface HintCommandShape {
|
|
48
|
+
readonly path: readonly string[];
|
|
49
|
+
readonly positional: readonly string[];
|
|
50
|
+
readonly inputs: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
偽なら、入力 repo はグローバルの `--repo` で、CLI ではコマンド名の前に出す
|
|
53
|
+
*/
|
|
54
|
+
readonly hasOwnRepo: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare function registerHintCommands(shapes: readonly HintCommandShape[]): void;
|
|
57
|
+
export declare function commandHint(path: readonly string[], input?: Readonly<Record<string, HintValue>>): CommandHint;
|
|
58
|
+
export declare function inputHint(path: readonly string[], name: string, value?: HintValue): InputHint;
|
|
59
|
+
/**
|
|
60
|
+
入力の名前だけの案内。`--host is required` の `--host`
|
|
61
|
+
*/
|
|
62
|
+
export declare function inputNameHint(path: readonly string[], name: string): InputHint;
|
|
63
|
+
/**
|
|
64
|
+
グローバルの repo の案内。value が無ければ名前だけ(CLI は `--repo`、MCP は `repo`)
|
|
65
|
+
*/
|
|
66
|
+
export declare function globalRepositoryHint(value?: HintValue): GlobalRepositoryHint;
|
|
67
|
+
export declare function placeholder(name: string): HintPlaceholder;
|
|
68
|
+
/**
|
|
69
|
+
タグ付きテンプレートで HintedText を作る。`hinted\`run: ${commandHint(['project', 'init'])}\``
|
|
70
|
+
*/
|
|
71
|
+
export declare function hinted(strings: TemplateStringsArray, ...values: readonly (string | number | Hint)[]): HintedText;
|
|
72
|
+
/**
|
|
73
|
+
HintedText を連結する。区切りは separator
|
|
74
|
+
*/
|
|
75
|
+
export declare function joinHinted(parts: readonly (string | HintedText)[], separator?: string): HintedText;
|
|
76
|
+
/**
|
|
77
|
+
案内 1 つを出し先の形にする。定義に無い path・入力名は TypeError
|
|
78
|
+
*/
|
|
79
|
+
export declare function formatHint(hint: Hint, surface: HintSurface): string;
|
|
80
|
+
export declare function formatHinted(text: string | HintedText, surface: HintSurface): string;
|
|
81
|
+
/**
|
|
82
|
+
例外が持つ案内(hintedText)。最上位はこれを出し先の形で描き直す。無ければ undefined
|
|
83
|
+
*/
|
|
84
|
+
export declare function hintedTextOf(error: unknown): HintedText | undefined;
|
|
85
|
+
//# sourceMappingURL=command-hint.d.ts.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// 出力の文に添える、次に打つコマンドの案内。案内はコマンドの path と入力のデータで持ち、CLI の行か MCP のツールの呼び方にする。
|
|
2
|
+
// コマンドの形(位置引数・入力名)は commands/registry.ts が registerHintCommands で登録する。
|
|
3
|
+
const catalog = new Map();
|
|
4
|
+
export function registerHintCommands(shapes) {
|
|
5
|
+
for (const shape of shapes)
|
|
6
|
+
catalog.set(shape.path.join(' '), shape);
|
|
7
|
+
}
|
|
8
|
+
export function commandHint(path, input = {}) {
|
|
9
|
+
return { kind: 'command', path, input };
|
|
10
|
+
}
|
|
11
|
+
export function inputHint(path, name, value = true) {
|
|
12
|
+
return { kind: 'input', path, name, value };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
入力の名前だけの案内。`--host is required` の `--host`
|
|
16
|
+
*/
|
|
17
|
+
export function inputNameHint(path, name) {
|
|
18
|
+
return { kind: 'input', path, name, value: undefined };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
グローバルの repo の案内。value が無ければ名前だけ(CLI は `--repo`、MCP は `repo`)
|
|
22
|
+
*/
|
|
23
|
+
export function globalRepositoryHint(value) {
|
|
24
|
+
return { kind: 'global-repo', value };
|
|
25
|
+
}
|
|
26
|
+
export function placeholder(name) {
|
|
27
|
+
return { placeholder: name };
|
|
28
|
+
}
|
|
29
|
+
function isHint(value) {
|
|
30
|
+
return typeof value === 'object' && value !== null && 'kind' in value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
タグ付きテンプレートで HintedText を作る。`hinted\`run: ${commandHint(['project', 'init'])}\``
|
|
34
|
+
*/
|
|
35
|
+
export function hinted(strings, ...values) {
|
|
36
|
+
return strings.flatMap((text, index) => {
|
|
37
|
+
const value = values.at(index);
|
|
38
|
+
if (index >= values.length)
|
|
39
|
+
return [text];
|
|
40
|
+
return [text, isHint(value) ? value : String(value)];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
HintedText を連結する。区切りは separator
|
|
45
|
+
*/
|
|
46
|
+
export function joinHinted(parts, separator = '\n') {
|
|
47
|
+
return parts.flatMap((part, index) => [...index === 0 ? [] : [separator], ...typeof part === 'string' ? [part] : part]);
|
|
48
|
+
}
|
|
49
|
+
function shapeOf(path) {
|
|
50
|
+
const shape = catalog.get(path.join(' '));
|
|
51
|
+
if (shape === undefined)
|
|
52
|
+
throw new TypeError(`案内のコマンド '${path.join(' ')}' が定義に無い`);
|
|
53
|
+
return shape;
|
|
54
|
+
}
|
|
55
|
+
function assertInput(shape, name) {
|
|
56
|
+
// 自分の --repo を持たないコマンドの repo は、グローバルの --repo
|
|
57
|
+
if (name === 'repo' && !shape.hasOwnRepo)
|
|
58
|
+
return;
|
|
59
|
+
if (!shape.inputs.includes(name))
|
|
60
|
+
throw new TypeError(`案内の入力 '${name}' が '${shape.path.join(' ')}' の定義に無い`);
|
|
61
|
+
}
|
|
62
|
+
function isList(value) {
|
|
63
|
+
return Array.isArray(value);
|
|
64
|
+
}
|
|
65
|
+
function isPlaceholder(value) {
|
|
66
|
+
return typeof value === 'object' && !isList(value);
|
|
67
|
+
}
|
|
68
|
+
// シェルにそのまま渡せない値は、単一引用符で包む
|
|
69
|
+
function cliValue(value) {
|
|
70
|
+
if (typeof value === 'number')
|
|
71
|
+
return String(value);
|
|
72
|
+
if (typeof value === 'object')
|
|
73
|
+
return `<${value.placeholder}>`;
|
|
74
|
+
return /^[\w./:@=+,-]+$/u.test(value) ? value : `'${value.replaceAll('\'', String.raw `'\''`)}'`;
|
|
75
|
+
}
|
|
76
|
+
function mcpValue(value) {
|
|
77
|
+
if (isPlaceholder(value))
|
|
78
|
+
return `<${value.placeholder}>`;
|
|
79
|
+
return typeof value === 'string' || isList(value) ? JSON.stringify(value) : String(value);
|
|
80
|
+
}
|
|
81
|
+
function flagOf(name) {
|
|
82
|
+
return `--${name.replaceAll('_', '-')}`;
|
|
83
|
+
}
|
|
84
|
+
function cliOption(name, value) {
|
|
85
|
+
const flag = flagOf(name);
|
|
86
|
+
if (typeof value === 'boolean') {
|
|
87
|
+
if (!value)
|
|
88
|
+
throw new TypeError(`案内の入力 '${name}' に false は出せない`);
|
|
89
|
+
return [flag];
|
|
90
|
+
}
|
|
91
|
+
return isList(value) ? value.flatMap((item) => [flag, cliValue(item)]) : [flag, cliValue(value)];
|
|
92
|
+
}
|
|
93
|
+
function cliPositional(value) {
|
|
94
|
+
if (typeof value === 'boolean')
|
|
95
|
+
throw new TypeError('位置引数に真偽値は出せない');
|
|
96
|
+
return isList(value) ? value.map((item) => cliValue(item)) : [cliValue(value)];
|
|
97
|
+
}
|
|
98
|
+
function formatCommand(hint, surface) {
|
|
99
|
+
const shape = shapeOf(hint.path);
|
|
100
|
+
const values = new Map(Object.entries(hint.input));
|
|
101
|
+
const names = Object.keys(hint.input);
|
|
102
|
+
for (const name of names)
|
|
103
|
+
assertInput(shape, name);
|
|
104
|
+
const ordered = [...shape.positional.filter(name => names.includes(name)), ...names.filter(name => !shape.positional.includes(name))];
|
|
105
|
+
const valueOf = (name) => values.get(name) ?? '';
|
|
106
|
+
if (surface === 'mcp') {
|
|
107
|
+
const tool = hint.path.join('_');
|
|
108
|
+
return ordered.length === 0 ? tool : `${tool} with ${ordered.map(name => `${name}: ${mcpValue(valueOf(name))}`).join(', ')}`;
|
|
109
|
+
}
|
|
110
|
+
const globalRepository = !shape.hasOwnRepo && names.includes('repo') ? cliOption('repo', valueOf('repo')) : [];
|
|
111
|
+
const words = ordered.filter(name => globalRepository.length === 0 || name !== 'repo').flatMap(name => shape.positional.includes(name) ? cliPositional(valueOf(name)) : cliOption(name, valueOf(name)));
|
|
112
|
+
return ['pecot', ...globalRepository, ...hint.path, ...words].join(' ');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
案内 1 つを出し先の形にする。定義に無い path・入力名は TypeError
|
|
116
|
+
*/
|
|
117
|
+
export function formatHint(hint, surface) {
|
|
118
|
+
if (hint.kind === 'command')
|
|
119
|
+
return formatCommand(hint, surface);
|
|
120
|
+
if (hint.kind === 'input')
|
|
121
|
+
assertInput(shapeOf(hint.path), hint.name);
|
|
122
|
+
const name = hint.kind === 'input' ? hint.name : 'repo';
|
|
123
|
+
const { value } = hint;
|
|
124
|
+
switch (surface) {
|
|
125
|
+
case 'mcp': {
|
|
126
|
+
return value === undefined ? name : `${name}: ${mcpValue(value)}`;
|
|
127
|
+
}
|
|
128
|
+
case 'cli': {
|
|
129
|
+
return value === undefined ? flagOf(name) : cliOption(name, value).join(' ');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function formatHinted(text, surface) {
|
|
134
|
+
return typeof text === 'string' ? text : text.map(part => typeof part === 'string' ? part : formatHint(part, surface)).join('');
|
|
135
|
+
}
|
|
136
|
+
function isHintedText(value) {
|
|
137
|
+
return Array.isArray(value) && value.every((part) => typeof part === 'string' || isHint(part));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
例外が持つ案内(hintedText)。最上位はこれを出し先の形で描き直す。無ければ undefined
|
|
141
|
+
*/
|
|
142
|
+
export function hintedTextOf(error) {
|
|
143
|
+
if (typeof error !== 'object' || error === null || !('hintedText' in error))
|
|
144
|
+
return undefined;
|
|
145
|
+
const { hintedText } = error;
|
|
146
|
+
return isHintedText(hintedText) ? hintedText : undefined;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=command-hint.js.map
|
|
@@ -196,6 +196,10 @@ aggregation_repo を RepositoryReference にする(未設定なら undefined
|
|
|
196
196
|
*/
|
|
197
197
|
export declare function aggregationRepositoryReference(config: ProjectConfig): RepositoryReference | undefined;
|
|
198
198
|
/**
|
|
199
|
+
Issue の表記で `#N` だけにするリポジトリ。repository(owner/repo)があればそれ、無ければ設定の最初のリポジトリ
|
|
200
|
+
*/
|
|
201
|
+
export declare function homeRepositoryOf(config: ProjectConfig, repository?: string): RepositoryReference | undefined;
|
|
202
|
+
/**
|
|
199
203
|
リポジトリがプロジェクトにリンクされているか。リンクの一覧は membership に問い合わせる
|
|
200
204
|
*/
|
|
201
205
|
export declare function isRepositoryInProject(config: ProjectConfig, owner: string, name: string, membership: RepositoryMembership): Promise<boolean>;
|
|
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|
|
7
7
|
import { PecotError } from './errors.js';
|
|
8
8
|
import { isJsonObject, jsonField } from './json.js';
|
|
9
9
|
import { isJsonArray, pythonRepr, pythonStrip, pythonStringRepr, ValidationFailure } from './python-format.js';
|
|
10
|
-
import { parseOwnerRepository } from './repository-resolver.js';
|
|
10
|
+
import { parseOwnerRepository, splitOwnerRepository } from './repository-resolver.js';
|
|
11
11
|
const WorkflowStatusSchema = z.enum(['backlog', 'pending', 'blocked', 'ready', 'active', 'in_review', 'archived']);
|
|
12
12
|
export const WORKFLOW_STATUSES = WorkflowStatusSchema.options;
|
|
13
13
|
const PrioritySchema = z.enum(['high', 'medium', 'low']);
|
|
@@ -270,6 +270,16 @@ export function aggregationRepositoryReference(config) {
|
|
|
270
270
|
return config.aggregation_repo === undefined || config.aggregation_repo === '' ? undefined : parseOwnerRepository(config.aggregation_repo);
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
|
+
Issue の表記で `#N` だけにするリポジトリ。repository(owner/repo)があればそれ、無ければ設定の最初のリポジトリ
|
|
274
|
+
*/
|
|
275
|
+
export function homeRepositoryOf(config, repository = '') {
|
|
276
|
+
const split = splitOwnerRepository(repository);
|
|
277
|
+
if (split !== undefined)
|
|
278
|
+
return split;
|
|
279
|
+
const [first] = config.repositories;
|
|
280
|
+
return first === undefined ? undefined : { owner: first.owner, repository: first.name };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
273
283
|
リポジトリがプロジェクトにリンクされているか。リンクの一覧は membership に問い合わせる
|
|
274
284
|
*/
|
|
275
285
|
export async function isRepositoryInProject(config, owner, name, membership) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Dependabot alert の状態判定。`release
|
|
1
|
+
// Dependabot alert の状態判定。`release check` と `board show` が同じ判定を共有する。
|
|
2
2
|
// 有効 / 無効・open 件数・最高 severity・一覧 URL をまとめて返す。取得は DependabotSource に任せる。
|
|
3
3
|
import { describeApiError } from './api-error-detail.js';
|
|
4
4
|
import { PecotError } from './errors.js';
|
|
@@ -16,4 +16,9 @@ export declare class ProjectRootNotFoundError extends PecotError {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class InvalidValueError extends BaseError {
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
起きないはずの分岐に入った。実装の誤りで、利用者の入力のせいではない
|
|
21
|
+
*/
|
|
22
|
+
export declare class InternalError extends BaseError {
|
|
23
|
+
}
|
|
19
24
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -28,4 +28,9 @@ export class ProjectRootNotFoundError extends PecotError {
|
|
|
28
28
|
*/
|
|
29
29
|
export class InvalidValueError extends BaseError {
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
起きないはずの分岐に入った。実装の誤りで、利用者の入力のせいではない
|
|
33
|
+
*/
|
|
34
|
+
export class InternalError extends BaseError {
|
|
35
|
+
}
|
|
31
36
|
//# sourceMappingURL=errors.js.map
|
|
@@ -17,6 +17,28 @@ export interface BoardItem {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
+
一覧の応答から読む、着手の判定の軽い入力。JSON の出力には出さない
|
|
21
|
+
*/
|
|
22
|
+
export interface BoardProgress {
|
|
23
|
+
readonly issueType: string | undefined;
|
|
24
|
+
readonly subIssues: number;
|
|
25
|
+
/**
|
|
26
|
+
親の Issue。無ければ undefined
|
|
27
|
+
*/
|
|
28
|
+
readonly parent: {
|
|
29
|
+
readonly repository: string;
|
|
30
|
+
readonly number: number;
|
|
31
|
+
} | undefined;
|
|
32
|
+
/**
|
|
33
|
+
前提の件数。応答に無ければ undefined
|
|
34
|
+
*/
|
|
35
|
+
readonly blockedBy: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
Status の値(札)
|
|
38
|
+
*/
|
|
39
|
+
readonly label: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
20
42
|
GraphQL の戻り値から Workflow ステータスを抽出する。
|
|
21
43
|
フィールド名は大文字小文字を区別しない。見つからなければ undefined。
|
|
22
44
|
名前が一致したノードを最初に見つけた時点で、その値(無ければ undefined)を返す
|
|
@@ -28,16 +50,41 @@ Draft Issue など content が無いアイテムは除く
|
|
|
28
50
|
*/
|
|
29
51
|
export declare function transformItems(rawItems: readonly JsonObject[], workflowFieldName: string): readonly BoardItem[];
|
|
30
52
|
/**
|
|
31
|
-
|
|
53
|
+
一覧の応答から、Issue ごとの着手の判定の入力を取る。キーは boardItemKey と同じ。Issue 以外と、番号の無いものは含めない
|
|
54
|
+
*/
|
|
55
|
+
export declare function readBoardProgress(rawItems: readonly JsonObject[], labelFieldName: string): ReadonlyMap<string, BoardProgress>;
|
|
56
|
+
/**
|
|
57
|
+
1 アイテムを Markdown 表の行 `| Ref | Title |` にする。extraCells は、Title の後ろに足すセル。
|
|
32
58
|
Ref は GitHub 慣習に倣い `owner/repo#N` で合成する。
|
|
33
59
|
リポジトリ情報または番号が欠落している場合は可能な範囲で埋め、両方欠落しているときは `-` を表示する
|
|
34
60
|
*/
|
|
35
|
-
export declare function formatTableRow(item: BoardItem): string;
|
|
61
|
+
export declare function formatTableRow(item: BoardItem, extraCells?: readonly string[]): string;
|
|
62
|
+
/**
|
|
63
|
+
判定の文の表(readiness 引数)を引くキー。`owner/repo#N` の小文字で、issueReferenceKey と同じ形になる。
|
|
64
|
+
リポジトリか番号が欠けたアイテムは undefined
|
|
65
|
+
*/
|
|
66
|
+
export declare function boardItemKey(item: BoardItem): string | undefined;
|
|
36
67
|
/**
|
|
37
68
|
プロジェクトボードを Markdown 形式で出力する。件数が 0 のステータスは出さない。
|
|
38
|
-
Archived は 6 件以上あるとき、更新が新しい直近 5
|
|
69
|
+
Archived は 6 件以上あるとき、更新が新しい直近 5 件だけを出す。
|
|
70
|
+
readiness(boardItemKey → 判定の文)を渡したときだけ、Ready と Blocked の節に Readiness の列を足す。
|
|
71
|
+
表に無いアイテムのセルは `-`
|
|
72
|
+
*/
|
|
73
|
+
export declare function formatBoardOutput(items: readonly BoardItem[], readiness?: ReadonlyMap<string, string>): string;
|
|
74
|
+
export interface StackableChain {
|
|
75
|
+
/**
|
|
76
|
+
並びの一番上の Issue の親(表示用の `#N`)。親が無ければ undefined
|
|
77
|
+
*/
|
|
78
|
+
readonly epic: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
下から並べた Issue(表示用の `#N`)
|
|
81
|
+
*/
|
|
82
|
+
readonly chain: readonly string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
`## Stackable chains` の節を作る。1 行が 1 つの並びで、並びが無ければ undefined
|
|
39
86
|
*/
|
|
40
|
-
export declare function
|
|
87
|
+
export declare function formatStackableChains(chains: readonly StackableChain[]): string | undefined;
|
|
41
88
|
/**
|
|
42
89
|
アイテムリストを JSON 出力用の辞書にする
|
|
43
90
|
*/
|