@hawkeyexl/manni 4.21.0 → 4.23.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 (316) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-C534YIAU.js → batch-DPYBMRVD.js} +21 -22
  3. package/dist/build-LEKUMGEC.js +36 -0
  4. package/dist/calibrate-TYONPNG4.js +42 -0
  5. package/dist/capture-2EPHIAZT.js +37 -0
  6. package/dist/check-ADCSXGBK.js +57 -0
  7. package/dist/check-HWEDHABD.js +30 -0
  8. package/dist/check-J2KQI7IW.js +33 -0
  9. package/dist/check-L5AUSTE6.js +57 -0
  10. package/dist/{check-LKPQPQWJ.js → check-SQVQE4E4.js} +23 -23
  11. package/dist/{chunk-D4QHRVDJ.js → chunk-2GPF4OEF.js} +3 -157
  12. package/dist/chunk-2GPF4OEF.js.map +1 -0
  13. package/dist/{chunk-IOJD2RFG.js → chunk-2MOXVM6H.js} +2 -2
  14. package/dist/{chunk-762MM6NA.js → chunk-2QK25SLZ.js} +4 -4
  15. package/dist/{chunk-HHJ2HFPP.js → chunk-2UJOQ6CB.js} +9 -9
  16. package/dist/{chunk-H5YWCCBO.js → chunk-3CBGLUJX.js} +3 -3
  17. package/dist/{chunk-E23KWEPL.js → chunk-3USSSKLA.js} +2 -2
  18. package/dist/{chunk-PTGXEZQD.js → chunk-3ZVRGBK6.js} +4 -4
  19. package/dist/{chunk-XI3BNZG4.js → chunk-5JXA75XB.js} +46 -7
  20. package/dist/chunk-5JXA75XB.js.map +1 -0
  21. package/dist/{chunk-IN5T22FP.js → chunk-6QNA7UX2.js} +2 -2
  22. package/dist/{chunk-CZIO37J5.js → chunk-6RENCXLC.js} +10 -5
  23. package/dist/chunk-6RENCXLC.js.map +1 -0
  24. package/dist/{chunk-WHVFHBL3.js → chunk-72UN462G.js} +11 -3
  25. package/dist/chunk-72UN462G.js.map +1 -0
  26. package/dist/{chunk-OWJLB2AF.js → chunk-76Y3JATE.js} +2 -2
  27. package/dist/chunk-7M3MBFG7.js +38 -0
  28. package/dist/chunk-7M3MBFG7.js.map +1 -0
  29. package/dist/{chunk-BHGFLRXM.js → chunk-7NSFGAAQ.js} +8 -7
  30. package/dist/chunk-7NSFGAAQ.js.map +1 -0
  31. package/dist/{chunk-3SFAB75L.js → chunk-AJCUKL43.js} +6 -6
  32. package/dist/{chunk-CREFJCWZ.js → chunk-AOLCEULZ.js} +8 -8
  33. package/dist/{chunk-Q76T6Y6X.js → chunk-AZKNB2T3.js} +3635 -3409
  34. package/dist/chunk-AZKNB2T3.js.map +1 -0
  35. package/dist/{chunk-2NGFDLIM.js → chunk-B4ECIBLF.js} +4 -4
  36. package/dist/{chunk-5UJKXOAD.js → chunk-B4POKRCS.js} +6 -6
  37. package/dist/chunk-BA7BQBWV.js +311 -0
  38. package/dist/chunk-BA7BQBWV.js.map +1 -0
  39. package/dist/{chunk-KBSTXL6L.js → chunk-BOCJTOKA.js} +4 -4
  40. package/dist/{chunk-CFMI74TP.js → chunk-BZ74YUYE.js} +2 -2
  41. package/dist/{chunk-NLJ3XIKT.js → chunk-C2QE4FSZ.js} +3 -3
  42. package/dist/{chunk-DENZLZ3Z.js → chunk-CLUUSZDY.js} +26 -17
  43. package/dist/chunk-CLUUSZDY.js.map +1 -0
  44. package/dist/{chunk-PACZEDOH.js → chunk-CWPRB7SA.js} +19 -15
  45. package/dist/chunk-CWPRB7SA.js.map +1 -0
  46. package/dist/{chunk-245W2Q7C.js → chunk-D4BGNAN5.js} +2 -2
  47. package/dist/{chunk-XBJKYXOR.js → chunk-DWUK6YNX.js} +11 -11
  48. package/dist/{chunk-MTCOBRCX.js → chunk-E75CMOR3.js} +4 -4
  49. package/dist/{chunk-TFVNEPMF.js → chunk-EAF4K7IK.js} +4 -4
  50. package/dist/{chunk-TFVNEPMF.js.map → chunk-EAF4K7IK.js.map} +1 -1
  51. package/dist/{chunk-KCWNJMSS.js → chunk-EBBJFXMX.js} +3 -3
  52. package/dist/{chunk-LWBNHK72.js → chunk-EPN67ZNX.js} +47 -29
  53. package/dist/chunk-EPN67ZNX.js.map +1 -0
  54. package/dist/{chunk-6XK3NTL5.js → chunk-FBIBR4CH.js} +35 -40
  55. package/dist/chunk-FBIBR4CH.js.map +1 -0
  56. package/dist/{chunk-5LE4NH3Z.js → chunk-FJYIPHWK.js} +6 -4
  57. package/dist/{chunk-5LE4NH3Z.js.map → chunk-FJYIPHWK.js.map} +1 -1
  58. package/dist/{chunk-A4QNKEX4.js → chunk-GCHEVTCJ.js} +2 -2
  59. package/dist/{chunk-GMOAW2EG.js → chunk-GIHIONJH.js} +3 -2
  60. package/dist/chunk-GIHIONJH.js.map +1 -0
  61. package/dist/{chunk-P7HAXMFN.js → chunk-I4KDAO6P.js} +5 -3
  62. package/dist/{chunk-P7HAXMFN.js.map → chunk-I4KDAO6P.js.map} +1 -1
  63. package/dist/chunk-INOVEO32.js +28 -0
  64. package/dist/chunk-INOVEO32.js.map +1 -0
  65. package/dist/{chunk-B2242FYO.js → chunk-JF4BC7ZD.js} +38 -3
  66. package/dist/chunk-JF4BC7ZD.js.map +1 -0
  67. package/dist/{chunk-RKACUTY5.js → chunk-JZWQQOUN.js} +9 -11
  68. package/dist/{chunk-RKACUTY5.js.map → chunk-JZWQQOUN.js.map} +1 -1
  69. package/dist/{chunk-BXCVOHEX.js → chunk-K4YR4PY2.js} +15 -13
  70. package/dist/{chunk-BXCVOHEX.js.map → chunk-K4YR4PY2.js.map} +1 -1
  71. package/dist/{chunk-BXE4L52Q.js → chunk-KX6HRTLH.js} +6599 -3508
  72. package/dist/chunk-KX6HRTLH.js.map +1 -0
  73. package/dist/{chunk-V2XJJEEF.js → chunk-L3DOX3UL.js} +4 -4
  74. package/dist/{chunk-FHJIH6XP.js → chunk-LHP56Q45.js} +16 -7
  75. package/dist/chunk-LHP56Q45.js.map +1 -0
  76. package/dist/{chunk-BLXRIAV2.js → chunk-LT3STF5K.js} +29 -4
  77. package/dist/chunk-LT3STF5K.js.map +1 -0
  78. package/dist/{chunk-SHXPE4D4.js → chunk-MGQNGW6I.js} +2 -2
  79. package/dist/{chunk-SHXPE4D4.js.map → chunk-MGQNGW6I.js.map} +1 -1
  80. package/dist/{chunk-JUUCCML3.js → chunk-MPRVAMO3.js} +4 -4
  81. package/dist/{chunk-JQA6RF4R.js → chunk-N2T6RLSE.js} +2 -2
  82. package/dist/{chunk-JQA6RF4R.js.map → chunk-N2T6RLSE.js.map} +1 -1
  83. package/dist/{chunk-JCTHXG33.js → chunk-NHOGTAPK.js} +2 -2
  84. package/dist/{chunk-VM7VAFJW.js → chunk-NVYDWVXN.js} +2 -1
  85. package/dist/{chunk-ARNI3SJT.js → chunk-OL3Z7KPQ.js} +9 -9
  86. package/dist/chunk-P6LRDWMJ.js +1875 -0
  87. package/dist/chunk-P6LRDWMJ.js.map +1 -0
  88. package/dist/{chunk-NUQF5F5J.js → chunk-PNDEKFF3.js} +2 -2
  89. package/dist/chunk-QJGPOFNB.js +409 -0
  90. package/dist/chunk-QJGPOFNB.js.map +1 -0
  91. package/dist/{chunk-DMVBIIP3.js → chunk-QJL57GPX.js} +3 -3
  92. package/dist/{chunk-AE6KBAAU.js → chunk-QR55QXJ7.js} +11 -11
  93. package/dist/{chunk-BJUEOC4G.js → chunk-QWVIGKBM.js} +3 -3
  94. package/dist/{chunk-E7OG5F6S.js → chunk-RZ6OONZU.js} +13 -11
  95. package/dist/{chunk-E7OG5F6S.js.map → chunk-RZ6OONZU.js.map} +1 -1
  96. package/dist/{chunk-U4OJ7U45.js → chunk-SZMJ24FR.js} +9 -9
  97. package/dist/{chunk-KQDRO6N6.js → chunk-TLY44PCL.js} +2 -2
  98. package/dist/{chunk-VLRIP4BQ.js → chunk-TOVSR2YO.js} +2 -2
  99. package/dist/chunk-TT5UDTDM.js +888 -0
  100. package/dist/chunk-TT5UDTDM.js.map +1 -0
  101. package/dist/{chunk-2YKUSTHS.js → chunk-TVLIJ6ZM.js} +5 -5
  102. package/dist/{chunk-RQPEKHZH.js → chunk-UQYDLEBS.js} +80 -16
  103. package/dist/chunk-UQYDLEBS.js.map +1 -0
  104. package/dist/{chunk-GMLOAKOA.js → chunk-VSDXZAQU.js} +4 -22
  105. package/dist/chunk-VSDXZAQU.js.map +1 -0
  106. package/dist/{chunk-22WGKOQ7.js → chunk-VTJAY3WN.js} +7 -7
  107. package/dist/{chunk-DPDG3FHL.js → chunk-WHECOVH2.js} +3 -3
  108. package/dist/{chunk-BKY6GAFA.js → chunk-WPHPLVS3.js} +53 -918
  109. package/dist/chunk-WPHPLVS3.js.map +1 -0
  110. package/dist/{chunk-SSQZB5SQ.js → chunk-XG6PVB5S.js} +11 -1
  111. package/dist/chunk-XG6PVB5S.js.map +1 -0
  112. package/dist/{chunk-R2CR62JV.js → chunk-XVL7DYWM.js} +4 -4
  113. package/dist/{chunk-CLPC3LKX.js → chunk-Y4O737F7.js} +4 -4
  114. package/dist/{chunk-YSZNJ2ID.js → chunk-YBPXVBSY.js} +2 -2
  115. package/dist/{chunk-2HOWRAWK.js → chunk-YJHH2DHV.js} +2 -2
  116. package/dist/{chunk-APAF4VWW.js → chunk-YUCH6WJY.js} +6 -405
  117. package/dist/chunk-YUCH6WJY.js.map +1 -0
  118. package/dist/chunk-ZAOJYN2D.js +159 -0
  119. package/dist/chunk-ZAOJYN2D.js.map +1 -0
  120. package/dist/{cli-77A46SB2.js → cli-4R5HIGG4.js} +33 -21
  121. package/dist/{cli-77A46SB2.js.map → cli-4R5HIGG4.js.map} +1 -1
  122. package/dist/{cli-6NKE6RMT.js → cli-BF6KB3EJ.js} +34 -22
  123. package/dist/{cli-6NKE6RMT.js.map → cli-BF6KB3EJ.js.map} +1 -1
  124. package/dist/{cli-3PBRPPMQ.js → cli-DXOHHWZK.js} +16 -19
  125. package/dist/{cli-3PBRPPMQ.js.map → cli-DXOHHWZK.js.map} +1 -1
  126. package/dist/{cli-AVHLY2AI.js → cli-MPMECIQH.js} +154 -65
  127. package/dist/cli-MPMECIQH.js.map +1 -0
  128. package/dist/cli-NDYBQ755.js +152 -0
  129. package/dist/cli-NDYBQ755.js.map +1 -0
  130. package/dist/{cli-K47XWDLJ.js → cli-SJA66MIP.js} +29 -30
  131. package/dist/{cli-K47XWDLJ.js.map → cli-SJA66MIP.js.map} +1 -1
  132. package/dist/{cli-FDXU7CGZ.js → cli-TBAOKTMV.js} +16 -19
  133. package/dist/{cli-FDXU7CGZ.js.map → cli-TBAOKTMV.js.map} +1 -1
  134. package/dist/{cli-MQXOK64K.js → cli-TWGGMUXX.js} +89 -45
  135. package/dist/cli-TWGGMUXX.js.map +1 -0
  136. package/dist/{cli-FSDJY5OC.js → cli-V2BJYNMF.js} +4 -4
  137. package/dist/{cli-JNYL6LB7.js → cli-XGCK2LUV.js} +19 -22
  138. package/dist/{cli-JNYL6LB7.js.map → cli-XGCK2LUV.js.map} +1 -1
  139. package/dist/{cli-MOKRUHZT.js → cli-XXN75A42.js} +9 -11
  140. package/dist/cli.js +15 -15
  141. package/dist/cli.js.map +1 -1
  142. package/dist/{config-BMWDC66C.js → config-2YJPJ36T.js} +5 -5
  143. package/dist/docmeta.js +8 -10
  144. package/dist/docmeta.js.map +1 -1
  145. package/dist/github-NQQTH5JK.js +33 -0
  146. package/dist/github-NWL2XGE7.js +48 -0
  147. package/dist/github-WBIEYSM7.js +28 -0
  148. package/dist/graph/runtime.js.map +1 -1
  149. package/dist/{host-YSTYO5DX.js → host-JT27OWTC.js} +3 -3
  150. package/dist/index.d.ts +363 -25
  151. package/dist/index.js +289 -270
  152. package/dist/index.js.map +1 -1
  153. package/dist/json-IVHRVOGQ.js +40 -0
  154. package/dist/{json-YTKUFNO3.js → json-J4TONMKY.js} +2 -2
  155. package/dist/{json-YIK72XAL.js → json-QQAK73QQ.js} +12 -15
  156. package/dist/{labels-X633ZPK7.js → labels-VI2I5YFD.js} +11 -14
  157. package/dist/{labels-X633ZPK7.js.map → labels-VI2I5YFD.js.map} +1 -1
  158. package/dist/lint-VB5A3ENL.js +32 -0
  159. package/dist/list-3XRFX2Y3.js +33 -0
  160. package/dist/list-LMYCD5G5.js +37 -0
  161. package/dist/list-LOS7FTFD.js +30 -0
  162. package/dist/{page-OMPEACUN.js → page-3Y4EGYUO.js} +11 -14
  163. package/dist/{prepare-B4JVDVOV.js → prepare-JK6XKBZB.js} +20 -22
  164. package/dist/{prepare-B4JVDVOV.js.map → prepare-JK6XKBZB.js.map} +1 -1
  165. package/dist/{pretty-U7ATCFBN.js → pretty-DR4GHOJG.js} +12 -15
  166. package/dist/pretty-G2J5UEXC.js +41 -0
  167. package/dist/pretty-GCEIQ3FP.js +65 -0
  168. package/dist/{provider-JY2I3VLF.js → provider-YWNTTQPA.js} +3 -3
  169. package/dist/{release-VHHASAG7.js → release-EFLQT3FW.js} +3 -3
  170. package/dist/{reporters-FAIEOTC4.js → reporters-43LBUWEE.js} +11 -14
  171. package/dist/{reporters-KE7AZR6C.js → reporters-OWYFZD4S.js} +6 -6
  172. package/dist/run-G6G55SWJ.js +36 -0
  173. package/dist/{sarif-DOGRSGTB.js → sarif-CN7RSIKH.js} +10 -13
  174. package/dist/sarif-FR26WNVT.js +49 -0
  175. package/dist/sarif-GWTNYCZJ.js +28 -0
  176. package/dist/strategy-3EZUOE2T.js +59 -0
  177. package/dist/{term-MDN3NJDW.js → term-5WITRS3M.js} +21 -25
  178. package/dist/{term-MDN3NJDW.js.map → term-5WITRS3M.js.map} +1 -1
  179. package/dist/{validate-QDYQ642J.js → validate-TDIEFXRQ.js} +6 -7
  180. package/package.json +1 -1
  181. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  182. package/plugin/manni/hooks/graph-server.mjs +3 -3
  183. package/plugin/manni/hooks/page-metadata.mjs +81 -7
  184. package/plugin/manni/skills/fix/SKILL.md +3 -3
  185. package/shapes/graph/shapes-1.3.0.ttl +1250 -0
  186. package/dist/build-SVKT7QFU.js +0 -39
  187. package/dist/calibrate-AL3MH7TY.js +0 -43
  188. package/dist/capture-2F7B4DAD.js +0 -39
  189. package/dist/check-BI7OGIVE.js +0 -48
  190. package/dist/check-JZINDP3F.js +0 -45
  191. package/dist/check-OPUMZEVK.js +0 -35
  192. package/dist/check-OW7UD73D.js +0 -33
  193. package/dist/chunk-6XK3NTL5.js.map +0 -1
  194. package/dist/chunk-APAF4VWW.js.map +0 -1
  195. package/dist/chunk-B2242FYO.js.map +0 -1
  196. package/dist/chunk-BHGFLRXM.js.map +0 -1
  197. package/dist/chunk-BKY6GAFA.js.map +0 -1
  198. package/dist/chunk-BLXRIAV2.js.map +0 -1
  199. package/dist/chunk-BXE4L52Q.js.map +0 -1
  200. package/dist/chunk-CZIO37J5.js.map +0 -1
  201. package/dist/chunk-D4QHRVDJ.js.map +0 -1
  202. package/dist/chunk-D5GBYKDU.js +0 -164
  203. package/dist/chunk-D5GBYKDU.js.map +0 -1
  204. package/dist/chunk-DENZLZ3Z.js.map +0 -1
  205. package/dist/chunk-FHJIH6XP.js.map +0 -1
  206. package/dist/chunk-GMLOAKOA.js.map +0 -1
  207. package/dist/chunk-GMOAW2EG.js.map +0 -1
  208. package/dist/chunk-LWBNHK72.js.map +0 -1
  209. package/dist/chunk-PACZEDOH.js.map +0 -1
  210. package/dist/chunk-Q76T6Y6X.js.map +0 -1
  211. package/dist/chunk-RQPEKHZH.js.map +0 -1
  212. package/dist/chunk-RWXR3GJI.js +0 -441
  213. package/dist/chunk-RWXR3GJI.js.map +0 -1
  214. package/dist/chunk-S5G6T4VC.js +0 -3200
  215. package/dist/chunk-S5G6T4VC.js.map +0 -1
  216. package/dist/chunk-SSQZB5SQ.js.map +0 -1
  217. package/dist/chunk-UP6NBQ62.js +0 -2
  218. package/dist/chunk-WHVFHBL3.js.map +0 -1
  219. package/dist/chunk-XI3BNZG4.js.map +0 -1
  220. package/dist/chunk-ZPLVANY2.js +0 -15
  221. package/dist/chunk-ZPLVANY2.js.map +0 -1
  222. package/dist/cli-AVHLY2AI.js.map +0 -1
  223. package/dist/cli-LP5OE3BL.js +0 -84
  224. package/dist/cli-LP5OE3BL.js.map +0 -1
  225. package/dist/cli-MQXOK64K.js.map +0 -1
  226. package/dist/github-6GYTPSGV.js +0 -35
  227. package/dist/github-DJOLVNDD.js +0 -31
  228. package/dist/github-ZF2TQ3RP.js +0 -35
  229. package/dist/json-Y7625EFE.js +0 -42
  230. package/dist/lint-RF3B55W7.js +0 -35
  231. package/dist/list-5DW4QZ7P.js +0 -36
  232. package/dist/list-7CHWJ633.js +0 -39
  233. package/dist/list-UNWG6NPD.js +0 -33
  234. package/dist/pretty-PPNHHOEN.js +0 -52
  235. package/dist/pretty-XGYQ25PH.js +0 -43
  236. package/dist/run-MHJ3AYKG.js +0 -39
  237. package/dist/sarif-MIEMQOIK.js +0 -30
  238. package/dist/sarif-RGRG7VFX.js +0 -36
  239. package/dist/strategy-EK5VY5DG.js +0 -223
  240. package/dist/strategy-EK5VY5DG.js.map +0 -1
  241. /package/dist/{batch-C534YIAU.js.map → batch-DPYBMRVD.js.map} +0 -0
  242. /package/dist/{build-SVKT7QFU.js.map → build-LEKUMGEC.js.map} +0 -0
  243. /package/dist/{calibrate-AL3MH7TY.js.map → calibrate-TYONPNG4.js.map} +0 -0
  244. /package/dist/{capture-2F7B4DAD.js.map → capture-2EPHIAZT.js.map} +0 -0
  245. /package/dist/{check-BI7OGIVE.js.map → check-ADCSXGBK.js.map} +0 -0
  246. /package/dist/{check-JZINDP3F.js.map → check-HWEDHABD.js.map} +0 -0
  247. /package/dist/{check-OPUMZEVK.js.map → check-J2KQI7IW.js.map} +0 -0
  248. /package/dist/{check-OW7UD73D.js.map → check-L5AUSTE6.js.map} +0 -0
  249. /package/dist/{check-LKPQPQWJ.js.map → check-SQVQE4E4.js.map} +0 -0
  250. /package/dist/{chunk-IOJD2RFG.js.map → chunk-2MOXVM6H.js.map} +0 -0
  251. /package/dist/{chunk-762MM6NA.js.map → chunk-2QK25SLZ.js.map} +0 -0
  252. /package/dist/{chunk-HHJ2HFPP.js.map → chunk-2UJOQ6CB.js.map} +0 -0
  253. /package/dist/{chunk-H5YWCCBO.js.map → chunk-3CBGLUJX.js.map} +0 -0
  254. /package/dist/{chunk-E23KWEPL.js.map → chunk-3USSSKLA.js.map} +0 -0
  255. /package/dist/{chunk-PTGXEZQD.js.map → chunk-3ZVRGBK6.js.map} +0 -0
  256. /package/dist/{chunk-IN5T22FP.js.map → chunk-6QNA7UX2.js.map} +0 -0
  257. /package/dist/{chunk-OWJLB2AF.js.map → chunk-76Y3JATE.js.map} +0 -0
  258. /package/dist/{chunk-3SFAB75L.js.map → chunk-AJCUKL43.js.map} +0 -0
  259. /package/dist/{chunk-CREFJCWZ.js.map → chunk-AOLCEULZ.js.map} +0 -0
  260. /package/dist/{chunk-2NGFDLIM.js.map → chunk-B4ECIBLF.js.map} +0 -0
  261. /package/dist/{chunk-5UJKXOAD.js.map → chunk-B4POKRCS.js.map} +0 -0
  262. /package/dist/{chunk-KBSTXL6L.js.map → chunk-BOCJTOKA.js.map} +0 -0
  263. /package/dist/{chunk-CFMI74TP.js.map → chunk-BZ74YUYE.js.map} +0 -0
  264. /package/dist/{chunk-NLJ3XIKT.js.map → chunk-C2QE4FSZ.js.map} +0 -0
  265. /package/dist/{chunk-245W2Q7C.js.map → chunk-D4BGNAN5.js.map} +0 -0
  266. /package/dist/{chunk-XBJKYXOR.js.map → chunk-DWUK6YNX.js.map} +0 -0
  267. /package/dist/{chunk-MTCOBRCX.js.map → chunk-E75CMOR3.js.map} +0 -0
  268. /package/dist/{chunk-KCWNJMSS.js.map → chunk-EBBJFXMX.js.map} +0 -0
  269. /package/dist/{chunk-A4QNKEX4.js.map → chunk-GCHEVTCJ.js.map} +0 -0
  270. /package/dist/{chunk-V2XJJEEF.js.map → chunk-L3DOX3UL.js.map} +0 -0
  271. /package/dist/{chunk-JUUCCML3.js.map → chunk-MPRVAMO3.js.map} +0 -0
  272. /package/dist/{chunk-JCTHXG33.js.map → chunk-NHOGTAPK.js.map} +0 -0
  273. /package/dist/{chunk-VM7VAFJW.js.map → chunk-NVYDWVXN.js.map} +0 -0
  274. /package/dist/{chunk-ARNI3SJT.js.map → chunk-OL3Z7KPQ.js.map} +0 -0
  275. /package/dist/{chunk-NUQF5F5J.js.map → chunk-PNDEKFF3.js.map} +0 -0
  276. /package/dist/{chunk-DMVBIIP3.js.map → chunk-QJL57GPX.js.map} +0 -0
  277. /package/dist/{chunk-AE6KBAAU.js.map → chunk-QR55QXJ7.js.map} +0 -0
  278. /package/dist/{chunk-BJUEOC4G.js.map → chunk-QWVIGKBM.js.map} +0 -0
  279. /package/dist/{chunk-U4OJ7U45.js.map → chunk-SZMJ24FR.js.map} +0 -0
  280. /package/dist/{chunk-KQDRO6N6.js.map → chunk-TLY44PCL.js.map} +0 -0
  281. /package/dist/{chunk-VLRIP4BQ.js.map → chunk-TOVSR2YO.js.map} +0 -0
  282. /package/dist/{chunk-2YKUSTHS.js.map → chunk-TVLIJ6ZM.js.map} +0 -0
  283. /package/dist/{chunk-22WGKOQ7.js.map → chunk-VTJAY3WN.js.map} +0 -0
  284. /package/dist/{chunk-DPDG3FHL.js.map → chunk-WHECOVH2.js.map} +0 -0
  285. /package/dist/{chunk-R2CR62JV.js.map → chunk-XVL7DYWM.js.map} +0 -0
  286. /package/dist/{chunk-CLPC3LKX.js.map → chunk-Y4O737F7.js.map} +0 -0
  287. /package/dist/{chunk-YSZNJ2ID.js.map → chunk-YBPXVBSY.js.map} +0 -0
  288. /package/dist/{chunk-2HOWRAWK.js.map → chunk-YJHH2DHV.js.map} +0 -0
  289. /package/dist/{cli-FSDJY5OC.js.map → cli-V2BJYNMF.js.map} +0 -0
  290. /package/dist/{chunk-UP6NBQ62.js.map → cli-XXN75A42.js.map} +0 -0
  291. /package/dist/{cli-MOKRUHZT.js.map → config-2YJPJ36T.js.map} +0 -0
  292. /package/dist/{config-BMWDC66C.js.map → github-NQQTH5JK.js.map} +0 -0
  293. /package/dist/{github-6GYTPSGV.js.map → github-NWL2XGE7.js.map} +0 -0
  294. /package/dist/{github-DJOLVNDD.js.map → github-WBIEYSM7.js.map} +0 -0
  295. /package/dist/{github-ZF2TQ3RP.js.map → host-JT27OWTC.js.map} +0 -0
  296. /package/dist/{host-YSTYO5DX.js.map → json-IVHRVOGQ.js.map} +0 -0
  297. /package/dist/{json-Y7625EFE.js.map → json-J4TONMKY.js.map} +0 -0
  298. /package/dist/{json-YIK72XAL.js.map → json-QQAK73QQ.js.map} +0 -0
  299. /package/dist/{json-YTKUFNO3.js.map → lint-VB5A3ENL.js.map} +0 -0
  300. /package/dist/{lint-RF3B55W7.js.map → list-3XRFX2Y3.js.map} +0 -0
  301. /package/dist/{list-5DW4QZ7P.js.map → list-LMYCD5G5.js.map} +0 -0
  302. /package/dist/{list-7CHWJ633.js.map → list-LOS7FTFD.js.map} +0 -0
  303. /package/dist/{list-UNWG6NPD.js.map → page-3Y4EGYUO.js.map} +0 -0
  304. /package/dist/{page-OMPEACUN.js.map → pretty-DR4GHOJG.js.map} +0 -0
  305. /package/dist/{pretty-PPNHHOEN.js.map → pretty-G2J5UEXC.js.map} +0 -0
  306. /package/dist/{pretty-U7ATCFBN.js.map → pretty-GCEIQ3FP.js.map} +0 -0
  307. /package/dist/{pretty-XGYQ25PH.js.map → provider-YWNTTQPA.js.map} +0 -0
  308. /package/dist/{release-VHHASAG7.js.map → release-EFLQT3FW.js.map} +0 -0
  309. /package/dist/{provider-JY2I3VLF.js.map → reporters-43LBUWEE.js.map} +0 -0
  310. /package/dist/{reporters-FAIEOTC4.js.map → reporters-OWYFZD4S.js.map} +0 -0
  311. /package/dist/{reporters-KE7AZR6C.js.map → run-G6G55SWJ.js.map} +0 -0
  312. /package/dist/{run-MHJ3AYKG.js.map → sarif-CN7RSIKH.js.map} +0 -0
  313. /package/dist/{sarif-DOGRSGTB.js.map → sarif-FR26WNVT.js.map} +0 -0
  314. /package/dist/{sarif-MIEMQOIK.js.map → sarif-GWTNYCZJ.js.map} +0 -0
  315. /package/dist/{sarif-RGRG7VFX.js.map → strategy-3EZUOE2T.js.map} +0 -0
  316. /package/dist/{validate-QDYQ642J.js.map → validate-TDIEFXRQ.js.map} +0 -0
@@ -1,31 +1,36 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- PAGE_FIELDS,
4
- PARENTS,
5
- RECORD_TYPES,
6
- STRATEGY_RULES,
7
- guidanceFor,
8
- isStrategyRule,
9
- resolveSeverity,
10
- ruleId
11
- } from "./chunk-GMLOAKOA.js";
12
- import {
13
- closestName
14
- } from "./chunk-XTKJNRJ6.js";
15
2
  import {
16
3
  PathIndex,
17
4
  hasScheme,
18
5
  loadConfig,
19
6
  resolveRoute,
20
7
  routesFrom
21
- } from "./chunk-FHJIH6XP.js";
8
+ } from "./chunk-LHP56Q45.js";
9
+ import {
10
+ closestName
11
+ } from "./chunk-XTKJNRJ6.js";
12
+ import {
13
+ guidanceFor,
14
+ isStrategyRule,
15
+ resolveSeverity,
16
+ ruleId
17
+ } from "./chunk-VSDXZAQU.js";
18
+ import {
19
+ PAGE_FIELDS,
20
+ PARENTS,
21
+ STRATEGY_RULES
22
+ } from "./chunk-INOVEO32.js";
22
23
  import {
23
24
  declaredAt,
24
25
  metaPageView
25
- } from "./chunk-KCWNJMSS.js";
26
+ } from "./chunk-EBBJFXMX.js";
27
+ import {
28
+ RECORD_FIELDS,
29
+ readRecord
30
+ } from "./chunk-AZKNB2T3.js";
26
31
  import {
27
32
  STDIN_REQUIRES_AS
28
- } from "./chunk-BXE4L52Q.js";
33
+ } from "./chunk-KX6HRTLH.js";
29
34
  import {
30
35
  STDIN_LABEL,
31
36
  STDIN_TOKEN,
@@ -35,7 +40,7 @@ import {
35
40
  gitignoreOptions,
36
41
  resolveTargetSet,
37
42
  supportedExtensions
38
- } from "./chunk-BJUEOC4G.js";
43
+ } from "./chunk-QWVIGKBM.js";
39
44
  import {
40
45
  SEVERITIES
41
46
  } from "./chunk-77AINBYM.js";
@@ -43,7 +48,7 @@ import {
43
48
  findConfigFile,
44
49
  readConfigFile,
45
50
  selectCollections
46
- } from "./chunk-B2242FYO.js";
51
+ } from "./chunk-JF4BC7ZD.js";
47
52
  import {
48
53
  ToolError,
49
54
  errorMessage
@@ -54,12 +59,7 @@ import { relative, resolve } from "node:path";
54
59
 
55
60
  // src/strategy/core/check.ts
56
61
  var fold = (value) => value.toLowerCase();
57
- var FIELD_TYPES = {
58
- audiences: "audience",
59
- personas: "persona",
60
- journeys: "journey",
61
- audience: "audience"
62
- };
62
+ var FIELD_TYPES = RECORD_FIELDS;
63
63
  var parentTypeOf = (type) => FIELD_TYPES[PARENTS[type]];
64
64
  function indexSet(set) {
65
65
  const byType = /* @__PURE__ */ new Map();
@@ -487,10 +487,7 @@ import { isAbsolute, relative as relative2, resolve as resolve4 } from "node:pat
487
487
 
488
488
  // src/strategy/core/load-set.ts
489
489
  import { readFile } from "node:fs/promises";
490
- import { basename, extname, resolve as resolve3 } from "node:path";
491
- function isRecordType(value) {
492
- return typeof value === "string" && RECORD_TYPES.includes(value);
493
- }
490
+ import { extname, resolve as resolve3 } from "node:path";
494
491
  function text(value) {
495
492
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
496
493
  }
@@ -591,10 +588,6 @@ function stepsOf(data, at) {
591
588
  ];
592
589
  });
593
590
  }
594
- function stem(label) {
595
- const name = basename(label);
596
- return name.slice(0, name.length - extname(name).length);
597
- }
598
591
  async function loadStrategySet(opts) {
599
592
  const { run } = opts;
600
593
  const allowEmpty = opts.allowEmpty ?? run.config?.allowEmpty === true;
@@ -610,31 +603,32 @@ async function loadStrategySet(opts) {
610
603
  const merged = await view.merge(label, extracted);
611
604
  const data = merged.extracted.data;
612
605
  const at = (pointer) => declaredAt(label, pointer, { extracted: merged.extracted, locate: merged.locate });
613
- const type = data["type"];
614
- const isRecord = isRecordType(type);
615
- if (isRecord) {
606
+ const declares = readRecord(data, label);
607
+ const type = declares?.type;
608
+ const isRecord = declares !== void 0;
609
+ if (declares !== void 0) {
616
610
  const declaredId = text(data["id"]);
617
611
  const title = text(data["title"]);
618
612
  const description = text(data["description"]);
619
613
  const lifecycle = text(data["lifecycle"]);
620
614
  const steps = type === "journey" ? stepsOf(data, at) : [];
621
615
  const record = {
622
- id: declaredId ?? stem(label),
623
- type,
616
+ id: declares.id,
617
+ type: declares.type,
624
618
  ...title === void 0 ? {} : { title },
625
619
  ...description === void 0 ? {} : { description },
626
620
  ...lifecycle === void 0 ? {} : { lifecycle },
627
621
  file: label,
628
622
  line: 1,
629
623
  ...declaredId === void 0 ? {} : { idAt: at("/id") },
630
- parents: type === "audience" ? [] : valuesOf(data, PARENTS[type]).map(({ value, pointer }) => ({ value, ...at(pointer) })),
624
+ parents: declares.type === "audience" ? [] : valuesOf(data, PARENTS[declares.type]).map(({ value, pointer }) => ({ value, ...at(pointer) })),
631
625
  ...steps.length === 0 ? {} : { steps }
632
626
  };
633
627
  set.records.push(record);
634
628
  } else {
635
629
  pages.push(label);
636
630
  }
637
- const parentField = isRecord && type !== "audience" ? PARENTS[type] : void 0;
631
+ const parentField = type !== void 0 && type !== "audience" ? PARENTS[type] : void 0;
638
632
  for (const field of Object.values(PAGE_FIELDS)) {
639
633
  if (field === parentField) continue;
640
634
  for (const { value, pointer } of valuesOf(data, field)) {
@@ -698,9 +692,10 @@ export {
698
692
  checkStrategySet,
699
693
  StrategyError,
700
694
  DEFAULT_STRATEGY_BASELINE_PATH,
695
+ resolveStrategyRun,
701
696
  loadStrategy,
702
697
  formatChoice,
703
698
  displayPath,
704
699
  plural
705
700
  };
706
- //# sourceMappingURL=chunk-6XK3NTL5.js.map
701
+ //# sourceMappingURL=chunk-FBIBR4CH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/strategy/core/steps.ts","../src/strategy/core/check.ts","../src/strategy/errors.ts","../src/strategy/core/config.ts","../src/strategy/commands/run.ts","../src/strategy/core/load-set.ts"],"sourcesContent":["/**\n * A journey's `steps:` resolved to the run's pages (proposal 0106). Pure,\n * given the routes: the command core loads `graph.routes`, and only when a\n * step names a `/` route.\n *\n * A `doc` is a repo path, resolved from the config file's directory and named\n * exactly, or a `/` route, resolved by graph's own `resolveRoute`. A scheme\n * URL and a route no mapping covers are not checked. Anything after `#` or\n * `?` is dropped first.\n */\nimport { relative, resolve } from \"node:path\";\nimport { PathIndex, hasScheme, resolveRoute } from \"../../graph/core/analyze.js\";\nimport type { RouteMapping } from \"../../graph/core/config.js\";\nimport type { ResolvedStep, StepState, StrategyRecord, StrategySet, StrategyStep } from \"../types.js\";\nimport { indexSet, type StrategyIndex } from \"./check.js\";\n\nexport interface StepContext {\n /** `graph.routes`, rebased onto the run's base. None leaves every route unchecked. */\n routes?: RouteMapping[];\n /** The directory a repo-path `doc` resolves from: the config file's, else the working directory. */\n from?: string;\n /** The directory the run's labels are relative to. */\n base?: string;\n}\n\n/** Each journey with steps to its steps, resolved, in order. */\nexport type StepMap = ReadonlyMap<StrategyRecord, ResolvedStep[]>;\n\nconst posix = (path: string): string => path.replaceAll(\"\\\\\", \"/\");\n\n/** `doc` without its anchor or query. */\nfunction target(doc: string): string {\n return doc.split(/[?#]/, 1)[0] ?? \"\";\n}\n\n/** Whether a step's doc is a site route, which needs `graph.routes`. */\nfunction isRoute(doc: string): boolean {\n return target(doc).startsWith(\"/\");\n}\n\nexport function stepsNeedRoutes(set: StrategySet): boolean {\n return set.records.some((r) => r.steps?.some((s) => s.doc !== undefined && isRoute(s.doc)) === true);\n}\n\n/** What a `doc` names: a page of the run, no page, or nothing this run can check. */\ntype Located = { page: string } | \"none\" | \"unchecked\";\n\nfunction locate(doc: string, pages: ReadonlySet<string>, index: PathIndex, ctx: StepContext): Located {\n if (hasScheme(doc)) return \"unchecked\";\n const path = target(doc);\n if (path.startsWith(\"/\")) {\n const found = resolveRoute(path, ctx.routes ?? [], index);\n if (found === null) return \"unchecked\";\n return found === \"broken\" ? \"none\" : { page: found };\n }\n const label = ctx.from === undefined || ctx.base === undefined ? path : relative(ctx.base, resolve(ctx.from, path));\n const wanted = posix(label);\n return pages.has(wanted) ? { page: wanted } : \"none\";\n}\n\n/** The state table of proposal 0106. `found` is undefined when the step has no `doc`. */\nfunction stateOf(step: StrategyStep, found: Located | undefined, served: boolean): StepState {\n if (found === undefined) return step.exists === true || step.exists === \"partial\" ? \"broken\" : \"unwritten\";\n if (found === \"unchecked\") return step.exists === false ? \"unwritten\" : \"unchecked\";\n if (found === \"none\") return step.exists === false ? \"unwritten\" : \"broken\";\n if (step.exists === \"partial\") return \"partial\";\n return served ? \"served\" : \"unclaimed\";\n}\n\nexport function resolveSteps(set: StrategySet, ctx: StepContext = {}, index: StrategyIndex = indexSet(set)): Map<StrategyRecord, ResolvedStep[]> {\n const pages = new Set((set.pages ?? []).map(posix));\n // `PathIndex` is graph's tiered lookup; a repo path must name its file exactly, so it uses `pages`.\n const routeIndex = new PathIndex(pages);\n const out = new Map<StrategyRecord, ResolvedStep[]>();\n for (const record of set.records) {\n if (record.type !== \"journey\" || record.steps === undefined) continue;\n const naming = new Set(index.pagesNaming(record).map(posix));\n out.set(\n record,\n record.steps.map((step): ResolvedStep => {\n const found = step.doc === undefined ? undefined : locate(step.doc, pages, routeIndex, ctx);\n const page = typeof found === \"object\" ? found.page : undefined;\n const state = stateOf(step, found, page !== undefined && naming.has(page));\n return { ...step, state, ...(page === undefined ? {} : { page }) };\n }),\n );\n }\n return out;\n}\n\n/** Served steps over steps. */\nexport function coverageOf(steps: readonly ResolvedStep[]): { served: number; steps: number } {\n return { served: steps.filter((s) => s.state === \"served\").length, steps: steps.length };\n}\n","/**\n * `strategy check`'s rules (proposal 0102). Pure: it reads records and\n * references and returns findings, so the command core owns every file and\n * the rules are tested on sets built inline.\n *\n * Ids compare case-folded. A reference field is checked only when the set\n * holds a record of that field's type, so a repo that keeps no audience\n * records keeps free-form `audiences:`. `missing-parent` and the use counts\n * read pages that are not records: a record's own `journeys:` serves nobody.\n *\n * The four step rules (proposal 0106) read each live journey's resolved\n * `steps:`. A draft or archived journey's steps draw nothing.\n */\nimport { closestName } from \"../../shared/closest-name.js\";\nimport { RECORD_FIELDS } from \"../../shared/reference-fields.js\";\nimport {\n PAGE_FIELDS,\n PARENTS,\n type At,\n type ChildType,\n type RecordType,\n type ReferenceField,\n type ResolvedStep,\n type StrategyFinding,\n type StrategyRecord,\n type StrategyRule,\n type StrategySet,\n type StrategySeverity,\n} from \"../types.js\";\nimport { guidanceFor, resolveSeverity, ruleId } from \"./severity.js\";\nimport { resolveSteps, type StepMap } from \"./steps.js\";\n\nconst fold = (value: string): string => value.toLowerCase();\n\n/** The type each page field names. */\nconst FIELD_TYPES: Readonly<Record<ReferenceField, RecordType>> = RECORD_FIELDS;\n\n/** The type of a child's parents: an audience for a persona, a persona for a journey. */\nconst parentTypeOf = (type: ChildType): RecordType => FIELD_TYPES[PARENTS[type]];\n\n/** What a set's records and pages say about each other, resolved once for `check`, `list` and `get`. */\nexport interface StrategyIndex {\n /** Whether the set holds a record of this type. */\n has(type: RecordType): boolean;\n /** The record of `type` a value names, case-folded. The first one read wins. */\n resolve(type: RecordType, value: string): StrategyRecord | undefined;\n /** The first record of any type with this id, case-folded. */\n anyWithId(value: string): StrategyRecord | undefined;\n /** The records of the parent type the record's parent field names, each once, in the field's order. */\n parentsOf(record: StrategyRecord): StrategyRecord[];\n /** The records whose parent field names this record, in set order. */\n childrenOf(record: StrategyRecord): StrategyRecord[];\n /** The pages that name this record directly, sorted. Records do not count. */\n pagesNaming(record: StrategyRecord): string[];\n}\n\nexport function indexSet(set: StrategySet): StrategyIndex {\n const byType = new Map<RecordType, Map<string, StrategyRecord>>();\n const byId = new Map<string, StrategyRecord>();\n for (const record of set.records) {\n const ids = byType.get(record.type) ?? new Map<string, StrategyRecord>();\n if (!ids.has(fold(record.id))) ids.set(fold(record.id), record);\n byType.set(record.type, ids);\n if (!byId.has(fold(record.id))) byId.set(fold(record.id), record);\n }\n const resolveIn = (type: RecordType, value: string): StrategyRecord | undefined => byType.get(type)?.get(fold(value));\n const parentsOf = (record: StrategyRecord): StrategyRecord[] => {\n if (record.type === \"audience\") return [];\n const type = parentTypeOf(record.type);\n const found = record.parents.map((p) => resolveIn(type, p.value)).filter((r) => r !== undefined);\n return [...new Set(found)];\n };\n\n const children = new Map<StrategyRecord, StrategyRecord[]>();\n for (const record of set.records) {\n for (const parent of parentsOf(record)) children.set(parent, [...(children.get(parent) ?? []), record]);\n }\n const pages = new Map<StrategyRecord, Set<string>>();\n for (const reference of set.references) {\n if (reference.record) continue;\n const target = resolveIn(FIELD_TYPES[reference.field], reference.value);\n if (target === undefined) continue;\n const named = pages.get(target) ?? new Set<string>();\n named.add(reference.page);\n pages.set(target, named);\n }\n\n return {\n has: (type) => (byType.get(type)?.size ?? 0) > 0,\n resolve: resolveIn,\n anyWithId: (value) => byId.get(fold(value)),\n parentsOf,\n childrenOf: (record) => children.get(record) ?? [],\n pagesNaming: (record) => [...(pages.get(record) ?? [])].sort(),\n };\n}\n\n/** A finding before its level is known: `message` is its identity, `fix` the advice after it. */\ninterface Draft {\n rule: StrategyRule;\n message: string;\n fix?: string;\n file: string;\n line?: number;\n id?: string;\n field?: ReferenceField | \"steps\";\n}\n\n/** `a journey`, `an audience`. */\nfunction article(type: RecordType): string {\n return `${type === \"audience\" ? \"an\" : \"a\"} ${type}`;\n}\n\n/** Where a finding about a whole record sits: its `id:` line, else its first line. */\nfunction onRecord(record: StrategyRecord): At {\n return record.idAt ?? { file: record.file, line: record.line };\n}\n\nfunction located(at: At): At {\n return { file: at.file, ...(at.line === undefined ? {} : { line: at.line }) };\n}\n\n/** The ancestor of `record` of type `type`, walking up each record's first parent. */\nfunction ancestorOf(index: StrategyIndex, record: StrategyRecord, type: RecordType): StrategyRecord | undefined {\n let current = index.parentsOf(record)[0];\n while (current !== undefined && current.type !== type) current = index.parentsOf(current)[0];\n return current;\n}\n\nexport interface CheckStrategySetOptions {\n severity?: Partial<Record<StrategyRule, StrategySeverity>>;\n /** The journeys' steps, resolved. Default: resolved with no routes, each repo path read as a label. */\n steps?: StepMap;\n /** A step's page as a message names it. Default: its label. */\n pagePath?: (page: string) => string;\n}\n\n/** The step rules' drafts for one live journey. `naming` holds the pages that name it, posix. */\nfunction stepDrafts(\n record: StrategyRecord,\n steps: readonly ResolvedStep[],\n naming: ReadonlySet<string>,\n pagePath: (page: string) => string,\n): Draft[] {\n const drafts: Draft[] = [];\n for (const step of steps) {\n const on = (at: At | undefined): At => located(at ?? { file: step.file, ...(step.line === undefined ? {} : { line: step.line }) });\n const about = { ...on(undefined), id: record.id, field: \"steps\" as const };\n const n = `step ${String(step.n)}`;\n if (step.state === \"broken\") {\n drafts.push(\n step.doc === undefined\n ? {\n rule: \"broken-step\",\n message: `${n}: exists: ${String(step.exists)}, but the step has no doc.`,\n fix: \"Name its page in doc:, or set exists: false.\",\n ...about,\n ...on(step.existsAt),\n }\n : {\n rule: \"broken-step\",\n message: `${n}: doc \"${step.doc}\" names no page.`,\n fix: \"Correct doc, or set exists: false if the page does not exist.\",\n ...about,\n ...on(step.docAt),\n },\n );\n }\n if (step.state === \"unwritten\") {\n drafts.push({\n rule: \"unwritten-step\",\n message: step.doc === undefined ? `${n}: no page carries this stage.` : `${n}: doc \"${step.doc}\" names a page that does not exist.`,\n ...about,\n });\n }\n if (step.page === undefined) continue;\n if (step.exists === false && step.doc !== undefined) {\n drafts.push({\n rule: \"stale-step\",\n message: `${n}: exists: false, but doc \"${step.doc}\" names a page.`,\n fix: \"Set exists: true or partial, or drop exists:.\",\n ...about,\n ...on(step.existsAt),\n });\n }\n if (!naming.has(step.page)) {\n drafts.push({\n rule: \"missing-journey\",\n message: `${n}: ${pagePath(step.page)} does not name \"${record.id}\" in journeys:.`,\n fix: \"Add it to that page's journeys:, or point the step at a page that does.\",\n ...about,\n ...on(step.docAt),\n });\n }\n }\n return drafts;\n}\n\nexport function checkStrategySet(set: StrategySet, opts: CheckStrategySetOptions = {}): StrategyFinding[] {\n const levels = resolveSeverity(opts.severity);\n const index = indexSet(set);\n const drafts: Draft[] = [];\n\n // The step rules, on each live journey's steps.\n const steps = opts.steps ?? resolveSteps(set, {}, index);\n for (const [record, resolved] of steps) {\n if (record.lifecycle === \"draft\" || record.lifecycle === \"archived\") continue;\n const naming = new Set(index.pagesNaming(record).map((page) => page.replaceAll(\"\\\\\", \"/\")));\n drafts.push(...stepDrafts(record, resolved, naming, opts.pagePath ?? ((page) => page)));\n }\n\n /** The finding for a value that names no record of `type`, or the wrong type of record. */\n const unresolved = (field: ReferenceField, value: string, onRecordField: boolean): Pick<Draft, \"message\" | \"fix\"> => {\n const type = FIELD_TYPES[field];\n const other = index.anyWithId(value);\n if (other !== undefined) {\n const ancestor = ancestorOf(index, other, type);\n const fix =\n ancestor !== undefined\n ? `Did you mean its ${type}, \"${ancestor.id}\"?`\n : onRecordField\n ? \"Correct the value.\"\n : `Move it to ${PAGE_FIELDS[other.type]}:.`;\n return { message: `${field}: \"${value}\" is ${article(other.type)}, not ${article(type)}.`, fix };\n }\n const ids = set.records.filter((r) => r.type === type).map((r) => r.id);\n const nearest = closestName(fold(value), ids.map(fold));\n const suggestion = nearest === undefined ? undefined : ids.find((id) => fold(id) === nearest);\n const add = `Correct the value, or add a record with type: ${type} and id: ${value}.`;\n const fix =\n suggestion === undefined ? add : onRecordField ? `Did you mean \"${suggestion}\"?` : `Did you mean \"${suggestion}\"? ${add}`;\n return { message: `${field}: \"${value}\" names no ${type}.`, fix };\n };\n\n // undefined-reference, on every page's fields, records included.\n for (const reference of set.references) {\n const type = FIELD_TYPES[reference.field];\n if (!index.has(type) || index.resolve(type, reference.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(reference.field, reference.value, false),\n ...located(reference),\n field: reference.field,\n });\n }\n // ...and on each value of a record's parent field.\n for (const record of set.records) {\n if (record.type === \"audience\") continue;\n const field = PARENTS[record.type];\n const type = parentTypeOf(record.type);\n if (!index.has(type)) continue;\n for (const parent of record.parents) {\n if (index.resolve(type, parent.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(field, parent.value, true),\n ...located(parent),\n id: record.id,\n field,\n });\n }\n }\n\n // duplicate-id: on every record sharing the id, each naming the others.\n const sharing = new Map<string, StrategyRecord[]>();\n for (const record of set.records) sharing.set(fold(record.id), [...(sharing.get(fold(record.id)) ?? []), record]);\n for (const group of sharing.values()) {\n if (group.length < 2) continue;\n for (const record of group) {\n const others = group\n .filter((other) => other !== record)\n .map((other) => {\n const at = onRecord(other);\n return at.line === undefined ? at.file : `${at.file}:${String(at.line)}`;\n });\n drafts.push({\n rule: \"duplicate-id\",\n message: `id: \"${record.id}\" is also the id of ${others.join(\", \")}.`,\n fix: \"Give each record its own id.\",\n ...located(onRecord(record)),\n id: record.id,\n });\n }\n }\n\n // missing-parent: per page, one finding per set of parents the page names none of.\n const byPage = new Map<string, typeof set.references>();\n for (const reference of set.references) {\n if (reference.record) continue;\n byPage.set(reference.page, [...(byPage.get(reference.page) ?? []), reference]);\n }\n for (const references of byPage.values()) {\n const named = (field: ReferenceField): Set<string> =>\n new Set(references.filter((r) => r.field === field).map((r) => fold(r.value)));\n const reported = new Set<string>();\n for (const childType of [\"journey\", \"persona\"] as const satisfies readonly ChildType[]) {\n const parentType = parentTypeOf(childType);\n const parentField = PAGE_FIELDS[parentType];\n const has = named(parentField);\n for (const reference of references) {\n if (reference.field !== PAGE_FIELDS[childType]) continue;\n const child = index.resolve(childType, reference.value);\n if (child === undefined) continue;\n const parents = index.parentsOf(child);\n const ids = parents.map((p) => `\"${p.id}\"`).join(\", \");\n const key = `${parentType} ${ids}`;\n if (parents.length === 0 || parents.some((p) => has.has(fold(p.id))) || reported.has(key)) continue;\n reported.add(key);\n const one = parents.length === 1;\n drafts.push({\n rule: \"missing-parent\",\n message: one\n ? `${parentField}: does not name ${ids}, the ${parentType} of ${childType} \"${child.id}\".`\n : `${parentField}: names none of ${ids}, the ${parentField} of ${childType} \"${child.id}\".`,\n fix: `Add ${one ? \"it\" : \"one\"}, or drop \"${child.id}\" from ${PAGE_FIELDS[childType]}:.`,\n ...located(reference),\n field: parentField,\n });\n }\n }\n }\n\n // orphan-record, unserved-journey and unused-record: about whole records.\n for (const record of set.records) {\n const at = located(onRecord(record));\n if (record.type !== \"audience\" && record.parents.length === 0 && index.has(parentTypeOf(record.type))) {\n const field = PARENTS[record.type];\n drafts.push({\n rule: \"orphan-record\",\n message: `${field}: missing, so this ${record.type} belongs to no ${parentTypeOf(record.type)}.`,\n fix: `Name one with ${field}:.`,\n ...at,\n id: record.id,\n field,\n });\n }\n // Only the first record with an id is the one references resolve to.\n if (index.resolve(record.type, record.id) !== record) continue;\n const pages = index.pagesNaming(record);\n // A draft journey is not live yet, and an archived one no longer is, so neither owes a page.\n const live = record.lifecycle !== \"draft\" && record.lifecycle !== \"archived\";\n if (record.type === \"journey\" && live && pages.length === 0) {\n drafts.push({\n rule: \"unserved-journey\",\n message: \"no page names this journey in journeys:.\",\n fix: \"Name it on the pages that serve it.\",\n ...at,\n id: record.id,\n });\n }\n if (record.type !== \"journey\" && pages.length === 0 && index.childrenOf(record).length === 0) {\n drafts.push({\n rule: \"unused-record\",\n message: `no page and no record names this ${record.type}.`,\n ...at,\n id: record.id,\n });\n }\n }\n\n const findings: StrategyFinding[] = [];\n for (const draft of drafts) {\n const level = levels[draft.rule];\n if (level === \"off\") continue;\n findings.push({\n rule: draft.rule,\n ruleId: ruleId(draft.rule),\n severity: level,\n message: draft.fix === undefined ? draft.message : `${draft.message} ${draft.fix}`,\n ...(draft.fix === undefined ? {} : { key: draft.message }),\n guidance: guidanceFor(draft.rule),\n file: draft.file,\n ...(draft.line === undefined ? {} : { line: draft.line }),\n ...(draft.id === undefined ? {} : { id: draft.id }),\n ...(draft.field === undefined ? {} : { field: draft.field }),\n });\n }\n return findings.sort(compareFindings);\n}\n\nfunction compareText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nexport function compareFindings(a: StrategyFinding, b: StrategyFinding): number {\n return (\n compareText(a.file, b.file) ||\n (a.line ?? 0) - (b.line ?? 0) ||\n compareText(a.ruleId, b.ruleId) ||\n compareText(a.message, b.message)\n );\n}\n","import { ToolError } from \"../shared/errors.js\";\n\n/** An operational or usage error in the strategy tool: exit 2. */\nexport class StrategyError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"StrategyError\";\n }\n}\n","/**\n * The `strategy:` section of manni.config.yaml, and the run resolution every\n * command shares (proposal 0102). Its keys mirror `term:`'s, and so do its\n * refusals: unknown keys, rules or levels are errors that name what is\n * supported and never echo a value. The document set is the family\n * `collections:`, so `paths` and `exclude` are refused by name.\n */\nimport { resolve } from \"node:path\";\nimport { selectCollections } from \"../../shared/collections.js\";\nimport { findConfigFile, readConfigFile, type ConfigFile, type ConfigFileOptions } from \"../../shared/config-file.js\";\nimport { SEVERITIES } from \"../../shared/severity.js\";\nimport { StrategyError } from \"../errors.js\";\nimport {\n STRATEGY_RULES,\n type StrategyConfig,\n type StrategyRule,\n type StrategyRun,\n type StrategySeverity,\n} from \"../types.js\";\nimport { isStrategyRule } from \"./severity.js\";\n\nexport const STRATEGY_SECTION = \"strategy\";\n\nexport const DEFAULT_STRATEGY_BASELINE_PATH = \".manni-strategy-baseline.json\";\n\n/** The keys `strategy:` accepts, in the order the reference lists them. */\nconst CONFIG_KEYS: readonly (keyof StrategyConfig)[] = [\"severity\", \"baseline\", \"allowEmpty\", \"respectGitignore\"];\n\n/** Keys that belong to the family, refused by name with where they live. */\nconst COLLECTION_KEYS: readonly string[] = [\"paths\", \"exclude\"];\n\n/** The family scale, least severe first, then `off`. */\nconst SEVERITY_LEVELS: readonly StrategySeverity[] = [...SEVERITIES, \"off\"];\n\nconst CONFIG_FILE: ConfigFileOptions = {\n section: STRATEGY_SECTION,\n legacyNames: [],\n toError: (message) => new StrategyError(message),\n};\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLevel(value: unknown): value is StrategySeverity {\n return typeof value === \"string\" && (SEVERITY_LEVELS as readonly string[]).includes(value);\n}\n\nfunction rejectUnknownKeys(obj: Record<string, unknown>, allowed: readonly string[], where: string, source: string): void {\n for (const key of Object.keys(obj)) {\n if (!allowed.includes(key)) {\n throw new StrategyError(`Unknown key \"${key}\" under ${where}: in ${source}. Supported keys: ${allowed.join(\", \")}.`);\n }\n }\n}\n\n/** A type error names the key and the type it wanted, never the value, which could be a pasted secret. */\nfunction wrongType(key: string, expected: string, source: string): StrategyError {\n return new StrategyError(`strategy.${key} in ${source} must be ${expected}.`);\n}\n\nfunction asBoolean(value: unknown, key: string, source: string): boolean {\n if (typeof value !== \"boolean\") throw wrongType(key, \"a boolean\", source);\n return value;\n}\n\nfunction parseSeverity(value: unknown, source: string): Partial<Record<StrategyRule, StrategySeverity>> {\n if (!isMapping(value)) throw wrongType(\"severity\", \"a mapping\", source);\n rejectUnknownKeys(value, STRATEGY_RULES, \"strategy.severity\", source);\n const severity: Partial<Record<StrategyRule, StrategySeverity>> = {};\n for (const [rule, level] of Object.entries(value)) {\n if (!isStrategyRule(rule)) continue;\n if (!isLevel(level)) {\n // A level is not a secret, so a string one is quoted back.\n const quoted = typeof level === \"string\" ? ` \"${level}\"` : \"\";\n throw new StrategyError(\n `${source}: strategy.severity.${rule}${quoted} is not a level. Expected ${SEVERITY_LEVELS.join(\" | \")}.`,\n );\n }\n severity[rule] = level;\n }\n return severity;\n}\n\n/** Validate the `strategy:` slice of a family file. `null` is an empty section. */\nexport function parseStrategyConfig(raw: unknown, source: string): StrategyConfig {\n if (raw == null) return {};\n if (!isMapping(raw)) throw new StrategyError(`strategy: in ${source} must be a mapping.`);\n // Before the unknown-key check, which would call a family setting a typo.\n for (const key of COLLECTION_KEYS) {\n if (Object.hasOwn(raw, key)) {\n throw new StrategyError(`${source}: strategy does not carry \"${key}\". Name a collection under collections:.`);\n }\n }\n rejectUnknownKeys(raw, CONFIG_KEYS, \"strategy\", source);\n\n const config: StrategyConfig = {};\n if (raw.severity !== undefined) config.severity = parseSeverity(raw.severity, source);\n if (raw.baseline !== undefined) {\n if (typeof raw.baseline !== \"string\") throw wrongType(\"baseline\", \"a string\", source);\n config.baseline = raw.baseline;\n }\n if (raw.allowEmpty !== undefined) config.allowEmpty = asBoolean(raw.allowEmpty, \"allowEmpty\", source);\n if (raw.respectGitignore !== undefined) {\n config.respectGitignore = asBoolean(raw.respectGitignore, \"respectGitignore\", source);\n }\n return config;\n}\n\nexport interface StrategyRunOptions {\n cwd: string;\n /** `-c/--config`. */\n configPath?: string;\n /** Positional inputs; empty means fall back to the selected collections' `paths:`. */\n inputs: string[];\n /** `--collection <name>`, repeatable. Empty means every declared collection. */\n collection?: string[];\n}\n\nconst STDIN = \"-\";\n\n/** Which config governs the run, and what to resolve from where. */\nexport async function resolveStrategyRun(opts: StrategyRunOptions): Promise<StrategyRun> {\n const cwd = resolve(opts.cwd);\n const wanted = opts.collection ?? [];\n if (wanted.length > 0 && opts.inputs.some((input) => input !== STDIN)) {\n throw new StrategyError(\"--collection selects a configured collection; it cannot be combined with paths.\");\n }\n\n const file: ConfigFile | null = opts.configPath\n ? await readConfigFile(opts.configPath, cwd, CONFIG_FILE)\n : await findConfigFile(cwd, CONFIG_FILE);\n if (wanted.length > 0 && file === null) {\n throw new StrategyError(\"--collection needs a config file to select from.\");\n }\n const config = file === null ? null : parseStrategyConfig(file.value, file.source);\n\n const collections = file\n ? selectCollections(file.collections, wanted, file.source, (message) => new StrategyError(message))\n : [];\n const fromCollections = opts.inputs.length === 0;\n const inputs = fromCollections ? collections.flatMap((c) => c.paths) : opts.inputs;\n const base = fromCollections && inputs.length > 0 && file ? file.dir : cwd;\n\n return {\n config,\n inputs,\n base,\n collections,\n fromCollections,\n ...(file ? { configDir: file.dir, configPath: file.path, configSource: file.source, configFile: file } : {}),\n };\n}\n","/**\n * What every `manni strategy` command core shares: resolve the run and load\n * the set. Kept free of commander and of stdout, so a core is called directly\n * by its tests; the CLI reads stdin once and hands it in.\n */\nimport { isAbsolute, relative, resolve } from \"node:path\";\nimport { loadConfig } from \"../../graph/core/config.js\";\nimport { routesFrom } from \"../../graph/core/discover.js\";\nimport { resolveStrategyRun } from \"../core/config.js\";\nimport { loadStrategySet } from \"../core/load-set.js\";\nimport { resolveSteps, stepsNeedRoutes, type StepMap } from \"../core/steps.js\";\nimport { StrategyError } from \"../errors.js\";\nimport type { StrategyRun, StrategySet } from \"../types.js\";\n\n/** The inputs and flags `list`, `get` and `check` share. */\nexport interface StrategyCommandOptions {\n /** Default `process.cwd()`. */\n cwd?: string;\n /** Positional `[paths...]`; `-` is stdin. Empty falls back to the collections. */\n inputs: string[];\n /** Stdin's content, read once by the CLI when `-` is among the inputs. */\n stdin?: string;\n /** `--as <format>`. */\n as?: string;\n /** `--exclude <glob>`, repeatable. */\n exclude?: string[];\n /** `--ext <list>`, already split. */\n exts?: string[];\n /** `--allow-empty`. */\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n noGitignore?: boolean;\n /** `--collection <name>`, repeatable. */\n collection?: string[];\n /** `-c, --config <path>`. */\n configPath?: string;\n onNotice?: (message: string) => void;\n}\n\nexport interface LoadedStrategy {\n cwd: string;\n run: StrategyRun;\n set: StrategySet;\n /** Each journey's steps, resolved against the run's pages. */\n steps: StepMap;\n}\n\nexport async function loadStrategy(opts: StrategyCommandOptions): Promise<LoadedStrategy> {\n const cwd = resolve(opts.cwd ?? process.cwd());\n const run = await resolveStrategyRun({\n cwd,\n inputs: opts.inputs,\n ...(opts.configPath === undefined ? {} : { configPath: opts.configPath }),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n });\n // A collection's `exclude:` shapes the collection, so it applies when the\n // inputs came from the collections and never to a path the operator typed.\n const exclude = [\n ...new Set([...(opts.exclude ?? []), ...(run.fromCollections ? run.collections.flatMap((c) => c.exclude) : [])]),\n ];\n const set = await loadStrategySet({\n run,\n exclude,\n ...(opts.exts === undefined ? {} : { exts: opts.exts }),\n ...(opts.allowEmpty === true ? { allowEmpty: true } : {}),\n ...(opts.noGitignore === true ? { noGitignore: true } : {}),\n ...(opts.stdin === undefined ? {} : { stdin: opts.stdin }),\n ...(opts.as === undefined ? {} : { as: opts.as }),\n ...(opts.onNotice === undefined ? {} : { onNotice: opts.onNotice }),\n });\n // `graph:` is read only when a step names a `/` route, and through graph's own loader.\n const routes = stepsNeedRoutes(set) && run.configPath !== undefined ? routesFrom(loadConfig(run.configPath, cwd), run.base) : [];\n const steps = resolveSteps(set, { routes, from: run.configDir ?? cwd, base: run.base });\n return { cwd, run, set, steps };\n}\n\n/** `value` when it is one of `allowed`, else the family's unknown-format refusal. */\nexport function formatChoice<T extends string>(value: string, allowed: readonly T[]): T {\n const found = allowed.find((candidate) => candidate === value);\n if (found === undefined) throw new StrategyError(`unknown format \"${value}\". Expected ${allowed.join(\" | \")}.`);\n return found;\n}\n\n/**\n * A path as a person standing in `cwd` would type it: relative, posix. A\n * label is relative to the run's base, which is the config directory for a\n * collection run, so it is resolved from there first.\n */\nexport function displayPath(path: string, cwd: string, base = cwd): string {\n if (path.startsWith(\"<\")) return path;\n const rel = relative(cwd, isAbsolute(path) ? path : resolve(base, path));\n return (rel === \"\" ? \".\" : rel).replaceAll(\"\\\\\", \"/\");\n}\n\n/** `1 record`, `2 records`. */\nexport function plural(n: number, one: string, many = `${one}s`): string {\n return `${String(n)} ${n === 1 ? one : many}`;\n}\n","/**\n * Load a strategy set: resolve the run's files, extract each one's metadata\n * with meta's extractor, merge in what its `{page}.meta.yaml` manifests\n * supply through `metaPageView`, and read the records and references out of\n * the merged view. Every value's file and line come from `declaredAt`, so a\n * value a sidecar holds is filed at the sidecar's line.\n *\n * A file that cannot be read or parsed is an error, not a skip: a set that\n * quietly lost a record would report the pages naming it as broken.\n */\nimport { readFile } from \"node:fs/promises\";\nimport { extname, resolve } from \"node:path\";\nimport {\n STDIN_LABEL,\n STDIN_TOKEN,\n assertNonEmpty,\n declaredAt,\n extractorByName,\n extractorForExtension,\n gitignoreOptions,\n metaPageView,\n resolveTargetSet,\n supportedExtensions,\n} from \"../../meta/internal.js\";\nimport type { ExtractedMetadata } from \"../../meta/index.js\";\nimport { STDIN_REQUIRES_AS } from \"../../shared/cli-options.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { readRecord } from \"../../shared/reference-fields.js\";\nimport { StrategyError } from \"../errors.js\";\nimport {\n PAGE_FIELDS,\n PARENTS,\n type At,\n type StrategyRecord,\n type StrategyReference,\n type StrategyRun,\n type StrategySet,\n type StrategyStep,\n} from \"../types.js\";\n\nexport interface LoadStrategySetOptions {\n run: StrategyRun;\n /** Stdin's content, when `-` is among the run's inputs. */\n stdin?: string;\n /** `--as <format>`, which stdin needs. */\n as?: string;\n /** `--exclude <glob>`, repeatable. */\n exclude?: string[];\n /** `--ext <list>`: the extensions a directory or glob walk keeps. */\n exts?: string[];\n /** `--allow-empty`: wins over `strategy.allowEmpty`. */\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n noGitignore?: boolean;\n onNotice?: (message: string) => void;\n}\n\ninterface Extracted {\n label: string;\n extracted: ExtractedMetadata;\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() !== \"\" ? value : undefined;\n}\n\nfunction extract(content: string, label: string, path: string | undefined, format: string): Extracted {\n const extractor = extractorByName(format);\n if (extractor === undefined) throw new StrategyError(`${label}: no reader for format \"${format}\".`);\n try {\n return { label, extracted: extractor.extract(content, path ?? label) };\n } catch (error) {\n throw new StrategyError(`${label}: could not be read as ${format}: ${errorMessage(error)}`);\n }\n}\n\nasync function readInput(path: string, label: string): Promise<string> {\n try {\n return await readFile(path, \"utf8\");\n } catch (error) {\n throw new StrategyError(`${label}: could not be read: ${errorMessage(error)}`);\n }\n}\n\n/** The files the run names, extracted. Stdin comes last, as one more input. */\nasync function extractAll(opts: LoadStrategySetOptions, allowEmpty: boolean): Promise<Extracted[]> {\n const { run } = opts;\n const exclude = opts.exclude ?? [];\n const usingStdin = run.inputs.includes(STDIN_TOKEN);\n const inputs = run.inputs.filter((input) => input !== STDIN_TOKEN);\n if (usingStdin && (opts.as === undefined || opts.as === \"\")) throw new StrategyError(STDIN_REQUIRES_AS);\n if (inputs.length === 0 && !usingStdin) {\n throw new StrategyError(\n \"No files to read. Pass paths/globs, or declare a collection under `collections:` in manni.config.yaml.\",\n );\n }\n\n const out: Extracted[] = [];\n if (inputs.length > 0) {\n const { files, gitignoreSkipped } = await resolveTargetSet({\n inputs,\n cwd: run.base,\n exclude,\n exts: opts.exts ?? supportedExtensions(),\n allowEmpty,\n ...gitignoreOptions({\n ...(opts.noGitignore === true ? { flag: false } : {}),\n ...(run.config?.respectGitignore === undefined ? {} : { configured: run.config.respectGitignore }),\n ...(opts.onNotice ? { onNotice: opts.onNotice } : {}),\n }),\n });\n assertNonEmpty({\n files,\n inputs,\n usingStdin,\n allowEmpty,\n exclude,\n ...(opts.exts === undefined ? {} : { exts: opts.exts }),\n gitignoreSkipped,\n action: \"read\",\n });\n for (const file of files) {\n const extractor = extractorForExtension(extname(file));\n if (extractor === undefined) {\n throw new StrategyError(`${file}: no reader for its extension. Pass --as <format> through stdin to read it.`);\n }\n const path = resolve(run.base, file);\n out.push(extract(await readInput(path, file), file, path, extractor.name));\n }\n }\n if (usingStdin && opts.as !== undefined) out.push(extract(opts.stdin ?? \"\", STDIN_LABEL, undefined, opts.as));\n return out;\n}\n\n/** One value or a list of them, with the pointer each sits at. Anything else contributes nothing. */\nfunction valuesOf(data: Record<string, unknown>, field: string): { value: string; pointer: string }[] {\n const raw = data[field];\n if (typeof raw === \"string\") return raw.trim() === \"\" ? [] : [{ value: raw, pointer: `/${field}` }];\n if (!Array.isArray(raw)) return [];\n return raw.flatMap((item: unknown, i) =>\n typeof item === \"string\" && item.trim() !== \"\" ? [{ value: item, pointer: `/${field}/${String(i)}` }] : [],\n );\n}\n\n/**\n * A journey's `steps:`, each mapping item with the fields of their type and\n * the lines they sit on. A step is numbered by its position in the list.\n */\nfunction stepsOf(data: Record<string, unknown>, at: (pointer: string) => At): StrategyStep[] {\n const raw = data[\"steps\"];\n if (!Array.isArray(raw)) return [];\n return raw.flatMap((item: unknown, i): StrategyStep[] => {\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) return [];\n const fields = item as Record<string, unknown>;\n const pointer = `/steps/${String(i)}`;\n const stage = text(fields[\"stage\"]);\n const doc = text(fields[\"doc\"]);\n const note = text(fields[\"note\"]);\n const exists = fields[\"exists\"];\n const known = exists === true || exists === false || exists === \"partial\" ? exists : undefined;\n return [\n {\n n: i + 1,\n ...(stage === undefined ? {} : { stage }),\n ...(doc === undefined ? {} : { doc }),\n ...(known === undefined ? {} : { exists: known }),\n ...(note === undefined ? {} : { note }),\n ...at(pointer),\n ...(doc === undefined ? {} : { docAt: at(`${pointer}/doc`) }),\n ...(known === undefined ? {} : { existsAt: at(`${pointer}/exists`) }),\n },\n ];\n });\n}\n\nexport async function loadStrategySet(opts: LoadStrategySetOptions): Promise<StrategySet> {\n const { run } = opts;\n const allowEmpty = opts.allowEmpty ?? run.config?.allowEmpty === true;\n const inputs = await extractAll(opts, allowEmpty);\n\n // Meta's view over the same config file, so a sidecar counts exactly as\n // `manni meta validate` merges it. Labels are relative to the run's base.\n const view = await metaPageView({\n cwd: run.base,\n ...(run.configPath === undefined ? { noConfig: true } : { configPath: run.configPath }),\n pages: inputs.filter((i) => i.label !== STDIN_LABEL).map((i) => resolve(run.base, i.label)),\n });\n\n const pages: string[] = [];\n const set: StrategySet = { records: [], references: [], pages };\n for (const { label, extracted } of inputs) {\n const merged = await view.merge(label, extracted);\n const data = merged.extracted.data;\n const at = (pointer: string): At => declaredAt(label, pointer, { extracted: merged.extracted, locate: merged.locate });\n const declares = readRecord(data, label);\n const type = declares?.type;\n const isRecord = declares !== undefined;\n\n if (declares !== undefined) {\n const declaredId = text(data[\"id\"]);\n const title = text(data[\"title\"]);\n const description = text(data[\"description\"]);\n const lifecycle = text(data[\"lifecycle\"]);\n const steps = type === \"journey\" ? stepsOf(data, at) : [];\n const record: StrategyRecord = {\n id: declares.id,\n type: declares.type,\n ...(title === undefined ? {} : { title }),\n ...(description === undefined ? {} : { description }),\n ...(lifecycle === undefined ? {} : { lifecycle }),\n file: label,\n line: 1,\n ...(declaredId === undefined ? {} : { idAt: at(\"/id\") }),\n parents:\n declares.type === \"audience\"\n ? []\n : valuesOf(data, PARENTS[declares.type]).map(({ value, pointer }) => ({ value, ...at(pointer) })),\n ...(steps.length === 0 ? {} : { steps }),\n };\n set.records.push(record);\n } else {\n pages.push(label);\n }\n\n // A journey's `personas:` is its parent field, read above, so it is not a reference too.\n const parentField = type !== undefined && type !== \"audience\" ? PARENTS[type] : undefined;\n for (const field of Object.values(PAGE_FIELDS)) {\n if (field === parentField) continue;\n for (const { value, pointer } of valuesOf(data, field)) {\n const reference: StrategyReference = { field, value, page: label, record: isRecord, ...at(pointer) };\n set.references.push(reference);\n }\n }\n }\n\n if (set.records.length === 0 && !allowEmpty) {\n throw new StrategyError(\n \"no strategy records found. A record is a page declaring type: audience, type: persona or type: journey.\",\n );\n }\n return set;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,UAAU,eAAe;;;ACsBlC,IAAM,OAAO,CAAC,UAA0B,MAAM,YAAY;AAG1D,IAAM,cAA4D;AAGlE,IAAM,eAAe,CAAC,SAAgC,YAAY,QAAQ,IAAI,CAAC;AAkBxE,SAAS,SAAS,KAAiC;AACxD,QAAM,SAAS,oBAAI,IAA6C;AAChE,QAAM,OAAO,oBAAI,IAA4B;AAC7C,aAAW,UAAU,IAAI,SAAS;AAChC,UAAM,MAAM,OAAO,IAAI,OAAO,IAAI,KAAK,oBAAI,IAA4B;AACvE,QAAI,CAAC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC,EAAG,KAAI,IAAI,KAAK,OAAO,EAAE,GAAG,MAAM;AAC9D,WAAO,IAAI,OAAO,MAAM,GAAG;AAC3B,QAAI,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC,EAAG,MAAK,IAAI,KAAK,OAAO,EAAE,GAAG,MAAM;AAAA,EAClE;AACA,QAA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ACtF,SAAO,EAAE,KAAK,KAAK,KAAK,MAAM;AAChC;AAGO,SAAS,aAA+B,OAAe,SAA0B;AACtF,QAAM,QAAQ,QAAQ,KAAK,CAAC,cAAc,cAAc,KAAK;AAC7D,MAAI,UAAU,OAAW,OAAM,IAAI,cAAc,mBAAmB,KAAK,eAAe,QAAQ,KAAK,KAAK,CAAC,GAAG;AAC9G,SAAO;AACT;AAOO,SAAS,YAAY,MAAc,KAAa,OAAO,KAAa;AACzE,MAAI,KAAK,WAAW,GAAG,EAAG,QAAO;AACjC,QAAM,MAAMC,UAAS,KAAK,WAAW,IAAI,IAAI,OAAOD,SAAQ,MAAM,IAAI,CAAC;AACvE,UAAQ,QAAQ,KAAK,MAAM,KAAK,WAAW,MAAM,GAAG;AACtD;AAGO,SAAS,OAAO,GAAW,KAAa,OAAO,GAAG,GAAG,KAAa;AACvE,SAAO,GAAG,OAAO,CAAC,CAAC,IAAI,MAAM,IAAI,MAAM,IAAI;AAC7C;","names":["target","fix","resolve","resolve","relative","resolve","resolve","resolve","resolve","relative"]}
@@ -2,11 +2,13 @@
2
2
  import {
3
3
  displayPath,
4
4
  plural
5
- } from "./chunk-6XK3NTL5.js";
5
+ } from "./chunk-FBIBR4CH.js";
6
+ import {
7
+ PARENTS
8
+ } from "./chunk-INOVEO32.js";
6
9
  import {
7
- PARENTS,
8
10
  RECORD_TYPES
9
- } from "./chunk-GMLOAKOA.js";
11
+ } from "./chunk-AZKNB2T3.js";
10
12
  import {
11
13
  guidanceLines
12
14
  } from "./chunk-QK6VYJHV.js";
@@ -151,4 +153,4 @@ export {
151
153
  renderGetPretty,
152
154
  renderFindingsPretty
153
155
  };
154
- //# sourceMappingURL=chunk-5LE4NH3Z.js.map
156
+ //# sourceMappingURL=chunk-FJYIPHWK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/strategy/reporters/pretty.ts"],"sourcesContent":["/**\n * Human output for every `manni strategy` command. `list` is a tree, `get` a\n * key column, and `check` term's layout: findings grouped under a bold\n * `file:line`, each message wrapped under its own column with the rule's\n * guidance dim beneath it.\n */\nimport { palette, type Colors } from \"../../shared/color.js\";\nimport { guidanceLines } from \"../../shared/guidance.js\";\nimport type { Severity } from \"../../shared/severity.js\";\nimport type { StrategyReport } from \"../commands/findings.js\";\nimport type { RecordEntry } from \"../commands/list.js\";\nimport { displayPath, plural } from \"../commands/run.js\";\nimport { PARENTS, RECORD_TYPES, type ResolvedStep, type StrategyFinding, type StrategyRecord } from \"../types.js\";\n\nconst WIDTH = 80;\n\n/** A record's title, or its id when it has none. */\nexport function titleOf(record: StrategyRecord): string {\n return record.title ?? record.id;\n}\n\n/** `4 audiences, 4 personas, 74 journeys`. */\nexport function countsLine(records: readonly StrategyRecord[]): string {\n return RECORD_TYPES.map((type) => plural(records.filter((r) => r.type === type).length, type)).join(\", \");\n}\n\n// ---------------------------------------------------------------------------\n// list\n\nexport function renderListPretty(entries: readonly RecordEntry[]): string {\n const cell = (e: RecordEntry): string => `${\" \".repeat(e.depth)}${e.record.id}`;\n const recordWidth = Math.max(\"record\".length, ...entries.map((e) => cell(e).length)) + 4;\n const pagesWidth = Math.max(\"pages\".length, ...entries.map((e) => String(e.pages.length).length));\n // The steps column shows only when some journey has steps, so a set without them prints as it always has.\n const covered = (e: RecordEntry): string =>\n e.coverage === undefined ? \"\" : `${String(e.coverage.served)}/${String(e.coverage.steps)}`;\n const stepsWidth = entries.some((e) => e.coverage !== undefined)\n ? Math.max(\"steps\".length, ...entries.map((e) => covered(e).length))\n : 0;\n const row = (record: string, pages: string, steps: string, title: string): string =>\n `${record.padEnd(recordWidth)}${pages.padStart(pagesWidth)} ${stepsWidth === 0 ? \"\" : `${steps.padStart(stepsWidth)} `}${title}`.trimEnd();\n return [\n row(\"record\", \"pages\", \"steps\", \"title\"),\n ...entries.map((e) => row(cell(e), String(e.pages.length), covered(e), titleOf(e.record))),\n // A record under several parents is counted once.\n countsLine([...new Set(entries.map((e) => e.record))]),\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// get\n\nconst KEY_WIDTH = 14;\n\n/** Each record as `id title`, the ids padded so the titles line up. */\nfunction recordLines(records: readonly Pick<StrategyRecord, \"id\" | \"title\">[]): string[] {\n const width = Math.max(0, ...records.map((r) => r.id.length)) + 2;\n return records.map((r) => (r.title === undefined ? r.id : `${r.id.padEnd(width)}${r.title}`));\n}\n\n/**\n * Each step as its number, its state padded to nine and its stage. Under it,\n * dim: the page `doc` names, else `doc` as written, then the note.\n */\nfunction stepLines(steps: readonly ResolvedStep[], c: Colors): string[] {\n const numberWidth = Math.max(...steps.map((s) => String(s.n).length));\n const indent = \" \".repeat(numberWidth + 2 + 9 + 2);\n return steps.flatMap((step) => {\n const lines = [`${String(step.n).padEnd(numberWidth)} ${step.state.padEnd(9)} ${step.stage ?? \"\"}`.trimEnd()];\n const where = step.page ?? step.doc;\n if (where !== undefined) lines.push(`${indent}${c.dim(where)}`);\n if (step.note !== undefined) lines.push(`${indent}${c.dim(step.note)}`);\n return lines;\n });\n}\n\nexport function renderGetPretty(entry: RecordEntry, opts: { color: boolean }): string {\n const c = palette(opts.color);\n const { record } = entry;\n const rows: [string, string[]][] = [\n [\"type\", [record.type]],\n [\"id\", [record.id]],\n ];\n if (record.description !== undefined) rows.push([\"description\", [record.description]]);\n if (record.lifecycle !== undefined) rows.push([\"lifecycle\", [record.lifecycle]]);\n if (record.type !== \"audience\" && record.parents.length > 0) {\n // A value no record answers to shows as written.\n const shown = record.parents.map(\n (p) => entry.parents.find((r) => r.id.toLowerCase() === p.value.toLowerCase()) ?? { id: p.value },\n );\n rows.push([PARENTS[record.type], recordLines(shown)]);\n }\n if (entry.children.length > 0) rows.push([record.type === \"audience\" ? \"personas\" : \"journeys\", recordLines(entry.children)]);\n if (entry.steps !== undefined && entry.coverage !== undefined) {\n rows.push([\"steps\", [`${String(entry.coverage.served)} of ${String(entry.coverage.steps)} served`, ...stepLines(entry.steps, c)]]);\n }\n rows.push([\"pages\", entry.pages.length === 0 ? [\"none\"] : entry.pages]);\n\n const where = `${entry.file}:${String(record.line)}`;\n const lines = [`${c.bold(titleOf(record).padEnd(44))} ${c.dim(where)}`];\n for (const [key, values] of rows) {\n values.forEach((value, i) => lines.push(` ${(i === 0 ? key : \"\").padEnd(KEY_WIDTH)}${value}`));\n }\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// check\n\nconst RULE_WIDTH = 36;\n\n/** Sentences packed into lines of at most `width`; a message that fits stays whole. */\nfunction wrapSentences(text: string, width: number): string[] {\n if (text.length <= width) return [text];\n const lines: string[] = [];\n let line = \"\";\n // A sentence ends at `.` or `?` before a space and a capital, which every\n // message sentence starts with, so `m1.0`, a URL or `e.g. x` never splits.\n for (const sentence of text.split(/(?<=[.?])\\s+(?=[A-Z])/)) {\n if (line === \"\") line = sentence;\n else if (line.length + 1 + sentence.length <= width) line = `${line} ${sentence}`;\n else {\n lines.push(line);\n line = sentence;\n }\n }\n if (line !== \"\") lines.push(line);\n return lines;\n}\n\nfunction severityText(c: Colors, severity: Severity): string {\n const padded = severity.padEnd(7);\n if (severity === \"error\") return c.red(padded);\n if (severity === \"warning\") return c.yellow(padded);\n return c.cyan(padded);\n}\n\nfunction counts(findings: readonly StrategyFinding[]): string {\n const n = (severity: Severity): number => findings.filter((f) => f.severity === severity).length;\n const parts: string[] = [];\n if (n(\"error\") > 0) parts.push(plural(n(\"error\"), \"error\"));\n if (n(\"warning\") > 0) parts.push(plural(n(\"warning\"), \"warning\"));\n if (n(\"notice\") > 0) parts.push(plural(n(\"notice\"), \"notice\"));\n return parts.join(\", \");\n}\n\nexport function renderFindingsPretty(report: StrategyReport, opts: { color: boolean }): string {\n const c = palette(opts.color);\n const { baseline } = report;\n if (baseline?.written === true) {\n return `${c.green(\"✓\")} ${plural(report.found, \"finding\")} recorded in ${baseline.path}`;\n }\n const baselined = baseline !== undefined && baseline.suppressed > 0 ? `, ${String(baseline.suppressed)} baselined` : \"\";\n const records = plural(report.records, \"record\");\n if (report.findings.length === 0) {\n const steps = report.steps > 0 ? `, ${plural(report.steps, \"step\")}` : \"\";\n return `${c.green(\"✓\")} ${records}, ${plural(report.references, \"reference\")}${steps}, no findings${baselined}`;\n }\n\n const ruleWidth = Math.max(RULE_WIDTH, ...report.findings.map((f) => f.ruleId.length + 2));\n const prefixWidth = 2 + 7 + 1 + ruleWidth;\n const indent = \" \".repeat(prefixWidth);\n const lines: string[] = [];\n let group: string | undefined;\n for (const finding of report.findings) {\n const file = displayPath(finding.file, report.cwd, report.base);\n const header = finding.line === undefined ? file : `${file}:${String(finding.line)}`;\n if (header !== group) {\n lines.push(c.bold(header));\n group = header;\n }\n wrapSentences(finding.message, WIDTH - prefixWidth).forEach((text, i) => {\n lines.push(\n i === 0 ? ` ${severityText(c, finding.severity)} ${finding.ruleId.padEnd(ruleWidth)}${text}` : `${indent}${text}`,\n );\n });\n for (const line of guidanceLines(finding.guidance)) lines.push(`${indent}${c.dim(line)}`);\n }\n lines.push(\"\", `${counts(report.findings)} in ${records}${baselined}`);\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,IAAM,QAAQ;AAGP,SAAS,QAAQ,QAAgC;AACtD,SAAO,OAAO,SAAS,OAAO;AAChC;AAGO,SAAS,WAAW,SAA4C;AACrE,SAAO,aAAa,IAAI,CAAC,SAAS,OAAO,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,QAAQ,IAAI,CAAC,EAAE,KAAK,IAAI;AAC1G;AAKO,SAAS,iBAAiB,SAAyC;AACxE,QAAM,OAAO,CAAC,MAA2B,GAAG,KAAK,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE;AAC9E,QAAM,cAAc,KAAK,IAAI,SAAS,QAAQ,GAAG,QAAQ,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI;AACvF,QAAM,aAAa,KAAK,IAAI,QAAQ,QAAQ,GAAG,QAAQ,IAAI,CAAC,MAA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AO,KAAK,OAAO,OAAO,YAAY,WAAW,CAAC,GAAG,KAAK,gBAAgB,SAAS;AAAA,EAC/G;AAEA,QAAM,YAAY,KAAK,IAAI,YAAY,GAAG,OAAO,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,CAAC;AACzF,QAAM,cAAc,IAAI,IAAI,IAAI;AAChC,QAAM,SAAS,IAAI,OAAO,WAAW;AACrC,QAAM,QAAkB,CAAC;AACzB,MAAI;AACJ,aAAW,WAAW,OAAO,UAAU;AACrC,UAAM,OAAO,YAAY,QAAQ,MAAM,OAAO,KAAK,OAAO,IAAI;AAC9D,UAAM,SAAS,QAAQ,SAAS,SAAY,OAAO,GAAG,IAAI,IAAI,OAAO,QAAQ,IAAI,CAAC;AAClF,QAAI,WAAW,OAAO;AACpB,YAAM,KAAK,EAAE,KAAK,MAAM,CAAC;AACzB,cAAQ;AAAA,IACV;AACA,kBAAc,QAAQ,SAAS,QAAQ,WAAW,EAAE,QAAQ,CAAC,MAAM,MAAM;AACvE,YAAM;AAAA,QACJ,MAAM,IAAI,KAAK,aAAa,GAAG,QAAQ,QAAQ,CAAC,IAAI,QAAQ,OAAO,OAAO,SAAS,CAAC,GAAG,IAAI,KAAK,GAAG,MAAM,GAAG,IAAI;AAAA,MAClH;AAAA,IACF,CAAC;AACD,eAAW,QAAQ,cAAc,QAAQ,QAAQ,EAAG,OAAM,KAAK,GAAG,MAAM,GAAG,EAAE,IAAI,IAAI,CAAC,EAAE;AAAA,EAC1F;AACA,QAAM,KAAK,IAAI,GAAG,OAAO,OAAO,QAAQ,CAAC,OAAO,OAAO,GAAG,SAAS,EAAE;AACrE,SAAO,MAAM,KAAK,IAAI;AACxB;","names":[]}
1
+ {"version":3,"sources":["../src/strategy/reporters/pretty.ts"],"sourcesContent":["/**\n * Human output for every `manni strategy` command. `list` is a tree, `get` a\n * key column, and `check` term's layout: findings grouped under a bold\n * `file:line`, each message wrapped under its own column with the rule's\n * guidance dim beneath it.\n */\nimport { palette, type Colors } from \"../../shared/color.js\";\nimport { guidanceLines } from \"../../shared/guidance.js\";\nimport type { Severity } from \"../../shared/severity.js\";\nimport type { StrategyReport } from \"../commands/findings.js\";\nimport type { RecordEntry } from \"../commands/list.js\";\nimport { displayPath, plural } from \"../commands/run.js\";\nimport { PARENTS, RECORD_TYPES, type ResolvedStep, type StrategyFinding, type StrategyRecord } from \"../types.js\";\n\nconst WIDTH = 80;\n\n/** A record's title, or its id when it has none. */\nexport function titleOf(record: StrategyRecord): string {\n return record.title ?? record.id;\n}\n\n/** `4 audiences, 4 personas, 74 journeys`. */\nexport function countsLine(records: readonly StrategyRecord[]): string {\n return RECORD_TYPES.map((type) => plural(records.filter((r) => r.type === type).length, type)).join(\", \");\n}\n\n// ---------------------------------------------------------------------------\n// list\n\nexport function renderListPretty(entries: readonly RecordEntry[]): string {\n const cell = (e: RecordEntry): string => `${\" \".repeat(e.depth)}${e.record.id}`;\n const recordWidth = Math.max(\"record\".length, ...entries.map((e) => cell(e).length)) + 4;\n const pagesWidth = Math.max(\"pages\".length, ...entries.map((e) => String(e.pages.length).length));\n // The steps column shows only when some journey has steps, so a set without them prints as it always has.\n const covered = (e: RecordEntry): string =>\n e.coverage === undefined ? \"\" : `${String(e.coverage.served)}/${String(e.coverage.steps)}`;\n const stepsWidth = entries.some((e) => e.coverage !== undefined)\n ? Math.max(\"steps\".length, ...entries.map((e) => covered(e).length))\n : 0;\n const row = (record: string, pages: string, steps: string, title: string): string =>\n `${record.padEnd(recordWidth)}${pages.padStart(pagesWidth)} ${stepsWidth === 0 ? \"\" : `${steps.padStart(stepsWidth)} `}${title}`.trimEnd();\n return [\n row(\"record\", \"pages\", \"steps\", \"title\"),\n ...entries.map((e) => row(cell(e), String(e.pages.length), covered(e), titleOf(e.record))),\n // A record under several parents is counted once.\n countsLine([...new Set(entries.map((e) => e.record))]),\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// get\n\nconst KEY_WIDTH = 14;\n\n/** Each record as `id title`, the ids padded so the titles line up. */\nfunction recordLines(records: readonly Pick<StrategyRecord, \"id\" | \"title\">[]): string[] {\n const width = Math.max(0, ...records.map((r) => r.id.length)) + 2;\n return records.map((r) => (r.title === undefined ? r.id : `${r.id.padEnd(width)}${r.title}`));\n}\n\n/**\n * Each step as its number, its state padded to nine and its stage. Under it,\n * dim: the page `doc` names, else `doc` as written, then the note.\n */\nfunction stepLines(steps: readonly ResolvedStep[], c: Colors): string[] {\n const numberWidth = Math.max(...steps.map((s) => String(s.n).length));\n const indent = \" \".repeat(numberWidth + 2 + 9 + 2);\n return steps.flatMap((step) => {\n const lines = [`${String(step.n).padEnd(numberWidth)} ${step.state.padEnd(9)} ${step.stage ?? \"\"}`.trimEnd()];\n const where = step.page ?? step.doc;\n if (where !== undefined) lines.push(`${indent}${c.dim(where)}`);\n if (step.note !== undefined) lines.push(`${indent}${c.dim(step.note)}`);\n return lines;\n });\n}\n\nexport function renderGetPretty(entry: RecordEntry, opts: { color: boolean }): string {\n const c = palette(opts.color);\n const { record } = entry;\n const rows: [string, string[]][] = [\n [\"type\", [record.type]],\n [\"id\", [record.id]],\n ];\n if (record.description !== undefined) rows.push([\"description\", [record.description]]);\n if (record.lifecycle !== undefined) rows.push([\"lifecycle\", [record.lifecycle]]);\n if (record.type !== \"audience\" && record.parents.length > 0) {\n // A value no record answers to shows as written.\n const shown = record.parents.map(\n (p) => entry.parents.find((r) => r.id.toLowerCase() === p.value.toLowerCase()) ?? { id: p.value },\n );\n rows.push([PARENTS[record.type], recordLines(shown)]);\n }\n if (entry.children.length > 0) rows.push([record.type === \"audience\" ? \"personas\" : \"journeys\", recordLines(entry.children)]);\n if (entry.steps !== undefined && entry.coverage !== undefined) {\n rows.push([\"steps\", [`${String(entry.coverage.served)} of ${String(entry.coverage.steps)} served`, ...stepLines(entry.steps, c)]]);\n }\n rows.push([\"pages\", entry.pages.length === 0 ? [\"none\"] : entry.pages]);\n\n const where = `${entry.file}:${String(record.line)}`;\n const lines = [`${c.bold(titleOf(record).padEnd(44))} ${c.dim(where)}`];\n for (const [key, values] of rows) {\n values.forEach((value, i) => lines.push(` ${(i === 0 ? key : \"\").padEnd(KEY_WIDTH)}${value}`));\n }\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// check\n\nconst RULE_WIDTH = 36;\n\n/** Sentences packed into lines of at most `width`; a message that fits stays whole. */\nfunction wrapSentences(text: string, width: number): string[] {\n if (text.length <= width) return [text];\n const lines: string[] = [];\n let line = \"\";\n // A sentence ends at `.` or `?` before a space and a capital, which every\n // message sentence starts with, so `m1.0`, a URL or `e.g. x` never splits.\n for (const sentence of text.split(/(?<=[.?])\\s+(?=[A-Z])/)) {\n if (line === \"\") line = sentence;\n else if (line.length + 1 + sentence.length <= width) line = `${line} ${sentence}`;\n else {\n lines.push(line);\n line = sentence;\n }\n }\n if (line !== \"\") lines.push(line);\n return lines;\n}\n\nfunction severityText(c: Colors, severity: Severity): string {\n const padded = severity.padEnd(7);\n if (severity === \"error\") return c.red(padded);\n if (severity === \"warning\") return c.yellow(padded);\n return c.cyan(padded);\n}\n\nfunction counts(findings: readonly StrategyFinding[]): string {\n const n = (severity: Severity): number => findings.filter((f) => f.severity === severity).length;\n const parts: string[] = [];\n if (n(\"error\") > 0) parts.push(plural(n(\"error\"), \"error\"));\n if (n(\"warning\") > 0) parts.push(plural(n(\"warning\"), \"warning\"));\n if (n(\"notice\") > 0) parts.push(plural(n(\"notice\"), \"notice\"));\n return parts.join(\", \");\n}\n\nexport function renderFindingsPretty(report: StrategyReport, opts: { color: boolean }): string {\n const c = palette(opts.color);\n const { baseline } = report;\n if (baseline?.written === true) {\n return `${c.green(\"✓\")} ${plural(report.found, \"finding\")} recorded in ${baseline.path}`;\n }\n const baselined = baseline !== undefined && baseline.suppressed > 0 ? `, ${String(baseline.suppressed)} baselined` : \"\";\n const records = plural(report.records, \"record\");\n if (report.findings.length === 0) {\n const steps = report.steps > 0 ? `, ${plural(report.steps, \"step\")}` : \"\";\n return `${c.green(\"✓\")} ${records}, ${plural(report.references, \"reference\")}${steps}, no findings${baselined}`;\n }\n\n const ruleWidth = Math.max(RULE_WIDTH, ...report.findings.map((f) => f.ruleId.length + 2));\n const prefixWidth = 2 + 7 + 1 + ruleWidth;\n const indent = \" \".repeat(prefixWidth);\n const lines: string[] = [];\n let group: string | undefined;\n for (const finding of report.findings) {\n const file = displayPath(finding.file, report.cwd, report.base);\n const header = finding.line === undefined ? file : `${file}:${String(finding.line)}`;\n if (header !== group) {\n lines.push(c.bold(header));\n group = header;\n }\n wrapSentences(finding.message, WIDTH - prefixWidth).forEach((text, i) => {\n lines.push(\n i === 0 ? ` ${severityText(c, finding.severity)} ${finding.ruleId.padEnd(ruleWidth)}${text}` : `${indent}${text}`,\n );\n });\n for (const line of guidanceLines(finding.guidance)) lines.push(`${indent}${c.dim(line)}`);\n }\n lines.push(\"\", `${counts(report.findings)} in ${records}${baselined}`);\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,IAAM,QAAQ;AAGP,SAAS,QAAQ,QAAgC;AACtD,SAAO,OAAO,SAAS,OAAO;AAChC;AAGO,SAAS,WAAW,SAA4C;AACrE,SAAO,aAAa,IAAI,CAAC,SAAS,OAAO,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,QAAQ,IAAI,CAAC,EAAE,KAAK,IAAI;AAC1G;AAKO,SAAS,iBAAiB,SAAyC;AACxE,QAAM,OAAO,CAAC,MAA2B,GAAG,KAAK,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE;AAC9E,QAAM,cAAc,KAAK,IAAI,SAAS,QAAQ,GAAG,QAAQ,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI;AACvF,QAAM,aAAa,KAAK,IAAI,QAAQ,QAAQ,GAAG,QAAQ,IAAI,CAAC,MAAM,OAAO,EAAE,MAAM,MAAM,EAAE,MAAM,CAAC;AAEhG,QAA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AgB,SAAS;AAAA,EAC/G;AAEA,QAAM,YAAY,KAAK,IAAI,YAAY,GAAG,OAAO,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,CAAC;AACzF,QAAM,cAAc,IAAI,IAAI,IAAI;AAChC,QAAM,SAAS,IAAI,OAAO,WAAW;AACrC,QAAM,QAAkB,CAAC;AACzB,MAAI;AACJ,aAAW,WAAW,OAAO,UAAU;AACrC,UAAM,OAAO,YAAY,QAAQ,MAAM,OAAO,KAAK,OAAO,IAAI;AAC9D,UAAM,SAAS,QAAQ,SAAS,SAAY,OAAO,GAAG,IAAI,IAAI,OAAO,QAAQ,IAAI,CAAC;AAClF,QAAI,WAAW,OAAO;AACpB,YAAM,KAAK,EAAE,KAAK,MAAM,CAAC;AACzB,cAAQ;AAAA,IACV;AACA,kBAAc,QAAQ,SAAS,QAAQ,WAAW,EAAE,QAAQ,CAAC,MAAM,MAAM;AACvE,YAAM;AAAA,QACJ,MAAM,IAAI,KAAK,aAAa,GAAG,QAAQ,QAAQ,CAAC,IAAI,QAAQ,OAAO,OAAO,SAAS,CAAC,GAAG,IAAI,KAAK,GAAG,MAAM,GAAG,IAAI;AAAA,MAClH;AAAA,IACF,CAAC;AACD,eAAW,QAAQ,cAAc,QAAQ,QAAQ,EAAG,OAAM,KAAK,GAAG,MAAM,GAAG,EAAE,IAAI,IAAI,CAAC,EAAE;AAAA,EAC1F;AACA,QAAM,KAAK,IAAI,GAAG,OAAO,OAAO,QAAQ,CAAC,OAAO,OAAO,GAAG,SAAS,EAAE;AACrE,SAAO,MAAM,KAAK,IAAI;AACxB;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
  isMultilingual,
5
5
  languageOf,
6
6
  plural
7
- } from "./chunk-2YKUSTHS.js";
7
+ } from "./chunk-TVLIJ6ZM.js";
8
8
  import {
9
9
  TERM_AUX_FIELDS,
10
10
  TERM_DESIGNATION_FIELDS,
@@ -342,4 +342,4 @@ export {
342
342
  renderValeWiring,
343
343
  renderFormatsPretty
344
344
  };
345
- //# sourceMappingURL=chunk-A4QNKEX4.js.map
345
+ //# sourceMappingURL=chunk-GCHEVTCJ.js.map
@@ -48,7 +48,8 @@ function publicPage(page) {
48
48
  return { ...page, citations: page.citations.map(publicCitation) };
49
49
  }
50
50
  function renderCheckJson(run) {
51
- return JSON.stringify({ summary: run.summary, pages: run.pages.map(publicPage) }, null, 2);
51
+ const impact = run.impact === void 0 ? {} : { impact: run.impact.entries };
52
+ return JSON.stringify({ summary: run.summary, ...impact, pages: run.pages.map(publicPage) }, null, 2);
52
53
  }
53
54
  function renderRemoveJson(run) {
54
55
  return JSON.stringify(run, null, 2);
@@ -74,4 +75,4 @@ export {
74
75
  renderHistoryJson,
75
76
  renderUpdateJson
76
77
  };
77
- //# sourceMappingURL=chunk-GMOAW2EG.js.map
78
+ //# sourceMappingURL=chunk-GIHIONJH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cite/reporters/json.ts"],"sourcesContent":["/**\n * JSON output. `{ summary, impact, pages }` for check; the run itself for update,\n * remove and history.\n *\n * A citation prints its two ends and how they are anchored. `resolvedPath`,\n * `diff`, `commitsSince` and a changed claim's current lines are left out of\n * every citation: output never says more than the page did. It is an\n * allowlist rather than a strip, so a field added to the result stays private\n * until someone decides here that it is safe to print.\n */\nimport type {\n CheckRun,\n CitationAnchor,\n CitationResult,\n HistoryRun,\n MarkerEnd,\n OriginKind,\n PageCitationReport,\n RemoveRun,\n UpdateRewrite,\n UpdateRun,\n} from \"../types.js\";\n\nexport interface PublicClaimEnd {\n lines?: string;\n fileLines?: string;\n status: string;\n newLines?: string;\n candidates?: string[];\n /** The baseline the claim was read against: the page's own history says it. */\n commitSha?: string;\n historyAvailable?: boolean;\n}\n\nexport interface PublicSourceEnd {\n src: string;\n /** The checkout the source is in, by its `cite.repos` name; present only for a repo entry. */\n repo?: string;\n status: string;\n newLines?: string;\n newSrc?: string;\n candidates?: string[];\n /** The entry's recorded `commit-sha`, as it is written. */\n commitSha?: string;\n /** The full hash the verdict was read against, when history found one (0097). */\n baselineSha?: string;\n historyAvailable?: boolean;\n truncatedSearch?: boolean;\n}\n\nexport interface PublicCitationResult {\n id?: string;\n origin: { kind: OriginKind; file: string; line?: number };\n anchor: CitationAnchor;\n /** The marker that names the entry: its line, and its misplacement when it has one. */\n marker?: MarkerEnd;\n claim: PublicClaimEnd | null;\n source: PublicSourceEnd;\n}\n\nexport function publicCitation(result: CitationResult): PublicCitationResult {\n const origin: PublicCitationResult[\"origin\"] = {\n kind: result.origin.kind,\n file: result.origin.file,\n };\n if (result.origin.line !== undefined) origin.line = result.origin.line;\n\n const source: PublicSourceEnd = {\n src: result.source.src,\n ...(result.source.repo === undefined ? {} : { repo: result.source.repo }),\n status: result.source.status,\n };\n if (result.source.newLines !== undefined) source.newLines = result.source.newLines;\n if (result.source.newSrc !== undefined) source.newSrc = result.source.newSrc;\n if (result.source.candidates !== undefined) source.candidates = result.source.candidates;\n if (result.source.commitSha !== undefined) source.commitSha = result.source.commitSha;\n if (result.source.baselineSha !== undefined) source.baselineSha = result.source.baselineSha;\n if (result.source.historyAvailable !== undefined) {\n source.historyAvailable = result.source.historyAvailable;\n }\n if (result.source.truncatedSearch !== undefined) {\n source.truncatedSearch = result.source.truncatedSearch;\n }\n\n let claim: PublicClaimEnd | null = null;\n if (result.claim !== null) {\n claim = { status: result.claim.status };\n if (result.claim.lines !== undefined) claim.lines = result.claim.lines;\n if (result.claim.fileLines !== undefined) claim.fileLines = result.claim.fileLines;\n if (result.claim.newLines !== undefined) claim.newLines = result.claim.newLines;\n if (result.claim.candidates !== undefined) claim.candidates = result.claim.candidates;\n if (result.claim.commitSha !== undefined) claim.commitSha = result.claim.commitSha;\n if (result.claim.historyAvailable !== undefined) {\n claim.historyAvailable = result.claim.historyAvailable;\n }\n }\n\n // Key order is the order the plan spells a citation in: what it is called,\n // where it is kept, what anchors it, then its two ends.\n return {\n ...(result.citation.id === undefined ? {} : { id: result.citation.id }),\n origin,\n anchor: result.anchor,\n ...(result.marker === undefined ? {} : { marker: result.marker }),\n claim,\n source,\n };\n}\n\nexport interface PublicPageReport extends Omit<PageCitationReport, \"citations\"> {\n citations: PublicCitationResult[];\n}\n\nexport function publicPage(page: PageCitationReport): PublicPageReport {\n return { ...page, citations: page.citations.map(publicCitation) };\n}\n\nexport function renderCheckJson(run: CheckRun): string {\n // `impact` (proposal 0105) is omitted when empty, as the summary's zero counts are.\n const impact = run.impact === undefined ? {} : { impact: run.impact.entries };\n return JSON.stringify({ summary: run.summary, ...impact, pages: run.pages.map(publicPage) }, null, 2);\n}\n\nexport function renderRemoveJson(run: RemoveRun): string {\n // The whole run, with nothing stripped: `RemoveRun` carries no\n // pretty-only field, as `UpdateRewrite.markerLine` is below. A field added\n // to it for the terminal alone is stripped here, as that one is.\n return JSON.stringify(run, null, 2);\n}\n\n/** `{ summary, pages }` for `history`: the run itself, which carries nothing pretty-only. */\nexport function renderHistoryJson(run: HistoryRun): string {\n return JSON.stringify(run, null, 2);\n}\n\nexport function renderUpdateJson(run: UpdateRun): string {\n // `markerLine` is the pretty report's line for a marker-anchored claim.\n // `at` is the claim's own first file line, which is what data says.\n const strip = (rows: readonly UpdateRewrite[]): Omit<UpdateRewrite, \"markerLine\">[] =>\n rows.map(({ markerLine: _pretty, ...rewrite }) => rewrite);\n const pages = run.pages.map((page) => ({\n ...page,\n rewritten: strip(page.rewritten),\n refused: strip(page.refused),\n }));\n return JSON.stringify({ ...run, pages }, null, 2);\n}\n"],"mappings":";;;AA4DO,SAAS,eAAe,QAA8C;AAC3E,QAAM,SAAyC;AAAA,IAC7C,MAAM,OAAO,OAAO;AAAA,IACpB,MAAM,OAAO,OAAO;AAAA,EACtB;AACA,MAAI,OAAO,OAAO,SAAS,OAAW,QAAO,OAAO,OAAO,OAAO;AAElE,QAAM,SAA0B;AAAA,IAC9B,KAAK,OAAO,OAAO;AAAA,IACnB,GAAI,OAAO,OAAO,SAAS,SAAY,CAAC,IAAI,EAAE,MAAM,O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A,IAC/D;AAAA,IACA;AAAA,EACF;AACF;AAMO,SAAS,WAAW,MAA4C;AACrE,SAAO,EAAE,GAAG,MAAM,WAAW,KAAK,UAAU,IAAI,cAAc,EAAE;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AAErD,QAAM,SAAS,IAAI,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,IAAI,OAAO,QAAQ;AAC5E,SAAO,KAAK,UAAU,EAAE,SAAS,IAAI,SAAS,GAAG,QAAQ,OAAO,IAAI,MAAM,IAAI,UAAU,EAAE,GAAG,MAAM,CAAC;AACtG;AAEO,SAAS,iBAAiB,KAAwB;AAIvD,SAAO,KAAK,UAAU,KAAK,MAAM,CAAC;AACpC;AAGO,SAAS,kBAAkB,KAAyB;AACzD,SAAO,KAAK,UAAU,KAAK,MAAM,CAAC;AACpC;AAEO,SAAS,iBAAiB,KAAwB;AAGvD,QAAM,QAAQ,CAAC,SACb,KAAK,IAAI,CAAC,EAAE,YAAY,SAAS,GAAG,QAAQ,MAAM,OAAO;AAC3D,QAAM,QAAQ,IAAI,MAAM,IAAI,CAAC,UAAU;AAAA,IACrC,GAAG;AAAA,IACH,WAAW,MAAM,KAAK,SAAS;AAAA,IAC/B,SAAS,MAAM,KAAK,OAAO;AAAA,EAC7B,EAAE;AACF,SAAO,KAAK,UAAU,EAAE,GAAG,KAAK,MAAM,GAAG,MAAM,CAAC;AAClD;","names":[]}
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  PROJECT_RULES_FILENAMES,
4
- extractEvals,
5
4
  listInTree,
6
5
  safeRead,
7
6
  segments
8
- } from "./chunk-APAF4VWW.js";
7
+ } from "./chunk-YUCH6WJY.js";
8
+ import {
9
+ extractEvals
10
+ } from "./chunk-QJGPOFNB.js";
9
11
  import {
10
12
  TracevalsError
11
13
  } from "./chunk-ZINZTHWO.js";
@@ -171,4 +173,4 @@ async function discoverArtifacts(options) {
171
173
  export {
172
174
  discoverArtifacts
173
175
  };
174
- //# sourceMappingURL=chunk-P7HAXMFN.js.map
176
+ //# sourceMappingURL=chunk-I4KDAO6P.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tracevals/artifacts/discover.ts"],"sourcesContent":["/**\n * Static artifact discovery: find every skill, agent definition, and\n * project-rules file in a project without a trace.\n *\n * This is the inverse of `resolveArtifacts`, which maps names a trace *used*\n * onto files. Authoring (`manni tracevals fill`) needs the whole population instead,\n * including artifacts no session has exercised yet.\n *\n * Scope is deliberately the project only — never the user's `~/.claude` or the\n * plugin store, which hold third-party files that are not this project's to\n * edit.\n */\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport { stat } from \"node:fs/promises\";\nimport picomatch from \"picomatch\";\nimport type { ExtractedMetadata } from \"../../meta/index.js\";\nimport { extractEvals } from \"../evals/extract.js\";\nimport { TracevalsError } from \"../types.js\";\nimport { listInTree, safeRead, segments } from \"./fs.js\";\nimport { PROJECT_RULES_FILENAMES } from \"./resolve.js\";\nimport type { ArtifactType, ResolvedArtifact } from \"./types.js\";\n\nexport interface DiscoveredArtifact {\n artifact: ResolvedArtifact;\n /**\n * `ok` — frontmatter parsed; `unreadable` — the YAML itself is malformed;\n * `invalid` — a `metadata.evals` block that fails the published schema.\n * Only `ok` artifacts are safe to propose against.\n */\n status: \"ok\" | \"unreadable\" | \"invalid\";\n /** Criterion names already declared, for dedupe and cache keying. */\n existingNames: string[];\n /** The artifact opted out via `metadata.evals.skip`. */\n skip: boolean;\n error?: string;\n}\n\nexport interface DiscoveryResult {\n artifacts: DiscoveredArtifact[];\n warnings: string[];\n}\n\nexport interface DiscoverOptions {\n /** Project root to scan. */\n root: string;\n /**\n * Explicit files or directories. A file is taken as an artifact regardless\n * of naming convention; a directory is scanned. Defaults to scanning `root`.\n * Relative entries resolve against `cwd`, like any CLI path argument.\n */\n paths?: string[];\n /** Base for relative `paths`; defaults to the process working directory. */\n cwd?: string;\n /**\n * `--exclude <glob>`, repeatable and never split on commas. Applied to\n * everything the scan found — an explicitly named file as much as a walked\n * directory — so one flag means the same thing however the artifact was\n * reached.\n */\n exclude?: string[];\n /**\n * The artifact's front matter as the run reads it: its own, or its own with a\n * manifest-supplied `metadata` block merged in (`evals/external.ts`). Without\n * it a relocated artifact looks empty here, and `fill` would propose evals it\n * already declares. Absent when no collection declares such a manifest.\n */\n metadataFor?: (artifact: ResolvedArtifact) => Promise<ExtractedMetadata | undefined>;\n}\n\n/**\n * Whether `path` is excluded by any of `globs`.\n *\n * Matched against the path as the user would write it, relative to `cwd` with\n * posix separators, so an exclude written against `test/fixtures` reads the\n * same on Windows as on Linux. A target outside `cwd` has no such spelling,\n * so the absolute posix path is offered too rather than a `../../` one no\n * glob would be written against.\n */\nfunction excluder(\n globs: readonly string[] | undefined,\n cwd: string,\n): (path: string) => boolean {\n if (globs === undefined || globs.length === 0) return () => false;\n const isMatch = picomatch([...globs], { dot: true });\n return (path) => {\n const posix = resolve(path).split(sep).join(\"/\");\n const rel = relative(cwd, resolve(path)).split(sep).join(\"/\");\n const inside = rel !== \"\" && !rel.startsWith(\"../\") && !isAbsolute(rel);\n return isMatch(posix) || (inside && isMatch(rel));\n };\n}\n\nconst SKILL_DIRS = [\"skills\", join(\"src\", \"skills\"), join(\".claude\", \"skills\")];\nconst RULES_NAMES = new Set<string>(PROJECT_RULES_FILENAMES);\n\n/** Path segments, separator-normalized, for convention matching. */\n/** Which artifact type a path represents by convention, if any. */\nfunction classify(path: string): ArtifactType | undefined {\n const name = basename(path);\n if (RULES_NAMES.has(name)) return \"project-rules\";\n if (name === \"SKILL.md\") return \"skill\";\n if (!name.endsWith(\".md\")) return undefined;\n // Candidates only — `isRecognizedSlashCommand` and `isRecognizedAgent`\n // decide whether this particular directory is one the resolver would ever\n // look in. Commands nest (an organizing subdirectory does not rename the\n // command), so any `commands` ancestor is a candidate; agents do not.\n if (segments(dirname(path)).includes(\"commands\")) return \"slash-command\";\n if (segments(dirname(path)).at(-1) === \"agents\") return \"agent\";\n return undefined;\n}\n\n/**\n * `path` split into segments relative to `anchor`, or null when it escapes.\n * Slicing by prefix length silently mangles paths that are not underneath the\n * anchor, so relative() does the work.\n */\nfunction relativeSegments(anchor: string, path: string): string[] | null {\n const rel = relative(resolve(anchor), resolve(path));\n if (rel === \"\" || rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return segments(rel);\n}\n\n/**\n * Artifact name as the rest of the system refers to it: a skill by its\n * directory, an agent by its filename stem, project rules by filename.\n */\nfunction nameFor(type: ArtifactType, path: string): string {\n if (type === \"skill\") return segments(dirname(path)).at(-1) ?? basename(path);\n // A slash command is referenced by its filename stem with the leading slash\n // stripped, and an organizing subdirectory does not enter the name — so\n // `commands/release/tag.md` is `tag`, the same string the trace records.\n if (type === \"agent\" || type === \"slash-command\") {\n return basename(path).replace(/\\.md$/, \"\");\n }\n return basename(path);\n}\n\n/**\n * Slash commands live in `.claude/commands/` at any depth — the only place\n * `resolveArtifacts` looks for a project command, so discovery and resolution\n * agree on the same population.\n *\n * Deliberately narrow, for the reason `isRecognizedAgent` is: `fill` writes by\n * default, and matching any directory named `commands` would classify a docs\n * page about a CLI as an instruction artifact and edit it.\n */\nfunction isRecognizedSlashCommand(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n // Any `.claude/commands/` pair, not the first segment that happens to be\n // named \"commands\": a project with a top-level `commands/` directory would\n // otherwise fail the `at >= 1` test and have its real command files rejected.\n return parts.some(\n (part, at) =>\n part === \"commands\" &&\n at >= 1 &&\n parts[at - 1] === \".claude\" &&\n at < parts.length - 1,\n );\n}\n\n/** A skill file must sit as `<skillsDir>/<skillName>/SKILL.md`. */\nfunction isRecognizedSkill(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n return SKILL_DIRS.some((dir) => {\n const want = segments(dir);\n const at = parts.length - want.length - 2;\n if (at < 0) return false;\n return want.every((part, i) => parts[at + i] === part);\n });\n}\n\n/**\n * Agent definitions live in `.claude/agents/` at any depth, or in `agents/`\n * directly at the project root — the two places `resolveArtifacts` looks.\n *\n * This is deliberately narrow. Matching any directory named `agents` would\n * classify ordinary prose in `docs/agents/` as an agent definition, and `fill`\n * writes by default, so the mistake would edit unrelated files.\n */\nfunction isRecognizedAgent(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n if (parts.length === 2 && parts[0] === \"agents\") return true;\n return (\n parts.length >= 3 &&\n parts.at(-3) === \".claude\" &&\n parts.at(-2) === \"agents\"\n );\n}\n\nasync function readOne(\n path: string,\n type: ArtifactType,\n metadataFor?: DiscoverOptions[\"metadataFor\"],\n): Promise<DiscoveredArtifact | null> {\n const content = await safeRead(path);\n if (content === null) return null;\n const artifact: ResolvedArtifact = {\n name: nameFor(type, path),\n type,\n path,\n content,\n origin: \"project\",\n };\n\n try {\n const extracted = extractEvals(artifact, await metadataFor?.(artifact));\n if (extracted.errors.length > 0) {\n const first = extracted.errors[0];\n return {\n artifact,\n status: \"invalid\",\n existingNames: [],\n skip: false,\n error: `metadata.evals is invalid: ${first?.message ?? \"schema error\"}`,\n };\n }\n return {\n artifact,\n status: \"ok\",\n existingNames: extracted.evals.map((e) => e.id),\n skip: extracted.skip,\n };\n } catch (err) {\n // A manifest that cannot be read, or an artifact two collections both keep\n // `metadata` for, is the run's problem rather than this artifact's.\n if (err instanceof TracevalsError) throw err;\n // docmeta throws on malformed YAML. A half-written artifact must not take\n // down a scan of the whole project.\n return {\n artifact,\n status: \"unreadable\",\n existingNames: [],\n skip: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n}\n\nexport async function discoverArtifacts(\n options: DiscoverOptions,\n): Promise<DiscoveryResult> {\n const root = resolve(options.root);\n const warnings: string[] = [];\n const cwd = options.cwd ?? process.cwd();\n const targets = options.paths?.length\n ? options.paths.map((p) => (isAbsolute(p) ? p : resolve(cwd, p)))\n : [root];\n\n const files = new Map<string, ArtifactType>();\n\n for (const target of targets) {\n let info;\n try {\n info = await stat(target);\n } catch {\n throw new TracevalsError(`no such file or directory: ${target}`);\n }\n\n if (info.isFile()) {\n // An explicit file is taken at its word; convention only supplies the\n // type, and an unrecognized name is treated as project rules.\n files.set(target, classify(target) ?? \"project-rules\");\n continue;\n }\n\n // Convention is anchored at the directory being scanned, so\n // `fill packages/api` treats that package as its own project rather than\n // silently finding nothing.\n const found = await listInTree(target, (path) => {\n const type = classify(path);\n if (type === undefined) return false;\n if (type === \"skill\") return isRecognizedSkill(path, target);\n if (type === \"agent\") return isRecognizedAgent(path, target);\n if (type === \"slash-command\") {\n return isRecognizedSlashCommand(path, target);\n }\n return true;\n });\n for (const path of found) {\n const type = classify(path);\n if (type !== undefined) files.set(path, type);\n }\n }\n\n // After the walk rather than inside it: a `--exclude` is about the artifact\n // set, and applying it to directory names during the walk would make\n // `**/fixtures/**` and `**/fixtures` mean different things.\n const excluded = excluder(options.exclude, cwd);\n for (const path of [...files.keys()]) {\n if (excluded(path)) files.delete(path);\n }\n\n const artifacts: DiscoveredArtifact[] = [];\n for (const [path, type] of files) {\n const discovered = await readOne(path, type, options.metadataFor);\n if (discovered === null) {\n warnings.push(`could not read ${path}`);\n continue;\n }\n if (discovered.status !== \"ok\") {\n warnings.push(`${path}: ${discovered.error ?? discovered.status}`);\n }\n artifacts.push(discovered);\n }\n return { artifacts, warnings };\n}\n"],"mappings":";;;;;;;;;;;;;AAYA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,OAAO,eAAe;AAgEtB,SAAS,SACP,OACA,KAC2B;AAC3B,MAAI,UAAU,UAAa,MAAM,WAAW,EAAG,QAAO,MAAM;AAC5D,QAAM,UAAU,UAAU,CAAC,GAAG,KAAK,GAAG,EAAE,KAAK,KAAK,CAAC;AACnD,SAAO,CAAC,SAAS;AACf,UAAM,QAAQ,QAAQ,IAAI,EAAE,MAAM,GAAG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B,MAAM,MAAM;AAAA,MAC9C;AACA,aAAO;AAAA,IACT,CAAC;AACD,eAAW,QAAQ,OAAO;AACxB,YAAM,OAAO,SAAS,IAAI;AAC1B,UAAI,SAAS,OAAW,OAAM,IAAI,MAAM,IAAI;AAAA,IAC9C;AAAA,EACF;AAKA,QAAM,WAAW,SAAS,QAAQ,SAAS,GAAG;AAC9C,aAAW,QAAQ,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG;AACpC,QAAI,SAAS,IAAI,EAAG,OAAM,OAAO,IAAI;AAAA,EACvC;AAEA,QAAM,YAAkC,CAAC;AACzC,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO;AAChC,UAAM,aAAa,MAAM,QAAQ,MAAM,MAAM,QAAQ,WAAW;AAChE,QAAI,eAAe,MAAM;AACvB,eAAS,KAAK,kBAAkB,IAAI,EAAE;AACtC;AAAA,IACF;AACA,QAAI,WAAW,WAAW,MAAM;AAC9B,eAAS,KAAK,GAAG,IAAI,KAAK,WAAW,SAAS,WAAW,MAAM,EAAE;AAAA,IACnE;AACA,cAAU,KAAK,UAAU;AAAA,EAC3B;AACA,SAAO,EAAE,WAAW,SAAS;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../src/tracevals/artifacts/discover.ts"],"sourcesContent":["/**\n * Static artifact discovery: find every skill, agent definition, and\n * project-rules file in a project without a trace.\n *\n * This is the inverse of `resolveArtifacts`, which maps names a trace *used*\n * onto files. Authoring (`manni tracevals fill`) needs the whole population instead,\n * including artifacts no session has exercised yet.\n *\n * Scope is deliberately the project only — never the user's `~/.claude` or the\n * plugin store, which hold third-party files that are not this project's to\n * edit.\n */\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport { stat } from \"node:fs/promises\";\nimport picomatch from \"picomatch\";\nimport type { ExtractedMetadata } from \"../../meta/index.js\";\nimport { extractEvals } from \"../evals/extract.js\";\nimport { TracevalsError } from \"../types.js\";\nimport { listInTree, safeRead, segments } from \"./fs.js\";\nimport { PROJECT_RULES_FILENAMES } from \"./resolve.js\";\nimport type { ArtifactType, ResolvedArtifact } from \"./types.js\";\n\nexport interface DiscoveredArtifact {\n artifact: ResolvedArtifact;\n /**\n * `ok` — frontmatter parsed; `unreadable` — the YAML itself is malformed;\n * `invalid` — a `metadata.evals` block that fails the published schema.\n * Only `ok` artifacts are safe to propose against.\n */\n status: \"ok\" | \"unreadable\" | \"invalid\";\n /** Criterion names already declared, for dedupe and cache keying. */\n existingNames: string[];\n /** The artifact opted out via `metadata.evals.skip`. */\n skip: boolean;\n error?: string;\n}\n\nexport interface DiscoveryResult {\n artifacts: DiscoveredArtifact[];\n warnings: string[];\n}\n\nexport interface DiscoverOptions {\n /** Project root to scan. */\n root: string;\n /**\n * Explicit files or directories. A file is taken as an artifact regardless\n * of naming convention; a directory is scanned. Defaults to scanning `root`.\n * Relative entries resolve against `cwd`, like any CLI path argument.\n */\n paths?: string[];\n /** Base for relative `paths`; defaults to the process working directory. */\n cwd?: string;\n /**\n * `--exclude <glob>`, repeatable and never split on commas. Applied to\n * everything the scan found — an explicitly named file as much as a walked\n * directory — so one flag means the same thing however the artifact was\n * reached.\n */\n exclude?: string[];\n /**\n * The artifact's front matter as the run reads it: its own, or its own with a\n * manifest-supplied `metadata` block merged in (`evals/external.ts`). Without\n * it a relocated artifact looks empty here, and `fill` would propose evals it\n * already declares. Absent when no collection declares such a manifest.\n */\n metadataFor?: (artifact: ResolvedArtifact) => Promise<ExtractedMetadata | undefined>;\n}\n\n/**\n * Whether `path` is excluded by any of `globs`.\n *\n * Matched against the path as the user would write it, relative to `cwd` with\n * posix separators, so an exclude written against `test/fixtures` reads the\n * same on Windows as on Linux. A target outside `cwd` has no such spelling,\n * so the absolute posix path is offered too rather than a `../../` one no\n * glob would be written against.\n */\nfunction excluder(\n globs: readonly string[] | undefined,\n cwd: string,\n): (path: string) => boolean {\n if (globs === undefined || globs.length === 0) return () => false;\n const isMatch = picomatch([...globs], { dot: true });\n return (path) => {\n const posix = resolve(path).split(sep).join(\"/\");\n const rel = relative(cwd, resolve(path)).split(sep).join(\"/\");\n const inside = rel !== \"\" && !rel.startsWith(\"../\") && !isAbsolute(rel);\n return isMatch(posix) || (inside && isMatch(rel));\n };\n}\n\nconst SKILL_DIRS = [\"skills\", join(\"src\", \"skills\"), join(\".claude\", \"skills\")];\nconst RULES_NAMES = new Set<string>(PROJECT_RULES_FILENAMES);\n\n/** Path segments, separator-normalized, for convention matching. */\n/** Which artifact type a path represents by convention, if any. */\nfunction classify(path: string): ArtifactType | undefined {\n const name = basename(path);\n if (RULES_NAMES.has(name)) return \"project-rules\";\n if (name === \"SKILL.md\") return \"skill\";\n if (!name.endsWith(\".md\")) return undefined;\n // Candidates only — `isRecognizedSlashCommand` and `isRecognizedAgent`\n // decide whether this particular directory is one the resolver would ever\n // look in. Commands nest (an organizing subdirectory does not rename the\n // command), so any `commands` ancestor is a candidate; agents do not.\n if (segments(dirname(path)).includes(\"commands\")) return \"slash-command\";\n if (segments(dirname(path)).at(-1) === \"agents\") return \"agent\";\n return undefined;\n}\n\n/**\n * `path` split into segments relative to `anchor`, or null when it escapes.\n * Slicing by prefix length silently mangles paths that are not underneath the\n * anchor, so relative() does the work.\n */\nfunction relativeSegments(anchor: string, path: string): string[] | null {\n const rel = relative(resolve(anchor), resolve(path));\n if (rel === \"\" || rel.startsWith(\"..\") || isAbsolute(rel)) return null;\n return segments(rel);\n}\n\n/**\n * Artifact name as the rest of the system refers to it: a skill by its\n * directory, an agent by its filename stem, project rules by filename.\n */\nfunction nameFor(type: ArtifactType, path: string): string {\n if (type === \"skill\") return segments(dirname(path)).at(-1) ?? basename(path);\n // A slash command is referenced by its filename stem with the leading slash\n // stripped, and an organizing subdirectory does not enter the name — so\n // `commands/release/tag.md` is `tag`, the same string the trace records.\n if (type === \"agent\" || type === \"slash-command\") {\n return basename(path).replace(/\\.md$/, \"\");\n }\n return basename(path);\n}\n\n/**\n * Slash commands live in `.claude/commands/` at any depth — the only place\n * `resolveArtifacts` looks for a project command, so discovery and resolution\n * agree on the same population.\n *\n * Deliberately narrow, for the reason `isRecognizedAgent` is: `fill` writes by\n * default, and matching any directory named `commands` would classify a docs\n * page about a CLI as an instruction artifact and edit it.\n */\nfunction isRecognizedSlashCommand(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n // Any `.claude/commands/` pair, not the first segment that happens to be\n // named \"commands\": a project with a top-level `commands/` directory would\n // otherwise fail the `at >= 1` test and have its real command files rejected.\n return parts.some(\n (part, at) =>\n part === \"commands\" &&\n at >= 1 &&\n parts[at - 1] === \".claude\" &&\n at < parts.length - 1,\n );\n}\n\n/** A skill file must sit as `<skillsDir>/<skillName>/SKILL.md`. */\nfunction isRecognizedSkill(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n return SKILL_DIRS.some((dir) => {\n const want = segments(dir);\n const at = parts.length - want.length - 2;\n if (at < 0) return false;\n return want.every((part, i) => parts[at + i] === part);\n });\n}\n\n/**\n * Agent definitions live in `.claude/agents/` at any depth, or in `agents/`\n * directly at the project root — the two places `resolveArtifacts` looks.\n *\n * This is deliberately narrow. Matching any directory named `agents` would\n * classify ordinary prose in `docs/agents/` as an agent definition, and `fill`\n * writes by default, so the mistake would edit unrelated files.\n */\nfunction isRecognizedAgent(path: string, anchor: string): boolean {\n const parts = relativeSegments(anchor, path);\n if (parts === null) return false;\n if (parts.length === 2 && parts[0] === \"agents\") return true;\n return (\n parts.length >= 3 &&\n parts.at(-3) === \".claude\" &&\n parts.at(-2) === \"agents\"\n );\n}\n\nasync function readOne(\n path: string,\n type: ArtifactType,\n metadataFor?: DiscoverOptions[\"metadataFor\"],\n): Promise<DiscoveredArtifact | null> {\n const content = await safeRead(path);\n if (content === null) return null;\n const artifact: ResolvedArtifact = {\n name: nameFor(type, path),\n type,\n path,\n content,\n origin: \"project\",\n };\n\n try {\n const extracted = extractEvals(artifact, await metadataFor?.(artifact));\n if (extracted.errors.length > 0) {\n const first = extracted.errors[0];\n return {\n artifact,\n status: \"invalid\",\n existingNames: [],\n skip: false,\n error: `metadata.evals is invalid: ${first?.message ?? \"schema error\"}`,\n };\n }\n return {\n artifact,\n status: \"ok\",\n existingNames: extracted.evals.map((e) => e.id),\n skip: extracted.skip,\n };\n } catch (err) {\n // A manifest that cannot be read, or an artifact two collections both keep\n // `metadata` for, is the run's problem rather than this artifact's.\n if (err instanceof TracevalsError) throw err;\n // docmeta throws on malformed YAML. A half-written artifact must not take\n // down a scan of the whole project.\n return {\n artifact,\n status: \"unreadable\",\n existingNames: [],\n skip: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n}\n\nexport async function discoverArtifacts(\n options: DiscoverOptions,\n): Promise<DiscoveryResult> {\n const root = resolve(options.root);\n const warnings: string[] = [];\n const cwd = options.cwd ?? process.cwd();\n const targets = options.paths?.length\n ? options.paths.map((p) => (isAbsolute(p) ? p : resolve(cwd, p)))\n : [root];\n\n const files = new Map<string, ArtifactType>();\n\n for (const target of targets) {\n let info;\n try {\n info = await stat(target);\n } catch {\n throw new TracevalsError(`no such file or directory: ${target}`);\n }\n\n if (info.isFile()) {\n // An explicit file is taken at its word; convention only supplies the\n // type, and an unrecognized name is treated as project rules.\n files.set(target, classify(target) ?? \"project-rules\");\n continue;\n }\n\n // Convention is anchored at the directory being scanned, so\n // `fill packages/api` treats that package as its own project rather than\n // silently finding nothing.\n const found = await listInTree(target, (path) => {\n const type = classify(path);\n if (type === undefined) return false;\n if (type === \"skill\") return isRecognizedSkill(path, target);\n if (type === \"agent\") return isRecognizedAgent(path, target);\n if (type === \"slash-command\") {\n return isRecognizedSlashCommand(path, target);\n }\n return true;\n });\n for (const path of found) {\n const type = classify(path);\n if (type !== undefined) files.set(path, type);\n }\n }\n\n // After the walk rather than inside it: a `--exclude` is about the artifact\n // set, and applying it to directory names during the walk would make\n // `**/fixtures/**` and `**/fixtures` mean different things.\n const excluded = excluder(options.exclude, cwd);\n for (const path of [...files.keys()]) {\n if (excluded(path)) files.delete(path);\n }\n\n const artifacts: DiscoveredArtifact[] = [];\n for (const [path, type] of files) {\n const discovered = await readOne(path, type, options.metadataFor);\n if (discovered === null) {\n warnings.push(`could not read ${path}`);\n continue;\n }\n if (discovered.status !== \"ok\") {\n warnings.push(`${path}: ${discovered.error ?? discovered.status}`);\n }\n artifacts.push(discovered);\n }\n return { artifacts, warnings };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,OAAO,eAAe;AAgEtB,SAAS,SACP,OACA,KAC2B;AAC3B,MAAI,UAAU,UAAa,MAAM,WAAW,EAAG,QAAO,MAAM;AAC5D,QAAM,UAAU,UAAU,CAAC,GAAG,KAAK,GAAG,EAAE,KAAK,KAAK,CAAC;AACnD,SAAO,CAAC,SAAS;AACf,UAAM,QAAQ,QAAQ,IAAI,EAAE,MAAM,GAAG,EAAE,KAAK,GAAG;AAC/C,UAAM,MAAM,SAAS,KAAK,QAAQ,IAAI,CAAC,EAAE,MAAM,GAAG,EAAE,KAAK,GAAG;AAC5D,UAAM,SAAS,QAAQ,MAAM,CAAC,IAAI,WAAW,KAAK,KAAK,CAAC,WAAW,GAAG;AACtE,WAAO,QAAQ,KAAK,KAAM,UAAU,QAAQ,GAAG;AAAA,EACjD;AACF;AAEA,IAAM,aAAa,CAAC,UAAU,KAAK,OAAO,QAAQ,GAAG,KAAK,WAAW,QAAQ,CAAC;AAC9E,IAAM,cAAc,IAAI,IAAY,uBAAuB;AAI3D,SAAS,SAAS,MAAwC;AACxD,QAAM,OAAO,SAAS,IAAI;AAC1B,MAAI,YAAY,IAAI,IAAI,EAAG,QAAO;AAClC,MAAI,SAAS,WAAY,QAAO;AAChC,MAAI,CAAC,KAAK,SAAS,KAAK,EAAG,QAAO;AAKlC,MAAI,SAAS,QAAQ,IAAI,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AS,KAAK,GAAG,IAAI,KAAK,WAAW,SAAS,WAAW,MAAM,EAAE;AAAA,IACnE;AACA,cAAU,KAAK,UAAU;AAAA,EAC3B;AACA,SAAO,EAAE,WAAW,SAAS;AAC/B;","names":[]}
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/strategy/types.ts
4
+ var PAGE_FIELDS = {
5
+ audience: "audiences",
6
+ persona: "personas",
7
+ journey: "journeys"
8
+ };
9
+ var PARENTS = { persona: "audience", journey: "personas" };
10
+ var STRATEGY_RULES = [
11
+ "undefined-reference",
12
+ "duplicate-id",
13
+ "missing-parent",
14
+ "orphan-record",
15
+ "unserved-journey",
16
+ "unused-record",
17
+ "broken-step",
18
+ "stale-step",
19
+ "missing-journey",
20
+ "unwritten-step"
21
+ ];
22
+
23
+ export {
24
+ PAGE_FIELDS,
25
+ PARENTS,
26
+ STRATEGY_RULES
27
+ };
28
+ //# sourceMappingURL=chunk-INOVEO32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/strategy/types.ts"],"sourcesContent":["/**\n * The strategy domain's records, references, findings and config (proposal\n * 0102). A record is a page declaring `type: audience`, `type: persona` or\n * `type: journey`. A reference is a value of a page's `audiences:`,\n * `personas:` or `journeys:`, read through meta's merged view so a value in a\n * `{page}.meta.yaml` counts. A journey's own `personas:` is its parent field,\n * not a reference.\n */\nimport type { Guidance } from \"../shared/guidance.js\";\nimport type { ConfigFile } from \"../shared/config-file.js\";\nimport type { CollectionConfig } from \"../shared/collections.js\";\nimport type { Severity } from \"../shared/severity.js\";\nimport { RECORD_TYPES, type RecordField, type RecordType } from \"../shared/reference-fields.js\";\n\n/** The three record types, parent first, from `src/shared/reference-fields.ts`. */\nexport { RECORD_TYPES, type RecordType };\n\n/** The page field that names records of each type. Each is a key of `RECORD_FIELDS`. */\nexport const PAGE_FIELDS = {\n audience: \"audiences\",\n persona: \"personas\",\n journey: \"journeys\",\n} as const satisfies Record<RecordType, RecordField>;\nexport type PageField = (typeof PAGE_FIELDS)[RecordType];\n\n/**\n * The field a record names its parents in: a persona's `audience:`, a\n * journey's `personas:`. Either holds one string or a list.\n */\nexport const PARENTS = { persona: \"audience\", journey: \"personas\" } as const satisfies Record<\n Exclude<RecordType, \"audience\">,\n RecordField\n>;\nexport type ChildType = keyof typeof PARENTS;\nexport type ParentField = (typeof PARENTS)[ChildType];\n\n/** Every field whose value names a record. */\nexport type ReferenceField = PageField | ParentField;\n\n/** Every rule `strategy check` reports, in the order the rules page lists them. */\nexport const STRATEGY_RULES = [\n \"undefined-reference\",\n \"duplicate-id\",\n \"missing-parent\",\n \"orphan-record\",\n \"unserved-journey\",\n \"unused-record\",\n \"broken-step\",\n \"stale-step\",\n \"missing-journey\",\n \"unwritten-step\",\n] as const;\nexport type StrategyRule = (typeof STRATEGY_RULES)[number];\n\n/** A rule's level: the family scale plus `off`, which drops the rule's findings. */\nexport type StrategySeverity = Severity | \"off\";\n\n/** A file, and the 1-based line in it when one is known. */\nexport interface At {\n file: string;\n line?: number;\n}\n\nexport interface StrategyRecord {\n /** `id:`, else the file stem. Compared case-folded. */\n id: string;\n type: RecordType;\n title?: string;\n description?: string;\n /** `lifecycle:`, from meta's `manni:lifecycle:1.0.0`. A `draft` or `archived` journey is exempt from `unserved-journey`. */\n lifecycle?: string;\n /** The page the record was read from, as the run labels it. */\n file: string;\n line: number;\n /** Where `id:` is declared, when the record declares one. */\n idAt?: At;\n /** The values of `audience:` on a persona or `personas:` on a journey, each where it is declared. Empty on an audience. */\n parents: (At & { value: string })[];\n /** A journey's `steps:`, when it carries at least one mapping. Never set on an audience or a persona. */\n steps?: StrategyStep[];\n}\n\n/**\n * One item of a journey's `steps:` (proposal 0106). A field that is not of\n * its type reads as absent; the shape is meta's to validate.\n */\nexport interface StrategyStep {\n /** The step's position in `steps:`, from 1. */\n n: number;\n stage?: string;\n doc?: string;\n exists?: boolean | \"partial\";\n note?: string;\n /** Where the step starts. */\n file: string;\n line?: number;\n docAt?: At;\n existsAt?: At;\n}\n\n/** What `strategy` makes of a step's `doc` and `exists`. */\nexport type StepState = \"served\" | \"unclaimed\" | \"partial\" | \"unwritten\" | \"broken\" | \"unchecked\";\n\nexport interface ResolvedStep extends StrategyStep {\n state: StepState;\n /** The page `doc` names, as a label of the run, when it names one. */\n page?: string;\n}\n\nexport interface StrategyReference {\n field: PageField;\n value: string;\n /** Where the value is declared: the page, or the manifest that supplied it. */\n file: string;\n line?: number;\n /** The page the value belongs to. */\n page: string;\n /** Whether that page is itself a record. A record's values are checked, never counted as a page naming. */\n record: boolean;\n}\n\nexport interface StrategySet {\n records: StrategyRecord[];\n references: StrategyReference[];\n /** The labels of the run's inputs that are not records: what a step's `doc` may name. Absent reads as none. */\n pages?: string[];\n}\n\nexport interface StrategyFinding {\n rule: StrategyRule;\n /** `manni:strategy/<rule>`. */\n ruleId: string;\n severity: Severity;\n /** What happened, then what to do about it. */\n message: string;\n /** The message before its advice: the baseline's identity. Never printed. */\n key?: string;\n guidance: Guidance;\n file: string;\n line?: number;\n /** The record the finding is about, when it is about one. */\n id?: string;\n /** The field that breaks the rule, when one does. */\n field?: ReferenceField | \"steps\";\n}\n\n/** The `strategy:` section. Every key is optional. */\nexport interface StrategyConfig {\n severity?: Partial<Record<StrategyRule, StrategySeverity>>;\n baseline?: string;\n allowEmpty?: boolean;\n respectGitignore?: boolean;\n}\n\n/** What every command core resolves before touching a file. */\nexport interface StrategyRun {\n config: StrategyConfig | null;\n /** The positional inputs, or the selected collections' `paths:`. */\n inputs: string[];\n /** Directory `inputs` resolve from: cwd for positional inputs, the config directory for collections. */\n base: string;\n collections: CollectionConfig[];\n fromCollections: boolean;\n configDir?: string;\n configPath?: string;\n configSource?: string;\n configFile?: ConfigFile;\n}\n"],"mappings":";;;AAkBO,IAAM,cAAc;AAAA,EACzB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AACX;AAOO,IAAM,UAAU,EAAE,SAAS,YAAY,SAAS,WAAW;AAW3D,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}