archidocs 1.2.0 → 1.3.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.
Files changed (68) hide show
  1. package/README.md +62 -13
  2. package/dist/cli/commands.d.ts +225 -4
  3. package/dist/cli/commands.js +129 -4
  4. package/dist/cli/init.d.ts +1 -1
  5. package/dist/cli/init.js +2 -2
  6. package/dist/cli/main.js +9 -14
  7. package/dist/core/compare.d.ts +2 -13
  8. package/dist/core/compare.js +2 -35
  9. package/dist/core/index.d.ts +2 -5
  10. package/dist/core/index.js +2 -5
  11. package/dist/core/rules.d.ts +10 -0
  12. package/dist/core/rules.js +186 -7
  13. package/dist/core/views/compare.d.ts +12 -0
  14. package/dist/core/views/compare.js +37 -0
  15. package/dist/core/{deployment-views.d.ts → views/deployment.d.ts} +4 -5
  16. package/dist/core/{deployment-views.js → views/deployment.js} +5 -7
  17. package/dist/core/{dynamic-views.d.ts → views/dynamic.d.ts} +1 -3
  18. package/dist/core/{dynamic-views.js → views/dynamic.js} +4 -8
  19. package/dist/core/views/generated.d.ts +18 -0
  20. package/dist/core/views/generated.js +92 -0
  21. package/dist/core/views/ids.d.ts +36 -0
  22. package/dist/core/views/ids.js +51 -0
  23. package/dist/core/views/index.d.ts +13 -0
  24. package/dist/core/views/index.js +12 -0
  25. package/dist/core/views/lens.d.ts +27 -0
  26. package/dist/core/views/lens.js +112 -0
  27. package/dist/core/views/model.d.ts +21 -0
  28. package/dist/core/views/model.js +69 -0
  29. package/dist/core/views/resolve.d.ts +42 -0
  30. package/dist/core/views/resolve.js +81 -0
  31. package/dist/core/{save-as-view.d.ts → views/save-as-view.d.ts} +2 -2
  32. package/dist/core/{save-as-view.js → views/save-as-view.js} +13 -10
  33. package/dist/core/{saved-views.d.ts → views/saved.d.ts} +4 -18
  34. package/dist/core/{saved-views.js → views/saved.js} +8 -103
  35. package/dist/core/views/types.d.ts +91 -0
  36. package/dist/core/views/types.js +2 -0
  37. package/dist/mcp/errors.d.ts +37 -0
  38. package/dist/mcp/errors.js +35 -0
  39. package/dist/mcp/index.d.ts +2 -1
  40. package/dist/mcp/index.js +1 -0
  41. package/dist/mcp/server.d.ts +1 -2
  42. package/dist/mcp/server.js +12 -12
  43. package/dist/render/layout.d.ts +20 -3
  44. package/dist/render/layout.js +49 -12
  45. package/dist/render/sequence-svg.d.ts +1 -1
  46. package/dist/render/sequence.d.ts +1 -1
  47. package/dist/render/svg.d.ts +1 -1
  48. package/dist/render/svg.js +4 -4
  49. package/dist/schema/adr.js +18 -13
  50. package/dist/schema/workspace.js +226 -130
  51. package/dist/viewer/assets/index-BXa5R96a.js +138 -0
  52. package/dist/viewer/assets/index-YFA-pYjQ.css +1 -0
  53. package/dist/viewer/assets/{layout.worker-Bg-OaLVN.js → layout.worker-BRHAGJrD.js} +1 -1
  54. package/dist/viewer/assets/{png-BDKIXtm5.js → png-CAaXWR-k.js} +1 -1
  55. package/dist/viewer/assets/{svg-Bulv5YWn.js → svg-BPVHfD36.js} +2 -2
  56. package/dist/viewer/index.html +2 -2
  57. package/guide/SKILL.md +1 -1
  58. package/guide/topics/bootstrap.md +1 -1
  59. package/guide/topics/relationships.md +1 -1
  60. package/package.json +4 -3
  61. package/schemas/adr.schema.json +18 -15
  62. package/schemas/model.schema.json +637 -1144
  63. package/schemas/project.schema.json +8 -4
  64. package/schemas/workspace.schema.json +39 -20
  65. package/dist/core/views.d.ts +0 -126
  66. package/dist/core/views.js +0 -217
  67. package/dist/viewer/assets/index-DvKgCpBr.css +0 -1
  68. package/dist/viewer/assets/index-gucix3xm.js +0 -113
@@ -5,9 +5,7 @@ import { withDocs } from "../core/rules.js";
5
5
  import { search } from "../core/search.js";
6
6
  import { changeKinds, countChanges, deriveEdges, diff, filterChanges, findPaths, getImpact, levelOf, listOwned, resolveScope, scopeMatcher, } from "../core/index.js";
7
7
  import { suggest } from "../core/suggest.js";
8
- import { listViews, resolveView } from "../core/views.js";
9
- import { resolveDynamic, resolveDynamicView, takesPart } from "../core/dynamic-views.js";
10
- import { describeLens } from "../core/saved-views.js";
8
+ import { describeLens, listViews, resolveView } from "../core/views/index.js";
11
9
  import { listAdrs } from "../core/adrs.js";
12
10
  import { AdrStatus } from "../schema/adr.js";
13
11
  import { BundleAdr, BundleDeployment, BundleElement, BundleLens, BundleRelationship } from "../schema/bundle.js";
@@ -131,7 +129,7 @@ export function createServer(options) {
131
129
  // Edges at the Element's level that carry at least one Relationship declared beneath either end.
132
130
  const derived = deriveEdges(bundle, levelOf(element)).filter((e) => e.relationships.some((r) => r.from !== e.from || r.to !== e.to));
133
131
  const derivedEdges = { in: derived.filter((e) => e.to === id), out: derived.filter((e) => e.from === id) };
134
- const dynamicViews = bundle.views.flatMap((v) => (v.kind === "dynamic" && takesPart(resolveDynamic(bundle, v).view, id) ? [{ id: v.id, title: v.title }] : []));
132
+ const dynamicViews = listViews(bundle, { kind: "dynamic", element: id }).map((v) => ({ id: v.id, title: v.title }));
135
133
  const data = {
136
134
  element,
137
135
  owner: team ? { id: team.id, name: team.name } : null,
@@ -290,10 +288,11 @@ export function createServer(options) {
290
288
  });
291
289
  tool("get_view", {
292
290
  title: "Get View",
293
- description: "One View by id (c1, c2, c2/<system>, c3/<service>, deployment/<environment>, or a Saved View's project:view-id) as nodes and edges. Neighbours outside the focus are collapsed to the highest level that still separates them; each edge carries the declared Relationships beneath it. A Deployment View nests Deployment Targets (kind `target`), a System box per System inside each Target (id `<system>@<target>`) and the Deployments (kind `deployment`, id `<service>@<target>`, `element` the Service); a consumer Deployment connects to the provider's Deployments under their deepest shared Target, else to all of them, and a related Service with no Deployment there is a node outside every Target. A Saved View with a Lens also returns the Lens, a `mark` ({hit, distance?, side?}, `side` being origin, upstream or downstream for an impact Lens) per node and `lit` per edge; the Lens never changes which nodes the View holds. A Dynamic View instead returns `participants` in drawing order and `steps` [{n, kind: call|return|event, from, to, relationship, interaction, via?, channel?, description, note?}]: an event is drawn publisher → subscriber while `relationship` is the stored subscriber → publisher subscription; a return replies over the sync `relationship` the other way. Steps that don't resolve are left out (`check` reports them).",
291
+ description: "One View by id (c1, c2, c2/<system>, c3/<service>, deployment/<environment>, or a Saved View's project:view-id) as nodes and edges. Neighbors outside the focus are collapsed to the highest level that still separates them; each edge carries the declared Relationships beneath it, and `direction` is the way the View draws (a Saved View's own, else TB for a Deployment View, else LR). A Deployment View nests Deployment Targets (kind `target`), a System box per System inside each Target (id `<system>@<target>`) and the Deployments (kind `deployment`, id `<service>@<target>`, `element` the Service, `target` the Deployment Target), and returns its `environment`; a consumer Deployment connects to the provider's Deployments under their deepest shared Target, else to all of them, and a related Service with no Deployment there is a node outside every Target. A Saved View with a Lens also returns the Lens, a `mark` ({hit, distance?, side?}, `side` being origin, upstream or downstream for an impact Lens) per node and `lit` per edge; the Lens never changes which nodes the View holds. A Dynamic View instead returns `participants` in drawing order and `steps` [{n, kind: call|return|event, from, to, relationship, interaction, via?, channel?, description, note?}]: an event is drawn publisher → subscriber while `relationship` is the stored subscriber → publisher subscription; a return replies over the sync `relationship` the other way. Steps that don't resolve are left out (`check` reports them).",
294
292
  input: z.object({ id: z.string().min(1).describe("A View id, such as c1, c2/shop:checkout, c3/shop:cart or architecture:purchase") }),
295
293
  output: ViewSummary.extend({
296
294
  direction: z.enum(["TB", "BT", "LR", "RL"]).optional(),
295
+ environment: z.string().optional(),
297
296
  lens: BundleLens.optional(),
298
297
  nodes: z
299
298
  .array(z.object({
@@ -301,6 +300,7 @@ export function createServer(options) {
301
300
  kind: z.enum([...ElementKind.options, "target", "deployment"]),
302
301
  name: z.string(),
303
302
  element: z.string().optional(),
303
+ target: z.string().optional(),
304
304
  parent: z.string().nullable(),
305
305
  collapsed: z.boolean(),
306
306
  external: z.boolean(),
@@ -325,21 +325,21 @@ export function createServer(options) {
325
325
  .optional(),
326
326
  }),
327
327
  }, ({ id }, { bundle }) => {
328
- const dynamic = resolveDynamicView(bundle, id);
329
- if (dynamic) {
328
+ const view = resolveView(bundle, id);
329
+ if (!view)
330
+ return notFound("View", id, listViews(bundle).map((v) => v.id));
331
+ if (view.kind === "dynamic") {
332
+ const dynamic = view;
330
333
  return ok({ ...dynamic }, [
331
334
  `${dynamic.title} (${dynamic.id}): ${count(dynamic.participants.length, "participant")}, ${count(dynamic.steps.length, "Step")}.`,
332
335
  `Participants: ${dynamic.participants.join(", ")}`,
333
336
  ...(dynamic.steps.length ? ["Steps:", ...dynamic.steps.map(stepLine)] : []),
334
337
  ].join("\n"));
335
338
  }
336
- const view = resolveView(bundle, id);
337
- if (!view)
338
- return notFound("View", id, listViews(bundle).map((v) => v.id));
339
339
  const edgeCount = `${view.edges.length} edge${view.edges.length === 1 ? "" : "s"}`;
340
340
  return ok({ ...view }, [
341
341
  `${view.title} (${view.id}): ${view.nodes.length} node${view.nodes.length === 1 ? "" : "s"}, ${edgeCount}.`,
342
- ...(view.lens ? [`Lens: ${describeLens(view.lens)}.`] : []),
342
+ ...(view.lens ? [`Lens: ${describeLens(bundle, view.lens)}.`] : []),
343
343
  "Nodes:",
344
344
  ...view.nodes.map(nodeLine),
345
345
  ...(view.edges.length ? ["Edges:", ...view.edges.map((e) => `- ${e.from} → ${e.to}: ${e.relationships.map(relationshipLabel).join("; ")}${e.lit ? " (lit)" : ""}`)] : []),
@@ -631,7 +631,7 @@ export function createServer(options) {
631
631
  });
632
632
  server.registerTool("get_authoring_guide", {
633
633
  title: "Authoring guide",
634
- description: "How to edit the Model with the write tools. With no topic: the archidocs-authoring skill (the Model, the edit loop) and its list of topics. With a topic: that flow's reference file; `rules` is the catalogue of every check rule. Load it before writing.",
634
+ description: "How to edit the Model with the write tools. With no topic: the archidocs-authoring skill (the Model, the edit loop) and its list of topics. With a topic: that flow's reference file; `rules` is the catalog of every check rule. Load it before writing.",
635
635
  inputSchema: advertise(GuideInput),
636
636
  outputSchema: z.object({ topic: z.string().nullable(), topics: z.array(z.object({ id: z.string(), summary: z.string() })), text: z.string() }),
637
637
  annotations: { readOnlyHint: true, openWorldHint: false },
@@ -1,5 +1,5 @@
1
1
  import type { ELK } from "elkjs/lib/elk-api.js";
2
- import type { ResolvedView, ViewNode } from "../core/views.ts";
2
+ import type { ResolvedView, ViewNode } from "../core/views/index.ts";
3
3
  /** Which way a View's edges flow: top to bottom, bottom to top, left to right or right to left. */
4
4
  export type Direction = "TB" | "BT" | "LR" | "RL";
5
5
  export declare const directions: readonly Direction[];
@@ -30,16 +30,33 @@ export interface Layout {
30
30
  edges: LaidOutEdge[];
31
31
  }
32
32
  export interface LayoutOptionsInput {
33
- /** Defaults to `LR`. */
33
+ /** Overrides the View's own direction, as `archidocs export --direction` and the viewer's direction control do. */
34
34
  direction?: Direction;
35
35
  /** The ELK instance to run, such as one backed by a web worker in the browser; defaults to the bundled, in-thread one. */
36
36
  elk?: ELK;
37
37
  }
38
- /** Fixed node sizes per kind, so a layout needs no text measuring. Containers are sized by their contents. */
38
+ /** The least size of a node per kind; `nodeSize` widens it for a long name. Containers are sized by their contents. */
39
39
  export declare const NODE_SIZES: Record<ViewNode["kind"], {
40
40
  width: number;
41
41
  height: number;
42
42
  }>;
43
+ /** No box grows wider than this for its name; a longer name takes a second line instead. */
44
+ export declare const NODE_MAX_WIDTH = 360;
45
+ /** The extra height a box gets for a second line of name. */
46
+ export declare const NAME_LINE = 18;
47
+ /** The width a box of `width` leaves for its name. */
48
+ export declare function nameRoom(n: ViewNode, width: number): number;
49
+ /**
50
+ * A box's size: its kind's size, widened in 10px steps until its name fits on one line, up to NODE_MAX_WIDTH;
51
+ * a name longer than that takes two lines and the box grows by one. Measured with the embedded font's advances,
52
+ * so the same View lays out the same everywhere.
53
+ */
54
+ export declare function nodeSize(n: ViewNode): {
55
+ width: number;
56
+ height: number;
57
+ };
58
+ /** The least width of an open box, so its head row shows its whole name; capped like any box, past which the name is cut. */
59
+ export declare function containerMinWidth(n: ViewNode): number;
43
60
  /** Room at the top of a container for its label. */
44
61
  export declare const CONTAINER_HEADER = 40;
45
62
  /**
@@ -1,18 +1,55 @@
1
1
  import ElkBundled from "elkjs/lib/elk.bundled.js";
2
+ import { textWidth } from "./text.js";
2
3
  export const directions = ["TB", "BT", "LR", "RL"];
3
- /** Fixed node sizes per kind, so a layout needs no text measuring. Containers are sized by their contents. */
4
+ /** The least size of a node per kind; `nodeSize` widens it for a long name. Containers are sized by their contents. */
4
5
  export const NODE_SIZES = {
5
- // The Variant D prototype's sizes (ticket 14), 40px wider and 12px taller, so names fit and boxes breathe.
6
- person: { width: 200, height: 70 },
7
- system: { width: 230, height: 76 },
8
- service: { width: 220, height: 66 },
9
- component: { width: 210, height: 62 },
6
+ // The Variant D prototype's sizes (ticket 14), 40px wider and up to 22px taller, so names fit and boxes breathe.
7
+ person: { width: 200, height: 76 },
8
+ system: { width: 230, height: 80 },
9
+ service: { width: 220, height: 72 },
10
+ component: { width: 210, height: 68 },
10
11
  target: { width: 240, height: 84 },
11
- deployment: { width: 220, height: 62 },
12
+ deployment: { width: 220, height: 68 },
12
13
  };
14
+ /** No box grows wider than this for its name; a longer name takes a second line instead. */
15
+ export const NODE_MAX_WIDTH = 360;
16
+ /** The extra height a box gets for a second line of name. */
17
+ export const NAME_LINE = 18;
18
+ /** What a box's head row holds beside the name: Team edge, padding, kind glyph and the Team code tile. */
19
+ const HEAD_CHROME = 116;
20
+ /** The expand toggle of a collapsed System or Service, and the way-in tile in an open box's head row. */
21
+ const TOGGLE_CHROME = 30;
22
+ const WAY_IN_CHROME = 30;
23
+ /** The room a box of this kind and state needs beside its name. */
24
+ function headChrome(n) {
25
+ const opens = n.kind === "system" || (n.kind === "service" && n.collapsed);
26
+ return HEAD_CHROME + (n.collapsed && opens ? TOGGLE_CHROME : 0) + (n.kind === "person" ? 12 : 0);
27
+ }
28
+ /** The width a box of `width` leaves for its name. */
29
+ export function nameRoom(n, width) {
30
+ return width - headChrome(n);
31
+ }
32
+ /**
33
+ * A box's size: its kind's size, widened in 10px steps until its name fits on one line, up to NODE_MAX_WIDTH;
34
+ * a name longer than that takes two lines and the box grows by one. Measured with the embedded font's advances,
35
+ * so the same View lays out the same everywhere.
36
+ */
37
+ export function nodeSize(n) {
38
+ const base = NODE_SIZES[n.kind];
39
+ const wanted = Math.ceil((textWidth(n.name, 13, 700) + headChrome(n)) / 10) * 10;
40
+ const width = Math.min(NODE_MAX_WIDTH, Math.max(base.width, wanted));
41
+ return { width, height: base.height + (wanted > NODE_MAX_WIDTH ? NAME_LINE : 0) };
42
+ }
43
+ /** What an open box's head row holds beside its name: Team edge, padding, glyph, its kind in words and the Team code tile. */
44
+ const CONTAINER_CHROME = 210;
45
+ /** The least width of an open box, so its head row shows its whole name; capped like any box, past which the name is cut. */
46
+ export function containerMinWidth(n) {
47
+ const opens = n.kind === "system" || n.kind === "service";
48
+ return Math.min(NODE_MAX_WIDTH + 80, Math.ceil(textWidth(n.name, 13, 700) + CONTAINER_CHROME + (opens ? TOGGLE_CHROME + WAY_IN_CHROME : 0)));
49
+ }
13
50
  /** Room at the top of a container for its label. */
14
51
  export const CONTAINER_HEADER = 40;
15
- const CONTAINER_PADDING = `[top=${CONTAINER_HEADER + 8},left=20,bottom=20,right=20]`;
52
+ const CONTAINER_PADDING = `[top=${CONTAINER_HEADER + 12},left=24,bottom=24,right=24]`;
16
53
  const ELK_DIRECTION = { TB: "DOWN", BT: "UP", LR: "RIGHT", RL: "LEFT" };
17
54
  /** The border side edges leave a container by, then the side they enter one by. */
18
55
  const PORT_SIDES = {
@@ -33,7 +70,7 @@ let sharedElk;
33
70
  * sorted by id, which, with fixed node sizes, makes the Layout deterministic.
34
71
  */
35
72
  export async function layoutView(view, options = {}) {
36
- const direction = options.direction ?? "LR";
73
+ const direction = options.direction ?? view.direction;
37
74
  const elk = options.elk ?? (sharedElk ??= new ElkConstructor());
38
75
  const graph = new ViewGraph(view);
39
76
  const { root, routes } = toElk(graph, direction);
@@ -72,7 +109,7 @@ function toElk(graph, direction) {
72
109
  "elk.direction": ELK_DIRECTION[direction],
73
110
  "elk.edgeRouting": "ORTHOGONAL",
74
111
  "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
75
- "elk.spacing.nodeNode": "40",
112
+ "elk.spacing.nodeNode": "48",
76
113
  "elk.layered.spacing.nodeNodeBetweenLayers": "72",
77
114
  "elk.spacing.edgeNode": "20",
78
115
  "elk.spacing.edgeEdge": "12",
@@ -121,10 +158,10 @@ function toElk(graph, direction) {
121
158
  const nodePorts = [...(ports.get(n.id) ?? [])].sort(([a], [b]) => cmp(a, b));
122
159
  const node = {
123
160
  id: n.id,
124
- ...(children.length > 0 ? { children } : NODE_SIZES[n.kind]),
161
+ ...(children.length > 0 ? { children } : nodeSize(n)),
125
162
  ...(nodePorts.length > 0 ? { ports: nodePorts.map(([id, side]) => ({ id, width: 0, height: 0, layoutOptions: { "elk.port.side": side } })) } : {}),
126
163
  layoutOptions: {
127
- ...(children.length > 0 ? { ...common, "elk.padding": CONTAINER_PADDING } : {}),
164
+ ...(children.length > 0 ? { ...common, "elk.padding": CONTAINER_PADDING, "elk.nodeSize.constraints": "MINIMUM_SIZE", "elk.nodeSize.minimum": `(${containerMinWidth(n)},0)` } : {}),
128
165
  ...(nodePorts.length > 0 ? { "elk.portConstraints": "FIXED_SIDE" } : {}),
129
166
  },
130
167
  edges: [],
@@ -1,4 +1,4 @@
1
- import type { ResolvedDynamicView } from "../core/dynamic-views.ts";
1
+ import type { ResolvedDynamicView } from "../core/views/index.ts";
2
2
  import type { Bundle } from "../schema/bundle.ts";
3
3
  import { type MessageStyle } from "./sequence.ts";
4
4
  import { type RenderSource } from "./svg.ts";
@@ -1,4 +1,4 @@
1
- import type { ResolvedDynamicView, ResolvedStep } from "../core/dynamic-views.ts";
1
+ import type { ResolvedDynamicView, ResolvedStep } from "../core/views/index.ts";
2
2
  /** How a message is drawn: sync is solid with a filled head, async solid with an open head, return dashed with an open head. */
3
3
  export type MessageStyle = "sync" | "async" | "return";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { ResolvedView } from "../core/views.ts";
1
+ import { type ResolvedView } from "../core/views/index.ts";
2
2
  import type { Bundle } from "../schema/bundle.ts";
3
3
  import type { Layout } from "./layout.ts";
4
4
  import { type TeamStyle } from "./teams.ts";
@@ -1,4 +1,4 @@
1
- import { describeLens } from "../core/saved-views.js";
1
+ import { describeLens } from "../core/views/index.js";
2
2
  import { FONT_FAMILY, FONTS } from "./font.js";
3
3
  import { teamStyles } from "./teams.js";
4
4
  import { cut, fmt, text, textWidth } from "./text.js";
@@ -35,7 +35,7 @@ export function renderSvg({ bundle, view, layout, source, theme = "light", label
35
35
  const containers = new Set(view.nodes.map((n) => n.parent).filter((p) => p !== null));
36
36
  const title = view.title;
37
37
  const subtitle = sourceLine(source, label);
38
- const key = drawKey(c, view.lens);
38
+ const key = drawKey(c, bundle, view.lens);
39
39
  const width = Math.ceil(Math.max(layout.width, key.width, textWidth(title, 20, 700), textWidth(subtitle, 12)) + 2 * PAD);
40
40
  const height = Math.ceil(HEADER + layout.height + PAD + KEY);
41
41
  const depth = (n) => (n.parent === null ? 0 : 1 + depth(view.nodes.find((p) => p.id === n.parent)));
@@ -177,7 +177,7 @@ function drawEdge(c, points, edge) {
177
177
  return `<path d="${d}" fill="none" stroke="${c.edge}" stroke-width="${FRAME}" marker-end="url(#arrow)"/>`;
178
178
  }
179
179
  /** The key, in the canvas's own vocabulary: the Team tile, External, broker, and the Lens if there is one. */
180
- function drawKey(c, lens) {
180
+ function drawKey(c, bundle, lens) {
181
181
  const parts = [];
182
182
  let x = 0;
183
183
  const label = (s) => {
@@ -209,7 +209,7 @@ function drawKey(c, lens) {
209
209
  swatch(`fill="${c.paper}" stroke="${c.muted}" stroke-width="3"`);
210
210
  else
211
211
  swatch(`fill="${c.pathbg}" stroke="${c.path}" stroke-width="${FRAME}"`);
212
- label(`Lens: ${describeLens(lens)}`);
212
+ label(`Lens: ${describeLens(bundle, lens)}`);
213
213
  }
214
214
  return { parts, width: x - 24 };
215
215
  }
@@ -8,20 +8,25 @@ export const ADR_FILENAME = /^(\d{4})-[a-z0-9][a-z0-9-]*\.md$/;
8
8
  export const AdrRef = z
9
9
  .string()
10
10
  .regex(/^([a-z0-9][a-z0-9-]*:)?\d{4}$/, "must be an ADR number (NNNN), or `project:NNNN` for one in another Project")
11
- .describe("An ADR number in this Project, or `project:NNNN` for one in another Project");
12
- const people = z.array(z.string()).describe("People or Team ids; not checked");
11
+ .describe("An ADR number in this Project, or `project:NNNN` for one in another Project.");
12
+ const people = z.array(z.string());
13
13
  /**
14
14
  * An ADR's frontmatter, with field names following MADR v4. The title is the
15
15
  * body's first `# ` heading, not a field.
16
16
  */
17
- export const AdrFrontmatter = z.strictObject({
18
- status: AdrStatus,
19
- date: z.iso.date("must be an ISO date (YYYY-MM-DD)").describe("The date of the last status change"),
20
- "decision-makers": people.optional(),
21
- consulted: people.optional(),
22
- informed: people.optional(),
23
- tags: z.array(z.string()).optional(),
24
- elements: z.array(Ref).optional().describe("Elements and Deployment Targets the decision affects"),
25
- views: z.array(Ref).optional().describe("Saved Views the decision affects"),
26
- supersedes: z.array(AdrRef).optional().describe("ADRs this one replaces once accepted"),
27
- });
17
+ export const AdrFrontmatter = z
18
+ .strictObject({
19
+ status: AdrStatus.describe("Where the decision stands. `proposed`: awaiting acceptance in a pull request. `accepted`: in force. `rejected`: turned down, and kept for its reasoning. `deprecated`: no longer in force, with no ADR replacing it. `superseded`: never written by hand; it is derived once an accepted ADR lists this one in `supersedes`."),
20
+ date: z.iso.date("must be an ISO date (YYYY-MM-DD)").describe("The date of the last status change, as `YYYY-MM-DD`."),
21
+ "decision-makers": people.optional().describe("Who made the decision: people's names or Team ids. Not checked."),
22
+ consulted: people.optional().describe("Who was asked for input: people's names or Team ids. Not checked."),
23
+ informed: people.optional().describe("Who was told of the decision: people's names or Team ids. Not checked."),
24
+ tags: z.array(z.string()).optional().describe("Free-form labels for the ADR."),
25
+ elements: z.array(Ref).optional().describe("The Elements and Deployment Targets the decision affects, each as an id in this Project or `project:id`."),
26
+ views: z.array(Ref).optional().describe("The Saved Views the decision affects, each as an id in this Project or `project:id`."),
27
+ supersedes: z
28
+ .array(AdrRef)
29
+ .optional()
30
+ .describe("The ADRs this one replaces once it is accepted, each as a four-digit number in this Project or `project:NNNN`. Only an accepted or deprecated ADR can be superseded."),
31
+ })
32
+ .describe("An ADR's frontmatter. The ADR's title is the first `# ` heading of its body, not a field.");