@crvouga/atlas 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +178 -617
  3. package/dist/bun/src/driver.d.ts +41 -7
  4. package/dist/bun/src/driver.js +47 -6
  5. package/dist/bun/src/index.d.ts +8 -0
  6. package/dist/bun/src/index.js +8 -0
  7. package/dist/core/src/cli.d.ts +14 -1
  8. package/dist/core/src/cli.js +30 -1
  9. package/dist/core/src/config.d.ts +70 -4
  10. package/dist/core/src/config.js +62 -3
  11. package/dist/core/src/events/cloudevents.d.ts +54 -9
  12. package/dist/core/src/events/cloudevents.js +60 -9
  13. package/dist/core/src/graph.d.ts +21 -0
  14. package/dist/core/src/graph.js +26 -0
  15. package/dist/core/src/index.d.ts +11 -0
  16. package/dist/core/src/index.js +11 -0
  17. package/dist/core/src/lint.d.ts +30 -0
  18. package/dist/core/src/lint.js +13 -0
  19. package/dist/core/src/plan.d.ts +39 -1
  20. package/dist/core/src/plan.js +28 -1
  21. package/dist/core/src/privacy.d.ts +29 -2
  22. package/dist/core/src/privacy.js +19 -2
  23. package/dist/core/src/report/formats.d.ts +34 -4
  24. package/dist/core/src/report/formats.js +24 -4
  25. package/dist/core/src/report/markdown.d.ts +15 -0
  26. package/dist/core/src/report/markdown.js +8 -0
  27. package/dist/core/src/run/clients.d.ts +44 -5
  28. package/dist/core/src/run/clients.js +46 -2
  29. package/dist/core/src/run/execute.d.ts +69 -16
  30. package/dist/core/src/run/execute.js +67 -16
  31. package/dist/core/src/run/frames.d.ts +13 -4
  32. package/dist/core/src/run/frames.js +19 -4
  33. package/dist/core/src/run/http.d.ts +34 -1
  34. package/dist/core/src/run/http.js +14 -1
  35. package/dist/core/src/run/types.d.ts +76 -3
  36. package/dist/core/src/run/types.js +19 -3
  37. package/dist/core/src/signals.d.ts +49 -5
  38. package/dist/core/src/signals.js +22 -5
  39. package/dist/core/src/spec/compose.d.ts +23 -1
  40. package/dist/core/src/spec/compose.js +10 -1
  41. package/dist/core/src/spec/index.d.ts +9 -1
  42. package/dist/core/src/spec/index.js +9 -1
  43. package/dist/core/src/spec/load.d.ts +22 -1
  44. package/dist/core/src/spec/load.js +31 -1
  45. package/dist/core/src/spec/parse.d.ts +16 -2
  46. package/dist/core/src/spec/parse.js +25 -2
  47. package/dist/core/src/spec/scxml.d.ts +25 -4
  48. package/dist/core/src/spec/scxml.js +36 -4
  49. package/dist/core/src/spec/types.d.ts +52 -1
  50. package/dist/core/src/spec/types.js +24 -0
  51. package/dist/detox/src/index.d.ts +54 -11
  52. package/dist/detox/src/index.js +45 -7
  53. package/dist/playwright/src/driver.d.ts +39 -3
  54. package/dist/playwright/src/driver.js +27 -3
  55. package/dist/playwright/src/index.d.ts +10 -0
  56. package/dist/playwright/src/index.js +10 -0
  57. package/dist/playwright/src/media.d.ts +50 -4
  58. package/dist/playwright/src/media.js +55 -4
  59. package/dist/playwright/src/signals.d.ts +44 -5
  60. package/dist/playwright/src/signals.js +29 -5
  61. package/dist/reports/src/attachment-files.d.ts +44 -0
  62. package/dist/reports/src/attachment-files.js +121 -0
  63. package/dist/reports/src/attachment-response.d.ts +31 -0
  64. package/dist/reports/src/attachment-response.js +55 -0
  65. package/dist/reports/src/aws-credentials.d.ts +48 -0
  66. package/dist/reports/src/aws-credentials.js +221 -0
  67. package/dist/reports/src/browser-navigation.d.ts +14 -0
  68. package/dist/reports/src/browser-navigation.js +7 -0
  69. package/dist/reports/src/bundle.d.ts +34 -2
  70. package/dist/reports/src/bundle.js +38 -2
  71. package/dist/reports/src/catalog.d.ts +34 -3
  72. package/dist/reports/src/catalog.js +17 -3
  73. package/dist/reports/src/cli-stores.d.ts +36 -0
  74. package/dist/reports/src/cli-stores.js +73 -0
  75. package/dist/reports/src/clock.d.ts +7 -2
  76. package/dist/reports/src/clock.js +5 -2
  77. package/dist/reports/src/completion-order.d.ts +18 -5
  78. package/dist/reports/src/completion-order.js +18 -5
  79. package/dist/reports/src/compose.d.ts +80 -0
  80. package/dist/reports/src/compose.js +117 -0
  81. package/dist/reports/src/copy-store.d.ts +29 -0
  82. package/dist/reports/src/copy-store.js +52 -0
  83. package/dist/reports/src/directory-outline.d.ts +38 -0
  84. package/dist/reports/src/directory-outline.js +103 -0
  85. package/dist/reports/src/directory-store.d.ts +20 -0
  86. package/dist/reports/src/directory-store.js +166 -0
  87. package/dist/reports/src/doctor.d.ts +29 -0
  88. package/dist/reports/src/doctor.js +83 -0
  89. package/dist/reports/src/effective-delta.d.ts +34 -0
  90. package/dist/reports/src/effective-delta.js +25 -0
  91. package/dist/reports/src/evidence-detail.d.ts +64 -0
  92. package/dist/reports/src/evidence-detail.js +92 -0
  93. package/dist/reports/src/evidence-live.d.ts +35 -5
  94. package/dist/reports/src/evidence-live.js +18 -2
  95. package/dist/reports/src/evidence-types.d.ts +68 -1
  96. package/dist/reports/src/evidence-types.js +5 -1
  97. package/dist/reports/src/evidence-view.d.ts +43 -4
  98. package/dist/reports/src/evidence-view.js +13 -2
  99. package/dist/reports/src/explorer-types.d.ts +40 -3
  100. package/dist/reports/src/explorer-types.js +8 -0
  101. package/dist/reports/src/explorer-versions.d.ts +9 -1
  102. package/dist/reports/src/explorer-versions.js +18 -1
  103. package/dist/reports/src/export-evidence.d.ts +16 -1
  104. package/dist/reports/src/export-evidence.js +52 -1
  105. package/dist/reports/src/fetcher.d.ts +27 -3
  106. package/dist/reports/src/fetcher.js +11 -3
  107. package/dist/reports/src/format-date.d.ts +6 -0
  108. package/dist/reports/src/format-date.js +6 -0
  109. package/dist/reports/src/format.d.ts +16 -0
  110. package/dist/reports/src/format.js +10 -0
  111. package/dist/reports/src/frames.d.ts +36 -3
  112. package/dist/reports/src/frames.js +22 -3
  113. package/dist/reports/src/hash.d.ts +18 -0
  114. package/dist/reports/src/hash.js +13 -0
  115. package/dist/reports/src/host.d.ts +29 -0
  116. package/dist/reports/src/host.js +64 -0
  117. package/dist/reports/src/html-frame.d.ts +5 -6
  118. package/dist/reports/src/html-frame.js +12 -1
  119. package/dist/reports/src/http-store.d.ts +52 -0
  120. package/dist/reports/src/http-store.js +145 -0
  121. package/dist/reports/src/http.d.ts +7 -0
  122. package/dist/reports/src/http.js +6 -0
  123. package/dist/reports/src/ingest.d.ts +54 -0
  124. package/dist/reports/src/ingest.js +210 -0
  125. package/dist/reports/src/init.d.ts +40 -0
  126. package/dist/reports/src/init.js +364 -0
  127. package/dist/reports/src/junit.d.ts +33 -6
  128. package/dist/reports/src/junit.js +87 -21
  129. package/dist/reports/src/keyboard.d.ts +20 -0
  130. package/dist/reports/src/keyboard.js +11 -0
  131. package/dist/reports/src/keys.d.ts +21 -3
  132. package/dist/reports/src/keys.js +21 -3
  133. package/dist/reports/src/layer-axes.d.ts +35 -5
  134. package/dist/reports/src/layer-axes.js +25 -5
  135. package/dist/reports/src/layer-catalog.d.ts +28 -1
  136. package/dist/reports/src/layer-catalog.js +18 -1
  137. package/dist/reports/src/layer-merge.d.ts +98 -9
  138. package/dist/reports/src/layer-merge.js +147 -31
  139. package/dist/reports/src/layer-source.d.ts +18 -0
  140. package/dist/reports/src/layer-source.js +11 -0
  141. package/dist/reports/src/layer-store.d.ts +42 -0
  142. package/dist/reports/src/layer-store.js +63 -5
  143. package/dist/reports/src/layer-types.d.ts +32 -1
  144. package/dist/reports/src/layers-route.d.ts +47 -4
  145. package/dist/reports/src/layers-route.js +86 -7
  146. package/dist/reports/src/media-types.d.ts +11 -0
  147. package/dist/reports/src/media-types.js +22 -0
  148. package/dist/reports/src/namespace-guard.d.ts +10 -1
  149. package/dist/reports/src/namespace-guard.js +10 -1
  150. package/dist/reports/src/navigation.d.ts +12 -0
  151. package/dist/reports/src/navigation.js +7 -0
  152. package/dist/reports/src/object-io.d.ts +11 -4
  153. package/dist/reports/src/object-io.js +4 -4
  154. package/dist/reports/src/object-store-conformance.d.ts +27 -0
  155. package/dist/reports/src/object-store-conformance.js +87 -0
  156. package/dist/reports/src/object-store.d.ts +33 -24
  157. package/dist/reports/src/object-store.js +17 -24
  158. package/dist/reports/src/parse-with.d.ts +16 -0
  159. package/dist/reports/src/parse-with.js +14 -0
  160. package/dist/reports/src/performance-part.d.ts +25 -1
  161. package/dist/reports/src/performance-part.js +15 -1
  162. package/dist/reports/src/performance.d.ts +22 -2
  163. package/dist/reports/src/performance.js +12 -2
  164. package/dist/reports/src/persist.d.ts +12 -3
  165. package/dist/reports/src/persist.js +12 -3
  166. package/dist/reports/src/phone.d.ts +18 -1
  167. package/dist/reports/src/phone.js +18 -1
  168. package/dist/reports/src/protocol.d.ts +26 -4
  169. package/dist/reports/src/protocol.js +15 -4
  170. package/dist/reports/src/publication.d.ts +21 -1
  171. package/dist/reports/src/publication.js +21 -1
  172. package/dist/reports/src/publish-checks.d.ts +35 -0
  173. package/dist/reports/src/publish-checks.js +122 -0
  174. package/dist/reports/src/publish.d.ts +42 -9
  175. package/dist/reports/src/publish.js +36 -7
  176. package/dist/reports/src/read.d.ts +46 -16
  177. package/dist/reports/src/read.js +38 -14
  178. package/dist/reports/src/recording-bundle.d.ts +13 -2
  179. package/dist/reports/src/recording-bundle.js +4 -2
  180. package/dist/reports/src/recording-keys.d.ts +15 -1
  181. package/dist/reports/src/recording-keys.js +15 -1
  182. package/dist/reports/src/remote-report.d.ts +28 -7
  183. package/dist/reports/src/remote-report.js +15 -7
  184. package/dist/reports/src/report-cli.d.ts +51 -0
  185. package/dist/reports/src/report-cli.js +485 -0
  186. package/dist/reports/src/report-index.d.ts +99 -0
  187. package/dist/reports/src/report-index.js +337 -0
  188. package/dist/reports/src/report-loader.d.ts +10 -0
  189. package/dist/reports/src/report-loader.js +6 -0
  190. package/dist/reports/src/report-parts.d.ts +29 -3
  191. package/dist/reports/src/report-parts.js +37 -3
  192. package/dist/reports/src/report-status.d.ts +48 -0
  193. package/dist/reports/src/report-status.js +156 -0
  194. package/dist/reports/src/report-types.d.ts +73 -0
  195. package/dist/reports/src/report-types.js +3 -0
  196. package/dist/reports/src/reporter.d.ts +67 -0
  197. package/dist/reports/src/reporter.js +128 -0
  198. package/dist/reports/src/reports-explorer-route.d.ts +541 -0
  199. package/dist/reports/src/reports-explorer-route.js +11 -0
  200. package/dist/reports/src/reports-list-route.d.ts +9 -0
  201. package/dist/reports/src/reports-list-route.js +9 -0
  202. package/dist/reports/src/reports-route.d.ts +561 -22
  203. package/dist/reports/src/reports-route.js +11 -3
  204. package/dist/reports/src/reports-store.d.ts +19 -2
  205. package/dist/reports/src/reports-store.js +10 -2
  206. package/dist/reports/src/resilient-cache.d.ts +14 -1
  207. package/dist/reports/src/resilient-cache.js +8 -1
  208. package/dist/reports/src/retention.d.ts +17 -1
  209. package/dist/reports/src/retention.js +5 -1
  210. package/dist/reports/src/run-bundle.d.ts +63 -0
  211. package/dist/reports/src/run-bundle.js +159 -0
  212. package/dist/reports/src/s3-store.d.ts +79 -0
  213. package/dist/reports/src/s3-store.js +295 -0
  214. package/dist/reports/src/scenario.d.ts +14 -4
  215. package/dist/reports/src/scenario.js +5 -4
  216. package/dist/reports/src/sigv4.d.ts +72 -0
  217. package/dist/reports/src/sigv4.js +96 -0
  218. package/dist/reports/src/snapshot-bundle.d.ts +24 -1
  219. package/dist/reports/src/snapshot-bundle.js +27 -2
  220. package/dist/reports/src/snapshot-surface.d.ts +20 -9
  221. package/dist/reports/src/snapshot-surface.js +32 -19
  222. package/dist/reports/src/source-content.d.ts +23 -0
  223. package/dist/reports/src/source-content.js +30 -1
  224. package/dist/reports/src/source-entries.d.ts +13 -0
  225. package/dist/reports/src/source-entries.js +6 -0
  226. package/dist/reports/src/source-part.d.ts +15 -0
  227. package/dist/reports/src/source-part.js +8 -0
  228. package/dist/reports/src/source-reader.d.ts +11 -0
  229. package/dist/reports/src/source-reader.js +5 -0
  230. package/dist/reports/src/spec-evidence.d.ts +12 -2
  231. package/dist/reports/src/spec-evidence.js +6 -2
  232. package/dist/reports/src/spec-inventory.d.ts +15 -1
  233. package/dist/reports/src/spec-inventory.js +22 -1
  234. package/dist/reports/src/spec-link.d.ts +28 -0
  235. package/dist/reports/src/spec-link.js +70 -0
  236. package/dist/reports/src/spec-set.d.ts +63 -0
  237. package/dist/reports/src/spec-set.js +177 -0
  238. package/dist/reports/src/status.d.ts +10 -0
  239. package/dist/reports/src/status.js +5 -0
  240. package/dist/reports/src/store-prefix.d.ts +28 -0
  241. package/dist/reports/src/store-prefix.js +22 -0
  242. package/dist/reports/src/store-url.d.ts +89 -0
  243. package/dist/reports/src/store-url.js +160 -0
  244. package/dist/reports/src/test-catalog-entity.d.ts +11 -0
  245. package/dist/reports/src/test-catalog-entity.js +6 -0
  246. package/dist/reports/src/types.d.ts +6 -1
  247. package/dist/reports/src/use-report-nav.d.ts +35 -0
  248. package/dist/reports/src/use-report-nav.js +12 -0
  249. package/dist/schema/src/api.d.ts +799 -0
  250. package/dist/schema/src/api.js +201 -0
  251. package/dist/schema/src/cli-results.d.ts +210 -0
  252. package/dist/schema/src/cli-results.js +124 -0
  253. package/dist/schema/src/common.d.ts +53 -0
  254. package/dist/schema/src/common.js +42 -0
  255. package/dist/schema/src/index.d.ts +14 -0
  256. package/dist/schema/src/index.js +14 -0
  257. package/dist/schema/src/layer.d.ts +2273 -0
  258. package/dist/schema/src/layer.js +462 -0
  259. package/dist/schema/src/manifest.d.ts +95 -0
  260. package/dist/schema/src/manifest.js +84 -0
  261. package/dist/schema/src/report-sources.d.ts +28 -0
  262. package/dist/schema/src/report-sources.js +25 -0
  263. package/dist/schema/src/runs-index.d.ts +16 -0
  264. package/dist/schema/src/runs-index.js +15 -0
  265. package/dist/schema/src/server-config.d.ts +93 -0
  266. package/dist/schema/src/server-config.js +73 -0
  267. package/dist/schema/src/spec.d.ts +69 -0
  268. package/dist/schema/src/spec.js +58 -0
  269. package/dist/server/src/app.d.ts +62 -0
  270. package/dist/server/src/app.js +419 -0
  271. package/dist/server/src/auth.d.ts +41 -0
  272. package/dist/server/src/auth.js +59 -0
  273. package/dist/server/src/config.d.ts +83 -0
  274. package/dist/server/src/config.js +187 -0
  275. package/dist/server/src/dev.d.ts +12 -0
  276. package/dist/server/src/dev.js +80 -0
  277. package/dist/server/src/events.d.ts +29 -0
  278. package/dist/server/src/events.js +101 -0
  279. package/dist/server/src/host.d.ts +30 -0
  280. package/dist/server/src/host.js +115 -0
  281. package/dist/server/src/index.d.ts +16 -0
  282. package/dist/server/src/index.js +16 -0
  283. package/dist/server/src/llms.d.ts +19 -0
  284. package/dist/server/src/llms.js +63 -0
  285. package/dist/server/src/main.d.ts +30 -0
  286. package/dist/server/src/main.js +112 -0
  287. package/dist/server/src/openapi.d.ts +59 -0
  288. package/dist/server/src/openapi.js +374 -0
  289. package/dist/server/src/problem.d.ts +8 -0
  290. package/dist/server/src/problem.js +39 -0
  291. package/dist/server/src/site.d.ts +13 -0
  292. package/dist/server/src/site.js +43 -0
  293. package/dist/server/src/store-api.d.ts +28 -0
  294. package/dist/server/src/store-api.js +159 -0
  295. package/dist/server/src/validate.d.ts +71 -0
  296. package/dist/server/src/validate.js +197 -0
  297. package/dist/vitest/src/index.d.ts +27 -5
  298. package/dist/vitest/src/index.js +18 -5
  299. package/dist/webdriver/src/driver.d.ts +63 -11
  300. package/dist/webdriver/src/driver.js +57 -6
  301. package/dist/webdriver/src/index.d.ts +8 -0
  302. package/dist/webdriver/src/index.js +1 -0
  303. package/dist/webdriver/src/protocol.d.ts +75 -6
  304. package/dist/webdriver/src/protocol.js +79 -6
  305. package/docs/agents.md +137 -0
  306. package/docs/deploying.md +345 -0
  307. package/docs/dogfooding.md +175 -0
  308. package/docs/extending.md +242 -0
  309. package/docs/integrating.md +485 -0
  310. package/docs/reference/bun.md +141 -0
  311. package/docs/reference/cli.md +146 -0
  312. package/docs/reference/core.md +2426 -0
  313. package/docs/reference/detox.md +150 -0
  314. package/docs/reference/http-api.md +303 -0
  315. package/docs/reference/playwright.md +303 -0
  316. package/docs/reference/reports.md +7098 -0
  317. package/docs/reference/schema.md +1651 -0
  318. package/docs/reference/server.md +685 -0
  319. package/docs/reference/vitest.md +45 -0
  320. package/docs/reference/webdriver.md +330 -0
  321. package/docs/report-backends.md +144 -0
  322. package/docs/report-contract.md +400 -0
  323. package/docs/reporting-issues.md +160 -0
  324. package/docs/server.md +285 -0
  325. package/docs/statecharts.md +641 -0
  326. package/llms-full.txt +3506 -0
  327. package/llms.txt +47 -0
  328. package/package.json +32 -4
  329. package/packages/core/README.md +2 -1
  330. package/packages/reports/README.md +65 -0
  331. package/packages/reports/STORAGE.md +4 -0
  332. package/packages/schema/README.md +14 -0
  333. package/packages/schema/schemas/check-detail.schema.json +1032 -0
  334. package/packages/schema/schemas/checks-result.schema.json +26 -0
  335. package/packages/schema/schemas/command-error.schema.json +35 -0
  336. package/packages/schema/schemas/doctor-result.schema.json +60 -0
  337. package/packages/schema/schemas/effective-delta.schema.json +490 -0
  338. package/packages/schema/schemas/effective-evidence.schema.json +471 -0
  339. package/packages/schema/schemas/evidence-page.schema.json +271 -0
  340. package/packages/schema/schemas/hello-event.schema.json +22 -0
  341. package/packages/schema/schemas/init-plan.schema.json +347 -0
  342. package/packages/schema/schemas/layer-rows.schema.json +199 -0
  343. package/packages/schema/schemas/layer.schema.json +2888 -0
  344. package/packages/schema/schemas/merge-result.schema.json +40 -0
  345. package/packages/schema/schemas/outline.schema.json +62 -0
  346. package/packages/schema/schemas/problem.schema.json +37 -0
  347. package/packages/schema/schemas/publish-checks.schema.json +1413 -0
  348. package/packages/schema/schemas/publish-result.schema.json +168 -0
  349. package/packages/schema/schemas/ready.schema.json +68 -0
  350. package/packages/schema/schemas/report-event.schema.json +100 -0
  351. package/packages/schema/schemas/report-status.schema.json +370 -0
  352. package/packages/schema/schemas/server-config.schema.json +194 -0
  353. package/packages/schema/schemas/server-info.schema.json +114 -0
  354. package/packages/schema/schemas/spec-set.schema.json +103 -0
  355. package/packages/schema/schemas/store-listing.schema.json +29 -0
  356. package/packages/schema/schemas/store-write-result.schema.json +28 -0
  357. package/packages/schema/schemas/stream-result.schema.json +59 -0
  358. package/packages/server/README.md +43 -0
  359. package/packages/server/openapi.json +6699 -0
  360. package/packages/visualizer/README.md +21 -0
  361. package/packages/visualizer/src/app/AppShell.tsx +9 -2
  362. package/packages/visualizer/src/app/report-sources.tsx +6 -4
  363. package/packages/visualizer/src/app/router.tsx +3 -3
  364. package/packages/visualizer/src/components/Header.module.css +35 -0
  365. package/packages/visualizer/src/components/Header.tsx +40 -3
  366. package/packages/visualizer/src/data/adapters/adapter.ts +5 -17
  367. package/packages/visualizer/src/data/adapters/index.ts +10 -1
  368. package/packages/visualizer/src/evidence/api.ts +14 -2
  369. package/packages/visualizer/src/evidence/artifacts.module.css +213 -0
  370. package/packages/visualizer/src/evidence/artifacts.tsx +272 -0
  371. package/packages/visualizer/src/evidence/check-detail.tsx +3 -1
  372. package/packages/visualizer/src/evidence/evidence-context.tsx +74 -12
  373. package/packages/visualizer/src/evidence/spec-page.tsx +23 -16
  374. package/packages/visualizer/src/find/Finder.tsx +1 -7
  375. package/packages/visualizer/src/find/open.ts +4 -0
  376. package/packages/visualizer/src/live/live-stream.ts +204 -0
  377. package/packages/visualizer/src/runtime.ts +19 -0
  378. package/packages/visualizer/vite/atlas-server-proxy.ts +36 -0
  379. package/packages/visualizer/vite.config.ts +11 -3
@@ -0,0 +1,641 @@
1
+ # Executable statecharts
2
+
3
+ Write down how a product behaves as statecharts in open formats, then let Atlas lint them, plan
4
+ paths that cover every transition, run those paths against the real product through any driver (a
5
+ browser, a phone, a plain function), and write a manifest of what happened, with screenshots, video
6
+ clips, captions, business events and standard test reports. Each run publishes as a layer
7
+ (`atlas report publish --manifest`), so it combines with every other suite's evidence. This page covers
8
+ running them, from a runnable example to the visualizer.
9
+
10
+ ```
11
+ specs/ atlas lint the charts are pure, reachable, free of silent dead ends,
12
+ app.scxml ──▶ and every journey replays
13
+ child.machine.yaml atlas plan curated journeys + shortest paths covering every transition
14
+ journeys.yaml atlas run each path against the product, through a driver
15
+ │
16
+ ▼
17
+ atlas-runs/<run>/manifest.json, junit.xml, ctrf.json, chart.mmd, media/
18
+ ```
19
+
20
+ The spec is the source of truth for the product's behaviour, not for the test code: a state says
21
+ what a person sees, an event says what happens in business language ("Adds a todo", "Sync fails"),
22
+ and the implementation says how a driver makes each event happen and recognises each state.
23
+
24
+ ## Quick start: the todo example
25
+
26
+ [`examples/todo`](https://github.com/crvouga/atlas/tree/main/examples/todo) is a dependency-free web app (static HTML and vanilla JavaScript
27
+ served by a small Node server) specified as two charts:
28
+
29
+ - `specs/todo-app.scxml`, the root chart in SCXML: a welcome screen, a "Setting up" state that
30
+ invokes the child chart, and a `<parallel>` "Working on the list" state whose "Sync" and "List"
31
+ regions change independently.
32
+ - `specs/getting-started.machine.yaml`, the child chart in XState YAML. Its two final states hand
33
+ back to the parent through `meta.doneEvent`.
34
+ - `specs/journeys.yaml`, four curated journeys.
35
+ - `specs/getting-started.feature` and `specs/working-the-list.feature`, the same stories in Gherkin.
36
+ - `specs/todo.qnt`, the list, its sync, and its actions as a Quint model.
37
+
38
+ The visualizer lists the features under Gherkin and the model under Quint.
39
+
40
+ It has every kind of event: user events (taps and typing), a **system** event ("Sync fails", which
41
+ the test triggers through a real HTTP endpoint on the example server), a **time** event ("Retry
42
+ timer elapses", which jumps Playwright's clock 30 seconds) and **hand-off** events from the child
43
+ chart. The server reports business events as CloudEvents to an Atlas `cloudEventsHttpSource`, so
44
+ the states' `meta.events` are checked on every run.
45
+
46
+ This repository runs on [Bun](https://bun.sh). Video clips and WebP thumbnails need FFmpeg on the
47
+ `PATH`. From the repository root:
48
+
49
+ ```sh
50
+ bun install
51
+ bunx playwright install chromium
52
+
53
+ bun run example:lint # pure, reachable, no undocumented dead ends, journeys replay, everything implemented
54
+ bun run example:plan # 4 journeys + 1 generated path cover all 14 transitions
55
+ bun run example:fast # run every path quickly
56
+ bun run example:run # statechart showcase, then the Gherkin features and the Quint model
57
+ bun test examples # the same spec against an in-memory model, as a test suite
58
+
59
+ bun run example:clients # clients/: one chart across a phone, a desktop and the sync server at once
60
+ bun run example:clients:bun # the same, with the desktop in Bun's WebKit and the phone in Playwright's Chromium
61
+ ```
62
+
63
+ To run every chart of the example and browse the results, run these in separate terminals; the
64
+ visualizer updates when a run finishes.
65
+
66
+ ```sh
67
+ bun run atlas:run # example:clients, then example:run: every chart of the example, in showcase mode
68
+ bun run atlas:viz # the example's specs, chart runs, and layered reports
69
+ ```
70
+
71
+ Each config writes its own run and the visualizer shows one run at a time: the latest is the
72
+ single-browser run, and the run across clients is the one before it in the run picker.
73
+
74
+ `bun run viz:dev` opens the full coffee example with a layered report, without waiting
75
+ for a run. Gherkin, Quint, DMN, Alloy and OpenSLO documents sit beside the charts. The same scenarios
76
+ are filled by separate layers across desktop web, mobile web, iOS and Android, and across versions,
77
+ branches and backends (this machine, shared reports, and a device lab). A layer that repeated one
78
+ scenario leaves the others as the last layer that ran them. One feature is left with no results.
79
+ **Sources** in the header switches any of those off. The chart runs stay on the statechart map.
80
+
81
+ `bun run atlas:viz` opens the todo example the same way. The Gherkin, Quint, DMN, Alloy and OpenSLO
82
+ tabs already show five layers, so each environment is visible before a run. `example:run` adds one
83
+ desktop web layer for the scenarios and traces it actually ran. That layer replaces only those
84
+ desktop web results. The other environments stay. `ATLAS_REPORTS_MODULE` replaces this example API
85
+ with a host's reports.
86
+
87
+ A showcase run ends with:
88
+
89
+ ```
90
+ States 14/14 passed, 0 failed, 0 not reached
91
+ Transitions 14/14 passed, 0 failed, 0 not reached
92
+ Manifest: examples/todo/atlas-runs/<run-id>/manifest.json
93
+ ```
94
+
95
+ `example:run` then runs the Gherkin features in a browser and the Quint model, and publishes that desktop web layer beside the ones already in the report.
96
+
97
+ `bun test examples` runs [`model.test.ts`](https://github.com/crvouga/atlas/blob/main/examples/todo/model.test.ts): the same charts and journeys
98
+ against `TodoModel`, a plain class, through `functionDriver` and `describeAtlas`. Only the driver
99
+ and the implementation differ, which is the point: the spec belongs to the product, not to one
100
+ test tool.
101
+
102
+ ## Writing specs
103
+
104
+ ### Files
105
+
106
+ Atlas loads every chart and journeys file directly inside the specs directory:
107
+
108
+ - `*.scxml`, `*.machine.json`, `*.machine.yaml` (or `.yml`): one chart each;
109
+ - `journeys.yaml` (or `.yml`, `.json`): the curated journeys.
110
+
111
+ The **root** chart is the one no other chart invokes. A chart's id is the SCXML `name` attribute or
112
+ the XState `id`.
113
+
114
+ ### The pure subset
115
+
116
+ Atlas walks charts without running any code, so it executes only the parts of a statechart that
117
+ are pure structure:
118
+
119
+ - states, nesting (`initial`), `parallel` regions and `final` states;
120
+ - event transitions, written as a target (`Opens: Open` or `{ target: '#Open' }`);
121
+ - `invoke` that names another chart (`src`, `id`, `onDone`), composed statically;
122
+ - `meta`.
123
+
124
+ Guards, actions, `entry`/`exit`, `context`, `after` (delays), `always`, `output` and `onError` are
125
+ lint errors. A condition becomes a state or an event instead: "Payment declined" is an event the
126
+ system sends, not a guard on "Pays"; "30 seconds pass" is a time event, not an `after`.
127
+
128
+ State names are global across the composed product (transitions target `#<name>`), so they must be
129
+ unique across charts, and they cannot contain dots. Names are business language and may contain
130
+ spaces.
131
+
132
+ ### `meta`
133
+
134
+ | Field | Meaning |
135
+ | --- | --- |
136
+ | `description` | What is true in this state. Required on every state by default (`requiredMeta` changes that). |
137
+ | `snapshot` | What a person sees, in words. |
138
+ | `events` | Business events that happen on entering the state, checked against what event sources observed. |
139
+ | `checks` | Things to verify on screen, quoted from the spec; the implementation's `checks()` returns their results. |
140
+ | `confidence` | `confirmed` or `assumed`. |
141
+ | `source` | Where the behaviour is documented. |
142
+ | `deadEnd` | Why a state with no way out is meant to be one. Without it, a dead end is a lint error. |
143
+ | `doneEvent` | On a child chart's final state: the event its parent receives from that final. |
144
+ | `childMachine`, `childFinalEvents` | Legacy composition on the parent state. Prefer `invoke`. |
145
+
146
+ ### SCXML conventions
147
+
148
+ SCXML ids are XML IDs and event attributes are token lists, so business names travel in an
149
+ `atlas:name` attribute next to a token id. Metadata lives in the `atlas` namespace, as SCXML allows:
150
+
151
+ ```xml
152
+ <scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:atlas="https://github.com/crvouga/atlas/ns/1"
153
+ version="1.0" datamodel="null" name="Todo app" initial="welcome">
154
+ <state id="welcome" atlas:name="Welcome">
155
+ <atlas:meta>
156
+ <atlas:description>The first screen a person sees.</atlas:description>
157
+ <atlas:event>App opened</atlas:event>
158
+ </atlas:meta>
159
+ <transition event="starts-setup" atlas:name="Starts setup" target="setting-up"/>
160
+ </state>
161
+ <state id="setting-up" atlas:name="Setting up">
162
+ <atlas:meta><atlas:description>The child chart runs here.</atlas:description></atlas:meta>
163
+ <invoke id="getting-started" src="getting-started.machine.yaml" atlas:name="Getting started"/>
164
+ <transition event="done.invoke.getting-started" target="working"/>
165
+ </state>
166
+ ...
167
+ </scxml>
168
+ ```
169
+
170
+ `<atlas:event>`, `<atlas:check>` and `<atlas:source>` repeat to form lists; `<atlas:dead-end>` is
171
+ `meta.deadEnd`; a final state's `atlas:done-event` attribute is `meta.doneEvent`. `atlas export
172
+ --format scxml` writes any chart (or the composed product) back out in this form, and reading it
173
+ again gives the same chart.
174
+
175
+ ### Composition
176
+
177
+ A parent state runs a child chart with any of:
178
+
179
+ 1. XState `invoke: { src: 'Child', id: 'child', onDone: '#Next' }`, or SCXML `<invoke id="child">`
180
+ plus a `done.invoke.child` transition;
181
+ 2. `meta.doneEvent` on the child's final states, each naming the event the parent receives, which
182
+ the parent handles in its `on` (a final whose event the parent does not handle goes to
183
+ `onDone`);
184
+ 3. legacy `meta.childMachine: 'Child'` and `meta.childFinalEvents: { <final>: <event> }` on the
185
+ parent state.
186
+
187
+ Atlas inlines each child into the state that invokes it. The child's final states stay as states
188
+ (so they keep their screenshots and checks) but take the parent's transition for their hand-off
189
+ event. When a path reaches one, the hand-off happens by itself: journeys never list hand-off
190
+ events, and the planner inserts them. Give each hand-off event an implementation of kind
191
+ `hand-off` (usually a no-op); events without an implementation count as blocked.
192
+
193
+ ### Journeys
194
+
195
+ ```yaml
196
+ journeys:
197
+ Keeps working through a sync outage:
198
+ description: Adds todos while the sync is down, and the retry catches up.
199
+ events: [Starts setup, Skips naming the list, Adds a todo, Sync fails, Adds a todo, Retry timer elapses]
200
+ endsIn: [Some todos open, Synced]
201
+ ```
202
+
203
+ The linter replays each journey through the composed chart and checks it ends in every `endsIn`
204
+ state. Each journey runs as its own path; generated paths only cover what journeys leave out.
205
+
206
+ ## Implementing a spec
207
+
208
+ An implementation tells a driver how to make each event happen and how to recognise each state.
209
+ Events are keyed by their exact name in the spec.
210
+
211
+ ```ts
212
+ import { defineConfig } from '@crvouga/atlas';
213
+ import { playwrightDriver, role, screen, text } from '@crvouga/atlas/playwright';
214
+
215
+ export default defineConfig({
216
+ specs: './specs',
217
+ driver: () => playwrightDriver({ clock: true }),
218
+ targets: ['http://127.0.0.1:4317'],
219
+ implementation: {
220
+ async setup({ page }) {
221
+ await page.goto('http://127.0.0.1:4317');
222
+ },
223
+ events: {
224
+ 'Adds a todo': {
225
+ kind: 'user',
226
+ how: 'Types a todo and taps "Add".',
227
+ async run({ page, user }) {
228
+ await user.type(page.getByLabel('New todo'), 'Water the plants', 'New todo');
229
+ await user.tap(page.getByRole('button', { name: 'Add' }), 'Add');
230
+ }
231
+ },
232
+ 'Retry timer elapses': {
233
+ kind: 'time',
234
+ how: 'Jumps the page clock 30 seconds.',
235
+ run: ({ page }) => page.clock.fastForward(30_000)
236
+ }
237
+ },
238
+ states: {
239
+ 'No todos': screen({ all: [text('Nothing to do yet')] }),
240
+ Offline: screen({ all: [text('Offline')], none: [text('All changes synced')] })
241
+ }
242
+ }
243
+ });
244
+ ```
245
+
246
+ **Events** (`EventImplementation<C>`): `kind` is `user`, `system`, `time` or `hand-off`; `how` is a
247
+ plain-language note shown in reports; `run(ctx, tools)` makes it happen; `prepare(ctx, tools)`
248
+ creates test data before the path starts; `blocked: '<reason>'` marks an event that cannot run yet,
249
+ so paths stop before it and report why.
250
+
251
+ **States** (`StateImplementation<C>`): `recognize(ctx)` returns whether the state is showing and the
252
+ signals it looked at. Optional: `checks(ctx)` (results for `meta.checks`; a failed check fails the
253
+ state), `lookIn(ctx)` (where to look when the change happens off screen, such as reloading or
254
+ opening another tab), `settle(ctx)` (within-state actions after the screenshot, such as
255
+ dismissing a toast), `transient` (shown too briefly to wait for) and `sameAs` (a state the UI cannot
256
+ tell apart from this one).
257
+
258
+ **Setup**: `setup(ctx, { path, tools })` puts the product in the path's start configuration;
259
+ `canStart(active)` returns `true` or the reason a start configuration cannot be set up yet. It is
260
+ optional when seeds cover every start.
261
+
262
+ **Seeds** (`seeds: Record<string, Seed<C>>`): see [Seeds and parallel runs](#seeds-and-parallel-runs).
263
+
264
+ **Correlation**: `correlate(ctx)` returns ids (a user id, a trace id) that tell this attempt's
265
+ business events from those of attempts running beside it.
266
+
267
+ Only leaf states need recognisers. `atlas lint --require-implementations` lists every event and
268
+ leaf state in scope that has no implementation.
269
+
270
+ ## Seeds and parallel runs
271
+
272
+ A chart of a whole product is deep: a member reaches a results screen after signing up,
273
+ onboarding, paying and booking. Walking every path from the initial state repeats that prefix
274
+ in every path, so a run gets slower the more of the product it covers. Seeds remove the prefix.
275
+
276
+ A seed puts the system directly in one configuration of the chart, usually through an API or the
277
+ database: create a member who has paid, sign them in, open the screen.
278
+
279
+ ```ts
280
+ implementation: {
281
+ seeds: {
282
+ 'Paid member': {
283
+ at: 'Paid', // a state name, or a full state value
284
+ how: 'Creates a paid member through the admin API and signs in.',
285
+ async run({ page, api }) {
286
+ const member = await api.createMember({ plan: 'paid' });
287
+ await page.goto(`/sign-in?token=${member.token}`);
288
+ }
289
+ }
290
+ },
291
+ events: { /* … */ },
292
+ states: { /* … */ }
293
+ }
294
+ ```
295
+
296
+ With seeds, the plan changes in three ways:
297
+
298
+ - **Journeys are cut at seeded configurations.** A journey is replayed from the initial state, and
299
+ wherever it passes through a configuration a seed produces, it is cut. Each stretch becomes a path
300
+ that starts from that seed. A stretch that several journeys share becomes one path. The manifest's
301
+ `journeys` lists the paths each journey is made of. A journey passes when all of them pass, fails
302
+ when one fails, and is `not-reached` while any is blocked.
303
+ - **Generated paths start from the nearest seed.** A breadth-first search from every start point at
304
+ once finds, for each uncovered transition, the shortest way to take it from any seed (or from
305
+ `setup`'s start). Ties go to the seed declared first.
306
+ - **Redundant paths are dropped.** A generated path that is a prefix of another path from the same
307
+ start is not planned.
308
+
309
+ The plan is deterministic. The same chart, journeys and seeds give the same paths, ids and keys
310
+ (`key` hashes the start and the events) on every machine, so results can be composed:
311
+
312
+ - **Workers.** `--workers n` (or `workers` in the config) runs n path attempts at once. Each attempt
313
+ gets its own driver context. The longest paths go first, timed by earlier runs.
314
+ - The driver's `concurrency` caps the worker count. Playwright and Bun contexts and HTTP clients
315
+ run side by side. A WebDriver session or a Detox device runs one at a time unless you raise it.
316
+ - The manifest is a pure fold of the path outcomes in plan order, so the same outcomes give the
317
+ same report whatever order they finished in.
318
+ - **Shards.** `--shard i/n` runs one part of the plan, split by the plan alone, so every machine
319
+ agrees on the split. `atlas merge <run-dir>...` composes the shards into one run, with their media
320
+ copied in.
321
+ - **Reruns.** `--rerun-failed` keeps the passed paths of the newest run, matched by key, and runs
322
+ the rest. The result is still one complete run.
323
+ - **Areas.** `--seed <name>` (repeatable) runs only the paths that start from that seed (`start`
324
+ for paths `setup` starts). `--state <name>` scopes the run to one state of the chart. With these you can
325
+ run one area of the product on its own, then merge it into a full run.
326
+
327
+ Seeds are what make the composition sound: a seed must leave the system exactly as the steps that
328
+ lead there would. Atlas checks this both ways and reports it:
329
+ - A seeded path must first recognise its start state.
330
+ - The manifest's `seeds` lists, for each seed, the passed paths that reached the same states through
331
+ real steps (`verifiedBy`).
332
+
333
+ A seed nobody reaches through the steps is a claim that has not been checked yet. In the
334
+ visualizer, seeded states carry a "Seeded" tag.
335
+
336
+ Business events and parallel runs: a shared source, such as a log file, sees every attempt's events.
337
+ `EventSource.mark()` returns a position that `collect(mark)` reads from, so attempts don't consume
338
+ each other's marks.
339
+ - With `correlate(ctx)`, only events and log lines that mention one of the attempt's ids count.
340
+ - Without it, a run on several workers reports business events as "no signal" rather than guessing.
341
+
342
+ ## Drivers
343
+
344
+ | Driver | Package | Plays | Speed | Clips |
345
+ | --- | --- | --- | --- | --- |
346
+ | `functionDriver(create)` | `@crvouga/atlas` | A domain model, a CLI, anything reachable from code | Microseconds | No |
347
+ | `httpDriver(baseUrl)` | `@crvouga/atlas` | An API client with a cookie jar: a partner system, an operator API, a back office job | Milliseconds | No |
348
+ | `bunWebViewDriver()` | `@crvouga/atlas/bun` | A web app in Bun's built-in browser (WebKit on macOS, Chrome elsewhere) | A view in milliseconds, screenshots in about 10 ms | From screenshots |
349
+ | `playwrightDriver()` | `@crvouga/atlas/playwright` | A web app (or React Native on the web) in Chromium, with a fake clock | About a second per context | Screencast with a touch overlay |
350
+ | `webdriverDriver()` | `@crvouga/atlas/webdriver` | Safari, Chrome, Firefox, Edge; native iOS and Android apps through Appium | Depends on the server | From screenshots, or Appium's recorder |
351
+ | `detoxDriver()` | `@crvouga/atlas/detox` | A React Native app, inside a Detox test run | Depends on the device | Detox artifacts |
352
+
353
+ The Bun, Playwright, WebDriver and Detox contexts all provide a `SignalContext` (`goto`,
354
+ `isVisible`, `user.tap`, `user.type`), and they resolve the same signals (`testId`, `role`, `label`,
355
+ `text`, `css` from `@crvouga/atlas/signals`), each against its own UI tree: the DOM, or the
356
+ accessibility tree of a native app, where a test ID is the accessibility identifier (React
357
+ Native's `testID`). An implementation written
358
+ against `SignalContext` with `screen` from `@crvouga/atlas/signals` runs on any of them unchanged.
359
+
360
+ `bunWebViewDriver` needs the Bun runtime: run `bun --bun atlas run`. The `atlas` binary runs on
361
+ Node (through tsx) or Bun, and Playwright works under Bun too, so one run can mix Bun's WebKit and
362
+ Playwright's Chromium.
363
+
364
+ ## Several clients in one run
365
+
366
+ Product flows cross devices: a member books on an iOS app, an operator approves in a web
367
+ dashboard, a partner confirms over an API. `combineDrivers` runs several drivers as the named
368
+ clients of one run, and `combineImplementations` merges what each client does and shows:
369
+
370
+ ```ts
371
+ import { combineDrivers, combineImplementations, defineConfig, httpDriver, type HttpClient } from '@crvouga/atlas';
372
+ import { role, screen, text, type SignalContext } from '@crvouga/atlas/signals';
373
+ import { playwrightDriver } from '@crvouga/atlas/playwright';
374
+ import { accessibilityId, webdriverDriver } from '@crvouga/atlas/webdriver';
375
+
376
+ type Clients = { member: SignalContext; operator: SignalContext; partner: HttpClient };
377
+
378
+ export default defineConfig<Clients>({
379
+ specs: './specs',
380
+ driver: combineDrivers<Clients>(
381
+ {
382
+ member: webdriverDriver({
383
+ url: 'http://127.0.0.1:4723', // Appium
384
+ capabilities: { platformName: 'iOS', 'appium:automationName': 'XCUITest', 'appium:app': './build/App.app' }
385
+ }),
386
+ operator: playwrightDriver({ baseUrl: 'http://127.0.0.1:3000', device: { viewport: { width: 1280, height: 800 } } }),
387
+ partner: httpDriver('http://127.0.0.1:4000')
388
+ },
389
+ { screens: 'all' }
390
+ ),
391
+ implementation: combineImplementations<Clients>(
392
+ {
393
+ member: {
394
+ events: { 'Requests a visit': { kind: 'user', how: 'Taps "Request".', run: (m) => m.user.tap(role('button', 'Request'), 'Request') } },
395
+ states: { 'Visit confirmed': screen({ all: [text('Confirmed')] }) }
396
+ },
397
+ operator: {
398
+ setup: (o) => o.goto('/queue'),
399
+ events: { 'Operator approves': { kind: 'user', how: 'Approves it in the queue.', run: (o) => o.user.tap(role('button', 'Approve'), 'Approve') } },
400
+ states: { 'Waiting for approval': screen({ all: [role('row', 'New request')] }) }
401
+ },
402
+ partner: {
403
+ events: { 'Partner confirms': { kind: 'system', how: 'POSTs the confirmation webhook.', run: (p) => p.post('/webhooks/confirm', { ok: true }).then(() => undefined) } }
404
+ }
405
+ },
406
+ { setup: async ({ partner }) => void (await partner.post('/test/reset')) }
407
+ )
408
+ });
409
+ ```
410
+
411
+ - Each client's part is written against that client's own context, so every driver's helpers
412
+ work unchanged; `shared` (the second argument) holds setup and events that need several clients
413
+ at once. `shared.setup` runs first, then each client's setup in order.
414
+ - `onClient(name, impl)` lifts a single event or state implementation to a client.
415
+ - An event's client is recorded for its clip; a state's client is the screen it is recognised and
416
+ photographed on. With `screens: 'all'`, every other client's screen is captured at the same
417
+ moment (`screenshot.also`).
418
+ - Timeline entries, clips, states and transitions carry `client` in the manifest;
419
+ `run.environment.clients` names the driver each client ran on; a failed attempt keeps one trace
420
+ per client.
421
+ - If one client cannot open (no simulator booted), the others are closed and the attempt fails
422
+ naming that client.
423
+
424
+ [`examples/todo/clients`](https://github.com/crvouga/atlas/tree/main/examples/todo/clients) runs a chart (`specs/clients/shared-list.scxml`)
425
+ across a phone, a desktop and the sync server; pick each device's driver with `ATLAS_PHONE` and
426
+ `ATLAS_DESKTOP` (`playwright`, `bun` or `webdriver`).
427
+
428
+ ## Writing a driver
429
+
430
+ A driver owns the thing under test for one path attempt: a browser context, a device, a model or
431
+ an API client. Only `open` and `close` are required.
432
+
433
+ ```ts
434
+ type Focus = { client?: string };
435
+
436
+ type Driver<C> = {
437
+ name: string;
438
+ open(input: { path: PlannedPath; attempt: number; mode: RunMode; directory: string; timeline: Timeline }): Promise<C>;
439
+ close(ctx: C, input: { failed: boolean; traceFile: string }): Promise<{ trace?: string; traces?: Record<string, string> } | void>;
440
+ screenshot?(ctx: C, file: string, focus?: Focus): Promise<Image | null>;
441
+ record?(ctx: C, workDirectory: string, focus?: Focus): Promise<{ stop(output: string): Promise<Clip | null> }>;
442
+ text?(ctx: C, focus?: Focus): Promise<string>;
443
+ hold?(ctx: C, ms: number, focus?: Focus): Promise<void>;
444
+ pacing?: { before: number; after: number };
445
+ clients?: Record<string, string>;
446
+ concurrency?: number;
447
+ dispose?(): Promise<void>;
448
+ };
449
+ ```
450
+
451
+ `focus` says which client a multi-client run is looking at; single-client drivers ignore it.
452
+ A driver without a native screen recorder can encode clips from screenshots with
453
+ `recordFrames(capture, workDirectory)`.
454
+
455
+ - `open` returns a fresh context for each attempt; `close` may return the path of a trace file
456
+ (Playwright writes one for failed attempts).
457
+ - `screenshot` and `record` produce media; `record` is used only in showcase mode, one clip per
458
+ transition.
459
+ - `text` returns the visible text, for the privacy scan.
460
+ - `concurrency` is how many contexts can be open at once (1 when omitted). Workers never exceed
461
+ it, so a driver of one device stays sequential while browser contexts run side by side.
462
+ - `timeline.add({ kind, label, ... })` logs taps, typing, system calls and time jumps; they become
463
+ each clip's captions.
464
+
465
+ For anything you can reach from Node (a domain model, an API client, a CLI), `functionDriver(create)`
466
+ is a complete driver:
467
+
468
+ ```ts
469
+ import { functionDriver } from '@crvouga/atlas';
470
+
471
+ const driver = functionDriver(() => new TodoModel());
472
+ ```
473
+
474
+ ## CLI
475
+
476
+ ```
477
+ atlas lint [--config atlas.config.ts | --specs <dir>] [--require-implementations]
478
+ atlas plan [--config atlas.config.ts] [--state <name>]
479
+ atlas run [--config atlas.config.ts] [--mode fast|showcase] [--workers n] [--state <name>]
480
+ [--seed <name>]... [--paths id,id] [--shard i/n] [--rerun-failed | --reuse <run-dir>]
481
+ [--no-retry] [--output <dir>]
482
+ atlas merge [--config atlas.config.ts] [--output <dir>] <run-dir> <run-dir>...
483
+ atlas export --specs <dir> --format scxml|mermaid|markdown|json [--out <file>]
484
+ atlas report publish|stream|status|merge|doctor|policy … layered evidence for any kind of spec (below)
485
+ ```
486
+
487
+ - `lint` with `--specs` checks charts and journeys alone; with a config it also lists missing
488
+ implementations, and `--require-implementations` makes them errors.
489
+ - `plan` prints the seeds and each path with:
490
+ - its seed and step count;
491
+ - what blocks it;
492
+ - the paths each journey is made of;
493
+ - the total and longest path length, and how many transitions stay uncovered.
494
+ - `run` exits non-zero when a path fails or the privacy scan finds something. `--paths` runs only
495
+ the given path ids; `--no-retry` skips the retry of failed paths.
496
+ - `--workers`, `--shard`, `--seed`, `--state`, `--rerun-failed` and `--reuse` are described in
497
+ [Seeds and parallel runs](#seeds-and-parallel-runs).
498
+ - `merge` composes runs of the same plan (shards, or a rerun and its earlier run) into one run.
499
+ - `export` writes the composed product (every child inlined) as SCXML, Mermaid, Markdown or
500
+ XState JSON. The Markdown is a readable map for the people who own the product: one section per
501
+ area (each parallel region apart), every state with its description and what the user sees (a
502
+ `snapshot` written as an identifier is left out), a table of every event that can happen there
503
+ and where it leads, then the named journeys.
504
+
505
+ The config file is TypeScript (loaded with `tsx`) and defaults to `atlas.config.ts` in the current
506
+ directory. Relative paths in it resolve against the config file's directory.
507
+
508
+ ### `atlas report`
509
+
510
+ Evidence for specs of any kind, not only statecharts: `publish`, `status`, `merge`, `doctor`, `policy`
511
+ and `stream`. Run `atlas report --help` for every flag. [Integrating Atlas](integrating.md) is the guide,
512
+ [running Atlas for a project](deploying.md) covers the server, S3 and filters, and
513
+ [the report contract](report-contract.md) holds the rules. For a statechart run:
514
+
515
+ ```sh
516
+ atlas report publish --producer statecharts --environment desktop-web \
517
+ --manifest atlas-runs/<run>/manifest.json --specs ./specs --upload-run
518
+ ```
519
+
520
+ `--upload-run` also sends the run's screenshots and clips to the store (or the server) so the viewer can show them
521
+ (only when the run's privacy scan passed).
522
+
523
+ ## Config reference
524
+
525
+ `defineConfig<C>(config)` returns the config unchanged, typed for the driver's context `C`.
526
+
527
+ | Field | Meaning |
528
+ | --- | --- |
529
+ | `specs` | The specs directory. |
530
+ | `driver` | A `Driver<C>`, or a function returning one (called once per run). |
531
+ | `implementation` | `{ events, states, seeds?, setup?, canStart?, correlate? }`. |
532
+ | `chart` | Run one chart of the product; the root chart when omitted. |
533
+ | `start`, `startLabel` | Where generated paths start (an XState state value) and how to describe it; the initial state when omitted. |
534
+ | `entryEvents` | When running one chart or one state: the only events that enter it from outside. |
535
+ | `state` | Run one state of a chart and what is inside it, with the transitions into and out of it: one area of a chart that models the whole product. |
536
+ | `workers` | Path attempts that run at once, capped by the driver's `concurrency`; one per CPU when omitted. |
537
+ | `beforeRun` | Runs once before any path: prepare what every seed relies on (reference data, configuration). |
538
+ | `output` | Where runs are written; `atlas-runs` beside the config. |
539
+ | `eventSources` | `() => EventSource[]`: where business events come from. |
540
+ | `eventMatchers` | How each business event name is recognised: `{ type }`, `{ pattern }` or a function. |
541
+ | `privacy` | Extra `deny` patterns, `allowEmails` and `allowHosts`. |
542
+ | `targets` | URLs the run reaches, checked against `privacy.allowHosts` before anything runs. |
543
+ | `environment` | Recorded in the manifest. |
544
+ | `stepTimeoutMs` | How long to wait for a state to show up (default 45 000). |
545
+ | `requiredMeta` | `meta` fields every state needs (default `['description']`). |
546
+
547
+ The programmatic API mirrors the CLI: `prepare(config)` loads, lints and plans; `runConfig(config,
548
+ options)` runs; `loadSpecDirectory`, `lintBundle`, `chartScope`, `planChart` and `runPaths` are the
549
+ steps underneath.
550
+
551
+ ## How a run works
552
+
553
+ 1. **Plan.** Curated journeys come first.
554
+ - When running one chart of a larger product, each journey is cut to its stretch inside the
555
+ chart, starting at an entry transition.
556
+ - With seeds, journeys are also cut wherever they pass through a seeded configuration.
557
+ - Then, for each transition still uncovered, the plan adds the shortest path that takes it from
558
+ the nearest seed or start. The search is breadth-first, so loops stay bounded.
559
+ - Paths stop before blocked events. A blocked path whose runnable part other paths already cover
560
+ is reported but not run.
561
+ 2. **Run each path.** Paths run on a pool of workers, longest first. Each gets a fresh driver
562
+ context, then every event's `prepare`, then its seed's `run` (or `setup`). The start state must
563
+ be recognised. Then for each step: run the event, wait for the target state, run its checks,
564
+ collect business events, screenshot, `settle`.
565
+ 3. **Retry.** A failed path runs once more. Passing the second time makes it `flaky`.
566
+ 4. **Write.** The manifest and reports are rewritten each time a path finishes, from every outcome
567
+ so far in plan order, so a crash keeps what ran. `outcomes.json` keeps the raw outcomes, for
568
+ `atlas merge` and `--rerun-failed`.
569
+
570
+ Every path, state and transition ends as `passed`, `failed`, `flaky` or `not-reached`. Reaching a
571
+ state also reaches its ancestors. A failure records the recogniser's signals and which known states
572
+ the screen looked like instead.
573
+
574
+ ### Run modes
575
+
576
+ | Mode | Pacing | Media |
577
+ | --- | --- | --- |
578
+ | `fast` | None | Screenshots of every state (when the driver takes them) |
579
+ | `showcase` | Holds before and after each step; taps glide and type at human speed | Screenshots, plus an H.264 clip of every transition with a poster and WebVTT captions |
580
+
581
+ ## Manifest and reports
582
+
583
+ Each run writes `<output>/<timestamp>-<mode>/`:
584
+
585
+ | File | Contents |
586
+ | --- | --- |
587
+ | `manifest.json` | The run (commit, branch, environment, mode, spec version, scope), every chart, the composed map (nodes and edges), every state and transition with status, media, timeline and reasons, every path with its attempts, coverage and privacy results. Schema: `packages/schema/schemas/manifest.schema.json`. |
588
+ | `junit.xml` | One test case per path: failures, skips (with the blocking reason) and flaky passes. |
589
+ | `ctrf.json` | The same as CTRF. |
590
+ | `chart.mmd` | The composed chart as a Mermaid state diagram. |
591
+ | `outcomes.json` | Each path's raw outcome by path key, which the manifest is folded from: for merging shards and reusing passed paths. |
592
+ | `media/paths/<path>/NN.png`, `.webp` | Screenshots of each state a path reached; `failed-NN.png` where it failed. |
593
+ | `media/clips/<path>/NN.mp4`, `.poster.webp`, `.vtt` | Showcase clips of each transition, with captions. |
594
+ | `media/traces/<path>.zip` | Driver traces of failed attempts (Playwright traces with the Playwright driver). |
595
+
596
+ A run is also evidence for the report. `atlas report publish --manifest <run>/manifest.json` turns it
597
+ into a layer with one check per path, identified by the path's `key` (the same start and events give
598
+ the same key in every run). `atlas merge` composes the shards of one plan into one *run*; layers
599
+ compose a run with everything else: other suites, other environments, other branches.
600
+
601
+ ## Business events
602
+
603
+ States list the business events that happen on entering them in `meta.events`. An `EventSource`
604
+ says what actually happened. `mark()` returns a position before each event, and `collect(mark)`
605
+ returns what arrived after it, once the state is recognised:
606
+
607
+ - `cloudEventsHttpSource()` starts an HTTP endpoint that accepts CloudEvents in structured, binary
608
+ or batch mode. Point the product's event bus, webhook relay or collector at its `url`.
609
+ - `logFileSource(file)` collects lines appended to a log, for products whose only event stream is a
610
+ log; match them with `{ pattern }`.
611
+ - Any object with `name`, `mark` and `collect` works, such as an in-memory bus in a unit test.
612
+
613
+ With no matcher, a business event is observed when a CloudEvent's `type` equals its name. Events
614
+ with neither a matcher nor a CloudEvents source are reported as "no signal", never as missing.
615
+
616
+ ## Privacy
617
+
618
+ Runs produce media and manifests that get shared, so Atlas refuses to leak real data:
619
+
620
+ - Before running, every `targets` URL must be on `allowHosts` (loopback only by default).
621
+ - After every step, the driver's visible text is scanned, and the manifest is scanned before it is
622
+ written. By default it flags email addresses outside `example.com`/`.org`/`.net` and the `.test`,
623
+ `.example`, `.invalid`, `.localhost` and `.local` domains, anything shaped like a US Social Security
624
+ number, and card numbers other than the well-known test cards. Findings describe the match without
625
+ repeating it.
626
+ - Any finding fails the run. Add `deny` patterns and `allowEmails` in `privacy`.
627
+
628
+ ## Visualizer
629
+
630
+ The [`atlas-visualizer`](../packages/visualizer) command renders the charts from the specs directory and
631
+ overlays runs from the runs directory: screenshots on states, clips on transitions, statuses and
632
+ history. See its README for how to point it at a project.
633
+
634
+ Its open index lists every place, journey and spec beside one plate. Connect multiple local
635
+ directories, HTTP report stores and streaming
636
+ APIs using [report backends](report-backends.md). The runner publishes reached screens
637
+ and completed steps while paths are still running.
638
+
639
+ Layered reports for any spec appear beside the charts: each Gherkin, Quint, DMN, Alloy and OpenSLO
640
+ document shows the combined result of its checks per environment, with the layer behind each. Point
641
+ the viewer at your stores with `reportsHost` ([integrating Atlas](integrating.md#6-browse-it)).