qgraphflow 0.0.6 → 0.0.7
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/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +2 -2
- package/.cursor-plugin/plugin.json +1 -1
- package/.qoder-plugin/plugin.json +1 -1
- package/README.md +119 -70
- package/docs/clients.de.md +15 -24
- package/docs/clients.es.md +15 -24
- package/docs/clients.ja.md +15 -24
- package/docs/clients.md +15 -24
- package/docs/clients.pt.md +15 -24
- package/docs/clients.ru.md +15 -24
- package/docs/clients.zh-CN.md +15 -24
- package/docs/readme/README.de.md +120 -71
- package/docs/readme/README.es.md +120 -71
- package/docs/readme/README.ja.md +120 -71
- package/docs/readme/README.pt.md +120 -71
- package/docs/readme/README.ru.md +120 -71
- package/docs/readme/README.zh-CN.md +106 -59
- package/examples/jeepay/README.md +23 -0
- package/examples/jeepay/capabilities.graph.json +270 -0
- package/examples/jeepay/class.graph.json +237 -0
- package/examples/jeepay/collection.graph.json +3057 -0
- package/examples/jeepay/dataflow.graph.json +212 -0
- package/examples/jeepay/deployment.graph.json +222 -0
- package/examples/jeepay/engineering.graph.json +277 -0
- package/examples/jeepay/er.graph.json +482 -0
- package/examples/jeepay/flowchart.graph.json +312 -0
- package/examples/jeepay/relations.graph.json +289 -0
- package/examples/jeepay/sequence.graph.json +355 -0
- package/examples/jeepay/source.json +95 -0
- package/examples/jeepay/state.graph.json +175 -0
- package/examples/jeepay/usecase.graph.json +222 -0
- package/package.json +14 -3
- package/skills/q-flow/SKILL.md +28 -20
- package/skills/q-flow/agents/openai.yaml +1 -1
- package/skills/q-flow/assets/viewer/package.json +1 -1
- package/skills/q-flow/assets/viewer/src/architecture-overview-theme.js +22 -0
- package/skills/q-flow/assets/viewer/src/architecture-overview.js +340 -0
- package/skills/q-flow/assets/viewer/src/diagrams/architecture.js +8 -5
- package/skills/q-flow/assets/viewer/src/diagrams/card.js +35 -17
- package/skills/q-flow/assets/viewer/src/diagrams/deployment.js +7 -5
- package/skills/q-flow/assets/viewer/src/diagrams/drawing.js +5 -2
- package/skills/q-flow/assets/viewer/src/diagrams/registry.js +10 -0
- package/skills/q-flow/assets/viewer/src/diagrams/sequence.js +13 -7
- package/skills/q-flow/assets/viewer/src/edge-routing.js +43 -22
- package/skills/q-flow/assets/viewer/src/export-svg.js +27 -5
- package/skills/q-flow/assets/viewer/src/graph-validation.js +72 -15
- package/skills/q-flow/assets/viewer/src/i18n-messages.json +184 -8
- package/skills/q-flow/assets/viewer/src/layout-compaction.js +123 -0
- package/skills/q-flow/assets/viewer/src/layout-measure.js +14 -8
- package/skills/q-flow/assets/viewer/src/layout-policy.js +6 -0
- package/skills/q-flow/assets/viewer/src/layout-quality.js +61 -15
- package/skills/q-flow/assets/viewer/src/layout-refinement.js +271 -0
- package/skills/q-flow/assets/viewer/src/layout-semantics.js +8 -0
- package/skills/q-flow/assets/viewer/src/layout-spacing.js +23 -4
- package/skills/q-flow/assets/viewer/src/layout-templates.js +298 -0
- package/skills/q-flow/assets/viewer/src/node-svg.js +1 -1
- package/skills/q-flow/assets/viewer/src/orthogonal-routing.js +475 -0
- package/skills/q-flow/assets/viewer/src/presentation-graph.js +31 -0
- package/skills/q-flow/assets/viewer/src/route-clearance.js +144 -0
- package/skills/q-flow/assets/viewer/src/sequence-executions.js +22 -0
- package/skills/q-flow/assets/viewer/src/sequence-fragments.js +20 -2
- package/skills/q-flow/assets/viewer/src/session-graph.js +46 -3
- package/skills/q-flow/assets/viewer/src/text-layout.js +33 -6
- package/skills/q-flow/assets/viewer/src/view-identity.js +26 -0
- package/skills/q-flow/assets/viewer/src/visual-style.js +13 -5
- package/skills/q-flow/assets/viewer-dist/index.html +30 -28
- package/skills/q-flow/references/evidence-sources.md +7 -5
- package/skills/q-flow/references/graph-common.md +34 -34
- package/skills/q-flow/references/graph-schema.md +28 -7
- package/skills/q-flow/references/guided-intake.md +51 -71
- package/skills/q-flow/references/layout-routing.md +47 -0
- package/skills/q-flow/references/types/architecture.md +42 -22
- package/skills/q-flow/references/types/class.md +9 -2
- package/skills/q-flow/references/types/dataflow.md +11 -4
- package/skills/q-flow/references/types/deployment.md +11 -3
- package/skills/q-flow/references/types/er.md +8 -1
- package/skills/q-flow/references/types/flowchart.md +12 -5
- package/skills/q-flow/references/types/sequence.md +20 -16
- package/skills/q-flow/references/types/state.md +10 -3
- package/skills/q-flow/references/types/usecase.md +6 -0
- package/skills/q-flow/references/viewer-development.md +37 -24
- package/skills/q-flow/references/visual-contract.md +12 -6
- package/skills/q-flow/scripts/compile-layout.mjs +85 -102
- package/skills/q-flow/scripts/compile-sequence.mjs +4 -21
- package/skills/q-flow/scripts/generate-viewer.mjs +18 -9
- package/skills/q-flow/scripts/validate-graph.mjs +38 -21
- package/examples/order-flow.graph.json +0 -94
|
@@ -1,41 +1,61 @@
|
|
|
1
1
|
# architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read with `graph-common.md`. Architecture offers three views:
|
|
4
|
+
|
|
5
|
+
- `meta.architectureView: "relations"` (default): 组件关系架构图 — calls and dependencies.
|
|
6
|
+
- `capabilities`: 平台能力架构图 — platform foundation, capabilities, business integration and rules.
|
|
7
|
+
- `engineering`: 工程分层架构图 — project organization and one component's internal layers, with parallel support.
|
|
4
8
|
|
|
5
9
|
| Node `kind` | Group `kind` | Edge `kind` |
|
|
6
10
|
| --- | --- | --- |
|
|
7
|
-
| `external`, `config`, `framework`, `security`, `service`, `business`, `data`, `failure`, `system`, `component`, `database` | `runtime`, `security`, `ownership`, `external` | `request`, `call`, `data`, `success`, `failure`, `framework`, `optional`, `depends` |
|
|
11
|
+
| `external`, `config`, `framework`, `security`, `service`, `business`, `data`, `failure`, `system`, `component`, `database` | `runtime`, `security`, `ownership`, `external` | `request`, `call`, `data`, `success`, `failure`, `framework`, `optional`, `depends`, `aggregates`, `inherits`, `provides` |
|
|
12
|
+
|
|
13
|
+
## Components and evidence
|
|
14
|
+
|
|
15
|
+
Use `business` for one or two business centres, `service` for entry points, `component` for internal modules, `data` for repositories/caches/queues as code, `database` for stores, `external` for systems outside the repo (no `source`), `security` for filters/auth, `config` for configuration, `framework` for framework-owned pieces, `failure` for explicit failure handling and `system` for a subsystem shown as one box.
|
|
16
|
+
|
|
17
|
+
`label` names the component at the chosen level; `subtitle` states its responsibility. Use exact class/route/table/package names when relevant; supporting detail goes in `facts` or overview body. Keep conceptual scope explicit; names/config do not prove status or runtime compatibility.
|
|
18
|
+
|
|
19
|
+
Edges follow calls/data: `request` HTTP/RPC, `call` in-process/service calls, `data` reads/writes, `success`/`failure` outcome branches, `framework` wiring, `optional` conditional paths. Label with the operation, usually up to 3 words; put details in `facts`. `site` anchors the call, construction or config that establishes repository evidence.
|
|
20
|
+
|
|
21
|
+
Direction is fixed: `aggregates` aggregator → member; `inherits` child → parent; `provides` provider → consumer; `depends` dependent → dependency. These are not runtime calls. Never reverse them to match the drawing's reading direction or delete them to simplify layout.
|
|
22
|
+
|
|
23
|
+
`groupId` / `parentId` encode real ownership: `runtime` process/JVM/container, `ownership` module/team, `security` trust zone, `external` outside systems. Draw an area-wide filter as a security boundary, not edges to every component. Nodes may be ungrouped.
|
|
8
24
|
|
|
9
|
-
##
|
|
25
|
+
## Overview structure
|
|
10
26
|
|
|
11
|
-
- `
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
Either overview requires non-empty `layout.sections`. Each section has a unique `id`, non-empty `title`, and `mode`: `stack` (layers), `grid` (wrapping peers), `row` (parallel regions), or `note` (explanations). Non-notes have non-empty `items`: each exactly one `{ "nodeId": "..." }`, `{ "groupId": "..." }`, or nested section. Group references include real members and child groups. Every node is placed exactly once. IDs must not collide with nodes/groups. `detailOf` optionally names the overall component represented by a detail section. Sections describe presentation only; keep real ownership unchanged.
|
|
28
|
+
|
|
29
|
+
Optional section `text` contains paragraph strings and `source` uses the common anchor. A note requires non-empty text and no items. Nodes accept `overviewText` paragraph strings and `badges`: `{ "label": "JDK 17", "role": "version", "evidence": "document", "source": { ... } }`. Roles: `status`, `version`, `requirement`; evidence kinds and optional anchors follow common rules. Empty arrays are valid on nodes. Reference-image status/version/rules are document claims, not verified source.
|
|
30
|
+
|
|
31
|
+
Repeated architecture views require distinct `meta.viewId`; all identities must be unique, including legacy type IDs. Collections have 1–32 views; other types stay unique. Menus show capabilities/engineering/relations as independent architecture types, adding titles for repeated templates.
|
|
32
|
+
|
|
33
|
+
Use reference bands/cards/badges. Section `tone` / node `overviewTone`: `white`, `subtle`, `blue`, `green`, `lavender`, `plain`; section `frame`: `solid`, `dashed`, `none`; grid `columns`: 1–16; row `weights`: positive numbers per item (detail/support `[2,1]`); node `overviewAccent`: boolean stripe. Use tones and grids to clarify each fictional or public model. Style is not evidence.
|
|
15
34
|
|
|
16
35
|
## Minimal valid skeleton
|
|
17
36
|
|
|
18
37
|
```json
|
|
19
38
|
{
|
|
20
|
-
"meta": { "title": "
|
|
21
|
-
"groups": [{ "id": "process", "label": "order-service process", "kind": "runtime" }],
|
|
39
|
+
"meta": { "title": "Platform integration", "diagramType": "architecture", "architectureView": "capabilities", "viewId": "platform-overview", "sourceRef": "Conceptual example", "locale": "en" },
|
|
22
40
|
"nodes": [
|
|
23
|
-
{ "id": "
|
|
24
|
-
{ "id": "
|
|
25
|
-
{ "id": "service", "label": "OrderService", "kind": "business", "groupId": "process", "module": "order", "subtitle": "createOrder · payOrder", "source": { "kind": "source", "file": "src/services/order-service.js", "lineStart": 6, "lineEnd": 49 } },
|
|
26
|
-
{ "id": "db", "label": "orders DB", "kind": "database", "groupId": "process", "module": "order", "source": { "kind": "schema", "file": "db/schema.sql", "lineStart": 1, "lineEnd": 31 } }
|
|
41
|
+
{ "id": "platform", "label": "Platform", "kind": "system", "module": "platform", "overviewText": ["Shared application capabilities"], "badges": [] },
|
|
42
|
+
{ "id": "application", "label": "Application", "kind": "component", "module": "application", "overviewText": [], "badges": [] }
|
|
27
43
|
],
|
|
28
|
-
"edges": [
|
|
29
|
-
|
|
30
|
-
{ "id": "
|
|
31
|
-
{ "id": "
|
|
32
|
-
|
|
44
|
+
"edges": [{ "id": "capabilities", "source": "platform", "target": "application", "kind": "provides", "label": "Shared capabilities", "evidence": "inference" }],
|
|
45
|
+
"layout": { "sections": [
|
|
46
|
+
{ "id": "platform-layer", "title": "Platform", "mode": "stack", "tone": "blue", "items": [{ "nodeId": "platform" }] },
|
|
47
|
+
{ "id": "application-layer", "title": "Applications", "mode": "grid", "tone": "green", "items": [{ "nodeId": "application" }] },
|
|
48
|
+
{ "id": "scope-note", "title": "Evidence scope", "mode": "note", "text": ["Conceptual structure, without source implementation claims."] }
|
|
49
|
+
] }
|
|
33
50
|
}
|
|
34
51
|
```
|
|
35
52
|
|
|
53
|
+
For relations, omit `architectureView` and `layout.sections`.
|
|
54
|
+
|
|
55
|
+
Generation measures full text. Unlock to reorder peers within the same section/group. Details edit body/badges/sections; apply relayouts, failure keeps the draft/valid canvas, cancel discards. Save keeps order/style; switch keeps each view; reset affects only the current view.
|
|
56
|
+
|
|
36
57
|
## Frequent validation errors
|
|
37
58
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- `
|
|
41
|
-
- Layout diagnostics after generation (`group.member-inset`, `route.*`) mean the view is too dense: split into two views rather than removing facts.
|
|
59
|
+
Reject unknown kinds/evidence, missing references/geometry and duplicate/missing placements. Report blockers; never drop facts or shrink text.
|
|
60
|
+
|
|
61
|
+
`layout.overviewConnections`: `within-category` (default) or `all`; categories are deepest sections. Page/export hide cross-category edges by default, retaining JSON/details. To show required cross-category dependencies, use `all` or relations.
|
|
@@ -10,6 +10,7 @@ Types and their structural relationships: inheritance, implementation, compositi
|
|
|
10
10
|
|
|
11
11
|
- `attributes` and `methods` are arrays of strings in UML form (`+cents: number`, `+charge(orderId, amount): Promise<Result>`); list the real members, keep declared types. `interface` and `abstract` render with their stereotype.
|
|
12
12
|
- Edge direction: `inheritance` child → parent; `implementation` class → `interface` (the target must be an interface); `composition` / `aggregation` whole → part (diamond at the whole); `association` from the holder of the reference to the referenced type; `dependency` user → used (`new`, parameter, return type).
|
|
13
|
+
- Edge `site`: the `extends` / `implements` clause or the field that holds the association.
|
|
13
14
|
- `sourceMultiplicity` / `targetMultiplicity` (`1`, `*`, `0..1`, `1..*`, `2..4`) are allowed only on `association`, `aggregation` and `composition`.
|
|
14
15
|
- Optional `layout.rank` puts parents / interfaces above their children; when given, a child must not rank above its parent.
|
|
15
16
|
- Keep 5–10 classes per view; show the members that matter for the question, but never fabricate ones.
|
|
@@ -26,12 +27,18 @@ Types and their structural relationships: inheritance, implementation, compositi
|
|
|
26
27
|
{ "id": "item", "label": "OrderItem", "kind": "class", "attributes": ["+sku: string", "+quantity: number"], "source": { "kind": "source", "file": "src/domain/order.js", "lineStart": 5, "lineEnd": 15 } }
|
|
27
28
|
],
|
|
28
29
|
"edges": [
|
|
29
|
-
{ "id": "c1", "source": "gateway", "target": "provider", "kind": "inheritance", "evidence": "source" },
|
|
30
|
-
{ "id": "c2", "source": "order", "target": "item", "kind": "composition", "label": "items", "sourceMultiplicity": "1", "targetMultiplicity": "1..*", "evidence": "source" }
|
|
30
|
+
{ "id": "c1", "source": "gateway", "target": "provider", "kind": "inheritance", "evidence": "source", "site": { "file": "src/domain/payment-provider.js", "lineStart": 8, "symbol": "PaymentProvider" } },
|
|
31
|
+
{ "id": "c2", "source": "order", "target": "item", "kind": "composition", "label": "items", "sourceMultiplicity": "1", "targetMultiplicity": "1..*", "evidence": "source", "site": { "file": "src/domain/order.js", "lineStart": 19, "symbol": "items" } }
|
|
31
32
|
]
|
|
32
33
|
}
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
## Layout
|
|
37
|
+
|
|
38
|
+
Contract parents above implementations; complete member compartments and lateral dependencies. Geometry is derived from full content; never shorten facts to fit the template.
|
|
39
|
+
|
|
40
|
+
Layout keeps attributes, methods, relation direction and endpoint markers; routes leave the nearest feasible class outline.
|
|
41
|
+
|
|
35
42
|
## Frequent validation errors
|
|
36
43
|
|
|
37
44
|
- `edge c implementation target must be an interface` — use `inheritance` for an abstract base class, `implementation` only towards `kind: "interface"`.
|
|
@@ -10,6 +10,7 @@ How data moves between external entities, processes and data stores (Gane–Sars
|
|
|
10
10
|
|
|
11
11
|
- `external` is a source or sink outside the system (user, partner API — no `source`); `process` transforms data (a service method, a job); `dataStore` holds it (table group, file, cache, topic).
|
|
12
12
|
- Every edge is `data` and its `label` names the data that flows (`customerId, items`, `paid orders`), not the operation. Direction is the direction the data moves; a request and its response are two edges when both carry data.
|
|
13
|
+
- Edge `site`: the read or write call that moves the data.
|
|
13
14
|
- Flows directly between stores, or from an external entity to a store, are kept when the source shows them; do not insert a process to make the notation "pure".
|
|
14
15
|
- `groups` mark ownership (`ownership`) or the outside world (`external`) only when the boundary is real. Anchor processes to the function, stores to the schema / file writer.
|
|
15
16
|
- Keep 6–10 nodes per view; one pipeline or one request path per view. `module` follows the evidenced domain of each process and store (the service, the cache layer, the topic); an external that belongs to a channel carries it too.
|
|
@@ -27,14 +28,20 @@ How data moves between external entities, processes and data stores (Gane–Sars
|
|
|
27
28
|
{ "id": "csv", "label": "settlement CSV", "kind": "dataStore" }
|
|
28
29
|
],
|
|
29
30
|
"edges": [
|
|
30
|
-
{ "id": "d1", "source": "buyer", "target": "create", "kind": "data", "label": "customerId, items", "evidence": "source" },
|
|
31
|
-
{ "id": "d2", "source": "create", "target": "orders", "kind": "data", "label": "order", "evidence": "source" },
|
|
32
|
-
{ "id": "d3", "source": "orders", "target": "export", "kind": "data", "label": "paid orders", "evidence": "source" },
|
|
33
|
-
{ "id": "d4", "source": "export", "target": "csv", "kind": "data", "label": "settlement rows", "evidence": "source" }
|
|
31
|
+
{ "id": "d1", "source": "buyer", "target": "create", "kind": "data", "label": "customerId, items", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 15, "symbol": "createOrder" } },
|
|
32
|
+
{ "id": "d2", "source": "create", "target": "orders", "kind": "data", "label": "order", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 30, "symbol": "save" } },
|
|
33
|
+
{ "id": "d3", "source": "orders", "target": "export", "kind": "data", "label": "paid orders", "evidence": "source", "site": { "file": "src/jobs/settlement-export.js", "lineStart": 8, "symbol": "findPaid" } },
|
|
34
|
+
{ "id": "d4", "source": "export", "target": "csv", "kind": "data", "label": "settlement rows", "evidence": "source", "site": { "file": "src/jobs/settlement-export.js", "lineStart": 19, "symbol": "writeFile" } }
|
|
34
35
|
]
|
|
35
36
|
}
|
|
36
37
|
```
|
|
37
38
|
|
|
39
|
+
## Layout
|
|
40
|
+
|
|
41
|
+
External inputs, processing stages and storage regions connected by the actual data relationships. Geometry is derived from full content; never shorten facts to fit the template.
|
|
42
|
+
|
|
43
|
+
Layout keeps process, store and external symbols, data names and flow direction.
|
|
44
|
+
|
|
38
45
|
## Frequent validation errors
|
|
39
46
|
|
|
40
47
|
- `edge d.kind is unsupported for dataflow` — only `data`; the operation belongs in the label.
|
|
@@ -11,7 +11,7 @@ Where runtime units run and how they connect: hosts, networks, containers, datab
|
|
|
11
11
|
- `container` for a running container / process, `node` for a VM or machine, `device` for hardware or a client device, `artifact` for a deployable file (jar, image, bundle), `service` for a managed / logical service, `database` for stores, `external` for third-party endpoints (no `source`).
|
|
12
12
|
- Groups model real boundaries from the manifests: `network` (compose networks, VPC subnets), `host`, `cluster`, `namespace`; nest with `parentId`. A node belongs to one group; when a unit sits on two networks, place it by its primary role and say so in `facts`.
|
|
13
13
|
- Edges: `network` for traffic (label with port or protocol), `depends` for `depends_on` / environment-variable references, `deploy` from a unit to the artifact it runs. Direction follows the connection initiator.
|
|
14
|
-
- Anchor each unit to its service block in the manifest (`source.kind: "config"`); evidence for edges is `config` or `document
|
|
14
|
+
- Anchor each unit to its service block in the manifest (`source.kind: "config"`); evidence for edges is `config` or `document`; an edge `site` is the manifest line declaring the port, `depends_on` or variable.
|
|
15
15
|
|
|
16
16
|
## Minimal valid skeleton
|
|
17
17
|
|
|
@@ -25,13 +25,21 @@ Where runtime units run and how they connect: hosts, networks, containers, datab
|
|
|
25
25
|
{ "id": "postgres", "label": "postgres", "kind": "database", "groupId": "data", "source": { "kind": "config", "file": "deploy/docker-compose.yml", "lineStart": 30, "lineEnd": 33 } }
|
|
26
26
|
],
|
|
27
27
|
"edges": [
|
|
28
|
-
{ "id": "d1", "source": "browser", "target": "api", "kind": "network", "label": "443", "evidence": "config" },
|
|
29
|
-
{ "id": "d2", "source": "api", "target": "postgres", "kind": "depends", "label": "DATABASE_URL", "evidence": "config" }
|
|
28
|
+
{ "id": "d1", "source": "browser", "target": "api", "kind": "network", "label": "443", "evidence": "config", "site": { "file": "deploy/docker-compose.yml", "lineStart": 12, "symbol": "443" } },
|
|
29
|
+
{ "id": "d2", "source": "api", "target": "postgres", "kind": "depends", "label": "DATABASE_URL", "evidence": "config", "site": { "file": "deploy/docker-compose.yml", "lineStart": 15, "symbol": "DATABASE_URL" } }
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
## Layout
|
|
35
|
+
|
|
36
|
+
Runtime tiers packed inside the existing network/host ownership hierarchy. Geometry is derived from full content; never shorten facts to fit the template.
|
|
37
|
+
|
|
38
|
+
Layout keeps nested runtime boundaries and cross-boundary relations; boundaries grow around real members, never reparent.
|
|
39
|
+
|
|
34
40
|
## Frequent validation errors
|
|
35
41
|
|
|
36
42
|
- `group X.parentId does not name a group` — nested networks must list their parent first.
|
|
37
43
|
- `node X.kind is unsupported for deployment` — `service` here is a deployment unit; application-code kinds (`component`, `business`) belong to architecture.
|
|
44
|
+
|
|
45
|
+
Optional node `layout.tier` accepts `external`, `application`, `infrastructure`, or `data`, arranged top to bottom. Without a hint: external nodes use external, databases data, queues/caches infrastructure, and other nodes application. It is a display hint, never a new runtime fact.
|
|
@@ -11,6 +11,7 @@ Tables (entities), their columns and keys, and the relationships with cardinalit
|
|
|
11
11
|
- Every entity has a non-empty `fields` array; each field `{ "name", "type", "key"?: "PK" | "FK" | "UK", "nullable"?: boolean }` copied from the DDL / mapping (types verbatim, `nullable: true` only when the column allows NULL). List every column of the table you show; do not invent columns, do not infer foreign keys that the schema does not declare.
|
|
12
12
|
- A relationship needs both `sourceCardinality` and `targetCardinality`, each one of `1`, `0..1`, `*`, `1..*`, `0..*`. Source is the referenced (parent) side, target the referencing side: `customers (1) → orders (0..*)`. A UNIQUE foreign key gives `1 → 0..1`. Label with the verb in the locale's language (`places`, `contains`).
|
|
13
13
|
- Anchor each entity to its `CREATE TABLE` (or ORM class) with `source.kind: "schema"`. Keep 4–8 entities per view; large schemas become several views by aggregate.
|
|
14
|
+
- Edge `site`: the foreign-key constraint or mapping annotation; `symbol` is the referenced table.
|
|
14
15
|
|
|
15
16
|
## Minimal valid skeleton
|
|
16
17
|
|
|
@@ -24,11 +25,17 @@ Tables (entities), their columns and keys, and the relationships with cardinalit
|
|
|
24
25
|
"fields": [{ "name": "id", "type": "VARCHAR(32)", "key": "PK", "nullable": false }, { "name": "customer_id", "type": "BIGINT", "key": "FK", "nullable": false }, { "name": "status", "type": "VARCHAR(16)", "nullable": false }] }
|
|
25
26
|
],
|
|
26
27
|
"edges": [
|
|
27
|
-
{ "id": "r1", "source": "customers", "target": "orders", "kind": "relationship", "label": "places", "sourceCardinality": "1", "targetCardinality": "0..*", "evidence": "schema" }
|
|
28
|
+
{ "id": "r1", "source": "customers", "target": "orders", "kind": "relationship", "label": "places", "sourceCardinality": "1", "targetCardinality": "0..*", "evidence": "schema", "site": { "file": "db/schema.sql", "lineStart": 11, "symbol": "customers" } }
|
|
28
29
|
]
|
|
29
30
|
}
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
## Layout
|
|
34
|
+
|
|
35
|
+
A related-entity matrix with full field columns and dedicated cardinality/label corridors. Geometry is derived from full content; never shorten facts to fit the template.
|
|
36
|
+
|
|
37
|
+
Layout keeps fields, relation direction, cardinalities and endpoint symbols; routes leave the nearest feasible entity outline.
|
|
38
|
+
|
|
32
39
|
## Frequent validation errors
|
|
33
40
|
|
|
34
41
|
- `node X.fields must be an array` / entity without fields — every entity lists at least one field.
|
|
@@ -14,6 +14,7 @@ The steps and decisions of one function, use case or job, top to bottom. Read wi
|
|
|
14
14
|
- The main path must read downward. When the happy path is not obvious from the edges, list it in `layout.primaryPath` (node ids in order, each pair joined by a directed edge). Feedback / retry edges are allowed and route around the outside.
|
|
15
15
|
- `module` per step is the subsystem whose work the step performs: a call into inventory is inventory's work, a payment check is payment's, a pure control decision keeps the owning component, `start` / `end` take the caller. A flow that really lives inside one subsystem keeps one module; `module.single-tone` only asks you to check.
|
|
16
16
|
- A `process`, `input`, `output` or `subprocess` has exactly one outgoing edge; only a `decision` branches (`flowchart.process-branch`).
|
|
17
|
+
- Edge `site`: the call that runs a step, or the condition line of a `yes` / `no` branch.
|
|
17
18
|
- Anchor each step to the lines that implement it. Keep 8–14 nodes; merge trivial assignments into the step that owns them.
|
|
18
19
|
|
|
19
20
|
## Minimal valid skeleton
|
|
@@ -31,15 +32,21 @@ The steps and decisions of one function, use case or job, top to bottom. Read wi
|
|
|
31
32
|
{ "id": "failed", "label": "throw 402", "kind": "end", "module": "orders" }
|
|
32
33
|
],
|
|
33
34
|
"edges": [
|
|
34
|
-
{ "id": "f1", "source": "start", "target": "reserve", "kind": "flow", "evidence": "source" },
|
|
35
|
-
{ "id": "f2", "source": "reserve", "target": "ok", "kind": "flow", "evidence": "source" },
|
|
36
|
-
{ "id": "f3", "source": "ok", "target": "persist", "kind": "yes", "label": "yes", "evidence": "source" },
|
|
37
|
-
{ "id": "f4", "source": "ok", "target": "failed", "kind": "no", "label": "no", "evidence": "source" },
|
|
38
|
-
{ "id": "f5", "source": "persist", "target": "done", "kind": "success", "evidence": "source" }
|
|
35
|
+
{ "id": "f1", "source": "start", "target": "reserve", "kind": "flow", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 17, "symbol": "reserve" } },
|
|
36
|
+
{ "id": "f2", "source": "reserve", "target": "ok", "kind": "flow", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 25, "symbol": "ok" } },
|
|
37
|
+
{ "id": "f3", "source": "ok", "target": "persist", "kind": "yes", "label": "yes", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 32, "symbol": "persist" } },
|
|
38
|
+
{ "id": "f4", "source": "ok", "target": "failed", "kind": "no", "label": "no", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 27, "symbol": "failed" } },
|
|
39
|
+
{ "id": "f5", "source": "persist", "target": "done", "kind": "success", "evidence": "source", "site": { "file": "src/services/order-service.js", "lineStart": 34, "symbol": "done" } }
|
|
39
40
|
]
|
|
40
41
|
}
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
## Layout
|
|
45
|
+
|
|
46
|
+
A vertical main spine with separate side branches and outer feedback corridors. Geometry is derived from full content; never shorten facts to fit the template.
|
|
47
|
+
|
|
48
|
+
Layout keeps decision exits on distinct sides, the declared main path and full branch labels.
|
|
49
|
+
|
|
43
50
|
## Frequent validation errors
|
|
44
51
|
|
|
45
52
|
- `layout.primaryPath has no directed edge from A to B` — the path must follow existing edges; fix the path or add the missing edge.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# sequence
|
|
2
2
|
|
|
3
|
-
Calls and returns along one flow, with activation bars and fragments. Read with `graph-common.md
|
|
3
|
+
Calls and returns along one flow, with activation bars and fragments. Read with `graph-common.md`.
|
|
4
4
|
|
|
5
5
|
| Node `kind` | Group `kind` | Edge `kind` |
|
|
6
6
|
| --- | --- | --- |
|
|
@@ -8,14 +8,15 @@ Calls and returns along one flow, with activation bars and fragments. Read with
|
|
|
8
8
|
|
|
9
9
|
## Participants (nodes)
|
|
10
10
|
|
|
11
|
-
- One node per lifeline: `actor` for the human or caller, `service` / `participant` for code you read, `external` for systems outside the repository, `database` for a store
|
|
11
|
+
- One node per lifeline: `actor` for the human or caller, `service` / `participant` for code you read, `external` for systems outside the repository, `database` for a store. Participants never have `groupId`.
|
|
12
12
|
- Left-to-right order follows first appearance in the messages; `layout.participantOrder` (all ids, once) only reproduces an existing convention.
|
|
13
|
+
- 8 participants / 20 messages is advisory; user detail wins. Follow common splitting rules.
|
|
13
14
|
|
|
14
15
|
## Messages (edges)
|
|
15
16
|
|
|
16
17
|
- Every message has `order` (positive integer, unique, increasing in time; gaps allowed), a non-empty `label` (method or message with the important arguments), `evidence`, and `kind`: `sync` (caller waits), `async` (no wait: events, publish), `return` (reply, drawn dashed).
|
|
17
|
-
- A `return` carries `"replyTo": "<call id>"`: the call is an earlier `sync` / `async` with reversed endpoints, has at most one return, and both sit in the same fragment operand.
|
|
18
|
-
- Self-messages are allowed. Alternative outcomes of one call are one return
|
|
18
|
+
- A `return` carries `"replyTo": "<call id>"`: the call is an earlier `sync` / `async` with reversed endpoints, has at most one return, and both sit in the same fragment operand.
|
|
19
|
+
- Self-messages are allowed. Alternative outcomes of one call are one return (`ok | declined`).
|
|
19
20
|
|
|
20
21
|
## Activation bars (`executions`)
|
|
21
22
|
|
|
@@ -31,8 +32,8 @@ Top-level array of `{ "id", "participantId", "start": { "edgeId", "at" }, "end":
|
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
- `alt`: two or more guarded operands, optional `else` last. `opt`: one guarded operand. `loop`: one guarded operand plus `loop: { "min", "max" | "*" }`. `par`: two or more operands with `label` instead of `guard` (concurrent; vertical order is not time).
|
|
34
|
-
- `edgeIds` lists the operand's messages; an operand may instead or also carry `body` text or a child fragment (`parentId` + `parentOperandId`). Operand ids are required except on `alt`; a message belongs to at most one operand; successive operands' `order` ranges must not interleave.
|
|
35
|
-
- Guards are display text — copy the real condition. Only fragments the source establishes (
|
|
35
|
+
- `edgeIds` lists the operand's messages; an operand may instead or also carry `body` text or a child fragment (`parentId` + `parentOperandId`). Operand ids are required except on `alt`; a message belongs to at most one operand; successive operands' `order` ranges must not interleave.
|
|
36
|
+
- Guards are display text — copy the real condition. Only fragments the source establishes (`if`, retry loop, concurrent handlers).
|
|
36
37
|
|
|
37
38
|
## Minimal valid skeleton
|
|
38
39
|
|
|
@@ -41,9 +42,9 @@ Top-level array of `{ "id", "participantId", "start": { "edgeId", "at" }, "end":
|
|
|
41
42
|
"meta": { "title": "POST /orders → createOrder", "sourceRef": "repo@main", "diagramType": "sequence", "locale": "zh-CN" },
|
|
42
43
|
"nodes": [
|
|
43
44
|
{ "id": "client", "label": "caller", "kind": "actor" },
|
|
44
|
-
{ "id": "service", "label": "OrderService", "kind": "service", "source": { "kind": "source", "file": "src/
|
|
45
|
-
{ "id": "payments", "label": "PaymentProvider", "kind": "external", "source": { "kind": "source", "file": "src/
|
|
46
|
-
{ "id": "bus", "label": "EventBus", "kind": "participant", "source": { "kind": "source", "file": "src/
|
|
45
|
+
{ "id": "service", "label": "OrderService", "kind": "service", "source": { "kind": "source", "file": "src/order-service.js", "lineStart": 15, "lineEnd": 37 } },
|
|
46
|
+
{ "id": "payments", "label": "PaymentProvider", "kind": "external", "source": { "kind": "source", "file": "src/payment.js", "lineStart": 2, "lineEnd": 6 } },
|
|
47
|
+
{ "id": "bus", "label": "EventBus", "kind": "participant", "source": { "kind": "source", "file": "src/bus.js", "lineStart": 13, "lineEnd": 17 } }
|
|
47
48
|
],
|
|
48
49
|
"groups": [
|
|
49
50
|
{ "id": "outcome", "label": "payment result", "kind": "alt", "operands": [
|
|
@@ -51,10 +52,10 @@ Top-level array of `{ "id", "participantId", "start": { "edgeId", "at" }, "end":
|
|
|
51
52
|
{ "id": "declined", "guard": "else", "edgeIds": [], "body": "release inventory, throw 402" } ] }
|
|
52
53
|
],
|
|
53
54
|
"edges": [
|
|
54
|
-
{ "id": "m1", "source": "client", "target": "service", "kind": "sync", "label": "createOrder(items)", "order": 1, "evidence": "source" },
|
|
55
|
-
{ "id": "m2", "source": "service", "target": "payments", "kind": "sync", "label": "charge(orderId, total)", "order": 2, "evidence": "source" },
|
|
55
|
+
{ "id": "m1", "source": "client", "target": "service", "kind": "sync", "label": "createOrder(items)", "order": 1, "evidence": "source", "site": { "file": "src/order-service.js", "lineStart": 15 } },
|
|
56
|
+
{ "id": "m2", "source": "service", "target": "payments", "kind": "sync", "label": "charge(orderId, total)", "order": 2, "evidence": "source", "site": { "file": "src/order-service.js", "lineStart": 28, "symbol": "charge" } },
|
|
56
57
|
{ "id": "m3", "source": "payments", "target": "service", "kind": "return", "label": "{ ok, transactionId }", "order": 3, "replyTo": "m2", "evidence": "source" },
|
|
57
|
-
{ "id": "m4", "source": "service", "target": "bus", "kind": "async", "label": "publish(order.created)", "order": 4, "evidence": "source" },
|
|
58
|
+
{ "id": "m4", "source": "service", "target": "bus", "kind": "async", "label": "publish(order.created)", "order": 4, "evidence": "source", "site": { "file": "src/order-service.js", "lineStart": 35, "symbol": "publish" } },
|
|
58
59
|
{ "id": "m5", "source": "service", "target": "client", "kind": "return", "label": "order | 402", "order": 5, "replyTo": "m1", "evidence": "source" }
|
|
59
60
|
],
|
|
60
61
|
"executions": [
|
|
@@ -64,11 +65,14 @@ Top-level array of `{ "id", "participantId", "start": { "edgeId", "at" }, "end":
|
|
|
64
65
|
}
|
|
65
66
|
```
|
|
66
67
|
|
|
68
|
+
## Layout
|
|
69
|
+
|
|
70
|
+
Layout widens participant gaps for full labels; message order, reply pairing, bars and fragments stay.
|
|
71
|
+
|
|
67
72
|
## Frequent validation errors
|
|
68
73
|
|
|
69
|
-
- `edge m.order must be a positive integer for sequence` / `order duplicates N` — `--fix` renumbers in array order
|
|
70
|
-
- `edge r.replyTo m must reference a sync or async call from a return` / `endpoints must be reversed` / `must precede its return` — point at the right call; `--fix` fills
|
|
71
|
-
- `group g.operands order ranges must be ordered and non-interleaving` — all
|
|
72
|
-
- `group g.operands[i].id is required` — `opt` / `loop` / `par` operands need ids (`--fix` adds `op1..`).
|
|
74
|
+
- `edge m.order must be a positive integer for sequence` / `order duplicates N` — `--fix` renumbers in array order.
|
|
75
|
+
- `edge r.replyTo m must reference a sync or async call from a return` / `endpoints must be reversed` / `must precede its return` — point at the right call; `--fix` fills a unique candidate.
|
|
76
|
+
- `group g.operands order ranges must be ordered and non-interleaving` — all of operand 1 precedes operand 2: move a message or split the fragment.
|
|
73
77
|
- `execution x.start endpoint m does not belong to participant p` — `send` ⇒ source, `receive` ⇒ target.
|
|
74
78
|
- `Sequence group g needs explicit operands before automatic layout` — every fragment declares `operands`.
|
|
@@ -14,6 +14,7 @@ The lifecycle of one component or entity: states, the events that move between t
|
|
|
14
14
|
- A guard is a condition the source checks, never a restatement of the source state (`state != RUNNING` on a transition out of `STARTING`). When an event leads every state to one target (shutdown, close), draw the transitions the source names per state and put "entered from any state on …" in the target's `facts`.
|
|
15
15
|
- A `state` may carry `entry`, `do` and `exit`: one plain string each for what the source runs on entering the state, while it stays active and on leaving it (`"entry": "schedule the timeout, send the registration"`). Take an action out of a transition's `action` and into `entry` when the code runs it after the state is set; leave out the keys the source does not show, never invent a `do`.
|
|
16
16
|
- Anchor each state to where it is declared (enum member, transition-table row, status constant). Tag the state the component exists to reach and stay in (`running`, `active`) with `tags: ["core"]`.
|
|
17
|
+
- Edge `site`: the line that sets the target state; `symbol` is the target constant.
|
|
17
18
|
- State colors are derived from the lifecycle and never written: the `core` state is green, a state with no way on (or only into a `final`) is slate, a state tagged `failure` is red, and the rest run warm to cool in the order the machine reaches them (orange, blue, teal, …). So always tag the goal state `core`: without one the states keep their module color. Use `tags: ["failure"]` only for an error or aborted state, not for every cancellation or timeout.
|
|
18
19
|
- One machine per view; keep 5–10 states. States carry the component's `module`; a `choice` takes the module of the subsystem whose result it branches on; `initial` / `final` never carry a wash.
|
|
19
20
|
|
|
@@ -29,13 +30,19 @@ The lifecycle of one component or entity: states, the events that move between t
|
|
|
29
30
|
{ "id": "cancelled", "label": "cancelled", "kind": "state", "source": { "kind": "source", "file": "src/domain/order-state.js", "lineStart": 6, "lineEnd": 6 } }
|
|
30
31
|
],
|
|
31
32
|
"edges": [
|
|
32
|
-
{ "id": "s0", "source": "initial", "target": "created", "kind": "transition", "label": "new Order", "evidence": "source" },
|
|
33
|
-
{ "id": "s1", "source": "created", "target": "paid", "kind": "transition", "label": "pay", "guard": "payment.ok", "evidence": "source" },
|
|
34
|
-
{ "id": "s2", "source": "created", "target": "cancelled", "kind": "transition", "label": "cancel", "action": "release inventory", "evidence": "source" }
|
|
33
|
+
{ "id": "s0", "source": "initial", "target": "created", "kind": "transition", "label": "new Order", "evidence": "source", "site": { "file": "src/domain/order.js", "lineStart": 22, "symbol": "CREATED" } },
|
|
34
|
+
{ "id": "s1", "source": "created", "target": "paid", "kind": "transition", "label": "pay", "guard": "payment.ok", "evidence": "source", "site": { "file": "src/domain/order.js", "lineStart": 41, "symbol": "PAID" } },
|
|
35
|
+
{ "id": "s2", "source": "created", "target": "cancelled", "kind": "transition", "label": "cancel", "action": "release inventory", "evidence": "source", "site": { "file": "src/domain/order.js", "lineStart": 47, "symbol": "CANCELLED" } }
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
```
|
|
38
39
|
|
|
40
|
+
## Layout
|
|
41
|
+
|
|
42
|
+
Initial state, lifecycle bands, outcome branches and local self-transitions. Geometry is derived from full content; never shorten facts to fit the template.
|
|
43
|
+
|
|
44
|
+
Layout keeps initial/final symbols, transition labels and the self-transition arc.
|
|
45
|
+
|
|
39
46
|
## Frequent validation errors
|
|
40
47
|
|
|
41
48
|
- `edge s.guard must be a string` — guards and actions are plain text, not objects or booleans.
|
|
@@ -33,6 +33,12 @@ Actors and what they can do, with include / extend relationships between use cas
|
|
|
33
33
|
}
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## Layout
|
|
37
|
+
|
|
38
|
+
Actors outside the real system boundary and use cases in a compact internal matrix. Geometry is derived from full content; never shorten facts to fit the template.
|
|
39
|
+
|
|
40
|
+
Layout keeps the system boundary, actor identity and include/extend direction.
|
|
41
|
+
|
|
36
42
|
## Frequent validation errors
|
|
37
43
|
|
|
38
44
|
- `node X.groupId places an actor inside a system boundary` — remove `groupId` from actors.
|