archidocs 1.4.0-beta.2 → 1.4.0-beta.3

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/core/load.js CHANGED
@@ -304,6 +304,8 @@ function toBundle(ws, options) {
304
304
  const source = (l) => ({ file: l.file.path, line: l.line });
305
305
  const str = (v) => (typeof v === "string" ? v : null);
306
306
  const links = (v) => Array.isArray(v) ? v.map(asRecord).map((l) => ({ label: String(l.label ?? ""), url: String(l.url ?? "") })) : [];
307
+ // Scalars only, as strings; a nested value is a schema finding and is left out here.
308
+ const metadata = (v) => Object.fromEntries(Object.entries(asRecord(v)).flatMap(([k, x]) => (["string", "number", "boolean"].includes(typeof x) ? [[k, String(x)]] : [])));
307
309
  const byId = (a, b) => cmp(a.id, b.id);
308
310
  const projects = ws.projects.filter((p) => p.id !== undefined && !p.duplicateOf);
309
311
  const elements = ws.elements
@@ -318,19 +320,21 @@ function toBundle(ws, options) {
318
320
  owner: str(d.owner) ?? e.project.owner ?? "",
319
321
  tags: Array.isArray(d.tags) ? d.tags.map(String) : [],
320
322
  links: links(d.links),
323
+ metadata: metadata(d.metadata),
321
324
  source: source(e),
322
325
  };
323
326
  const external = d.external === true;
324
327
  const technology = str(d.technology);
328
+ const repository = str(d.repository);
325
329
  switch (e.kind) {
326
330
  case "person":
327
331
  return { ...common, kind: e.kind };
328
332
  case "system":
329
- return { ...common, kind: e.kind, external };
333
+ return { ...common, kind: e.kind, external, repository };
330
334
  case "service":
331
- return { ...common, kind: e.kind, type: ["app", "datastore", "broker"].find((t) => t === d.type) ?? "app", technology, external };
335
+ return { ...common, kind: e.kind, type: ["app", "datastore", "broker"].find((t) => t === d.type) ?? "app", technology, external, repository };
332
336
  case "component":
333
- return { ...common, kind: e.kind, technology };
337
+ return { ...common, kind: e.kind, technology, repository };
334
338
  }
335
339
  });
336
340
  const inBundle = (p) => p.id !== undefined && !p.duplicateOf;
@@ -22,6 +22,9 @@ export declare const topics: readonly [{
22
22
  }, {
23
23
  readonly id: "propose-adr";
24
24
  readonly summary: "Propose an ADR linked to the Elements and Views it affects.";
25
+ }, {
26
+ readonly id: "fill-gaps";
27
+ readonly summary: "Interview the user about the fields the Model leaves empty, proposing each value from evidence in the code and writing it as it is confirmed.";
25
28
  }, {
26
29
  readonly id: "change";
27
30
  readonly summary: "Rename, move or remove, working through refused removals by their references.";
@@ -18,6 +18,7 @@ export const topics = [
18
18
  { id: "dynamic-view", summary: "Draft a scenario as Steps over existing Relationships, adding missing ones." },
19
19
  { id: "saved-view", summary: "Save a structural or Deployment View with selectors and a Lens." },
20
20
  { id: "propose-adr", summary: "Propose an ADR linked to the Elements and Views it affects." },
21
+ { id: "fill-gaps", summary: "Interview the user about the fields the Model leaves empty, proposing each value from evidence in the code and writing it as it is confirmed." },
21
22
  { id: "change", summary: "Rename, move or remove, working through refused removals by their references." },
22
23
  { id: "rules", summary: "Every `check` rule id: what it means, a failing example and the fix." },
23
24
  ];
@@ -49,7 +50,7 @@ export async function authoringGuide(topic) {
49
50
  */
50
51
  export const skillStub = (runner) => `---
51
52
  name: ${SKILL_NAME}
52
- description: Edit the Archidocs architecture Model. Use when bootstrapping a Project from code, adding or changing Services, Relationships, Deployments or Views, or proposing an ADR.
53
+ description: Edit the Archidocs architecture Model. Use when bootstrapping a Project from code, adding or changing Services, Relationships, Deployments or Views, proposing an ADR, or finding and filling documentation gaps.
53
54
  ---
54
55
 
55
56
  # Archidocs authoring
@@ -157,7 +157,9 @@ export function createServer(options) {
157
157
  ["technology", "technology" in element ? element.technology : null],
158
158
  ["external", "external" in element && element.external ? "yes" : null],
159
159
  ["tags", element.tags.join(", ")],
160
+ ["repository", "repository" in element ? element.repository : null],
160
161
  ["links", element.links.map((l) => `[${l.label}](${l.url})`).join(", ")],
162
+ ["metadata", Object.entries(element.metadata).map(([k, v]) => `${k}: ${v}`).join(", ")],
161
163
  ["children", children.map(label).join(", ")],
162
164
  ["deployments", deployments.map((d) => `${d.environment} on ${d.target}${d.url ? ` (${d.url})` : ""}`).join(", ")],
163
165
  ["uses", relationships.out.map((r) => `${r.to}${r.description ? ` (${r.description})` : ""}`).join(", ")],
@@ -51,8 +51,8 @@ export function renderSequenceSvg({ bundle, view, source, brokers = false, theme
51
51
  ].join("\n");
52
52
  }
53
53
  /** Arrowheads: filled for sync calls, open for async and returns. */
54
- export const heads = (fill) => `<marker id="head-filled" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z" fill="${fill}"/></marker>` +
55
- `<marker id="head-open" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10" fill="none" stroke="${fill}" stroke-width="1.5"/></marker>`;
54
+ export const heads = (fill) => `<marker id="head-filled" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="${fill}"/></marker>` +
55
+ `<marker id="head-open" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path d="M0,0 L10,5 L0,10" fill="none" stroke="${fill}" stroke-width="1.5"/></marker>`;
56
56
  const lifeline = (c, x, layout) => `<path d="M${fmt(x)},${HEADER_BOX} L${fmt(x)},${fmt(layout.height - 10)}" fill="none" stroke="${c.faint}" stroke-dasharray="3 4"/>`;
57
57
  function header(c, id, x, w, element, team) {
58
58
  const left = x - w / 2;
@@ -74,7 +74,7 @@ export function renderSvg({ bundle, view, layout, source, theme = "light", label
74
74
  "",
75
75
  ].join("\n");
76
76
  }
77
- const marker = (id, fill) => `<marker id="${id}" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z" fill="${fill}"/></marker>`;
77
+ const marker = (id, fill) => `<marker id="${id}" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="${fill}"/></marker>`;
78
78
  /** A broker's vertical stripes, in the rule colour. */
79
79
  const brokerPattern = (c) => `<pattern id="broker" width="12" height="12" patternUnits="userSpaceOnUse"><rect x="8" width="4" height="12" fill="${c.rule}"/></pattern>`;
80
80
  /** A rectangle with its own radius per corner (top-left, top-right, bottom-right, bottom-left), as a path. */
@@ -10,6 +10,7 @@ export declare const BundleElement: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
10
  label: z.ZodString;
11
11
  url: z.ZodString;
12
12
  }, z.core.$strip>>;
13
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
13
14
  id: z.ZodString;
14
15
  kind: z.ZodLiteral<"person">;
15
16
  source: z.ZodObject<{
@@ -26,9 +27,11 @@ export declare const BundleElement: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
27
  label: z.ZodString;
27
28
  url: z.ZodString;
28
29
  }, z.core.$strip>>;
30
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
29
31
  id: z.ZodString;
30
32
  kind: z.ZodLiteral<"system">;
31
33
  external: z.ZodBoolean;
34
+ repository: z.ZodNullable<z.ZodString>;
32
35
  source: z.ZodObject<{
33
36
  file: z.ZodString;
34
37
  line: z.ZodNumber;
@@ -43,6 +46,7 @@ export declare const BundleElement: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
46
  label: z.ZodString;
44
47
  url: z.ZodString;
45
48
  }, z.core.$strip>>;
49
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
46
50
  id: z.ZodString;
47
51
  kind: z.ZodLiteral<"service">;
48
52
  type: z.ZodEnum<{
@@ -52,6 +56,7 @@ export declare const BundleElement: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
56
  }>;
53
57
  technology: z.ZodNullable<z.ZodString>;
54
58
  external: z.ZodBoolean;
59
+ repository: z.ZodNullable<z.ZodString>;
55
60
  source: z.ZodObject<{
56
61
  file: z.ZodString;
57
62
  line: z.ZodNumber;
@@ -66,9 +71,11 @@ export declare const BundleElement: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
71
  label: z.ZodString;
67
72
  url: z.ZodString;
68
73
  }, z.core.$strip>>;
74
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
69
75
  id: z.ZodString;
70
76
  kind: z.ZodLiteral<"component">;
71
77
  technology: z.ZodNullable<z.ZodString>;
78
+ repository: z.ZodNullable<z.ZodString>;
72
79
  source: z.ZodObject<{
73
80
  file: z.ZodString;
74
81
  line: z.ZodNumber;
@@ -470,6 +477,7 @@ export declare const Bundle: z.ZodObject<{
470
477
  label: z.ZodString;
471
478
  url: z.ZodString;
472
479
  }, z.core.$strip>>;
480
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
473
481
  id: z.ZodString;
474
482
  kind: z.ZodLiteral<"person">;
475
483
  source: z.ZodObject<{
@@ -486,9 +494,11 @@ export declare const Bundle: z.ZodObject<{
486
494
  label: z.ZodString;
487
495
  url: z.ZodString;
488
496
  }, z.core.$strip>>;
497
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
489
498
  id: z.ZodString;
490
499
  kind: z.ZodLiteral<"system">;
491
500
  external: z.ZodBoolean;
501
+ repository: z.ZodNullable<z.ZodString>;
492
502
  source: z.ZodObject<{
493
503
  file: z.ZodString;
494
504
  line: z.ZodNumber;
@@ -503,6 +513,7 @@ export declare const Bundle: z.ZodObject<{
503
513
  label: z.ZodString;
504
514
  url: z.ZodString;
505
515
  }, z.core.$strip>>;
516
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
506
517
  id: z.ZodString;
507
518
  kind: z.ZodLiteral<"service">;
508
519
  type: z.ZodEnum<{
@@ -512,6 +523,7 @@ export declare const Bundle: z.ZodObject<{
512
523
  }>;
513
524
  technology: z.ZodNullable<z.ZodString>;
514
525
  external: z.ZodBoolean;
526
+ repository: z.ZodNullable<z.ZodString>;
515
527
  source: z.ZodObject<{
516
528
  file: z.ZodString;
517
529
  line: z.ZodNumber;
@@ -526,9 +538,11 @@ export declare const Bundle: z.ZodObject<{
526
538
  label: z.ZodString;
527
539
  url: z.ZodString;
528
540
  }, z.core.$strip>>;
541
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
529
542
  id: z.ZodString;
530
543
  kind: z.ZodLiteral<"component">;
531
544
  technology: z.ZodNullable<z.ZodString>;
545
+ repository: z.ZodNullable<z.ZodString>;
532
546
  source: z.ZodObject<{
533
547
  file: z.ZodString;
534
548
  line: z.ZodNumber;
@@ -11,6 +11,8 @@ const elementFields = {
11
11
  owner: z.string(),
12
12
  tags: z.array(z.string()),
13
13
  links: z.array(Link),
14
+ /** Free-form facts, values as written in YAML turned to strings, in declared order. */
15
+ metadata: z.record(z.string(), z.string()),
14
16
  };
15
17
  /**
16
18
  * One Element: qualified id, kind, parent (qualified id or null), the
@@ -22,9 +24,9 @@ const element = (kind, fields) => {
22
24
  };
23
25
  export const BundleElement = z.discriminatedUnion("kind", [
24
26
  element("person", {}),
25
- element("system", { external: z.boolean() }),
26
- element("service", { type: z.enum(["app", "datastore", "broker"]), technology: z.string().nullable(), external: z.boolean() }),
27
- element("component", { technology: z.string().nullable() }),
27
+ element("system", { external: z.boolean(), repository: z.string().nullable() }),
28
+ element("service", { type: z.enum(["app", "datastore", "broker"]), technology: z.string().nullable(), external: z.boolean(), repository: z.string().nullable() }),
29
+ element("component", { technology: z.string().nullable(), repository: z.string().nullable() }),
28
30
  ]);
29
31
  /** A Deployment Target: qualified id, parent Target (qualified id or null) and its effective Owner. */
30
32
  export const BundleTarget = z.object({
@@ -58,6 +58,8 @@ export declare const Relationship: z.ZodObject<{
58
58
  channel: z.ZodOptional<z.ZodString>;
59
59
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
60
  }, z.core.$strict>;
61
+ /** An Element's free-form facts: what a team wants to record that the Model has no field for. */
62
+ export declare const Metadata: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
61
63
  export declare const Person: z.ZodObject<{
62
64
  name: z.ZodString;
63
65
  description: z.ZodOptional<z.ZodString>;
@@ -67,6 +69,7 @@ export declare const Person: z.ZodObject<{
67
69
  label: z.ZodString;
68
70
  url: z.ZodURL;
69
71
  }, z.core.$strict>>>;
72
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
70
73
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
74
  to: z.ZodString;
72
75
  id: z.ZodOptional<z.ZodString>;
@@ -83,6 +86,7 @@ export declare const Person: z.ZodObject<{
83
86
  }, z.core.$strict>;
84
87
  export declare const Component: z.ZodObject<{
85
88
  technology: z.ZodOptional<z.ZodString>;
89
+ repository: z.ZodOptional<z.ZodURL>;
86
90
  in: z.ZodOptional<z.ZodString>;
87
91
  name: z.ZodString;
88
92
  description: z.ZodOptional<z.ZodString>;
@@ -92,6 +96,7 @@ export declare const Component: z.ZodObject<{
92
96
  label: z.ZodString;
93
97
  url: z.ZodURL;
94
98
  }, z.core.$strict>>>;
99
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
95
100
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
96
101
  to: z.ZodString;
97
102
  id: z.ZodOptional<z.ZodString>;
@@ -113,10 +118,12 @@ export declare const Service: z.ZodObject<{
113
118
  broker: "broker";
114
119
  }>>;
115
120
  technology: z.ZodOptional<z.ZodString>;
121
+ repository: z.ZodOptional<z.ZodURL>;
116
122
  external: z.ZodOptional<z.ZodBoolean>;
117
123
  in: z.ZodOptional<z.ZodString>;
118
124
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
119
125
  technology: z.ZodOptional<z.ZodString>;
126
+ repository: z.ZodOptional<z.ZodURL>;
120
127
  in: z.ZodOptional<z.ZodString>;
121
128
  name: z.ZodString;
122
129
  description: z.ZodOptional<z.ZodString>;
@@ -126,6 +133,7 @@ export declare const Service: z.ZodObject<{
126
133
  label: z.ZodString;
127
134
  url: z.ZodURL;
128
135
  }, z.core.$strict>>>;
136
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
129
137
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
138
  to: z.ZodString;
131
139
  id: z.ZodOptional<z.ZodString>;
@@ -148,6 +156,7 @@ export declare const Service: z.ZodObject<{
148
156
  label: z.ZodString;
149
157
  url: z.ZodURL;
150
158
  }, z.core.$strict>>>;
159
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
151
160
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
161
  to: z.ZodString;
153
162
  id: z.ZodOptional<z.ZodString>;
@@ -164,6 +173,7 @@ export declare const Service: z.ZodObject<{
164
173
  }, z.core.$strict>;
165
174
  export declare const System: z.ZodObject<{
166
175
  external: z.ZodOptional<z.ZodBoolean>;
176
+ repository: z.ZodOptional<z.ZodURL>;
167
177
  services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
168
178
  type: z.ZodOptional<z.ZodEnum<{
169
179
  app: "app";
@@ -171,10 +181,12 @@ export declare const System: z.ZodObject<{
171
181
  broker: "broker";
172
182
  }>>;
173
183
  technology: z.ZodOptional<z.ZodString>;
184
+ repository: z.ZodOptional<z.ZodURL>;
174
185
  external: z.ZodOptional<z.ZodBoolean>;
175
186
  in: z.ZodOptional<z.ZodString>;
176
187
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
177
188
  technology: z.ZodOptional<z.ZodString>;
189
+ repository: z.ZodOptional<z.ZodURL>;
178
190
  in: z.ZodOptional<z.ZodString>;
179
191
  name: z.ZodString;
180
192
  description: z.ZodOptional<z.ZodString>;
@@ -184,6 +196,7 @@ export declare const System: z.ZodObject<{
184
196
  label: z.ZodString;
185
197
  url: z.ZodURL;
186
198
  }, z.core.$strict>>>;
199
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
187
200
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
201
  to: z.ZodString;
189
202
  id: z.ZodOptional<z.ZodString>;
@@ -206,6 +219,7 @@ export declare const System: z.ZodObject<{
206
219
  label: z.ZodString;
207
220
  url: z.ZodURL;
208
221
  }, z.core.$strict>>>;
222
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
209
223
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
210
224
  to: z.ZodString;
211
225
  id: z.ZodOptional<z.ZodString>;
@@ -228,6 +242,7 @@ export declare const System: z.ZodObject<{
228
242
  label: z.ZodString;
229
243
  url: z.ZodURL;
230
244
  }, z.core.$strict>>>;
245
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
231
246
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
232
247
  to: z.ZodString;
233
248
  id: z.ZodOptional<z.ZodString>;
@@ -591,6 +606,7 @@ export declare const ModelFile: z.ZodObject<{
591
606
  label: z.ZodString;
592
607
  url: z.ZodURL;
593
608
  }, z.core.$strict>>>;
609
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
594
610
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
595
611
  to: z.ZodString;
596
612
  id: z.ZodOptional<z.ZodString>;
@@ -607,6 +623,7 @@ export declare const ModelFile: z.ZodObject<{
607
623
  }, z.core.$strict>>>;
608
624
  systems: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
609
625
  external: z.ZodOptional<z.ZodBoolean>;
626
+ repository: z.ZodOptional<z.ZodURL>;
610
627
  services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
611
628
  type: z.ZodOptional<z.ZodEnum<{
612
629
  app: "app";
@@ -614,10 +631,12 @@ export declare const ModelFile: z.ZodObject<{
614
631
  broker: "broker";
615
632
  }>>;
616
633
  technology: z.ZodOptional<z.ZodString>;
634
+ repository: z.ZodOptional<z.ZodURL>;
617
635
  external: z.ZodOptional<z.ZodBoolean>;
618
636
  in: z.ZodOptional<z.ZodString>;
619
637
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
620
638
  technology: z.ZodOptional<z.ZodString>;
639
+ repository: z.ZodOptional<z.ZodURL>;
621
640
  in: z.ZodOptional<z.ZodString>;
622
641
  name: z.ZodString;
623
642
  description: z.ZodOptional<z.ZodString>;
@@ -627,6 +646,7 @@ export declare const ModelFile: z.ZodObject<{
627
646
  label: z.ZodString;
628
647
  url: z.ZodURL;
629
648
  }, z.core.$strict>>>;
649
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
630
650
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
631
651
  to: z.ZodString;
632
652
  id: z.ZodOptional<z.ZodString>;
@@ -649,6 +669,7 @@ export declare const ModelFile: z.ZodObject<{
649
669
  label: z.ZodString;
650
670
  url: z.ZodURL;
651
671
  }, z.core.$strict>>>;
672
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
652
673
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
653
674
  to: z.ZodString;
654
675
  id: z.ZodOptional<z.ZodString>;
@@ -671,6 +692,7 @@ export declare const ModelFile: z.ZodObject<{
671
692
  label: z.ZodString;
672
693
  url: z.ZodURL;
673
694
  }, z.core.$strict>>>;
695
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
674
696
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
675
697
  to: z.ZodString;
676
698
  id: z.ZodOptional<z.ZodString>;
@@ -692,10 +714,12 @@ export declare const ModelFile: z.ZodObject<{
692
714
  broker: "broker";
693
715
  }>>;
694
716
  technology: z.ZodOptional<z.ZodString>;
717
+ repository: z.ZodOptional<z.ZodURL>;
695
718
  external: z.ZodOptional<z.ZodBoolean>;
696
719
  in: z.ZodOptional<z.ZodString>;
697
720
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
698
721
  technology: z.ZodOptional<z.ZodString>;
722
+ repository: z.ZodOptional<z.ZodURL>;
699
723
  in: z.ZodOptional<z.ZodString>;
700
724
  name: z.ZodString;
701
725
  description: z.ZodOptional<z.ZodString>;
@@ -705,6 +729,7 @@ export declare const ModelFile: z.ZodObject<{
705
729
  label: z.ZodString;
706
730
  url: z.ZodURL;
707
731
  }, z.core.$strict>>>;
732
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
708
733
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
709
734
  to: z.ZodString;
710
735
  id: z.ZodOptional<z.ZodString>;
@@ -727,6 +752,7 @@ export declare const ModelFile: z.ZodObject<{
727
752
  label: z.ZodString;
728
753
  url: z.ZodURL;
729
754
  }, z.core.$strict>>>;
755
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
730
756
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
731
757
  to: z.ZodString;
732
758
  id: z.ZodOptional<z.ZodString>;
@@ -743,6 +769,7 @@ export declare const ModelFile: z.ZodObject<{
743
769
  }, z.core.$strict>>>;
744
770
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
745
771
  technology: z.ZodOptional<z.ZodString>;
772
+ repository: z.ZodOptional<z.ZodURL>;
746
773
  in: z.ZodOptional<z.ZodString>;
747
774
  name: z.ZodString;
748
775
  description: z.ZodOptional<z.ZodString>;
@@ -752,6 +779,7 @@ export declare const ModelFile: z.ZodObject<{
752
779
  label: z.ZodString;
753
780
  url: z.ZodURL;
754
781
  }, z.core.$strict>>>;
782
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
755
783
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
756
784
  to: z.ZodString;
757
785
  id: z.ZodOptional<z.ZodString>;
@@ -973,6 +1001,7 @@ export declare const shallow: {
973
1001
  label: z.ZodString;
974
1002
  url: z.ZodURL;
975
1003
  }, z.core.$strict>>>;
1004
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
976
1005
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
977
1006
  to: z.ZodString;
978
1007
  id: z.ZodOptional<z.ZodString>;
@@ -989,6 +1018,7 @@ export declare const shallow: {
989
1018
  }, z.core.$strict>;
990
1019
  readonly system: z.ZodObject<{
991
1020
  external: z.ZodOptional<z.ZodBoolean>;
1021
+ repository: z.ZodOptional<z.ZodURL>;
992
1022
  name: z.ZodString;
993
1023
  description: z.ZodOptional<z.ZodString>;
994
1024
  owner: z.ZodOptional<z.ZodString>;
@@ -997,6 +1027,7 @@ export declare const shallow: {
997
1027
  label: z.ZodString;
998
1028
  url: z.ZodURL;
999
1029
  }, z.core.$strict>>>;
1030
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1000
1031
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
1001
1032
  to: z.ZodString;
1002
1033
  id: z.ZodOptional<z.ZodString>;
@@ -1019,6 +1050,7 @@ export declare const shallow: {
1019
1050
  broker: "broker";
1020
1051
  }>>;
1021
1052
  technology: z.ZodOptional<z.ZodString>;
1053
+ repository: z.ZodOptional<z.ZodURL>;
1022
1054
  external: z.ZodOptional<z.ZodBoolean>;
1023
1055
  in: z.ZodOptional<z.ZodString>;
1024
1056
  name: z.ZodString;
@@ -1029,6 +1061,7 @@ export declare const shallow: {
1029
1061
  label: z.ZodString;
1030
1062
  url: z.ZodURL;
1031
1063
  }, z.core.$strict>>>;
1064
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1032
1065
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
1033
1066
  to: z.ZodString;
1034
1067
  id: z.ZodOptional<z.ZodString>;
@@ -1046,6 +1079,7 @@ export declare const shallow: {
1046
1079
  }, z.core.$strict>;
1047
1080
  readonly component: z.ZodObject<{
1048
1081
  technology: z.ZodOptional<z.ZodString>;
1082
+ repository: z.ZodOptional<z.ZodURL>;
1049
1083
  in: z.ZodOptional<z.ZodString>;
1050
1084
  name: z.ZodString;
1051
1085
  description: z.ZodOptional<z.ZodString>;
@@ -1055,6 +1089,7 @@ export declare const shallow: {
1055
1089
  label: z.ZodString;
1056
1090
  url: z.ZodURL;
1057
1091
  }, z.core.$strict>>>;
1092
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1058
1093
  relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
1059
1094
  to: z.ZodString;
1060
1095
  id: z.ZodOptional<z.ZodString>;
@@ -70,6 +70,12 @@ export const Relationship = z
70
70
  title: "Relationship",
71
71
  description: "A Relationship: a dependency of the Element it is declared under (the consumer) on the Element `to` names (the provider). Declare it once, under the consumer.",
72
72
  });
73
+ /** An Element's free-form facts: what a team wants to record that the Model has no field for. */
74
+ export const Metadata = z
75
+ .record(z.string().min(1), z.union([z.string(), z.number(), z.boolean()]))
76
+ .describe("Free-form facts about the Element that the Model has no field for, such as `tier: 1` or `on-call: payments-oncall`. Keys are labels, shown as written; values are strings, numbers or booleans. Nothing in the Model reads them: they are shown in the viewer and returned by the MCP server.");
77
+ /** A link to the source code repository of a System, Service or Component. */
78
+ const Repository = z.url().describe("The full URL of the source code repository the Element is built from. Shown as a link in the viewer.");
73
79
  /** The fields every kind of Element takes. */
74
80
  const elementFields = {
75
81
  name: z.string().describe("The Element's display name."),
@@ -77,6 +83,7 @@ const elementFields = {
77
83
  owner: Id.optional().describe("The Team that owns the Element: the id of a Team in `workspace.yaml`. Set it only when it differs from the Project's; nothing is inherited from the parent Element. Default: the Project's `owner`."),
78
84
  tags: z.array(z.string()).optional().describe("Free-form labels. A Saved View's `{tag}` selector picks Elements by them."),
79
85
  links: z.array(Link).optional().describe("Links to pages about the Element, such as a runbook or a dashboard."),
86
+ metadata: Metadata.optional(),
80
87
  relationships: z.array(Relationship).optional().describe("The Relationships this Element is the consumer of: what it depends on. A Relationship is never declared under its provider."),
81
88
  };
82
89
  export const Person = z.strictObject({ ...elementFields }).meta({
@@ -88,6 +95,7 @@ export const Component = z
88
95
  .strictObject({
89
96
  ...elementFields,
90
97
  technology: z.string().optional().describe("What the Component is built with, such as `TypeScript module`. Shown under its name."),
98
+ repository: Repository.optional(),
91
99
  in: Id.optional().describe("The Service this Component belongs to, as an id in this Project. Required for a Component under the top-level `components` key, and not allowed for one nested under a Service's `components`."),
92
100
  })
93
101
  .meta({ id: "Component", title: "Component", description: "A Component: a part inside a Service that is not deployed on its own." });
@@ -99,6 +107,7 @@ export const Service = z
99
107
  .optional()
100
108
  .describe("What the Service is; each type is drawn differently. `app`: an application, the usual case. `datastore`: a database or other store. `broker`: a message broker that async Relationships run through, named by their `via`. Default: `app`."),
101
109
  technology: z.string().optional().describe("What the Service is built with, such as `Go` or `PostgreSQL`. Shown under its name."),
110
+ repository: Repository.optional(),
102
111
  external: z.boolean().optional().describe("`true` for a Service run outside the organization, such as a payment provider's API. An External Service can't declare Components. Default: `false`."),
103
112
  in: Id.optional().describe("The System this Service belongs to, as an id in this Project. Only for a Service under the top-level `services` key, and not allowed for one nested under a System's `services`. Without it, a top-level Service stands outside any System."),
104
113
  components: z.record(Id, Component).optional().describe("The Components inside the Service, keyed by id."),
@@ -108,6 +117,7 @@ export const System = z
108
117
  .strictObject({
109
118
  ...elementFields,
110
119
  external: z.boolean().optional().describe("`true` for a System run outside the organization, such as a payment provider. Nothing inside an External System can declare Components. Default: `false`."),
120
+ repository: Repository.optional(),
111
121
  services: z.record(Id, Service).optional().describe("The Services in the System, keyed by id."),
112
122
  })
113
123
  .meta({ id: "System", title: "System", description: "A System: a named grouping of Services that together deliver a business capability. Systems do not nest." });