okstra 0.233.0 → 0.234.1
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/dist/cli-registry.mjs +6 -0
- package/dist/cli-registry.mjs.map +1 -1
- package/dist/commands/trace/progression.mjs +6 -5
- package/dist/commands/trace/progression.mjs.map +1 -1
- package/dist/commands/trace/trace.mjs +2 -2
- package/dist/commands/trace/trace.mjs.map +1 -1
- package/docs/architecture/storage-model.md +19 -0
- package/docs/cli.md +41 -1
- package/docs/project-structure-overview.md +3 -2
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/python/okstra_ctl/business_flow/cli.py +60 -6
- package/runtime/python/okstra_ctl/business_flow/contracts.py +12 -1
- package/runtime/python/okstra_ctl/business_flow/engine.py +17 -5
- package/runtime/python/okstra_ctl/business_flow/history.py +60 -0
- package/runtime/python/okstra_ctl/business_flow/source.py +35 -2
- package/runtime/python/okstra_ctl/business_flow/store.py +51 -14
- package/runtime/python/okstra_ctl/business_flow/sweep.py +124 -0
- package/runtime/python/okstra_ctl/doyouknow/cli.py +9 -9
- package/runtime/python/okstra_ctl/doyouknow/config.py +2 -2
- package/runtime/python/okstra_ctl/doyouknow/group_view.py +152 -0
- package/runtime/python/okstra_ctl/doyouknow/source_contracts.py +4 -3
- package/runtime/python/okstra_ctl/doyouknow/source_store.py +2 -2
- package/runtime/python/okstra_ctl/doyouknow/sources/business.py +116 -0
- package/runtime/python/okstra_ctl/doyouknow/sync.py +34 -9
- package/runtime/python/okstra_ctl/fixed_text.py +10 -0
- package/runtime/python/okstra_ctl/project_group.py +175 -0
- package/runtime/python/okstra_ctl/project_group_cli.py +62 -0
- package/runtime/schemas/business-flow-v1.schema.json +3 -0
- package/runtime/schemas/doyouknow-config-v1.schema.json +1 -1
- package/runtime/skills/okstra-brief-gen/SKILL.md +52 -6
- package/runtime/skills/okstra-explain-flow/SKILL.md +27 -2
- package/runtime/skills/okstra-tdd/SKILL.md +7 -4
- package/runtime/templates/doyouknow/group-view.css +103 -0
- package/runtime/templates/doyouknow/group-view.js +317 -0
- package/runtime/templates/doyouknow/group-view.template.html +72 -0
|
@@ -79,8 +79,9 @@ call `status --path <file>` rather than reconstructing state from prose.
|
|
|
79
79
|
confirm a new attempt with the user and preserve the existing attempt.
|
|
80
80
|
- `run-tests`: implement the current step's work, run the commands recorded in
|
|
81
81
|
`analysis`, and supply their actual evidence as described below.
|
|
82
|
-
- `done`: report the trace path, the passing integration result
|
|
83
|
-
|
|
82
|
+
- `done`: report the trace path, the passing integration result, the source
|
|
83
|
+
and test lines the work added, and any explicitly unverified limitation.
|
|
84
|
+
End the trace workflow.
|
|
84
85
|
|
|
85
86
|
Use `okstra trace advance --path <file> --step <id> [options]` for transitions.
|
|
86
87
|
After any failed `advance`, read its JSON error and call `status --path <file>`:
|
|
@@ -95,14 +96,14 @@ earlier failed command or edit state to bypass a rejection.
|
|
|
95
96
|
|
|
96
97
|
| Step | Body outcome before advancing |
|
|
97
98
|
|---|---|
|
|
98
|
-
| `analysis` | Preserve the request; map every requirement to `R-NNN` with its source sentence. Fill the `Key` / `Value` table for `language`, `unitTestCommand`, `integrationTestCommand`, `typecheckCommand`. For languages without a type checker, use a command checking that tests import. |
|
|
99
|
+
| `analysis` | Preserve the request; map every requirement to `R-NNN` with its source sentence. Fill the `Key` / `Value` table for `language`, `unitTestCommand`, `integrationTestCommand`, `typecheckCommand`. Write each command as the shell runs it: the table is stored as plain text, so a backslash copied from the JSON frontmatter of another trace stays doubled. A cell cannot hold `|` and backticks are removed, so put a pipeline behind a script or package command. For languages without a type checker, use a command checking that tests import. |
|
|
99
100
|
| `analysis-review` | Reviewers compare every request sentence with the requirement list. Record each reviewer's omissions and verdict. |
|
|
100
101
|
| `spec` | Put each specification item in a `Spec item` / `Requirement` table and link it to existing R-IDs. |
|
|
101
102
|
| `spec-review` | Reviewers check for missing R-IDs, specification items lacking R-IDs, unauthorized scope and overdesign. Record their findings and verdicts. |
|
|
102
103
|
| `interface-design` | Record domain boundaries and public signatures. Add a `Use case` / `Requirement` table with `UC-NNN` IDs and each use case's R-IDs. |
|
|
103
104
|
| `interface-review` | Reviewers check that every R-ID has a use case and the boundaries and signatures serve those cases. Record their findings and verdicts. |
|
|
104
105
|
| `interface-code` | Write interface code, record code paths and pass type checking, compilation or the recorded import check. |
|
|
105
|
-
| `tests-red` | Write unit and integration tests. Record `Test` / `Use case` / `Kind` / `Path` rows, using `integration` for integration rows; every UC needs
|
|
106
|
+
| `tests-red` | Write unit and integration tests. Record `Test` / `Use case` / `Kind` / `Path` rows, using `integration` for integration rows; every UC needs at least one integration test. Unit tests own a rule's variants (each boundary, limit and error kind). An integration test checks that the wired components carry one representative case of its UC and does not repeat a variant a unit test asserts, so a failure-path UC needs one integration case, not one per variant. Reuse the project's existing test setup (mocks, test modules, fixtures) through a shared helper instead of copying it into each new test file. Establish both unit and integration RED caused by missing implementation. |
|
|
106
107
|
| `implementation` | Implement the interfaces and reach unit GREEN. Record the integration result even when it remains RED. |
|
|
107
108
|
| `integration` | Reach integration GREEN for every use case. Record paths and results. |
|
|
108
109
|
|
|
@@ -153,6 +154,8 @@ Resolve `<host-runtime>` from the launcher's `OKSTRA_RUNTIME_HOST` when present;
|
|
|
153
154
|
lacks the current binding: the reviewed section, round, step, trace or host
|
|
154
155
|
changed after dispatch, or the binding was not copied verbatim. Review the
|
|
155
156
|
current text again under a new binding rather than editing the trace back.
|
|
157
|
+
A passing review re-reads the reviewed section's IDs and, for `analysis`, its
|
|
158
|
+
`Key` / `Value` table; edits made after the pass are not read.
|
|
156
159
|
`REVIEWER_NOT_INDEPENDENT` means a registered model from another provider was
|
|
157
160
|
skipped. A failed reviewer execution is retried once with a new invocation ID;
|
|
158
161
|
report a repeated failure as a blocker instead of judging the section yourself.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bg: #f7f7f5;
|
|
3
|
+
--panel: #ffffff;
|
|
4
|
+
--text: #1f2328;
|
|
5
|
+
--muted: #5f6670;
|
|
6
|
+
--line: #d9dbde;
|
|
7
|
+
--accent: #0969da;
|
|
8
|
+
--current: #1a7f37;
|
|
9
|
+
--historical: #9a6700;
|
|
10
|
+
--unverified: #6e7781;
|
|
11
|
+
--call: #0969da;
|
|
12
|
+
--event: #8250df;
|
|
13
|
+
--queue: #bf3989;
|
|
14
|
+
--shared-data: #1a7f37;
|
|
15
|
+
--file: #9a6700;
|
|
16
|
+
--batch: #cf222e;
|
|
17
|
+
}
|
|
18
|
+
@media (prefers-color-scheme: dark) {
|
|
19
|
+
:root {
|
|
20
|
+
--bg: #111418;
|
|
21
|
+
--panel: #1a1f25;
|
|
22
|
+
--text: #e6e8eb;
|
|
23
|
+
--muted: #9aa3ad;
|
|
24
|
+
--line: #2f363e;
|
|
25
|
+
--accent: #58a6ff;
|
|
26
|
+
--current: #3fb950;
|
|
27
|
+
--historical: #d29922;
|
|
28
|
+
--unverified: #8b949e;
|
|
29
|
+
--call: #58a6ff;
|
|
30
|
+
--event: #a371f7;
|
|
31
|
+
--queue: #db61a2;
|
|
32
|
+
--shared-data: #3fb950;
|
|
33
|
+
--file: #d29922;
|
|
34
|
+
--batch: #f85149;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
* { box-sizing: border-box; }
|
|
38
|
+
body {
|
|
39
|
+
margin: 0;
|
|
40
|
+
background: var(--bg);
|
|
41
|
+
color: var(--text);
|
|
42
|
+
font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
43
|
+
}
|
|
44
|
+
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
|
|
45
|
+
header h1 { margin: 0 0 4px; font-size: 22px; }
|
|
46
|
+
.meta { color: var(--muted); font-size: 13px; }
|
|
47
|
+
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
|
|
48
|
+
.empty { color: var(--muted); }
|
|
49
|
+
section { margin-top: 28px; }
|
|
50
|
+
h2 { font-size: 17px; margin: 0 0 10px; }
|
|
51
|
+
h3 { font-size: 14px; margin: 14px 0 6px; }
|
|
52
|
+
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
|
|
53
|
+
.scroll { overflow-x: auto; }
|
|
54
|
+
table { width: 100%; border-collapse: collapse; }
|
|
55
|
+
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
56
|
+
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
|
|
57
|
+
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
|
|
58
|
+
ul.plain { margin: 0; padding-left: 18px; }
|
|
59
|
+
|
|
60
|
+
.graph svg { width: 100%; height: auto; display: block; }
|
|
61
|
+
.graph .node circle { fill: var(--panel); stroke: var(--text); stroke-width: 1.5; cursor: pointer; }
|
|
62
|
+
.graph .node.outside circle { stroke-dasharray: 3 3; stroke: var(--muted); }
|
|
63
|
+
.graph .node.uninvestigated circle { fill: var(--bg); }
|
|
64
|
+
.graph .node.selected circle { stroke: var(--accent); stroke-width: 3; }
|
|
65
|
+
.graph .node text { fill: var(--text); font-size: 12px; text-anchor: middle; pointer-events: none; }
|
|
66
|
+
.graph .edge { fill: none; stroke-width: 1.8; cursor: pointer; }
|
|
67
|
+
.graph .edge.candidate { stroke-dasharray: 5 4; }
|
|
68
|
+
.graph .edge.dimmed { opacity: 0.15; }
|
|
69
|
+
.graph .edge.call, .legend .call { stroke: var(--call); color: var(--call); }
|
|
70
|
+
.graph .edge.event, .legend .event { stroke: var(--event); color: var(--event); }
|
|
71
|
+
.graph .edge.queue, .legend .queue { stroke: var(--queue); color: var(--queue); }
|
|
72
|
+
.graph .edge.shared-data, .legend .shared-data { stroke: var(--shared-data); color: var(--shared-data); }
|
|
73
|
+
.graph .edge.file, .legend .file { stroke: var(--file); color: var(--file); }
|
|
74
|
+
.graph .edge.batch, .legend .batch { stroke: var(--batch); color: var(--batch); }
|
|
75
|
+
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; font-size: 12px; }
|
|
76
|
+
.legend li::before { content: "━ "; }
|
|
77
|
+
|
|
78
|
+
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
|
|
79
|
+
.filters input, .filters select {
|
|
80
|
+
font: inherit; color: var(--text); background: var(--panel);
|
|
81
|
+
border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
|
|
82
|
+
}
|
|
83
|
+
.filters input { min-width: 280px; }
|
|
84
|
+
|
|
85
|
+
details.flow { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
|
|
86
|
+
details.flow > summary { cursor: pointer; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
|
|
87
|
+
details.flow > summary .name { font-weight: 600; }
|
|
88
|
+
details.flow > .body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
|
|
89
|
+
.chip { border: 1px solid currentColor; border-radius: 999px; padding: 0 8px; font-size: 12px; white-space: nowrap; }
|
|
90
|
+
.chip.current { color: var(--current); }
|
|
91
|
+
.chip.historical { color: var(--historical); }
|
|
92
|
+
.chip.unverified, .chip.partial { color: var(--unverified); }
|
|
93
|
+
.chip.complete { color: var(--muted); }
|
|
94
|
+
ol.steps { margin: 0; padding-left: 20px; }
|
|
95
|
+
ol.steps > li { margin-bottom: 12px; }
|
|
96
|
+
ol.steps .step-title { font-weight: 600; }
|
|
97
|
+
dl.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 6px 0 0; font-size: 13px; }
|
|
98
|
+
dl.fields dt { color: var(--muted); }
|
|
99
|
+
dl.fields dd { margin: 0; }
|
|
100
|
+
dl.terms dt { font-weight: 600; margin-top: 6px; }
|
|
101
|
+
dl.terms dd { margin: 0; }
|
|
102
|
+
ul.facts { margin: 0; padding-left: 18px; }
|
|
103
|
+
ul.facts li { margin-bottom: 6px; }
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Inlined into the group view page by okstra_ctl.doyouknow.group_view. The selection and
|
|
4
|
+
// layout functions take plain data so tests-js can run them without a browser.
|
|
5
|
+
(function (root) {
|
|
6
|
+
const EDGE_KINDS = ["call", "event", "queue", "shared-data", "file", "batch"];
|
|
7
|
+
const STEP_FIELDS = [
|
|
8
|
+
["inputs", "Inputs"], ["outputs", "Outputs"], ["rules", "Rules"], ["states", "States"],
|
|
9
|
+
["failures", "Failures"], ["retries", "Retries"], ["recovery", "Recovery"],
|
|
10
|
+
["before", "Before"], ["after", "After"], ["risks", "Risks"], ["sideEffects", "Side effects"],
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
function searchText(flow) {
|
|
14
|
+
const parts = [flow.title, flow.question, flow.summary, ...flow.gaps, ...flow.questions];
|
|
15
|
+
flow.terms.forEach((row) => parts.push(row.term, row.meaning));
|
|
16
|
+
flow.steps.forEach((step) => {
|
|
17
|
+
parts.push(step.title, step.purpose);
|
|
18
|
+
STEP_FIELDS.forEach(([key]) => parts.push(...[].concat(step[key])));
|
|
19
|
+
});
|
|
20
|
+
flow.facts.forEach((fact) => parts.push(fact.key, fact.business, fact.value, ...fact.evidence));
|
|
21
|
+
flow.relationships.forEach((row) => parts.push(row.data));
|
|
22
|
+
return parts.join("\n").toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Every whitespace-separated word of the query must appear; an empty projectId means any project.
|
|
26
|
+
// `flow.projects` is the set the collector stored for the flow, so the page never re-derives it.
|
|
27
|
+
function matchFlows(flows, query, projectId) {
|
|
28
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
29
|
+
return flows.filter((flow) => {
|
|
30
|
+
if (projectId && !flow.projects.includes(projectId)) return false;
|
|
31
|
+
const text = searchText(flow);
|
|
32
|
+
return words.every((word) => text.includes(word));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function graphProjects(data) {
|
|
37
|
+
const ids = data.projects.map((row) => row.projectId);
|
|
38
|
+
data.edges.forEach((edge) => [edge.from, edge.to].forEach((id) => ids.includes(id) || ids.push(id)));
|
|
39
|
+
return ids;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function circleLayout(ids, width, height) {
|
|
43
|
+
const radius = Math.min(width, height) / 2 - 70;
|
|
44
|
+
const positions = {};
|
|
45
|
+
ids.forEach((id, index) => {
|
|
46
|
+
const angle = (2 * Math.PI * index) / Math.max(ids.length, 1) - Math.PI / 2;
|
|
47
|
+
positions[id] = {
|
|
48
|
+
x: Math.round(width / 2 + (ids.length === 1 ? 0 : radius) * Math.cos(angle)),
|
|
49
|
+
y: Math.round(height / 2 + (ids.length === 1 ? 0 : radius) * Math.sin(angle)),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
return positions;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const NODE_RADIUS = 26;
|
|
56
|
+
|
|
57
|
+
function edgePath(from, to, index) {
|
|
58
|
+
if (from.x === to.x && from.y === to.y) {
|
|
59
|
+
// A relationship of a project with itself: a loop above the node, taller for each further one.
|
|
60
|
+
const top = from.y - NODE_RADIUS;
|
|
61
|
+
const rise = 46 + index * 18;
|
|
62
|
+
return `M ${from.x - 10} ${top} C ${from.x - 42} ${top - rise} ${from.x + 42} ${top - rise} ${from.x + 10} ${top - 6}`;
|
|
63
|
+
}
|
|
64
|
+
const dx = to.x - from.x;
|
|
65
|
+
const dy = to.y - from.y;
|
|
66
|
+
const length = Math.hypot(dx, dy);
|
|
67
|
+
const ux = dx / length;
|
|
68
|
+
const uy = dy / length;
|
|
69
|
+
// Parallel relationships between the same two projects bend by a different amount each.
|
|
70
|
+
const bend = 24 + index * 22;
|
|
71
|
+
const cx = (from.x + to.x) / 2 - uy * bend;
|
|
72
|
+
const cy = (from.y + to.y) / 2 + ux * bend;
|
|
73
|
+
const sx = from.x + ux * NODE_RADIUS;
|
|
74
|
+
const sy = from.y + uy * NODE_RADIUS;
|
|
75
|
+
const ex = to.x - ux * (NODE_RADIUS + 8);
|
|
76
|
+
const ey = to.y - uy * (NODE_RADIUS + 8);
|
|
77
|
+
return `M ${sx} ${sy} Q ${cx} ${cy} ${ex} ${ey}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
root.GroupView = { matchFlows, graphProjects, circleLayout, edgePath };
|
|
81
|
+
if (typeof document === "undefined") return;
|
|
82
|
+
|
|
83
|
+
const SVG = "http://www.w3.org/2000/svg";
|
|
84
|
+
const data = JSON.parse(document.getElementById("group-view-data").textContent);
|
|
85
|
+
const members = new Map(data.projects.map((row) => [row.projectId, row]));
|
|
86
|
+
const flowsById = new Map(data.flows.map((flow) => [flow.id, flow]));
|
|
87
|
+
const state = { query: "", project: "" };
|
|
88
|
+
|
|
89
|
+
function el(tag, attributes, children) {
|
|
90
|
+
const node = document.createElement(tag);
|
|
91
|
+
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
92
|
+
if (key === "text") node.textContent = value;
|
|
93
|
+
else node.setAttribute(key, value);
|
|
94
|
+
});
|
|
95
|
+
(children || []).forEach((child) => node.appendChild(child));
|
|
96
|
+
return node;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function svg(tag, attributes) {
|
|
100
|
+
const node = document.createElementNS(SVG, tag);
|
|
101
|
+
Object.entries(attributes || {}).forEach(([key, value]) => node.setAttribute(key, value));
|
|
102
|
+
return node;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function setVisible(id, visible) {
|
|
106
|
+
document.getElementById(id).hidden = !visible;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function selectProject(projectId) {
|
|
110
|
+
state.project = state.project === projectId ? "" : projectId;
|
|
111
|
+
document.getElementById("project-filter").value = state.project;
|
|
112
|
+
renderGraphSelection();
|
|
113
|
+
renderFlows();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function openFlow(flowId) {
|
|
117
|
+
state.query = "";
|
|
118
|
+
state.project = "";
|
|
119
|
+
document.getElementById("search").value = "";
|
|
120
|
+
document.getElementById("project-filter").value = "";
|
|
121
|
+
renderGraphSelection();
|
|
122
|
+
renderFlows();
|
|
123
|
+
const target = document.getElementById("flow-" + flowId);
|
|
124
|
+
target.open = true;
|
|
125
|
+
target.scrollIntoView({ block: "start" });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function renderHeader() {
|
|
129
|
+
document.getElementById("title").textContent = "Project group · " + data.projectGroup;
|
|
130
|
+
document.getElementById("meta").textContent =
|
|
131
|
+
`Generated ${data.generatedAt} · ${data.projects.length} projects · ${data.flows.length} flows · ${data.edges.length} relationships`;
|
|
132
|
+
const problems = document.getElementById("problems");
|
|
133
|
+
data.problems.forEach((text) => problems.appendChild(el("li", { text })));
|
|
134
|
+
setVisible("problems-section", data.problems.length > 0);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function renderGraph() {
|
|
138
|
+
const ids = graphProjects(data);
|
|
139
|
+
const width = 960;
|
|
140
|
+
const height = Math.max(360, Math.min(720, 200 + ids.length * 40));
|
|
141
|
+
const positions = circleLayout(ids, width, height);
|
|
142
|
+
const graph = document.getElementById("graph");
|
|
143
|
+
graph.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
144
|
+
const defs = svg("defs");
|
|
145
|
+
const marker = svg("marker", { id: "arrow", viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "7", markerHeight: "7", orient: "auto-start-reverse" });
|
|
146
|
+
marker.appendChild(svg("path", { d: "M 0 0 L 10 5 L 0 10 z", fill: "context-stroke" }));
|
|
147
|
+
defs.appendChild(marker);
|
|
148
|
+
graph.appendChild(defs);
|
|
149
|
+
|
|
150
|
+
const drawn = {};
|
|
151
|
+
data.edges.forEach((edge) => {
|
|
152
|
+
const pair = [edge.from, edge.to].sort().join("\n");
|
|
153
|
+
drawn[pair] = (drawn[pair] || 0) + 1;
|
|
154
|
+
const path = svg("path", {
|
|
155
|
+
class: `edge ${edge.kind} ${edge.standing}`,
|
|
156
|
+
d: edgePath(positions[edge.from], positions[edge.to], drawn[pair] - 1),
|
|
157
|
+
"marker-end": "url(#arrow)",
|
|
158
|
+
"data-from": edge.from,
|
|
159
|
+
"data-to": edge.to,
|
|
160
|
+
});
|
|
161
|
+
const title = svg("title");
|
|
162
|
+
title.textContent = `${edge.from} → ${edge.to} · ${edge.kind} · ${edge.reason} · ${flowsById.get(edge.flowId).title}`;
|
|
163
|
+
path.appendChild(title);
|
|
164
|
+
path.addEventListener("click", () => openFlow(edge.flowId));
|
|
165
|
+
graph.appendChild(path);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
ids.forEach((id) => {
|
|
169
|
+
const member = members.get(id);
|
|
170
|
+
const group = svg("g", {
|
|
171
|
+
class: "node" + (member ? (member.investigated ? "" : " uninvestigated") : " outside"),
|
|
172
|
+
"data-project": id,
|
|
173
|
+
transform: `translate(${positions[id].x} ${positions[id].y})`,
|
|
174
|
+
});
|
|
175
|
+
group.appendChild(svg("circle", { r: String(NODE_RADIUS) }));
|
|
176
|
+
const label = svg("text", { y: String(NODE_RADIUS + 16) });
|
|
177
|
+
label.textContent = id;
|
|
178
|
+
group.appendChild(label);
|
|
179
|
+
group.addEventListener("click", () => selectProject(id));
|
|
180
|
+
graph.appendChild(group);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const legend = document.getElementById("legend");
|
|
184
|
+
EDGE_KINDS.filter((kind) => data.edges.some((edge) => edge.kind === kind))
|
|
185
|
+
.forEach((kind) => legend.appendChild(el("li", { class: kind, text: kind })));
|
|
186
|
+
setVisible("graph-empty", data.edges.length === 0);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function renderGraphSelection() {
|
|
190
|
+
document.querySelectorAll("#graph .node").forEach((node) => {
|
|
191
|
+
node.classList.toggle("selected", node.getAttribute("data-project") === state.project);
|
|
192
|
+
});
|
|
193
|
+
document.querySelectorAll("#graph .edge").forEach((edge) => {
|
|
194
|
+
const touches = [edge.getAttribute("data-from"), edge.getAttribute("data-to")].includes(state.project);
|
|
195
|
+
edge.classList.toggle("dimmed", Boolean(state.project) && !touches);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function fieldList(step) {
|
|
200
|
+
const list = el("dl", { class: "fields" });
|
|
201
|
+
STEP_FIELDS.forEach(([key, label]) => {
|
|
202
|
+
const values = [].concat(step[key]).filter(Boolean);
|
|
203
|
+
if (values.length === 0) return;
|
|
204
|
+
list.appendChild(el("dt", { text: label }));
|
|
205
|
+
list.appendChild(el("dd", { text: values.join(" · ") }));
|
|
206
|
+
});
|
|
207
|
+
return list;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function flowBody(flow) {
|
|
211
|
+
const body = el("div", { class: "body" });
|
|
212
|
+
body.appendChild(el("p", { text: flow.summary }));
|
|
213
|
+
body.appendChild(el("p", { class: "meta", text: `Question: ${flow.question} · stored by ${flow.owner} · ${flow.updatedAt}` }));
|
|
214
|
+
body.appendChild(el("p", { class: "meta" }, [el("code", { text: flow.locator })]));
|
|
215
|
+
|
|
216
|
+
body.appendChild(el("h3", { text: "Steps" }));
|
|
217
|
+
body.appendChild(el("ol", { class: "steps" }, flow.steps.map((step) => el("li", {}, [
|
|
218
|
+
el("div", { class: "step-title", text: step.title }),
|
|
219
|
+
el("div", { text: step.purpose }),
|
|
220
|
+
el("div", { class: "meta", text: "Projects: " + step.projectIds.join(", ") }),
|
|
221
|
+
fieldList(step),
|
|
222
|
+
]))));
|
|
223
|
+
|
|
224
|
+
if (flow.relationships.length) {
|
|
225
|
+
body.appendChild(el("h3", { text: "Relationships between projects" }));
|
|
226
|
+
body.appendChild(el("ul", { class: "plain" }, flow.relationships.map((row) => el("li", {
|
|
227
|
+
text: `${row.from} → ${row.to} · ${row.kind} · ${row.data}`,
|
|
228
|
+
}))));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (flow.terms.length) {
|
|
232
|
+
body.appendChild(el("h3", { text: "Terms" }));
|
|
233
|
+
const terms = el("dl", { class: "terms" });
|
|
234
|
+
flow.terms.forEach((row) => {
|
|
235
|
+
terms.appendChild(el("dt", { text: row.term }));
|
|
236
|
+
terms.appendChild(el("dd", { text: row.meaning }));
|
|
237
|
+
});
|
|
238
|
+
body.appendChild(terms);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (flow.facts.length) {
|
|
242
|
+
body.appendChild(el("h3", { text: "Facts and where they were read" }));
|
|
243
|
+
body.appendChild(el("ul", { class: "facts" }, flow.facts.map((fact) => el("li", {}, [
|
|
244
|
+
el("span", { text: `${fact.value} ` }),
|
|
245
|
+
el("span", { class: "meta", text: `(${fact.level}) ` }),
|
|
246
|
+
el("code", { text: fact.key }),
|
|
247
|
+
el("div", {}, fact.evidence.map((ref) => el("code", { text: ref + " " }))),
|
|
248
|
+
]))));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
[["Unverified segments", flow.gaps], ["Open questions", flow.questions]].forEach(([heading, rows]) => {
|
|
252
|
+
if (rows.length === 0) return;
|
|
253
|
+
body.appendChild(el("h3", { text: heading }));
|
|
254
|
+
body.appendChild(el("ul", { class: "plain" }, rows.map((text) => el("li", { text }))));
|
|
255
|
+
});
|
|
256
|
+
return body;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function renderFlows() {
|
|
260
|
+
const matched = matchFlows(data.flows, state.query, state.project);
|
|
261
|
+
const container = document.getElementById("flows");
|
|
262
|
+
container.replaceChildren(...matched.map((flow) => el("details", { class: "flow", id: "flow-" + flow.id }, [
|
|
263
|
+
el("summary", {}, [
|
|
264
|
+
el("span", { class: "name", text: flow.title }),
|
|
265
|
+
el("span", { class: "chip " + flow.freshness, text: flow.freshness }),
|
|
266
|
+
el("span", { class: "chip " + flow.status, text: flow.status }),
|
|
267
|
+
el("span", { class: "meta", text: flow.projects.join(", ") }),
|
|
268
|
+
]),
|
|
269
|
+
flowBody(flow),
|
|
270
|
+
])));
|
|
271
|
+
document.getElementById("flow-count").textContent = `${matched.length} of ${data.flows.length}`;
|
|
272
|
+
setVisible("flows-empty", matched.length === 0);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function renderFilters() {
|
|
276
|
+
const select = document.getElementById("project-filter");
|
|
277
|
+
select.appendChild(el("option", { value: "", text: "All projects" }));
|
|
278
|
+
graphProjects(data).forEach((id) => select.appendChild(el("option", { value: id, text: id })));
|
|
279
|
+
select.addEventListener("change", () => {
|
|
280
|
+
state.project = select.value;
|
|
281
|
+
renderGraphSelection();
|
|
282
|
+
renderFlows();
|
|
283
|
+
});
|
|
284
|
+
document.getElementById("search").addEventListener("input", (event) => {
|
|
285
|
+
state.query = event.target.value;
|
|
286
|
+
renderFlows();
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function renderCoverage() {
|
|
291
|
+
const body = document.getElementById("coverage");
|
|
292
|
+
data.projects.forEach((row) => body.appendChild(el("tr", {}, [
|
|
293
|
+
el("td", {}, [el("code", { text: row.projectId })]),
|
|
294
|
+
el("td", { text: row.investigated ? "yes" : "no" }),
|
|
295
|
+
el("td", { text: String(row.flowCount) }),
|
|
296
|
+
el("td", {}, [el("code", { text: row.projectRoot + (row.rootExists ? "" : " (missing)") })]),
|
|
297
|
+
])));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function renderRecords() {
|
|
301
|
+
const body = document.getElementById("records");
|
|
302
|
+
data.records.forEach((row) => body.appendChild(el("tr", {}, [
|
|
303
|
+
el("td", { text: row.kind }),
|
|
304
|
+
el("td", {}, [el("div", { text: row.title }), el("code", { text: row.locator })]),
|
|
305
|
+
el("td", { text: row.projects.join(", ") }),
|
|
306
|
+
el("td", { text: row.updatedAt || "-" }),
|
|
307
|
+
])));
|
|
308
|
+
setVisible("records-empty", data.records.length === 0);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
renderHeader();
|
|
312
|
+
renderGraph();
|
|
313
|
+
renderFilters();
|
|
314
|
+
renderFlows();
|
|
315
|
+
renderCoverage();
|
|
316
|
+
renderRecords();
|
|
317
|
+
})(typeof globalThis !== "undefined" ? globalThis : this);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>{{TITLE}}</title>
|
|
7
|
+
<style>
|
|
8
|
+
{{STYLE}}
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main>
|
|
13
|
+
<header>
|
|
14
|
+
<h1 id="title"></h1>
|
|
15
|
+
<p class="meta" id="meta"></p>
|
|
16
|
+
</header>
|
|
17
|
+
|
|
18
|
+
<section id="problems-section" hidden>
|
|
19
|
+
<h2>Collection problems</h2>
|
|
20
|
+
<ul id="problems" class="plain"></ul>
|
|
21
|
+
</section>
|
|
22
|
+
|
|
23
|
+
<section>
|
|
24
|
+
<h2>Project relationships</h2>
|
|
25
|
+
<p class="hint">Select a project to list the flows that cover it. A dashed line is a relationship whose facts are not all confirmed from source.</p>
|
|
26
|
+
<div class="panel graph">
|
|
27
|
+
<svg id="graph" role="img" aria-label="Relationships between the projects of this group"></svg>
|
|
28
|
+
<ul id="legend" class="legend"></ul>
|
|
29
|
+
</div>
|
|
30
|
+
<p class="empty" id="graph-empty" hidden>No project relationship has been explained yet.</p>
|
|
31
|
+
</section>
|
|
32
|
+
|
|
33
|
+
<section>
|
|
34
|
+
<h2>Business flows</h2>
|
|
35
|
+
<div class="filters">
|
|
36
|
+
<label>Search <input id="search" type="search" placeholder="term, rule, state, fact, file" autocomplete="off"></label>
|
|
37
|
+
<label>Project <select id="project-filter"></select></label>
|
|
38
|
+
<span class="meta" id="flow-count"></span>
|
|
39
|
+
</div>
|
|
40
|
+
<div id="flows"></div>
|
|
41
|
+
<p class="empty" id="flows-empty" hidden>No flow matches.</p>
|
|
42
|
+
</section>
|
|
43
|
+
|
|
44
|
+
<section>
|
|
45
|
+
<h2>Coverage</h2>
|
|
46
|
+
<p class="hint">A project is investigated when at least one flow of this group inspected it. An uninvestigated project is not known to be unrelated.</p>
|
|
47
|
+
<div class="panel scroll">
|
|
48
|
+
<table>
|
|
49
|
+
<thead><tr><th>Project</th><th>Investigated</th><th>Own flows</th><th>Root</th></tr></thead>
|
|
50
|
+
<tbody id="coverage"></tbody>
|
|
51
|
+
</table>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<section>
|
|
56
|
+
<h2>Linked records</h2>
|
|
57
|
+
<p class="hint">Memory entries, manager tasks and project tasks that name a project of this group.</p>
|
|
58
|
+
<div class="panel scroll">
|
|
59
|
+
<table>
|
|
60
|
+
<thead><tr><th>Kind</th><th>Record</th><th>Projects</th><th>Updated</th></tr></thead>
|
|
61
|
+
<tbody id="records"></tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
<p class="empty" id="records-empty" hidden>No linked record.</p>
|
|
65
|
+
</section>
|
|
66
|
+
</main>
|
|
67
|
+
<script id="group-view-data" type="application/json">{{DATA}}</script>
|
|
68
|
+
<script>
|
|
69
|
+
{{SCRIPT}}
|
|
70
|
+
</script>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|