laymos 0.0.1 → 0.0.2

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 (583) hide show
  1. package/README.md +137 -710
  2. package/bin/laymos.mjs +2 -0
  3. package/dist/architecture/analyze-project/analyze-project.d.ts +9 -0
  4. package/dist/architecture/analyze-project/analyze-project.d.ts.map +1 -0
  5. package/dist/architecture/analyze-project/analyze-project.js +47 -0
  6. package/dist/architecture/analyze-project/index.d.ts +3 -0
  7. package/dist/architecture/analyze-project/index.d.ts.map +1 -0
  8. package/dist/architecture/analyze-project/index.js +1 -0
  9. package/dist/architecture/build-report/build-report.d.ts +7 -0
  10. package/dist/architecture/build-report/build-report.d.ts.map +1 -0
  11. package/dist/{engine/4-emit/emit.js → architecture/build-report/build-report.js} +12 -9
  12. package/dist/architecture/build-report/index.d.ts +2 -0
  13. package/dist/architecture/build-report/index.d.ts.map +1 -0
  14. package/dist/architecture/build-report/index.js +1 -0
  15. package/dist/architecture/errors.d.ts +11 -0
  16. package/dist/architecture/errors.d.ts.map +1 -0
  17. package/dist/{engine → architecture}/errors.js +0 -2
  18. package/dist/{engine/1-extract/extract.d.ts → architecture/extract-dependencies/extract-dependencies.d.ts} +1 -1
  19. package/dist/architecture/extract-dependencies/extract-dependencies.d.ts.map +1 -0
  20. package/dist/{engine/1-extract/extract.js → architecture/extract-dependencies/extract-dependencies.js} +13 -11
  21. package/dist/architecture/extract-dependencies/index.d.ts +3 -0
  22. package/dist/architecture/extract-dependencies/index.d.ts.map +1 -0
  23. package/dist/architecture/extract-dependencies/index.js +1 -0
  24. package/dist/architecture/resolve-architecture/index.d.ts +3 -0
  25. package/dist/architecture/resolve-architecture/index.d.ts.map +1 -0
  26. package/dist/architecture/resolve-architecture/index.js +1 -0
  27. package/dist/{engine/2-resolve/resolve.d.ts → architecture/resolve-architecture/resolve-architecture.d.ts} +2 -2
  28. package/dist/architecture/resolve-architecture/resolve-architecture.d.ts.map +1 -0
  29. package/dist/{engine/2-resolve/resolve.js → architecture/resolve-architecture/resolve-architecture.js} +1 -1
  30. package/dist/architecture/validate-rules/index.d.ts +3 -0
  31. package/dist/architecture/validate-rules/index.d.ts.map +1 -0
  32. package/dist/architecture/validate-rules/index.js +1 -0
  33. package/dist/{engine/3-evaluate/evaluate.d.ts → architecture/validate-rules/validate-rules.d.ts} +4 -4
  34. package/dist/architecture/validate-rules/validate-rules.d.ts.map +1 -0
  35. package/dist/{engine/3-evaluate/evaluate.js → architecture/validate-rules/validate-rules.js} +2 -2
  36. package/dist/architecture-analysis-schema/architecture-analysis-schema.d.ts +109 -0
  37. package/dist/architecture-analysis-schema/architecture-analysis-schema.d.ts.map +1 -0
  38. package/dist/architecture-analysis-schema/architecture-analysis-schema.js +10 -0
  39. package/dist/architecture-analysis-schema/index.d.ts +7 -0
  40. package/dist/architecture-analysis-schema/index.d.ts.map +1 -0
  41. package/dist/architecture-analysis-schema/index.js +3 -0
  42. package/dist/architecture-analysis-schema/layer-analysis-schema.d.ts +27 -0
  43. package/dist/architecture-analysis-schema/layer-analysis-schema.d.ts.map +1 -0
  44. package/dist/architecture-analysis-schema/layer-analysis-schema.js +18 -0
  45. package/dist/architecture-analysis-schema/module-analysis-schema.d.ts +150 -0
  46. package/dist/architecture-analysis-schema/module-analysis-schema.d.ts.map +1 -0
  47. package/dist/architecture-analysis-schema/module-analysis-schema.js +96 -0
  48. package/dist/architecture-analysis-schema/module-source-schema.d.ts +16 -0
  49. package/dist/architecture-analysis-schema/module-source-schema.d.ts.map +1 -0
  50. package/dist/architecture-analysis-schema/module-source-schema.js +10 -0
  51. package/dist/architecture-analysis-schema/project-config-schema.d.ts +51 -0
  52. package/dist/architecture-analysis-schema/project-config-schema.d.ts.map +1 -0
  53. package/dist/architecture-analysis-schema/project-config-schema.js +110 -0
  54. package/dist/change-set-schema/change-set-schema.d.ts +55 -0
  55. package/dist/change-set-schema/change-set-schema.d.ts.map +1 -0
  56. package/dist/change-set-schema/change-set-schema.js +43 -0
  57. package/dist/change-set-schema/index.d.ts +3 -0
  58. package/dist/change-set-schema/index.d.ts.map +1 -0
  59. package/dist/change-set-schema/index.js +2 -0
  60. package/dist/cli/cli.js +6 -1
  61. package/dist/cli/deps/dependency-tree.d.ts +3 -0
  62. package/dist/cli/deps/dependency-tree.d.ts.map +1 -0
  63. package/dist/cli/deps/dependency-tree.js +39 -0
  64. package/dist/cli/deps/deps.d.ts +7 -0
  65. package/dist/cli/deps/deps.d.ts.map +1 -0
  66. package/dist/cli/deps/deps.js +26 -0
  67. package/dist/cli/deps/index.d.ts +2 -0
  68. package/dist/cli/deps/index.d.ts.map +1 -0
  69. package/dist/cli/deps/index.js +2 -0
  70. package/dist/cli/errors.d.ts +2 -0
  71. package/dist/cli/errors.d.ts.map +1 -0
  72. package/dist/cli/errors.js +34 -0
  73. package/dist/cli/inspect/file/file.d.ts +8 -0
  74. package/dist/cli/inspect/file/file.d.ts.map +1 -0
  75. package/dist/cli/inspect/file/file.js +16 -0
  76. package/dist/cli/inspect/file/index.d.ts +2 -0
  77. package/dist/cli/inspect/file/index.d.ts.map +1 -0
  78. package/dist/cli/inspect/file/index.js +1 -0
  79. package/dist/cli/inspect/file/report.d.ts +3 -0
  80. package/dist/cli/inspect/file/report.d.ts.map +1 -0
  81. package/dist/cli/inspect/file/report.js +26 -0
  82. package/dist/cli/inspect/index.d.ts +2 -0
  83. package/dist/cli/inspect/index.d.ts.map +1 -0
  84. package/dist/cli/inspect/index.js +1 -0
  85. package/dist/cli/inspect/inspect.d.ts +4 -0
  86. package/dist/cli/inspect/inspect.d.ts.map +1 -0
  87. package/dist/cli/inspect/inspect.js +14 -0
  88. package/dist/cli/inspect/json.d.ts +4 -0
  89. package/dist/cli/inspect/json.d.ts.map +1 -0
  90. package/dist/cli/inspect/json.js +5 -0
  91. package/dist/cli/inspect/layer/index.d.ts +2 -0
  92. package/dist/cli/inspect/layer/index.d.ts.map +1 -0
  93. package/dist/cli/inspect/layer/index.js +1 -0
  94. package/dist/cli/inspect/layer/layer.d.ts +7 -0
  95. package/dist/cli/inspect/layer/layer.d.ts.map +1 -0
  96. package/dist/cli/inspect/layer/layer.js +13 -0
  97. package/dist/cli/inspect/layer/report.d.ts +3 -0
  98. package/dist/cli/inspect/layer/report.d.ts.map +1 -0
  99. package/dist/cli/inspect/layer/report.js +21 -0
  100. package/dist/cli/inspect/module/index.d.ts +2 -0
  101. package/dist/cli/inspect/module/index.d.ts.map +1 -0
  102. package/dist/cli/inspect/module/index.js +1 -0
  103. package/dist/cli/inspect/module/module.d.ts +7 -0
  104. package/dist/cli/inspect/module/module.d.ts.map +1 -0
  105. package/dist/cli/inspect/module/module.js +15 -0
  106. package/dist/cli/inspect/module/report.d.ts +3 -0
  107. package/dist/cli/inspect/module/report.d.ts.map +1 -0
  108. package/dist/cli/inspect/module/report.js +38 -0
  109. package/dist/cli/inspect/path-tree.d.ts +7 -0
  110. package/dist/cli/inspect/path-tree.d.ts.map +1 -0
  111. package/dist/cli/inspect/path-tree.js +62 -0
  112. package/dist/cli/inspect/path.d.ts +5 -0
  113. package/dist/cli/inspect/path.d.ts.map +1 -0
  114. package/dist/cli/inspect/path.js +10 -0
  115. package/dist/cli/inspect/project/index.d.ts +2 -0
  116. package/dist/cli/inspect/project/index.d.ts.map +1 -0
  117. package/dist/cli/inspect/project/index.js +1 -0
  118. package/dist/cli/inspect/project/project.d.ts +8 -0
  119. package/dist/cli/inspect/project/project.d.ts.map +1 -0
  120. package/dist/cli/inspect/project/project.js +19 -0
  121. package/dist/cli/inspect/project/report.d.ts +3 -0
  122. package/dist/cli/inspect/project/report.d.ts.map +1 -0
  123. package/dist/cli/inspect/project/report.js +16 -0
  124. package/dist/cli/lint/index.d.ts +2 -0
  125. package/dist/cli/lint/index.d.ts.map +1 -0
  126. package/dist/cli/lint/index.js +2 -0
  127. package/dist/cli/lint/layers/index.d.ts +3 -0
  128. package/dist/cli/lint/layers/index.d.ts.map +1 -0
  129. package/dist/cli/lint/layers/index.js +4 -0
  130. package/dist/cli/lint/layers/layers.d.ts +5 -0
  131. package/dist/cli/lint/layers/layers.d.ts.map +1 -0
  132. package/dist/cli/lint/layers/layers.js +18 -0
  133. package/dist/cli/lint/layers/report.d.ts +5 -0
  134. package/dist/cli/lint/layers/report.d.ts.map +1 -0
  135. package/dist/cli/lint/layers/report.js +60 -0
  136. package/dist/cli/lint/lint.d.ts +4 -0
  137. package/dist/cli/lint/lint.d.ts.map +1 -0
  138. package/dist/cli/lint/lint.js +26 -0
  139. package/dist/cli/lint/modules/index.d.ts +5 -0
  140. package/dist/cli/lint/modules/index.d.ts.map +1 -0
  141. package/dist/cli/lint/modules/index.js +4 -0
  142. package/dist/cli/lint/modules/modules.d.ts +5 -0
  143. package/dist/cli/lint/modules/modules.d.ts.map +1 -0
  144. package/dist/cli/lint/modules/modules.js +15 -0
  145. package/dist/cli/lint/modules/report.d.ts +5 -0
  146. package/dist/cli/lint/modules/report.d.ts.map +1 -0
  147. package/dist/cli/lint/modules/report.js +69 -0
  148. package/dist/cli/run.d.ts +1 -8
  149. package/dist/cli/run.d.ts.map +1 -1
  150. package/dist/cli/run.js +14 -242
  151. package/dist/cli/stories/index.d.ts +2 -0
  152. package/dist/cli/stories/index.d.ts.map +1 -0
  153. package/dist/cli/stories/index.js +1 -0
  154. package/dist/cli/stories/progress.d.ts +7 -0
  155. package/dist/cli/stories/progress.d.ts.map +1 -0
  156. package/dist/cli/stories/progress.js +45 -0
  157. package/dist/cli/stories/report.d.ts +9 -0
  158. package/dist/cli/stories/report.d.ts.map +1 -0
  159. package/dist/cli/stories/report.js +63 -0
  160. package/dist/cli/stories/stories.d.ts +6 -0
  161. package/dist/cli/stories/stories.d.ts.map +1 -0
  162. package/dist/cli/stories/stories.js +30 -0
  163. package/dist/config/define-config.d.ts +5 -0
  164. package/dist/config/define-config.d.ts.map +1 -1
  165. package/dist/config/define-config.js +152 -7
  166. package/dist/config/index.d.ts +6 -0
  167. package/dist/config/index.d.ts.map +1 -1
  168. package/dist/config/index.js +2 -0
  169. package/dist/config/layer-graph.d.ts +2 -2
  170. package/dist/config/layer-graph.d.ts.map +1 -1
  171. package/dist/config/layer-graph.js +2 -29
  172. package/dist/config/layer.d.ts +2 -2
  173. package/dist/config/layer.d.ts.map +1 -1
  174. package/dist/config/layer.js +2 -15
  175. package/dist/config/load-config/index.d.ts +2 -0
  176. package/dist/config/load-config/index.d.ts.map +1 -0
  177. package/dist/config/load-config/index.js +1 -0
  178. package/dist/config/load-config/load-config.d.ts +34 -0
  179. package/dist/config/load-config/load-config.d.ts.map +1 -0
  180. package/dist/config/load-config/load-config.js +127 -0
  181. package/dist/config/module.d.ts +4 -2
  182. package/dist/config/module.d.ts.map +1 -1
  183. package/dist/config/module.js +5 -12
  184. package/dist/config/project-narrative.d.ts +15 -0
  185. package/dist/config/project-narrative.d.ts.map +1 -0
  186. package/dist/config/project-narrative.js +11 -0
  187. package/dist/config/types.d.ts +5 -3
  188. package/dist/config/types.d.ts.map +1 -1
  189. package/dist/domain/architecture-analysis/architecture-analysis.d.ts +4 -0
  190. package/dist/domain/architecture-analysis/architecture-analysis.d.ts.map +1 -0
  191. package/dist/domain/architecture-analysis/architecture-analysis.js +13 -0
  192. package/dist/domain/architecture-analysis/index.d.ts +3 -0
  193. package/dist/domain/architecture-analysis/index.d.ts.map +1 -0
  194. package/dist/domain/architecture-analysis/index.js +2 -0
  195. package/dist/domain/architecture-analysis/layer-rules.d.ts +3 -0
  196. package/dist/domain/architecture-analysis/layer-rules.d.ts.map +1 -0
  197. package/dist/domain/architecture-analysis/layer-rules.js +15 -0
  198. package/dist/domain/architecture-analysis/layers/allowed-dependencies.d.ts +3 -0
  199. package/dist/domain/architecture-analysis/layers/allowed-dependencies.d.ts.map +1 -0
  200. package/dist/domain/architecture-analysis/layers/allowed-dependencies.js +20 -0
  201. package/dist/domain/architecture-analysis/layers/coverage-violations.d.ts +2 -0
  202. package/dist/domain/architecture-analysis/layers/coverage-violations.d.ts.map +1 -0
  203. package/dist/domain/architecture-analysis/layers/coverage-violations.js +5 -0
  204. package/dist/domain/architecture-analysis/layers/dependency-violations.d.ts +5 -0
  205. package/dist/domain/architecture-analysis/layers/dependency-violations.d.ts.map +1 -0
  206. package/dist/domain/architecture-analysis/layers/dependency-violations.js +18 -0
  207. package/dist/domain/architecture-analysis/layers/index.d.ts +9 -0
  208. package/dist/domain/architecture-analysis/layers/index.d.ts.map +1 -0
  209. package/dist/domain/architecture-analysis/layers/index.js +4 -0
  210. package/dist/domain/architecture-analysis/layers/layer-membership.d.ts +3 -0
  211. package/dist/domain/architecture-analysis/layers/layer-membership.d.ts.map +1 -0
  212. package/dist/domain/architecture-analysis/layers/layer-membership.js +13 -0
  213. package/dist/domain/architecture-analysis/layers/layers.d.ts +11 -0
  214. package/dist/domain/architecture-analysis/layers/layers.d.ts.map +1 -0
  215. package/dist/domain/architecture-analysis/layers/layers.js +22 -0
  216. package/dist/domain/architecture-analysis/layers/module-coverage-violations.d.ts +4 -0
  217. package/dist/domain/architecture-analysis/layers/module-coverage-violations.d.ts.map +1 -0
  218. package/dist/domain/architecture-analysis/layers/module-coverage-violations.js +9 -0
  219. package/dist/domain/architecture-analysis/modules/dependency-graph.d.ts +2 -0
  220. package/dist/domain/architecture-analysis/modules/dependency-graph.d.ts.map +1 -0
  221. package/dist/domain/architecture-analysis/modules/dependency-graph.js +45 -0
  222. package/dist/domain/architecture-analysis/modules/dependency-permissions.d.ts +4 -0
  223. package/dist/domain/architecture-analysis/modules/dependency-permissions.d.ts.map +1 -0
  224. package/dist/domain/architecture-analysis/modules/dependency-permissions.js +35 -0
  225. package/dist/domain/architecture-analysis/modules/index.d.ts +12 -0
  226. package/dist/domain/architecture-analysis/modules/index.d.ts.map +1 -0
  227. package/dist/domain/architecture-analysis/modules/index.js +3 -0
  228. package/dist/domain/architecture-analysis/modules/module-descriptors.d.ts +5 -0
  229. package/dist/domain/architecture-analysis/modules/module-descriptors.d.ts.map +1 -0
  230. package/dist/domain/architecture-analysis/modules/module-descriptors.js +37 -0
  231. package/dist/domain/architecture-analysis/modules/module-membership.d.ts +3 -0
  232. package/dist/domain/architecture-analysis/modules/module-membership.d.ts.map +1 -0
  233. package/dist/domain/architecture-analysis/modules/module-membership.js +12 -0
  234. package/dist/domain/architecture-analysis/modules/modules.d.ts +16 -0
  235. package/dist/domain/architecture-analysis/modules/modules.d.ts.map +1 -0
  236. package/dist/domain/architecture-analysis/modules/modules.js +35 -0
  237. package/dist/domain/architecture-analysis/modules/public-entry-points.d.ts +3 -0
  238. package/dist/domain/architecture-analysis/modules/public-entry-points.d.ts.map +1 -0
  239. package/dist/domain/architecture-analysis/modules/public-entry-points.js +11 -0
  240. package/dist/domain/architecture-analysis/modules/unexposed-modules.d.ts +3 -0
  241. package/dist/domain/architecture-analysis/modules/unexposed-modules.d.ts.map +1 -0
  242. package/dist/domain/architecture-analysis/modules/unexposed-modules.js +10 -0
  243. package/dist/domain/architecture-analysis/modules/violations/boundaries.d.ts +8 -0
  244. package/dist/domain/architecture-analysis/modules/violations/boundaries.d.ts.map +1 -0
  245. package/dist/domain/architecture-analysis/modules/violations/boundaries.js +47 -0
  246. package/dist/domain/architecture-analysis/modules/violations/coverage.d.ts +3 -0
  247. package/dist/domain/architecture-analysis/modules/violations/coverage.d.ts.map +1 -0
  248. package/dist/domain/architecture-analysis/modules/violations/coverage.js +7 -0
  249. package/dist/domain/architecture-analysis/modules/violations/cycles.d.ts +3 -0
  250. package/dist/domain/architecture-analysis/modules/violations/cycles.d.ts.map +1 -0
  251. package/dist/domain/architecture-analysis/modules/violations/cycles.js +7 -0
  252. package/dist/domain/architecture-analysis/modules/violations/dead-modules.d.ts +3 -0
  253. package/dist/domain/architecture-analysis/modules/violations/dead-modules.d.ts.map +1 -0
  254. package/dist/domain/architecture-analysis/modules/violations/dead-modules.js +23 -0
  255. package/dist/domain/architecture-analysis/modules/violations/dependencies.d.ts +4 -0
  256. package/dist/domain/architecture-analysis/modules/violations/dependencies.d.ts.map +1 -0
  257. package/dist/domain/architecture-analysis/modules/violations/dependencies.js +7 -0
  258. package/dist/domain/architecture-analysis/modules/violations/entry-points.d.ts +3 -0
  259. package/dist/domain/architecture-analysis/modules/violations/entry-points.d.ts.map +1 -0
  260. package/dist/domain/architecture-analysis/modules/violations/entry-points.js +17 -0
  261. package/dist/domain/architecture-analysis/modules/violations/graph-coverage.d.ts +3 -0
  262. package/dist/domain/architecture-analysis/modules/violations/graph-coverage.d.ts.map +1 -0
  263. package/dist/domain/architecture-analysis/modules/violations/graph-coverage.js +16 -0
  264. package/dist/domain/architecture-analysis/modules/violations/index.d.ts +3 -0
  265. package/dist/domain/architecture-analysis/modules/violations/index.d.ts.map +1 -0
  266. package/dist/domain/architecture-analysis/modules/violations/index.js +2 -0
  267. package/dist/domain/architecture-analysis/modules/violations/unused-shared.d.ts +3 -0
  268. package/dist/domain/architecture-analysis/modules/violations/unused-shared.d.ts.map +1 -0
  269. package/dist/domain/architecture-analysis/modules/violations/unused-shared.js +9 -0
  270. package/dist/domain/architecture-analysis/modules/violations/violations.d.ts +9 -0
  271. package/dist/domain/architecture-analysis/modules/violations/violations.d.ts.map +1 -0
  272. package/dist/domain/architecture-analysis/modules/violations/violations.js +22 -0
  273. package/dist/domain/file-graph/file-graph.d.ts +10 -0
  274. package/dist/domain/file-graph/file-graph.d.ts.map +1 -0
  275. package/dist/domain/file-graph/file-graph.js +37 -0
  276. package/dist/domain/file-graph/index.d.ts +4 -0
  277. package/dist/domain/file-graph/index.d.ts.map +1 -0
  278. package/dist/domain/file-graph/index.js +1 -0
  279. package/dist/domain/project-config/index.d.ts +10 -0
  280. package/dist/domain/project-config/index.d.ts.map +1 -0
  281. package/dist/domain/project-config/index.js +12 -0
  282. package/dist/domain/project-config/project-config.d.ts +52 -0
  283. package/dist/domain/project-config/project-config.d.ts.map +1 -0
  284. package/dist/domain/project-config/project-config.js +39 -0
  285. package/dist/domain/project-config/resolve.d.ts +8 -0
  286. package/dist/domain/project-config/resolve.d.ts.map +1 -0
  287. package/dist/domain/project-config/resolve.js +29 -0
  288. package/dist/domain/project-config/validation/containment.d.ts +4 -0
  289. package/dist/domain/project-config/validation/containment.d.ts.map +1 -0
  290. package/dist/domain/project-config/validation/containment.js +21 -0
  291. package/dist/domain/project-config/validation/index.d.ts +3 -0
  292. package/dist/domain/project-config/validation/index.d.ts.map +1 -0
  293. package/dist/domain/project-config/validation/index.js +2 -0
  294. package/dist/domain/project-config/validation/layers/cycles.d.ts +3 -0
  295. package/dist/domain/project-config/validation/layers/cycles.d.ts.map +1 -0
  296. package/dist/domain/project-config/validation/layers/cycles.js +64 -0
  297. package/dist/domain/project-config/validation/layers/index.d.ts +3 -0
  298. package/dist/domain/project-config/validation/layers/index.d.ts.map +1 -0
  299. package/dist/domain/project-config/validation/layers/index.js +2 -0
  300. package/dist/domain/project-config/validation/layers/layers.d.ts +3 -0
  301. package/dist/domain/project-config/validation/layers/layers.d.ts.map +1 -0
  302. package/dist/domain/project-config/validation/layers/layers.js +9 -0
  303. package/dist/domain/project-config/validation/layers/overlaps.d.ts +3 -0
  304. package/dist/domain/project-config/validation/layers/overlaps.d.ts.map +1 -0
  305. package/dist/domain/project-config/validation/layers/overlaps.js +26 -0
  306. package/dist/domain/project-config/validation/layers/references.d.ts +3 -0
  307. package/dist/domain/project-config/validation/layers/references.d.ts.map +1 -0
  308. package/dist/domain/project-config/validation/layers/references.js +21 -0
  309. package/dist/domain/project-config/validation/modules/containment.d.ts +3 -0
  310. package/dist/domain/project-config/validation/modules/containment.d.ts.map +1 -0
  311. package/dist/domain/project-config/validation/modules/containment.js +24 -0
  312. package/dist/domain/project-config/validation/modules/graphs.d.ts +4 -0
  313. package/dist/domain/project-config/validation/modules/graphs.d.ts.map +1 -0
  314. package/dist/domain/project-config/validation/modules/graphs.js +96 -0
  315. package/dist/domain/project-config/validation/modules/index.d.ts +3 -0
  316. package/dist/domain/project-config/validation/modules/index.d.ts.map +1 -0
  317. package/dist/domain/project-config/validation/modules/index.js +2 -0
  318. package/dist/domain/project-config/validation/modules/kinds.d.ts +3 -0
  319. package/dist/domain/project-config/validation/modules/kinds.d.ts.map +1 -0
  320. package/dist/domain/project-config/validation/modules/kinds.js +18 -0
  321. package/dist/domain/project-config/validation/modules/modules.d.ts +3 -0
  322. package/dist/domain/project-config/validation/modules/modules.d.ts.map +1 -0
  323. package/dist/domain/project-config/validation/modules/modules.js +16 -0
  324. package/dist/domain/project-config/validation/modules/nested.d.ts +3 -0
  325. package/dist/domain/project-config/validation/modules/nested.d.ts.map +1 -0
  326. package/dist/domain/project-config/validation/modules/nested.js +34 -0
  327. package/dist/domain/project-config/validation/modules/overlaps.d.ts +4 -0
  328. package/dist/domain/project-config/validation/modules/overlaps.d.ts.map +1 -0
  329. package/dist/domain/project-config/validation/modules/overlaps.js +43 -0
  330. package/dist/domain/project-config/validation/modules/paths.d.ts +3 -0
  331. package/dist/domain/project-config/validation/modules/paths.d.ts.map +1 -0
  332. package/dist/domain/project-config/validation/modules/paths.js +27 -0
  333. package/dist/domain/project-config/validation/modules/scopes.d.ts +4 -0
  334. package/dist/domain/project-config/validation/modules/scopes.d.ts.map +1 -0
  335. package/dist/domain/project-config/validation/modules/scopes.js +28 -0
  336. package/dist/domain/project-config/validation/modules/subpaths.d.ts +3 -0
  337. package/dist/domain/project-config/validation/modules/subpaths.d.ts.map +1 -0
  338. package/dist/domain/project-config/validation/modules/subpaths.js +40 -0
  339. package/dist/domain/project-config/validation/paths.d.ts +3 -0
  340. package/dist/domain/project-config/validation/paths.d.ts.map +1 -0
  341. package/dist/domain/project-config/validation/paths.js +39 -0
  342. package/dist/domain/project-config/validation/validation.d.ts +3 -0
  343. package/dist/domain/project-config/validation/validation.d.ts.map +1 -0
  344. package/dist/domain/project-config/validation/validation.js +12 -0
  345. package/dist/entrypoints/cli/cli.d.ts +3 -0
  346. package/dist/entrypoints/cli/cli.d.ts.map +1 -0
  347. package/dist/entrypoints/cli/cli.js +6 -0
  348. package/dist/entrypoints/cli/run.d.ts +13 -0
  349. package/dist/entrypoints/cli/run.d.ts.map +1 -0
  350. package/dist/entrypoints/cli/run.js +155 -0
  351. package/dist/entrypoints/cli/test-output.d.ts +17 -0
  352. package/dist/entrypoints/cli/test-output.d.ts.map +1 -0
  353. package/dist/entrypoints/cli/test-output.js +244 -0
  354. package/dist/entrypoints/node/index.d.ts +24 -0
  355. package/dist/entrypoints/node/index.d.ts.map +1 -0
  356. package/dist/entrypoints/node/index.js +27 -0
  357. package/dist/entrypoints/report/index.d.ts +2 -0
  358. package/dist/entrypoints/report/index.d.ts.map +1 -0
  359. package/dist/entrypoints/report/index.js +1 -0
  360. package/dist/index.d.ts +17 -1
  361. package/dist/index.d.ts.map +1 -1
  362. package/dist/index.js +22 -1
  363. package/dist/markdown/index.d.ts +3 -0
  364. package/dist/markdown/index.d.ts.map +1 -0
  365. package/dist/markdown/index.js +1 -0
  366. package/dist/markdown/markdown.d.ts +7 -0
  367. package/dist/markdown/markdown.d.ts.map +1 -0
  368. package/dist/markdown/markdown.js +13 -0
  369. package/dist/orchestrator/analyze-project/analyze-project.d.ts +119 -0
  370. package/dist/orchestrator/analyze-project/analyze-project.d.ts.map +1 -0
  371. package/dist/orchestrator/analyze-project/analyze-project.js +9 -0
  372. package/dist/orchestrator/analyze-project/index.d.ts +2 -0
  373. package/dist/orchestrator/analyze-project/index.d.ts.map +1 -0
  374. package/dist/orchestrator/analyze-project/index.js +2 -0
  375. package/dist/orchestrator/inspect/index.d.ts +4 -0
  376. package/dist/orchestrator/inspect/index.d.ts.map +1 -0
  377. package/dist/orchestrator/inspect/index.js +1 -0
  378. package/dist/orchestrator/inspect/inspect.d.ts +269 -0
  379. package/dist/orchestrator/inspect/inspect.d.ts.map +1 -0
  380. package/dist/orchestrator/inspect/inspect.js +147 -0
  381. package/dist/orchestrator/load-changes/index.d.ts +2 -0
  382. package/dist/orchestrator/load-changes/index.d.ts.map +1 -0
  383. package/dist/orchestrator/load-changes/index.js +2 -0
  384. package/dist/orchestrator/load-changes/load-changes.d.ts +6 -0
  385. package/dist/orchestrator/load-changes/load-changes.d.ts.map +1 -0
  386. package/dist/orchestrator/load-changes/load-changes.js +18 -0
  387. package/dist/orchestrator/load-module-source/errors.d.ts +17 -0
  388. package/dist/orchestrator/load-module-source/errors.d.ts.map +1 -0
  389. package/dist/orchestrator/load-module-source/errors.js +5 -0
  390. package/dist/orchestrator/load-module-source/index.d.ts +2 -0
  391. package/dist/orchestrator/load-module-source/index.d.ts.map +1 -0
  392. package/dist/orchestrator/load-module-source/index.js +1 -0
  393. package/dist/orchestrator/load-module-source/load-module-source.d.ts +12 -0
  394. package/dist/orchestrator/load-module-source/load-module-source.d.ts.map +1 -0
  395. package/dist/orchestrator/load-module-source/load-module-source.js +39 -0
  396. package/dist/orchestrator/load-project/index.d.ts +3 -0
  397. package/dist/orchestrator/load-project/index.d.ts.map +1 -0
  398. package/dist/orchestrator/load-project/index.js +2 -0
  399. package/dist/orchestrator/load-project/load-project.d.ts +54 -0
  400. package/dist/orchestrator/load-project/load-project.d.ts.map +1 -0
  401. package/dist/orchestrator/load-project/load-project.js +30 -0
  402. package/dist/orchestrator/query-dependencies/index.d.ts +3 -0
  403. package/dist/orchestrator/query-dependencies/index.d.ts.map +1 -0
  404. package/dist/orchestrator/query-dependencies/index.js +4 -0
  405. package/dist/orchestrator/query-dependencies/query-dependencies.d.ts +12 -0
  406. package/dist/orchestrator/query-dependencies/query-dependencies.d.ts.map +1 -0
  407. package/dist/orchestrator/query-dependencies/query-dependencies.js +20 -0
  408. package/dist/orchestrator/run-stories/errors.d.ts +11 -0
  409. package/dist/orchestrator/run-stories/errors.d.ts.map +1 -0
  410. package/dist/orchestrator/run-stories/errors.js +3 -0
  411. package/dist/orchestrator/run-stories/extract-snippets.d.ts +12 -0
  412. package/dist/orchestrator/run-stories/extract-snippets.d.ts.map +1 -0
  413. package/dist/orchestrator/run-stories/extract-snippets.js +181 -0
  414. package/dist/orchestrator/run-stories/index.d.ts +3 -0
  415. package/dist/orchestrator/run-stories/index.d.ts.map +1 -0
  416. package/dist/orchestrator/run-stories/index.js +3 -0
  417. package/dist/orchestrator/run-stories/run-stories.d.ts +16 -0
  418. package/dist/orchestrator/run-stories/run-stories.d.ts.map +1 -0
  419. package/dist/orchestrator/run-stories/run-stories.js +290 -0
  420. package/dist/report/architecture.d.ts +1 -1
  421. package/dist/report/architecture.d.ts.map +1 -1
  422. package/dist/report/index.d.ts +2 -1
  423. package/dist/report/index.d.ts.map +1 -1
  424. package/dist/report/index.js +1 -1
  425. package/dist/report/tests.d.ts +411 -0
  426. package/dist/report/tests.d.ts.map +1 -0
  427. package/dist/report/tests.js +102 -0
  428. package/dist/services/config/config.d.ts +12 -0
  429. package/dist/services/config/config.d.ts.map +1 -0
  430. package/dist/services/config/config.js +46 -0
  431. package/dist/services/config/errors.d.ts +13 -0
  432. package/dist/services/config/errors.d.ts.map +1 -0
  433. package/dist/services/config/errors.js +3 -0
  434. package/dist/services/config/index.d.ts +4 -0
  435. package/dist/services/config/index.d.ts.map +1 -0
  436. package/dist/services/config/index.js +7 -0
  437. package/dist/services/file-cruiser/errors.d.ts +10 -0
  438. package/dist/services/file-cruiser/errors.d.ts.map +1 -0
  439. package/dist/services/file-cruiser/errors.js +3 -0
  440. package/dist/services/file-cruiser/file-cruiser.d.ts +11 -0
  441. package/dist/services/file-cruiser/file-cruiser.d.ts.map +1 -0
  442. package/dist/services/file-cruiser/file-cruiser.js +7 -0
  443. package/dist/services/file-cruiser/index.d.ts +4 -0
  444. package/dist/services/file-cruiser/index.d.ts.map +1 -0
  445. package/dist/services/file-cruiser/index.js +6 -0
  446. package/dist/services/file-cruiser/oxc/file-scanner.d.ts +5 -0
  447. package/dist/services/file-cruiser/oxc/file-scanner.d.ts.map +1 -0
  448. package/dist/services/file-cruiser/oxc/file-scanner.js +54 -0
  449. package/dist/services/file-cruiser/oxc/import-resolver.d.ts +5 -0
  450. package/dist/services/file-cruiser/oxc/import-resolver.d.ts.map +1 -0
  451. package/dist/services/file-cruiser/oxc/import-resolver.js +44 -0
  452. package/dist/services/file-cruiser/oxc/index.d.ts +2 -0
  453. package/dist/services/file-cruiser/oxc/index.d.ts.map +1 -0
  454. package/dist/services/file-cruiser/oxc/index.js +2 -0
  455. package/dist/services/file-cruiser/oxc/oxc.d.ts +5 -0
  456. package/dist/services/file-cruiser/oxc/oxc.d.ts.map +1 -0
  457. package/dist/services/file-cruiser/oxc/oxc.js +29 -0
  458. package/dist/services/git/changed-paths.d.ts +4 -0
  459. package/dist/services/git/changed-paths.d.ts.map +1 -0
  460. package/dist/services/git/changed-paths.js +85 -0
  461. package/dist/services/git/errors.d.ts +11 -0
  462. package/dist/services/git/errors.d.ts.map +1 -0
  463. package/dist/services/git/errors.js +3 -0
  464. package/dist/services/git/git.d.ts +12 -0
  465. package/dist/services/git/git.d.ts.map +1 -0
  466. package/dist/services/git/git.js +23 -0
  467. package/dist/services/git/index.d.ts +4 -0
  468. package/dist/services/git/index.d.ts.map +1 -0
  469. package/dist/services/git/index.js +6 -0
  470. package/dist/services/git/parse-patch.d.ts +3 -0
  471. package/dist/services/git/parse-patch.d.ts.map +1 -0
  472. package/dist/services/git/parse-patch.js +53 -0
  473. package/dist/services/git/run-git.d.ts +9 -0
  474. package/dist/services/git/run-git.d.ts.map +1 -0
  475. package/dist/services/git/run-git.js +22 -0
  476. package/dist/story/index.d.ts +3 -0
  477. package/dist/story/index.d.ts.map +1 -0
  478. package/dist/story/index.js +2 -0
  479. package/dist/story/schema/index.d.ts +6 -0
  480. package/dist/story/schema/index.d.ts.map +1 -0
  481. package/dist/story/schema/index.js +4 -0
  482. package/dist/story/schema/slug.d.ts +2 -0
  483. package/dist/story/schema/slug.d.ts.map +1 -0
  484. package/dist/story/schema/slug.js +6 -0
  485. package/dist/story/schema/story-report-schema.d.ts +408 -0
  486. package/dist/story/schema/story-report-schema.d.ts.map +1 -0
  487. package/dist/story/schema/story-report-schema.js +94 -0
  488. package/dist/story/schema/story-tree-schema.d.ts +42 -0
  489. package/dist/story/schema/story-tree-schema.d.ts.map +1 -0
  490. package/dist/story/schema/story-tree-schema.js +40 -0
  491. package/dist/story/story.d.ts +38 -0
  492. package/dist/story/story.d.ts.map +1 -0
  493. package/dist/story/story.js +56 -0
  494. package/dist/tests/authoring/index.d.ts +72 -0
  495. package/dist/tests/authoring/index.d.ts.map +1 -0
  496. package/dist/tests/authoring/index.js +312 -0
  497. package/dist/tests/run-tests/index.d.ts +3 -0
  498. package/dist/tests/run-tests/index.d.ts.map +1 -0
  499. package/dist/tests/run-tests/index.js +1 -0
  500. package/dist/tests/run-tests/run-tests.d.ts +26 -0
  501. package/dist/tests/run-tests/run-tests.d.ts.map +1 -0
  502. package/dist/tests/run-tests/run-tests.js +284 -0
  503. package/package.json +36 -24
  504. package/schema.json +212 -0
  505. package/dist/cli/index.d.ts +0 -2
  506. package/dist/cli/index.d.ts.map +0 -1
  507. package/dist/cli/index.js +0 -1
  508. package/dist/engine/1-extract/extract.d.ts.map +0 -1
  509. package/dist/engine/1-extract/index.d.ts +0 -3
  510. package/dist/engine/1-extract/index.d.ts.map +0 -1
  511. package/dist/engine/1-extract/index.js +0 -1
  512. package/dist/engine/2-resolve/index.d.ts +0 -3
  513. package/dist/engine/2-resolve/index.d.ts.map +0 -1
  514. package/dist/engine/2-resolve/index.js +0 -1
  515. package/dist/engine/2-resolve/resolve.d.ts.map +0 -1
  516. package/dist/engine/3-evaluate/evaluate.d.ts.map +0 -1
  517. package/dist/engine/3-evaluate/index.d.ts +0 -3
  518. package/dist/engine/3-evaluate/index.d.ts.map +0 -1
  519. package/dist/engine/3-evaluate/index.js +0 -1
  520. package/dist/engine/4-emit/emit.d.ts +0 -7
  521. package/dist/engine/4-emit/emit.d.ts.map +0 -1
  522. package/dist/engine/4-emit/index.d.ts +0 -2
  523. package/dist/engine/4-emit/index.d.ts.map +0 -1
  524. package/dist/engine/4-emit/index.js +0 -1
  525. package/dist/engine/errors.d.ts +0 -19
  526. package/dist/engine/errors.d.ts.map +0 -1
  527. package/dist/node.d.ts +0 -24
  528. package/dist/node.d.ts.map +0 -1
  529. package/dist/node.js +0 -139
  530. package/dist/report/stories.d.ts +0 -22
  531. package/dist/report/stories.d.ts.map +0 -1
  532. package/dist/report/stories.js +0 -1
  533. package/dist/story/artifact/artifact.d.ts +0 -57
  534. package/dist/story/artifact/artifact.d.ts.map +0 -1
  535. package/dist/story/artifact/artifact.js +0 -234
  536. package/dist/story/artifact/index.d.ts +0 -2
  537. package/dist/story/artifact/index.d.ts.map +0 -1
  538. package/dist/story/artifact/index.js +0 -1
  539. package/dist/story/artifact/storage.d.ts +0 -10
  540. package/dist/story/artifact/storage.d.ts.map +0 -1
  541. package/dist/story/artifact/storage.js +0 -162
  542. package/dist/story/artifact/types.d.ts +0 -74
  543. package/dist/story/artifact/types.d.ts.map +0 -1
  544. package/dist/story/artifact/types.js +0 -1
  545. package/dist/story/core/blocks.d.ts +0 -20
  546. package/dist/story/core/blocks.d.ts.map +0 -1
  547. package/dist/story/core/blocks.js +0 -104
  548. package/dist/story/core/declare.d.ts +0 -63
  549. package/dist/story/core/declare.d.ts.map +0 -1
  550. package/dist/story/core/declare.js +0 -62
  551. package/dist/story/core/index.d.ts +0 -4
  552. package/dist/story/core/index.d.ts.map +0 -1
  553. package/dist/story/core/index.js +0 -1
  554. package/dist/story/core/recorder.d.ts +0 -38
  555. package/dist/story/core/recorder.d.ts.map +0 -1
  556. package/dist/story/core/recorder.js +0 -28
  557. package/dist/story/core/runtime-context.d.ts +0 -14
  558. package/dist/story/core/runtime-context.d.ts.map +0 -1
  559. package/dist/story/core/runtime-context.js +0 -19
  560. package/dist/story/core/types.d.ts +0 -21
  561. package/dist/story/core/types.d.ts.map +0 -1
  562. package/dist/story/core/types.js +0 -1
  563. package/dist/story/effect/effect.d.ts +0 -52
  564. package/dist/story/effect/effect.d.ts.map +0 -1
  565. package/dist/story/effect/effect.js +0 -99
  566. package/dist/story/effect/index.d.ts +0 -3
  567. package/dist/story/effect/index.d.ts.map +0 -1
  568. package/dist/story/effect/index.js +0 -1
  569. package/dist/story/runner/index.d.ts +0 -3
  570. package/dist/story/runner/index.d.ts.map +0 -1
  571. package/dist/story/runner/index.js +0 -1
  572. package/dist/story/runner/runner.d.ts +0 -44
  573. package/dist/story/runner/runner.d.ts.map +0 -1
  574. package/dist/story/runner/runner.js +0 -476
  575. package/dist/story/story-runtime/index.d.ts +0 -2
  576. package/dist/story/story-runtime/index.d.ts.map +0 -1
  577. package/dist/story/story-runtime/index.js +0 -1
  578. package/dist/story/story-runtime/story-runtime.d.ts +0 -52
  579. package/dist/story/story-runtime/story-runtime.d.ts.map +0 -1
  580. package/dist/story/story-runtime/story-runtime.js +0 -194
  581. package/dist/story/vanilla/index.d.ts +0 -29
  582. package/dist/story/vanilla/index.d.ts.map +0 -1
  583. package/dist/story/vanilla/index.js +0 -78
@@ -1,162 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- import { mkdir, readFile, readdir, rm, unlink, writeFile, } from 'node:fs/promises';
3
- import { basename, join } from 'node:path';
4
- const storiesDirectory = '.laymos/stories';
5
- const rawDirectory = '.raw';
6
- export async function writeRawArtifact(baseDir, storyId, artifact) {
7
- const directory = join(baseDir, storiesDirectory, rawDirectory);
8
- await mkdir(directory, { recursive: true });
9
- await writeFile(join(directory, `${Buffer.from(storyId).toString('base64url')}.json`), canonicalStringify({ storyId, artifact }));
10
- }
11
- export async function clearRawArtifacts(baseDir) {
12
- await rm(join(baseDir, storiesDirectory, rawDirectory), {
13
- recursive: true,
14
- force: true,
15
- });
16
- }
17
- export async function commitRawArtifacts(baseDir, complete) {
18
- const directory = join(baseDir, storiesDirectory);
19
- const raw = join(directory, rawDirectory);
20
- await mkdir(directory, { recursive: true });
21
- const existing = complete ? emptyIndex() : await getStoryIndex(baseDir);
22
- const entries = new Map(Object.entries(existing.stories));
23
- const committedStoryIds = new Set();
24
- if (complete) {
25
- for (const file of await listFiles(directory)) {
26
- if (file.endsWith('.story.json') || file === 'index.json') {
27
- await unlink(join(directory, file));
28
- }
29
- }
30
- }
31
- for (const file of (await listFiles(raw)).sort()) {
32
- if (!file.endsWith('.json'))
33
- continue;
34
- const parsed = parseJson(await readFile(join(raw, file), 'utf8'), `raw Story artifact ${file}`);
35
- if (typeof parsed.storyId !== 'string') {
36
- throw new Error(`Raw Story artifact ${file} has no Story ID`);
37
- }
38
- const artifact = parseArtifact(parsed.artifact, file);
39
- committedStoryIds.add(parsed.storyId);
40
- const bytes = canonicalStringify(artifact);
41
- const hash = createHash('sha256').update(bytes).digest('hex');
42
- const artifactFile = `${storySlug(parsed.storyId)}-${hash}.story.json`;
43
- await writeFile(join(directory, artifactFile), bytes);
44
- const previous = entries.get(parsed.storyId);
45
- if (previous !== undefined && previous.artifact !== artifactFile) {
46
- await rm(join(directory, previous.artifact), { force: true });
47
- }
48
- entries.set(parsed.storyId, {
49
- name: artifact.name,
50
- description: artifact.description,
51
- artifact: artifactFile,
52
- generatedAt: artifact.generatedAt,
53
- });
54
- }
55
- const index = {
56
- schemaVersion: 2,
57
- stories: Object.fromEntries([...entries].sort(([left], [right]) => left.localeCompare(right))),
58
- };
59
- await writeFile(join(directory, 'index.json'), canonicalStringify(index));
60
- await rm(raw, { recursive: true, force: true });
61
- return { index, committedStoryIds };
62
- }
63
- export async function getStoryIndex(baseDir) {
64
- let bytes;
65
- try {
66
- bytes = await readFile(join(baseDir, storiesDirectory, 'index.json'), 'utf8');
67
- }
68
- catch (cause) {
69
- if (isMissingFile(cause))
70
- return emptyIndex();
71
- throw cause;
72
- }
73
- const value = parseJson(bytes, 'Story index');
74
- if (value.schemaVersion !== 2 || !isRecord(value.stories)) {
75
- throw new Error('Story index is malformed or has an unsupported schema');
76
- }
77
- for (const [storyId, entry] of Object.entries(value.stories)) {
78
- if (!isIndexEntry(entry)) {
79
- throw new Error(`Story index entry "${storyId}" is malformed`);
80
- }
81
- }
82
- return value;
83
- }
84
- export async function getStoryArtifact(baseDir, storyId) {
85
- const index = await getStoryIndex(baseDir);
86
- const entry = index.stories[storyId];
87
- if (entry === undefined)
88
- throw new Error(`Story "${storyId}" was not found`);
89
- const bytes = await readFile(join(baseDir, storiesDirectory, entry.artifact), 'utf8');
90
- const expectedHash = entry.artifact.match(/-([a-f0-9]{64})\.story\.json$/)?.[1];
91
- const actualHash = createHash('sha256').update(bytes).digest('hex');
92
- if (expectedHash === undefined || expectedHash !== actualHash) {
93
- throw new Error(`Story artifact "${entry.artifact}" failed its hash check`);
94
- }
95
- return parseArtifact(parseJson(bytes, `Story artifact ${entry.artifact}`), entry.artifact);
96
- }
97
- function canonicalStringify(value) {
98
- return JSON.stringify(sortValue(value));
99
- }
100
- function sortValue(value) {
101
- if (Array.isArray(value))
102
- return value.map(sortValue);
103
- if (!isRecord(value))
104
- return value;
105
- return Object.fromEntries(Object.entries(value)
106
- .sort(([left], [right]) => left.localeCompare(right))
107
- .map(([key, item]) => [key, sortValue(item)]));
108
- }
109
- function parseArtifact(value, source) {
110
- if (!isRecord(value) ||
111
- value.schemaVersion !== 2 ||
112
- typeof value.generatedAt !== 'number' ||
113
- typeof value.name !== 'string' ||
114
- typeof value.description !== 'string' ||
115
- !isRecord(value.blocks) ||
116
- !Array.isArray(value.scenarios)) {
117
- throw new Error(`Story artifact ${source} is malformed`);
118
- }
119
- return value;
120
- }
121
- function parseJson(value, source) {
122
- try {
123
- return JSON.parse(value);
124
- }
125
- catch (cause) {
126
- throw new Error(`${source} is not valid JSON`, { cause });
127
- }
128
- }
129
- function storySlug(storyId) {
130
- return basename(storyId)
131
- .replace(/\.story\.[^.]+$/, '')
132
- .replace(/[^a-z0-9-]+/g, '-');
133
- }
134
- function emptyIndex() {
135
- return { schemaVersion: 2, stories: {} };
136
- }
137
- async function listFiles(directory) {
138
- try {
139
- return await readdir(directory);
140
- }
141
- catch (cause) {
142
- if (isMissingFile(cause))
143
- return [];
144
- throw cause;
145
- }
146
- }
147
- function isIndexEntry(value) {
148
- return (isRecord(value) &&
149
- typeof value.name === 'string' &&
150
- typeof value.description === 'string' &&
151
- typeof value.artifact === 'string' &&
152
- typeof value.generatedAt === 'number');
153
- }
154
- function isRecord(value) {
155
- return typeof value === 'object' && value !== null && !Array.isArray(value);
156
- }
157
- function isMissingFile(cause) {
158
- return (typeof cause === 'object' &&
159
- cause !== null &&
160
- 'code' in cause &&
161
- cause.code === 'ENOENT');
162
- }
@@ -1,74 +0,0 @@
1
- export type StoryId = string;
2
- export type BlockId = string;
3
- export interface StorySourceLocation {
4
- readonly file: string;
5
- readonly line: number;
6
- readonly column: number;
7
- }
8
- interface StoryBlockBase {
9
- readonly name: string;
10
- readonly description: string;
11
- readonly location: StorySourceLocation;
12
- }
13
- export type StoryDecisionValue = string | number | boolean;
14
- export type StoryArm = {
15
- readonly kind: 'literal';
16
- readonly value: StoryDecisionValue;
17
- readonly name: string;
18
- readonly description: string;
19
- } | {
20
- readonly kind: 'otherwise';
21
- readonly name: string;
22
- readonly description: string;
23
- };
24
- export type StoryBlock = (StoryBlockBase & {
25
- readonly kind: 'block';
26
- }) | (StoryBlockBase & {
27
- readonly kind: 'decision';
28
- readonly arms: readonly StoryArm[];
29
- });
30
- export type ScenarioOutcome = 'succeeded' | 'failed' | 'interrupted' | 'skipped';
31
- export type StoryScenarioFailurePhase = 'preparation' | 'execution' | 'verification' | 'cleanup';
32
- export interface StoryScenarioFailure {
33
- readonly phase: StoryScenarioFailurePhase;
34
- readonly message: string;
35
- }
36
- export type StoryBlockVisitOutcome = 'succeeded' | 'failed' | 'interrupted';
37
- export type StorySelectedArm = {
38
- readonly kind: 'literal';
39
- readonly value: StoryDecisionValue;
40
- } | {
41
- readonly kind: 'otherwise';
42
- };
43
- export type ExecutionPath = readonly ExecutionItem[];
44
- export type ExecutionItem = {
45
- readonly blockId: BlockId;
46
- readonly outcome: StoryBlockVisitOutcome;
47
- readonly startOffsetMillis: number;
48
- readonly durationMillis: number;
49
- readonly selectedArm?: StorySelectedArm;
50
- readonly attributes?: Readonly<Record<string, unknown>>;
51
- readonly children: ExecutionPath;
52
- } | {
53
- readonly parallel: readonly ExecutionPath[];
54
- };
55
- export interface StoryScenario {
56
- readonly name: string;
57
- readonly description: string;
58
- readonly location: StorySourceLocation;
59
- readonly outcome: ScenarioOutcome;
60
- readonly startedAt?: number;
61
- readonly durationMillis?: number;
62
- readonly execution: ExecutionPath;
63
- readonly failures: readonly StoryScenarioFailure[];
64
- }
65
- export interface StoryArtifact {
66
- readonly schemaVersion: 3;
67
- readonly generatedAt: number;
68
- readonly name: string;
69
- readonly description: string;
70
- readonly blocks: Readonly<Record<BlockId, StoryBlock>>;
71
- readonly scenarios: readonly StoryScenario[];
72
- }
73
- export {};
74
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/story/artifact/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACxC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAChB;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEN,MAAM,MAAM,UAAU,GAClB,CAAC,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAC7C,CAAC,cAAc,GAAG;IAChB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,CAAC;CACpC,CAAC,CAAC;AAEP,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,QAAQ,GACR,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,yBAAyB,GACjC,aAAa,GACb,WAAW,GACX,cAAc,GACd,SAAS,CAAC;AAEd,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,yBAAyB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG,SAAS,aAAa,EAAE,CAAC;AAErD,MAAM,MAAM,aAAa,GACrB;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CAClC,GACD;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACpD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- import type { ArmMeta, BlockMeta, DecisionValue } from './types.js';
2
- type AnyFunction = (...args: any[]) => any;
3
- export interface DecisionBuilder<Remaining extends DecisionValue, Result> {
4
- when<Key extends Remaining, Next>(value: Key, body: (value: Key) => Next): DecisionBuilder<Exclude<Remaining, Key>, Result | Next>;
5
- when<Key extends Remaining, Next>(value: Key, meta: ArmMeta, body: (value: Key) => Next): DecisionBuilder<Exclude<Remaining, Key>, Result | Next>;
6
- otherwise<Next>(body: (value: Remaining) => Next): Result | Next;
7
- otherwise<Next>(meta: ArmMeta, body: (value: Remaining) => Next): Result | Next;
8
- readonly exhaustive: [Remaining] extends [never] ? () => Result : never;
9
- }
10
- /** Marks a reusable function boundary as a Story Block. */
11
- export declare function functionBlock<Fn extends AnyFunction>(name: string, fn: Fn): Fn;
12
- export declare function functionBlock<Fn extends AnyFunction>(name: string, meta: BlockMeta<Parameters<Fn>>, fn: Fn): Fn;
13
- /** Executes an inline Story Block. */
14
- export declare function step<R>(name: string, body: () => R): R;
15
- export declare function step<R>(name: string, meta: BlockMeta, body: () => R): R;
16
- /** Builds an eager, literal-keyed Story Decision. */
17
- export declare function decision<const Input extends DecisionValue>(name: string, input: Input): DecisionBuilder<Input, never>;
18
- export declare function decision<const Input extends DecisionValue>(name: string, meta: BlockMeta<[Input]>, input: Input): DecisionBuilder<Input, never>;
19
- export {};
20
- //# sourceMappingURL=blocks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/story/core/blocks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE3C,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,aAAa,EAAE,MAAM;IACtE,IAAI,CAAC,GAAG,SAAS,SAAS,EAAE,IAAI,EAC9B,KAAK,EAAE,GAAG,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GACzB,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,GAAG,SAAS,SAAS,EAAE,IAAI,EAC9B,KAAK,EAAE,GAAG,EACV,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GACzB,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3D,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IACjE,SAAS,CAAC,IAAI,EACZ,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAC/B,MAAM,GAAG,IAAI,CAAC;IACjB,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,GAAG,KAAK,CAAC;CACzE;AA8ED,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,EAAE,SAAS,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;AAChF,wBAAgB,aAAa,CAAC,EAAE,SAAS,WAAW,EAClD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,EAC/B,EAAE,EAAE,EAAE,GACL,EAAE,CAAC;AAuBN,sCAAsC;AACtC,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AACxD,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAmBzE,qDAAqD;AACrD,wBAAgB,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,aAAa,EACxD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GACX,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACjC,wBAAgB,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,aAAa,EACxD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,EACxB,KAAK,EAAE,KAAK,GACX,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC"}
@@ -1,104 +0,0 @@
1
- import { captureLocation, getRecorder, resolveAttributes } from './recorder.js';
2
- class DecisionBuilderImpl {
3
- state;
4
- constructor(state) {
5
- this.state = state;
6
- }
7
- when(value, metaOrBody, optionalBody) {
8
- const meta = typeof metaOrBody === 'function' ? {} : metaOrBody;
9
- const body = typeof metaOrBody === 'function' ? metaOrBody : optionalBody;
10
- if (body === undefined)
11
- throw new TypeError('Decision Arm body is required');
12
- const arm = {
13
- kind: 'literal',
14
- value,
15
- name: meta.name ?? String(value),
16
- ...(meta.description === undefined
17
- ? {}
18
- : { description: meta.description }),
19
- };
20
- getRecorder()?.declareArm(this.state.block, arm);
21
- if (!this.state.matched && Object.is(this.state.input, value)) {
22
- this.state.matched = true;
23
- this.state.result = runDecisionArm(this.state, { kind: 'literal', value }, () => body(value));
24
- }
25
- return this;
26
- }
27
- otherwise(metaOrBody, optionalBody) {
28
- const meta = typeof metaOrBody === 'function' ? {} : metaOrBody;
29
- const body = typeof metaOrBody === 'function' ? metaOrBody : optionalBody;
30
- if (body === undefined)
31
- throw new TypeError('Otherwise Arm body is required');
32
- const arm = {
33
- kind: 'otherwise',
34
- name: meta.name ?? 'Otherwise',
35
- ...(meta.description === undefined
36
- ? {}
37
- : { description: meta.description }),
38
- };
39
- getRecorder()?.declareArm(this.state.block, arm);
40
- if (!this.state.matched) {
41
- this.state.matched = true;
42
- this.state.result = runDecisionArm(this.state, { kind: 'otherwise' }, () => body(this.state.input));
43
- }
44
- return this.state.result;
45
- }
46
- exhaustive() {
47
- return this.state.result;
48
- }
49
- }
50
- export function functionBlock(name, metaOrFn, optionalFn) {
51
- const meta = typeof metaOrFn === 'function' ? {} : metaOrFn;
52
- const fn = (typeof metaOrFn === 'function' ? metaOrFn : optionalFn);
53
- if (fn === undefined)
54
- throw new TypeError('Function Block body is required');
55
- const block = makeBlock(name, meta, 'block');
56
- return function (...args) {
57
- const recorder = getRecorder();
58
- if (recorder === undefined)
59
- return fn.apply(this, args);
60
- const attributes = resolveAttributes(meta.attributes, args);
61
- return recorder.run(block, undefined, attributes, () => fn.apply(this, args));
62
- };
63
- }
64
- export function step(name, metaOrBody, optionalBody) {
65
- const meta = typeof metaOrBody === 'function' ? {} : metaOrBody;
66
- const body = typeof metaOrBody === 'function' ? metaOrBody : optionalBody;
67
- if (body === undefined)
68
- throw new TypeError('Step body is required');
69
- const recorder = getRecorder();
70
- if (recorder === undefined)
71
- return body();
72
- return recorder.run(makeBlock(name, meta, 'block'), undefined, resolveAttributes(meta.attributes, []), body);
73
- }
74
- export function decision(name, metaOrInput, optionalInput) {
75
- const hasMeta = typeof metaOrInput === 'object';
76
- const meta = (hasMeta ? metaOrInput : {});
77
- const input = (hasMeta ? optionalInput : metaOrInput);
78
- if (input === undefined)
79
- throw new TypeError('Decision value is required');
80
- const state = {
81
- block: makeBlock(name, meta, 'decision'),
82
- input,
83
- attributes: meta.attributes,
84
- matched: false,
85
- result: undefined,
86
- };
87
- return new DecisionBuilderImpl(state);
88
- }
89
- function makeBlock(name, meta, kind) {
90
- return {
91
- name,
92
- kind,
93
- location: captureLocation(),
94
- ...(meta.description === undefined
95
- ? {}
96
- : { description: meta.description }),
97
- };
98
- }
99
- function runDecisionArm(state, selectedArm, body) {
100
- const recorder = getRecorder();
101
- if (recorder === undefined)
102
- return body();
103
- return recorder.run(state.block, selectedArm, resolveAttributes(state.attributes, [state.input]), body);
104
- }
@@ -1,63 +0,0 @@
1
- import type { SourceLocation } from './recorder.js';
2
- import type { StoryGroupMeta, StoryMeta } from './types.js';
3
- export type ScenarioExpectation = {
4
- readonly kind: 'success';
5
- readonly verify: (value: unknown, prepared: unknown) => unknown;
6
- } | {
7
- readonly kind: 'error';
8
- readonly verify: (error: unknown, prepared: unknown) => unknown;
9
- };
10
- interface ScenarioDeclarationBase {
11
- readonly name: string;
12
- readonly description: string;
13
- readonly mode: 'run' | 'skip';
14
- readonly location: SourceLocation;
15
- }
16
- export type ScenarioDeclaration = (ScenarioDeclarationBase & {
17
- readonly mode: 'skip';
18
- }) | (ScenarioDeclarationBase & {
19
- readonly mode: 'run';
20
- readonly run: {
21
- readonly prepare: () => unknown;
22
- readonly expectation: ScenarioExpectation;
23
- readonly cleanup?: (prepared: unknown) => unknown;
24
- readonly timeout?: unknown;
25
- };
26
- });
27
- export interface StoryExecution {
28
- readonly execute: (prepared: unknown) => unknown;
29
- readonly layer?: unknown;
30
- }
31
- export interface StoryDeclaration {
32
- readonly name: string;
33
- readonly description: string;
34
- readonly group?: StoryGroupDeclaration;
35
- readonly scenarios: readonly ScenarioDeclaration[];
36
- readonly execution: StoryExecution | undefined;
37
- }
38
- export interface StoryGroupDeclaration {
39
- readonly name: string;
40
- readonly description: string;
41
- readonly parent?: StoryGroupDeclaration;
42
- }
43
- export interface MutableStoryDeclaration {
44
- readonly name: string;
45
- readonly description: string;
46
- readonly group?: StoryGroupDeclaration;
47
- readonly scenarios: ScenarioDeclaration[];
48
- execution: StoryExecution | undefined;
49
- }
50
- export type StoryCollector = (declaration: StoryDeclaration) => void;
51
- /** Declares the single Story owned by a Story file. */
52
- export declare function declareStory(name: string, meta: StoryMeta, group?: StoryGroupDeclaration): MutableStoryDeclaration;
53
- export declare function declareStoryGroup(name: string, meta: StoryGroupMeta, parent?: StoryGroupDeclaration): StoryGroupDeclaration;
54
- /** Adds a Scenario to a mutable Story declaration. */
55
- export declare function addScenario(declaration: MutableStoryDeclaration, scenario: Omit<Extract<ScenarioDeclaration, {
56
- readonly mode: 'skip';
57
- }>, 'location'> | Omit<Extract<ScenarioDeclaration, {
58
- readonly mode: 'run';
59
- }>, 'location'>): void;
60
- /** Runs `load` with a Story collector installed and returns what it declared. */
61
- export declare function collectDeclaredStories(load: () => Promise<unknown>): Promise<StoryDeclaration[]>;
62
- export {};
63
- //# sourceMappingURL=declare.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../../src/story/core/declare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAC3B;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;CACjE,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;CACjE,CAAC;AAEN,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,MAAM,mBAAmB,GAC3B,CAAC,uBAAuB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACrD,CAAC,uBAAuB,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE;QACZ,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;QAChC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;QAClD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH,CAAC,CAAC;AAEP,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IAC1C,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAUrE,uDAAuD;AACvD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,qBAAqB,GAC5B,uBAAuB,CAYzB;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,MAAM,CAAC,EAAE,qBAAqB,GAC7B,qBAAqB,CAQvB;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CACzB,WAAW,EAAE,uBAAuB,EACpC,QAAQ,EACJ,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,UAAU,CAAC,GACzE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,EAAE,UAAU,CAAC,GAC3E,IAAI,CAMN;AAiBD,iFAAiF;AACjF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAY7B"}
@@ -1,62 +0,0 @@
1
- import { captureLocation } from './recorder.js';
2
- const collectorKey = Symbol.for('laymos/story-collector');
3
- const collectorHost = globalThis;
4
- /** Declares the single Story owned by a Story file. */
5
- export function declareStory(name, meta, group) {
6
- requirePathSegment(name, 'Story');
7
- requireDescription(meta.description, `Story "${name}"`);
8
- const declaration = {
9
- name,
10
- description: meta.description,
11
- ...(group === undefined ? {} : { group }),
12
- scenarios: [],
13
- execution: undefined,
14
- };
15
- collectorHost[collectorKey]?.(declaration);
16
- return declaration;
17
- }
18
- export function declareStoryGroup(name, meta, parent) {
19
- requirePathSegment(name, 'Story Group');
20
- requireDescription(meta.description, `Story Group "${name}"`);
21
- return {
22
- name,
23
- description: meta.description,
24
- ...(parent === undefined ? {} : { parent }),
25
- };
26
- }
27
- /** Adds a Scenario to a mutable Story declaration. */
28
- export function addScenario(declaration, scenario) {
29
- requireDescription(scenario.description, `Scenario "${scenario.name}"`);
30
- declaration.scenarios.push({
31
- ...scenario,
32
- location: captureLocation(),
33
- });
34
- }
35
- function requireDescription(description, subject) {
36
- if (description.trim().length === 0) {
37
- throw new TypeError(`${subject} description must not be empty`);
38
- }
39
- }
40
- function requirePathSegment(name, subject) {
41
- if (name.trim().length === 0) {
42
- throw new TypeError(`${subject} name must not be empty`);
43
- }
44
- if (name.includes('/')) {
45
- throw new TypeError(`${subject} name "${name}" must not contain "/"`);
46
- }
47
- }
48
- /** Runs `load` with a Story collector installed and returns what it declared. */
49
- export async function collectDeclaredStories(load) {
50
- if (collectorHost[collectorKey] !== undefined) {
51
- throw new Error('Story modules must be loaded sequentially');
52
- }
53
- const collected = [];
54
- collectorHost[collectorKey] = (declaration) => collected.push(declaration);
55
- try {
56
- await load();
57
- return collected;
58
- }
59
- finally {
60
- delete collectorHost[collectorKey];
61
- }
62
- }
@@ -1,4 +0,0 @@
1
- export { decision, functionBlock, step } from './blocks.js';
2
- export type { DecisionBuilder } from './blocks.js';
3
- export type { ArmMeta, Attributes, BlockMeta, DecisionValue } from './types.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/story/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- export { decision, functionBlock, step } from './blocks.js';
@@ -1,38 +0,0 @@
1
- import { Context } from 'effect';
2
- import type { Attributes, AttributesInput, DecisionValue } from './types.js';
3
- export interface SourceLocation {
4
- readonly file: string;
5
- readonly line: number;
6
- readonly column: number;
7
- }
8
- export interface BlockDeclaration {
9
- readonly name: string;
10
- readonly description: string;
11
- readonly kind: 'block' | 'decision';
12
- readonly location: SourceLocation;
13
- }
14
- export type ArmDeclaration = {
15
- readonly kind: 'literal';
16
- readonly value: DecisionValue;
17
- readonly name: string;
18
- readonly description: string;
19
- } | {
20
- readonly kind: 'otherwise';
21
- readonly name: string;
22
- readonly description: string;
23
- };
24
- export type SelectedArm = {
25
- readonly kind: 'literal';
26
- readonly value: DecisionValue;
27
- } | {
28
- readonly kind: 'otherwise';
29
- };
30
- export interface StoryRecorder {
31
- declareArm(block: BlockDeclaration, arm: ArmDeclaration): void;
32
- start(block: BlockDeclaration, selectedArm: SelectedArm | undefined, attributes: Attributes | undefined, parent: unknown): unknown;
33
- finish(token: unknown, outcome: 'succeeded' | 'failed' | 'interrupted'): void;
34
- }
35
- export declare const CurrentRecorder: Context.Reference<StoryRecorder | undefined>;
36
- export declare function resolveAttributes<Args extends readonly unknown[]>(input: AttributesInput<Args> | undefined, args: Args): Attributes | undefined;
37
- export declare function captureLocation(): SourceLocation;
38
- //# sourceMappingURL=recorder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../src/story/core/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/D,KAAK,CACH,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,WAAW,GAAG,SAAS,EACpC,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC;IACX,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,IAAI,CAAC;CAC/E;AAED,eAAO,MAAM,eAAe,8CAG3B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,SAAS,OAAO,EAAE,EAC/D,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,SAAS,EACxC,IAAI,EAAE,IAAI,GACT,UAAU,GAAG,SAAS,CAGxB;AAED,wBAAgB,eAAe,IAAI,cAAc,CAwBhD"}
@@ -1,28 +0,0 @@
1
- import { Context } from 'effect';
2
- export const CurrentRecorder = Context.Reference('laymos/story/current-recorder', { defaultValue: () => undefined });
3
- export function resolveAttributes(input, args) {
4
- if (input === undefined)
5
- return undefined;
6
- return typeof input === 'function' ? input(...args) : input;
7
- }
8
- export function captureLocation() {
9
- const stack = new Error().stack?.split('\n').slice(1) ?? [];
10
- for (const line of stack) {
11
- if (line.includes('/story/core/') ||
12
- line.includes('/story/effect/') ||
13
- line.includes('/story/story-runtime/') ||
14
- line.includes('/story/runner/') ||
15
- line.includes('node:internal')) {
16
- continue;
17
- }
18
- const match = line.match(/(?:\(|\s)(file:\/\/\/[^)\s]+|\/[^)\s]+):(\d+):(\d+)\)?$/);
19
- if (match?.[1] !== undefined) {
20
- return {
21
- file: decodeURIComponent(match[1].replace(/^file:\/\//, '')),
22
- line: Number(match[2]),
23
- column: Number(match[3]),
24
- };
25
- }
26
- }
27
- return { file: '<unknown>', line: 0, column: 0 };
28
- }
@@ -1,14 +0,0 @@
1
- import type { MutableStoryDeclaration, StoryCollector } from './declare.js';
2
- import type { StoryRecorder } from './recorder.js';
3
- export interface StoryRuntimeContext {
4
- readonly activeStory: MutableStoryDeclaration | undefined;
5
- readonly collector: StoryCollector | undefined;
6
- readonly recorder: StoryRecorder | undefined;
7
- }
8
- type StoryRuntimeContextUpdate = {
9
- readonly [Key in keyof StoryRuntimeContext]?: StoryRuntimeContext[Key];
10
- };
11
- export declare function getStoryRuntimeContext(): StoryRuntimeContext;
12
- export declare function withStoryRuntimeContext<R>(update: StoryRuntimeContextUpdate, body: () => R): R;
13
- export {};
14
- //# sourceMappingURL=runtime-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-context.d.ts","sourceRoot":"","sources":["../../../src/story/core/runtime-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC;CAC9C;AAED,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC;CACvE,CAAC;AAcF,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,MAAM,CAAC,GACZ,CAAC,CAGH"}
@@ -1,19 +0,0 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
2
- const runtimeContextKey = Symbol.for('laymos/story-runtime-context');
3
- const emptyContext = {
4
- activeStory: undefined,
5
- collector: undefined,
6
- recorder: undefined,
7
- };
8
- export function getStoryRuntimeContext() {
9
- return getRuntimeContextStorage().getStore() ?? emptyContext;
10
- }
11
- export function withStoryRuntimeContext(update, body) {
12
- const context = { ...getStoryRuntimeContext(), ...update };
13
- return getRuntimeContextStorage().run(context, body);
14
- }
15
- function getRuntimeContextStorage() {
16
- const host = globalThis;
17
- host[runtimeContextKey] ??= new AsyncLocalStorage();
18
- return host[runtimeContextKey];
19
- }
@@ -1,21 +0,0 @@
1
- export type DecisionValue = string | number | boolean;
2
- export type Attributes = Readonly<Record<string, unknown>>;
3
- export type AttributesInput<Args extends readonly unknown[]> = Attributes | ((...args: Args) => Attributes);
4
- export interface BlockMeta<Args extends readonly unknown[] = readonly []> {
5
- readonly description: string;
6
- readonly attributes?: AttributesInput<Args>;
7
- }
8
- export interface ArmMeta {
9
- readonly name?: string;
10
- readonly description: string;
11
- }
12
- export interface StoryMeta {
13
- readonly description: string;
14
- }
15
- export interface StoryGroupMeta {
16
- readonly description: string;
17
- }
18
- export interface ScenarioMeta {
19
- readonly description: string;
20
- }
21
- //# sourceMappingURL=types.d.ts.map