@yutaura/live-spec 0.0.0-stage → 0.2.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 +12 -0
- package/LICENSE +21 -0
- package/README.md +205 -2
- package/dist/cli.d.ts +20 -0
- package/dist/cli.js +219 -0
- package/dist/diff.d.ts +123 -0
- package/dist/diff.js +178 -0
- package/dist/ensure-scope.d.ts +9 -0
- package/dist/ensure-scope.js +81 -0
- package/dist/ensure.d.ts +9 -0
- package/dist/ensure.js +35 -0
- package/dist/explore.d.ts +25 -0
- package/dist/explore.js +292 -0
- package/dist/generate.d.ts +21 -0
- package/dist/generate.js +159 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/load.d.ts +58 -0
- package/dist/load.js +79 -0
- package/dist/model.d.ts +487 -0
- package/dist/model.js +209 -0
- package/dist/mutation.d.ts +3 -0
- package/dist/mutation.js +51 -0
- package/dist/omission.d.ts +6 -0
- package/dist/omission.js +177 -0
- package/dist/project-diff.d.ts +24 -0
- package/dist/project-diff.js +76 -0
- package/dist/render/collapse.d.ts +4 -0
- package/dist/render/collapse.js +22 -0
- package/dist/render/diff-html.d.ts +2 -0
- package/dist/render/diff-html.js +148 -0
- package/dist/render/diff-markdown.d.ts +11 -0
- package/dist/render/diff-markdown.js +70 -0
- package/dist/render/ensures.d.ts +2 -0
- package/dist/render/ensures.js +21 -0
- package/dist/render/escape.d.ts +1 -0
- package/dist/render/escape.js +2 -0
- package/dist/render/html.d.ts +13 -0
- package/dist/render/html.js +717 -0
- package/dist/render/layout.d.ts +39 -0
- package/dist/render/layout.js +74 -0
- package/dist/render/markdown.d.ts +20 -0
- package/dist/render/markdown.js +248 -0
- package/dist/render/review.d.ts +17 -0
- package/dist/render/review.js +17 -0
- package/dist/render/summary.d.ts +62 -0
- package/dist/render/summary.js +119 -0
- package/dist/render/union.d.ts +23 -0
- package/dist/render/union.js +43 -0
- package/dist/render/wireframe.d.ts +3 -0
- package/dist/render/wireframe.js +62 -0
- package/dist/serve.d.ts +8 -0
- package/dist/serve.js +71 -0
- package/dist/skills.d.ts +8 -0
- package/dist/skills.js +20 -0
- package/dist/spec-loader.d.ts +2 -0
- package/dist/spec-loader.js +24 -0
- package/dist/static.d.ts +15 -0
- package/dist/static.js +151 -0
- package/dist/surface.d.ts +59 -0
- package/dist/surface.js +44 -0
- package/dist/watch.d.ts +10 -0
- package/dist/watch.js +47 -0
- package/package.json +60 -4
- package/skills/live-spec-authoring/SKILL.md +190 -0
- package/skills/live-spec-from-code/SKILL.md +93 -0
- package/skills/live-spec-review/SKILL.md +71 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Graph } from "../model.js";
|
|
2
|
+
export interface Point {
|
|
3
|
+
readonly x: number;
|
|
4
|
+
readonly y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface LaidOutNode {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly x: number;
|
|
10
|
+
readonly y: number;
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface LaidOutEdge {
|
|
15
|
+
readonly from: string;
|
|
16
|
+
readonly to: string;
|
|
17
|
+
readonly action: string;
|
|
18
|
+
readonly points: ReadonlyArray<Point>;
|
|
19
|
+
readonly label: Point & {
|
|
20
|
+
readonly width: number;
|
|
21
|
+
readonly height: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface Layout {
|
|
25
|
+
readonly width: number;
|
|
26
|
+
readonly height: number;
|
|
27
|
+
readonly nodes: ReadonlyArray<LaidOutNode>;
|
|
28
|
+
readonly edges: ReadonlyArray<LaidOutEdge>;
|
|
29
|
+
}
|
|
30
|
+
export declare const textWidth: (text: string, halfWidth?: number) => number;
|
|
31
|
+
export interface LayoutOptions {
|
|
32
|
+
readonly nodeSize?: {
|
|
33
|
+
readonly width: number;
|
|
34
|
+
readonly height: number;
|
|
35
|
+
};
|
|
36
|
+
/** false にすると「どの状態からでも」にまとめない(差分の図で、消えた遷移まで見せるため) */
|
|
37
|
+
readonly collapse?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare const layout: (graph: Graph, options?: LayoutOptions) => Promise<Layout>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import ElkModule from "elkjs/lib/elk.bundled.js";
|
|
2
|
+
import { ANY, ANY_LABEL, collapseTransitions } from "./collapse.js";
|
|
3
|
+
const NODE_HEIGHT = 40;
|
|
4
|
+
const NODE_PADDING_X = 28;
|
|
5
|
+
const LABEL_HEIGHT = 16;
|
|
6
|
+
// ブラウザで文字幅を測らずに概算する理由: 生成は Node で行い、出力を決定的にしたいため。
|
|
7
|
+
// 全角は半角の約 2 倍の幅として扱う。
|
|
8
|
+
export const textWidth = (text, halfWidth = 7.2) => [...text].reduce((w, ch) => w + ((ch.codePointAt(0) ?? 0) > 0x2e7f ? halfWidth * 1.9 : halfWidth), 0);
|
|
9
|
+
const LAYOUT_OPTIONS = {
|
|
10
|
+
"elk.algorithm": "layered",
|
|
11
|
+
"elk.direction": "RIGHT",
|
|
12
|
+
"elk.edgeRouting": "ORTHOGONAL",
|
|
13
|
+
"elk.spacing.nodeNode": "36",
|
|
14
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "72",
|
|
15
|
+
"elk.spacing.edgeLabel": "4",
|
|
16
|
+
"elk.layered.spacing.edgeNodeBetweenLayers": "24",
|
|
17
|
+
"elk.padding": "[top=24,left=24,bottom=24,right=24]",
|
|
18
|
+
// 入力の並び(幅優先探索の順)をなるべく保つ理由: spec を少し変えただけで図の配置が大きく入れ替わると、
|
|
19
|
+
// 差分レビューで「どこが変わったか」が分からなくなるため。
|
|
20
|
+
"elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
|
|
21
|
+
// 循環を断ち切るときに入力順(幅優先探索の順)を基準にする理由: reject や unpublish のような
|
|
22
|
+
// 「戻る」遷移を逆向きの辺として扱わせ、初期状態から右へ流れる読み順を保つため。
|
|
23
|
+
"elk.layered.cycleBreaking.strategy": "MODEL_ORDER",
|
|
24
|
+
};
|
|
25
|
+
// .default を経由する理由: elkjs は CommonJS で、型定義は `export default` だが実体は module.exports。
|
|
26
|
+
// nodenext ではデフォルト import が module.exports そのものの型になり、コンストラクタとして型付けされない。
|
|
27
|
+
// 実体は ELKNode.default = ELKNode も設定しているので、.default なら型と実行時の両方で正しく動く。
|
|
28
|
+
const ELK = ElkModule.default;
|
|
29
|
+
export const layout = async (graph, options = {}) => {
|
|
30
|
+
const elk = new ELK();
|
|
31
|
+
// 自分自身に戻る遷移は描かない。ほぼすべての状態にあると、図が線で埋まって読めなくなるため。
|
|
32
|
+
const transitions = (options.collapse === false ? graph.transitions : collapseTransitions(graph)).filter((t) => t.from !== t.to);
|
|
33
|
+
const hasAny = transitions.some((t) => t.from === ANY);
|
|
34
|
+
const nodeList = [
|
|
35
|
+
...(hasAny ? [{ id: ANY, label: ANY_LABEL, initial: false }] : []),
|
|
36
|
+
...graph.states.map((s) => ({ id: s.id, label: s.label, initial: s.initial })),
|
|
37
|
+
];
|
|
38
|
+
const input = {
|
|
39
|
+
id: "root",
|
|
40
|
+
layoutOptions: LAYOUT_OPTIONS,
|
|
41
|
+
children: nodeList.map((s) => ({
|
|
42
|
+
id: s.id,
|
|
43
|
+
width: options.nodeSize?.width ?? textWidth(s.label) + NODE_PADDING_X * 2,
|
|
44
|
+
height: options.nodeSize?.height ?? NODE_HEIGHT,
|
|
45
|
+
// 「どの状態からでも」には層の指定をしない。初期状態へ戻る遷移(リセットなど)があると、
|
|
46
|
+
// 初期状態と同じ最初の層に置くことになり、ELK が層の中の辺を扱えずに落ちるため。
|
|
47
|
+
...(s.initial ? { layoutOptions: { "elk.layered.layering.layerConstraint": "FIRST" } } : {}),
|
|
48
|
+
})),
|
|
49
|
+
edges: transitions.map((t, i) => ({
|
|
50
|
+
id: `e${i}`,
|
|
51
|
+
sources: [t.from],
|
|
52
|
+
targets: [t.to],
|
|
53
|
+
labels: [{ text: t.action, width: textWidth(t.action, 6.6) + 8, height: LABEL_HEIGHT }],
|
|
54
|
+
})),
|
|
55
|
+
};
|
|
56
|
+
const result = await elk.layout(input);
|
|
57
|
+
const nodes = nodeList.map((s) => {
|
|
58
|
+
const n = result.children.find((c) => c.id === s.id);
|
|
59
|
+
return { id: s.id, label: s.label, x: n.x, y: n.y, width: n.width, height: n.height };
|
|
60
|
+
});
|
|
61
|
+
const edges = transitions.map((t, i) => {
|
|
62
|
+
const e = result.edges.find((x) => x.id === `e${i}`);
|
|
63
|
+
const section = e.sections[0];
|
|
64
|
+
const label = e.labels[0];
|
|
65
|
+
return {
|
|
66
|
+
from: t.from,
|
|
67
|
+
to: t.to,
|
|
68
|
+
action: t.action,
|
|
69
|
+
points: [section.startPoint, ...(section.bendPoints ?? []), section.endPoint].map(({ x, y }) => ({ x, y })),
|
|
70
|
+
label: { x: label.x, y: label.y, width: label.width, height: label.height },
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return { width: result.width, height: result.height, nodes, edges };
|
|
74
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Spec } from "../load.js";
|
|
2
|
+
import type { Finding, Graph } from "../model.js";
|
|
3
|
+
import { type ActionSummary } from "./summary.js";
|
|
4
|
+
type Objects = ReadonlyArray<{
|
|
5
|
+
readonly spec: Spec;
|
|
6
|
+
readonly graph: Graph;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const renderIndexMarkdown: (objects: Objects, title: string) => string;
|
|
9
|
+
export declare const renderMarkdown: (spec: Spec, graph: Graph, objects?: Objects) => string;
|
|
10
|
+
export declare const splitEvidence: (text: string) => {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly rest: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const inputCell: (input: unknown, column: string) => string;
|
|
15
|
+
export declare const resultCell: (r: Graph["decisions"][number]["rows"][number]) => string;
|
|
16
|
+
export declare const questionTarget: (spec: Spec, q: Graph["questions"][number], labelOf: (id: string) => string) => string;
|
|
17
|
+
export declare const describeStep: (spec: Spec, step: Graph["scenarios"][number]["steps"][number]) => string;
|
|
18
|
+
export declare const formatEffect: (a: ActionSummary) => string;
|
|
19
|
+
export declare const describeFinding: (f: Finding, labelOf: (id: string) => string) => string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { describeEnsure } from "./ensures.js";
|
|
2
|
+
import { REVIEW_LEAD, REVIEW_TITLE, reviewItems, unguardedId } from "./review.js";
|
|
3
|
+
import { ANY, ANY_LABEL, collapseTransitions } from "./collapse.js";
|
|
4
|
+
import { formatTransition, presentBlocked, summarizeActions, summarizeStates } from "./summary.js";
|
|
5
|
+
import { surfaceToText } from "./wireframe.js";
|
|
6
|
+
const actionName = (objects, object, action) => {
|
|
7
|
+
const spec = objects.find((o) => o.spec.name === object)?.spec;
|
|
8
|
+
const doc = spec?.docs[action];
|
|
9
|
+
return doc === undefined ? action : `${doc.replace(/。$/, "")}(${action})`;
|
|
10
|
+
};
|
|
11
|
+
const endpoint = (objects, object, action) => `[${object}](${object}.md)${action === null ? "" : ` の ${actionName(objects, object, action)}`}`;
|
|
12
|
+
const allLinks = (objects) => objects.flatMap(({ spec, graph }) => graph.links.map((l) => ({ ...l, source: spec.name })));
|
|
13
|
+
export const renderIndexMarkdown = (objects, title) => [
|
|
14
|
+
`# ${title}`,
|
|
15
|
+
"",
|
|
16
|
+
`ドメインオブジェクト ${objects.length} 個の仕様書です。`,
|
|
17
|
+
"",
|
|
18
|
+
"| ドメインオブジェクト | 説明 | 状態 | 操作 | 未決 | 検査 |",
|
|
19
|
+
"|---|---|---|---|---|---|",
|
|
20
|
+
...objects.map(({ spec, graph }) => `| [${spec.name}](${spec.name}.md) | ${spec.stateDoc ?? ""} | ${graph.states.length} | ${spec.actions.length} | ${graph.questions.length} | ${graph.findings.length === 0 ? "OK" : `⚠ ${graph.findings.length}`} |`),
|
|
21
|
+
"",
|
|
22
|
+
...(allLinks(objects).length === 0
|
|
23
|
+
? []
|
|
24
|
+
: [
|
|
25
|
+
"## つながり",
|
|
26
|
+
"",
|
|
27
|
+
...allLinks(objects).map((l) => `- ${endpoint(objects, l.source, l.from)} → ${endpoint(objects, l.to, l.action)}: ${l.label}`),
|
|
28
|
+
"",
|
|
29
|
+
]),
|
|
30
|
+
].join("\n");
|
|
31
|
+
export const renderMarkdown = (spec, graph, objects = [{ spec, graph }]) => {
|
|
32
|
+
const incoming = allLinks(objects).filter((l) => l.to === spec.name && l.source !== spec.name);
|
|
33
|
+
const ownAction = (action) => (action === null ? "" : actionName(objects, spec.name, action));
|
|
34
|
+
const labelOf = (id) => graph.states.find((s) => s.id === id)?.label ?? id;
|
|
35
|
+
return [
|
|
36
|
+
`# ${spec.name}`,
|
|
37
|
+
"",
|
|
38
|
+
...(spec.stateDoc === null ? [] : [spec.stateDoc, ""]),
|
|
39
|
+
// 未決事項を状態遷移図より前に置く理由: AI が書いた仕様のうち、人が判断すべきなのはここだけ、という
|
|
40
|
+
// 入口にしたいため。全体を読む前に、判断が必要な点が目に入るようにする。
|
|
41
|
+
...(graph.questions.length === 0
|
|
42
|
+
? []
|
|
43
|
+
: [
|
|
44
|
+
"## 未決事項",
|
|
45
|
+
"",
|
|
46
|
+
...graph.questions.flatMap((q, i) => [
|
|
47
|
+
`${i + 1}. ${q.ask}${questionTarget(spec, q, labelOf)}`,
|
|
48
|
+
...(q.note === null ? [] : [` - ${q.note}`]),
|
|
49
|
+
]),
|
|
50
|
+
"",
|
|
51
|
+
]),
|
|
52
|
+
...reviewSection(spec, graph),
|
|
53
|
+
"## 状態遷移図",
|
|
54
|
+
"",
|
|
55
|
+
"```mermaid",
|
|
56
|
+
"stateDiagram-v2",
|
|
57
|
+
...graph.states.map((s) => ` state "${s.label}" as ${s.id}`),
|
|
58
|
+
...graph.states.filter((s) => s.initial).map((s) => ` [*] --> ${s.id}`),
|
|
59
|
+
// 自分自身に戻る遷移は図に描かない(線が図を埋めるため)。操作の節の「できるとき」には残る。
|
|
60
|
+
...(collapseTransitions(graph).some((t) => t.from === ANY) ? [` state "${ANY_LABEL}" as any`] : []),
|
|
61
|
+
...collapseTransitions(graph)
|
|
62
|
+
.filter((t) => t.from !== t.to)
|
|
63
|
+
.map((t) => ` ${t.from === ANY ? "any" : t.from} --> ${t.to}: ${t.action} (${t.actors.join(", ")})`),
|
|
64
|
+
...graph.states.filter((s) => s.terminal).map((s) => ` ${s.id} --> [*]`),
|
|
65
|
+
"```",
|
|
66
|
+
"",
|
|
67
|
+
...glossarySection(spec),
|
|
68
|
+
"## 操作",
|
|
69
|
+
"",
|
|
70
|
+
...summarizeActions(spec, graph).flatMap((a) => [
|
|
71
|
+
...actionSection(a),
|
|
72
|
+
...((spec.evidence[a.name] ?? []).length === 0 ? [] : [`- **根拠**: ${spec.evidence[a.name].map(formatEvidence).join("、")}`]),
|
|
73
|
+
...graph.questions.filter((q) => q.action === a.name).map((q) => `- **未決**: ${q.ask}`),
|
|
74
|
+
...ensureLines((graph.ensures ?? []).filter((e) => e.action === a.name), spec.reviewed),
|
|
75
|
+
"",
|
|
76
|
+
]),
|
|
77
|
+
...(graph.links.length + incoming.length === 0
|
|
78
|
+
? []
|
|
79
|
+
: [
|
|
80
|
+
"## つながり",
|
|
81
|
+
"",
|
|
82
|
+
...graph.links.map((l) => `- ${l.from === null ? "" : `${ownAction(l.from)} `}→ ${endpoint(objects, l.to, l.action)}: ${l.label}`),
|
|
83
|
+
...incoming.map((l) => `- ${l.action === null ? "" : `${ownAction(l.action)} `}← ${endpoint(objects, l.source, l.from)}から: ${l.label}`),
|
|
84
|
+
"",
|
|
85
|
+
]),
|
|
86
|
+
...(graph.decisions.length === 0 ? [] : ["## ルール", "", ...graph.decisions.flatMap((d) => [...decisionTable(d), ""])]),
|
|
87
|
+
...(graph.scenarios.length === 0 ? [] : ["## シナリオ", "", ...graph.scenarios.flatMap((s) => [...scenarioSection(spec, s, labelOf), ""])]),
|
|
88
|
+
...screensSection(spec, graph),
|
|
89
|
+
"## 検査結果",
|
|
90
|
+
"",
|
|
91
|
+
...(graph.findings.length === 0 ? ["問題は見つかりませんでした。"] : graph.findings.map((f) => `- ⚠ ${describeFinding(f, labelOf)}`)),
|
|
92
|
+
"",
|
|
93
|
+
].join("\n");
|
|
94
|
+
};
|
|
95
|
+
const ensureLines = (ensures, reviewed) => ensures.length === 0 ? [] : ["- **条件**:", ...ensures.map((e) => ` - ${describeEnsure(e, reviewed[unguardedId(e)] !== undefined)}`)];
|
|
96
|
+
const reviewSection = (spec, graph) => {
|
|
97
|
+
const { pending, acknowledged } = reviewItems(spec, graph);
|
|
98
|
+
if (pending.length + acknowledged.length === 0)
|
|
99
|
+
return [];
|
|
100
|
+
return [
|
|
101
|
+
`## ${REVIEW_TITLE}`,
|
|
102
|
+
"",
|
|
103
|
+
...(pending.length === 0 ? ["確かめてほしい点はありません。"] : [REVIEW_LEAD, "", ...pending.map((i) => `- ${i.message}(\`${i.id}\`)`)]),
|
|
104
|
+
"",
|
|
105
|
+
...(acknowledged.length === 0 ? [] : ["### 確認済み", "", ...acknowledged.map((i) => `- \`${i.id}\`: ${i.note}`), ""]),
|
|
106
|
+
];
|
|
107
|
+
};
|
|
108
|
+
const actionSection = (a) => {
|
|
109
|
+
const heading = a.summary === null ? `### \`${a.name}\`` : `### ${a.summary}(\`${a.name}\`)`;
|
|
110
|
+
if (a.capable.length === 0)
|
|
111
|
+
return [heading, "", "- **できる人**: なし(どの状態でも誰も実行できない)"];
|
|
112
|
+
const who = a.othersReasons.length === 0 ? a.capable.join(", ") : `${a.capable.join(", ")}(ほかの人は「${a.othersReasons.join("」「")}」)`;
|
|
113
|
+
const groups = presentBlocked(a.blocked).map((b) => `${b.states === null ? "それ以外のすべての状態" : b.states.join(", ")}(${b.reason})`);
|
|
114
|
+
const whenNot = groups.length === 0
|
|
115
|
+
? "- **できないとき**: なし"
|
|
116
|
+
: groups.length === 1
|
|
117
|
+
? `- **できないとき**: ${groups[0]}`
|
|
118
|
+
: ["- **できないとき**:", ...groups.map((g) => ` - ${g}`)].join("\n");
|
|
119
|
+
const effect = formatEffect(a);
|
|
120
|
+
return [
|
|
121
|
+
heading,
|
|
122
|
+
"",
|
|
123
|
+
`- **できる人**: ${who}`,
|
|
124
|
+
`- **できるとき**: ${a.when.map(formatTransition).join(" / ")}`,
|
|
125
|
+
whenNot,
|
|
126
|
+
...(a.inputOutcomes.length === 0
|
|
127
|
+
? []
|
|
128
|
+
: [
|
|
129
|
+
[
|
|
130
|
+
"- **入力ごとの結果**:",
|
|
131
|
+
...a.inputOutcomes.map((o) => o.transitions.length > 0
|
|
132
|
+
? ` - ${o.input}: ${o.transitions.map(formatTransition).join(" / ")}`
|
|
133
|
+
: ` - ${o.input}: ❌ ${o.reasons.join("、")}`),
|
|
134
|
+
].join("\n"),
|
|
135
|
+
]),
|
|
136
|
+
...(effect === "" ? [] : [`- **結果**: ${effect}`]),
|
|
137
|
+
];
|
|
138
|
+
};
|
|
139
|
+
// 根拠の先頭(空白か「(」まで)をコードの場所としてコード書式にし、残りは補足として続ける。
|
|
140
|
+
export const splitEvidence = (text) => {
|
|
141
|
+
const m = /^(\S+?)((?:(|\s).*)?$/.exec(text);
|
|
142
|
+
return { path: m?.[1] ?? text, rest: m?.[2] ?? "" };
|
|
143
|
+
};
|
|
144
|
+
const formatEvidence = (text) => {
|
|
145
|
+
const { path, rest } = splitEvidence(text);
|
|
146
|
+
return `\`${path}\`${rest}`;
|
|
147
|
+
};
|
|
148
|
+
const glossarySection = (spec) => {
|
|
149
|
+
const fields = Object.entries(spec.fieldDocs).map(([field, doc]) => {
|
|
150
|
+
const values = spec.fields[field];
|
|
151
|
+
return `- **${field}**(項目): ${doc}${values === undefined ? "" : `。値: ${values.map(String).join(" / ")}`}`;
|
|
152
|
+
});
|
|
153
|
+
const terms = Object.entries(spec.glossary).map(([term, doc]) => `- **${term}**: ${doc}`);
|
|
154
|
+
return fields.length + terms.length === 0 ? [] : ["## 用語", "", ...fields, ...terms, ""];
|
|
155
|
+
};
|
|
156
|
+
const screensSection = (spec, graph) => {
|
|
157
|
+
const states = summarizeStates(spec, graph).filter((s) => s.surfaces.length > 0);
|
|
158
|
+
if (states.length === 0)
|
|
159
|
+
return [];
|
|
160
|
+
const invalidFor = (state, actors) => graph.findings.flatMap((f) => (f.kind === "surface-action-not-allowed" && f.state === state && actors.includes(f.actor) ? [f.action] : []));
|
|
161
|
+
return [
|
|
162
|
+
"## 画面",
|
|
163
|
+
"",
|
|
164
|
+
...states.flatMap((s) => [
|
|
165
|
+
`### ${s.label}`,
|
|
166
|
+
"",
|
|
167
|
+
...s.surfaces.flatMap((g) => [
|
|
168
|
+
`${g.actors.join(", ")} が見る画面:`,
|
|
169
|
+
"",
|
|
170
|
+
"```text",
|
|
171
|
+
surfaceToText(g.surface, invalidFor(s.id, g.actors)),
|
|
172
|
+
"```",
|
|
173
|
+
"",
|
|
174
|
+
]),
|
|
175
|
+
]),
|
|
176
|
+
];
|
|
177
|
+
};
|
|
178
|
+
const cell = (v) => (v === undefined || v === null ? "" : typeof v === "string" ? v : JSON.stringify(v));
|
|
179
|
+
export const inputCell = (input, column) => typeof input === "object" && input !== null ? cell(input[column]) : cell(input);
|
|
180
|
+
export const resultCell = (r) => r.ok ? cell(r.result) : `❌ ${cell(r.result)}(期待: ${cell(r.expect)})`;
|
|
181
|
+
const decisionTable = (d) => [
|
|
182
|
+
`### ${d.name}`,
|
|
183
|
+
"",
|
|
184
|
+
`| ${[...d.columns, "結果"].join(" | ")} |`,
|
|
185
|
+
`|${[...d.columns, "結果"].map(() => "---").join("|")}|`,
|
|
186
|
+
...d.rows.map((r) => `| ${[...d.columns.map((c) => inputCell(r.input, c)), resultCell(r)].join(" | ")} |`),
|
|
187
|
+
];
|
|
188
|
+
export const questionTarget = (spec, q, labelOf) => q.action !== null
|
|
189
|
+
? `(操作: ${(spec.docs[q.action] ?? q.action).replace(/。$/, "")})`
|
|
190
|
+
: q.states.length > 0
|
|
191
|
+
? `(状態: ${q.states.map(labelOf).join(", ")})`
|
|
192
|
+
: "";
|
|
193
|
+
export const describeStep = (spec, step) => {
|
|
194
|
+
// 文の途中に入れるので、見出しの末尾の「。」は外す(「起動する。(start)」のようにならないように)。
|
|
195
|
+
const what = (spec.docs[step.action] ?? step.action).replace(/。$/, "");
|
|
196
|
+
const detail = step.input === null ? step.action : `${step.action}、${step.input}`;
|
|
197
|
+
return `${step.actor} が ${what}(${detail})`;
|
|
198
|
+
};
|
|
199
|
+
const scenarioSection = (spec, s, labelOf) => [
|
|
200
|
+
`### ${s.passed ? "✅" : "❌"} ${s.name}`,
|
|
201
|
+
"",
|
|
202
|
+
...s.steps.map((step, i) => step.ok && step.denied
|
|
203
|
+
? `${i + 1}. ${describeStep(spec, step)}: 断られる(${step.reason})`
|
|
204
|
+
: step.ok
|
|
205
|
+
? `${i + 1}. ${describeStep(spec, step)}: ${labelOf(step.from ?? "")} → ${labelOf(step.to ?? "")}`
|
|
206
|
+
: `${i + 1}. ❌ ${describeStep(spec, step)}: ${step.reason}`),
|
|
207
|
+
];
|
|
208
|
+
export const formatEffect = (a) => a.effect.map((e) => `${e.field} → ${e.values.join(" / ")}`).join(", ");
|
|
209
|
+
export const describeFinding = (f, labelOf) => {
|
|
210
|
+
switch (f.kind) {
|
|
211
|
+
case "unreachable-value":
|
|
212
|
+
return `${f.field} = ${String(f.value)} は型に書かれているが、到達できるどの状態でもとらない`;
|
|
213
|
+
case "never-enabled-action":
|
|
214
|
+
return `操作 ${f.action} は、到達できるどの状態でも誰も実行できない`;
|
|
215
|
+
case "action-error":
|
|
216
|
+
return `操作 ${f.action} が ${labelOf(f.state)} で ${f.actor} が実行したときに例外を投げた: ${f.message}`;
|
|
217
|
+
case "invalid-return":
|
|
218
|
+
return `操作 ${f.action} が ${labelOf(f.state)} で ${f.actor} が実行したときにオブジェクトを返さなかった`;
|
|
219
|
+
case "invariant-violation": {
|
|
220
|
+
const path = f.path.length === 0 ? "初期状態" : f.path.map((p) => `${p.action} (${p.actor})`).join(" → ");
|
|
221
|
+
return `不変条件「${f.invariant}」を ${labelOf(f.state)} で破る(${path})`;
|
|
222
|
+
}
|
|
223
|
+
case "missing-inputs":
|
|
224
|
+
return `操作 ${f.action} は 3 つ目以降の引数をとるが、inputs に例がないので実行していない`;
|
|
225
|
+
case "unknown-inputs":
|
|
226
|
+
return `inputs に書かれた ${f.action} という操作は存在しない`;
|
|
227
|
+
case "reviewed-unmatched":
|
|
228
|
+
return `reviewed に書かれた ${f.id} は、確かめてほしい点のどれにも当たらない(ID の書き間違いか、もう出なくなった候補)`;
|
|
229
|
+
case "surface-action-not-allowed":
|
|
230
|
+
return `${labelOf(f.state)} で ${f.actor} に ${f.action} のボタンが見えているが、実行できない`;
|
|
231
|
+
case "surface-action-missing":
|
|
232
|
+
return `${labelOf(f.state)} で ${f.actor} は ${f.action} を実行できるが、画面にボタンがない`;
|
|
233
|
+
case "surface-error":
|
|
234
|
+
return `${labelOf(f.state)} で ${f.actor} の画面を作るときに例外を投げた: ${f.message}`;
|
|
235
|
+
case "link-unresolved":
|
|
236
|
+
return `つながりの相手 ${f.to}${f.action === null ? "" : ` の ${f.action}`} が見つからない`;
|
|
237
|
+
case "decision-mismatch":
|
|
238
|
+
return `ルール「${f.decision}」の ${f.row} 行目の結果が期待と違う(期待: ${f.expected}、実際: ${f.actual})`;
|
|
239
|
+
case "decision-error":
|
|
240
|
+
return `ルール「${f.decision}」の ${f.row} 行目で例外を投げた: ${f.message}`;
|
|
241
|
+
case "question-unmatched":
|
|
242
|
+
return `未決事項「${f.ask}」の対象の状態が、到達できるどの状態にも当てはまらない`;
|
|
243
|
+
case "scenario-failed":
|
|
244
|
+
return `シナリオ「${f.scenario}」の ${f.step} 段目で止まった: ${f.reason}`;
|
|
245
|
+
case "state-limit":
|
|
246
|
+
return `状態が ${f.maxStates} 個を超えたので探索を打ち切った(値が増え続ける項目がないか確認する)`;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Spec } from "../load.js";
|
|
2
|
+
import type { EnsureCheck, Graph } from "../model.js";
|
|
3
|
+
export interface ReviewItem {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const unguardedId: (e: Pick<EnsureCheck, "action" | "reason">) => string;
|
|
8
|
+
export declare const REVIEW_TITLE = "\u78BA\u304B\u3081\u3066\u307B\u3057\u3044\u70B9";
|
|
9
|
+
export declare const REVIEW_LEAD = "spec \u3092\u5B9F\u884C\u3057\u305F\u7D50\u679C\u304B\u3089\u3001\u6761\u4EF6\u306E\u66F8\u304D\u5FD8\u308C\u30FB\u66F8\u304D\u9593\u9055\u3044\u306E\u5019\u88DC\u3092\u6319\u3052\u3066\u3044\u307E\u3059\u3002\u76F4\u3059\u304B\u3001\u610F\u56F3\u3069\u304A\u308A\u306A\u3089 `export const reviewed = { \"ID\": \"\u7406\u7531\" }` \u306B\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
10
|
+
export declare const reviewItems: (spec: Spec, graph: Graph) => {
|
|
11
|
+
pending: ReviewItem[];
|
|
12
|
+
acknowledged: {
|
|
13
|
+
id: string;
|
|
14
|
+
message: string;
|
|
15
|
+
note: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describeEnsure } from "./ensures.js";
|
|
2
|
+
export const unguardedId = (e) => `unguarded:${e.action}:${e.reason}`;
|
|
3
|
+
export const REVIEW_TITLE = "確かめてほしい点";
|
|
4
|
+
export const REVIEW_LEAD = "spec を実行した結果から、条件の書き忘れ・書き間違いの候補を挙げています。直すか、意図どおりなら `export const reviewed = { \"ID\": \"理由\" }` に書いてください。";
|
|
5
|
+
// 確認済みのものを消さずに残す理由: 「意図どおり」と判断した中身を、後から人が読めるようにするため。
|
|
6
|
+
export const reviewItems = (spec, graph) => {
|
|
7
|
+
const items = [
|
|
8
|
+
...(graph.ensures ?? [])
|
|
9
|
+
.filter((e) => e.verdict === "unguarded")
|
|
10
|
+
.map((e) => ({ id: unguardedId(e), message: `\`${e.action}\` の${describeEnsure(e).replace(/^⚠ /, "")}` })),
|
|
11
|
+
...(graph.omissions ?? []).map((h) => ({ id: h.id, message: h.message })),
|
|
12
|
+
];
|
|
13
|
+
return {
|
|
14
|
+
pending: items.filter((i) => spec.reviewed[i.id] === undefined),
|
|
15
|
+
acknowledged: items.flatMap((i) => (spec.reviewed[i.id] === undefined ? [] : [{ ...i, note: spec.reviewed[i.id] }])),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Spec } from "../load.js";
|
|
2
|
+
import type { Graph } from "../model.js";
|
|
3
|
+
export interface ActionSummary {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly summary: string | null;
|
|
6
|
+
readonly capable: ReadonlyArray<string>;
|
|
7
|
+
readonly othersReasons: ReadonlyArray<string>;
|
|
8
|
+
readonly when: ReadonlyArray<{
|
|
9
|
+
readonly from: string;
|
|
10
|
+
readonly to: string;
|
|
11
|
+
}>;
|
|
12
|
+
readonly blocked: ReadonlyArray<{
|
|
13
|
+
readonly reason: string;
|
|
14
|
+
readonly states: ReadonlyArray<string>;
|
|
15
|
+
}>;
|
|
16
|
+
readonly effect: ReadonlyArray<{
|
|
17
|
+
readonly field: string;
|
|
18
|
+
readonly values: ReadonlyArray<string>;
|
|
19
|
+
}>;
|
|
20
|
+
readonly inputReasons: ReadonlyArray<{
|
|
21
|
+
readonly input: string;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
}>;
|
|
24
|
+
readonly inputOutcomes: ReadonlyArray<{
|
|
25
|
+
readonly input: string;
|
|
26
|
+
readonly transitions: ReadonlyArray<{
|
|
27
|
+
readonly from: string;
|
|
28
|
+
readonly to: string;
|
|
29
|
+
}>;
|
|
30
|
+
readonly reasons: ReadonlyArray<string>;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface StateSummary {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly label: string;
|
|
36
|
+
readonly initial: boolean;
|
|
37
|
+
readonly terminal: boolean;
|
|
38
|
+
readonly can: ReadonlyArray<{
|
|
39
|
+
readonly action: string;
|
|
40
|
+
readonly actors: ReadonlyArray<string>;
|
|
41
|
+
readonly to: string;
|
|
42
|
+
}>;
|
|
43
|
+
readonly cannot: ReadonlyArray<{
|
|
44
|
+
readonly action: string;
|
|
45
|
+
readonly reason: string;
|
|
46
|
+
}>;
|
|
47
|
+
readonly violations: ReadonlyArray<string>;
|
|
48
|
+
readonly surfaces: ReadonlyArray<{
|
|
49
|
+
readonly actors: ReadonlyArray<string>;
|
|
50
|
+
readonly surface: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
export declare const summarizeActions: (spec: Spec, graph: Graph) => ReadonlyArray<ActionSummary>;
|
|
54
|
+
export declare const summarizeStates: (spec: Spec, graph: Graph) => ReadonlyArray<StateSummary>;
|
|
55
|
+
export declare const presentBlocked: (blocked: ActionSummary["blocked"]) => ReadonlyArray<{
|
|
56
|
+
readonly reason: string;
|
|
57
|
+
readonly states: ReadonlyArray<string> | null;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const formatTransition: (t: {
|
|
60
|
+
readonly from: string;
|
|
61
|
+
readonly to: string;
|
|
62
|
+
}) => string;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ANY, ANY_LABEL, collapseTransitions } from "./collapse.js";
|
|
2
|
+
const ERROR_REASON = "エラー";
|
|
3
|
+
// 「担当者」= どこかの状態で一度でもその操作を実行できた登場人物。
|
|
4
|
+
// 担当者が止められた理由を「いつ」の条件、担当者以外が止められた理由を「誰が」の条件とみなす。
|
|
5
|
+
// spec の書き手に ensure を「権限」「状態」と分類させずに、実行結果だけから両者を分けるため。
|
|
6
|
+
// 担当者がいない操作では、全員の理由を「いつ」の条件として扱う。
|
|
7
|
+
const capableOf = (graph, action) => unique(graph.availability.filter((a) => a.action === action && a.enabled).map((a) => a.actor));
|
|
8
|
+
const whenReason = (graph, state, action, capable) => {
|
|
9
|
+
const entries = graph.availability.filter((a) => a.state === state && a.action === action && (capable.length === 0 || capable.includes(a.actor)));
|
|
10
|
+
return unique(entries.map((a) => a.reason ?? ERROR_REASON)).join("、");
|
|
11
|
+
};
|
|
12
|
+
export const summarizeActions = (spec, graph) => {
|
|
13
|
+
const labelOf = labeler(graph);
|
|
14
|
+
return spec.actions.map(([name]) => {
|
|
15
|
+
const entries = graph.availability.filter((a) => a.action === name);
|
|
16
|
+
const capable = capableOf(graph, name);
|
|
17
|
+
const blocked = new Map();
|
|
18
|
+
for (const state of unique(entries.map((a) => a.state))) {
|
|
19
|
+
if (entries.some((a) => a.state === state && a.enabled))
|
|
20
|
+
continue;
|
|
21
|
+
const reason = whenReason(graph, state, name, capable);
|
|
22
|
+
blocked.set(reason, [...(blocked.get(reason) ?? []), labelOf(state)]);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
name,
|
|
26
|
+
summary: spec.docs[name] ?? null,
|
|
27
|
+
capable,
|
|
28
|
+
othersReasons: capable.length === 0 ? [] : unique(entries.filter((a) => !capable.includes(a.actor)).map((a) => a.reason ?? ERROR_REASON)),
|
|
29
|
+
when: uniqueBy(collapseTransitions(graph)
|
|
30
|
+
.filter((t) => t.action === name)
|
|
31
|
+
.map((t) => ({ from: t.from === ANY ? ANY : labelOf(t.from), to: labelOf(t.to) })), (w) => `${w.from}→${w.to}`),
|
|
32
|
+
blocked: [...blocked.entries()].map(([reason, states]) => ({ reason, states })),
|
|
33
|
+
effect: effectOf(graph, name),
|
|
34
|
+
inputReasons: inputReasonsOf(entries),
|
|
35
|
+
inputOutcomes: inputOutcomesOf(spec, name, entries, labelOf),
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export const summarizeStates = (spec, graph) => {
|
|
40
|
+
const labelOf = labeler(graph);
|
|
41
|
+
return graph.states.map((s) => {
|
|
42
|
+
const can = [];
|
|
43
|
+
const cannot = [];
|
|
44
|
+
for (const [action] of spec.actions) {
|
|
45
|
+
const enabled = graph.availability.filter((a) => a.state === s.id && a.action === action && a.enabled);
|
|
46
|
+
if (enabled.length > 0) {
|
|
47
|
+
for (const to of unique(enabled.map((a) => a.to))) {
|
|
48
|
+
can.push({ action, actors: unique(enabled.filter((a) => a.to === to).map((a) => a.actor)), to: labelOf(to) });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (graph.availability.some((a) => a.state === s.id && a.action === action)) {
|
|
52
|
+
cannot.push({ action, reason: whenReason(graph, s.id, action, capableOf(graph, action)) });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const violations = graph.findings.flatMap((f) => (f.kind === "invariant-violation" && f.state === s.id ? [f.invariant] : []));
|
|
56
|
+
const groups = new Map();
|
|
57
|
+
for (const sf of graph.surfaces.filter((x) => x.state === s.id)) {
|
|
58
|
+
const key = JSON.stringify(sf.surface);
|
|
59
|
+
const g = groups.get(key) ?? { actors: [], surface: sf.surface };
|
|
60
|
+
g.actors.push(sf.actor);
|
|
61
|
+
groups.set(key, g);
|
|
62
|
+
}
|
|
63
|
+
return { id: s.id, label: s.label, initial: s.initial, terminal: s.terminal, can, cannot, violations, surfaces: [...groups.values()] };
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
// 同じ状態・同じ登場人物で、ある入力では成功し別の入力では失敗したときだけ、その失敗を
|
|
67
|
+
// 「入力の条件」とみなす。状態や権限による失敗と混ぜないため。
|
|
68
|
+
const inputReasonsOf = (entries) => {
|
|
69
|
+
const found = entries.filter((a) => !a.enabled &&
|
|
70
|
+
a.input !== null &&
|
|
71
|
+
entries.some((b) => b.enabled && b.state === a.state && b.actor === a.actor));
|
|
72
|
+
return uniqueBy(found.map((a) => ({ input: a.input, reason: a.reason ?? ERROR_REASON })), (r) => `${r.input}|${r.reason}`);
|
|
73
|
+
};
|
|
74
|
+
// 入力ごとに「どこからどこへ移るか」を出す理由: CLI の引数のように入力で結果が大きく変わる操作では、
|
|
75
|
+
// 「できない入力」だけでは、正しい入力でどうなるかが仕様書から読めないため。
|
|
76
|
+
const inputOutcomesOf = (spec, action, entries, labelOf) => (spec.inputs[action] ?? []).map(([input]) => {
|
|
77
|
+
const mine = entries.filter((a) => a.input === input);
|
|
78
|
+
const transitions = uniqueBy(mine.filter((a) => a.enabled).map((a) => ({ from: labelOf(a.state), to: labelOf(a.to) })), (t) => `${t.from}→${t.to}`);
|
|
79
|
+
if (transitions.length > 0)
|
|
80
|
+
return { input, transitions, reasons: [] };
|
|
81
|
+
// 入力が原因の理由を優先する理由: 全員が状態や権限で止まる理由まで並べると、その入力の何がだめなのかが埋もれるため。
|
|
82
|
+
const byInput = inputReasonsOf(entries).filter((r) => r.input === input).map((r) => r.reason);
|
|
83
|
+
const reasons = byInput.length > 0 ? byInput : unique(mine.map((a) => a.reason ?? ERROR_REASON));
|
|
84
|
+
return { input, transitions, reasons };
|
|
85
|
+
});
|
|
86
|
+
const REST_THRESHOLD = 3;
|
|
87
|
+
// 一番多いまとまりを「それ以外」とまとめる理由: できないときの状態は、たいてい「できるとき」の補集合で、
|
|
88
|
+
// すべて並べると状態名の壁になり、何が条件なのかが読めなくなるため。少ないときはそのまま並べる。
|
|
89
|
+
export const presentBlocked = (blocked) => {
|
|
90
|
+
if (blocked.length === 0)
|
|
91
|
+
return [];
|
|
92
|
+
const largest = blocked.reduce((a, b) => (b.states.length > a.states.length ? b : a));
|
|
93
|
+
if (largest.states.length < REST_THRESHOLD)
|
|
94
|
+
return blocked;
|
|
95
|
+
return [...blocked.filter((b) => b !== largest), { reason: largest.reason, states: null }];
|
|
96
|
+
};
|
|
97
|
+
export const formatTransition = (t) => t.from === ANY ? `${ANY_LABEL} → ${t.to}` : t.from === t.to ? `${t.from}(変わらない)` : `${t.from} → ${t.to}`;
|
|
98
|
+
const effectOf = (graph, action) => {
|
|
99
|
+
const changed = new Map();
|
|
100
|
+
for (const t of graph.transitions) {
|
|
101
|
+
if (t.action !== action)
|
|
102
|
+
continue;
|
|
103
|
+
const from = graph.states.find((s) => s.id === t.from).values;
|
|
104
|
+
const to = graph.states.find((s) => s.id === t.to).values;
|
|
105
|
+
for (const k of Object.keys(to)) {
|
|
106
|
+
if (JSON.stringify(from[k]) === JSON.stringify(to[k]))
|
|
107
|
+
continue;
|
|
108
|
+
if (!changed.has(k))
|
|
109
|
+
changed.set(k, new Set());
|
|
110
|
+
changed.get(k).add(typeof to[k] === "string" ? to[k] : JSON.stringify(to[k]));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return [...changed.entries()].map(([field, values]) => ({ field, values: [...values] }));
|
|
114
|
+
};
|
|
115
|
+
const labeler = (graph) => (id) => graph.states.find((s) => s.id === id)?.label ?? id;
|
|
116
|
+
const unique = (xs) => [...new Set(xs)];
|
|
117
|
+
const uniqueBy = (xs, key) => [
|
|
118
|
+
...new Map(xs.map((x) => [key(x), x])).values(),
|
|
119
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Graph } from "../model.js";
|
|
2
|
+
export type DiffStatus = "added" | "removed" | "kept";
|
|
3
|
+
export type EdgeStatus = DiffStatus | "changed";
|
|
4
|
+
export interface UnionNode {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly status: DiffStatus;
|
|
8
|
+
readonly initial: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UnionEdge {
|
|
11
|
+
readonly from: string;
|
|
12
|
+
readonly to: string;
|
|
13
|
+
readonly action: string;
|
|
14
|
+
/** changed は、遷移はあるが通れる人が変わったもの */
|
|
15
|
+
readonly status: EdgeStatus;
|
|
16
|
+
readonly actorsAdded: ReadonlyArray<string>;
|
|
17
|
+
readonly actorsRemoved: ReadonlyArray<string>;
|
|
18
|
+
}
|
|
19
|
+
export declare const unionGraph: (before: Graph | null, after: Graph | null) => {
|
|
20
|
+
nodes: UnionNode[];
|
|
21
|
+
edges: UnionEdge[];
|
|
22
|
+
};
|
|
23
|
+
export declare const edgeLabel: (e: UnionEdge) => string;
|