archidocs 1.0.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.
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/dist/cli/commands.d.ts +543 -0
- package/dist/cli/commands.js +299 -0
- package/dist/cli/format.d.ts +2 -2
- package/dist/cli/format.js +9 -5
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/main.js +27 -73
- package/dist/core/compare.d.ts +2 -13
- package/dist/core/compare.js +2 -35
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.js +3 -6
- package/dist/core/query.d.ts +1 -1
- package/dist/core/rules.d.ts +30 -0
- package/dist/core/rules.js +194 -7
- package/dist/core/views/compare.d.ts +12 -0
- package/dist/core/views/compare.js +37 -0
- package/dist/core/{deployment-views.d.ts → views/deployment.d.ts} +4 -5
- package/dist/core/{deployment-views.js → views/deployment.js} +5 -7
- package/dist/core/{dynamic-views.d.ts → views/dynamic.d.ts} +1 -3
- package/dist/core/{dynamic-views.js → views/dynamic.js} +4 -8
- package/dist/core/views/generated.d.ts +18 -0
- package/dist/core/views/generated.js +92 -0
- package/dist/core/views/ids.d.ts +36 -0
- package/dist/core/views/ids.js +51 -0
- package/dist/core/views/index.d.ts +13 -0
- package/dist/core/views/index.js +12 -0
- package/dist/core/views/lens.d.ts +27 -0
- package/dist/core/views/lens.js +112 -0
- package/dist/core/views/model.d.ts +21 -0
- package/dist/core/views/model.js +69 -0
- package/dist/core/views/resolve.d.ts +42 -0
- package/dist/core/views/resolve.js +81 -0
- package/dist/core/{save-as-view.d.ts → views/save-as-view.d.ts} +2 -2
- package/dist/core/{save-as-view.js → views/save-as-view.js} +13 -10
- package/dist/core/{saved-views.d.ts → views/saved.d.ts} +4 -18
- package/dist/core/{saved-views.js → views/saved.js} +8 -103
- package/dist/core/views/types.d.ts +91 -0
- package/dist/core/views/types.js +2 -0
- package/dist/mcp/errors.d.ts +37 -0
- package/dist/mcp/errors.js +35 -0
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/server.d.ts +1 -2
- package/dist/mcp/server.js +15 -13
- package/dist/mcp/writes.js +2 -1
- package/dist/render/font.d.ts +14 -8
- package/dist/render/font.js +11 -10
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.js +1 -0
- package/dist/render/layout.d.ts +20 -3
- package/dist/render/layout.js +49 -12
- package/dist/render/png.d.ts +1 -1
- package/dist/render/png.js +5 -5
- package/dist/render/sequence-svg.d.ts +8 -3
- package/dist/render/sequence-svg.js +32 -32
- package/dist/render/sequence.d.ts +1 -1
- package/dist/render/sequence.js +1 -1
- package/dist/render/svg.d.ts +19 -6
- package/dist/render/svg.js +148 -85
- package/dist/render/text.d.ts +6 -4
- package/dist/render/text.js +11 -9
- package/dist/render/tokens.d.ts +53 -0
- package/dist/render/tokens.js +71 -0
- package/dist/schema/adr.js +18 -13
- package/dist/schema/workspace.js +226 -130
- package/dist/viewer/assets/index-BXa5R96a.js +138 -0
- package/dist/viewer/assets/index-YFA-pYjQ.css +1 -0
- package/dist/viewer/assets/{layout.worker-Bg-OaLVN.js → layout.worker-BRHAGJrD.js} +1 -1
- package/dist/viewer/assets/{png-D1zzLB1s.js → png-CAaXWR-k.js} +1 -1
- package/dist/viewer/assets/svg-BPVHfD36.js +2 -0
- package/dist/viewer/index.html +2 -2
- package/guide/SKILL.md +1 -1
- package/guide/topics/bootstrap.md +1 -1
- package/guide/topics/relationships.md +1 -1
- package/package.json +20 -4
- package/schemas/adr.schema.json +18 -15
- package/schemas/model.schema.json +637 -1144
- package/schemas/project.schema.json +8 -4
- package/schemas/workspace.schema.json +39 -20
- package/dist/core/views.d.ts +0 -126
- package/dist/core/views.js +0 -217
- package/dist/viewer/assets/index-BwUCSYuf.js +0 -113
- package/dist/viewer/assets/index-DvKgCpBr.css +0 -1
- package/dist/viewer/assets/svg-Cw4FMsm3.js +0 -2
package/dist/core/rules.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { generatedViews, MAX_VIEW_NODES } from "./views.js";
|
|
2
|
-
import { resolveSaved } from "./saved-views.js";
|
|
1
|
+
import { checkView, generatedViews, MAX_VIEW_NODES, parseViewId } from "./views/index.js";
|
|
3
2
|
import { Id, parentKindOf } from "../schema/workspace.js";
|
|
4
3
|
import { qualified, qualify, referenceResolver } from "./refs.js";
|
|
5
|
-
import { resolveDynamic } from "./dynamic-views.js";
|
|
6
4
|
import { didYouMean } from "./suggest.js";
|
|
7
5
|
import { AdrFrontmatter } from "../schema/adr.js";
|
|
8
6
|
import { checkSchema } from "./schema-check.js";
|
|
9
7
|
import { qualifyAdr } from "./adr.js";
|
|
8
|
+
/** The part of the Model a rule is about, in the order the docs list them. Every rule is in exactly one. */
|
|
9
|
+
export const ruleAreas = ["workspace", "elements", "relationships", "deployments", "views", "decisions"];
|
|
10
10
|
const base = {
|
|
11
11
|
"workspace.yaml": "teams:\n core:\n name: Core\nenvironments:\n prod:\n name: Production\n",
|
|
12
12
|
"shop/project.yaml": "id: shop\nname: Shop\nowner: core\n",
|
|
@@ -127,14 +127,14 @@ const resolvedSavedViews = (ws, bundle) => ws.views.flatMap((decl) => {
|
|
|
127
127
|
return [];
|
|
128
128
|
if (def.level === "deployment" && !bundle.environments.some((e) => e.id === def.environment))
|
|
129
129
|
return [];
|
|
130
|
-
return [{ decl, def, resolution:
|
|
130
|
+
return [{ decl, def, resolution: checkView(bundle, def) }];
|
|
131
131
|
});
|
|
132
132
|
/** The Bundle definition a View declaration became, if it made it into the Bundle (the first of a repeated id). */
|
|
133
133
|
const bundledView = (decl, bundle) => bundle.views.find((v) => v.id === `${decl.project.id}:${decl.id}` && v.source.file === decl.file.path && v.source.line === decl.line);
|
|
134
134
|
/** Each Dynamic View that made it into the Bundle, with its resolution. */
|
|
135
135
|
const resolvedDynamicViews = (ws, bundle) => ws.views.flatMap((decl) => {
|
|
136
136
|
const def = bundledView(decl, bundle);
|
|
137
|
-
return def?.kind === "dynamic" ? [{ decl, def, resolution:
|
|
137
|
+
return def?.kind === "dynamic" ? [{ decl, def, resolution: checkView(bundle, def) }] : [];
|
|
138
138
|
});
|
|
139
139
|
/** A rule reporting one kind of Dynamic View problem, at the Step or participant it is about. */
|
|
140
140
|
const dynamicProblems = (rule) => (ws, bundle) => resolvedDynamicViews(ws, bundle).flatMap(({ decl, resolution }) => resolution.problems.filter((p) => p.rule === rule).map((p) => at(decl.file, [...decl.path, ...p.at], p.message)));
|
|
@@ -187,8 +187,12 @@ export const rules = [
|
|
|
187
187
|
{
|
|
188
188
|
id: "yaml-syntax",
|
|
189
189
|
severity: "error",
|
|
190
|
+
area: "workspace",
|
|
191
|
+
since: "1.0.0",
|
|
190
192
|
summary: "A file can't be parsed as YAML.",
|
|
193
|
+
why: "Nothing in a file that can't be parsed reaches the Model. Everything it declares goes missing, and every reference to those ids fails as well.",
|
|
191
194
|
fix: "Correct the YAML syntax at the reported position.",
|
|
195
|
+
related: ["invalid-adr-frontmatter"],
|
|
192
196
|
example: {
|
|
193
197
|
failing: withServices("services:\n web:\n name: [Web\n"),
|
|
194
198
|
passing: withServices("services:\n web:\n name: Web\n"),
|
|
@@ -201,8 +205,12 @@ export const rules = [
|
|
|
201
205
|
{
|
|
202
206
|
id: "unknown-field",
|
|
203
207
|
severity: "error",
|
|
208
|
+
area: "workspace",
|
|
209
|
+
since: "1.0.0",
|
|
204
210
|
summary: "A key isn't in the schema.",
|
|
211
|
+
why: "A key the schema doesn't know is almost always a misspelling. If it were ignored, the Model would quietly lack what the author meant to declare, such as a Service's `technology`.",
|
|
205
212
|
fix: "Remove the key, or correct its spelling to the suggested field.",
|
|
213
|
+
related: ["missing-field", "invalid-value"],
|
|
206
214
|
example: {
|
|
207
215
|
failing: withServices("services:\n web:\n name: Web\n techology: Go\n"),
|
|
208
216
|
passing: withServices("services:\n web:\n name: Web\n technology: Go\n"),
|
|
@@ -212,8 +220,12 @@ export const rules = [
|
|
|
212
220
|
{
|
|
213
221
|
id: "missing-field",
|
|
214
222
|
severity: "error",
|
|
223
|
+
area: "workspace",
|
|
224
|
+
since: "1.0.0",
|
|
215
225
|
summary: "A required field is absent.",
|
|
226
|
+
why: "A required field is one the rest of the Model relies on, such as the `name` an Element is shown by or the `to` of a Relationship. Without it the declaration can't be drawn or resolved.",
|
|
216
227
|
fix: "Add the missing field.",
|
|
228
|
+
related: ["unknown-field", "invalid-value"],
|
|
217
229
|
example: {
|
|
218
230
|
failing: withServices("services:\n web:\n technology: Go\n"),
|
|
219
231
|
passing: withServices("services:\n web:\n name: Web\n technology: Go\n"),
|
|
@@ -223,8 +235,12 @@ export const rules = [
|
|
|
223
235
|
{
|
|
224
236
|
id: "invalid-value",
|
|
225
237
|
severity: "error",
|
|
238
|
+
area: "workspace",
|
|
239
|
+
since: "1.0.0",
|
|
226
240
|
summary: "A value has the wrong type, a bad enum value or a malformed URL.",
|
|
241
|
+
why: "A value a field doesn't accept means nothing to what reads the Model. A Service `type` outside `app`, `datastore` and `broker` can't be drawn, and a malformed `url` can't be opened.",
|
|
227
242
|
fix: "Change the value to one the field accepts.",
|
|
243
|
+
related: ["unknown-field", "missing-field"],
|
|
228
244
|
example: {
|
|
229
245
|
failing: withServices("services:\n orders-db:\n name: Orders DB\n type: database\n"),
|
|
230
246
|
passing: withServices("services:\n orders-db:\n name: Orders DB\n type: datastore\n"),
|
|
@@ -234,8 +250,12 @@ export const rules = [
|
|
|
234
250
|
{
|
|
235
251
|
id: "nested-project",
|
|
236
252
|
severity: "error",
|
|
253
|
+
area: "workspace",
|
|
254
|
+
since: "1.0.0",
|
|
237
255
|
summary: "A `project.yaml` sits inside another Project's folder.",
|
|
256
|
+
why: "A Project is one Team's folder: it namespaces the ids declared in it and gives them a default Owner. A Project inside another would put its files in two Teams' folders at once.",
|
|
238
257
|
fix: "Move the inner Project's folder out of the outer Project's folder.",
|
|
258
|
+
related: ["file-outside-project"],
|
|
239
259
|
example: {
|
|
240
260
|
failing: { ...base, "shop/legacy/project.yaml": "id: legacy\nname: Legacy\nowner: core\n" },
|
|
241
261
|
passing: { ...base, "legacy/project.yaml": "id: legacy\nname: Legacy\nowner: core\n" },
|
|
@@ -247,8 +267,12 @@ export const rules = [
|
|
|
247
267
|
{
|
|
248
268
|
id: "file-outside-project",
|
|
249
269
|
severity: "error",
|
|
270
|
+
area: "workspace",
|
|
271
|
+
since: "1.0.0",
|
|
250
272
|
summary: "A model file is under no Project.",
|
|
273
|
+
why: "Elements, Deployments and Views always belong to a Project, which gives them their Qualified id and default Owner. A model file under no Project has neither, so nothing in it can join the Model.",
|
|
251
274
|
fix: "Move the file into a Project folder (one with a `project.yaml`).",
|
|
275
|
+
related: ["nested-project"],
|
|
252
276
|
example: {
|
|
253
277
|
failing: { ...base, "services.yaml": "services:\n web:\n name: Web\n" },
|
|
254
278
|
passing: withServices("services:\n web:\n name: Web\n"),
|
|
@@ -260,8 +284,12 @@ export const rules = [
|
|
|
260
284
|
{
|
|
261
285
|
id: "duplicate-project-id",
|
|
262
286
|
severity: "error",
|
|
287
|
+
area: "workspace",
|
|
288
|
+
since: "1.0.0",
|
|
263
289
|
summary: "Two Projects share an id.",
|
|
290
|
+
why: "A Qualified id, `project:id`, names one thing across the whole Workspace. If two Projects were both `shop`, `shop:web` could mean an Element in either.",
|
|
264
291
|
fix: "Give one of the Projects a different id.",
|
|
292
|
+
related: ["unknown-project", "duplicate-id"],
|
|
265
293
|
example: {
|
|
266
294
|
failing: { ...base, "shop-admin/project.yaml": "id: shop\nname: Shop admin\nowner: core\n" },
|
|
267
295
|
passing: { ...base, "shop-admin/project.yaml": "id: shop-admin\nname: Shop admin\nowner: core\n" },
|
|
@@ -271,8 +299,12 @@ export const rules = [
|
|
|
271
299
|
{
|
|
272
300
|
id: "definition-outside-workspace",
|
|
273
301
|
severity: "error",
|
|
302
|
+
area: "workspace",
|
|
303
|
+
since: "1.0.0",
|
|
274
304
|
summary: "`teams` or `environments` declared outside `workspace.yaml`.",
|
|
305
|
+
why: "Teams and Environments are defined once per Workspace, so `prod` means the same thing in every Project. A second definition inside a Project could disagree with the first.",
|
|
275
306
|
fix: "Move the definitions into `workspace.yaml` at the Workspace root.",
|
|
307
|
+
related: ["unknown-team", "unknown-environment"],
|
|
276
308
|
example: {
|
|
277
309
|
failing: withServices("teams:\n web-team:\n name: Web\n"),
|
|
278
310
|
passing: {
|
|
@@ -285,8 +317,12 @@ export const rules = [
|
|
|
285
317
|
{
|
|
286
318
|
id: "unknown-team",
|
|
287
319
|
severity: "error",
|
|
320
|
+
area: "workspace",
|
|
321
|
+
since: "1.0.0",
|
|
288
322
|
summary: "An `owner`, or a Saved View's `{team}` selector or Team Lens, names no Team.",
|
|
323
|
+
why: "Every Element has exactly one Owner, so there is one Team to ask when something breaks. An `owner` that names no Team leaves nobody accountable, and a `{team}` selector or Team Lens that names none shows nothing.",
|
|
289
324
|
fix: "Use the id of a Team defined in `workspace.yaml`, or define the Team there.",
|
|
325
|
+
related: ["definition-outside-workspace"],
|
|
290
326
|
example: {
|
|
291
327
|
failing: withServices("services:\n web:\n name: Web\n owner: cor\n"),
|
|
292
328
|
passing: withServices("services:\n web:\n name: Web\n owner: core\n"),
|
|
@@ -317,8 +353,12 @@ export const rules = [
|
|
|
317
353
|
{
|
|
318
354
|
id: "duplicate-id",
|
|
319
355
|
severity: "error",
|
|
356
|
+
area: "elements",
|
|
357
|
+
since: "1.0.0",
|
|
320
358
|
summary: "An Element or Deployment Target id is declared twice in a Project, across files too, whatever its kind or nesting.",
|
|
359
|
+
why: "A reference such as `to: web` has to name one thing. Ids are unique across the whole Project, whatever the kind or nesting, so moving an Element under another parent never changes its id.",
|
|
321
360
|
fix: "Rename one of the Elements or Targets, or remove the second declaration.",
|
|
361
|
+
related: ["duplicate-relationship-id", "duplicate-view-id", "duplicate-project-id"],
|
|
322
362
|
example: {
|
|
323
363
|
failing: withServices("services:\n web:\n name: Web\n", { "shop/more.yaml": "services:\n web:\n name: Web v2\n" }),
|
|
324
364
|
passing: withServices("services:\n web:\n name: Web\n", { "shop/more.yaml": "services:\n web-v2:\n name: Web v2\n" }),
|
|
@@ -346,8 +386,12 @@ export const rules = [
|
|
|
346
386
|
{
|
|
347
387
|
id: "invalid-nesting",
|
|
348
388
|
severity: "error",
|
|
389
|
+
area: "elements",
|
|
390
|
+
since: "1.0.0",
|
|
349
391
|
summary: "System > Service > Component is broken, by nesting or `in:`.",
|
|
392
|
+
why: "Every View shows the Model at a level: Systems at C1, Services at C2, Components at C3. That depends on the nesting System > Service > Component: a Component directly inside a System has no Service to be drawn in.",
|
|
350
393
|
fix: "Move the Element under a parent of the right kind (a Service under a System, a Component under a Service), or point `in:` at one.",
|
|
394
|
+
related: ["external-with-components", "unknown-element"],
|
|
351
395
|
example: {
|
|
352
396
|
failing: withServices("systems:\n checkout:\n name: Checkout\n components:\n cart-api:\n name: Cart API\n"),
|
|
353
397
|
passing: withServices("systems:\n checkout:\n name: Checkout\n services:\n cart:\n name: Cart\n components:\n cart-api:\n name: Cart API\n"),
|
|
@@ -374,8 +418,12 @@ export const rules = [
|
|
|
374
418
|
{
|
|
375
419
|
id: "external-with-components",
|
|
376
420
|
severity: "error",
|
|
421
|
+
area: "elements",
|
|
422
|
+
since: "1.0.0",
|
|
377
423
|
summary: "An External System or Service declares Components.",
|
|
378
|
-
|
|
424
|
+
why: "An External System or Service runs outside the organization, and you can't see inside it. Components declared there would describe software that its Owner, the Team accountable for the integration, doesn't run and can't check.",
|
|
425
|
+
fix: "Remove the Components, or drop `external` if the organization runs the Element itself.",
|
|
426
|
+
related: ["invalid-nesting"],
|
|
379
427
|
example: {
|
|
380
428
|
failing: withServices("services:\n stripe:\n name: Stripe\n external: true\n components:\n stripe-sdk:\n name: Stripe SDK\n"),
|
|
381
429
|
passing: withServices("services:\n stripe:\n name: Stripe\n external: true\n"),
|
|
@@ -396,8 +444,12 @@ export const rules = [
|
|
|
396
444
|
{
|
|
397
445
|
id: "unknown-element",
|
|
398
446
|
severity: "error",
|
|
447
|
+
area: "elements",
|
|
448
|
+
since: "1.0.0",
|
|
399
449
|
summary: "A reference names no Element: in `to`, `via`, `in`, a Deployment's `service`, or a Saved View's selectors, `expand`, `collapse` or Lens.",
|
|
450
|
+
why: "A reference that names no Element leaves something hanging: a Relationship with no provider, a Deployment with no Service, a Saved View that selects nothing. It is nearly always a misspelled id, so `check` suggests the nearest one.",
|
|
400
451
|
fix: "Use the id of an Element declared in the Project, or declare it.",
|
|
452
|
+
related: ["unknown-project", "wrong-kind", "unknown-target", "unknown-adr-link"],
|
|
401
453
|
example: {
|
|
402
454
|
failing: withServices("systems:\n checkout:\n name: Checkout\n", { "shop/cart.yaml": "services:\n cart:\n name: Cart\n in: chekout\n" }),
|
|
403
455
|
passing: withServices("systems:\n checkout:\n name: Checkout\n", { "shop/cart.yaml": "services:\n cart:\n name: Cart\n in: checkout\n" }),
|
|
@@ -431,8 +483,12 @@ export const rules = [
|
|
|
431
483
|
{
|
|
432
484
|
id: "unknown-project",
|
|
433
485
|
severity: "error",
|
|
486
|
+
area: "workspace",
|
|
487
|
+
since: "1.0.0",
|
|
434
488
|
summary: "A `project:` prefix names no Project.",
|
|
489
|
+
why: "A Qualified id names its Project first. If no Project has that id, the reference points at nothing, and the Relationship or Saved View that makes it can't be resolved.",
|
|
435
490
|
fix: "Correct the prefix to the id of an existing Project.",
|
|
491
|
+
related: ["own-project-prefix", "unknown-element", "duplicate-project-id"],
|
|
436
492
|
example: {
|
|
437
493
|
failing: { ...relating("to: paymnts:payments-api"), ...payments },
|
|
438
494
|
passing: { ...relating("to: payments:payments-api"), ...payments },
|
|
@@ -452,8 +508,12 @@ export const rules = [
|
|
|
452
508
|
{
|
|
453
509
|
id: "own-project-prefix",
|
|
454
510
|
severity: "error",
|
|
511
|
+
area: "workspace",
|
|
512
|
+
since: "1.0.0",
|
|
455
513
|
summary: "A Project qualifies its own ids.",
|
|
514
|
+
why: "Every id has one spelling: bare inside its own Project, qualified from any other. If `cart` and `shop:cart` both worked inside `shop`, one Element would be written two ways in the same Project's files.",
|
|
456
515
|
fix: "Drop the `project:` prefix; within its own Project an id is written bare.",
|
|
516
|
+
related: ["unknown-project"],
|
|
457
517
|
example: {
|
|
458
518
|
failing: relating("to: shop:cart", cart),
|
|
459
519
|
passing: relating("to: cart", cart),
|
|
@@ -463,8 +523,12 @@ export const rules = [
|
|
|
463
523
|
{
|
|
464
524
|
id: "duplicate-relationship-id",
|
|
465
525
|
severity: "error",
|
|
526
|
+
area: "relationships",
|
|
527
|
+
since: "1.0.0",
|
|
466
528
|
summary: "A Relationship `id` repeats in a Project.",
|
|
529
|
+
why: "A Relationship has an `id` so that a Dynamic View Step, or an agent, can say which of several Relationships between two Elements it means. Two Relationships with the same id can't be told apart.",
|
|
467
530
|
fix: "Give one of the Relationships a different id.",
|
|
531
|
+
related: ["ambiguous-step", "duplicate-id"],
|
|
468
532
|
example: {
|
|
469
533
|
failing: twoToCart("add-item", "add-item"),
|
|
470
534
|
passing: twoToCart("add-item", "add-gift-card"),
|
|
@@ -488,8 +552,12 @@ export const rules = [
|
|
|
488
552
|
{
|
|
489
553
|
id: "self-relationship",
|
|
490
554
|
severity: "error",
|
|
555
|
+
area: "relationships",
|
|
556
|
+
since: "1.0.0",
|
|
491
557
|
summary: "An Element has a Relationship to itself.",
|
|
558
|
+
why: "A Relationship says that one Element depends on another. Pointed at itself, an Element would be its own upstream and downstream, which tells a reader nothing; it is usually a `to` that names the wrong id.",
|
|
492
559
|
fix: "Point `to` at the Element depended on, or remove the Relationship.",
|
|
560
|
+
related: ["ancestor-descendant-relationship"],
|
|
493
561
|
example: {
|
|
494
562
|
failing: relating("to: web", cart),
|
|
495
563
|
passing: relating("to: cart", cart),
|
|
@@ -499,7 +567,10 @@ export const rules = [
|
|
|
499
567
|
{
|
|
500
568
|
id: "person-as-provider",
|
|
501
569
|
severity: "error",
|
|
570
|
+
area: "relationships",
|
|
571
|
+
since: "1.0.0",
|
|
502
572
|
summary: "The provider of a Relationship is a Person.",
|
|
573
|
+
why: "A Relationship points from what depends to what is depended on, and a Person is only ever a consumer: it uses Systems, and nothing depends on it. Pointed at a Person, the Relationship runs backward, so impact answers upstream and downstream of it are wrong.",
|
|
503
574
|
fix: "A Person is only ever a consumer: declare the Relationship under the Person, pointing at what it uses.",
|
|
504
575
|
example: {
|
|
505
576
|
failing: relating("to: shopper", "people:\n shopper:\n name: Shopper\n"),
|
|
@@ -510,8 +581,12 @@ export const rules = [
|
|
|
510
581
|
{
|
|
511
582
|
id: "ancestor-descendant-relationship",
|
|
512
583
|
severity: "error",
|
|
584
|
+
area: "relationships",
|
|
585
|
+
since: "1.0.0",
|
|
513
586
|
summary: "An Element is linked to its own ancestor or descendant.",
|
|
587
|
+
why: "A Component is part of its Service, and a Service part of its System; the nesting already says so. A Relationship between an Element and its own ancestor can't be drawn at the ancestor's level, where both ends are the same node.",
|
|
514
588
|
fix: "Point `to` at an Element outside the consumer's own branch, such as a sibling.",
|
|
589
|
+
related: ["self-relationship", "ancestor-descendant-participants"],
|
|
515
590
|
example: {
|
|
516
591
|
failing: withServices("services:\n web:\n name: Web\n components:\n web-ui:\n name: Web UI\n relationships:\n - to: web\n"),
|
|
517
592
|
passing: withServices("services:\n web:\n name: Web\n components:\n web-ui:\n name: Web UI\n relationships:\n - to: web-api\n web-api:\n name: Web API\n"),
|
|
@@ -527,8 +602,12 @@ export const rules = [
|
|
|
527
602
|
{
|
|
528
603
|
id: "via-on-sync",
|
|
529
604
|
severity: "error",
|
|
605
|
+
area: "relationships",
|
|
606
|
+
since: "1.0.0",
|
|
530
607
|
summary: "`via` or `channel` on a sync Relationship.",
|
|
608
|
+
why: "`via` and `channel` say which broker and channel carry a Publisher's events to a Subscriber. A sync Relationship is a call that waits for an answer, with no broker in it, so they would add a hop that isn't there to impact and path answers.",
|
|
531
609
|
fix: "Set `interaction: async` if the Relationship runs through a broker, or remove `via` and `channel`.",
|
|
610
|
+
related: ["via-not-broker", "return-on-async"],
|
|
532
611
|
example: {
|
|
533
612
|
failing: relating("to: cart\nvia: events\nchannel: cart.updated", `${cart}${events("broker")}`),
|
|
534
613
|
passing: relating("to: cart\ninteraction: async\nvia: events\nchannel: cart.updated", `${cart}${events("broker")}`),
|
|
@@ -540,8 +619,12 @@ export const rules = [
|
|
|
540
619
|
{
|
|
541
620
|
id: "via-not-broker",
|
|
542
621
|
severity: "error",
|
|
622
|
+
area: "relationships",
|
|
623
|
+
since: "1.0.0",
|
|
543
624
|
summary: "`via` names a Service that isn't `type: broker`.",
|
|
625
|
+
why: "Impact and path answers count the `via` Service as a hop, and as something both sides depend on. That is true only of a broker: for any other Service it would claim that both sides depend on it when they don't.",
|
|
544
626
|
fix: "Point `via` at a broker Service, or mark the Service `type: broker`.",
|
|
627
|
+
related: ["via-on-sync", "wrong-kind"],
|
|
545
628
|
example: {
|
|
546
629
|
failing: relating("to: cart\ninteraction: async\nvia: events", `${cart}${events("app")}`),
|
|
547
630
|
passing: relating("to: cart\ninteraction: async\nvia: events", `${cart}${events("broker")}`),
|
|
@@ -556,7 +639,10 @@ export const rules = [
|
|
|
556
639
|
{
|
|
557
640
|
id: "duplicate-deployment",
|
|
558
641
|
severity: "error",
|
|
642
|
+
area: "deployments",
|
|
643
|
+
since: "1.0.0",
|
|
559
644
|
summary: "The same Service, Environment and Target appear twice.",
|
|
645
|
+
why: "A Deployment is one Service in one Environment on one Deployment Target, and those three name it: it has no id of its own. A second one with the same three could carry a different `url`, with nothing to say which is right.",
|
|
560
646
|
fix: "Remove the second Deployment, or merge its `url` and `endpoints` into the first.",
|
|
561
647
|
example: {
|
|
562
648
|
failing: withDeployments(" - { service: web, environment: prod, target: eks-prod, url: https://shop.example.com }\n", { "shop/more.yaml": "deployments:\n - { service: web, environment: prod, target: eks-prod, url: https://www.shop.example.com }\n" }),
|
|
@@ -586,8 +672,12 @@ export const rules = [
|
|
|
586
672
|
{
|
|
587
673
|
id: "unknown-environment",
|
|
588
674
|
severity: "error",
|
|
675
|
+
area: "deployments",
|
|
676
|
+
since: "1.0.0",
|
|
589
677
|
summary: "A Deployment, or a Saved Deployment View, names no Environment.",
|
|
678
|
+
why: "Environments are defined once, in `workspace.yaml`, so `prod` means the same thing in every Project. A Deployment that says `production` when the Environment is `prod` belongs to no Environment, and nobody asking where the Service runs in `prod` will find it.",
|
|
590
679
|
fix: "Use the id of an Environment defined in `workspace.yaml`, or define the Environment there.",
|
|
680
|
+
related: ["unknown-target", "target-outside-environment", "definition-outside-workspace"],
|
|
591
681
|
example: {
|
|
592
682
|
failing: withDeployments(" - { service: web, environment: production, target: eks-prod }\n"),
|
|
593
683
|
passing: withDeployments(" - { service: web, environment: prod, target: eks-prod }\n"),
|
|
@@ -606,8 +696,12 @@ export const rules = [
|
|
|
606
696
|
{
|
|
607
697
|
id: "unknown-target",
|
|
608
698
|
severity: "error",
|
|
699
|
+
area: "deployments",
|
|
700
|
+
since: "1.0.0",
|
|
609
701
|
summary: "A Deployment, or a Saved Deployment View's `targets`, names no Deployment Target.",
|
|
702
|
+
why: "A Deployment says where a Service runs. If its `target` names no Deployment Target, the Deployment has nowhere to be placed in a Deployment View; a Saved Deployment View that names one narrows to a Target that doesn't exist.",
|
|
610
703
|
fix: "Use the id of a Target declared in the Project, or `project:id` for one declared in another Project.",
|
|
704
|
+
related: ["unknown-environment", "target-outside-environment", "wrong-kind"],
|
|
611
705
|
example: {
|
|
612
706
|
failing: withDeployments(" - { service: web, environment: prod, target: eks-prd }\n"),
|
|
613
707
|
passing: withDeployments(" - { service: web, environment: prod, target: eks-prod }\n"),
|
|
@@ -630,8 +724,12 @@ export const rules = [
|
|
|
630
724
|
{
|
|
631
725
|
id: "wrong-kind",
|
|
632
726
|
severity: "error",
|
|
727
|
+
area: "elements",
|
|
728
|
+
since: "1.0.0",
|
|
633
729
|
summary: "An id resolves to a kind the field doesn't accept, such as a Deployment's `service` naming a Component or System, or a Relationship's `via` naming something other than a Service.",
|
|
730
|
+
why: "Some fields take one kind only. Only a Service is deployed, because Systems and Components run as part of their Services, and only a Service can be the broker an async Relationship runs through.",
|
|
634
731
|
fix: "Point the field at an id of the kind it accepts: a Deployment's `service` and a Relationship's `via` each name a Service.",
|
|
732
|
+
related: ["unknown-element", "via-not-broker", "unknown-target"],
|
|
635
733
|
example: {
|
|
636
734
|
failing: withDeployments(" - { service: cart, environment: prod, target: eks-prod }\n"),
|
|
637
735
|
passing: withDeployments(" - { service: web, environment: prod, target: eks-prod }\n"),
|
|
@@ -654,8 +752,12 @@ export const rules = [
|
|
|
654
752
|
{
|
|
655
753
|
id: "oversized-view",
|
|
656
754
|
severity: "warning",
|
|
755
|
+
area: "views",
|
|
756
|
+
since: "1.0.0",
|
|
657
757
|
summary: `A View has more than ${MAX_VIEW_NODES} nodes, too many for a readable diagram. A Generated View is reported at its System or Service, or at \`workspace.yaml\` for the Landscapes; a Saved View at its id.`,
|
|
758
|
+
why: `A View is a diagram for people to read. With more than ${MAX_VIEW_NODES} nodes the boxes and lines are too many to follow, so the View answers no question at a glance.`,
|
|
658
759
|
fix: "Split the System, or group top-level Services and Systems, so each Generated View stays within the limit; narrow a Saved View's selectors or raise its `level`.",
|
|
760
|
+
related: ["empty-view"],
|
|
659
761
|
example: {
|
|
660
762
|
failing: withServices(`systems:\n big:\n name: Big\n services:\n${numbered(MAX_VIEW_NODES, "s", 6)}`),
|
|
661
763
|
passing: withServices(`systems:\n big:\n name: Big\n services:\n${numbered(MAX_VIEW_NODES / 2, "s", 6)} more:\n name: More\n services:\n${numbered(MAX_VIEW_NODES / 2, "s", 6, MAX_VIEW_NODES / 2)}`),
|
|
@@ -665,7 +767,8 @@ export const rules = [
|
|
|
665
767
|
const generated = generatedViews(bundle)
|
|
666
768
|
.filter((v) => v.nodes.length > MAX_VIEW_NODES)
|
|
667
769
|
.flatMap((v) => {
|
|
668
|
-
const
|
|
770
|
+
const ref = parseViewId(v.id);
|
|
771
|
+
const focus = ref?.form === "focused" ? bundle.elements.find((e) => e.id === ref.element) : undefined;
|
|
669
772
|
const where = focus ? focus.source : workspaceFile ? { file: workspaceFile.path, line: 1 } : undefined;
|
|
670
773
|
if (!where)
|
|
671
774
|
return [];
|
|
@@ -680,8 +783,12 @@ export const rules = [
|
|
|
680
783
|
{
|
|
681
784
|
id: "duplicate-view-id",
|
|
682
785
|
severity: "error",
|
|
786
|
+
area: "views",
|
|
787
|
+
since: "1.0.0",
|
|
683
788
|
summary: "A Saved View id repeats in a Project, across files too.",
|
|
789
|
+
why: "A Saved View is opened, exported and linked from ADRs by its Qualified id, such as `shop:front`. Only the first View with an id goes into the Workspace Bundle, so the second could never be opened.",
|
|
684
790
|
fix: "Give one of the Views a different id.",
|
|
791
|
+
related: ["duplicate-id"],
|
|
685
792
|
example: {
|
|
686
793
|
failing: viewing("front:\n title: Front\n level: c2", { "shop/more.yaml": "views:\n structural:\n front:\n title: Front again\n level: c2\n" }),
|
|
687
794
|
passing: viewing("front:\n title: Front\n level: c2", { "shop/more.yaml": "views:\n structural:\n front-v2:\n title: Front again\n level: c2\n" }),
|
|
@@ -704,8 +811,12 @@ export const rules = [
|
|
|
704
811
|
{
|
|
705
812
|
id: "missing-step",
|
|
706
813
|
severity: "error",
|
|
814
|
+
area: "views",
|
|
815
|
+
since: "1.0.0",
|
|
707
816
|
summary: "A Dynamic View Step has no Relationship or derived edge between `from` and `to` (nor a `via` subscription of `to` to `from`), or the named `relationship` doesn't connect them.",
|
|
817
|
+
why: "Each Step must follow a Relationship that exists in the Model, so a scenario can't show a call the architecture doesn't have. A Step with no Relationship behind it means the scenario is wrong or the Model is missing a Relationship.",
|
|
708
818
|
fix: "Point the Step at two Elements a Relationship connects, declare the Relationship, or name one that connects them.",
|
|
819
|
+
related: ["ambiguous-step", "return-without-relationship"],
|
|
709
820
|
example: {
|
|
710
821
|
failing: scenario("purchase:\n title: Purchase\n steps:\n - { from: cart, to: web }"),
|
|
711
822
|
passing: scenario("purchase:\n title: Purchase\n steps:\n - { from: web, to: cart }"),
|
|
@@ -715,8 +826,12 @@ export const rules = [
|
|
|
715
826
|
{
|
|
716
827
|
id: "ambiguous-step",
|
|
717
828
|
severity: "error",
|
|
829
|
+
area: "views",
|
|
830
|
+
since: "1.0.0",
|
|
718
831
|
summary: "Several Relationships match a Dynamic View Step (several between the pair, or both a call and an event) and no `relationship` names one.",
|
|
832
|
+
why: "A Step takes its kind, a call or an event, and its default label from the Relationship it follows. When several Relationships match, Archidocs doesn't guess which one the scenario means.",
|
|
719
833
|
fix: "Name the Relationship the Step takes with `relationship: <id>`.",
|
|
834
|
+
related: ["missing-step", "duplicate-relationship-id"],
|
|
720
835
|
example: {
|
|
721
836
|
failing: scenario("purchase:\n title: Purchase\n steps:\n - { from: orders, to: mailer }", " relationships:\n - id: notify\n to: mailer\n"),
|
|
722
837
|
passing: scenario("purchase:\n title: Purchase\n steps:\n - { from: orders, to: mailer, relationship: notify }", " relationships:\n - id: notify\n to: mailer\n"),
|
|
@@ -726,8 +841,12 @@ export const rules = [
|
|
|
726
841
|
{
|
|
727
842
|
id: "return-without-relationship",
|
|
728
843
|
severity: "error",
|
|
844
|
+
area: "views",
|
|
845
|
+
since: "1.0.0",
|
|
729
846
|
summary: "A Dynamic View return Step has no Relationship the other way, from its `to` to its `from`.",
|
|
847
|
+
why: "A return Step is the provider's reply to a consumer, so it follows a Relationship the other way round: from its `to` to its `from`. With no such Relationship there is no call for it to be the reply to.",
|
|
730
848
|
fix: "Turn the Step round, or remove `return: true` if it is a call of its own.",
|
|
849
|
+
related: ["return-on-async", "missing-step"],
|
|
731
850
|
example: {
|
|
732
851
|
failing: scenario("purchase:\n title: Purchase\n steps:\n - { from: web, to: cart, return: true }"),
|
|
733
852
|
passing: scenario("purchase:\n title: Purchase\n steps:\n - { from: web, to: cart }\n - { from: cart, to: web, return: true }"),
|
|
@@ -737,8 +856,12 @@ export const rules = [
|
|
|
737
856
|
{
|
|
738
857
|
id: "return-on-async",
|
|
739
858
|
severity: "error",
|
|
859
|
+
area: "views",
|
|
860
|
+
since: "1.0.0",
|
|
740
861
|
summary: "A Dynamic View return Step resolves to an async Relationship, which has no reply.",
|
|
862
|
+
why: "An async Relationship doesn't wait for an answer, so there is no reply to draw. If the other side calls back later, that is a Relationship of its own and belongs in the Model.",
|
|
741
863
|
fix: "Remove the return Step, or model the callback as a Relationship of its own and add a Step for it.",
|
|
864
|
+
related: ["return-without-relationship", "via-on-sync"],
|
|
742
865
|
example: {
|
|
743
866
|
failing: scenario("purchase:\n title: Purchase\n steps:\n - { from: orders, to: mailer, return: true }"),
|
|
744
867
|
passing: scenario("purchase:\n title: Purchase\n steps:\n - { from: orders, to: mailer }"),
|
|
@@ -748,8 +871,12 @@ export const rules = [
|
|
|
748
871
|
{
|
|
749
872
|
id: "ancestor-descendant-participants",
|
|
750
873
|
severity: "error",
|
|
874
|
+
area: "views",
|
|
875
|
+
since: "1.0.0",
|
|
751
876
|
summary: "An Element and its own ancestor are both participants of a Dynamic View.",
|
|
877
|
+
why: "A Dynamic View tells its scenario with each Element at one level. With a Service and one of its own Components both taking part, the same software appears twice in the sequence chart, and a reader can't tell which of the two a Step really reaches.",
|
|
752
878
|
fix: "Tell the scenario at one level: use the ancestor throughout, or its descendants throughout.",
|
|
879
|
+
related: ["ancestor-descendant-relationship", "missing-step"],
|
|
753
880
|
example: {
|
|
754
881
|
failing: scenario("purchase:\n title: Purchase\n participants: [cart]\n steps:\n - { from: web, to: cart-api }"),
|
|
755
882
|
passing: scenario("purchase:\n title: Purchase\n participants: [cart]\n steps:\n - { from: web, to: cart }"),
|
|
@@ -759,8 +886,12 @@ export const rules = [
|
|
|
759
886
|
{
|
|
760
887
|
id: "target-outside-environment",
|
|
761
888
|
severity: "error",
|
|
889
|
+
area: "views",
|
|
890
|
+
since: "1.0.0",
|
|
762
891
|
summary: "A Saved Deployment View's `targets` entry has no Deployment in the View's `environment`, on it or on any Target inside it.",
|
|
892
|
+
why: "A Deployment View shows one Environment. A Deployment Target with no Deployment in that Environment, on it or on any Target inside it, has nothing to show there; it usually means the wrong Target or the wrong Environment.",
|
|
763
893
|
fix: "Remove the Target from `targets`, or point the View at the Environment that runs on it.",
|
|
894
|
+
related: ["unknown-target", "unknown-environment", "empty-view"],
|
|
764
895
|
example: {
|
|
765
896
|
failing: withDeployments(" - { service: web, environment: prod, target: eks-prod }\n", {
|
|
766
897
|
"shop/views.yaml": "targets:\n eks-staging:\n name: EKS staging\n kind: cluster\nviews:\n structural:\n runtime:\n title: Runtime\n level: deployment\n environment: prod\n targets: [eks-staging]\n",
|
|
@@ -789,8 +920,12 @@ export const rules = [
|
|
|
789
920
|
{
|
|
790
921
|
id: "bad-expand",
|
|
791
922
|
severity: "error",
|
|
923
|
+
area: "views",
|
|
924
|
+
since: "1.0.0",
|
|
792
925
|
summary: "A Saved View's `expand` or `collapse` id is not a node of the View once collapsed to its `level`, or has no children.",
|
|
926
|
+
why: "`expand` and `collapse` open or close single Elements once the View is collapsed to its `level`. An id that isn't a node of the View, or has no children, can't be opened or closed, so the View doesn't show what its author meant.",
|
|
793
927
|
fix: "Remove the id, include the Element in the View, or name an Element that has children.",
|
|
928
|
+
related: ["unknown-element"],
|
|
794
929
|
example: {
|
|
795
930
|
failing: viewing("front:\n title: Front\n level: c2\n include: [web]\n expand: [web]"),
|
|
796
931
|
passing: viewing("front:\n title: Front\n level: c2\n include: [web, cart]\n expand: [cart]"),
|
|
@@ -805,8 +940,12 @@ export const rules = [
|
|
|
805
940
|
{
|
|
806
941
|
id: "empty-view",
|
|
807
942
|
severity: "warning",
|
|
943
|
+
area: "views",
|
|
944
|
+
since: "1.0.0",
|
|
808
945
|
summary: "A Saved View resolves to no nodes.",
|
|
946
|
+
why: "A Saved View that selects nothing draws an empty diagram, which answers no question. It usually means the selectors no longer match the Model.",
|
|
809
947
|
fix: "Correct the selectors so they name Elements, or remove the View.",
|
|
948
|
+
related: ["unresolved-path", "oversized-view"],
|
|
810
949
|
example: {
|
|
811
950
|
failing: viewing("front:\n title: Front\n level: c2\n include: [{ tag: storefront }]"),
|
|
812
951
|
passing: withServices("services:\n web:\n name: Web\n tags: [storefront]\nviews:\n structural:\n front:\n title: Front\n level: c2\n include: [{ tag: storefront }]\n"),
|
|
@@ -818,8 +957,12 @@ export const rules = [
|
|
|
818
957
|
{
|
|
819
958
|
id: "unresolved-path",
|
|
820
959
|
severity: "warning",
|
|
960
|
+
area: "views",
|
|
961
|
+
since: "1.0.0",
|
|
821
962
|
summary: "A Saved View's path selector, or path Lens, finds no path between its two Elements.",
|
|
963
|
+
why: "A path selector or path Lens is there to show how one Element reaches another, and with no path between the two it adds nothing to the View. It is a warning, not an error, because a Model edit can legitimately break the path.",
|
|
822
964
|
fix: "Check the Relationships between the two Elements, or raise `paths`; remove the selector if the path is gone for good.",
|
|
965
|
+
related: ["empty-view"],
|
|
823
966
|
example: {
|
|
824
967
|
failing: viewing("front:\n title: Front\n level: c2\n include: [{ from: web, to: search }]"),
|
|
825
968
|
passing: viewing("front:\n title: Front\n level: c2\n include: [{ from: web, to: cart }]"),
|
|
@@ -829,8 +972,12 @@ export const rules = [
|
|
|
829
972
|
{
|
|
830
973
|
id: "invalid-adr-frontmatter",
|
|
831
974
|
severity: "error",
|
|
975
|
+
area: "decisions",
|
|
976
|
+
since: "1.0.0",
|
|
832
977
|
summary: "An ADR has no frontmatter, frontmatter that isn't valid YAML, or a field that is unknown, missing (`status`, `date`) or invalid, such as a `status` outside proposed, accepted, rejected, deprecated and superseded.",
|
|
978
|
+
why: "The frontmatter ties an ADR to the Model: `status` says whether the decision stands, and `elements` and `views` say what it affects. If it can't be read, a Proposed decision can't be told from an accepted one, and the ADR can't be shown on the Elements it is about.",
|
|
833
979
|
fix: "Start the file with `---`, `status` and `date` (YYYY-MM-DD), then `---`; use only the MADR fields and the `elements`, `views` and `supersedes` links.",
|
|
980
|
+
related: ["missing-adr-title", "hand-written-superseded", "yaml-syntax"],
|
|
834
981
|
example: {
|
|
835
982
|
failing: deciding({ "0001-use-kafka.md": adrText("status: approved\ndate: 2026-03-01") }),
|
|
836
983
|
passing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
@@ -847,8 +994,12 @@ export const rules = [
|
|
|
847
994
|
{
|
|
848
995
|
id: "missing-adr-title",
|
|
849
996
|
severity: "error",
|
|
997
|
+
area: "decisions",
|
|
998
|
+
since: "1.0.0",
|
|
850
999
|
summary: "An ADR's body has no `# ` heading to take its title from.",
|
|
1000
|
+
why: "An ADR is listed by its title, in the viewer and in `list_adrs`. The title is the body's first `# ` heading, not a frontmatter field, so an ADR without one has no name to be listed by.",
|
|
851
1001
|
fix: "Start the body with a `# ` heading naming the decision.",
|
|
1002
|
+
related: ["invalid-adr-frontmatter", "bad-adr-filename"],
|
|
852
1003
|
example: {
|
|
853
1004
|
failing: deciding({ "0001-use-kafka.md": "---\nstatus: accepted\ndate: 2026-03-01\n---\n\nWe publish domain events on Kafka.\n" }),
|
|
854
1005
|
passing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
@@ -858,8 +1009,12 @@ export const rules = [
|
|
|
858
1009
|
{
|
|
859
1010
|
id: "bad-adr-filename",
|
|
860
1011
|
severity: "error",
|
|
1012
|
+
area: "decisions",
|
|
1013
|
+
since: "1.0.0",
|
|
861
1014
|
summary: "A file in a Project's `adr/` folder isn't named `NNNN-slug.md` (and isn't `template.md`).",
|
|
1015
|
+
why: "An ADR's id is the number in its file name: `shop/adr/0003-use-kafka.md` is `shop:0003`. A file without the four-digit number has no id, so no `supersedes` can name it.",
|
|
862
1016
|
fix: "Rename it to the next free four-digit number and a lowercase slug, such as `0002-use-kafka.md`.",
|
|
1017
|
+
related: ["duplicate-adr-number"],
|
|
863
1018
|
example: {
|
|
864
1019
|
failing: deciding({ "use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
865
1020
|
passing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
@@ -881,8 +1036,12 @@ export const rules = [
|
|
|
881
1036
|
{
|
|
882
1037
|
id: "duplicate-adr-number",
|
|
883
1038
|
severity: "error",
|
|
1039
|
+
area: "decisions",
|
|
1040
|
+
since: "1.0.0",
|
|
884
1041
|
summary: "Two ADRs in a Project share a number, as when two pull requests each take the next free one.",
|
|
1042
|
+
why: "An ADR's number is its id in the Project, so two files numbered `0001` would both be `shop:0001`, and a `supersedes` naming it could mean either. It happens when two pull requests each take the next free number.",
|
|
885
1043
|
fix: "Renumber the later ADR to the next free number, and update any `supersedes` that meant it.",
|
|
1044
|
+
related: ["bad-adr-filename"],
|
|
886
1045
|
example: {
|
|
887
1046
|
failing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01"), "0001-use-redis.md": adrText("status: proposed\ndate: 2026-03-02", "Use Redis for carts") }),
|
|
888
1047
|
passing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01"), "0002-use-redis.md": adrText("status: proposed\ndate: 2026-03-02", "Use Redis for carts") }),
|
|
@@ -898,8 +1057,12 @@ export const rules = [
|
|
|
898
1057
|
{
|
|
899
1058
|
id: "unknown-adr-link",
|
|
900
1059
|
severity: "error",
|
|
1060
|
+
area: "decisions",
|
|
1061
|
+
since: "1.0.0",
|
|
901
1062
|
summary: "An ADR's `elements` names no Element or Deployment Target, its `views` no Saved View, or its `supersedes` no ADR.",
|
|
1063
|
+
why: "An ADR's links are how a reader gets from an Element to the decisions behind it. A link that names nothing attaches the decision to nothing, and a `supersedes` that names no ADR leaves the old decision looking current.",
|
|
902
1064
|
fix: "Use an id declared in the ADR's Project, or `project:id` (`project:NNNN` for an ADR) for one in another Project.",
|
|
1065
|
+
related: ["unknown-element"],
|
|
903
1066
|
example: {
|
|
904
1067
|
failing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nelements: [wbe]") }),
|
|
905
1068
|
passing: deciding({ "0001-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nelements: [web]") }),
|
|
@@ -928,8 +1091,12 @@ export const rules = [
|
|
|
928
1091
|
{
|
|
929
1092
|
id: "hand-written-superseded",
|
|
930
1093
|
severity: "error",
|
|
1094
|
+
area: "decisions",
|
|
1095
|
+
since: "1.0.0",
|
|
931
1096
|
summary: "An ADR's `status` is written as `superseded`; that status is derived once an accepted ADR lists it in `supersedes`.",
|
|
1097
|
+
why: "An ADR is superseded once an accepted ADR lists it in `supersedes`; Archidocs derives it. Written by hand, the status could disagree with those lists, so deriving it keeps the record of what replaced what in one place.",
|
|
932
1098
|
fix: "Give the old ADR back the status it had (usually accepted), and declare `supersedes` on the new ADR instead.",
|
|
1099
|
+
related: ["supersedes-unaccepted", "superseded-twice"],
|
|
933
1100
|
example: {
|
|
934
1101
|
failing: deciding({ "0001-use-rabbitmq.md": adrText("status: superseded\ndate: 2025-01-10", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
935
1102
|
passing: deciding({ "0001-use-rabbitmq.md": adrText("status: accepted\ndate: 2025-01-10", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nsupersedes: [\"0001\"]") }),
|
|
@@ -939,8 +1106,12 @@ export const rules = [
|
|
|
939
1106
|
{
|
|
940
1107
|
id: "supersedes-cycle",
|
|
941
1108
|
severity: "error",
|
|
1109
|
+
area: "decisions",
|
|
1110
|
+
since: "1.0.0",
|
|
942
1111
|
summary: "ADRs supersede each other in a cycle, directly or through others. Reported once, at the cycle's last file.",
|
|
1112
|
+
why: "`supersedes` runs from a newer decision to the older one it replaces. In a cycle every ADR is replaced by another, so none of them is the decision that stands.",
|
|
943
1113
|
fix: "Remove the `supersedes` entry that points back to a newer ADR.",
|
|
1114
|
+
related: ["superseded-twice", "supersedes-unaccepted"],
|
|
944
1115
|
example: {
|
|
945
1116
|
failing: deciding({ "0001-use-rabbitmq.md": adrText("status: accepted\ndate: 2025-01-10\nsupersedes: [\"0002\"]", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nsupersedes: [\"0001\"]") }),
|
|
946
1117
|
passing: deciding({ "0001-use-rabbitmq.md": adrText("status: accepted\ndate: 2025-01-10", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nsupersedes: [\"0001\"]") }),
|
|
@@ -978,8 +1149,12 @@ export const rules = [
|
|
|
978
1149
|
{
|
|
979
1150
|
id: "superseded-twice",
|
|
980
1151
|
severity: "warning",
|
|
1152
|
+
area: "decisions",
|
|
1153
|
+
since: "1.0.0",
|
|
981
1154
|
summary: "An ADR is superseded by more than one accepted ADR. Reported at the last of them.",
|
|
1155
|
+
why: "A superseded ADR should lead a reader to the one decision that replaced it. When two accepted ADRs both supersede it, the reader can't tell which of them stands now.",
|
|
982
1156
|
fix: "Keep `supersedes` on the one ADR that replaces it; have the later one supersede that ADR instead, if it replaces it in turn.",
|
|
1157
|
+
related: ["supersedes-cycle", "supersedes-unaccepted"],
|
|
983
1158
|
example: {
|
|
984
1159
|
failing: deciding({
|
|
985
1160
|
"0001-use-rabbitmq.md": adrText("status: accepted\ndate: 2025-01-10", "Use RabbitMQ"),
|
|
@@ -1005,8 +1180,12 @@ export const rules = [
|
|
|
1005
1180
|
{
|
|
1006
1181
|
id: "supersedes-unaccepted",
|
|
1007
1182
|
severity: "warning",
|
|
1183
|
+
area: "decisions",
|
|
1184
|
+
since: "1.0.0",
|
|
1008
1185
|
summary: "An ADR supersedes one that isn't accepted or deprecated, such as a proposed or rejected ADR.",
|
|
1186
|
+
why: "To supersede a decision is to replace one that was in force. A proposed or rejected ADR never was, yet listing it in `supersedes` shows it as superseded, as if it had once been the architecture.",
|
|
1009
1187
|
fix: "Remove the entry from `supersedes`, or point it at the accepted ADR this one replaces.",
|
|
1188
|
+
related: ["hand-written-superseded", "superseded-twice"],
|
|
1010
1189
|
example: {
|
|
1011
1190
|
failing: deciding({ "0001-use-rabbitmq.md": adrText("status: rejected\ndate: 2025-01-10", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01\nsupersedes: [\"0001\"]") }),
|
|
1012
1191
|
passing: deciding({ "0001-use-rabbitmq.md": adrText("status: rejected\ndate: 2025-01-10", "Use RabbitMQ"), "0002-use-kafka.md": adrText("status: accepted\ndate: 2026-03-01") }),
|
|
@@ -1023,3 +1202,11 @@ export const rules = [
|
|
|
1023
1202
|
function numbered(count, prefix, indent, from = 0) {
|
|
1024
1203
|
return Array.from({ length: count }, (_, i) => `${" ".repeat(indent)}${prefix}${from + i + 1}: { name: ${prefix.toUpperCase()}${from + i + 1} }\n`).join("");
|
|
1025
1204
|
}
|
|
1205
|
+
/** Base URL of the per-rule pages on the docs site; a rule's page is `<base><rule-id>/`. */
|
|
1206
|
+
export const RULE_DOCS_BASE_URL = "https://archidocs.dev/docs/reference/rules/";
|
|
1207
|
+
/** The docs page for a check rule. The site keeps a page for every rule id, removed ones included. */
|
|
1208
|
+
export const ruleDocsUrl = (ruleId) => `${RULE_DOCS_BASE_URL}${ruleId}/`;
|
|
1209
|
+
/** An issue with a link to its rule's docs page, as `check --format json` and MCP report it. */
|
|
1210
|
+
export const withDocs = (issue) => ({ ...issue, docs: ruleDocsUrl(issue.rule) });
|
|
1211
|
+
/** Rules removed from the registry, oldest first. An id here never returns to `rules`. */
|
|
1212
|
+
export const removed = [];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Bundle } from "../../schema/bundle.ts";
|
|
2
|
+
import type { ResolveOptions, ResolvedView } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A View for Compare: laid out over the union of both sides, with every node
|
|
5
|
+
* and edge marked. A node or edge only the later side's View shows is
|
|
6
|
+
* added, one only the earlier side's shows is removed. One both show is
|
|
7
|
+
* changed when its Element changed, or for a collapsed box when anything
|
|
8
|
+
* inside it was added, removed or changed; an edge when its Relationships
|
|
9
|
+
* did. A View that exists at one side only is drawn from that side.
|
|
10
|
+
* Undefined when neither side has the View. The options are `resolveView`'s.
|
|
11
|
+
*/
|
|
12
|
+
export declare function compareView(before: Bundle, after: Bundle, id: string, options?: ResolveOptions): ResolvedView | undefined;
|