@quolu/lattice 0.52.2 → 0.52.4
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/package.json +1 -1
- package/src/artifact-contracts-v2.mjs +325 -325
- package/src/artifact-contracts.mjs +895 -895
- package/src/boundary-compiler.mjs +712 -712
- package/src/boundary-observation-compiler-v2.mjs +344 -344
- package/src/bounded-seam.mjs +230 -230
- package/src/bridge-address.mjs +107 -107
- package/src/bridge-cli.mjs +297 -297
- package/src/bridge-config.mjs +346 -346
- package/src/bridge-daemon.mjs +378 -378
- package/src/bridge-hub-protocol.mjs +198 -0
- package/src/bridge-launch-agent.mjs +323 -323
- package/src/bridge-registrar.mjs +102 -102
- package/src/bridge-server.mjs +376 -376
- package/src/cli-help.mjs +308 -308
- package/src/cli-stdio.mjs +40 -40
- package/src/control-compiler.mjs +532 -532
- package/src/dag-chain.mjs +261 -261
- package/src/factory-diagnostics.mjs +188 -188
- package/src/git-process.mjs +72 -0
- package/src/hash-chain.mjs +76 -76
- package/src/hooks-cli.mjs +1057 -1057
- package/src/isolation-runner.mjs +409 -409
- package/src/node-version-guard.mjs +44 -44
- package/src/project-cli.mjs +699 -697
- package/src/project-identity.mjs +130 -130
- package/src/rc1-black-box-oracle.mjs +906 -906
- package/src/rc1-comparison.mjs +154 -154
- package/src/rc1-evidence-bundle.mjs +456 -456
- package/src/rc1-v4-campaign.mjs +708 -708
- package/src/rc1-v4-transform.mjs +467 -467
- package/src/rc1-v5-artifact-set.mjs +855 -855
- package/src/rc1-v5-behavior-evidence.mjs +594 -594
- package/src/rc1-v5-campaign.mjs +797 -797
- package/src/rc1-v5-transform.mjs +421 -421
- package/src/rc1-v6-artifact-set.mjs +807 -807
- package/src/rc1-v6-behavior-evidence.mjs +273 -273
- package/src/rc1-v6-campaign.mjs +623 -623
- package/src/rc1-v6-causal-binding.mjs +473 -473
- package/src/rc1-v6-measurement.mjs +313 -313
- package/src/rc2-artifact-set.mjs +1584 -1584
- package/src/rc2-campaign.mjs +1506 -1506
- package/src/rc2-delivery-policy-front-end.mjs +1079 -1079
- package/src/rc2-delivery-policy-oracle.mjs +134 -134
- package/src/rc2-delivery-policy-transform.mjs +1127 -1127
- package/src/rc2-rc1-transfer-front-end.mjs +511 -511
- package/src/rc3-actual-dogfood.mjs +652 -652
- package/src/rc3-dogfood-scaffold.mjs +315 -315
- package/src/rc3-scripted-campaign.mjs +1383 -1383
- package/src/rc4-stage1-dogfood.mjs +673 -673
- package/src/runtime-adapter-registry.mjs +524 -524
- package/src/runtime-cli.mjs +4588 -4588
- package/src/runtime-contracts.mjs +824 -824
- package/src/runtime-control-store.mjs +604 -604
- package/src/runtime-controller-protocol.mjs +587 -587
- package/src/runtime-decision-verifier.mjs +701 -701
- package/src/runtime-diff-observer.mjs +361 -361
- package/src/runtime-direct-os-observer.mjs +301 -301
- package/src/runtime-driver-state.mjs +166 -166
- package/src/runtime-engine.mjs +779 -779
- package/src/runtime-errors.mjs +356 -356
- package/src/runtime-event-store.mjs +189 -189
- package/src/runtime-front-end.mjs +925 -925
- package/src/runtime-gate-store.mjs +481 -481
- package/src/runtime-hold-recompile.mjs +916 -916
- package/src/runtime-io-sentinel.mjs +391 -391
- package/src/runtime-lifecycle-lock.mjs +294 -294
- package/src/runtime-managed-supervisor.mjs +1490 -1490
- package/src/runtime-multi-epoch-store.mjs +838 -838
- package/src/runtime-projection.mjs +269 -269
- package/src/runtime-pull-intake.mjs +1192 -1192
- package/src/runtime-scripted-adapter-controller.mjs +1160 -1160
- package/src/runtime-scripted-executor.mjs +163 -163
- package/src/runtime-scripted-worktree.mjs +104 -104
- package/src/runtime-seam-resolve.mjs +428 -428
- package/src/runtime-seam-treatment.mjs +173 -173
- package/src/runtime-socket-owner.mjs +125 -125
- package/src/runtime-work-order-contracts.mjs +91 -91
- package/src/runtime-work-order-controller.mjs +1171 -1171
- package/src/runtime-worktree-executor.mjs +199 -199
- package/src/schedulability-compiler-v2.mjs +303 -303
- package/src/schedulability-verifier-v2.mjs +317 -317
- package/src/seam-apply.mjs +549 -549
- package/src/seam-commit-shared.mjs +22 -22
- package/src/seam-commit-transform.mjs +81 -81
- package/src/seam-commit.mjs +18 -18
- package/src/seam-cost.mjs +322 -322
- package/src/seam-derivation.mjs +188 -188
- package/src/seam-gate.mjs +146 -146
- package/src/seam-proposal-contracts.mjs +446 -446
- package/src/seam-proposal-queries.mjs +521 -521
- package/src/seam-proposal.mjs +2011 -2011
- package/src/seam-ref.mjs +33 -33
- package/src/seam-rewrite.mjs +286 -286
- package/src/seam-transform.mjs +554 -554
- package/src/seam-verification.mjs +260 -260
- package/src/sensor-adapter.mjs +432 -432
- package/src/sensor-cli.mjs +139 -139
- package/src/sensor-diff.mjs +661 -661
- package/src/sensor-node-runtime.mjs +53 -53
- package/src/sensor-runtime.mjs +52 -52
- package/src/timestamp-contract.mjs +8 -8
- package/src/todo-audit-pending.mjs +91 -91
- package/src/todo-chain.mjs +178 -178
- package/src/todo-cli.mjs +3143 -3141
- package/src/todo-contracts.mjs +728 -728
- package/src/todo-dashboard-registry.mjs +573 -573
- package/src/todo-dispatch-shape.mjs +190 -190
- package/src/todo-gantt-html-independence.mjs +239 -239
- package/src/todo-gantt-html-shared.mjs +226 -226
- package/src/todo-gantt-html-style.mjs +131 -131
- package/src/todo-gantt-html.mjs +248 -248
- package/src/todo-gantt-layout.mjs +974 -974
- package/src/todo-gantt-live.mjs +361 -361
- package/src/todo-gantt-nested.mjs +263 -263
- package/src/todo-gantt-presentation.mjs +217 -217
- package/src/todo-gantt-scope.mjs +123 -123
- package/src/todo-gantt-svg.mjs +353 -353
- package/src/todo-independence-contracts.mjs +595 -595
- package/src/todo-independence-guidance.mjs +322 -322
- package/src/todo-independence.mjs +640 -640
- package/src/todo-markdown-renderer.mjs +260 -260
- package/src/todo-migration.mjs +448 -448
- package/src/todo-narrative-anchor.mjs +130 -130
- package/src/todo-note-store.mjs +629 -629
- package/src/todo-parallel-candidates.mjs +114 -114
- package/src/todo-revision.mjs +995 -995
- package/src/todo-split.mjs +472 -472
- package/src/todo-status.mjs +690 -690
- package/src/todo-store-git-transaction.mjs +418 -418
- package/src/todo-store.mjs +4360 -4322
- package/src/treatment-compiler.mjs +728 -728
- package/src/treatment-runner.mjs +656 -656
- package/src/witness-scaffold.mjs +180 -180
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
import { DOCUMENT_STATUS, SEVERABILITY_LABEL, escapeHtmlAttribute, escapeHtmlText, foldIndex, planActivity, presentationLookup, refKey, renderPhaseProgress, renderRelationList, renderSeamProposalOverview, renderTaskIndex, statusMarkup, taskReference } from './todo-gantt-html-shared.mjs';
|
|
2
|
-
import { renderTodoMarkdown } from './todo-markdown-renderer.mjs';
|
|
3
|
-
|
|
4
|
-
function renderNoteContext(context) {
|
|
5
|
-
if (context === null) {
|
|
6
|
-
return '<section class="work-log"><h2>作業記録</h2><p class="note-warning">作業記録を読み取れません。概要の読取警告を確認してください。</p></section>';
|
|
7
|
-
}
|
|
8
|
-
if (context.notes.length === 0) {
|
|
9
|
-
return '<section class="work-log"><h2>作業記録</h2><p>記録はありません。</p></section>';
|
|
10
|
-
}
|
|
11
|
-
const entries = context.notes.map((note) => {
|
|
12
|
-
const rendered = renderTodoMarkdown(note.body);
|
|
13
|
-
const filtering = rendered.discarded.length === 0 ? ''
|
|
14
|
-
: '<p class="note-warning">安全上表示できない要素を除外しました。</p>';
|
|
15
|
-
const correction = note.correction_state === 'superseded'
|
|
16
|
-
? `訂正済み(後継 ${note.superseded_by.slice(0, 12)}…)` : '現行';
|
|
17
|
-
// UTCのまま埋め、閲覧者の現地時刻への変換はブラウザ側へ委ねる(title属性に原文を残す)。
|
|
18
|
-
const stamp = `<time datetime="${escapeHtmlAttribute(note.recorded_at)}" title="${escapeHtmlAttribute(note.recorded_at)}" data-utc-stamp>${escapeHtmlText(note.recorded_at)}</time>`;
|
|
19
|
-
return `<article class="work-log-entry"><header>${stamp}<span>${escapeHtmlText(correction)}</span></header><div class="work-log-body">${rendered.html}</div>${filtering}<p class="work-log-origin">来歴: ${escapeHtmlText(note.origin_plan_version)}/${escapeHtmlText(note.origin_task_id)}・記録者 ${escapeHtmlText(`${note.actor.host}/${note.actor.agent}`)}</p></article>`;
|
|
20
|
-
}).join('');
|
|
21
|
-
const overflow = context.overflow_count === 0 ? ''
|
|
22
|
-
: `<p class="note-warning">ほか ${context.overflow_count}件は上限のため省略。全履歴: <code>${escapeHtmlText(context.full_history_command)}</code></p>`;
|
|
23
|
-
return `<section class="work-log"><h2>作業記録</h2>${entries}${overflow}<p class="work-log-head">note head: <code>${escapeHtmlText(context.note_head_digest ?? 'none')}</code></p></section>`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function renderDesignMemo(task) {
|
|
27
|
-
if (typeof task.design_memo !== 'string') {
|
|
28
|
-
return '<section class="design-memo"><h2>設計メモ</h2><p class="note-warning">未登録(legacy ToDo)</p></section>';
|
|
29
|
-
}
|
|
30
|
-
const rendered = renderTodoMarkdown(task.design_memo);
|
|
31
|
-
const filtering = rendered.discarded.length === 0 ? ''
|
|
32
|
-
: '<p class="note-warning">安全上表示できない要素を除外しました。</p>';
|
|
33
|
-
return `<section class="design-memo"><h2>設計メモ</h2><div class="design-memo-body">${rendered.html}</div>${filtering}</section>`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 図の外が語るための独立性要約を、plan単位の投影から引ける形へ畳む(ADR 0129 Decision 3)。
|
|
38
|
-
*/
|
|
39
|
-
export function summarizeIndependence(layout) {
|
|
40
|
-
if (layout.independence === null) return null;
|
|
41
|
-
const byPlan = new Map(layout.independence.plans.map((plan) => [plan.plan_key, plan]));
|
|
42
|
-
return {
|
|
43
|
-
plans: layout.independence.plans,
|
|
44
|
-
byPlan,
|
|
45
|
-
verifiedTaskCount: layout.independence.plans
|
|
46
|
-
.reduce((total, plan) => total + plan.verified_task_count, 0),
|
|
47
|
-
unknownTaskCount: layout.independence.plans
|
|
48
|
-
.reduce((total, plan) => total + plan.unknown_task_ids.length, 0),
|
|
49
|
-
serializePairCount: layout.independence.plans
|
|
50
|
-
.reduce((total, plan) => total + plan.serialize_pairs.length, 0),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** 記録が無いときだけADR 0063の既定をそのまま述べる。 */
|
|
55
|
-
export function dispatchBasis(summary) {
|
|
56
|
-
if (summary === null) {
|
|
57
|
-
return 'ready frontier全件が既定です。一部だけを直列着手する場合は理由が必要です。';
|
|
58
|
-
}
|
|
59
|
-
const parts = [`検証済み並列 ${summary.verifiedTaskCount}工程`];
|
|
60
|
-
if (summary.serializePairCount > 0) parts.push(`要直列 ${summary.serializePairCount}組`);
|
|
61
|
-
if (summary.unknownTaskCount > 0) parts.push(`未検査 ${summary.unknownTaskCount}工程`);
|
|
62
|
-
return `${parts.join('、')}。未検査は依存線が無くても並列可の根拠になりません。`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const COVERAGE_REASON = Object.freeze({
|
|
66
|
-
missing: 'このplanには独立性の記録がまだありません。',
|
|
67
|
-
stale: '記録はありますが、その後のdiffで失効しています。',
|
|
68
|
-
superseded: '記録は旧plan versionのもので、現在のtopologyには読めません。',
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 未検査を黙って消さない。記録が無い状態こそ最も警告が要る(ADR 0127)。
|
|
73
|
-
*
|
|
74
|
-
* 枠ごと消すと「競合なし」と読まれる。判定していないことと、次の一手を必ず言う。
|
|
75
|
-
*/
|
|
76
|
-
function unverifiedIndependence(planKey, coverage) {
|
|
77
|
-
const reason = COVERAGE_REASON[coverage] ?? COVERAGE_REASON.missing;
|
|
78
|
-
return `<p class="readiness-note"><strong>並列可否:</strong> 未検査です。競合が無いのではなく、まだ判定していません。${escapeHtmlText(reason)}宣言を書いて <code>lattice todo independence compile --plan ${escapeHtmlText(planKey)} --input <ref></code> を通すと判定できます。</p>`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function conflictItems(pairs) {
|
|
82
|
-
return pairs.map((pair) => `<li>${escapeHtmlText(pair.other)} — ${escapeHtmlText(SEVERABILITY_LABEL[pair.severability] ?? pair.severability)}(資源 ${escapeHtmlText(pair.detail)})</li>`).join('');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 作業中の工程は自分がready frontierに居ないため、conflictの相手側として現れる。
|
|
87
|
-
* 「今これを動かしている間、何が同時に始められないか」がその工程での並列可否である。
|
|
88
|
-
*/
|
|
89
|
-
function activeIndependence(plan, taskId) {
|
|
90
|
-
const blocked = plan.conflicts_with_active
|
|
91
|
-
.filter((entry) => entry.active_task_id === taskId)
|
|
92
|
-
.map((entry) => ({
|
|
93
|
-
other: entry.ready_task_id, severability: entry.severability, detail: entry.detail,
|
|
94
|
-
}));
|
|
95
|
-
if (blocked.length > 0) {
|
|
96
|
-
return `<p class="readiness-note"><strong>並列可否:</strong> この工程が作業中のあいだ、次の着手候補は同時に始められません。</p><ul class="independence-conflicts">${conflictItems(blocked)}</ul>`;
|
|
97
|
-
}
|
|
98
|
-
if (plan.coverage !== 'verified') return unverifiedIndependence(plan.plan_key, plan.coverage);
|
|
99
|
-
return '<p class="readiness-note"><strong>並列可否:</strong> 着手済のため同時着手の判定対象ではありません。現在の着手候補に、この工程と競合するものはありません。</p>';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** 個別ToDoについて、競合相手と切断可能性を言葉で示す。 */
|
|
103
|
-
export function renderIndependenceNote(ref, node, summary, status) {
|
|
104
|
-
// 完了した工程は同時着手の判断材料ではない。ここだけは黙ってよい。
|
|
105
|
-
if (status === 'done') return '';
|
|
106
|
-
const plan = summary === null ? undefined : summary.byPlan.get(ref.plan_key);
|
|
107
|
-
if (plan === undefined) return unverifiedIndependence(ref.plan_key, 'missing');
|
|
108
|
-
const taskId = ref.task_id;
|
|
109
|
-
const state = node?.visibility?.independence ?? null;
|
|
110
|
-
if (state === null) {
|
|
111
|
-
if (status === 'in-progress') return activeIndependence(plan, taskId);
|
|
112
|
-
return '<p class="readiness-note"><strong>並列可否:</strong> まだ着手候補ではないため判定していません。前提工程が片付いて着手候補に入った時点で判定します。</p>';
|
|
113
|
-
}
|
|
114
|
-
if (state === 'verified') {
|
|
115
|
-
return '<p class="readiness-note"><strong>並列可否:</strong> 独立検証済です。記録時点の宣言境界では他のready工程と干渉しません。</p>';
|
|
116
|
-
}
|
|
117
|
-
if (state === 'unknown') return unverifiedIndependence(plan.plan_key, plan.coverage);
|
|
118
|
-
const pairs = [
|
|
119
|
-
...plan.serialize_pairs
|
|
120
|
-
.filter((pair) => pair.task_ids.includes(taskId))
|
|
121
|
-
.map((pair) => ({
|
|
122
|
-
other: pair.task_ids.find((id) => id !== taskId),
|
|
123
|
-
severability: pair.severability,
|
|
124
|
-
detail: pair.detail,
|
|
125
|
-
})),
|
|
126
|
-
...plan.conflicts_with_active
|
|
127
|
-
.filter((entry) => entry.ready_task_id === taskId)
|
|
128
|
-
.map((entry) => ({
|
|
129
|
-
other: `${entry.active_task_id}(作業中)`,
|
|
130
|
-
severability: entry.severability,
|
|
131
|
-
detail: entry.detail,
|
|
132
|
-
})),
|
|
133
|
-
];
|
|
134
|
-
return `<p class="readiness-note"><strong>並列可否:</strong> 要直列です。</p><ul class="independence-conflicts">${conflictItems(pairs)}</ul>`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export function renderRightPane(
|
|
138
|
-
sections, layout, presentation, readModel, notesEnabled = false, noteWarnings = [], expandable = false,
|
|
139
|
-
) {
|
|
140
|
-
const lookup = presentationLookup(presentation);
|
|
141
|
-
const sectionByKey = new Map(sections.map((section) => [refKey(section.ref), section]));
|
|
142
|
-
const semanticNodes = [...layout.nodes, ...(layout.hierarchy_nodes ?? [])];
|
|
143
|
-
const nodeByKey = new Map(semanticNodes.map((node) => [refKey(node.ref), node]));
|
|
144
|
-
const folds = foldIndex(layout);
|
|
145
|
-
const incoming = new Map(sections.map((section) => [refKey(section.ref), []]));
|
|
146
|
-
const outgoing = new Map(sections.map((section) => [refKey(section.ref), []]));
|
|
147
|
-
const addRelation = (relations, ownerKey, ref, joinIds) => {
|
|
148
|
-
const entries = relations.get(ownerKey);
|
|
149
|
-
if (entries === undefined) return;
|
|
150
|
-
let entry = entries.find((candidate) => refKey(candidate.ref) === refKey(ref));
|
|
151
|
-
if (entry === undefined) {
|
|
152
|
-
entry = { ref, joinIds: [] };
|
|
153
|
-
entries.push(entry);
|
|
154
|
-
}
|
|
155
|
-
entry.joinIds = [...new Set([...entry.joinIds, ...joinIds])].sort();
|
|
156
|
-
};
|
|
157
|
-
// Premises and successors come from the FULL graph. `layout.edges` is the
|
|
158
|
-
// drawn graph, where a fold unit's interior dependencies have been contracted
|
|
159
|
-
// away — reading those here would tell a folded ToDo it has no premises.
|
|
160
|
-
for (const edge of layout.full_edges ?? layout.edges) {
|
|
161
|
-
addRelation(incoming, refKey(edge.to), edge.from, edge.join_ids);
|
|
162
|
-
addRelation(outgoing, refKey(edge.from), edge.to, edge.join_ids);
|
|
163
|
-
}
|
|
164
|
-
const counts = { pending: 0, 'in-progress': 0, blocked: 0, done: 0 };
|
|
165
|
-
for (const section of sections) counts[section.state.status] += 1;
|
|
166
|
-
const active = sections.filter((section) => section.state.status === 'in-progress');
|
|
167
|
-
const ready = semanticNodes.filter((node) => node.visibility.next_ready);
|
|
168
|
-
const independenceSummary = summarizeIndependence(layout);
|
|
169
|
-
const readyHeadline = ready.length > 1
|
|
170
|
-
? `<p class="readiness-note"><strong>同時dispatch推奨:</strong> ${ready.length}工程。${escapeHtmlText(dispatchBasis(independenceSummary))}</p>`
|
|
171
|
-
: ready.length === 1
|
|
172
|
-
? '<p class="readiness-note"><strong>着手候補:</strong> 1工程です。</p>'
|
|
173
|
-
: '<p class="readiness-note">現在のready frontierは空です。</p>';
|
|
174
|
-
// ready件数によらず、記録があるなら内訳を述べる。1件の時だけ黙ると、
|
|
175
|
-
// その1件が未検査でも「候補が1つある」としか伝わらない。
|
|
176
|
-
const independenceNote = independenceSummary === null || ready.length > 1 ? ''
|
|
177
|
-
: `<p class="readiness-note"><strong>並列可否:</strong> ${escapeHtmlText(dispatchBasis(independenceSummary))}</p>`;
|
|
178
|
-
const dispatchSummary = `${readyHeadline}${independenceNote}`;
|
|
179
|
-
const activeLinks = active.length === 0 ? '<p>作業中の工程はありません。</p>'
|
|
180
|
-
: `<ul class="active-list">${active.map((section) => `<li><button type="button" data-select-node-key="${escapeHtmlAttribute(refKey(section.ref))}">${escapeHtmlText(taskReference(section, lookup))} — ${escapeHtmlText(section.task.title)}</button></li>`).join('')}</ul>`;
|
|
181
|
-
const noteWarningMarkup = noteWarnings.length === 0 ? ''
|
|
182
|
-
: `<section class="gantt-warning"><h2>作業記録の読取警告</h2><ul>${noteWarnings.map((warning) => `<li><code>${escapeHtmlText(warning.plan_key)}</code>: <strong>${escapeHtmlText(warning.code)}</strong> — ${escapeHtmlText(warning.message)}</li>`).join('')}</ul></section>`;
|
|
183
|
-
const overview = `<section class="right-overview" data-right-panel="overview"><h1>工程を選択してください</h1><p>左の依存工程図から工程を選ぶと、題名・状態・前提・後続を表示します。</p><div class="status-summary"><span>☐ 未着手 ${counts.pending}</span><span>▶ 作業中 ${counts['in-progress']}</span><span>✅ 完了 ${counts.done}</span><span>⛔ ブロック中 ${counts.blocked}</span></div>${noteWarningMarkup}${dispatchSummary}${renderSeamProposalOverview(layout)}${renderPhaseProgress(readModel)}<h2>作業中</h2>${activeLinks}</section>`;
|
|
184
|
-
const details = sections.map((section) => {
|
|
185
|
-
const key = refKey(section.ref);
|
|
186
|
-
const node = nodeByKey.get(key);
|
|
187
|
-
const status = DOCUMENT_STATUS[section.state.status] ?? { mark: '?', label: '状態不明' };
|
|
188
|
-
const lane = lookup.lanes.get(JSON.stringify([section.ref.plan_key, section.task.lane]));
|
|
189
|
-
const category = lane === undefined ? section.task.lane : `${section.task.lane} — ${lane.name}`;
|
|
190
|
-
const categoryDescription = lane === undefined ? '' : `<p class="category-description">${escapeHtmlText(lane.description)}</p>`;
|
|
191
|
-
const blockedReason = section.state.status === 'blocked'
|
|
192
|
-
? `<p><strong>ブロック理由:</strong> ${escapeHtmlText(section.state.blocked_reason ?? '理由未記録')}</p>` : '';
|
|
193
|
-
const sourceLine = section.anchorOutcome.origin_line === null ? '' : `:${section.anchorOutcome.origin_line}`;
|
|
194
|
-
const sourceRef = section.narrativeRef ?? '参照なし';
|
|
195
|
-
const anchorText = section.anchorOutcome.anchored
|
|
196
|
-
? `元plan: ${sourceRef}${sourceLine} — 行対応を確認済み`
|
|
197
|
-
: `元plan: ${sourceRef}${sourceLine} — 行対応を確認できないため、本文位置との対応は表示していません`;
|
|
198
|
-
const readiness = node?.visibility.next_ready
|
|
199
|
-
? `<p class="readiness-note">ready frontierの一員です。${ready.length > 1 ? '他のready工程と同時着手できるかは下の並列可否で判断してください。' : '現在の唯一の着手候補です。'}</p>`
|
|
200
|
-
: incoming.get(key).length === 0 ? '<p class="readiness-note">登録済みの前提工程はありません。図だけではdispatch可否を判定しません。</p>' : '';
|
|
201
|
-
const independenceNote = renderIndependenceNote(
|
|
202
|
-
section.ref, node, independenceSummary, section.state.status,
|
|
203
|
-
);
|
|
204
|
-
// Say it plainly when the reader will not find this ToDo on the diagram.
|
|
205
|
-
const foldedNote = !folds.has(key) ? ''
|
|
206
|
-
: expandable
|
|
207
|
-
? '<p class="fold-note">完走済みのため既定の図には描いていません。左上の「完走済み」バッジを押すと、このページ内で表示できます。</p>'
|
|
208
|
-
: '<p class="fold-note">完走済みのため図には描いていません。図に出すには動的dashboardを <code>lattice todo gantt serve --port <port> --scope all</code> で起動してください。</p>';
|
|
209
|
-
const workLog = notesEnabled ? renderNoteContext(section.noteContext) : '';
|
|
210
|
-
const designMemo = renderDesignMemo(section.task);
|
|
211
|
-
return `<article class="task-detail" data-detail-key="${escapeHtmlAttribute(key)}" hidden><header><span class="detail-status status-${escapeHtmlAttribute(section.state.status)}">${escapeHtmlText(status.mark)} ${escapeHtmlText(status.label)}</span><span class="detail-reference">${escapeHtmlText(taskReference(section, lookup))}</span></header><h1>${escapeHtmlText(section.task.title)}</h1><p class="detail-category"><strong>カテゴリ:</strong> ${escapeHtmlText(category)}</p>${categoryDescription}<p><strong>正規ID:</strong> <code>${escapeHtmlText(`${section.ref.plan_key}/${section.task.task_id}`)}</code></p>${blockedReason}${readiness}${independenceNote}${foldedNote}${designMemo}<section><h2>前提工程</h2>${renderRelationList(incoming.get(key), sectionByKey, lookup, '登録済みの前提工程はありません。', folds)}</section><section><h2>後続工程</h2>${renderRelationList(outgoing.get(key), sectionByKey, lookup, '登録済みの後続工程はありません。', folds)}</section>${workLog}<p class="anchor-status">${escapeHtmlText(anchorText)}</p><details class="task-diagnostics"><summary>開発者向け診断</summary><dl><dt>canonical ref</dt><dd><code>${escapeHtmlText(`${section.ref.project_id}/${section.ref.plan_key}/${section.task.task_id}`)}</code></dd><dt>anchor</dt><dd>${escapeHtmlText(section.anchorOutcome.anchored ? 'verified' : section.anchorOutcome.reason)}</dd></dl></details></article>`;
|
|
212
|
-
}).join('');
|
|
213
|
-
const taskIndex = renderTaskIndex(sections, lookup, folds, planActivity(readModel));
|
|
214
|
-
return `<div class="right-toolbar"><button type="button" data-show-overview>概要</button><button type="button" data-show-selected hidden>選択工程へ戻る</button><button type="button" data-show-task-index>全工程一覧</button></div><div class="right-content">${overview}<div data-right-panel="details" hidden>${details}</div><section class="task-index" data-right-panel="task-index" hidden><h1>全工程</h1><p>Latticeに登録された全工程を現在の状態とともに表示しています。planは動いているものを最終活動の新しい順で上に、完走したものを古い順で下にまとめ、plan内は登録順です。</p>${taskIndex}</section></div>`;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export function renderDiagramLegend(presentation, layout = null, expandable = false) {
|
|
218
|
-
const categories = (presentation?.lanes ?? []).map((lane) => `<div class="category-entry"><dt><code>${escapeHtmlText(lane.lane)}</code> — ${escapeHtmlText(lane.name)}</dt><dd>${escapeHtmlText(lane.description)}</dd></div>`).join('');
|
|
219
|
-
const categoryDetails = categories === '' ? '' : `<details class="category-legend"><summary>カテゴリ説明</summary><dl>${categories}</dl></details>`;
|
|
220
|
-
const foldedCount = layout?.scope?.folded_task_count ?? 0;
|
|
221
|
-
// The badge says what is missing from the diagram, so it is also the control
|
|
222
|
-
// that brings it back — a reader who notices the count is exactly the reader
|
|
223
|
-
// who wants to see it.
|
|
224
|
-
const foldChip = foldedCount === 0 ? ''
|
|
225
|
-
: expandable
|
|
226
|
-
? `<button type="button" class="fold-chip" data-toggle-expanded aria-expanded="false"><span data-toggle-label data-collapsed-label="完走済み ${foldedCount}件を非表示(押すと表示)" data-expanded-label="完走済み ${foldedCount}件を表示中(押すと非表示)">完走済み ${foldedCount}件を非表示(押すと表示)</span></button>`
|
|
227
|
-
: `<span class="fold-chip">完走済み ${foldedCount}件を非表示</span>`;
|
|
228
|
-
const foldNote = foldedCount === 0 ? ''
|
|
229
|
-
: expandable
|
|
230
|
-
? '<p class="fold-note">後続に作業中・未着手が残っていない完了工程は図から外しています。生きた工程とその直接の前提工程は必ず描きます。上のバッジを押すと外した工程も含めて描きます。総数・進捗・最長依存鎖は外す前の全工程で数えています。</p>'
|
|
231
|
-
: '<p class="fold-note">後続に作業中・未着手が残っていない完了工程は図から外しています。生きた工程とその直接の前提工程は必ず描きます。外した工程は右の「全工程」から辿れ、図に出すには動的dashboardを <code>lattice todo gantt serve --port <port> --scope all</code> で起動してください。総数・進捗・最長依存鎖は外す前の全工程で数えています。</p>';
|
|
232
|
-
const independenceLegend = layout.independence === null ? ''
|
|
233
|
-
: '<span>∥ 独立検証済</span><span>⛓ 要直列</span><span>? 未検査</span>';
|
|
234
|
-
// 独立性の記録がある間は「全件同時dispatchが既定」と無条件に述べない(ADR 0129 Decision 3)。
|
|
235
|
-
const dispatchSentence = layout.independence === null
|
|
236
|
-
? 'ready frontierは全件同時dispatchが既定です。未登録の資源・host制約によりsubsetだけを選ぶ場合は理由を記録します。'
|
|
237
|
-
: '同時着手できるかはカードの並列可否で判断してください。未検査の工程は依存線が無くても並列可の根拠になりません。';
|
|
238
|
-
return `<div class="diagram-legend" aria-label="工程図の凡例"><span>${statusMarkup('pending', ' 未着手')}</span><span>${statusMarkup('in-progress', ' 作業中')}</span><span>${statusMarkup('done', ' 完了')}</span><span>${statusMarkup('blocked', ' ブロック中')}</span><span>破線枠: ready frontier</span>${independenceLegend}<span>太線: 構造上の最長依存鎖</span><span>半円: 非接触の線交差</span><span>黒丸: 論理上の合流</span>${foldChip}${categoryDetails}${foldNote}<p>縦方向は時間ではなく、登録済み依存関係による工程段階です。${dispatchSentence}構造上の最長依存鎖は各工程を同じ重みとして数え、実時間・工数・納期を表しません。</p></div>`;
|
|
239
|
-
}
|
|
1
|
+
import { DOCUMENT_STATUS, SEVERABILITY_LABEL, escapeHtmlAttribute, escapeHtmlText, foldIndex, planActivity, presentationLookup, refKey, renderPhaseProgress, renderRelationList, renderSeamProposalOverview, renderTaskIndex, statusMarkup, taskReference } from './todo-gantt-html-shared.mjs';
|
|
2
|
+
import { renderTodoMarkdown } from './todo-markdown-renderer.mjs';
|
|
3
|
+
|
|
4
|
+
function renderNoteContext(context) {
|
|
5
|
+
if (context === null) {
|
|
6
|
+
return '<section class="work-log"><h2>作業記録</h2><p class="note-warning">作業記録を読み取れません。概要の読取警告を確認してください。</p></section>';
|
|
7
|
+
}
|
|
8
|
+
if (context.notes.length === 0) {
|
|
9
|
+
return '<section class="work-log"><h2>作業記録</h2><p>記録はありません。</p></section>';
|
|
10
|
+
}
|
|
11
|
+
const entries = context.notes.map((note) => {
|
|
12
|
+
const rendered = renderTodoMarkdown(note.body);
|
|
13
|
+
const filtering = rendered.discarded.length === 0 ? ''
|
|
14
|
+
: '<p class="note-warning">安全上表示できない要素を除外しました。</p>';
|
|
15
|
+
const correction = note.correction_state === 'superseded'
|
|
16
|
+
? `訂正済み(後継 ${note.superseded_by.slice(0, 12)}…)` : '現行';
|
|
17
|
+
// UTCのまま埋め、閲覧者の現地時刻への変換はブラウザ側へ委ねる(title属性に原文を残す)。
|
|
18
|
+
const stamp = `<time datetime="${escapeHtmlAttribute(note.recorded_at)}" title="${escapeHtmlAttribute(note.recorded_at)}" data-utc-stamp>${escapeHtmlText(note.recorded_at)}</time>`;
|
|
19
|
+
return `<article class="work-log-entry"><header>${stamp}<span>${escapeHtmlText(correction)}</span></header><div class="work-log-body">${rendered.html}</div>${filtering}<p class="work-log-origin">来歴: ${escapeHtmlText(note.origin_plan_version)}/${escapeHtmlText(note.origin_task_id)}・記録者 ${escapeHtmlText(`${note.actor.host}/${note.actor.agent}`)}</p></article>`;
|
|
20
|
+
}).join('');
|
|
21
|
+
const overflow = context.overflow_count === 0 ? ''
|
|
22
|
+
: `<p class="note-warning">ほか ${context.overflow_count}件は上限のため省略。全履歴: <code>${escapeHtmlText(context.full_history_command)}</code></p>`;
|
|
23
|
+
return `<section class="work-log"><h2>作業記録</h2>${entries}${overflow}<p class="work-log-head">note head: <code>${escapeHtmlText(context.note_head_digest ?? 'none')}</code></p></section>`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function renderDesignMemo(task) {
|
|
27
|
+
if (typeof task.design_memo !== 'string') {
|
|
28
|
+
return '<section class="design-memo"><h2>設計メモ</h2><p class="note-warning">未登録(legacy ToDo)</p></section>';
|
|
29
|
+
}
|
|
30
|
+
const rendered = renderTodoMarkdown(task.design_memo);
|
|
31
|
+
const filtering = rendered.discarded.length === 0 ? ''
|
|
32
|
+
: '<p class="note-warning">安全上表示できない要素を除外しました。</p>';
|
|
33
|
+
return `<section class="design-memo"><h2>設計メモ</h2><div class="design-memo-body">${rendered.html}</div>${filtering}</section>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 図の外が語るための独立性要約を、plan単位の投影から引ける形へ畳む(ADR 0129 Decision 3)。
|
|
38
|
+
*/
|
|
39
|
+
export function summarizeIndependence(layout) {
|
|
40
|
+
if (layout.independence === null) return null;
|
|
41
|
+
const byPlan = new Map(layout.independence.plans.map((plan) => [plan.plan_key, plan]));
|
|
42
|
+
return {
|
|
43
|
+
plans: layout.independence.plans,
|
|
44
|
+
byPlan,
|
|
45
|
+
verifiedTaskCount: layout.independence.plans
|
|
46
|
+
.reduce((total, plan) => total + plan.verified_task_count, 0),
|
|
47
|
+
unknownTaskCount: layout.independence.plans
|
|
48
|
+
.reduce((total, plan) => total + plan.unknown_task_ids.length, 0),
|
|
49
|
+
serializePairCount: layout.independence.plans
|
|
50
|
+
.reduce((total, plan) => total + plan.serialize_pairs.length, 0),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 記録が無いときだけADR 0063の既定をそのまま述べる。 */
|
|
55
|
+
export function dispatchBasis(summary) {
|
|
56
|
+
if (summary === null) {
|
|
57
|
+
return 'ready frontier全件が既定です。一部だけを直列着手する場合は理由が必要です。';
|
|
58
|
+
}
|
|
59
|
+
const parts = [`検証済み並列 ${summary.verifiedTaskCount}工程`];
|
|
60
|
+
if (summary.serializePairCount > 0) parts.push(`要直列 ${summary.serializePairCount}組`);
|
|
61
|
+
if (summary.unknownTaskCount > 0) parts.push(`未検査 ${summary.unknownTaskCount}工程`);
|
|
62
|
+
return `${parts.join('、')}。未検査は依存線が無くても並列可の根拠になりません。`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const COVERAGE_REASON = Object.freeze({
|
|
66
|
+
missing: 'このplanには独立性の記録がまだありません。',
|
|
67
|
+
stale: '記録はありますが、その後のdiffで失効しています。',
|
|
68
|
+
superseded: '記録は旧plan versionのもので、現在のtopologyには読めません。',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 未検査を黙って消さない。記録が無い状態こそ最も警告が要る(ADR 0127)。
|
|
73
|
+
*
|
|
74
|
+
* 枠ごと消すと「競合なし」と読まれる。判定していないことと、次の一手を必ず言う。
|
|
75
|
+
*/
|
|
76
|
+
function unverifiedIndependence(planKey, coverage) {
|
|
77
|
+
const reason = COVERAGE_REASON[coverage] ?? COVERAGE_REASON.missing;
|
|
78
|
+
return `<p class="readiness-note"><strong>並列可否:</strong> 未検査です。競合が無いのではなく、まだ判定していません。${escapeHtmlText(reason)}宣言を書いて <code>lattice todo independence compile --plan ${escapeHtmlText(planKey)} --input <ref></code> を通すと判定できます。</p>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function conflictItems(pairs) {
|
|
82
|
+
return pairs.map((pair) => `<li>${escapeHtmlText(pair.other)} — ${escapeHtmlText(SEVERABILITY_LABEL[pair.severability] ?? pair.severability)}(資源 ${escapeHtmlText(pair.detail)})</li>`).join('');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 作業中の工程は自分がready frontierに居ないため、conflictの相手側として現れる。
|
|
87
|
+
* 「今これを動かしている間、何が同時に始められないか」がその工程での並列可否である。
|
|
88
|
+
*/
|
|
89
|
+
function activeIndependence(plan, taskId) {
|
|
90
|
+
const blocked = plan.conflicts_with_active
|
|
91
|
+
.filter((entry) => entry.active_task_id === taskId)
|
|
92
|
+
.map((entry) => ({
|
|
93
|
+
other: entry.ready_task_id, severability: entry.severability, detail: entry.detail,
|
|
94
|
+
}));
|
|
95
|
+
if (blocked.length > 0) {
|
|
96
|
+
return `<p class="readiness-note"><strong>並列可否:</strong> この工程が作業中のあいだ、次の着手候補は同時に始められません。</p><ul class="independence-conflicts">${conflictItems(blocked)}</ul>`;
|
|
97
|
+
}
|
|
98
|
+
if (plan.coverage !== 'verified') return unverifiedIndependence(plan.plan_key, plan.coverage);
|
|
99
|
+
return '<p class="readiness-note"><strong>並列可否:</strong> 着手済のため同時着手の判定対象ではありません。現在の着手候補に、この工程と競合するものはありません。</p>';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** 個別ToDoについて、競合相手と切断可能性を言葉で示す。 */
|
|
103
|
+
export function renderIndependenceNote(ref, node, summary, status) {
|
|
104
|
+
// 完了した工程は同時着手の判断材料ではない。ここだけは黙ってよい。
|
|
105
|
+
if (status === 'done') return '';
|
|
106
|
+
const plan = summary === null ? undefined : summary.byPlan.get(ref.plan_key);
|
|
107
|
+
if (plan === undefined) return unverifiedIndependence(ref.plan_key, 'missing');
|
|
108
|
+
const taskId = ref.task_id;
|
|
109
|
+
const state = node?.visibility?.independence ?? null;
|
|
110
|
+
if (state === null) {
|
|
111
|
+
if (status === 'in-progress') return activeIndependence(plan, taskId);
|
|
112
|
+
return '<p class="readiness-note"><strong>並列可否:</strong> まだ着手候補ではないため判定していません。前提工程が片付いて着手候補に入った時点で判定します。</p>';
|
|
113
|
+
}
|
|
114
|
+
if (state === 'verified') {
|
|
115
|
+
return '<p class="readiness-note"><strong>並列可否:</strong> 独立検証済です。記録時点の宣言境界では他のready工程と干渉しません。</p>';
|
|
116
|
+
}
|
|
117
|
+
if (state === 'unknown') return unverifiedIndependence(plan.plan_key, plan.coverage);
|
|
118
|
+
const pairs = [
|
|
119
|
+
...plan.serialize_pairs
|
|
120
|
+
.filter((pair) => pair.task_ids.includes(taskId))
|
|
121
|
+
.map((pair) => ({
|
|
122
|
+
other: pair.task_ids.find((id) => id !== taskId),
|
|
123
|
+
severability: pair.severability,
|
|
124
|
+
detail: pair.detail,
|
|
125
|
+
})),
|
|
126
|
+
...plan.conflicts_with_active
|
|
127
|
+
.filter((entry) => entry.ready_task_id === taskId)
|
|
128
|
+
.map((entry) => ({
|
|
129
|
+
other: `${entry.active_task_id}(作業中)`,
|
|
130
|
+
severability: entry.severability,
|
|
131
|
+
detail: entry.detail,
|
|
132
|
+
})),
|
|
133
|
+
];
|
|
134
|
+
return `<p class="readiness-note"><strong>並列可否:</strong> 要直列です。</p><ul class="independence-conflicts">${conflictItems(pairs)}</ul>`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function renderRightPane(
|
|
138
|
+
sections, layout, presentation, readModel, notesEnabled = false, noteWarnings = [], expandable = false,
|
|
139
|
+
) {
|
|
140
|
+
const lookup = presentationLookup(presentation);
|
|
141
|
+
const sectionByKey = new Map(sections.map((section) => [refKey(section.ref), section]));
|
|
142
|
+
const semanticNodes = [...layout.nodes, ...(layout.hierarchy_nodes ?? [])];
|
|
143
|
+
const nodeByKey = new Map(semanticNodes.map((node) => [refKey(node.ref), node]));
|
|
144
|
+
const folds = foldIndex(layout);
|
|
145
|
+
const incoming = new Map(sections.map((section) => [refKey(section.ref), []]));
|
|
146
|
+
const outgoing = new Map(sections.map((section) => [refKey(section.ref), []]));
|
|
147
|
+
const addRelation = (relations, ownerKey, ref, joinIds) => {
|
|
148
|
+
const entries = relations.get(ownerKey);
|
|
149
|
+
if (entries === undefined) return;
|
|
150
|
+
let entry = entries.find((candidate) => refKey(candidate.ref) === refKey(ref));
|
|
151
|
+
if (entry === undefined) {
|
|
152
|
+
entry = { ref, joinIds: [] };
|
|
153
|
+
entries.push(entry);
|
|
154
|
+
}
|
|
155
|
+
entry.joinIds = [...new Set([...entry.joinIds, ...joinIds])].sort();
|
|
156
|
+
};
|
|
157
|
+
// Premises and successors come from the FULL graph. `layout.edges` is the
|
|
158
|
+
// drawn graph, where a fold unit's interior dependencies have been contracted
|
|
159
|
+
// away — reading those here would tell a folded ToDo it has no premises.
|
|
160
|
+
for (const edge of layout.full_edges ?? layout.edges) {
|
|
161
|
+
addRelation(incoming, refKey(edge.to), edge.from, edge.join_ids);
|
|
162
|
+
addRelation(outgoing, refKey(edge.from), edge.to, edge.join_ids);
|
|
163
|
+
}
|
|
164
|
+
const counts = { pending: 0, 'in-progress': 0, blocked: 0, done: 0 };
|
|
165
|
+
for (const section of sections) counts[section.state.status] += 1;
|
|
166
|
+
const active = sections.filter((section) => section.state.status === 'in-progress');
|
|
167
|
+
const ready = semanticNodes.filter((node) => node.visibility.next_ready);
|
|
168
|
+
const independenceSummary = summarizeIndependence(layout);
|
|
169
|
+
const readyHeadline = ready.length > 1
|
|
170
|
+
? `<p class="readiness-note"><strong>同時dispatch推奨:</strong> ${ready.length}工程。${escapeHtmlText(dispatchBasis(independenceSummary))}</p>`
|
|
171
|
+
: ready.length === 1
|
|
172
|
+
? '<p class="readiness-note"><strong>着手候補:</strong> 1工程です。</p>'
|
|
173
|
+
: '<p class="readiness-note">現在のready frontierは空です。</p>';
|
|
174
|
+
// ready件数によらず、記録があるなら内訳を述べる。1件の時だけ黙ると、
|
|
175
|
+
// その1件が未検査でも「候補が1つある」としか伝わらない。
|
|
176
|
+
const independenceNote = independenceSummary === null || ready.length > 1 ? ''
|
|
177
|
+
: `<p class="readiness-note"><strong>並列可否:</strong> ${escapeHtmlText(dispatchBasis(independenceSummary))}</p>`;
|
|
178
|
+
const dispatchSummary = `${readyHeadline}${independenceNote}`;
|
|
179
|
+
const activeLinks = active.length === 0 ? '<p>作業中の工程はありません。</p>'
|
|
180
|
+
: `<ul class="active-list">${active.map((section) => `<li><button type="button" data-select-node-key="${escapeHtmlAttribute(refKey(section.ref))}">${escapeHtmlText(taskReference(section, lookup))} — ${escapeHtmlText(section.task.title)}</button></li>`).join('')}</ul>`;
|
|
181
|
+
const noteWarningMarkup = noteWarnings.length === 0 ? ''
|
|
182
|
+
: `<section class="gantt-warning"><h2>作業記録の読取警告</h2><ul>${noteWarnings.map((warning) => `<li><code>${escapeHtmlText(warning.plan_key)}</code>: <strong>${escapeHtmlText(warning.code)}</strong> — ${escapeHtmlText(warning.message)}</li>`).join('')}</ul></section>`;
|
|
183
|
+
const overview = `<section class="right-overview" data-right-panel="overview"><h1>工程を選択してください</h1><p>左の依存工程図から工程を選ぶと、題名・状態・前提・後続を表示します。</p><div class="status-summary"><span>☐ 未着手 ${counts.pending}</span><span>▶ 作業中 ${counts['in-progress']}</span><span>✅ 完了 ${counts.done}</span><span>⛔ ブロック中 ${counts.blocked}</span></div>${noteWarningMarkup}${dispatchSummary}${renderSeamProposalOverview(layout)}${renderPhaseProgress(readModel)}<h2>作業中</h2>${activeLinks}</section>`;
|
|
184
|
+
const details = sections.map((section) => {
|
|
185
|
+
const key = refKey(section.ref);
|
|
186
|
+
const node = nodeByKey.get(key);
|
|
187
|
+
const status = DOCUMENT_STATUS[section.state.status] ?? { mark: '?', label: '状態不明' };
|
|
188
|
+
const lane = lookup.lanes.get(JSON.stringify([section.ref.plan_key, section.task.lane]));
|
|
189
|
+
const category = lane === undefined ? section.task.lane : `${section.task.lane} — ${lane.name}`;
|
|
190
|
+
const categoryDescription = lane === undefined ? '' : `<p class="category-description">${escapeHtmlText(lane.description)}</p>`;
|
|
191
|
+
const blockedReason = section.state.status === 'blocked'
|
|
192
|
+
? `<p><strong>ブロック理由:</strong> ${escapeHtmlText(section.state.blocked_reason ?? '理由未記録')}</p>` : '';
|
|
193
|
+
const sourceLine = section.anchorOutcome.origin_line === null ? '' : `:${section.anchorOutcome.origin_line}`;
|
|
194
|
+
const sourceRef = section.narrativeRef ?? '参照なし';
|
|
195
|
+
const anchorText = section.anchorOutcome.anchored
|
|
196
|
+
? `元plan: ${sourceRef}${sourceLine} — 行対応を確認済み`
|
|
197
|
+
: `元plan: ${sourceRef}${sourceLine} — 行対応を確認できないため、本文位置との対応は表示していません`;
|
|
198
|
+
const readiness = node?.visibility.next_ready
|
|
199
|
+
? `<p class="readiness-note">ready frontierの一員です。${ready.length > 1 ? '他のready工程と同時着手できるかは下の並列可否で判断してください。' : '現在の唯一の着手候補です。'}</p>`
|
|
200
|
+
: incoming.get(key).length === 0 ? '<p class="readiness-note">登録済みの前提工程はありません。図だけではdispatch可否を判定しません。</p>' : '';
|
|
201
|
+
const independenceNote = renderIndependenceNote(
|
|
202
|
+
section.ref, node, independenceSummary, section.state.status,
|
|
203
|
+
);
|
|
204
|
+
// Say it plainly when the reader will not find this ToDo on the diagram.
|
|
205
|
+
const foldedNote = !folds.has(key) ? ''
|
|
206
|
+
: expandable
|
|
207
|
+
? '<p class="fold-note">完走済みのため既定の図には描いていません。左上の「完走済み」バッジを押すと、このページ内で表示できます。</p>'
|
|
208
|
+
: '<p class="fold-note">完走済みのため図には描いていません。図に出すには動的dashboardを <code>lattice todo gantt serve --port <port> --scope all</code> で起動してください。</p>';
|
|
209
|
+
const workLog = notesEnabled ? renderNoteContext(section.noteContext) : '';
|
|
210
|
+
const designMemo = renderDesignMemo(section.task);
|
|
211
|
+
return `<article class="task-detail" data-detail-key="${escapeHtmlAttribute(key)}" hidden><header><span class="detail-status status-${escapeHtmlAttribute(section.state.status)}">${escapeHtmlText(status.mark)} ${escapeHtmlText(status.label)}</span><span class="detail-reference">${escapeHtmlText(taskReference(section, lookup))}</span></header><h1>${escapeHtmlText(section.task.title)}</h1><p class="detail-category"><strong>カテゴリ:</strong> ${escapeHtmlText(category)}</p>${categoryDescription}<p><strong>正規ID:</strong> <code>${escapeHtmlText(`${section.ref.plan_key}/${section.task.task_id}`)}</code></p>${blockedReason}${readiness}${independenceNote}${foldedNote}${designMemo}<section><h2>前提工程</h2>${renderRelationList(incoming.get(key), sectionByKey, lookup, '登録済みの前提工程はありません。', folds)}</section><section><h2>後続工程</h2>${renderRelationList(outgoing.get(key), sectionByKey, lookup, '登録済みの後続工程はありません。', folds)}</section>${workLog}<p class="anchor-status">${escapeHtmlText(anchorText)}</p><details class="task-diagnostics"><summary>開発者向け診断</summary><dl><dt>canonical ref</dt><dd><code>${escapeHtmlText(`${section.ref.project_id}/${section.ref.plan_key}/${section.task.task_id}`)}</code></dd><dt>anchor</dt><dd>${escapeHtmlText(section.anchorOutcome.anchored ? 'verified' : section.anchorOutcome.reason)}</dd></dl></details></article>`;
|
|
212
|
+
}).join('');
|
|
213
|
+
const taskIndex = renderTaskIndex(sections, lookup, folds, planActivity(readModel));
|
|
214
|
+
return `<div class="right-toolbar"><button type="button" data-show-overview>概要</button><button type="button" data-show-selected hidden>選択工程へ戻る</button><button type="button" data-show-task-index>全工程一覧</button></div><div class="right-content">${overview}<div data-right-panel="details" hidden>${details}</div><section class="task-index" data-right-panel="task-index" hidden><h1>全工程</h1><p>Latticeに登録された全工程を現在の状態とともに表示しています。planは動いているものを最終活動の新しい順で上に、完走したものを古い順で下にまとめ、plan内は登録順です。</p>${taskIndex}</section></div>`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function renderDiagramLegend(presentation, layout = null, expandable = false) {
|
|
218
|
+
const categories = (presentation?.lanes ?? []).map((lane) => `<div class="category-entry"><dt><code>${escapeHtmlText(lane.lane)}</code> — ${escapeHtmlText(lane.name)}</dt><dd>${escapeHtmlText(lane.description)}</dd></div>`).join('');
|
|
219
|
+
const categoryDetails = categories === '' ? '' : `<details class="category-legend"><summary>カテゴリ説明</summary><dl>${categories}</dl></details>`;
|
|
220
|
+
const foldedCount = layout?.scope?.folded_task_count ?? 0;
|
|
221
|
+
// The badge says what is missing from the diagram, so it is also the control
|
|
222
|
+
// that brings it back — a reader who notices the count is exactly the reader
|
|
223
|
+
// who wants to see it.
|
|
224
|
+
const foldChip = foldedCount === 0 ? ''
|
|
225
|
+
: expandable
|
|
226
|
+
? `<button type="button" class="fold-chip" data-toggle-expanded aria-expanded="false"><span data-toggle-label data-collapsed-label="完走済み ${foldedCount}件を非表示(押すと表示)" data-expanded-label="完走済み ${foldedCount}件を表示中(押すと非表示)">完走済み ${foldedCount}件を非表示(押すと表示)</span></button>`
|
|
227
|
+
: `<span class="fold-chip">完走済み ${foldedCount}件を非表示</span>`;
|
|
228
|
+
const foldNote = foldedCount === 0 ? ''
|
|
229
|
+
: expandable
|
|
230
|
+
? '<p class="fold-note">後続に作業中・未着手が残っていない完了工程は図から外しています。生きた工程とその直接の前提工程は必ず描きます。上のバッジを押すと外した工程も含めて描きます。総数・進捗・最長依存鎖は外す前の全工程で数えています。</p>'
|
|
231
|
+
: '<p class="fold-note">後続に作業中・未着手が残っていない完了工程は図から外しています。生きた工程とその直接の前提工程は必ず描きます。外した工程は右の「全工程」から辿れ、図に出すには動的dashboardを <code>lattice todo gantt serve --port <port> --scope all</code> で起動してください。総数・進捗・最長依存鎖は外す前の全工程で数えています。</p>';
|
|
232
|
+
const independenceLegend = layout.independence === null ? ''
|
|
233
|
+
: '<span>∥ 独立検証済</span><span>⛓ 要直列</span><span>? 未検査</span>';
|
|
234
|
+
// 独立性の記録がある間は「全件同時dispatchが既定」と無条件に述べない(ADR 0129 Decision 3)。
|
|
235
|
+
const dispatchSentence = layout.independence === null
|
|
236
|
+
? 'ready frontierは全件同時dispatchが既定です。未登録の資源・host制約によりsubsetだけを選ぶ場合は理由を記録します。'
|
|
237
|
+
: '同時着手できるかはカードの並列可否で判断してください。未検査の工程は依存線が無くても並列可の根拠になりません。';
|
|
238
|
+
return `<div class="diagram-legend" aria-label="工程図の凡例"><span>${statusMarkup('pending', ' 未着手')}</span><span>${statusMarkup('in-progress', ' 作業中')}</span><span>${statusMarkup('done', ' 完了')}</span><span>${statusMarkup('blocked', ' ブロック中')}</span><span>破線枠: ready frontier</span>${independenceLegend}<span>太線: 構造上の最長依存鎖</span><span>半円: 非接触の線交差</span><span>黒丸: 論理上の合流</span>${foldChip}${categoryDetails}${foldNote}<p>縦方向は時間ではなく、登録済み依存関係による工程段階です。${dispatchSentence}構造上の最長依存鎖は各工程を同じ重みとして数え、実時間・工数・納期を表しません。</p></div>`;
|
|
239
|
+
}
|