@radicaltools/cli 0.3.0 → 0.3.1

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 (57) hide show
  1. package/README.md +121 -16
  2. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  3. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  5. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  6. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  7. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  8. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  9. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  10. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  11. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  12. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  13. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  14. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  15. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  16. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  17. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  18. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  19. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  20. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  21. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  22. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  23. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  24. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  25. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  26. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  27. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  28. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  29. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  30. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  31. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  32. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  33. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  34. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  35. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  36. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  37. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  38. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  39. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  40. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  41. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  42. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  43. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  44. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  45. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  46. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  47. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  48. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  49. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  50. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  51. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  52. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  53. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  54. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  55. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  56. package/dist/index.js +3680 -2074
  57. package/package.json +1 -1
@@ -0,0 +1,1397 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-code-documentation",
4
+ "category": "concern",
5
+ "name": "Code documentation",
6
+ "description": "What about the element is written down, where it lives and how it stays true: the decisions, the API reference, the README of each module, the documentation site, and the diagrams or the architecture model.",
7
+ "tags": [
8
+ "maintainability",
9
+ "documentation",
10
+ "adr",
11
+ "docs as code",
12
+ "api docs",
13
+ "diagrams",
14
+ "readme"
15
+ ],
16
+ "requiredMetamodel": "c4-ddd-governance-builtin",
17
+ "concern": {
18
+ "id": "code-documentation",
19
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
20
+ "why": "code lives in these elements, so what is written down about it, where, and how it is kept true has to be decided; one decision usually covers a whole repository and is bound to every element built from it.",
21
+ "group": "coding"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "Michael Nygard: Documenting Architecture Decisions",
26
+ "url": "https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions"
27
+ },
28
+ {
29
+ "title": "MADR: Markdown Any Decision Records",
30
+ "url": "https://adr.github.io/madr/"
31
+ },
32
+ {
33
+ "title": "Simon Brown: The C4 model for visualising software architecture",
34
+ "url": "https://c4model.com/"
35
+ },
36
+ {
37
+ "title": "Write the Docs: Docs as Code",
38
+ "url": "https://www.writethedocs.org/guide/docs-as-code/"
39
+ },
40
+ {
41
+ "title": "Diátaxis: a systematic approach to technical documentation",
42
+ "url": "https://diataxis.fr/"
43
+ },
44
+ {
45
+ "title": "Google developer documentation style guide",
46
+ "url": "https://developers.google.com/style"
47
+ },
48
+ {
49
+ "title": "OpenAPI Specification",
50
+ "url": "https://spec.openapis.org/oas/latest.html"
51
+ },
52
+ {
53
+ "title": "ISO/IEC 25010, Maintainability: analysability",
54
+ "url": "https://iso25000.com/index.php/en/iso-25000-standards/iso-25010"
55
+ },
56
+ {
57
+ "title": "lychee link checker",
58
+ "url": "https://lychee.cli.rs/"
59
+ },
60
+ {
61
+ "title": "MkDocs: strict builds and configuration",
62
+ "url": "https://www.mkdocs.org/user-guide/configuration/"
63
+ },
64
+ {
65
+ "title": "Python documentation: doctest",
66
+ "url": "https://docs.python.org/3/library/doctest.html"
67
+ }
68
+ ],
69
+ "templateParams": [
70
+ {
71
+ "key": "DECISIONS",
72
+ "title": "Decisions",
73
+ "label": "Where are architecture decisions recorded?",
74
+ "hint": "A decision that is not written down is re-argued at every change. Where the record lives decides who reads it, who reviews it, and whether anything checks that it is still true.",
75
+ "defaultValue": "adr-repo",
76
+ "options": [
77
+ {
78
+ "value": "adr-repo",
79
+ "label": "decision records as files in the repository",
80
+ "description": "One Markdown file per decision in the repository, in the MADR format (YAML front matter with status, date and decision-makers; sections for context, options, outcome and consequences), reviewed in the pull request with the code that implements it. Pick it when the people who need the decisions are the people who open the repository, and you want the record versioned and reviewed like code."
81
+ },
82
+ {
83
+ "value": "model",
84
+ "label": "decisions in an architecture model next to the code",
85
+ "description": "Decisions live in an architecture model kept in the repository (a radical.tools Markdown folder, or Structurizr DSL with its ADR tooling), each linked to the elements it constrains and to the requirements and checks behind it, and a CI job checks the model. Pick it when you already keep a C4 model or want decisions, diagrams and requirements to be one connected thing rather than three folders."
86
+ },
87
+ {
88
+ "value": "wiki",
89
+ "label": "a decision log in a wiki or document space",
90
+ "description": "Decisions are pages in Confluence, Notion or a similar space, from one template, with an index page per system and a link from the repository. Pick it when most readers (product, operations, architecture board, auditors) never open a repository and need to find and comment on decisions where they already work."
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "key": "API_DOCS",
96
+ "title": "API reference",
97
+ "label": "How is the API documented?",
98
+ "hint": "Generated reference is always current but says what, never why; a written guide explains, but goes stale unless its examples are run. An HTTP contract and a library's reference are generated from different sources, so they are different answers here.",
99
+ "defaultValue": "generated",
100
+ "options": [
101
+ {
102
+ "value": "generated",
103
+ "label": "generated from the OpenAPI contract on every build",
104
+ "description": "An HTTP API documented by its OpenAPI contract: the contract file (or the one generated from annotations) is the source of truth, rendered as a site (Redoc, Swagger UI) on every release, with a check that the contract and the running code agree. Pick it for any HTTP API other teams or customers call."
105
+ },
106
+ {
107
+ "value": "reference",
108
+ "label": "generated from the code's doc comments on every build",
109
+ "description": "A library or SDK documented by its doc comments: TSDoc, Javadoc or docstrings rendered by TypeDoc, Javadoc or Sphinx into a reference site published with each release, with warnings as errors. Pick it for a published package with no HTTP contract."
110
+ },
111
+ {
112
+ "value": "written",
113
+ "label": "a hand-written guide in the repository, with examples run by tests",
114
+ "description": "A guide written for readers (how to authenticate, the three calls that matter, the error model), kept next to the code, whose code examples are executed in CI (doctests, executed Markdown snippets). Pick it for a library or SDK where a tutorial beats a reference, and someone owns the text."
115
+ },
116
+ {
117
+ "value": "none",
118
+ "label": "no public API; internal types documented in code only",
119
+ "description": "Nothing outside the team calls the element; its exported types and functions carry doc comments and nothing is published. Pick it for a web app or a batch job with no callers, so that no one builds a reference nobody reads."
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ "key": "READMES",
125
+ "title": "READMEs",
126
+ "label": "Where does a newcomer read how to run and test a module?",
127
+ "hint": "The README is read more than any other page; what it must say decides whether a new person runs the module on day one or asks.",
128
+ "defaultValue": "per-module",
129
+ "options": [
130
+ {
131
+ "value": "per-module",
132
+ "label": "a README in every package, module or service",
133
+ "description": "Every package, module or service directory holds a README with the same sections (purpose, how to run, how to test, who owns it), and a check fails when one is missing or a section is absent. Pick it for a monorepo or any repository with more than one deployable or publishable unit."
134
+ },
135
+ {
136
+ "value": "root-only",
137
+ "label": "one README at the repository root",
138
+ "description": "One README at the root explains how to run and test the whole repository and holds a table of its modules with a line of purpose and an owner each. Pick it for a single-purpose repository where per-module READMEs would repeat the same text."
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "key": "DOCS_SITE",
144
+ "title": "Documentation",
145
+ "label": "Where is the longer documentation kept and published?",
146
+ "hint": "Documentation that lives in the repository is reviewed and built with the code and can fail the build on a broken link; documentation outside it reaches more readers, and only a scheduled job over the space's API checks it.",
147
+ "defaultValue": "docs-as-code",
148
+ "options": [
149
+ {
150
+ "value": "docs-as-code",
151
+ "label": "docs as code in the repository, built and published in CI",
152
+ "description": "Markdown or AsciiDoc in the repository, organised by Diátaxis (tutorials, how-to guides, reference, explanation), built by Docusaurus, MkDocs or Antora on every pull request and published on merge; a broken link or a warning fails the build. Pick it when the writers are the developers and the readers are developers or operators."
153
+ },
154
+ {
155
+ "value": "external",
156
+ "label": "kept and published outside the repository",
157
+ "description": "Documentation lives in Confluence, Notion, GitBook or a help-centre product, written by people who do not work in the repository, with a link from the README and the release it describes on each page. Pick it when technical writers or support own the documentation, or the readers are end users."
158
+ }
159
+ ]
160
+ },
161
+ {
162
+ "key": "DIAGRAMS",
163
+ "title": "Diagrams",
164
+ "label": "How are the architecture diagrams kept?",
165
+ "hint": "A diagram drawn once is out of date after the next merge; a diagram rendered from a model or from text in the repository changes in the pull request that changes the system.",
166
+ "defaultValue": "model",
167
+ "options": [
168
+ {
169
+ "value": "model",
170
+ "label": "rendered from a model or diagram-as-code in the repository",
171
+ "description": "Diagrams are rendered from a model or text kept in the repository (radical.tools, Structurizr DSL, PlantUML with C4-PlantUML, Mermaid) and reviewed in the pull request with the change they show. Pick it by default: the diagram is a diff, and a check can tell when code changed and the diagram did not."
172
+ },
173
+ {
174
+ "value": "images",
175
+ "label": "hand-drawn images, dated, in the docs folder",
176
+ "description": "Diagrams are drawn in draw.io or Excalidraw and kept as images in docs/diagrams, each with its editable source file next to it and a caption with its date and author on the page that shows it. Pick it for a small system with one or two diagrams, or sketches whose value is the conversation, not the record."
177
+ }
178
+ ]
179
+ },
180
+ {
181
+ "key": "ADR_DAYS",
182
+ "label": "How many days may a decision record stay in status proposed?",
183
+ "defaultValue": "14",
184
+ "type": "number"
185
+ },
186
+ {
187
+ "key": "ADR_DIR",
188
+ "label": "Which directory holds the decision records?",
189
+ "defaultValue": "docs/adr"
190
+ },
191
+ {
192
+ "key": "MODEL_DIR",
193
+ "label": "Which folder holds the architecture model?",
194
+ "defaultValue": "architecture"
195
+ },
196
+ {
197
+ "key": "README_SECTIONS",
198
+ "label": "Which sections must every README have (comma-separated headings)?",
199
+ "defaultValue": "Purpose, Run, Test, Owner"
200
+ },
201
+ {
202
+ "key": "DOC_COMMENT_COVERAGE_PCT",
203
+ "label": "What share of the exported symbols must carry doc comments (%)?",
204
+ "defaultValue": "90",
205
+ "type": "number"
206
+ },
207
+ {
208
+ "key": "LINK_CHECK_MINUTES",
209
+ "label": "Within how many minutes must the documentation build, link check included, finish?",
210
+ "defaultValue": "5",
211
+ "type": "number"
212
+ },
213
+ {
214
+ "key": "MAX_DOC_AGE_DAYS",
215
+ "label": "After how many days without review is a documentation page or diagram stale?",
216
+ "defaultValue": "365",
217
+ "type": "number"
218
+ }
219
+ ]
220
+ },
221
+ "nodes": [
222
+ {
223
+ "id": "need",
224
+ "type": "need",
225
+ "label": "The element can be understood without asking",
226
+ "x": 0,
227
+ "y": 0,
228
+ "kind": "brief",
229
+ "source": "Hub concern pack: Code documentation",
230
+ "description": "People who did not write the element have to change it, run it and reason about it: a new team member, an on-call engineer at night, a reviewer in another team, the author a year later. They need to find why it is built the way it is, what it offers to its callers, how to run and test each part, and how its parts fit together, and what they find has to be true today, not when it was written. ISO 25010 calls this analysability; in practice it is the difference between a change that takes an afternoon and one that takes a week of archaeology."
231
+ },
232
+ {
233
+ "id": "req-adr-recorded",
234
+ "type": "requirement",
235
+ "label": "Significant decisions are recorded",
236
+ "x": 260,
237
+ "y": 0,
238
+ "ears_type": "event-driven",
239
+ "trigger": "an architecturally significant decision is made (a new or removed dependency, external service or data store, a protocol or format other systems rely on, a security or data-handling choice, or going against an earlier decision)",
240
+ "action": "record it as one decision record with a title, status, date, context, decision and consequences, in: {{DECISIONS}}, and move the record out of status proposed (to accepted or rejected) within {{ADR_DAYS}} days",
241
+ "rationale": "A decision that is not written down is re-argued at every change or reversed without anyone noticing; the fields are the minimum that lets a later reader judge whether the context still holds, and a record left proposed is a decision nobody made (Nygard, Documenting Architecture Decisions; MADR)."
242
+ },
243
+ {
244
+ "id": "req-adr-supersede",
245
+ "type": "requirement",
246
+ "label": "Superseded decisions link forward",
247
+ "x": 260,
248
+ "y": 130,
249
+ "ears_type": "event-driven",
250
+ "trigger": "a new decision replaces or amends an earlier one",
251
+ "action": "mark the earlier record as superseded with a link to the new record, and leave the earlier record in place rather than deleting or rewriting it",
252
+ "rationale": "The old record explains code that is still there; a reader who finds it must be sent to the current decision (Nygard: records are immutable, status superseded)."
253
+ },
254
+ {
255
+ "id": "req-adr-with-code",
256
+ "type": "requirement",
257
+ "label": "Decision reviewed with its code",
258
+ "x": 260,
259
+ "y": 260,
260
+ "ears_type": "ubiquitous",
261
+ "action": "keep the decision record in the repository and change it in the same pull request as the first code that implements the decision, so that the reviewer of the code reviews the decision",
262
+ "rationale": "A decision reviewed with its code gets the same scrutiny as the code and is versioned with it; one reviewed elsewhere is approved by people who do not see what it costs (Nygard; Write the Docs, Docs as Code).",
263
+ "unchecked": "the reviewer of each pull request checks that a new or changed decision record arrives with the code that implements it; no tool can tell which change implements which decision",
264
+ "hubWhen": {
265
+ "DECISIONS": [
266
+ "adr-repo",
267
+ "model"
268
+ ]
269
+ }
270
+ },
271
+ {
272
+ "id": "req-adr-linked",
273
+ "type": "requirement",
274
+ "label": "Decisions linked to what they constrain",
275
+ "x": 260,
276
+ "y": 390,
277
+ "ears_type": "ubiquitous",
278
+ "action": "link every decision in the model to at least one element it constrains and, where one exists, to the automated check that enforces it, and fail the CI check on an accepted decision without date, context, decision or consequences, or on a decision that settles a concern for no element",
279
+ "rationale": "In a model a decision is only useful if a reader of an element can reach it from that element; an unlinked decision is a file in a different folder with extra steps (C4 model; the rules adr-incomplete and concern-unbound of radical check).",
280
+ "hubWhen": {
281
+ "DECISIONS": [
282
+ "model"
283
+ ]
284
+ }
285
+ },
286
+ {
287
+ "id": "req-adr-wiki-index",
288
+ "type": "requirement",
289
+ "label": "Decision log is findable from the code",
290
+ "x": 260,
291
+ "y": 520,
292
+ "ears_type": "ubiquitous",
293
+ "action": "keep one decision log index page per system linking every decision page, make every decision page from the same template with status and date properties, and link the index from the repository README",
294
+ "rationale": "Pages outside the repository are found only through links; without an index and a link from the code, the log is what the person who wrote it remembers (Nygard; Google developer documentation style guide on navigation).",
295
+ "hubWhen": {
296
+ "DECISIONS": [
297
+ "wiki"
298
+ ]
299
+ }
300
+ },
301
+ {
302
+ "id": "req-api-regenerated",
303
+ "type": "requirement",
304
+ "label": "Contract and code agree on every build",
305
+ "x": 260,
306
+ "y": 650,
307
+ "ears_type": "event-driven",
308
+ "trigger": "a pull request is built",
309
+ "action": "generate the OpenAPI specification from the running code, compare it with the contract file in the repository, and fail the build when they differ in any path, operation, parameter, schema or response",
310
+ "rationale": "A contract file that drifts from the code documents an API that does not exist, and the reference rendered from it is wrong on the day it is published (OpenAPI Specification; what may change between versions is the API evolution concern's decision).",
311
+ "hubWhen": {
312
+ "API_DOCS": [
313
+ "generated"
314
+ ]
315
+ }
316
+ },
317
+ {
318
+ "id": "req-reference-built",
319
+ "type": "requirement",
320
+ "label": "Reference builds clean and is published",
321
+ "x": 260,
322
+ "y": 780,
323
+ "ears_type": "event-driven",
324
+ "trigger": "a pull request is built, or a release is made",
325
+ "action": "build the API reference from the doc comments with warnings treated as errors (an unresolved link or an undocumented export is a warning) and, on a release, publish it under the release version",
326
+ "rationale": "A generated reference is only as current as its last build, and a warning ignored today is a blank page or a dead link in the published site (Google developer documentation style guide on API reference; Write the Docs, Docs as Code).",
327
+ "hubWhen": {
328
+ "API_DOCS": [
329
+ "reference"
330
+ ]
331
+ }
332
+ },
333
+ {
334
+ "id": "req-doc-comments",
335
+ "type": "requirement",
336
+ "label": "Exported symbols carry doc comments",
337
+ "x": 260,
338
+ "y": 910,
339
+ "ears_type": "ubiquitous",
340
+ "action": "carry a doc comment with a one-line summary on at least {{DOC_COMMENT_COVERAGE_PCT}}% of the exported or public symbols of the element, measured on every pull request, with the undocumented ones listed",
341
+ "rationale": "Whether or not a reference is published, a symbol without a comment is a blank page for the next reader; a threshold on the whole keeps the gate from blocking every typo while the number is brought up (Google developer documentation style guide on API reference comments; ISO 25010 analysability)."
342
+ },
343
+ {
344
+ "id": "req-examples-run",
345
+ "type": "requirement",
346
+ "label": "Examples in the docs are executed",
347
+ "x": 260,
348
+ "y": 1040,
349
+ "ears_type": "ubiquitous",
350
+ "action": "execute every code example in the API guide as a test on each pull request, and fail the build when an example throws or does not compile, or, where the tool compares output (Python doctest), prints something other than what the guide shows",
351
+ "rationale": "A written guide stays true only if its examples are run; an example that nobody runs is the first thing to break and the last to be noticed (Write the Docs, Docs as Code; Python doctest).",
352
+ "hubWhen": {
353
+ "API_DOCS": [
354
+ "written"
355
+ ]
356
+ }
357
+ },
358
+ {
359
+ "id": "req-readme-per-module",
360
+ "type": "requirement",
361
+ "label": "Every module has its README",
362
+ "x": 260,
363
+ "y": 1170,
364
+ "ears_type": "ubiquitous",
365
+ "action": "hold a README.md in every package, module or service directory with the sections {{README_SECTIONS}}, and fail the build when a directory lacks the file or a section",
366
+ "rationale": "The README is the page read first and most; the same sections everywhere let a newcomer run and test any module without asking who owns it (Google developer documentation style guide; Write the Docs on READMEs).",
367
+ "hubWhen": {
368
+ "READMES": [
369
+ "per-module"
370
+ ]
371
+ }
372
+ },
373
+ {
374
+ "id": "req-readme-root",
375
+ "type": "requirement",
376
+ "label": "Root README lists every module",
377
+ "x": 260,
378
+ "y": 1300,
379
+ "ears_type": "ubiquitous",
380
+ "action": "hold in the root README a table with one row per module directory naming its purpose and its owner, and fail the build when a module directory has no row or a row names a directory that no longer exists",
381
+ "rationale": "With one README, the table is the only place a newcomer learns what a directory is for and who to ask; a module missing from it is invisible (Google developer documentation style guide).",
382
+ "hubWhen": {
383
+ "READMES": [
384
+ "root-only"
385
+ ]
386
+ }
387
+ },
388
+ {
389
+ "id": "req-links",
390
+ "type": "requirement",
391
+ "label": "Broken links fail the docs build",
392
+ "x": 260,
393
+ "y": 1430,
394
+ "ears_type": "unwanted-behaviour",
395
+ "unwanted_condition": "a page of the documentation holds a link to a page, anchor or URL that does not resolve, or the site generator reports a warning",
396
+ "action": "fail the documentation build on the pull request, naming the page and the link, within {{LINK_CHECK_MINUTES}} minutes",
397
+ "rationale": "A broken link is the reader's first sign that nobody maintains the page; a build that fails on one keeps the whole site trustworthy at the cost of one fix per pull request (Write the Docs, Docs as Code; lychee).",
398
+ "hubWhen": {
399
+ "DOCS_SITE": [
400
+ "docs-as-code"
401
+ ]
402
+ }
403
+ },
404
+ {
405
+ "id": "req-external-versioned",
406
+ "type": "requirement",
407
+ "label": "External docs name their release and owner",
408
+ "x": 260,
409
+ "y": 1560,
410
+ "ears_type": "ubiquitous",
411
+ "action": "link the documentation space from the repository README, and carry on every page of the space the properties release (the release it describes), owner and reviewed (the date of the last review)",
412
+ "rationale": "Documentation outside the repository is not built with the code, so the only guard against describing a version that no longer runs is naming the release on the page, and the only guard against abandonment is an owner (Google developer documentation style guide on versioned documentation).",
413
+ "hubWhen": {
414
+ "DOCS_SITE": [
415
+ "external"
416
+ ]
417
+ }
418
+ },
419
+ {
420
+ "id": "req-doc-owner",
421
+ "type": "requirement",
422
+ "label": "Pages have an owner and a review date",
423
+ "x": 260,
424
+ "y": 1690,
425
+ "ears_type": "state-driven",
426
+ "precondition": "a page of the documentation (in the docs folder, or in the external space) has no owner, no review date, or a review date older than {{MAX_DOC_AGE_DAYS}} days",
427
+ "action": "fail the stale-page check naming the page and its owner, so that the page is re-dated after a review or removed",
428
+ "rationale": "A page nobody owns is a page nobody updates; a review date makes \"is this still true?\" a question with an answer instead of a guess (Google developer documentation style guide; Write the Docs on documentation maintenance)."
429
+ },
430
+ {
431
+ "id": "req-diagram-same-pr",
432
+ "type": "requirement",
433
+ "label": "Diagrams change with the code",
434
+ "x": 260,
435
+ "y": 1820,
436
+ "ears_type": "event-driven",
437
+ "trigger": "a pull request changes the structure of a diagrammed module (a new or removed container, component, dependency between modules, data store or external call)",
438
+ "action": "change the model or diagram source in the same pull request, and fail the check when the source under a diagrammed module changes structure and the model folder {{MODEL_DIR}} does not change",
439
+ "rationale": "A diagram kept as text or a model is a diff; the pull request that changes the system is the one moment the author knows what changed (Simon Brown, C4 model and diagrams as code).",
440
+ "hubWhen": {
441
+ "DIAGRAMS": [
442
+ "model"
443
+ ]
444
+ }
445
+ },
446
+ {
447
+ "id": "req-diagram-dated",
448
+ "type": "requirement",
449
+ "label": "Image diagrams are dated with their source",
450
+ "x": 260,
451
+ "y": 1950,
452
+ "ears_type": "ubiquitous",
453
+ "action": "keep every diagram image in docs/diagrams with its editable source file (.drawio or .excalidraw) next to it and a caption with its date and author on the page that shows it, and fail the check on a diagram whose caption date is older than {{MAX_DOC_AGE_DAYS}} days",
454
+ "rationale": "An image cannot be diffed, so the date tells a reader how far to trust it and the source file lets the next person change it instead of redrawing (Simon Brown, C4 model: notation and dating of diagrams).",
455
+ "hubWhen": {
456
+ "DIAGRAMS": [
457
+ "images"
458
+ ]
459
+ }
460
+ },
461
+ {
462
+ "id": "sc-adr-recorded",
463
+ "type": "scenario",
464
+ "label": "Decision gets a complete record",
465
+ "x": 520,
466
+ "y": 0,
467
+ "given": "a decision record created for a new external service",
468
+ "when": "the decision check runs on the pull request",
469
+ "then": "the record has title, status, date, context, decision and consequences, and the check fails on a record left in proposed for more than {{ADR_DAYS}} days"
470
+ },
471
+ {
472
+ "id": "sc-adr-supersede",
473
+ "type": "scenario",
474
+ "label": "Old decision points to the new",
475
+ "x": 520,
476
+ "y": 130,
477
+ "given": "an accepted decision record",
478
+ "when": "a new decision replaces it and the decision check runs",
479
+ "then": "the old record reads superseded and links to a record that exists; a superseded record with no link, or a link to a missing record, fails the check"
480
+ },
481
+ {
482
+ "id": "sc-adr-with-code",
483
+ "type": "scenario",
484
+ "label": "Decision and code in one pull request",
485
+ "x": 520,
486
+ "y": 260,
487
+ "given": "a change that implements a new decision",
488
+ "when": "its pull request is reviewed",
489
+ "then": "the diff holds both the decision record and the code, and the reviewer refuses a record merged ahead of the code",
490
+ "hubWhen": {
491
+ "DECISIONS": [
492
+ "adr-repo",
493
+ "model"
494
+ ]
495
+ }
496
+ },
497
+ {
498
+ "id": "sc-adr-linked",
499
+ "type": "scenario",
500
+ "label": "Unbound decision fails the check",
501
+ "x": 520,
502
+ "y": 390,
503
+ "given": "the architecture model with a decision marked with a concern that constrains no element",
504
+ "when": "the CI check runs with those rules raised to errors in check.json",
505
+ "then": "it fails naming the decision, and passes once the decision constrains an element",
506
+ "hubWhen": {
507
+ "DECISIONS": [
508
+ "model"
509
+ ]
510
+ }
511
+ },
512
+ {
513
+ "id": "sc-adr-wiki-index",
514
+ "type": "scenario",
515
+ "label": "Decision reached from the code",
516
+ "x": 520,
517
+ "y": 520,
518
+ "given": "a decision page in the space",
519
+ "when": "the weekly decision-log job runs",
520
+ "then": "the page has status and date properties, the index page links it, and the README links the index; a page missing from the index fails the job",
521
+ "hubWhen": {
522
+ "DECISIONS": [
523
+ "wiki"
524
+ ]
525
+ }
526
+ },
527
+ {
528
+ "id": "sc-api-regenerated",
529
+ "type": "scenario",
530
+ "label": "Drift fails the build",
531
+ "x": 520,
532
+ "y": 650,
533
+ "given": "a contract file and code that adds a response field without updating it",
534
+ "when": "the pull request is built",
535
+ "then": "the drift check fails naming the field, and passes once contract and code agree",
536
+ "hubWhen": {
537
+ "API_DOCS": [
538
+ "generated"
539
+ ]
540
+ }
541
+ },
542
+ {
543
+ "id": "sc-reference-built",
544
+ "type": "scenario",
545
+ "label": "Broken link fails the reference build",
546
+ "x": 520,
547
+ "y": 780,
548
+ "given": "a doc comment with a {@link} to a renamed symbol",
549
+ "when": "the pull request is built",
550
+ "then": "the reference build fails naming the comment, and the release job publishes only a build with 0 warnings",
551
+ "hubWhen": {
552
+ "API_DOCS": [
553
+ "reference"
554
+ ]
555
+ }
556
+ },
557
+ {
558
+ "id": "sc-doc-comments",
559
+ "type": "scenario",
560
+ "label": "Coverage below the threshold refused",
561
+ "x": 520,
562
+ "y": 910,
563
+ "given": "a pull request exporting a new function without a doc comment that takes coverage below {{DOC_COMMENT_COVERAGE_PCT}}%",
564
+ "when": "the doc-comment test runs",
565
+ "then": "it fails with the coverage and names the function"
566
+ },
567
+ {
568
+ "id": "sc-examples-run",
569
+ "type": "scenario",
570
+ "label": "Broken example fails the build",
571
+ "x": 520,
572
+ "y": 1040,
573
+ "given": "a guide whose example calls a function that was renamed",
574
+ "when": "the pull request runs its tests",
575
+ "then": "the example test fails naming the guide and the example",
576
+ "hubWhen": {
577
+ "API_DOCS": [
578
+ "written"
579
+ ]
580
+ }
581
+ },
582
+ {
583
+ "id": "sc-readme-per-module",
584
+ "type": "scenario",
585
+ "label": "Module without README fails",
586
+ "x": 520,
587
+ "y": 1170,
588
+ "given": "a new package directory added without a README.md",
589
+ "when": "the build runs",
590
+ "then": "the README check fails naming the directory, and passes once the file holds {{README_SECTIONS}}",
591
+ "hubWhen": {
592
+ "READMES": [
593
+ "per-module"
594
+ ]
595
+ }
596
+ },
597
+ {
598
+ "id": "sc-readme-root",
599
+ "type": "scenario",
600
+ "label": "Unlisted module fails",
601
+ "x": 520,
602
+ "y": 1300,
603
+ "given": "a new module directory not in the root README table",
604
+ "when": "the build runs",
605
+ "then": "the README check fails naming the directory",
606
+ "hubWhen": {
607
+ "READMES": [
608
+ "root-only"
609
+ ]
610
+ }
611
+ },
612
+ {
613
+ "id": "sc-links",
614
+ "type": "scenario",
615
+ "label": "Broken link stops the merge",
616
+ "x": 520,
617
+ "y": 1430,
618
+ "given": "a pull request that renames a page other pages link to",
619
+ "when": "the documentation build runs",
620
+ "then": "it fails within {{LINK_CHECK_MINUTES}} minutes naming each page with a broken link",
621
+ "hubWhen": {
622
+ "DOCS_SITE": [
623
+ "docs-as-code"
624
+ ]
625
+ }
626
+ },
627
+ {
628
+ "id": "sc-external-versioned",
629
+ "type": "scenario",
630
+ "label": "Page names its release",
631
+ "x": 520,
632
+ "y": 1560,
633
+ "given": "the pages of the documentation space",
634
+ "when": "the weekly page job reads their properties",
635
+ "then": "every page has release, owner and reviewed, and the README links the space; a page without one of them fails the job",
636
+ "hubWhen": {
637
+ "DOCS_SITE": [
638
+ "external"
639
+ ]
640
+ }
641
+ },
642
+ {
643
+ "id": "sc-doc-owner",
644
+ "type": "scenario",
645
+ "label": "Stale page reported",
646
+ "x": 520,
647
+ "y": 1690,
648
+ "given": "a page whose review date is {{MAX_DOC_AGE_DAYS}} days old plus one",
649
+ "when": "the stale-page check runs",
650
+ "then": "it fails naming the page and its owner, and passes once the page is re-dated or removed"
651
+ },
652
+ {
653
+ "id": "sc-diagram-same-pr",
654
+ "type": "scenario",
655
+ "label": "Structural change without diagram fails",
656
+ "x": 520,
657
+ "y": 1820,
658
+ "given": "a pull request adding a call to a new external service without touching {{MODEL_DIR}}",
659
+ "when": "the diagram check runs",
660
+ "then": "it fails naming the module, and passes once the model shows the new call",
661
+ "hubWhen": {
662
+ "DIAGRAMS": [
663
+ "model"
664
+ ]
665
+ }
666
+ },
667
+ {
668
+ "id": "sc-diagram-dated",
669
+ "type": "scenario",
670
+ "label": "Undated diagram fails the check",
671
+ "x": 520,
672
+ "y": 1950,
673
+ "given": "a diagram image added without a source file or a dated caption",
674
+ "when": "the docs check runs",
675
+ "then": "it fails naming the image, and passes once the source file and a caption with date and author are present",
676
+ "hubWhen": {
677
+ "DIAGRAMS": [
678
+ "images"
679
+ ]
680
+ }
681
+ },
682
+ {
683
+ "id": "adr-adr-repo",
684
+ "type": "adr",
685
+ "label": "Decision records as files in the repository",
686
+ "x": 780,
687
+ "y": 0,
688
+ "concern": "code-documentation",
689
+ "status": "accepted",
690
+ "date": "",
691
+ "context": "Code lives in this element and will be read, changed and operated by people who were not there when it was written, and by the same people a year later. The forces: a decision that is not written down is re-argued at every change, or quietly reversed; documentation kept away from the code is not updated when the code is, and a page that was true once reads as if it still were; generated reference is always current but says what, never why; a wiki reaches readers who never open a repository, at the price of living where no review and no build can check it; a diagram drawn once drifts from the system it shows the moment the next pull request merges; and every page costs time to keep, so the set has to be small enough that it is kept. The snippets assume one repository layout: source in src/, tests in test/, documentation in docs/ (diagrams in docs/diagrams/), and in a monorepo one directory per workspace under packages/.",
692
+ "decision": "Every architecturally significant decision is one Markdown file in {{ADR_DIR}}, numbered and named NNNN-title.md, copied from the template in the same directory in the MADR format: YAML front matter with status, date and decision-makers (and superseded-by on a superseded record), then the sections Context and Problem Statement, Considered Options, Decision Outcome and Consequences. A record leaves status proposed within {{ADR_DAYS}} days. The record is changed in the pull request of the first code that implements it, reviewed by the same reviewers; a superseding record sets the old one's status to superseded with a link, and old records are never rewritten. A test over the front matter runs in CI. API reference: {{API_DOCS}}. READMEs: {{READMES}}. Documentation: {{DOCS_SITE}}. Diagrams: {{DIAGRAMS}}.",
693
+ "consequences": "• Decisions are versioned, reviewed and searched like code, and travel with the repository when it is forked or archived.\n• Readers who do not open the repository (product, operations, auditors) need a published copy: the docs site renders the folder.\n• The template guarantees fields, not quality: a record with a one-line context passes the test and still explains nothing; reviewers have to read it.\n• Decisions spanning several repositories live in one of them or in a shared one, and the others link to it.",
694
+ "alternatives": "1. Decisions in an architecture model next to the code: links each decision to the elements it constrains and lets CI check them together, but needs the model to exist and be kept.\n2. A decision log in a wiki: reaches readers outside the repository, but no review with the code and only a scheduled job checks it.\n3. Decisions in commit messages or pull request descriptions: already written, but unsearchable by topic, and commit messages are folded when the branch is squashed.",
695
+ "hubWhen": {
696
+ "DECISIONS": [
697
+ "adr-repo"
698
+ ]
699
+ }
700
+ },
701
+ {
702
+ "id": "adr-model",
703
+ "type": "adr",
704
+ "label": "Decisions in the architecture model next to the code",
705
+ "x": 780,
706
+ "y": 130,
707
+ "concern": "code-documentation",
708
+ "status": "accepted",
709
+ "date": "",
710
+ "context": "Code lives in this element and will be read, changed and operated by people who were not there when it was written, and by the same people a year later. The forces: a decision that is not written down is re-argued at every change, or quietly reversed; documentation kept away from the code is not updated when the code is, and a page that was true once reads as if it still were; generated reference is always current but says what, never why; a wiki reaches readers who never open a repository, at the price of living where no review and no build can check it; a diagram drawn once drifts from the system it shows the moment the next pull request merges; and every page costs time to keep, so the set has to be small enough that it is kept. The snippets assume one repository layout: source in src/, tests in test/, documentation in docs/ (diagrams in docs/diagrams/), and in a monorepo one directory per workspace under packages/.",
711
+ "decision": "Decisions are elements of the architecture model kept in {{MODEL_DIR}} in the repository: with radical.tools, ADR nodes in the Markdown folder with status, date, context, decision, consequences and alternatives, linked with constrains to the containers and components they bind, with derives to the requirements behind them and with implements from the fitness functions that enforce them; `radical check {{MODEL_DIR}}` runs in CI with the rules adr-incomplete and concern-unbound raised to errors in check.json, and a script fails a decision left proposed for more than {{ADR_DAYS}} days. With Structurizr, ADRs in the workspace's decisions folder shown in its ADR view, validated by the CLI. A decision is changed in the same pull request as the first code that implements it; a superseding decision links the old one (radical check reports a superseded decision nothing supersedes) and leaves it in place. API reference: {{API_DOCS}}. READMEs: {{READMES}}. Documentation: {{DOCS_SITE}}. Diagrams: {{DIAGRAMS}}.",
712
+ "consequences": "• A reader of an element reaches its decisions, requirements and checks from the element, and a decision without a subject is an error, not a forgotten file.\n• The model has to be kept: a team that stops updating it has stale decisions and stale diagrams at once.\n• The model folder is reviewable as text, but the tool is one more thing to install for reading and editing (CLI, Studio or an editor for the DSL).\n• Decisions are published as part of the model, not as a page on their own; readers outside the repository need the rendered site or a viewer.",
713
+ "alternatives": "1. Decision records as plain files in {{ADR_DIR}}: no tool to learn, but the link from a decision to what it constrains is prose and nothing checks it.\n2. A decision log in a wiki: reaches readers outside the repository, but no review with the code and only a scheduled job checks it.\n3. Decisions both in the model and in a wiki: two copies drift; keep one and link to it.",
714
+ "hubWhen": {
715
+ "DECISIONS": [
716
+ "model"
717
+ ]
718
+ }
719
+ },
720
+ {
721
+ "id": "adr-wiki",
722
+ "type": "adr",
723
+ "label": "A decision log in a wiki or document space",
724
+ "x": 780,
725
+ "y": 260,
726
+ "concern": "code-documentation",
727
+ "status": "accepted",
728
+ "date": "",
729
+ "context": "Code lives in this element and will be read, changed and operated by people who were not there when it was written, and by the same people a year later. The forces: a decision that is not written down is re-argued at every change, or quietly reversed; documentation kept away from the code is not updated when the code is, and a page that was true once reads as if it still were; generated reference is always current but says what, never why; a wiki reaches readers who never open a repository, at the price of living where no review and no build can check it; a diagram drawn once drifts from the system it shows the moment the next pull request merges; and every page costs time to keep, so the set has to be small enough that it is kept. The snippets assume one repository layout: source in src/, tests in test/, documentation in docs/ (diagrams in docs/diagrams/), and in a monorepo one directory per workspace under packages/. Here most readers never open the repository: decisions have to be found, read and commented on in the space where those readers already work.",
730
+ "decision": "Decisions are pages in the team's space (Confluence with the Decision template, or a Notion database with the same fields), labelled decision, with the content properties status (proposed, accepted, superseded) and date and, on a superseded page, superseded-by: title, decision-makers, context, decision, consequences, options considered. One decision log index page per system links every decision page; the repository README links the index. A page leaves proposed within {{ADR_DAYS}} days; superseding sets the old page's status and the superseded-by property, and old pages are not edited. A weekly job over the space's REST API fails on a page missing a property, a page left proposed too long, and a decision not linked from the index. API reference: {{API_DOCS}}. READMEs: {{READMES}}. Documentation: {{DOCS_SITE}}. Diagrams: {{DIAGRAMS}}.",
731
+ "consequences": "• Product, operations and an architecture board read and comment where they already are, with the space's search and notifications.\n• The decision is not reviewed with the code: the reviewer of the pull request has to open the page, and a code change that contradicts a decision is caught by people, not by a check.\n• The space is outside version control: history is the page history, and an export is needed when the space is moved or shut.\n• Links from code to pages break when pages move; the job catches missing pages, not moved ones.",
732
+ "alternatives": "1. Decision records as files in {{ADR_DIR}}: reviewed with the code and versioned, but invisible to readers who do not open repositories unless published.\n2. Decisions in an architecture model next to the code: connected and checked, but the furthest from readers who live in the wiki.\n3. Files in the repository published to the wiki by a job: one source and both audiences, at the cost of a job to keep and comments that land on the copy.",
733
+ "hubWhen": {
734
+ "DECISIONS": [
735
+ "wiki"
736
+ ]
737
+ }
738
+ },
739
+ {
740
+ "id": "ff-adr-lint",
741
+ "type": "fitness-fn",
742
+ "label": "Decision records are well-formed",
743
+ "x": 1040,
744
+ "y": 0,
745
+ "characteristic": "maintainability",
746
+ "scope": "atomic",
747
+ "cadence": "triggered",
748
+ "trigger": "pull-request",
749
+ "invocation": "automated",
750
+ "description": "A test reads the front matter and the headings of every record in {{ADR_DIR}}, checks the required fields and sections and that each superseded-by link points at an existing record, and fails on a record left in proposed past the deadline. An unquoted date in YAML front matter is parsed by gray-matter as a Date object, so the test normalises it before matching. The same test in Python is a pytest over python-frontmatter.\n\nThreshold: Every file in {{ADR_DIR}} has a status from the list, a date and the Context, Decision Outcome and Consequences sections; every superseded record names an existing record in superseded-by; 0 records in status proposed older than {{ADR_DAYS}} days\n\nTool: Vitest with gray-matter (a test over the ADR folder); pytest with python-frontmatter for Python\n\n```ts\nimport { readdirSync, readFileSync } from 'node:fs'\nimport matter from 'gray-matter'\nimport { expect, it } from 'vitest'\n\nconst DIR = '{{ADR_DIR}}'\nconst DAYS = {{ADR_DAYS}}\nconst SECTIONS = ['## Context', '## Decision Outcome', '## Consequences']\nconst files = readdirSync(DIR).filter((f) => /^\\d{4}-.+\\.md$/.test(f))\n// gray-matter turns an unquoted \"date: 2026-10-01\" into a Date; keep YYYY-MM-DD either way\nconst iso = (v: unknown): string => (v instanceof Date ? v.toISOString().slice(0, 10) : String(v ?? ''))\n\nit.each(files)('%s is a well-formed decision record', (file) => {\n const { data, content } = matter(readFileSync(`${DIR}/${file}`, 'utf8'))\n expect(['proposed', 'accepted', 'rejected', 'superseded', 'deprecated'], `${file}: status`).toContain(data.status)\n expect(iso(data.date), `${file}: date`).toMatch(/^\\d{4}-\\d{2}-\\d{2}$/)\n for (const s of SECTIONS) expect(content, `${file} lacks \"${s}\"`).toContain(s)\n if (data.status === 'superseded') expect(files, `${file}: superseded-by`).toContain(String(data['superseded-by']))\n if (data.status === 'proposed') expect((Date.now() - Date.parse(iso(data.date))) / 86_400_000, `${file} is proposed too long`).toBeLessThanOrEqual(DAYS)\n})\n```",
751
+ "hubWhen": {
752
+ "DECISIONS": [
753
+ "adr-repo"
754
+ ]
755
+ }
756
+ },
757
+ {
758
+ "id": "ff-radical-check",
759
+ "type": "fitness-fn",
760
+ "label": "Architecture model checked in CI",
761
+ "x": 1040,
762
+ "y": 130,
763
+ "characteristic": "maintainability",
764
+ "scope": "atomic",
765
+ "cadence": "triggered",
766
+ "trigger": "pull-request",
767
+ "invocation": "automated",
768
+ "description": "The CI job runs the model check against the test reports of the same run: an accepted decision without date, context, decision or consequences (adr-incomplete), a superseded decision nothing supersedes (adr-superseded-unlinked), a decision marked with a concern that constrains no element (concern-unbound), and a fitness function naming a test that did not run each fail the pull request once check.json sets those rules to error. A second step reads the decision files of the Markdown folder and fails one left proposed past {{ADR_DAYS}} days. With Structurizr, the CLI's validate command on the workspace plays the role of the model check.\n\nThreshold: `radical check {{MODEL_DIR}}` reports 0 errors on every pull request with adr-incomplete, adr-superseded-unlinked and concern-unbound raised to errors in check.json; 0 decisions in status proposed older than {{ADR_DAYS}} days\n\nTool: radical CLI in GitHub Actions\n\n```yaml\n# .github/workflows/architecture.yml\nname: architecture model\non: [pull_request, push]\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 5\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: actions/setup-node@v4.1.0 # pin by commit SHA in your repository\n with: { node-version-file: .nvmrc, cache: npm }\n - run: npm ci\n - run: npm test -- --reporter=junit --outputFile=reports/junit.xml\n # check.json in the model folder: \"rules\": { \"adr-incomplete\": \"error\", \"adr-superseded-unlinked\": \"error\", \"concern-unbound\": \"error\" }\n - run: npx radical check {{MODEL_DIR}} --report reports\n - name: no decision left proposed for more than {{ADR_DAYS}} days\n run: |\n limit=$(date -u -d '{{ADR_DAYS}} days ago' +%F)\n stale=$(grep -rlE '^status: *\"?proposed\"?' {{MODEL_DIR}}/nodes --include='*.md' | while read -r f; do # the folder quotes its values\n d=$(grep -m1 -oE '^date: *\"?[0-9]{4}-[0-9]{2}-[0-9]{2}' \"$f\" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}')\n if [ -n \"$d\" ] && [ \"$d\" \\< \"$limit\" ]; then echo \"$f (proposed since $d)\"; fi; done)\n [ -z \"$stale\" ] || { echo \"decisions proposed for more than {{ADR_DAYS}} days:\"; echo \"$stale\"; exit 1; }\n```",
769
+ "hubWhen": {
770
+ "DECISIONS": [
771
+ "model"
772
+ ]
773
+ }
774
+ },
775
+ {
776
+ "id": "ff-wiki-log",
777
+ "type": "fitness-fn",
778
+ "label": "Decision log complete in the wiki",
779
+ "x": 1040,
780
+ "y": 260,
781
+ "characteristic": "maintainability",
782
+ "scope": "atomic",
783
+ "cadence": "triggered",
784
+ "trigger": "weekly",
785
+ "invocation": "automated",
786
+ "description": "A weekly job lists the pages labelled decision in the space through the Confluence REST API with their content properties (expand=metadata.properties), fails on a page missing a status or date, a superseded page without superseded-by, or a page left proposed past the deadline, then reads the index page's storage body and fails on a decision page it does not link (Confluence stores a page link as ri:content-title=\"<title>\"). The job fails on the first gap; what it prints is the list to fix.\n\nThreshold: 0 decision pages without a status and a date property; 0 superseded pages without a superseded-by property; 0 pages in status proposed older than {{ADR_DAYS}} days; 0 decision pages not linked from the index page; the README links the space\n\nTool: Confluence REST API with curl and jq (scheduled job on a GNU/Linux runner, for date -d)\n\n```bash\n#!/usr/bin/env bash\n# weekly: decision pages with their status, date and superseded-by properties\nset -euo pipefail\nSPACE=ARCH; INDEX_PAGE_ID=123456789; DAYS={{ADR_DAYS}}\nauth=(-u \"$CONFLUENCE_USER:$CONFLUENCE_TOKEN\")\ncurl -sf \"${auth[@]}\" \"$CONFLUENCE_URL/wiki/rest/api/content/search?cql=space=$SPACE+and+label=decision&expand=metadata.properties&limit=200\" \\\n | jq -r '.results[] | [.id, .title, (.metadata.properties.status.value // \"MISSING\"), (.metadata.properties.date.value // \"MISSING\"), (.metadata.properties[\"superseded-by\"].value // \"\")] | @tsv' > decisions.tsv\nlimit=$(date -u -d \"$DAYS days ago\" +%F); bad=0\nwhile IFS=$'\\t' read -r id title status date by; do\n if [ \"$status\" = MISSING ] || [ \"$date\" = MISSING ]; then echo \"no status or date: $title\"; bad=1; fi\n if [ \"$status\" = superseded ] && [ -z \"$by\" ]; then echo \"superseded without superseded-by: $title\"; bad=1; fi\n if [ \"$status\" = proposed ] && [ \"$date\" \\< \"$limit\" ]; then echo \"proposed since $date: $title\"; bad=1; fi\ndone < decisions.tsv\n# every decision page is linked from the index page, and the README links the space\nindex=$(curl -sf \"${auth[@]}\" \"$CONFLUENCE_URL/wiki/rest/api/content/$INDEX_PAGE_ID?expand=body.storage\" | jq -r .body.storage.value)\nwhile IFS=$'\\t' read -r id title rest; do\n grep -qF \"ri:content-title=\\\"$title\\\"\" <<< \"$index\" || { echo \"not on the index: $title\"; bad=1; }\ndone < decisions.tsv\ngrep -qF \"$CONFLUENCE_URL/wiki/spaces/$SPACE\" README.md || { echo \"README does not link the decision space\"; bad=1; }\nexit $bad\n```",
787
+ "hubWhen": {
788
+ "DECISIONS": [
789
+ "wiki"
790
+ ]
791
+ }
792
+ },
793
+ {
794
+ "id": "ff-readme-sections",
795
+ "type": "fitness-fn",
796
+ "label": "Every module has its README sections",
797
+ "x": 1040,
798
+ "y": 390,
799
+ "characteristic": "maintainability",
800
+ "scope": "atomic",
801
+ "cadence": "triggered",
802
+ "trigger": "pull-request",
803
+ "invocation": "automated",
804
+ "description": "A test lists the module directories from the workspace configuration (package.json workspaces, or the services folder), not from a list kept by hand, and expects a README.md with every required heading in each; a new module fails the test until it has one. The same test in Python walks the packages with pathlib under pytest.\n\nThreshold: Every workspace or module directory holds README.md with the headings {{README_SECTIONS}}; 0 directories without\n\nTool: Vitest (a test over the workspaces); pytest with pathlib for Python\n\n```ts\nimport { existsSync, globSync, readFileSync } from 'node:fs' // globSync: Node 22 or later (tinyglobby before that)\nimport { expect, it } from 'vitest'\n\nconst SECTIONS = '{{README_SECTIONS}}'.split(/,\\s*/)\nconst workspaces: string[] = JSON.parse(readFileSync('package.json', 'utf8')).workspaces\nconst dirs = workspaces.flatMap((w) => globSync(w))\n\nit.each(dirs)('%s has a README with the required sections', (dir) => {\n const file = `${dir}/README.md`\n expect(existsSync(file), `${file} is missing`).toBe(true)\n const headings = readFileSync(file, 'utf8').match(/^#{1,3} .+$/gm) ?? []\n for (const s of SECTIONS) expect(headings.some((h) => h.toLowerCase().includes(s.toLowerCase())), `${file} lacks \"${s}\"`).toBe(true)\n})\n```",
805
+ "hubWhen": {
806
+ "READMES": [
807
+ "per-module"
808
+ ]
809
+ }
810
+ },
811
+ {
812
+ "id": "ff-readme-table",
813
+ "type": "fitness-fn",
814
+ "label": "Root README lists every module",
815
+ "x": 1040,
816
+ "y": 520,
817
+ "characteristic": "maintainability",
818
+ "scope": "atomic",
819
+ "cadence": "triggered",
820
+ "trigger": "pull-request",
821
+ "invocation": "automated",
822
+ "description": "A test reads the module table of the root README (one row per directory: | `src/name` | purpose | owner |) and compares it with the module directories of the repository both ways: a directory without a row and a row without a directory each fail it.\n\nThreshold: Every module directory under src has a row in the root README's module table with purpose and owner; 0 rows naming a directory that no longer exists\n\nTool: Vitest (a test over README.md); pytest with pathlib for Python\n\n```ts\nimport { readdirSync, readFileSync } from 'node:fs'\nimport { expect, it } from 'vitest'\n\nconst readme = readFileSync('README.md', 'utf8')\nconst rows = [...readme.matchAll(/^\\| `?(src\\/[\\w-]+)`? \\| (.+?) \\| (.+?) \\|$/gm)] // | dir | purpose | owner |\nconst listed = new Map(rows.map((r) => [r[1], { purpose: r[2].trim(), owner: r[3].trim() }]))\nconst dirs = readdirSync('src', { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => `src/${d.name}`)\n\nit('every module is in the table, with purpose and owner', () => {\n expect(dirs.filter((d) => !listed.has(d))).toEqual([])\n for (const [dir, row] of listed) expect(row.purpose && row.owner, `${dir} lacks purpose or owner`).toBeTruthy()\n})\nit('no row names a module that is gone', () => {\n expect([...listed.keys()].filter((d) => !dirs.includes(d))).toEqual([])\n})\n```",
823
+ "hubWhen": {
824
+ "READMES": [
825
+ "root-only"
826
+ ]
827
+ }
828
+ },
829
+ {
830
+ "id": "ff-doc-comments",
831
+ "type": "fitness-fn",
832
+ "label": "Doc comments on the exported symbols",
833
+ "x": 1040,
834
+ "y": 650,
835
+ "characteristic": "maintainability",
836
+ "scope": "atomic",
837
+ "cadence": "triggered",
838
+ "trigger": "pull-request",
839
+ "invocation": "automated",
840
+ "description": "A test opens the TypeScript program from tsconfig.json, walks the exported declarations of every file under src, counts the ones with a JSDoc comment and fails below the threshold, printing the undocumented symbols with their file. For Python, interrogate measures docstring coverage of the public API and fails under the same number; for Java, the javadoc doclint run of the build reports undocumented public members. Where the Code quality gate decision enforces a linter, eslint-plugin-jsdoc's require-jsdoc rule also refuses a new export without a comment on the changed lines.\n\nThreshold: At least {{DOC_COMMENT_COVERAGE_PCT}}% of the exported functions, classes, interfaces, type aliases and variables under src carry a doc comment; the test lists the ones that do not\n\nTool: Vitest with the TypeScript compiler API; interrogate for Python; javadoc -Xdoclint for Java\n\n```ts\n// test/doc-comments.test.ts\nimport ts from 'typescript'\nimport { expect, it } from 'vitest'\n\nconst MIN_PCT = {{DOC_COMMENT_COVERAGE_PCT}}\nconst { config } = ts.readConfigFile('tsconfig.json', ts.sys.readFile)\nconst { fileNames, options } = ts.parseJsonConfigFileContent(config, ts.sys, '.')\nconst program = ts.createProgram(fileNames.filter((f) => f.startsWith('src/') || f.includes('/src/')), options)\nconst checker = program.getTypeChecker()\n\nit(`at least ${MIN_PCT}% of the exported symbols carry a doc comment`, () => {\n const missing: string[] = []\n let total = 0\n for (const file of program.getSourceFiles()) {\n if (file.isDeclarationFile || !program.getRootFileNames().includes(file.fileName)) continue\n const module = checker.getSymbolAtLocation(file)\n for (const symbol of module ? checker.getExportsOfModule(module) : []) {\n const decl = symbol.declarations?.[0]\n if (!decl) continue\n total++\n if (!ts.getJSDocCommentsAndTags(decl).length) missing.push(`${file.fileName}: ${symbol.name}`)\n }\n }\n const pct = total ? ((total - missing.length) * 100) / total : 100\n expect(pct, `${pct.toFixed(1)}% documented; without a comment:\\n${missing.join('\\n')}`).toBeGreaterThanOrEqual(MIN_PCT)\n})\n// Python: interrogate --fail-under {{DOC_COMMENT_COVERAGE_PCT}} src\n```"
841
+ },
842
+ {
843
+ "id": "ff-reference-build",
844
+ "type": "fitness-fn",
845
+ "label": "API reference builds without warnings",
846
+ "x": 1040,
847
+ "y": 780,
848
+ "characteristic": "maintainability",
849
+ "scope": "atomic",
850
+ "cadence": "triggered",
851
+ "trigger": "pull-request",
852
+ "invocation": "automated",
853
+ "description": "TypeDoc runs with warnings treated as errors, so a broken {@link} or an export without a comment fails the pull request; Sphinx does the same with `sphinx-build -W --keep-going`. The release job runs the same command and publishes the output under the release version (includeVersion puts it in the site). The file is typedoc.json; package.json holds the script \"docs:api\": \"typedoc\", which CI runs on every pull request and the release job runs to publish docs/api. Python: sphinx-build -W --keep-going -b html docs docs/_build.\n\nThreshold: The reference builds on every pull request with 0 warnings (an unresolved link or an undocumented export is a warning) and is published with each release under its version\n\nTool: TypeDoc; Sphinx for Python\n\n```json\n{\n \"$schema\": \"https://typedoc.org/schema.json\",\n \"entryPoints\": [\"src/index.ts\"],\n \"out\": \"docs/api\",\n \"treatWarningsAsErrors\": true,\n \"validation\": { \"notExported\": true, \"invalidLink\": true, \"notDocumented\": true },\n \"requiredToBeDocumented\": [\"Function\", \"Class\", \"Interface\", \"TypeAlias\", \"Method\"],\n \"includeVersion\": true\n}\n```",
854
+ "hubWhen": {
855
+ "API_DOCS": [
856
+ "reference"
857
+ ]
858
+ }
859
+ },
860
+ {
861
+ "id": "ff-contract-drift",
862
+ "type": "fitness-fn",
863
+ "label": "Contract and code agree",
864
+ "x": 1040,
865
+ "y": 910,
866
+ "characteristic": "compatibility",
867
+ "scope": "atomic",
868
+ "cadence": "triggered",
869
+ "trigger": "pull-request",
870
+ "invocation": "automated",
871
+ "description": "The pipeline starts the element, fetches the specification it generates from its routes and compares it with the contract file in the repository with oasdiff; any difference outside descriptions, examples and titles fails the build, so the contract, the reference rendered from it and the code cannot drift apart. Whether a difference may be released at all is the API evolution concern's decision; this check only keeps the documentation true.\n\nThreshold: 0 differences in paths, operations, parameters, schemas or responses between the OpenAPI contract in the repository and the specification the running code serves, on every pull request\n\nTool: oasdiff\n\n```bash\n#!/usr/bin/env bash\n# CI step: the contract in the repository is what the code serves\nset -euo pipefail\nnpm start & PID=$!\nuntil curl -sf http://localhost:3000/openapi.json > generated.json; do sleep 1; done\nkill $PID\n# any difference in paths, parameters, schemas or responses fails\noasdiff diff openapi.yaml generated.json --fail-on-diff --exclude-elements description,examples,title\n# and a breaking change is reported on its own for the API evolution review\noasdiff breaking openapi.yaml generated.json --fail-on ERR\n```",
872
+ "hubWhen": {
873
+ "API_DOCS": [
874
+ "generated"
875
+ ]
876
+ }
877
+ },
878
+ {
879
+ "id": "ff-doctest",
880
+ "type": "fitness-fn",
881
+ "label": "Examples in the guide run",
882
+ "x": 1040,
883
+ "y": 1040,
884
+ "characteristic": "maintainability",
885
+ "scope": "atomic",
886
+ "cadence": "triggered",
887
+ "trigger": "pull-request",
888
+ "invocation": "automated",
889
+ "description": "markdown-doctest executes every fenced js and es6 block of the guide with the package imported and fails on an exception; it does not compare output, so an example states what it expects with assert. For Python, `pytest --doctest-modules --doctest-glob=\"docs/*.md\"` runs the doctests in docstrings and Markdown and does compare the output. Examples that need a server run against a test instance started by the job; an example that cannot run is marked <!-- skip-example --> and reviewed as such.\n\nThreshold: Every code example in the API guide is executed on each pull request; 0 examples throwing, and for Python 0 examples whose output differs from the guide\n\nTool: markdown-doctest; pytest --doctest-modules for Python\n\n```js\n// .markdown-doctest-setup.js\nconst assert = require('node:assert')\nconst sdk = require('./dist')\nmodule.exports = {\n require: { '@shop/sdk': sdk, assert }, // what the examples import\n globals: { client: sdk.createClient({ baseUrl: process.env.API_URL }) },\n regexRequire: { '^@shop/sdk/(.+)$': (m, sub) => require(`./dist/${sub}`) },\n}\n// package.json: \"test:docs\": \"markdown-doctest docs/api/*.md README.md\"\n// an example that states its result: const order = await client.orders.get('o-1'); assert.equal(order.status, 'paid')\n// Python: pytest --doctest-modules --doctest-glob=\"docs/*.md\" src docs\n```",
890
+ "hubWhen": {
891
+ "API_DOCS": [
892
+ "written"
893
+ ]
894
+ }
895
+ },
896
+ {
897
+ "id": "ff-docs-build",
898
+ "type": "fitness-fn",
899
+ "label": "Docs build strictly with links checked",
900
+ "x": 1040,
901
+ "y": 1170,
902
+ "characteristic": "maintainability",
903
+ "scope": "atomic",
904
+ "cadence": "triggered",
905
+ "trigger": "pull-request",
906
+ "invocation": "automated",
907
+ "description": "The docs job builds the site with warnings as errors (`mkdocs build --strict`, or Docusaurus with onBrokenLinks: \"throw\") and runs lychee over the Markdown and the built HTML with fragments checked; the job has a timeout of {{LINK_CHECK_MINUTES}} minutes and is a required check.\n\nThreshold: The documentation builds in strict mode with 0 warnings and lychee finds 0 broken links or anchors, within {{LINK_CHECK_MINUTES}} minutes, on every pull request\n\nTool: MkDocs (--strict) with lychee in GitHub Actions\n\n```yaml\n# .github/workflows/docs.yml\nname: docs\non: [pull_request]\njobs:\n docs:\n runs-on: ubuntu-latest\n timeout-minutes: {{LINK_CHECK_MINUTES}}\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: actions/setup-python@v5.3.0 # pin by commit SHA in your repository\n with: { python-version: '3.12' }\n - run: pip install mkdocs-material && mkdocs build --strict # Docusaurus: onBrokenLinks: 'throw'\n - uses: lycheeverse/lychee-action@v2.0.2 # pin by commit SHA in your repository\n with:\n args: --no-progress --include-fragments --exclude-path site/assets 'docs/**/*.md' 'site/**/*.html'\n fail: true\n```",
908
+ "hubWhen": {
909
+ "DOCS_SITE": [
910
+ "docs-as-code"
911
+ ]
912
+ }
913
+ },
914
+ {
915
+ "id": "ff-stale-pages",
916
+ "type": "fitness-fn",
917
+ "label": "No page without owner or past review",
918
+ "x": 1040,
919
+ "y": 1300,
920
+ "characteristic": "maintainability",
921
+ "scope": "atomic",
922
+ "cadence": "temporal",
923
+ "every": "{{MAX_DOC_AGE_DAYS}}d",
924
+ "invocation": "manual",
925
+ "description": "A test over the docs folder reads each page's front matter and fails on a page without an owner or review date, or with a review date older than {{MAX_DOC_AGE_DAYS}} days, naming the page and its owner. An unquoted date is parsed by gray-matter as a Date object, so the test normalises it before matching. Run on every pull request and weekly on the main branch, so a page goes stale on a schedule, not unnoticed.\n\nThreshold: Every page under docs has owner and reviewed in its front matter; 0 pages with a reviewed date older than {{MAX_DOC_AGE_DAYS}} days\n\nTool: Vitest with gray-matter (a test over the docs folder); pytest with python-frontmatter for Python\n\n```ts\nimport { globSync, readFileSync } from 'node:fs' // globSync: Node 22 or later (tinyglobby before that)\nimport matter from 'gray-matter'\nimport { expect, it } from 'vitest'\n\nconst MAX_DAYS = {{MAX_DOC_AGE_DAYS}}\nconst pages = globSync('docs/**/*.md')\nconst iso = (v: unknown): string => (v instanceof Date ? v.toISOString().slice(0, 10) : String(v ?? ''))\n\nit.each(pages)('%s has an owner and a recent review date', (page) => {\n const { data } = matter(readFileSync(page, 'utf8')) // --- owner: team-orders reviewed: 2026-10-01 ---\n expect(data.owner, `${page} has no owner`).toBeTruthy()\n const reviewed = iso(data.reviewed)\n expect(reviewed, `${page} has no review date`).toMatch(/^\\d{4}-\\d{2}-\\d{2}$/)\n expect((Date.now() - Date.parse(reviewed)) / 86_400_000, `${page} (owner ${data.owner}) was last reviewed on ${reviewed}`).toBeLessThanOrEqual(MAX_DAYS)\n})\n```",
926
+ "hubWhen": {
927
+ "DOCS_SITE": [
928
+ "docs-as-code"
929
+ ]
930
+ }
931
+ },
932
+ {
933
+ "id": "ff-external-pages",
934
+ "type": "fitness-fn",
935
+ "label": "External pages name release, owner and review date",
936
+ "x": 1040,
937
+ "y": 1430,
938
+ "characteristic": "maintainability",
939
+ "scope": "atomic",
940
+ "cadence": "triggered",
941
+ "trigger": "weekly",
942
+ "invocation": "automated",
943
+ "description": "A weekly job lists the pages of the documentation space through the Confluence REST API with their content properties (expand=metadata.properties) and fails on a page without release, owner or reviewed, or reviewed older than {{MAX_DOC_AGE_DAYS}} days, naming the page and its owner; it also fails when the README does not link the space. Notion and GitBook have the same shape through their APIs (database properties, page metadata).\n\nThreshold: Every page of the documentation space has the content properties release, owner and reviewed; 0 pages with reviewed older than {{MAX_DOC_AGE_DAYS}} days; the README links the space\n\nTool: Confluence REST API with curl and jq (scheduled job on a GNU/Linux runner, for date -d)\n\n```bash\n#!/usr/bin/env bash\n# weekly: every documentation page names its release, owner and review date\nset -euo pipefail\nSPACE=DOCS; MAX_DAYS={{MAX_DOC_AGE_DAYS}}\nlimit=$(date -u -d \"$MAX_DAYS days ago\" +%F); bad=0\nwhile IFS=$'\\t' read -r title release owner reviewed; do\n if [ \"$release\" = MISSING ] || [ \"$owner\" = MISSING ] || [ \"$reviewed\" = MISSING ]; then echo \"missing release, owner or reviewed: $title\"; bad=1; fi\n if [ \"$reviewed\" != MISSING ] && [ \"$reviewed\" \\< \"$limit\" ]; then echo \"stale since $reviewed (owner $owner): $title\"; bad=1; fi\ndone < <(curl -sf -u \"$CONFLUENCE_USER:$CONFLUENCE_TOKEN\" \\\n \"$CONFLUENCE_URL/wiki/rest/api/content/search?cql=space=$SPACE+and+type=page&expand=metadata.properties&limit=200\" \\\n | jq -r '.results[] | [.title, (.metadata.properties.release.value // \"MISSING\"), (.metadata.properties.owner.value // \"MISSING\"), (.metadata.properties.reviewed.value // \"MISSING\")] | @tsv')\ngrep -qF \"$CONFLUENCE_URL/wiki/spaces/$SPACE\" README.md || { echo \"README does not link the documentation space\"; bad=1; }\nexit $bad\n```",
944
+ "hubWhen": {
945
+ "DOCS_SITE": [
946
+ "external"
947
+ ]
948
+ }
949
+ },
950
+ {
951
+ "id": "ff-diagram-drift",
952
+ "type": "fitness-fn",
953
+ "label": "Structural change touches the model",
954
+ "x": 1040,
955
+ "y": 1560,
956
+ "characteristic": "maintainability",
957
+ "scope": "atomic",
958
+ "cadence": "triggered",
959
+ "trigger": "pull-request",
960
+ "invocation": "automated",
961
+ "description": "A CI step lists the files a pull request changes; when a dependency manifest, a client of another service or a data-store configuration under a diagrammed module changed and nothing under {{MODEL_DIR}} did, the step fails with the list, and the author either updates the model or explains in the pull request why the structure did not change. With Structurizr or PlantUML the diagram source folder takes the model folder's place. The checkout needs the base branch (fetch-depth: 0, as the quality gate's job does) for merge-base.\n\nThreshold: 0 pull requests that add or remove a dependency, service client or data store under a diagrammed module without a change in {{MODEL_DIR}}\n\nTool: git diff --name-only (CI script)\n\n```bash\n#!/usr/bin/env bash\n# CI: a change to the structure of a diagrammed module changes the model too (checkout with fetch-depth: 0)\nset -euo pipefail\nMODEL='{{MODEL_DIR}}'\nBASE=$(git merge-base \"origin/${GITHUB_BASE_REF:-main}\" HEAD)\nchanged=$(git diff --name-only \"$BASE\"...HEAD)\n# files that change the structure: dependency manifests, service clients, data-store config\nstructural=$(grep -E '^(apps|packages|services)/[^/]+/(package\\.json|pom\\.xml|go\\.mod|requirements\\.txt|src/(clients|adapters|infra)/.*|src/.*(Client|Repository|Gateway)\\.[a-z]+)$' <<< \"$changed\" || true)\nif [ -n \"$structural\" ] && ! grep -q \"^$MODEL/\" <<< \"$changed\"; then\n echo \"These files change the structure of a diagrammed module, but $MODEL/ did not change:\"; echo \"$structural\"\n echo \"Update the model in this pull request (radical check lists what is missing) or explain why the structure is the same.\"\n exit 1\nfi\n```",
962
+ "hubWhen": {
963
+ "DIAGRAMS": [
964
+ "model"
965
+ ]
966
+ }
967
+ },
968
+ {
969
+ "id": "ff-diagram-images",
970
+ "type": "fitness-fn",
971
+ "label": "Image diagrams have a source and a dated caption",
972
+ "x": 1040,
973
+ "y": 1690,
974
+ "characteristic": "maintainability",
975
+ "scope": "atomic",
976
+ "cadence": "triggered",
977
+ "trigger": "pull-request",
978
+ "invocation": "automated",
979
+ "description": "A test lists the images under docs/diagrams, expects the editable source next to each, finds the Markdown page that embeds the image and reads the caption on the line after the embed (*Drawn 2026-10-01 by A. Nowak*), and fails on a missing source, a missing or malformed caption, or a date older than {{MAX_DOC_AGE_DAYS}} days.\n\nThreshold: Every image under docs/diagrams has a sibling .drawio or .excalidraw file and a caption \"Drawn YYYY-MM-DD by <author>\" on the line after the page that embeds it; 0 captions older than {{MAX_DOC_AGE_DAYS}} days\n\nTool: Vitest (a test over docs/diagrams); pytest with pathlib for Python\n\n```ts\nimport { existsSync, globSync, readFileSync } from 'node:fs' // globSync: Node 22 or later (tinyglobby before that)\nimport { basename } from 'node:path'\nimport { expect, it } from 'vitest'\n\nconst MAX_DAYS = {{MAX_DOC_AGE_DAYS}}\nconst images = globSync('docs/diagrams/*.{png,svg}')\nconst pages = globSync('docs/**/*.md').map((p) => readFileSync(p, 'utf8').split('\\n'))\nconst CAPTION = /^\\*?(Drawn|Updated) (\\d{4}-\\d{2}-\\d{2}) by .+/\n\nit.each(images)('%s has an editable source and a dated caption', (image) => {\n const stem = image.replace(/\\.(png|svg)$/, '')\n expect(existsSync(`${stem}.drawio`) || existsSync(`${stem}.excalidraw`), `${image} has no .drawio or .excalidraw next to it`).toBe(true)\n const caption = pages.flatMap((lines) => lines.flatMap((l, i) => (l.includes(`](`) && l.includes(basename(image)) ? [lines[i + 1] ?? ''] : [])))\n .map((l) => l.match(CAPTION)).find(Boolean)\n expect(caption, `${image}: no page embeds it with a caption \"Drawn YYYY-MM-DD by <author>\" on the next line`).toBeTruthy()\n expect((Date.now() - Date.parse(caption![2])) / 86_400_000, `${image} was drawn on ${caption![2]}: review or remove it`).toBeLessThanOrEqual(MAX_DAYS)\n})\n```",
980
+ "hubWhen": {
981
+ "DIAGRAMS": [
982
+ "images"
983
+ ]
984
+ }
985
+ }
986
+ ],
987
+ "relations": [
988
+ {
989
+ "id": "req-adr-recorded--derives--need",
990
+ "sourceId": "req-adr-recorded",
991
+ "targetId": "need",
992
+ "relationType": "derives"
993
+ },
994
+ {
995
+ "id": "req-adr-supersede--derives--need",
996
+ "sourceId": "req-adr-supersede",
997
+ "targetId": "need",
998
+ "relationType": "derives"
999
+ },
1000
+ {
1001
+ "id": "req-adr-with-code--derives--need",
1002
+ "sourceId": "req-adr-with-code",
1003
+ "targetId": "need",
1004
+ "relationType": "derives"
1005
+ },
1006
+ {
1007
+ "id": "req-adr-linked--derives--need",
1008
+ "sourceId": "req-adr-linked",
1009
+ "targetId": "need",
1010
+ "relationType": "derives"
1011
+ },
1012
+ {
1013
+ "id": "req-adr-wiki-index--derives--need",
1014
+ "sourceId": "req-adr-wiki-index",
1015
+ "targetId": "need",
1016
+ "relationType": "derives"
1017
+ },
1018
+ {
1019
+ "id": "req-api-regenerated--derives--need",
1020
+ "sourceId": "req-api-regenerated",
1021
+ "targetId": "need",
1022
+ "relationType": "derives"
1023
+ },
1024
+ {
1025
+ "id": "req-reference-built--derives--need",
1026
+ "sourceId": "req-reference-built",
1027
+ "targetId": "need",
1028
+ "relationType": "derives"
1029
+ },
1030
+ {
1031
+ "id": "req-doc-comments--derives--need",
1032
+ "sourceId": "req-doc-comments",
1033
+ "targetId": "need",
1034
+ "relationType": "derives"
1035
+ },
1036
+ {
1037
+ "id": "req-examples-run--derives--need",
1038
+ "sourceId": "req-examples-run",
1039
+ "targetId": "need",
1040
+ "relationType": "derives"
1041
+ },
1042
+ {
1043
+ "id": "req-readme-per-module--derives--need",
1044
+ "sourceId": "req-readme-per-module",
1045
+ "targetId": "need",
1046
+ "relationType": "derives"
1047
+ },
1048
+ {
1049
+ "id": "req-readme-root--derives--need",
1050
+ "sourceId": "req-readme-root",
1051
+ "targetId": "need",
1052
+ "relationType": "derives"
1053
+ },
1054
+ {
1055
+ "id": "req-links--derives--need",
1056
+ "sourceId": "req-links",
1057
+ "targetId": "need",
1058
+ "relationType": "derives"
1059
+ },
1060
+ {
1061
+ "id": "req-external-versioned--derives--need",
1062
+ "sourceId": "req-external-versioned",
1063
+ "targetId": "need",
1064
+ "relationType": "derives"
1065
+ },
1066
+ {
1067
+ "id": "req-doc-owner--derives--need",
1068
+ "sourceId": "req-doc-owner",
1069
+ "targetId": "need",
1070
+ "relationType": "derives"
1071
+ },
1072
+ {
1073
+ "id": "req-diagram-same-pr--derives--need",
1074
+ "sourceId": "req-diagram-same-pr",
1075
+ "targetId": "need",
1076
+ "relationType": "derives"
1077
+ },
1078
+ {
1079
+ "id": "req-diagram-dated--derives--need",
1080
+ "sourceId": "req-diagram-dated",
1081
+ "targetId": "need",
1082
+ "relationType": "derives"
1083
+ },
1084
+ {
1085
+ "id": "sc-adr-recorded--verifies--req-adr-recorded",
1086
+ "sourceId": "sc-adr-recorded",
1087
+ "targetId": "req-adr-recorded",
1088
+ "relationType": "verifies"
1089
+ },
1090
+ {
1091
+ "id": "sc-adr-supersede--verifies--req-adr-supersede",
1092
+ "sourceId": "sc-adr-supersede",
1093
+ "targetId": "req-adr-supersede",
1094
+ "relationType": "verifies"
1095
+ },
1096
+ {
1097
+ "id": "sc-adr-with-code--verifies--req-adr-with-code",
1098
+ "sourceId": "sc-adr-with-code",
1099
+ "targetId": "req-adr-with-code",
1100
+ "relationType": "verifies"
1101
+ },
1102
+ {
1103
+ "id": "sc-adr-linked--verifies--req-adr-linked",
1104
+ "sourceId": "sc-adr-linked",
1105
+ "targetId": "req-adr-linked",
1106
+ "relationType": "verifies"
1107
+ },
1108
+ {
1109
+ "id": "sc-adr-wiki-index--verifies--req-adr-wiki-index",
1110
+ "sourceId": "sc-adr-wiki-index",
1111
+ "targetId": "req-adr-wiki-index",
1112
+ "relationType": "verifies"
1113
+ },
1114
+ {
1115
+ "id": "sc-api-regenerated--verifies--req-api-regenerated",
1116
+ "sourceId": "sc-api-regenerated",
1117
+ "targetId": "req-api-regenerated",
1118
+ "relationType": "verifies"
1119
+ },
1120
+ {
1121
+ "id": "sc-reference-built--verifies--req-reference-built",
1122
+ "sourceId": "sc-reference-built",
1123
+ "targetId": "req-reference-built",
1124
+ "relationType": "verifies"
1125
+ },
1126
+ {
1127
+ "id": "sc-doc-comments--verifies--req-doc-comments",
1128
+ "sourceId": "sc-doc-comments",
1129
+ "targetId": "req-doc-comments",
1130
+ "relationType": "verifies"
1131
+ },
1132
+ {
1133
+ "id": "sc-examples-run--verifies--req-examples-run",
1134
+ "sourceId": "sc-examples-run",
1135
+ "targetId": "req-examples-run",
1136
+ "relationType": "verifies"
1137
+ },
1138
+ {
1139
+ "id": "sc-readme-per-module--verifies--req-readme-per-module",
1140
+ "sourceId": "sc-readme-per-module",
1141
+ "targetId": "req-readme-per-module",
1142
+ "relationType": "verifies"
1143
+ },
1144
+ {
1145
+ "id": "sc-readme-root--verifies--req-readme-root",
1146
+ "sourceId": "sc-readme-root",
1147
+ "targetId": "req-readme-root",
1148
+ "relationType": "verifies"
1149
+ },
1150
+ {
1151
+ "id": "sc-links--verifies--req-links",
1152
+ "sourceId": "sc-links",
1153
+ "targetId": "req-links",
1154
+ "relationType": "verifies"
1155
+ },
1156
+ {
1157
+ "id": "sc-external-versioned--verifies--req-external-versioned",
1158
+ "sourceId": "sc-external-versioned",
1159
+ "targetId": "req-external-versioned",
1160
+ "relationType": "verifies"
1161
+ },
1162
+ {
1163
+ "id": "sc-doc-owner--verifies--req-doc-owner",
1164
+ "sourceId": "sc-doc-owner",
1165
+ "targetId": "req-doc-owner",
1166
+ "relationType": "verifies"
1167
+ },
1168
+ {
1169
+ "id": "sc-diagram-same-pr--verifies--req-diagram-same-pr",
1170
+ "sourceId": "sc-diagram-same-pr",
1171
+ "targetId": "req-diagram-same-pr",
1172
+ "relationType": "verifies"
1173
+ },
1174
+ {
1175
+ "id": "sc-diagram-dated--verifies--req-diagram-dated",
1176
+ "sourceId": "sc-diagram-dated",
1177
+ "targetId": "req-diagram-dated",
1178
+ "relationType": "verifies"
1179
+ },
1180
+ {
1181
+ "id": "ff-adr-lint--implements--adr-adr-repo",
1182
+ "sourceId": "ff-adr-lint",
1183
+ "targetId": "adr-adr-repo",
1184
+ "relationType": "implements"
1185
+ },
1186
+ {
1187
+ "id": "ff-radical-check--implements--adr-model",
1188
+ "sourceId": "ff-radical-check",
1189
+ "targetId": "adr-model",
1190
+ "relationType": "implements"
1191
+ },
1192
+ {
1193
+ "id": "ff-wiki-log--implements--adr-wiki",
1194
+ "sourceId": "ff-wiki-log",
1195
+ "targetId": "adr-wiki",
1196
+ "relationType": "implements"
1197
+ },
1198
+ {
1199
+ "id": "ff-readme-sections--implements--adr-adr-repo",
1200
+ "sourceId": "ff-readme-sections",
1201
+ "targetId": "adr-adr-repo",
1202
+ "relationType": "implements"
1203
+ },
1204
+ {
1205
+ "id": "ff-readme-sections--implements--adr-model",
1206
+ "sourceId": "ff-readme-sections",
1207
+ "targetId": "adr-model",
1208
+ "relationType": "implements"
1209
+ },
1210
+ {
1211
+ "id": "ff-readme-sections--implements--adr-wiki",
1212
+ "sourceId": "ff-readme-sections",
1213
+ "targetId": "adr-wiki",
1214
+ "relationType": "implements"
1215
+ },
1216
+ {
1217
+ "id": "ff-readme-table--implements--adr-adr-repo",
1218
+ "sourceId": "ff-readme-table",
1219
+ "targetId": "adr-adr-repo",
1220
+ "relationType": "implements"
1221
+ },
1222
+ {
1223
+ "id": "ff-readme-table--implements--adr-model",
1224
+ "sourceId": "ff-readme-table",
1225
+ "targetId": "adr-model",
1226
+ "relationType": "implements"
1227
+ },
1228
+ {
1229
+ "id": "ff-readme-table--implements--adr-wiki",
1230
+ "sourceId": "ff-readme-table",
1231
+ "targetId": "adr-wiki",
1232
+ "relationType": "implements"
1233
+ },
1234
+ {
1235
+ "id": "ff-doc-comments--implements--adr-adr-repo",
1236
+ "sourceId": "ff-doc-comments",
1237
+ "targetId": "adr-adr-repo",
1238
+ "relationType": "implements"
1239
+ },
1240
+ {
1241
+ "id": "ff-doc-comments--implements--adr-model",
1242
+ "sourceId": "ff-doc-comments",
1243
+ "targetId": "adr-model",
1244
+ "relationType": "implements"
1245
+ },
1246
+ {
1247
+ "id": "ff-doc-comments--implements--adr-wiki",
1248
+ "sourceId": "ff-doc-comments",
1249
+ "targetId": "adr-wiki",
1250
+ "relationType": "implements"
1251
+ },
1252
+ {
1253
+ "id": "ff-reference-build--implements--adr-adr-repo",
1254
+ "sourceId": "ff-reference-build",
1255
+ "targetId": "adr-adr-repo",
1256
+ "relationType": "implements"
1257
+ },
1258
+ {
1259
+ "id": "ff-reference-build--implements--adr-model",
1260
+ "sourceId": "ff-reference-build",
1261
+ "targetId": "adr-model",
1262
+ "relationType": "implements"
1263
+ },
1264
+ {
1265
+ "id": "ff-reference-build--implements--adr-wiki",
1266
+ "sourceId": "ff-reference-build",
1267
+ "targetId": "adr-wiki",
1268
+ "relationType": "implements"
1269
+ },
1270
+ {
1271
+ "id": "ff-contract-drift--implements--adr-adr-repo",
1272
+ "sourceId": "ff-contract-drift",
1273
+ "targetId": "adr-adr-repo",
1274
+ "relationType": "implements"
1275
+ },
1276
+ {
1277
+ "id": "ff-contract-drift--implements--adr-model",
1278
+ "sourceId": "ff-contract-drift",
1279
+ "targetId": "adr-model",
1280
+ "relationType": "implements"
1281
+ },
1282
+ {
1283
+ "id": "ff-contract-drift--implements--adr-wiki",
1284
+ "sourceId": "ff-contract-drift",
1285
+ "targetId": "adr-wiki",
1286
+ "relationType": "implements"
1287
+ },
1288
+ {
1289
+ "id": "ff-doctest--implements--adr-adr-repo",
1290
+ "sourceId": "ff-doctest",
1291
+ "targetId": "adr-adr-repo",
1292
+ "relationType": "implements"
1293
+ },
1294
+ {
1295
+ "id": "ff-doctest--implements--adr-model",
1296
+ "sourceId": "ff-doctest",
1297
+ "targetId": "adr-model",
1298
+ "relationType": "implements"
1299
+ },
1300
+ {
1301
+ "id": "ff-doctest--implements--adr-wiki",
1302
+ "sourceId": "ff-doctest",
1303
+ "targetId": "adr-wiki",
1304
+ "relationType": "implements"
1305
+ },
1306
+ {
1307
+ "id": "ff-docs-build--implements--adr-adr-repo",
1308
+ "sourceId": "ff-docs-build",
1309
+ "targetId": "adr-adr-repo",
1310
+ "relationType": "implements"
1311
+ },
1312
+ {
1313
+ "id": "ff-docs-build--implements--adr-model",
1314
+ "sourceId": "ff-docs-build",
1315
+ "targetId": "adr-model",
1316
+ "relationType": "implements"
1317
+ },
1318
+ {
1319
+ "id": "ff-docs-build--implements--adr-wiki",
1320
+ "sourceId": "ff-docs-build",
1321
+ "targetId": "adr-wiki",
1322
+ "relationType": "implements"
1323
+ },
1324
+ {
1325
+ "id": "ff-stale-pages--implements--adr-adr-repo",
1326
+ "sourceId": "ff-stale-pages",
1327
+ "targetId": "adr-adr-repo",
1328
+ "relationType": "implements"
1329
+ },
1330
+ {
1331
+ "id": "ff-stale-pages--implements--adr-model",
1332
+ "sourceId": "ff-stale-pages",
1333
+ "targetId": "adr-model",
1334
+ "relationType": "implements"
1335
+ },
1336
+ {
1337
+ "id": "ff-stale-pages--implements--adr-wiki",
1338
+ "sourceId": "ff-stale-pages",
1339
+ "targetId": "adr-wiki",
1340
+ "relationType": "implements"
1341
+ },
1342
+ {
1343
+ "id": "ff-external-pages--implements--adr-adr-repo",
1344
+ "sourceId": "ff-external-pages",
1345
+ "targetId": "adr-adr-repo",
1346
+ "relationType": "implements"
1347
+ },
1348
+ {
1349
+ "id": "ff-external-pages--implements--adr-model",
1350
+ "sourceId": "ff-external-pages",
1351
+ "targetId": "adr-model",
1352
+ "relationType": "implements"
1353
+ },
1354
+ {
1355
+ "id": "ff-external-pages--implements--adr-wiki",
1356
+ "sourceId": "ff-external-pages",
1357
+ "targetId": "adr-wiki",
1358
+ "relationType": "implements"
1359
+ },
1360
+ {
1361
+ "id": "ff-diagram-drift--implements--adr-adr-repo",
1362
+ "sourceId": "ff-diagram-drift",
1363
+ "targetId": "adr-adr-repo",
1364
+ "relationType": "implements"
1365
+ },
1366
+ {
1367
+ "id": "ff-diagram-drift--implements--adr-model",
1368
+ "sourceId": "ff-diagram-drift",
1369
+ "targetId": "adr-model",
1370
+ "relationType": "implements"
1371
+ },
1372
+ {
1373
+ "id": "ff-diagram-drift--implements--adr-wiki",
1374
+ "sourceId": "ff-diagram-drift",
1375
+ "targetId": "adr-wiki",
1376
+ "relationType": "implements"
1377
+ },
1378
+ {
1379
+ "id": "ff-diagram-images--implements--adr-adr-repo",
1380
+ "sourceId": "ff-diagram-images",
1381
+ "targetId": "adr-adr-repo",
1382
+ "relationType": "implements"
1383
+ },
1384
+ {
1385
+ "id": "ff-diagram-images--implements--adr-model",
1386
+ "sourceId": "ff-diagram-images",
1387
+ "targetId": "adr-model",
1388
+ "relationType": "implements"
1389
+ },
1390
+ {
1391
+ "id": "ff-diagram-images--implements--adr-wiki",
1392
+ "sourceId": "ff-diagram-images",
1393
+ "targetId": "adr-wiki",
1394
+ "relationType": "implements"
1395
+ }
1396
+ ]
1397
+ }