@principal-ai/subsystems-react 0.51.4 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/subsystem/C4Graph.d.ts +3 -7
- package/dist/subsystem/C4Graph.d.ts.map +1 -1
- package/dist/subsystem/C4Graph.js +159 -45
- package/dist/subsystem/C4Graph.js.map +1 -1
- package/dist/subsystem/C4NodeCard.d.ts +26 -26
- package/dist/subsystem/C4NodeCard.d.ts.map +1 -1
- package/dist/subsystem/C4NodeCard.js +56 -30
- package/dist/subsystem/C4NodeCard.js.map +1 -1
- package/dist/subsystem/IssueList.d.ts +1 -1
- package/dist/subsystem/IssueList.d.ts.map +1 -1
- package/dist/subsystem/IssueList.js +20 -1
- package/dist/subsystem/IssueList.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +42 -19
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/c4.d.ts +48 -49
- package/dist/subsystem/c4.d.ts.map +1 -1
- package/dist/subsystem/c4.js +50 -0
- package/dist/subsystem/c4.js.map +1 -1
- package/dist/subsystem/c4Evidence.d.ts +88 -84
- package/dist/subsystem/c4Evidence.d.ts.map +1 -1
- package/dist/subsystem/c4Evidence.js +113 -166
- package/dist/subsystem/c4Evidence.js.map +1 -1
- package/dist/subsystem/nodes.js +5 -5
- package/dist/subsystem/nodes.js.map +1 -1
- package/dist/subsystem/techIcons/index.d.ts +5 -0
- package/dist/subsystem/techIcons/index.d.ts.map +1 -1
- package/dist/subsystem/techIcons/index.js +3 -0
- package/dist/subsystem/techIcons/index.js.map +1 -1
- package/dist/utils/edgeLabel.d.ts +15 -1
- package/dist/utils/edgeLabel.d.ts.map +1 -1
- package/dist/utils/edgeLabel.js +25 -1
- package/dist/utils/edgeLabel.js.map +1 -1
- package/dist/utils/elkLayout.d.ts +47 -0
- package/dist/utils/elkLayout.d.ts.map +1 -1
- package/dist/utils/elkLayout.js +71 -7
- package/dist/utils/elkLayout.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +8 -6
- package/src/stories/Subsystem/C4Graph/C4Component.stories.tsx +198 -0
- package/src/stories/Subsystem/C4Graph/C4Container.stories.tsx +42 -6
- package/src/stories/Subsystem/C4Graph/C4NodeGallery.stories.tsx +9 -7
- package/src/stories/Subsystem/ComponentGraph/Issues.stories.tsx +686 -2
- package/src/subsystem/C4Graph.tsx +242 -82
- package/src/subsystem/C4NodeCard.test.ts +32 -22
- package/src/subsystem/C4NodeCard.tsx +67 -39
- package/src/subsystem/IssueList.tsx +23 -0
- package/src/subsystem/SubsystemComponentGraph.tsx +38 -16
- package/src/subsystem/c4.protocolColor.test.ts +26 -0
- package/src/subsystem/c4.ts +76 -52
- package/src/subsystem/c4Evidence.test.ts +177 -237
- package/src/subsystem/c4Evidence.ts +160 -235
- package/src/subsystem/nodes.group.test.tsx +15 -0
- package/src/subsystem/nodes.tsx +7 -7
- package/src/subsystem/techIcons/index.tsx +8 -0
- package/src/utils/edgeLabel.test.ts +21 -2
- package/src/utils/edgeLabel.ts +29 -1
- package/src/utils/elkLayout.test.ts +16 -0
- package/src/utils/elkLayout.ts +119 -7
- package/src/stories/Subsystem/ComponentGraph/IssueOverlay.stories.tsx +0 -602
package/dist/subsystem/c4.d.ts
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* supplies the drawable model directly rather than having trails converted into
|
|
13
13
|
* lines.
|
|
14
14
|
*
|
|
15
|
+
* The element set is an umbrella over a model, not a standalone artifact: what
|
|
16
|
+
* sits inside a box resolves from the model document's `process` fields, folded
|
|
17
|
+
* to the claiming container's key by accepted consolidation records (see
|
|
18
|
+
* `c4Evidence`). Nothing here stores membership, so nothing here can drift from
|
|
19
|
+
* the model it organizes.
|
|
20
|
+
*
|
|
15
21
|
* ## Why a union and not one type with two axes
|
|
16
22
|
*
|
|
17
23
|
* C4's vocabulary is closed: software system, container, component, code —
|
|
@@ -31,7 +37,6 @@
|
|
|
31
37
|
*
|
|
32
38
|
* [C4 notation]: https://c4model.com/diagrams/notation
|
|
33
39
|
*/
|
|
34
|
-
import type { SubsystemComponent } from './model';
|
|
35
40
|
/**
|
|
36
41
|
* Has anyone signed off on this element yet?
|
|
37
42
|
*
|
|
@@ -50,27 +55,22 @@ interface C4ElementBase {
|
|
|
50
55
|
/** Display name. */
|
|
51
56
|
label: string;
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* runs of code being one container is a judgement, not a lookup.
|
|
57
|
-
*
|
|
58
|
-
* Each alias belongs to exactly one element.
|
|
59
|
-
*/
|
|
60
|
-
members: string[];
|
|
61
|
-
/**
|
|
62
|
-
* The `process` values this element consolidated, when it came from more than
|
|
63
|
-
* one. Purely provenance — it lets the confirm UI show "this box absorbed
|
|
64
|
-
* principal-studio/host". Never used to infer membership.
|
|
58
|
+
* Nesting parent. A component's container, or a container's system frame.
|
|
59
|
+
* Absent on an external system or a person — both are outside the boundary:
|
|
60
|
+
* an external is someone else's system, a person is never part of one.
|
|
65
61
|
*/
|
|
66
|
-
|
|
62
|
+
parentId?: string;
|
|
67
63
|
/** C4 asks every element to carry a one-line responsibility. */
|
|
68
64
|
description?: string;
|
|
69
65
|
state: C4ElementState;
|
|
70
66
|
/** Why this element is proposed as it is — shown in the confirm UI. */
|
|
71
67
|
rationale?: string;
|
|
72
|
-
/**
|
|
73
|
-
|
|
68
|
+
/** The component aliases this element groups. */
|
|
69
|
+
members?: string[];
|
|
70
|
+
/** Distinct constructs among the members, when resolved from a document. */
|
|
71
|
+
constructs?: string[];
|
|
72
|
+
/** Source model ids that contributed members, when attribution is supplied. */
|
|
73
|
+
models?: string[];
|
|
74
74
|
/** When the state last changed (ISO). */
|
|
75
75
|
decidedAt?: string;
|
|
76
76
|
}
|
|
@@ -91,6 +91,12 @@ export interface C4Container extends C4ElementBase {
|
|
|
91
91
|
containerKind: C4ContainerKind;
|
|
92
92
|
/** C4 requires a technology on every container. */
|
|
93
93
|
technology: string;
|
|
94
|
+
/**
|
|
95
|
+
* The `process` key this container claims — the boundary it verifies,
|
|
96
|
+
* matched exactly against the model document's keys. Not a member list:
|
|
97
|
+
* the components inside resolve from the model document.
|
|
98
|
+
*/
|
|
99
|
+
process?: string;
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
96
102
|
* A functional grouping inside a container — the C4 level 3 box.
|
|
@@ -120,7 +126,14 @@ export interface C4Person extends C4ElementBase {
|
|
|
120
126
|
}
|
|
121
127
|
/** One element. Four kinds, no fifth. */
|
|
122
128
|
export type C4Element = C4Container | C4Component | C4ExternalSystem | C4Person;
|
|
123
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* A whole authored element list, for one repo or composed graph. This is the
|
|
131
|
+
* shape the durable element store persists (`~/.principal/c4-elements/<purl>.json`):
|
|
132
|
+
* **accepted elements only** — the set is the approved architecture, not a
|
|
133
|
+
* history. `proposed` exists only on in-memory proposal scaffolds and is never
|
|
134
|
+
* persisted; a rejected proposal stays remembered by the proposal store, which
|
|
135
|
+
* is where proposing agents consult prior rejections.
|
|
136
|
+
*/
|
|
124
137
|
export interface C4ElementSet {
|
|
125
138
|
/** Repo key this set describes, e.g. `pkg:github/owner/name`. */
|
|
126
139
|
repoKey: string;
|
|
@@ -130,37 +143,6 @@ export interface C4ElementSet {
|
|
|
130
143
|
}
|
|
131
144
|
/** Which level to draw. Determines which frames are drawn. */
|
|
132
145
|
export type C4View = 'container' | 'component';
|
|
133
|
-
/**
|
|
134
|
-
* A flattened element, as the renderer reads it.
|
|
135
|
-
*
|
|
136
|
-
* The union above is what an author writes; this is the one shape every box
|
|
137
|
-
* draws with, so the card does not branch on kind to find a label.
|
|
138
|
-
*/
|
|
139
|
-
export interface C4Node {
|
|
140
|
-
id: string;
|
|
141
|
-
kind: C4Element['kind'];
|
|
142
|
-
/**
|
|
143
|
-
* Nesting parent: a component's container, a container or external system's
|
|
144
|
-
* frame, and nothing for a person — C4 puts people outside every system.
|
|
145
|
-
*/
|
|
146
|
-
parentId?: string;
|
|
147
|
-
label: string;
|
|
148
|
-
technology?: string;
|
|
149
|
-
description?: string;
|
|
150
|
-
state: C4ElementState;
|
|
151
|
-
/** `application` / `data-store`. Set on containers only. */
|
|
152
|
-
containerKind?: C4ContainerKind;
|
|
153
|
-
/** Provenance, when the element consolidated several derived keys. */
|
|
154
|
-
derivedFrom?: string[];
|
|
155
|
-
/** Resolved members, when a document was supplied. A container's list includes its components'. */
|
|
156
|
-
members: string[];
|
|
157
|
-
/** Distinct constructs among resolved members. */
|
|
158
|
-
constructs: string[];
|
|
159
|
-
/** Present at component level when the document resolved it. */
|
|
160
|
-
component?: SubsystemComponent;
|
|
161
|
-
/** Source model ids that contributed members, when attribution is supplied. */
|
|
162
|
-
models?: string[];
|
|
163
|
-
}
|
|
164
146
|
/** A compound frame: the system, or a container holding its components. */
|
|
165
147
|
export interface C4Group {
|
|
166
148
|
id: string;
|
|
@@ -190,6 +172,23 @@ export interface C4Edge {
|
|
|
190
172
|
/** How many underlying steps this line rolled up. */
|
|
191
173
|
count: number;
|
|
192
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Protocol hues, keyed by a canonical protocol token.
|
|
177
|
+
*
|
|
178
|
+
* C4's notation is colour-free, so this is a local choice — but on a container
|
|
179
|
+
* diagram the protocol is what a reader wants to distinguish at a glance
|
|
180
|
+
* (in-process RPC vs HTTP vs file I/O), more than the trail verb the line came
|
|
181
|
+
* from. Keys are lowercase, matched loosely (see `protocolColor`).
|
|
182
|
+
*/
|
|
183
|
+
export declare const PROTOCOL_COLOR: Record<string, string>;
|
|
184
|
+
/** Fallback hue for an edge whose protocol we have no colour for (or none). */
|
|
185
|
+
export declare const PROTOCOL_COLOR_FALLBACK = "#9ca3af";
|
|
186
|
+
/**
|
|
187
|
+
* Colour for an edge's protocol. Matches the longest known token contained in
|
|
188
|
+
* the (lowercased) protocol string, so `Electrobun RPC` finds `rpc` and
|
|
189
|
+
* `JSON-RPC` finds the `json-rpc` entry before `rpc`.
|
|
190
|
+
*/
|
|
191
|
+
export declare function protocolColor(protocol: string | undefined): string;
|
|
193
192
|
/** A drawable C4 projection. Authored, not derived. */
|
|
194
193
|
export interface C4Model {
|
|
195
194
|
view: C4View;
|
|
@@ -198,7 +197,7 @@ export interface C4Model {
|
|
|
198
197
|
label: string;
|
|
199
198
|
repoKey?: string;
|
|
200
199
|
};
|
|
201
|
-
nodes:
|
|
200
|
+
nodes: C4Element[];
|
|
202
201
|
groups: C4Group[];
|
|
203
202
|
edges: C4Edge[];
|
|
204
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c4.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"c4.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAElE,uDAAuD;AACvD,UAAU,aAAa;IACrB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,+EA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CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBjD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQlE;AAED,uDAAuD;AACvD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD"}
|
package/dist/subsystem/c4.js
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* supplies the drawable model directly rather than having trails converted into
|
|
13
13
|
* lines.
|
|
14
14
|
*
|
|
15
|
+
* The element set is an umbrella over a model, not a standalone artifact: what
|
|
16
|
+
* sits inside a box resolves from the model document's `process` fields, folded
|
|
17
|
+
* to the claiming container's key by accepted consolidation records (see
|
|
18
|
+
* `c4Evidence`). Nothing here stores membership, so nothing here can drift from
|
|
19
|
+
* the model it organizes.
|
|
20
|
+
*
|
|
15
21
|
* ## Why a union and not one type with two axes
|
|
16
22
|
*
|
|
17
23
|
* C4's vocabulary is closed: software system, container, component, code —
|
|
@@ -31,6 +37,50 @@
|
|
|
31
37
|
*
|
|
32
38
|
* [C4 notation]: https://c4model.com/diagrams/notation
|
|
33
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* Protocol hues, keyed by a canonical protocol token.
|
|
42
|
+
*
|
|
43
|
+
* C4's notation is colour-free, so this is a local choice — but on a container
|
|
44
|
+
* diagram the protocol is what a reader wants to distinguish at a glance
|
|
45
|
+
* (in-process RPC vs HTTP vs file I/O), more than the trail verb the line came
|
|
46
|
+
* from. Keys are lowercase, matched loosely (see `protocolColor`).
|
|
47
|
+
*/
|
|
48
|
+
export const PROTOCOL_COLOR = {
|
|
49
|
+
rpc: '#22c55e',
|
|
50
|
+
http: '#e8853a',
|
|
51
|
+
https: '#e8853a',
|
|
52
|
+
rest: '#e8853a',
|
|
53
|
+
graphql: '#e061a3',
|
|
54
|
+
fs: '#0ea5e9',
|
|
55
|
+
'file i/o': '#0ea5e9',
|
|
56
|
+
sql: '#a78bfa',
|
|
57
|
+
sqlite: '#a78bfa',
|
|
58
|
+
postgres: '#a78bfa',
|
|
59
|
+
'json-rpc': '#22c55e',
|
|
60
|
+
ws: '#e3b341',
|
|
61
|
+
websocket: '#e3b341',
|
|
62
|
+
mcp: '#4ec9b0',
|
|
63
|
+
stdin: '#9ca3af',
|
|
64
|
+
stdout: '#9ca3af',
|
|
65
|
+
};
|
|
66
|
+
/** Fallback hue for an edge whose protocol we have no colour for (or none). */
|
|
67
|
+
export const PROTOCOL_COLOR_FALLBACK = '#9ca3af';
|
|
68
|
+
/**
|
|
69
|
+
* Colour for an edge's protocol. Matches the longest known token contained in
|
|
70
|
+
* the (lowercased) protocol string, so `Electrobun RPC` finds `rpc` and
|
|
71
|
+
* `JSON-RPC` finds the `json-rpc` entry before `rpc`.
|
|
72
|
+
*/
|
|
73
|
+
export function protocolColor(protocol) {
|
|
74
|
+
if (!protocol)
|
|
75
|
+
return PROTOCOL_COLOR_FALLBACK;
|
|
76
|
+
const p = protocol.toLowerCase();
|
|
77
|
+
let best = '';
|
|
78
|
+
for (const key of Object.keys(PROTOCOL_COLOR)) {
|
|
79
|
+
if (key.length > best.length && p.includes(key))
|
|
80
|
+
best = key;
|
|
81
|
+
}
|
|
82
|
+
return best ? PROTOCOL_COLOR[best] : PROTOCOL_COLOR_FALLBACK;
|
|
83
|
+
}
|
|
34
84
|
/**
|
|
35
85
|
* `owner/name` from a purl, trimmed of scheme and fragment. Used to label the
|
|
36
86
|
* system frame when a repo key is known.
|
package/dist/subsystem/c4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c4.js","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"c4.js","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAoJH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAA2B;IACpD,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,EAAE,EAAE,SAAS;IACb,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,EAAE,EAAE,SAAS;IACb,SAAS,EAAE,SAAS;IACpB,GAAG,E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5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* This module does not decide anything. The proposing agent reads the
|
|
5
|
+
* subsystem diagrams, queries the existing containers, reasons, and writes
|
|
6
|
+
* its own rationale; what lives here is only the mechanical part of that
|
|
7
|
+
* loop:
|
|
8
8
|
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
9
|
+
* - `proposeElements` — the proposal scaffold: skip keys containers
|
|
10
|
+
* already claim, skip boundaries no container can be discerned from
|
|
11
|
+
* (no runtime code behind them)
|
|
12
|
+
* - `verifyProcessBoundaries` — a boundary's verification status, read
|
|
13
|
+
* off the claiming container
|
|
14
|
+
* - `verificationIssues` — those statuses as dynamic-topology findings,
|
|
15
|
+
* so verification surfaces through the standard diagnostics pipeline
|
|
16
|
+
* - `findUnassigned` — runtime components no `process` names at all
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
18
|
+
* Judgements — is this the same unit under a different name? is one function
|
|
19
|
+
* a deployable unit? — belong to the agent and the human, never to a
|
|
20
|
+
* matcher.
|
|
16
21
|
*/
|
|
17
22
|
import type { C4ContainerKind, C4Element, C4ElementSet } from './c4';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/** The process key, module path, or element id this concerns. */
|
|
21
|
-
target: string;
|
|
22
|
-
kind: C4ConcernKind;
|
|
23
|
-
message: string;
|
|
24
|
-
/** Aliases that triggered it. */
|
|
25
|
-
members?: string[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The questions worth a human's attention.
|
|
29
|
-
*
|
|
30
|
-
* Each maps to something an agent cannot settle by reading a string — it has
|
|
31
|
-
* to open the source, or ask the user.
|
|
32
|
-
*/
|
|
33
|
-
export type C4ConcernKind =
|
|
34
|
-
/** two or more process keys may be the same deployable unit */
|
|
35
|
-
'merge_candidate'
|
|
36
|
-
/** exactly one member — a lone function is not a deployable unit */
|
|
37
|
-
| 'singleton'
|
|
38
|
-
/** no member executes at runtime — a library is not a container */
|
|
39
|
-
| 'library_shaped'
|
|
40
|
-
/** a store whose storage kind was never decided */
|
|
41
|
-
| 'store_unclassified'
|
|
42
|
-
/** members claim more than one repo — a container cannot straddle systems */
|
|
43
|
-
| 'spans_repos'
|
|
44
|
-
/** an external with no resolvable identity */
|
|
45
|
-
| 'external_unidentified'
|
|
46
|
-
/** a runtime component with no process at all */
|
|
47
|
-
| 'unassigned'
|
|
48
|
-
/** C4 requires technology on every container */
|
|
49
|
-
| 'missing_technology';
|
|
50
|
-
/** The fields a concern check reads off a component. */
|
|
23
|
+
import type { SubsystemIssue } from './IssueList';
|
|
24
|
+
/** The fields the propose/verify gates read off a component. */
|
|
51
25
|
export interface C4MemberView {
|
|
52
26
|
alias: string;
|
|
53
27
|
construct: string;
|
|
@@ -60,31 +34,6 @@ export interface C4MemberView {
|
|
|
60
34
|
}
|
|
61
35
|
/** True when a component runs, and so can be part of a deployable unit. */
|
|
62
36
|
export declare function isRuntimeConstruct(construct: string): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Derive the questions worth asking about one candidate element.
|
|
65
|
-
*
|
|
66
|
-
* Pure over the rollup, so it runs identically against a single model, the 40
|
|
67
|
-
* composed models, or a fixture. Pure *questions* — it never proposes an
|
|
68
|
-
* answer, because the answers are architectural.
|
|
69
|
-
*/
|
|
70
|
-
export declare function deriveConcerns(key: string, members: readonly C4MemberView[], tech?: {
|
|
71
|
-
frameworks: readonly string[];
|
|
72
|
-
}): C4Concern[];
|
|
73
|
-
/**
|
|
74
|
-
* Suggest merges between keys that share a trailing role.
|
|
75
|
-
*
|
|
76
|
-
* `subsystems-studio/host` and `principal-studio/host` are the same role under
|
|
77
|
-
* two app names. This is a *question*, never a merge — only the user knows
|
|
78
|
-
* whether they are one process or two.
|
|
79
|
-
*/
|
|
80
|
-
export declare function suggestMerges(rollup: ReadonlyArray<{
|
|
81
|
-
key: string;
|
|
82
|
-
memberCount: number;
|
|
83
|
-
}>): Array<{
|
|
84
|
-
role: string;
|
|
85
|
-
keys: string[];
|
|
86
|
-
reason: string;
|
|
87
|
-
}>;
|
|
88
37
|
/**
|
|
89
38
|
* Runtime components that state no `process` at all.
|
|
90
39
|
*
|
|
@@ -94,26 +43,80 @@ export declare function suggestMerges(rollup: ReadonlyArray<{
|
|
|
94
43
|
*/
|
|
95
44
|
export declare function findUnassigned(members: readonly C4MemberView[]): C4MemberView[];
|
|
96
45
|
/**
|
|
97
|
-
*
|
|
46
|
+
* How far a process boundary has travelled toward being a container.
|
|
98
47
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
48
|
+
* A boundary starts `unassigned` — no container claims it. Proposing an
|
|
49
|
+
* element for it (see `proposeElements`) assigns the boundary to a container,
|
|
50
|
+
* which reads as `proposed` until a human decides. `accepted` verifies the
|
|
51
|
+
* boundary: someone approved this run of code as one deployable unit.
|
|
52
|
+
* `rejected` means the proposal was wrong and the boundary should not be
|
|
53
|
+
* drawn as a box.
|
|
54
|
+
*/
|
|
55
|
+
export type C4ProcessVerification = 'unassigned' | 'proposed' | 'rejected' | 'verified';
|
|
56
|
+
/** One process boundary's assignment and its review state. */
|
|
57
|
+
export interface C4ProcessBoundaryStatus {
|
|
58
|
+
/** The `process` key, e.g. `principal-studio/host`. */
|
|
59
|
+
key: string;
|
|
60
|
+
/** Aliases carrying this key in the model, when the caller supplied them. */
|
|
61
|
+
memberAliases: string[];
|
|
62
|
+
status: C4ProcessVerification;
|
|
63
|
+
/** The container whose state decided the status. Absent when `unassigned`. */
|
|
64
|
+
element?: C4Element;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Read a process boundary's verification off its container assignment.
|
|
102
68
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
69
|
+
* The claimant is the container whose `process` equals the boundary's key —
|
|
70
|
+
* a plain string match, no indirection. Two keys that are one deployable unit
|
|
71
|
+
* under two names are fixed in the model document (a consolidation proposal
|
|
72
|
+
* rewrites the components' `process` fields), so the reader never sees a
|
|
73
|
+
* discrepancy to resolve. When several containers claim one key (a
|
|
74
|
+
* hand-edited set can do this), the decided one wins: accepted over rejected
|
|
75
|
+
* over proposed, so one reviewer's yes outranks another's no.
|
|
107
76
|
*
|
|
108
|
-
*
|
|
77
|
+
* Pure: the same rollup and elements always read the same. `rollup` accepts
|
|
78
|
+
* `SubsystemProcessRegion`s directly — only `key` and `memberAliases` are read.
|
|
109
79
|
*/
|
|
110
|
-
export declare function
|
|
80
|
+
export declare function verifyProcessBoundaries(options: {
|
|
81
|
+
rollup: ReadonlyArray<{
|
|
82
|
+
key: string;
|
|
83
|
+
memberAliases?: readonly string[];
|
|
84
|
+
}>;
|
|
85
|
+
elements: readonly C4Element[];
|
|
86
|
+
}): C4ProcessBoundaryStatus[];
|
|
111
87
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
88
|
+
* Verification statuses as diagnostics findings — the dynamic-topology layer
|
|
89
|
+
* of the issues list. One finding per boundary that is NOT verified: an
|
|
90
|
+
* unclaimed boundary is the absence a proposing agent run resolves, a
|
|
91
|
+
* `proposed` one awaits the human's decision, a `rejected` one records that
|
|
92
|
+
* the decision was no. `verified` reports nothing — the audit reports
|
|
93
|
+
* absence only, and silence is the good state.
|
|
94
|
+
*
|
|
95
|
+
* The findings ride the existing pipeline untouched: they badge the process
|
|
96
|
+
* frame (target kind `process`), list under Dynamic topology, focus their
|
|
97
|
+
* members on click, and carry the fix the decision needs. Pure over its
|
|
98
|
+
* input, like the rest of this module.
|
|
99
|
+
*/
|
|
100
|
+
export declare function verificationIssues(statuses: readonly C4ProcessBoundaryStatus[]): SubsystemIssue[];
|
|
101
|
+
/**
|
|
102
|
+
* A starting point for an agent, shaped by the two questions that matter when
|
|
103
|
+
* assessing a process boundary:
|
|
104
|
+
*
|
|
105
|
+
* 1. **Does a container already exist for it?** (`elements`) — a key one
|
|
106
|
+
* already claims is never re-proposed; proposing another would be
|
|
107
|
+
* exactly the duplicate this module exists to prevent. The exact claim
|
|
108
|
+
* is a fact and skipped here; whether a *similarly named* container is
|
|
109
|
+
* the same unit is a judgement, so it belongs to the agent querying the
|
|
110
|
+
* container list — the fix there is a consolidation proposal, not a
|
|
111
|
+
* second box.
|
|
112
|
+
* 2. **Can the boundary be discerned into a container?** — code that never
|
|
113
|
+
* runs cannot be, so a library-shaped group gets no proposal; that
|
|
114
|
+
* fact is the agent's to report, not the scaffold's.
|
|
114
115
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
116
|
+
* For boundaries passing both, one `proposed` container per key. The
|
|
117
|
+
* rationale is the proposing agent's own reasoning, written on the proposal
|
|
118
|
+
* it POSTs — this scaffold does not fabricate one. A scaffold to edit and
|
|
119
|
+
* argue with — not an answer, and never `accepted`.
|
|
117
120
|
*/
|
|
118
121
|
export declare function proposeElements(options: {
|
|
119
122
|
repoKey: string;
|
|
@@ -122,7 +125,8 @@ export declare function proposeElements(options: {
|
|
|
122
125
|
members: readonly C4MemberView[];
|
|
123
126
|
frameworks: readonly string[];
|
|
124
127
|
}>;
|
|
125
|
-
|
|
128
|
+
/** Containers that already exist (from the element store), by `process` claim. */
|
|
129
|
+
elements?: readonly C4Element[];
|
|
126
130
|
}): C4ElementSet;
|
|
127
131
|
/**
|
|
128
132
|
* A first guess at what sort of container this is, offered as a *default* for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c4Evidence.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4Evidence.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"c4Evidence.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4Evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAe,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,gEAAgE;A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