@yutaura/live-spec 0.1.0 → 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 +1 -1
- package/README.md +12 -2
- package/dist/cli.js +49 -10
- package/dist/diff.d.ts +92 -2
- package/dist/diff.js +101 -64
- package/dist/ensure-scope.d.ts +9 -0
- package/dist/ensure-scope.js +81 -0
- package/dist/ensure.d.ts +4 -0
- package/dist/ensure.js +27 -2
- package/dist/explore.d.ts +20 -1
- package/dist/explore.js +34 -12
- package/dist/generate.d.ts +6 -0
- package/dist/generate.js +16 -4
- package/dist/load.d.ts +7 -1
- package/dist/load.js +5 -0
- package/dist/model.d.ts +85 -0
- package/dist/model.js +34 -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/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/html.d.ts +1 -0
- package/dist/render/html.js +42 -10
- package/dist/render/layout.d.ts +2 -0
- package/dist/render/layout.js +1 -1
- package/dist/render/markdown.js +24 -3
- package/dist/render/review.d.ts +17 -0
- package/dist/render/review.js +17 -0
- package/dist/render/union.d.ts +23 -0
- package/dist/render/union.js +43 -0
- package/dist/spec-loader.d.ts +2 -0
- package/dist/spec-loader.js +24 -0
- package/dist/static.d.ts +5 -0
- package/dist/static.js +34 -0
- package/package.json +7 -1
- package/skills/live-spec-authoring/SKILL.md +32 -2
- package/skills/live-spec-review/SKILL.md +16 -10
package/dist/render/html.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { describeEnsure } from "./ensures.js";
|
|
2
|
+
import { REVIEW_LEAD, REVIEW_TITLE, reviewItems, unguardedId } from "./review.js";
|
|
1
3
|
import { ANY } from "./collapse.js";
|
|
2
4
|
import { esc } from "./escape.js";
|
|
3
5
|
import { layout } from "./layout.js";
|
|
@@ -142,9 +144,11 @@ const renderPage = async ({ spec, graph }, index, objects, links) => {
|
|
|
142
144
|
<ol class="storyboard">${s.steps
|
|
143
145
|
.map((st) => {
|
|
144
146
|
const shown = st.to === null ? undefined : graph.surfaces.find((x) => x.state === st.to && x.actor === st.actor);
|
|
145
|
-
return `<li class="${st.ok ? "" : "failed"}"><p class="step">${esc(describeStep(spec, st))}</p>${st.ok
|
|
146
|
-
? `<p class="flow"
|
|
147
|
-
:
|
|
147
|
+
return `<li class="${st.ok ? "" : "failed"}"><p class="step">${esc(describeStep(spec, st))}</p>${st.ok && st.denied
|
|
148
|
+
? `<p class="flow">断られる(${esc(st.reason ?? "")})</p>`
|
|
149
|
+
: st.ok
|
|
150
|
+
? `<p class="flow">${esc(labelOf(st.from ?? ""))} → ${esc(labelOf(st.to ?? ""))}</p>`
|
|
151
|
+
: `<p class="reason">❌ ${esc(st.reason ?? "")}</p>`}${shown === undefined ? "" : `<div class="frame"><div class="frame-inner">${surfaceToHtml(shown.surface, notAllowed(st.to, [st.actor]))}</div></div>`}</li>`;
|
|
148
152
|
})
|
|
149
153
|
.join("")}</ol>
|
|
150
154
|
</article>`;
|
|
@@ -198,6 +202,7 @@ const renderPage = async ({ spec, graph }, index, objects, links) => {
|
|
|
198
202
|
.map((q) => `<li><span class="ask">${esc(q.ask)}</span><span class="target">${esc(questionTarget(spec, q, labelOf))}</span>${q.note === null ? "" : `<span class="note">${esc(q.note)}</span>`}</li>`)
|
|
199
203
|
.join("")}</ol>
|
|
200
204
|
</section>`}
|
|
205
|
+
${reviewHtml(spec, graph)}
|
|
201
206
|
<section class="board" aria-label="状態遷移図" data-mode="states">
|
|
202
207
|
<p class="hint">状態をクリックすると、その状態でできること・できないことを表示します。矢印のラベルや操作カードをクリックすると、その操作の遷移を強調します。Esc で解除。</p>
|
|
203
208
|
${wl === null
|
|
@@ -219,7 +224,7 @@ const renderPage = async ({ spec, graph }, index, objects, links) => {
|
|
|
219
224
|
<section class="actions">
|
|
220
225
|
<h2>操作</h2>
|
|
221
226
|
<div class="cards">
|
|
222
|
-
${actions.map((a) => actionCard(a, asksOf(a.name), linksOf(a.name), spec.evidence[a.name] ?? [])).join("\n ")}
|
|
227
|
+
${actions.map((a) => actionCard(a, asksOf(a.name), linksOf(a.name), spec.evidence[a.name] ?? [], (graph.ensures ?? []).filter((e) => e.action === a.name), spec.reviewed)).join("\n ")}
|
|
223
228
|
</div>
|
|
224
229
|
</section>
|
|
225
230
|
${graph.decisions.length === 0
|
|
@@ -319,7 +324,23 @@ const edgeSvg = (e, markerId) => {
|
|
|
319
324
|
const lb = e.label;
|
|
320
325
|
return `<g class="edge" data-action="${esc(e.action)}" data-from="${esc(e.from)}" data-to="${esc(e.to)}"><path d="${d}" marker-end="url(#${markerId})"/><g class="edge-label"><rect x="${lb.x}" y="${lb.y}" width="${lb.width}" height="${lb.height}" rx="4"/><text x="${lb.x + lb.width / 2}" y="${lb.y + lb.height / 2}">${esc(e.action)}</text></g></g>`;
|
|
321
326
|
};
|
|
322
|
-
|
|
327
|
+
// 確かめてほしい点の文は Markdown と共通なので、バッククォートで囲んだ部分を HTML ではコードとして出す。
|
|
328
|
+
const withCode = (text) => esc(text).replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
329
|
+
const reviewHtml = (spec, graph) => {
|
|
330
|
+
const { pending, acknowledged } = reviewItems(spec, graph);
|
|
331
|
+
if (pending.length + acknowledged.length === 0)
|
|
332
|
+
return "";
|
|
333
|
+
return `<section class="questions review${pending.length === 0 ? " done" : ""}" aria-label="${REVIEW_TITLE}">
|
|
334
|
+
<h2>${REVIEW_TITLE}</h2>
|
|
335
|
+
${pending.length === 0
|
|
336
|
+
? '<p class="note">確かめてほしい点はありません。</p>'
|
|
337
|
+
: `<p class="note">${withCode(REVIEW_LEAD)}</p><ol>${pending.map((i) => `<li><span class="ask">${withCode(i.message)}</span> <code class="review-id">${esc(i.id)}</code></li>`).join("")}</ol>`}
|
|
338
|
+
${acknowledged.length === 0
|
|
339
|
+
? ""
|
|
340
|
+
: `<details class="acknowledged"><summary>確認済み(${acknowledged.length} 件)</summary><ul>${acknowledged.map((i) => `<li><code class="review-id">${esc(i.id)}</code> ${esc(i.note)}</li>`).join("")}</ul></details>`}
|
|
341
|
+
</section>`;
|
|
342
|
+
};
|
|
343
|
+
const actionCard = (a, asks, links, evidence, ensures, reviewed) => {
|
|
323
344
|
const others = a.othersReasons.length === 0 ? "" : `<span class="muted">ほかの人は「${a.othersReasons.map(esc).join("」「")}」</span>`;
|
|
324
345
|
const who = a.capable.length === 0
|
|
325
346
|
? '<span class="muted">なし(どの状態でも誰も実行できない)</span>'
|
|
@@ -347,6 +368,14 @@ const actionCard = (a, asks, links, evidence) => {
|
|
|
347
368
|
})
|
|
348
369
|
.join("")}</dd>`}
|
|
349
370
|
${links.length === 0 ? "" : `<dt>つながり</dt><dd>${links.map((l) => `<span class="flow">→ ${objectLink(l.to)}${l.action === null ? "" : ` の ${esc(l.action)}`}</span>`).join("")}<span class="muted">${esc(links.map((l) => l.label).join(" / "))}</span></dd>`}
|
|
371
|
+
${ensures.length === 0
|
|
372
|
+
? ""
|
|
373
|
+
: `<dt>条件</dt><dd><ul>${ensures
|
|
374
|
+
.map((e) => {
|
|
375
|
+
const acknowledged = reviewed[unguardedId(e)] !== undefined;
|
|
376
|
+
return `<li class="ensure ${e.verdict}${acknowledged ? " acknowledged" : ""}">${esc(describeEnsure(e, acknowledged))}</li>`;
|
|
377
|
+
})
|
|
378
|
+
.join("")}</ul></dd>`}
|
|
350
379
|
${asks.length === 0 ? "" : `<dt>未決</dt><dd><ul>${asks.map((q) => `<li class="ask">${esc(q)}</li>`).join("")}</ul></dd>`}
|
|
351
380
|
</dl>
|
|
352
381
|
</article>`;
|
|
@@ -357,7 +386,7 @@ const jsonForScript = (data) => JSON.stringify(data)
|
|
|
357
386
|
.replace(/</g, "\\u003c")
|
|
358
387
|
.replace(/\u{2028}/gu, "\\u2028")
|
|
359
388
|
.replace(/\u{2029}/gu, "\\u2029");
|
|
360
|
-
const CSS = `
|
|
389
|
+
export const CSS = `
|
|
361
390
|
:root{--bg:#f6f5f1;--fg:#1c1c1e;--muted:#6e6d72;--line:#d9d6cd;--card:#fff;--node:#fff;--accent:#2b59e0;--accent-weak:#e5ebfc;--ok:#1d7f48;--warn:#b3501a;--chip:#efeee9}
|
|
362
391
|
@media (prefers-color-scheme:dark){:root{--bg:#141416;--fg:#ececee;--muted:#9a99a0;--line:#34343a;--card:#1c1c20;--node:#1f1f24;--accent:#7f9dff;--accent-weak:#232b45;--ok:#5cc98b;--warn:#f0a46b;--chip:#2a2a30}}
|
|
363
392
|
*{box-sizing:border-box}
|
|
@@ -448,16 +477,16 @@ marker path{fill:var(--muted)}
|
|
|
448
477
|
.edge.is-active path{stroke:var(--accent);stroke-width:2.2}
|
|
449
478
|
.edge.is-active .edge-label text{fill:var(--accent);font-weight:600}
|
|
450
479
|
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px}
|
|
451
|
-
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:18px 20px;cursor:pointer;outline:none}
|
|
480
|
+
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:18px 20px;cursor:pointer;outline:none;min-width:0}
|
|
452
481
|
.card:hover,.card:focus-visible{border-color:var(--accent)}
|
|
453
482
|
.card.is-selected{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-weak)}
|
|
454
483
|
.card h3{margin:0 0 12px;font-size:16px}
|
|
455
|
-
.card dl{display:grid;grid-template-columns:5.5em 1fr;gap:8px 12px;margin:0;font-size:14px}
|
|
484
|
+
.card dl{display:grid;grid-template-columns:5.5em minmax(0,1fr);gap:8px 12px;margin:0;font-size:14px}
|
|
456
485
|
.card dt{color:var(--muted);font-size:12.5px;padding-top:2px}
|
|
457
|
-
.card dd{margin:0}
|
|
486
|
+
.card dd{margin:0;min-width:0;overflow-wrap:anywhere}
|
|
458
487
|
.card ul{margin:0;padding:0;list-style:none}
|
|
459
488
|
.card li+li{margin-top:6px}
|
|
460
|
-
.chip,.state,.flow{display:inline-block;font-size:12.5px;border-radius:6px;padding:0 7px;margin:0 4px 4px 0;background:var(--chip)}
|
|
489
|
+
.chip,.state,.flow{display:inline-block;max-width:100%;font-size:12.5px;border-radius:6px;padding:0 7px;margin:0 4px 4px 0;background:var(--chip)}
|
|
461
490
|
.flow{background:var(--accent-weak)}
|
|
462
491
|
.questions{border:1px solid var(--warn);border-radius:14px;padding:4px 20px 12px;margin:0 0 20px;background:var(--card)}
|
|
463
492
|
.questions h2{margin:14px 0 8px;color:var(--warn);font-size:16px}
|
|
@@ -466,6 +495,9 @@ marker path{fill:var(--muted)}
|
|
|
466
495
|
.questions .ask{font-weight:600}
|
|
467
496
|
.questions .target{color:var(--muted);font-size:13px;margin-left:4px}
|
|
468
497
|
.questions .note{display:block;color:var(--muted);font-size:13px}
|
|
498
|
+
.questions.review.done{border-color:var(--line)}.questions.review.done h2{color:var(--muted)}.ensure.unguarded.acknowledged{color:var(--muted);font-weight:400;font-size:12.5px}
|
|
499
|
+
.review-id{font-size:11.5px;color:var(--muted);margin-left:4px}.acknowledged{margin:8px 0 4px;font-size:13px}.acknowledged summary{cursor:pointer;color:var(--muted)}
|
|
500
|
+
.ensure{font-size:12.5px;margin:2px 0;color:var(--muted)}.ensure.unguarded{color:var(--warn);font-weight:600;font-size:13px}
|
|
469
501
|
.q-badge{display:inline-block;font-size:11px;font-weight:600;padding:1px 8px;border-radius:999px;background:var(--warn);color:var(--bg);vertical-align:middle}
|
|
470
502
|
.card .ask{color:var(--warn);font-size:13px}
|
|
471
503
|
.q-mark circle{fill:var(--warn)}
|
package/dist/render/layout.d.ts
CHANGED
|
@@ -33,5 +33,7 @@ export interface LayoutOptions {
|
|
|
33
33
|
readonly width: number;
|
|
34
34
|
readonly height: number;
|
|
35
35
|
};
|
|
36
|
+
/** false にすると「どの状態からでも」にまとめない(差分の図で、消えた遷移まで見せるため) */
|
|
37
|
+
readonly collapse?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export declare const layout: (graph: Graph, options?: LayoutOptions) => Promise<Layout>;
|
package/dist/render/layout.js
CHANGED
|
@@ -29,7 +29,7 @@ const ELK = ElkModule.default;
|
|
|
29
29
|
export const layout = async (graph, options = {}) => {
|
|
30
30
|
const elk = new ELK();
|
|
31
31
|
// 自分自身に戻る遷移は描かない。ほぼすべての状態にあると、図が線で埋まって読めなくなるため。
|
|
32
|
-
const transitions = collapseTransitions(graph).filter((t) => t.from !== t.to);
|
|
32
|
+
const transitions = (options.collapse === false ? graph.transitions : collapseTransitions(graph)).filter((t) => t.from !== t.to);
|
|
33
33
|
const hasAny = transitions.some((t) => t.from === ANY);
|
|
34
34
|
const nodeList = [
|
|
35
35
|
...(hasAny ? [{ id: ANY, label: ANY_LABEL, initial: false }] : []),
|
package/dist/render/markdown.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { describeEnsure } from "./ensures.js";
|
|
2
|
+
import { REVIEW_LEAD, REVIEW_TITLE, reviewItems, unguardedId } from "./review.js";
|
|
1
3
|
import { ANY, ANY_LABEL, collapseTransitions } from "./collapse.js";
|
|
2
4
|
import { formatTransition, presentBlocked, summarizeActions, summarizeStates } from "./summary.js";
|
|
3
5
|
import { surfaceToText } from "./wireframe.js";
|
|
@@ -47,6 +49,7 @@ export const renderMarkdown = (spec, graph, objects = [{ spec, graph }]) => {
|
|
|
47
49
|
]),
|
|
48
50
|
"",
|
|
49
51
|
]),
|
|
52
|
+
...reviewSection(spec, graph),
|
|
50
53
|
"## 状態遷移図",
|
|
51
54
|
"",
|
|
52
55
|
"```mermaid",
|
|
@@ -68,6 +71,7 @@ export const renderMarkdown = (spec, graph, objects = [{ spec, graph }]) => {
|
|
|
68
71
|
...actionSection(a),
|
|
69
72
|
...((spec.evidence[a.name] ?? []).length === 0 ? [] : [`- **根拠**: ${spec.evidence[a.name].map(formatEvidence).join("、")}`]),
|
|
70
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),
|
|
71
75
|
"",
|
|
72
76
|
]),
|
|
73
77
|
...(graph.links.length + incoming.length === 0
|
|
@@ -88,6 +92,19 @@ export const renderMarkdown = (spec, graph, objects = [{ spec, graph }]) => {
|
|
|
88
92
|
"",
|
|
89
93
|
].join("\n");
|
|
90
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
|
+
};
|
|
91
108
|
const actionSection = (a) => {
|
|
92
109
|
const heading = a.summary === null ? `### \`${a.name}\`` : `### ${a.summary}(\`${a.name}\`)`;
|
|
93
110
|
if (a.capable.length === 0)
|
|
@@ -182,9 +199,11 @@ export const describeStep = (spec, step) => {
|
|
|
182
199
|
const scenarioSection = (spec, s, labelOf) => [
|
|
183
200
|
`### ${s.passed ? "✅" : "❌"} ${s.name}`,
|
|
184
201
|
"",
|
|
185
|
-
...s.steps.map((step, i) => step.ok
|
|
186
|
-
? `${i + 1}. ${describeStep(spec, step)}:
|
|
187
|
-
:
|
|
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}`),
|
|
188
207
|
];
|
|
189
208
|
export const formatEffect = (a) => a.effect.map((e) => `${e.field} → ${e.values.join(" / ")}`).join(", ");
|
|
190
209
|
export const describeFinding = (f, labelOf) => {
|
|
@@ -205,6 +224,8 @@ export const describeFinding = (f, labelOf) => {
|
|
|
205
224
|
return `操作 ${f.action} は 3 つ目以降の引数をとるが、inputs に例がないので実行していない`;
|
|
206
225
|
case "unknown-inputs":
|
|
207
226
|
return `inputs に書かれた ${f.action} という操作は存在しない`;
|
|
227
|
+
case "reviewed-unmatched":
|
|
228
|
+
return `reviewed に書かれた ${f.id} は、確かめてほしい点のどれにも当たらない(ID の書き間違いか、もう出なくなった候補)`;
|
|
208
229
|
case "surface-action-not-allowed":
|
|
209
230
|
return `${labelOf(f.state)} で ${f.actor} に ${f.action} のボタンが見えているが、実行できない`;
|
|
210
231
|
case "surface-action-missing":
|
|
@@ -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,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;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// 状態は値で突き合わせる(ID は探索順で、名前は initial の書き順で変わりうる)。
|
|
2
|
+
// 自分自身に戻る遷移は、通常の図と同じく描かない。
|
|
3
|
+
export const unionGraph = (before, after) => {
|
|
4
|
+
const keyOf = (s) => JSON.stringify(s.values);
|
|
5
|
+
const labelsOf = (g) => new Map((g?.states ?? []).map((s) => [s.id, keyOf(s)]));
|
|
6
|
+
const lb = labelsOf(before);
|
|
7
|
+
const la = labelsOf(after);
|
|
8
|
+
const beforeKeys = new Set(lb.values());
|
|
9
|
+
const afterKeys = new Set(la.values());
|
|
10
|
+
const ordered = [...new Set([...afterKeys, ...beforeKeys])];
|
|
11
|
+
// 変更後の名前を優先する理由: レビューする人が読むのは変更後の spec なので。
|
|
12
|
+
const names = new Map([...(before?.states ?? []), ...(after?.states ?? [])].map((s) => [keyOf(s), s.label]));
|
|
13
|
+
const initialState = (after ?? before)?.states.find((s) => s.initial);
|
|
14
|
+
const initialKey = initialState === undefined ? undefined : keyOf(initialState);
|
|
15
|
+
const nodes = ordered.map((key, i) => ({
|
|
16
|
+
id: `n${i}`,
|
|
17
|
+
label: names.get(key) ?? key,
|
|
18
|
+
status: !beforeKeys.has(key) ? "added" : !afterKeys.has(key) ? "removed" : "kept",
|
|
19
|
+
initial: key === initialKey,
|
|
20
|
+
}));
|
|
21
|
+
const idOf = new Map(ordered.map((key, i) => [key, nodes[i].id]));
|
|
22
|
+
const actorsByKey = (g, labels) => {
|
|
23
|
+
const map = new Map();
|
|
24
|
+
for (const t of (g?.transitions ?? []).filter((t) => t.from !== t.to)) {
|
|
25
|
+
const key = JSON.stringify([labels.get(t.from), t.action, labels.get(t.to)]);
|
|
26
|
+
map.set(key, new Set([...(map.get(key) ?? []), ...t.actors]));
|
|
27
|
+
}
|
|
28
|
+
return map;
|
|
29
|
+
};
|
|
30
|
+
const kb = actorsByKey(before, lb);
|
|
31
|
+
const ka = actorsByKey(after, la);
|
|
32
|
+
const edges = [...new Set([...ka.keys(), ...kb.keys()])].map((key) => {
|
|
33
|
+
const [from, action, to] = JSON.parse(key);
|
|
34
|
+
const b = kb.get(key);
|
|
35
|
+
const a = ka.get(key);
|
|
36
|
+
const actorsAdded = b === undefined || a === undefined ? [] : [...a].filter((x) => !b.has(x));
|
|
37
|
+
const actorsRemoved = b === undefined || a === undefined ? [] : [...b].filter((x) => !a.has(x));
|
|
38
|
+
const status = b === undefined ? "added" : a === undefined ? "removed" : actorsAdded.length + actorsRemoved.length > 0 ? "changed" : "kept";
|
|
39
|
+
return { from: idOf.get(from), to: idOf.get(to), action, status, actorsAdded, actorsRemoved };
|
|
40
|
+
});
|
|
41
|
+
return { nodes, edges };
|
|
42
|
+
};
|
|
43
|
+
export const edgeLabel = (e) => [e.action, ...e.actorsAdded.map((a) => `+${a}`), ...e.actorsRemoved.map((a) => `-${a}`)].join(" ");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { registerHooks } from "node:module";
|
|
2
|
+
// ファイル名に .spec. を含む .ts。差分やミューテーションで書き出す一時ファイル(.order.spec.live-spec-base.ts など)も含む。
|
|
3
|
+
export const isSpecModuleUrl = (url) => {
|
|
4
|
+
if (!url.startsWith("file:"))
|
|
5
|
+
return false;
|
|
6
|
+
const path = new URL(url).pathname;
|
|
7
|
+
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
8
|
+
return base.endsWith(".ts") && base.includes(".spec.");
|
|
9
|
+
};
|
|
10
|
+
let registered = false;
|
|
11
|
+
// spec を TypeScript の ES module として読むよう Node に伝える。
|
|
12
|
+
// 伝えないと、package.json に "type": "module" が無いプロジェクト(pnpm workspace のルートなど)では、
|
|
13
|
+
// Node が CommonJS として読もうとして失敗し、spec ごとに MODULE_TYPELESS_PACKAGE_JSON の警告を出す。
|
|
14
|
+
// 利用者に package.json を足してもらう回避策にしない理由: ルートに "type" を足すと、既存の CommonJS の設定ファイルを壊しうる。
|
|
15
|
+
export const registerSpecLoader = () => {
|
|
16
|
+
if (registered)
|
|
17
|
+
return;
|
|
18
|
+
registered = true;
|
|
19
|
+
registerHooks({
|
|
20
|
+
load(url, context, nextLoad) {
|
|
21
|
+
return nextLoad(url, isSpecModuleUrl(url) ? { ...context, format: "module-typescript" } : context);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
package/dist/static.d.ts
CHANGED
|
@@ -6,5 +6,10 @@ export interface StaticInfo {
|
|
|
6
6
|
readonly stateDoc: string | null;
|
|
7
7
|
readonly fieldDocs: Readonly<Record<string, string>>;
|
|
8
8
|
readonly evidence: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
9
|
+
readonly ensures: Readonly<Record<string, ReadonlyArray<EnsureCall>>>;
|
|
10
|
+
}
|
|
11
|
+
export interface EnsureCall {
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
readonly line: number;
|
|
9
14
|
}
|
|
10
15
|
export declare const analyze: (source: string) => StaticInfo;
|
package/dist/static.js
CHANGED
|
@@ -9,6 +9,7 @@ export const analyze = (source) => {
|
|
|
9
9
|
const body = file.program.body;
|
|
10
10
|
const comments = file.comments ?? [];
|
|
11
11
|
const evidence = {};
|
|
12
|
+
const ensures = {};
|
|
12
13
|
const order = [];
|
|
13
14
|
const docs = {};
|
|
14
15
|
const types = new Map();
|
|
@@ -41,6 +42,9 @@ export const analyze = (source) => {
|
|
|
41
42
|
});
|
|
42
43
|
if (found.length > 0)
|
|
43
44
|
evidence[name] = found;
|
|
45
|
+
const calls = ensureCallsIn(decl);
|
|
46
|
+
if (calls.length > 0)
|
|
47
|
+
ensures[name] = calls;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
const stateType = initialType === null ? undefined : types.get(initialType);
|
|
@@ -51,8 +55,38 @@ export const analyze = (source) => {
|
|
|
51
55
|
stateDoc: stateType?.doc ?? null,
|
|
52
56
|
fieldDocs: stateType === undefined ? {} : fieldDocsOf(stateType.members),
|
|
53
57
|
evidence,
|
|
58
|
+
ensures,
|
|
54
59
|
};
|
|
55
60
|
};
|
|
61
|
+
// 理由が文字列リテラル(または式を含まないテンプレート)の ensure だけを集める。
|
|
62
|
+
// 理由を式で組み立てている ensure は、どの理由のときに外せばよいかを実行前に決められないため。
|
|
63
|
+
const ensureCallsIn = (root) => {
|
|
64
|
+
const calls = [];
|
|
65
|
+
const visit = (node) => {
|
|
66
|
+
if (Array.isArray(node))
|
|
67
|
+
return node.forEach(visit);
|
|
68
|
+
if (typeof node !== "object" || node === null || !("type" in node))
|
|
69
|
+
return;
|
|
70
|
+
const n = node;
|
|
71
|
+
if (n.type === "CallExpression" && n.callee.type === "Identifier" && n.callee.name === "ensure") {
|
|
72
|
+
const arg = n.arguments[1];
|
|
73
|
+
const reason = arg?.type === "StringLiteral"
|
|
74
|
+
? arg.value
|
|
75
|
+
: arg?.type === "TemplateLiteral" && arg.expressions.length === 0
|
|
76
|
+
? arg.quasis.map((q) => q.value.cooked ?? "").join("")
|
|
77
|
+
: null;
|
|
78
|
+
if (reason !== null && n.loc != null)
|
|
79
|
+
calls.push({ reason, line: n.loc.start.line });
|
|
80
|
+
}
|
|
81
|
+
for (const [key, value] of Object.entries(n)) {
|
|
82
|
+
if (key === "loc" || key.endsWith("Comments"))
|
|
83
|
+
continue;
|
|
84
|
+
visit(value);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
visit(root);
|
|
88
|
+
return calls;
|
|
89
|
+
};
|
|
56
90
|
const valueNamesOf = (decl) => {
|
|
57
91
|
if (decl.type === "FunctionDeclaration" && decl.id != null)
|
|
58
92
|
return [[decl.id.name, null]];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yutaura/live-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "AI が書き、人が見て理解できる「生きた仕様書」を作るツール。素の TypeScript で書いた仕様を実行し、状態遷移図・画面・できる/できない理由・検査結果をまとめた仕様書を生成する",
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"spec-driven-development",
|
|
12
12
|
"wireframe"
|
|
13
13
|
],
|
|
14
|
+
"homepage": "https://github.com/yutaura-dev/live-spec#readme",
|
|
15
|
+
"bugs": "https://github.com/yutaura-dev/live-spec/issues",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/yutaura-dev/live-spec.git"
|
|
19
|
+
},
|
|
14
20
|
"exports": {
|
|
15
21
|
".": {
|
|
16
22
|
"types": "./dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@ live-spec は npm パッケージ `@yutaura/live-spec`(`npm i -D @yutaura/live
|
|
|
16
16
|
| Markdown を見る | `npx live-spec specs/`(spec が 1 つなら標準出力、複数なら `--out <ディレクトリ>`) |
|
|
17
17
|
| HTML を書き出す | `npx live-spec specs/ --html --out spec.html` |
|
|
18
18
|
| ブラウザで見ながら書く | `npx live-spec specs/ --serve` |
|
|
19
|
-
| 変更前と比べる | `npx live-spec diff
|
|
19
|
+
| 変更前と比べる | `npx live-spec diff specs/ [--base <リビジョン>] [--head <リビジョン>] [--html --out <file>]` |
|
|
20
20
|
|
|
21
21
|
(live-spec リポジトリ自身の中では `pnpm spec ...`)
|
|
22
22
|
|
|
@@ -43,7 +43,7 @@ npx tsc --noEmit --ignoreConfig --strict --module nodenext --moduleResolution no
|
|
|
43
43
|
| `invariants` | | 不変条件。`{ 説明: (状態) => boolean }` |
|
|
44
44
|
| `inputs` | | 3 つ目以降の引数の例。`{ 操作名: { 例の名前: [引数...] } }` |
|
|
45
45
|
| `surface` | | `(状態, 登場人物) => 画面 \| null` |
|
|
46
|
-
| `scenarios` | | `{ 名前: [{ do: 操作, by: "登場人物", input?: "例の名前", expect?: { 項目: 値 } }] }` |
|
|
46
|
+
| `scenarios` | | `{ 名前: [{ do: 操作, by: "登場人物", input?: "例の名前", expect?: { 項目: 値 }, denied?: "理由" }] }`。`denied` は「この手順は断られるはず」 |
|
|
47
47
|
| `questions` | | `[{ ask, about?: 操作 \| { 項目: 値 }, note? }]` |
|
|
48
48
|
| `links` | | `[{ from?: 操作, to: "相手の名前", action?: "相手の操作名", label }]` |
|
|
49
49
|
| `decisions` | | `{ 名前: { decide: (入力) => 結果, cases: [{ input, expect? }] } }` |
|
|
@@ -60,6 +60,7 @@ npx tsc --noEmit --ignoreConfig --strict --module nodenext --moduleResolution no
|
|
|
60
60
|
- 独立した項目(例: サーバの状態 × ブラウザのタブの状態 × 生成の結果)を 1 つの状態にまとめると、状態が組み合わせの数だけ増え、名前も `none · placeholder · listening · stale` のような読めないものになる。項目ごとに、それを持つドメインオブジェクトへ分ける
|
|
61
61
|
- 分けたオブジェクトどうしの関係(「サーバが止まるとタブは古いまま残る」など)は、それぞれの spec の操作・条件・JSDoc に書く。1 つの状態機械にまとめ直さない
|
|
62
62
|
- 状態の名前(ラベル)は、文字列の項目の値がそのまま使われる。`status: "受付待ち"` のように、読み手の言葉で値を付ける
|
|
63
|
+
- 名前に並ぶ項目は、`initial` に書いた順になる。読み手に最初に見せたい項目(ふつうは `status`)を先に書く
|
|
63
64
|
|
|
64
65
|
### 1. 状態には「振る舞いを変える値」だけを入れる
|
|
65
66
|
|
|
@@ -119,6 +120,8 @@ export const actors = {
|
|
|
119
120
|
|
|
120
121
|
状態の一覧だけでは業務の流れが読めない。代表的な流れ(正常系 1〜2 本と、差し戻し・やり直しのような分岐 1〜2 本)を `scenarios` に書く。各段階には操作の**関数**を渡し、要所に `expect` を書く。シナリオは初期状態から実行され、止まったり期待と違ったりすると検査結果に出るので、受け入れテストを兼ねる。シナリオ名は業務の言葉で(「書いて公開するまで」)。
|
|
121
122
|
|
|
123
|
+
「できない」ことも、大事なものはシナリオに書く。手順に `denied: "理由"` を付けると「この手順は、この理由で断られるはず」という意味になり、実行できてしまうとシナリオが失敗する(`{ do: reject, by: "編集者eve", input: "理由が空", denied: "差し戻し理由が必要" }`)。入力の検証(「--html と --json は同時に指定できない」)や「誰が」の条件は、状態についての条件ではないので不変条件では書けない。こうした条件の意図は `denied` で書く。
|
|
124
|
+
|
|
122
125
|
### 8. 判断できないことは未決事項にする
|
|
123
126
|
|
|
124
127
|
要件やコードから決められないこと(「アーカイブした記事を戻せるか?」)は、推測で spec に書かずに `questions` に書く。対象の操作(関数)か状態(`{ status: "archived" }`)を `about` に付けると、仕様書の図とカードに印が出る。人は未決事項だけを見れば判断すべき点が分かる。
|
|
@@ -150,6 +153,33 @@ export const actors = {
|
|
|
150
153
|
| ボタンが見えるが実行できない/実行できるがボタンがない | 画面と操作の食い違い | 表示条件を ensure にそろえる。意図的なら `disabled` |
|
|
151
154
|
| 状態数の上限で打ち切り | 値が増え続ける項目がある | その項目を状態から外すか、有限の値に抽象化する |
|
|
152
155
|
|
|
156
|
+
## 「確かめてほしい点」の直し方
|
|
157
|
+
|
|
158
|
+
live-spec は spec を実行した結果から、条件の書き忘れ・書き間違いの候補を、仕様書の上部の「確かめてほしい点」に ID つきで出す。AI が書いた spec の漏れを見つける主な手がかりなので、1 件ずつ次の順で判断する。
|
|
159
|
+
|
|
160
|
+
| 候補 | 疑うこと |
|
|
161
|
+
|---|---|
|
|
162
|
+
| 誰でもできる(`anyone-can`) | 「〜だけ」の書き忘れ |
|
|
163
|
+
| いつでもできる(`anytime`) | 状態の条件の書き忘れ |
|
|
164
|
+
| 入力を見ていない(`ignores-input`) | 入力の検証の書き忘れ |
|
|
165
|
+
| 本人と別人を区別しない(`same-for-similar-actors`) | 「自分の〜だけ」の書き忘れ |
|
|
166
|
+
| 結果がまったく同じ入力の例・登場人物(`indistinguishable-*`) | 例や人を分けるはずの条件の書き忘れ。または、違いを状態として表していない |
|
|
167
|
+
| どの可否にも影響しない項目(`unused-field`) | その項目を使う条件の書き忘れ。または、振る舞いに関係しない値を状態に入れている |
|
|
168
|
+
| 意図がほかに書かれていない条件(`unguarded`) | 外すと振る舞いが変わるのに、不変条件・シナリオ・画面のボタンのどれも気づかない条件 |
|
|
169
|
+
|
|
170
|
+
1. **要件・コードと照らして、本当に漏れか**を確かめる。漏れなら spec を直す
|
|
171
|
+
2. 意図どおりなら、**その意図をもう 1 か所に書けないか**を考える。状態についての性質なら不変条件、入力や「誰が」についてなら `denied` の手順を持つシナリオ(`unguarded` はこれで消える)
|
|
172
|
+
3. それでも意図どおりで、書き足す意味のある性質がないなら、`export const reviewed = { "ID": "理由" }` に理由を書く。仕様書では「確認済み」として理由つきで残る
|
|
173
|
+
4. 判断できないなら、未決事項(`questions`)にする
|
|
174
|
+
|
|
175
|
+
候補を消すためだけに、中身のない不変条件やシナリオを書かない。`reviewed` の理由も「意図どおり」だけで済ませず、なぜそれでよいかを要件の言葉で書く(「カードはどの列からでも動かせる。アーカイブも API では動かせる(未決事項 6)」)。`reviewed` の ID が候補のどれにも当たらなくなると検査結果に出るので、そのときは消す。
|
|
176
|
+
|
|
177
|
+
## 条件の理由と「通るのは」を突き合わせる
|
|
178
|
+
|
|
179
|
+
操作の節の「条件」には、`ensure` ごとに「理由の文 — 通るのは〜のとき」が並ぶ。「通るのは」は、その `ensure` だけを効かせて実行して求めた事実。理由の文と食い違っていれば、条件か理由のどちらかが間違っている(「実行中のときだけ」— 通るのは status が queued のとき)。書き終えたら全部の条件について読み比べる。状態の取り違えのような書き間違いは、ほかの検査ではほとんど見つからない。
|
|
180
|
+
|
|
181
|
+
「外しても振る舞いが変わらない」条件は、ほかの条件と重なっている。できない理由の文言を分けたくて重ねているなら残してよい。そうでなければ消す。
|
|
182
|
+
|
|
153
183
|
## 人への渡し方
|
|
154
184
|
|
|
155
185
|
生成物(HTML)と一緒に、次を短く伝える。人は spec のコードを読まない前提で書く。
|
|
@@ -8,25 +8,29 @@ description: live-spec の spec(*.spec.ts)の変更を、コードの差分
|
|
|
8
8
|
spec の差分(TypeScript の diff)をそのまま読ませても、人には振る舞いの変化が分からない。`ensure` の 1 行の変更が「閲覧者が公開できるようになった」という重大な変化だったりする。この skill では、変更前と変更後の spec をそれぞれ live-spec で**実行**し、結果を比べて「振る舞いの変化」として報告する。
|
|
9
9
|
|
|
10
10
|
## 差分を取る
|
|
11
|
-
|
|
12
|
-
`live-spec diff` を使う。変更前の spec(git のリビジョン時点)と作業ツリーの spec を、どちらも実行して比べる。
|
|
11
|
+
`live-spec diff` を使う。変更前と変更後の spec を、どちらも実行して比べる。ディレクトリを渡せば、ドメインオブジェクトごとに「追加・削除・変更・変化なし」を判定する。
|
|
13
12
|
|
|
14
13
|
```sh
|
|
15
14
|
# 作業ツリーの spec と HEAD を比べる
|
|
16
|
-
npx live-spec diff specs/
|
|
15
|
+
npx live-spec diff specs/
|
|
16
|
+
|
|
17
|
+
# PR のように、ブランチ同士を比べる(--head を省くと作業ツリー)
|
|
18
|
+
npx live-spec diff specs/ --base origin/main --head HEAD
|
|
17
19
|
|
|
18
|
-
#
|
|
19
|
-
npx live-spec diff specs/
|
|
20
|
+
# 人に見せるなら HTML(重ね合わせた状態遷移図と、画面の変更前・変更後が並ぶ)
|
|
21
|
+
npx live-spec diff specs/ --base origin/main --html --out spec-diff.html
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
出力には次が含まれる。状態は値で比べる(ID は探索順で振り直され、名前は `initial` の書き順で変わるため)。
|
|
23
25
|
|
|
26
|
+
- ドメインオブジェクトごとのまとめの表
|
|
27
|
+
- 変更前と変更後を重ねた状態遷移図(増えた・消えた・通れる人が変わった遷移)
|
|
24
28
|
- 操作・状態・遷移の増減
|
|
25
|
-
-
|
|
26
|
-
-
|
|
29
|
+
- できる/できないが入れ替わったもの。できない理由の言い方だけが変わったものは、別にまとめて件数を出す
|
|
30
|
+
- シナリオ・未決事項・検査結果の増減(検査結果は、最短の手順だけが変わったものは差分にしない)
|
|
27
31
|
- 画面が変わった状態と登場人物
|
|
28
32
|
|
|
29
|
-
spec
|
|
33
|
+
spec が相対パスで import している別ファイル(共通の型など)は、変更前の側でも作業ツリーの版が使われる。そのファイルを変えた PR では、差分を割り引いて読む。
|
|
30
34
|
|
|
31
35
|
## 読み方
|
|
32
36
|
|
|
@@ -35,7 +39,9 @@ spec が複数あるときは、変わった spec ごとに実行する(`git d
|
|
|
35
39
|
1. **権限が広がった変化**: ❌ から ✅ に変わった行。特に「誰が」の理由(「編集者だけ」など)が消えたもの。意図しない権限の拡大はバグになりやすい
|
|
36
40
|
2. **消えた状態・遷移**: それまでできた業務ができなくなっていないか
|
|
37
41
|
3. **新しい検査結果**: 不変条件の違反、画面と操作の食い違いなど
|
|
38
|
-
4.
|
|
42
|
+
4. **確かめてほしい点**: 仕様書の上部の一覧(誰でもできる・いつでもできる・本人と別人を区別しない、意図がほかに書かれていない条件、など)。変更で増えたものは、条件の書き忘れの候補として必ず挙げる。`reviewed` に足された理由も、要件として妥当かを確かめる
|
|
43
|
+
5. **理由と「通るのは」の食い違い**: 変更した操作の「条件」の各行で、理由の文と「通るのは〜のとき」を読み比べる。食い違う行は、条件か理由の書き間違いとして必ず挙げる
|
|
44
|
+
6. **画面の変化**: 状態と見る人を挙げ、HTML で確認してもらう(`npx live-spec <dir> --serve` で開き、`#/<名前>/<状態>` で直接開ける)
|
|
39
45
|
|
|
40
46
|
spec のコードの差分(`git diff`)は、変化の理由を説明するときの補足として読む。
|
|
41
47
|
|